|
|
|
@ -27,6 +27,7 @@ import 'package:test_sa/views/widgets/status/gas_refill/gas_type.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../../controllers/localization/localization.dart';
|
|
|
|
|
import '../../../../models/enums/user_types.dart';
|
|
|
|
|
|
|
|
|
|
class RequestGasRefill extends StatefulWidget {
|
|
|
|
|
static const String id = "/request-gas-refill";
|
|
|
|
@ -227,24 +228,89 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
const ASubTitle("Expected Date Time"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
ADateTimePicker(
|
|
|
|
|
date: _gasRefillProvider.expectedDateTime,
|
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
onDateTimePicker: (date) {
|
|
|
|
|
_gasRefillProvider.expectedDateTime = date;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (_userProvider.user?.type == UsersTypes.normal_user)
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
const ASubTitle("Expected Date Time"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
ADateTimePicker(
|
|
|
|
|
date: _gasRefillProvider.expectedDateTime,
|
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
onDateTimePicker: (date) {
|
|
|
|
|
_gasRefillProvider.expectedDateTime = date;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (_userProvider.user?.type == UsersTypes.engineer)
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
const ASubTitle("Start of Work"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
ADateTimePicker(
|
|
|
|
|
date: _gasRefillProvider.startDate,
|
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
onDateTimePicker: (date) {
|
|
|
|
|
_gasRefillProvider.startDate = date;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
const ASubTitle("End of Work"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
ADateTimePicker(
|
|
|
|
|
date: _gasRefillProvider.endDate,
|
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
onDateTimePicker: (date) {
|
|
|
|
|
_gasRefillProvider.endDate = date;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (_userProvider.user?.type == UsersTypes.engineer) const SizedBox(height: 8),
|
|
|
|
|
if (_userProvider.user?.type == UsersTypes.engineer) ASubTitle(_subtitle.workingHours),
|
|
|
|
|
if (_userProvider.user?.type == UsersTypes.engineer) const SizedBox(height: 4),
|
|
|
|
|
if (_userProvider.user?.type == UsersTypes.engineer)
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: null,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
hintText: _gasRefillProvider.startDate == null
|
|
|
|
|
? "0"
|
|
|
|
|
: ((_gasRefillProvider.endDate?.difference(_gasRefillProvider.startDate)?.inMinutes ?? 0) / 60)?.toStringAsFixed(2)?.toString() ?? "0",
|
|
|
|
|
enable: false,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
validator: (value) => Validator.isNumeric(value) ? null : _subtitle.requiredWord,
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
// _serviceReport.workHours = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
Divider(color: Theme.of(context).colorScheme.primary),
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|