Merge remote-tracking branch 'origin/zaid_development_new' into majd_development_new

merge-requests/32/head
nextwo 1 year ago
commit 08484b4904

@ -96,8 +96,12 @@ class GasRefillProvider extends ChangeNotifier {
"token": user.token ?? "",
"building": {"id": building?.id, "name": building?.name, "value": building?.value},
"floor": {"id": floor.id, "name": floor.name, "value": floor.value},
"expectedDate": "2023-06-08T07:03:07.866Z",
"expectedTime": "2023-06-08T07:03:07.866Z",
if (expectedDateTime != null) "expectedDate": expectedDateTime,
if (expectedDateTime != null) "expectedTime": expectedDateTime,
if (startDate != null) "startDate": startDate,
if (startDate != null) "startTime": startDate,
if (endDate != null) "endDate": endDate,
if (endDate != null) "endTime": endDate,
"department": {"id": department.id, "departmentName": department.name, "departmentCode": "", "ntCode": ""},
"GazRefillNo": "GR-${DateTime.now().toString().split(" ").first}",
"status": model.status.toMap(),
@ -174,4 +178,6 @@ class GasRefillProvider extends ChangeNotifier {
Floors floor;
Departments department;
DateTime expectedDateTime;
DateTime startDate;
DateTime endDate;
}

@ -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),

Loading…
Cancel
Save