|
|
|
@ -22,6 +22,7 @@ import 'package:test_sa/providers/work_order/reason_provider.dart';
|
|
|
|
import 'package:test_sa/providers/work_order/vendor_provider.dart';
|
|
|
|
import 'package:test_sa/providers/work_order/vendor_provider.dart';
|
|
|
|
import 'package:test_sa/service_request_latest/request_detail_provider.dart';
|
|
|
|
import 'package:test_sa/service_request_latest/request_detail_provider.dart';
|
|
|
|
import 'package:test_sa/service_request_latest/views/components/action_button/footer_action_button.dart';
|
|
|
|
import 'package:test_sa/service_request_latest/views/components/action_button/footer_action_button.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/views/pages/user/requests/add_supplier_engineer_bottom_sheet.dart';
|
|
|
|
import 'package:test_sa/views/widgets/date_and_time/date_picker.dart';
|
|
|
|
import 'package:test_sa/views/widgets/date_and_time/date_picker.dart';
|
|
|
|
import 'package:test_sa/views/widgets/date_and_time/time_picker.dart';
|
|
|
|
import 'package:test_sa/views/widgets/date_and_time/time_picker.dart';
|
|
|
|
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
@ -42,262 +43,191 @@ class ExternalMaintenanceRequest extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
|
|
class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest> with TickerProviderStateMixin {
|
|
|
|
class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest> with TickerProviderStateMixin {
|
|
|
|
|
|
|
|
|
|
|
|
ServiceRequest? _request;
|
|
|
|
|
|
|
|
ServiceRequestsProvider ?_serviceRequestsProvider;
|
|
|
|
|
|
|
|
ServiceStatusProvider? _assetTypeProvider;
|
|
|
|
|
|
|
|
ServiceReport ?_serviceReport;
|
|
|
|
ServiceReport ?_serviceReport;
|
|
|
|
bool _isLoading = false;
|
|
|
|
|
|
|
|
int _selectedValue = 1;
|
|
|
|
|
|
|
|
final TextEditingController _workingHoursController = TextEditingController();
|
|
|
|
final TextEditingController _workingHoursController = TextEditingController();
|
|
|
|
|
|
|
|
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
final TextEditingController _faultController = TextEditingController();
|
|
|
|
|
|
|
|
final TextEditingController _workPreformedController = TextEditingController();
|
|
|
|
|
|
|
|
final TextEditingController _partQtyController = TextEditingController();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
_serviceReport = ServiceReport(
|
|
|
|
|
|
|
|
// returnToService: DateTime.now(),
|
|
|
|
|
|
|
|
// //type: const Lookup(value: 2),
|
|
|
|
|
|
|
|
// device: widget.request.device,
|
|
|
|
|
|
|
|
sparePartsWorkOrders: [],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
if (context.mounted) {
|
|
|
|
|
|
|
|
_request = Provider.of<ServiceRequestsProvider>(context, listen: false).currentSelectedRequest;
|
|
|
|
|
|
|
|
Provider.of<ServiceReportLastCallsProvider>(context, listen: false).reset();
|
|
|
|
|
|
|
|
Provider.of<ReasonProvider>(context, listen: false).reset();
|
|
|
|
|
|
|
|
Provider.of<ReasonProvider>(context, listen: false).serviceRequestId = _request?.id;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// _isLoading = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void dispose() {
|
|
|
|
|
|
|
|
_faultController.dispose();
|
|
|
|
|
|
|
|
_workPreformedController.dispose();
|
|
|
|
|
|
|
|
_partQtyController.dispose();
|
|
|
|
|
|
|
|
super.dispose();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void getRequestForWorkOrder() async {
|
|
|
|
|
|
|
|
_isLoading = true;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
_serviceReport?.callRequest = await _serviceRequestsProvider?.getCallRequestForWorkOrder(callId: _request?.id??'0');
|
|
|
|
|
|
|
|
await _assetTypeProvider?.getTypes();
|
|
|
|
|
|
|
|
_serviceReport?.assignedEmployee = _serviceReport?.callRequest?.assignedEmployee;
|
|
|
|
|
|
|
|
_serviceReport?.equipmentStatus = _serviceReport?.callRequest?.defectType;
|
|
|
|
|
|
|
|
_serviceReport?.serviceType = Lookup(id: 65, name: "Interval", value: 1); // default value in service type as in web
|
|
|
|
|
|
|
|
_isLoading = false;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
// _serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context);
|
|
|
|
|
|
|
|
// _assetTypeProvider = Provider.of<ServiceStatusProvider>(context);
|
|
|
|
|
|
|
|
// if (_serviceReport?.callRequest == null) {
|
|
|
|
|
|
|
|
// getRequestForWorkOrder();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// _serviceReport?.assetType = _assetTypeProvider?.statuses?.firstWhere(
|
|
|
|
|
|
|
|
// (element) => element.value == _serviceReport?.callRequest?.assetType,
|
|
|
|
|
|
|
|
// orElse: () => Lookup(),
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Consumer<RequestDetailProvider>(
|
|
|
|
return Consumer<RequestDetailProvider>(
|
|
|
|
builder: (context, RequestDetailProvider requestDetailProvider,child) {
|
|
|
|
builder: (context, RequestDetailProvider requestDetailProvider,child) {
|
|
|
|
return LoadingManager(
|
|
|
|
return Column(
|
|
|
|
isLoading: _isLoading,
|
|
|
|
children: [
|
|
|
|
isFailedLoading: false,
|
|
|
|
Form(
|
|
|
|
stateCode: 200,
|
|
|
|
key: _formKey,
|
|
|
|
onRefresh: () async {},
|
|
|
|
child: Column(
|
|
|
|
child: Stack(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
SingleChildScrollView(
|
|
|
|
SingleItemDropDownMenu<SupplierDetails, VendorProvider>(
|
|
|
|
child: Form(
|
|
|
|
context: context,
|
|
|
|
key: _formKey,
|
|
|
|
title: context.translation.supplier,
|
|
|
|
child: Column(
|
|
|
|
backgroundColor: AppColor.neutral100,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
initialValue: requestDetailProvider.activityMaintenanceHelperModel?.supplier,
|
|
|
|
|
|
|
|
showAsBottomSheet: true,
|
|
|
|
|
|
|
|
onSelect: (supplier) {
|
|
|
|
|
|
|
|
if (supplier != null) {
|
|
|
|
|
|
|
|
requestDetailProvider.activityMaintenanceHelperModel?.supplier=supplier;
|
|
|
|
|
|
|
|
print('engineer is ${supplier.suppPersons?.length}');
|
|
|
|
|
|
|
|
// _subWorkOrders.supplier = supplier;
|
|
|
|
|
|
|
|
// log(_subWorkOrders.supplier?.suppPersons?.map((e) => e.personName)?.toString());
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
//TODO replace with correct component..
|
|
|
|
SingleItemDropDownMenu<SuppPersons, NullableLoadingProvider>(
|
|
|
|
|
|
|
|
|
|
|
|
SingleItemDropDownMenu<SupplierDetails, VendorProvider>(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
title: context.translation.supplier,
|
|
|
|
backgroundColor: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.neutral40 : AppColor.neutral100,
|
|
|
|
initialValue: null,
|
|
|
|
title: context.translation.supplierEngineer,
|
|
|
|
|
|
|
|
enabled: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons?.isNotEmpty ?? false,
|
|
|
|
|
|
|
|
staticData:requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons,
|
|
|
|
showAsBottomSheet: true,
|
|
|
|
showAsBottomSheet: true,
|
|
|
|
onSelect: (supplier) {
|
|
|
|
initialValue: requestDetailProvider.activityMaintenanceHelperModel?.supEngineer == null ? null : SuppPersons.fromJson(requestDetailProvider.activityMaintenanceHelperModel?.supEngineer?.toJson()),
|
|
|
|
if (supplier != null) {
|
|
|
|
onSelect: (suppPerson) {
|
|
|
|
// _subWorkOrders.supplier = supplier;
|
|
|
|
print(suppPerson?.toJson());
|
|
|
|
// log(_subWorkOrders.supplier?.suppPersons?.map((e) => e.personName)?.toString());
|
|
|
|
if (suppPerson != null) {
|
|
|
|
|
|
|
|
requestDetailProvider.activityMaintenanceHelperModel?.supEngineer = SuppEngineerWorkOrders.fromJson(suppPerson.toJson());
|
|
|
|
|
|
|
|
requestDetailProvider.updateActivityMaintenanceHelperModel(requestDetailProvider.activityMaintenanceHelperModel);
|
|
|
|
|
|
|
|
// engineer = SuppEngineerWorkOrders(
|
|
|
|
|
|
|
|
// id: suppPerson?.supplierId,
|
|
|
|
|
|
|
|
// supplierContactId: suppPerson?.id,
|
|
|
|
|
|
|
|
// personName: suppPerson?.personName,
|
|
|
|
|
|
|
|
// contact: suppPerson?.contact,
|
|
|
|
|
|
|
|
// externalEngCode: suppPerson?.externalEngCode,
|
|
|
|
|
|
|
|
// email: suppPerson?.email,
|
|
|
|
|
|
|
|
// );
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
).expanded,
|
|
|
|
SingleItemDropDownMenu<Lookup, NullableLoadingProvider>(
|
|
|
|
8.width,
|
|
|
|
context: context,
|
|
|
|
Container(
|
|
|
|
height: 56.toScreenHeight,
|
|
|
|
height: 56.toScreenHeight,
|
|
|
|
title: context.translation.supplier,
|
|
|
|
width: 60.toScreenWidth,
|
|
|
|
showShadow: false,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.neutral40 : AppColor.neutral100,
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
|
|
|
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: Icon(
|
|
|
|
|
|
|
|
Icons.add,
|
|
|
|
|
|
|
|
color: context.isDark ? null : AppColor.neutral60,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
).onPress(requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null
|
|
|
|
|
|
|
|
? null
|
|
|
|
|
|
|
|
: () async {
|
|
|
|
|
|
|
|
SuppEngineerWorkOrders suppEngineer = (await showModalBottomSheet(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
useSafeArea: true,
|
|
|
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
|
|
|
builder: (context) => AddSupplierEngineerBottomSheet(requestDetailProvider.activityMaintenanceHelperModel!.supplier!.id!.toInt()),
|
|
|
|
|
|
|
|
)) as SuppEngineerWorkOrders;
|
|
|
|
|
|
|
|
requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons ??= [];
|
|
|
|
|
|
|
|
requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons?.add(SuppPersons.fromJson(suppEngineer.toJson()));
|
|
|
|
|
|
|
|
requestDetailProvider.activityMaintenanceHelperModel?.supEngineer = suppEngineer;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
ADatePicker(
|
|
|
|
|
|
|
|
label: context.translation.startTime,
|
|
|
|
|
|
|
|
hideShadow: true,
|
|
|
|
backgroundColor: AppColor.neutral100,
|
|
|
|
backgroundColor: AppColor.neutral100,
|
|
|
|
staticData: Provider.of<ServiceReportLastCallsProvider>(context).calls,
|
|
|
|
date: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime,
|
|
|
|
initialValue: _serviceReport?.calllastSituation,
|
|
|
|
formatDateWithTime: true,
|
|
|
|
onSelect: (status) {
|
|
|
|
onDatePicker: (selectedDate) {
|
|
|
|
_serviceReport?.calllastSituation = status;
|
|
|
|
showTimePicker(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
initialTime: TimeOfDay.now(),
|
|
|
|
|
|
|
|
).then((selectedTime) {
|
|
|
|
|
|
|
|
// Handle the selected date and time here.
|
|
|
|
|
|
|
|
if (selectedTime != null) {
|
|
|
|
|
|
|
|
DateTime selectedDateTime = DateTime(
|
|
|
|
|
|
|
|
selectedDate.year,
|
|
|
|
|
|
|
|
selectedDate.month,
|
|
|
|
|
|
|
|
selectedDate.day,
|
|
|
|
|
|
|
|
selectedTime.hour,
|
|
|
|
|
|
|
|
selectedTime.minute,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime = selectedDateTime;
|
|
|
|
|
|
|
|
requestDetailProvider.updateActivityMaintenanceHelperModel(requestDetailProvider.activityMaintenanceHelperModel);
|
|
|
|
|
|
|
|
assignWorkingHours(requestDetailProvider: requestDetailProvider);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
).expanded,
|
|
|
|
8.height,
|
|
|
|
8.width,
|
|
|
|
AppTextFormField(
|
|
|
|
ADatePicker(
|
|
|
|
labelText: context.translation.engineerName,
|
|
|
|
label: context.translation.endTime,
|
|
|
|
|
|
|
|
hideShadow: true,
|
|
|
|
backgroundColor: AppColor.neutral100,
|
|
|
|
backgroundColor: AppColor.neutral100,
|
|
|
|
initialValue: _serviceReport?.assignedEmployee?.name.toString(),
|
|
|
|
date: requestDetailProvider.activityMaintenanceHelperModel?.supplierEndTime,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
formatDateWithTime: true,
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
onDatePicker: (selectedDate) {
|
|
|
|
showShadow: false,
|
|
|
|
showTimePicker(
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
context: context,
|
|
|
|
),
|
|
|
|
initialTime: TimeOfDay.now(),
|
|
|
|
8.height,
|
|
|
|
).then((selectedTime) {
|
|
|
|
Row(
|
|
|
|
// Handle the selected date and time here.
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
if (selectedTime != null) {
|
|
|
|
children: [
|
|
|
|
DateTime selectedDateTime = DateTime(
|
|
|
|
ADatePicker(
|
|
|
|
selectedDate.year,
|
|
|
|
label: context.translation.startTime,
|
|
|
|
selectedDate.month,
|
|
|
|
hideShadow: true,
|
|
|
|
selectedDate.day,
|
|
|
|
backgroundColor: AppColor.neutral100,
|
|
|
|
selectedTime.hour,
|
|
|
|
date: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime,
|
|
|
|
selectedTime.minute,
|
|
|
|
formatDateWithTime: true,
|
|
|
|
);
|
|
|
|
onDatePicker: (selectedDate) {
|
|
|
|
if (requestDetailProvider.activityMaintenanceHelperModel!.supplierStartTime!=null&&selectedDateTime.isBefore(requestDetailProvider.activityMaintenanceHelperModel!.supplierStartTime!)) {
|
|
|
|
showTimePicker(
|
|
|
|
"End Date time must be greater then start date".showToast;
|
|
|
|
context: context,
|
|
|
|
return;
|
|
|
|
initialTime: TimeOfDay.now(),
|
|
|
|
}
|
|
|
|
).then((selectedTime) {
|
|
|
|
requestDetailProvider.activityMaintenanceHelperModel?.supplierEndTime = selectedDateTime;
|
|
|
|
// Handle the selected date and time here.
|
|
|
|
requestDetailProvider.updateActivityMaintenanceHelperModel(requestDetailProvider.activityMaintenanceHelperModel);
|
|
|
|
if (selectedTime != null) {
|
|
|
|
assignWorkingHours(requestDetailProvider: requestDetailProvider);
|
|
|
|
DateTime selectedDateTime = DateTime(
|
|
|
|
|
|
|
|
selectedDate.year,
|
|
|
|
}
|
|
|
|
selectedDate.month,
|
|
|
|
});
|
|
|
|
selectedDate.day,
|
|
|
|
},
|
|
|
|
selectedTime.hour,
|
|
|
|
).expanded,
|
|
|
|
selectedTime.minute,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime = selectedDateTime;
|
|
|
|
|
|
|
|
requestDetailProvider.updateActivityMaintenanceHelperModel(requestDetailProvider.activityMaintenanceHelperModel);
|
|
|
|
|
|
|
|
assignWorkingHours(requestDetailProvider: requestDetailProvider);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
).expanded,
|
|
|
|
|
|
|
|
8.width,
|
|
|
|
|
|
|
|
ADatePicker(
|
|
|
|
|
|
|
|
label: context.translation.endTime,
|
|
|
|
|
|
|
|
hideShadow: true,
|
|
|
|
|
|
|
|
backgroundColor: AppColor.neutral100,
|
|
|
|
|
|
|
|
date: requestDetailProvider.activityMaintenanceHelperModel?.supplierEndTime,
|
|
|
|
|
|
|
|
formatDateWithTime: true,
|
|
|
|
|
|
|
|
onDatePicker: (selectedDate) {
|
|
|
|
|
|
|
|
showTimePicker(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
initialTime: TimeOfDay.now(),
|
|
|
|
|
|
|
|
).then((selectedTime) {
|
|
|
|
|
|
|
|
// Handle the selected date and time here.
|
|
|
|
|
|
|
|
if (selectedTime != null) {
|
|
|
|
|
|
|
|
DateTime selectedDateTime = DateTime(
|
|
|
|
|
|
|
|
selectedDate.year,
|
|
|
|
|
|
|
|
selectedDate.month,
|
|
|
|
|
|
|
|
selectedDate.day,
|
|
|
|
|
|
|
|
selectedTime.hour,
|
|
|
|
|
|
|
|
selectedTime.minute,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (requestDetailProvider.activityMaintenanceHelperModel!.supplierStartTime!=null&&selectedDateTime.isBefore(requestDetailProvider.activityMaintenanceHelperModel!.supplierStartTime!)) {
|
|
|
|
|
|
|
|
"End Date time must be greater then start date".showToast;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
requestDetailProvider.activityMaintenanceHelperModel?.supplierEndTime = selectedDateTime;
|
|
|
|
|
|
|
|
requestDetailProvider.updateActivityMaintenanceHelperModel(requestDetailProvider.activityMaintenanceHelperModel);
|
|
|
|
|
|
|
|
assignWorkingHours(requestDetailProvider: requestDetailProvider);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
).expanded,
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
|
|
|
labelText: context.translation.workingHours,
|
|
|
|
|
|
|
|
backgroundColor: AppColor.neutral80,
|
|
|
|
|
|
|
|
controller: _workingHoursController,
|
|
|
|
|
|
|
|
suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16),
|
|
|
|
|
|
|
|
initialValue: requestDetailProvider.activityMaintenanceHelperModel?.supplierWorkingHour.toString(),
|
|
|
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
|
|
|
enable: false,
|
|
|
|
|
|
|
|
showShadow: false,
|
|
|
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
).toShadowContainer(context).paddingOnly(start: 16, end: 16, top: 12),
|
|
|
|
AppTextFormField(
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
labelText: context.translation.workingHours,
|
|
|
|
child: AppFilledButton(
|
|
|
|
backgroundColor: AppColor.neutral80,
|
|
|
|
label:context.translation.addExternalActivity, // Use the dynamic label
|
|
|
|
controller: _workingHoursController,
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16),
|
|
|
|
onPressed: () async {
|
|
|
|
initialValue:requestDetailProvider.activityMaintenanceHelperModel?.supplierWorkingHour!=null? requestDetailProvider.activityMaintenanceHelperModel?.supplierWorkingHour.toString():'',
|
|
|
|
// Handle button press
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
|
|
|
enable: false,
|
|
|
|
|
|
|
|
showShadow: false,
|
|
|
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
],
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
).toShadowContainer(context).paddingOnly(start: 16, end: 16, top: 12),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Widget repairLocationWidget(BuildContext context) {
|
|
|
|
|
|
|
|
return Row(
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
radioButtonWidget(label: context.translation.remotely, value: 1),
|
|
|
|
|
|
|
|
radioButtonWidget(label: context.translation.workshop, value: 2),
|
|
|
|
|
|
|
|
radioButtonWidget(label: context.translation.abroad, value: 3),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget radioButtonWidget({required String label, required dynamic value}) {
|
|
|
|
|
|
|
|
return Row(
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
width: 20.toScreenWidth,
|
|
|
|
|
|
|
|
height: 40.toScreenHeight,
|
|
|
|
|
|
|
|
//TODO use the type required according data..
|
|
|
|
|
|
|
|
child: Radio<int>(
|
|
|
|
|
|
|
|
activeColor: AppColor.primary10,
|
|
|
|
|
|
|
|
value: value,
|
|
|
|
|
|
|
|
groupValue: _selectedValue,
|
|
|
|
|
|
|
|
onChanged: (int? value) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
_selectedValue = value!;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.width,
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
label,
|
|
|
|
|
|
|
|
style: AppTextStyles.tinyFont.copyWith(color: AppColor.neutral120),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
13.width,
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int calculateWorkingHours(DateTime? startTime, DateTime? endTime) {
|
|
|
|
int calculateWorkingHours(DateTime? startTime, DateTime? endTime) {
|
|
|
|
if(startTime!=null&&endTime!=null){
|
|
|
|
if(startTime!=null&&endTime!=null){
|
|
|
|
Duration difference = endTime.difference(startTime);
|
|
|
|
Duration difference = endTime.difference(startTime);
|
|
|
|
|