ppm timer & receiver name fixed.

main_design2.0
Sikander Saleem 8 months ago
parent e2750094d9
commit caa1f975ab

@ -387,88 +387,92 @@ class Ppm {
String visitStatusName, String visitStatusName,
String warrantyEndDate, String warrantyEndDate,
TimerModel tbsTimer, TimerModel tbsTimer,
}) => }) {
Ppm( Ppm ppm = Ppm(
id: id ?? this.id, id: id ?? this.id,
ppmScheduleId: ppmScheduleId ?? this.ppmScheduleId, ppmScheduleId: ppmScheduleId ?? this.ppmScheduleId,
assetId: assetId ?? this.assetId, assetId: assetId ?? this.assetId,
jobSheetNo: jobSheetNo ?? this.jobSheetNo, jobSheetNo: jobSheetNo ?? this.jobSheetNo,
assignedEmployeeId: assignedEmployeeId ?? this.assignedEmployeeId, assignedEmployeeId: assignedEmployeeId ?? this.assignedEmployeeId,
expectedDate: expectedDate ?? this.expectedDate, expectedDate: expectedDate ?? this.expectedDate,
actualDate: actualDate ?? this.actualDate, actualDate: actualDate ?? this.actualDate,
nextDate: nextDate ?? this.nextDate, nextDate: nextDate ?? this.nextDate,
forwardToId: forwardToId ?? this.forwardToId, forwardToId: forwardToId ?? this.forwardToId,
maintenanceContractId: maintenanceContractId ?? this.maintenanceContractId, maintenanceContractId: maintenanceContractId ?? this.maintenanceContractId,
typeOfServiceId: typeOfServiceId ?? this.typeOfServiceId, typeOfServiceId: typeOfServiceId ?? this.typeOfServiceId,
executionTimeFrameId: executionTimeFrameId ?? this.executionTimeFrameId, executionTimeFrameId: executionTimeFrameId ?? this.executionTimeFrameId,
externalEngineer: externalEngineer ?? this.externalEngineer, externalEngineer: externalEngineer ?? this.externalEngineer,
telephone: telephone ?? this.telephone, telephone: telephone ?? this.telephone,
groupLeaderReviewId: groupLeaderReviewId ?? this.groupLeaderReviewId, groupLeaderReviewId: groupLeaderReviewId ?? this.groupLeaderReviewId,
timePeriodId: timePeriodId ?? this.timePeriodId, timePeriodId: timePeriodId ?? this.timePeriodId,
assignedToId: assignedToId ?? this.assignedToId, assignedToId: assignedToId ?? this.assignedToId,
vCalibrationTools: vCalibrationTools ?? this.vCalibrationTools, vCalibrationTools: vCalibrationTools ?? this.vCalibrationTools,
vKits: vKits ?? this.vKits, vKits: vKits ?? this.vKits,
vContacts: vContacts ?? this.vContacts, vContacts: vContacts ?? this.vContacts,
vChecklists: vChecklists ?? this.vChecklists, vChecklists: vChecklists ?? this.vChecklists,
files: files ?? this.files, files: files ?? this.files,
visitStatusId: visitStatusId ?? this.visitStatusId, visitStatusId: visitStatusId ?? this.visitStatusId,
startDate: startDate ?? this.startDate, startDate: startDate ?? this.startDate,
endDate: endDate ?? this.endDate, endDate: endDate ?? this.endDate,
workingHours: workingHours ?? this.workingHours, workingHours: workingHours ?? this.workingHours,
travelingHours: travelingHours ?? this.travelingHours, travelingHours: travelingHours ?? this.travelingHours,
deviceStatusId: deviceStatusId ?? this.deviceStatusId, deviceStatusId: deviceStatusId ?? this.deviceStatusId,
comments: comments ?? this.comments, comments: comments ?? this.comments,
workPerformed: workPerformed ?? this.workPerformed, workPerformed: workPerformed ?? this.workPerformed,
supplierId: supplierId ?? this.supplierId, supplierId: supplierId ?? this.supplierId,
suppPersonId: suppPersonId ?? this.suppPersonId, suppPersonId: suppPersonId ?? this.suppPersonId,
suppStartDate: suppStartDate ?? this.suppStartDate, suppStartDate: suppStartDate ?? this.suppStartDate,
suppEndDate: suppEndDate ?? this.suppEndDate, suppEndDate: suppEndDate ?? this.suppEndDate,
suppWorkingHours: suppWorkingHours ?? this.suppWorkingHours, suppWorkingHours: suppWorkingHours ?? this.suppWorkingHours,
taskStatusId: taskStatusId ?? this.taskStatusId, taskStatusId: taskStatusId ?? this.taskStatusId,
engSignature: engSignature ?? this.engSignature, engSignature: engSignature ?? this.engSignature,
nurseSignature: nurseSignature ?? this.nurseSignature, nurseSignature: nurseSignature ?? this.nurseSignature,
safetyId: safetyId ?? this.safetyId, safetyId: safetyId ?? this.safetyId,
assetAvailabilityId: assetAvailabilityId ?? this.assetAvailabilityId, assetAvailabilityId: assetAvailabilityId ?? this.assetAvailabilityId,
assetAvailabilityName: assetAvailabilityName ?? this.assetAvailabilityName, assetAvailabilityName: assetAvailabilityName ?? this.assetAvailabilityName,
assetName: assetName ?? this.assetName, assetName: assetName ?? this.assetName,
assetNumber: assetNumber ?? this.assetNumber, assetNumber: assetNumber ?? this.assetNumber,
assetSerialNo: assetSerialNo ?? this.assetSerialNo, assetSerialNo: assetSerialNo ?? this.assetSerialNo,
assetSupplierId: assetSupplierId ?? this.assetSupplierId, assetSupplierId: assetSupplierId ?? this.assetSupplierId,
assetSupplierName: assetSupplierName ?? this.assetSupplierName, assetSupplierName: assetSupplierName ?? this.assetSupplierName,
assignedEmployeeName: assignedEmployeeName ?? this.assignedEmployeeName, assignedEmployeeName: assignedEmployeeName ?? this.assignedEmployeeName,
assignedToName: assignedToName ?? this.assignedToName, assignedToName: assignedToName ?? this.assignedToName,
createdOn: createdOn ?? this.createdOn, createdOn: createdOn ?? this.createdOn,
departmentId: departmentId ?? this.departmentId, departmentId: departmentId ?? this.departmentId,
departmentName: departmentName ?? this.departmentName, departmentName: departmentName ?? this.departmentName,
deviceStatusName: deviceStatusName ?? this.deviceStatusName, deviceStatusName: deviceStatusName ?? this.deviceStatusName,
dueDate: dueDate ?? this.dueDate, dueDate: dueDate ?? this.dueDate,
executionTimeFrameName: executionTimeFrameName ?? this.executionTimeFrameName, executionTimeFrameName: executionTimeFrameName ?? this.executionTimeFrameName,
forwardToName: forwardToName ?? this.forwardToName, forwardToName: forwardToName ?? this.forwardToName,
manufacturerId: manufacturerId ?? this.manufacturerId, manufacturerId: manufacturerId ?? this.manufacturerId,
manufacturerName: manufacturerName ?? this.manufacturerName, manufacturerName: manufacturerName ?? this.manufacturerName,
modifiedOn: modifiedOn ?? this.modifiedOn, modifiedOn: modifiedOn ?? this.modifiedOn,
notified: notified ?? this.notified, notified: notified ?? this.notified,
planCode: planCode ?? this.planCode, planCode: planCode ?? this.planCode,
planNo: planNo ?? this.planNo, planNo: planNo ?? this.planNo,
ppmId: ppmId ?? this.ppmId, ppmId: ppmId ?? this.ppmId,
ppmScheduleCode: ppmScheduleCode ?? this.ppmScheduleCode, ppmScheduleCode: ppmScheduleCode ?? this.ppmScheduleCode,
ppmScheduleNo: ppmScheduleNo ?? this.ppmScheduleNo, ppmScheduleNo: ppmScheduleNo ?? this.ppmScheduleNo,
ppmSupplierId: ppmSupplierId ?? this.ppmSupplierId, ppmSupplierId: ppmSupplierId ?? this.ppmSupplierId,
ppmSupplierName: ppmSupplierName ?? this.ppmSupplierName, ppmSupplierName: ppmSupplierName ?? this.ppmSupplierName,
safetyName: safetyName ?? this.safetyName, safetyName: safetyName ?? this.safetyName,
siteId: siteId ?? this.siteId, siteId: siteId ?? this.siteId,
siteName: siteName ?? this.siteName, siteName: siteName ?? this.siteName,
supplierName: supplierName ?? this.supplierName, supplierName: supplierName ?? this.supplierName,
suppPerson: suppPerson ?? this.suppPerson, suppPerson: suppPerson ?? this.suppPerson,
taskStatusName: taskStatusName ?? this.taskStatusName, taskStatusName: taskStatusName ?? this.taskStatusName,
timePeriodName: timePeriodName ?? this.timePeriodName, timePeriodName: timePeriodName ?? this.timePeriodName,
timePeriodValue: timePeriodValue ?? this.timePeriodValue, timePeriodValue: timePeriodValue ?? this.timePeriodValue,
typeOfServiceName: typeOfServiceName ?? this.typeOfServiceName, typeOfServiceName: typeOfServiceName ?? this.typeOfServiceName,
visitCode: visitCode ?? this.visitCode, visitCode: visitCode ?? this.visitCode,
visitNo: visitNo ?? this.visitNo, visitNo: visitNo ?? this.visitNo,
visitStatusName: visitStatusName ?? this.visitStatusName, visitStatusName: visitStatusName ?? this.visitStatusName,
warrantyEndDate: warrantyEndDate ?? this.warrantyEndDate, warrantyEndDate: warrantyEndDate ?? this.warrantyEndDate,
)..tbsTimer = tbsTimer ?? this.tbsTimer; );
ppm.tbsTimer = tbsTimer ?? this.tbsTimer;
return ppm;
}
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final map = <String, dynamic>{};

@ -261,9 +261,7 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
context.translation.transferDetails.heading5(context), context.translation.transferDetails.heading5(context),
8.height, 8.height,
'${context.translation.assetName}: ${_formModel.assetName.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context), '${context.translation.assetName}: ${_formModel.assetName.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context),
'${context.translation.requesterName}: ${_formModel?.receiverEndUserName?.cleanupWhitespace?.capitalizeFirstOfEach??""}'.bodyText(context),
///TBDZ
'${context.translation.requesterName}: '.bodyText(context),
], ],
).toShadowContainer(context); ).toShadowContainer(context);
} }

@ -19,22 +19,43 @@ import '../../../../new_views/app_style/app_color.dart';
import '../../../../new_views/common_widgets/app_filled_button.dart'; import '../../../../new_views/common_widgets/app_filled_button.dart';
import '../../../widgets/requests/request_status.dart'; import '../../../widgets/requests/request_status.dart';
class PpmDetailsPage extends StatelessWidget { class PpmDetailsPage extends StatefulWidget {
static const String id = "/visit-details"; static const String id = "/visit-details";
final RequestsDetails request; final RequestsDetails request;
const PpmDetailsPage({Key key, this.request}) : super(key: key); PpmDetailsPage({Key key, this.request}) : super(key: key);
@override
_PpmDetailsPageState createState() {
return _PpmDetailsPageState();
}
}
class _PpmDetailsPageState extends State<PpmDetailsPage> {
UserProvider userProvider;
PpmProvider ppmProvider;
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
UserProvider userProvider = Provider.of<UserProvider>(context); userProvider ??= Provider.of<UserProvider>(context, listen: false);
PpmProvider ppmProvider = Provider.of<PpmProvider>(context); ppmProvider ??= Provider.of<PpmProvider>(context, listen: false);
return Scaffold( return Scaffold(
appBar: DefaultAppBar(title: context.translation.preventiveMaintenance), appBar: DefaultAppBar(title: context.translation.preventiveMaintenance),
body: SafeArea( body: SafeArea(
child: FutureBuilder( child: FutureBuilder(
future: ppmProvider.getPpmById(request.id), future: ppmProvider.getPpmById(widget.request.id),
builder: (context, snap) { builder: (context, snap) {
if (snap.connectionState == ConnectionState.waiting) { if (snap.connectionState == ConnectionState.waiting) {
return const ALoading(); return const ALoading();
@ -48,13 +69,13 @@ class PpmDetailsPage extends StatelessWidget {
children: [ children: [
Row( Row(
children: [ children: [
if (request.priority != null) if (widget.request.priority != null)
StatusLabel( StatusLabel(
label: request.priority, label: widget.request.priority,
textColor: AppColor.getRequestStatusTextColorByName(context, request.priority), textColor: AppColor.getRequestStatusTextColorByName(context, widget.request.priority),
backgroundColor: AppColor.getRequestStatusColorByName(context, request.priority), backgroundColor: AppColor.getRequestStatusColorByName(context, widget.request.priority),
), ),
if (request.priority != null) 8.width, if (widget.request.priority != null) 8.width,
StatusLabel( StatusLabel(
label: ppm.visitStatusName, label: ppm.visitStatusName,
id: ppm.deviceStatusId, id: ppm.deviceStatusId,
@ -82,8 +103,9 @@ class PpmDetailsPage extends StatelessWidget {
).expanded, ).expanded,
if (userProvider.user.type == UsersTypes.engineer && (ppm.visitStatusId != 270 && ppm.visitStatusId != 269)) if (userProvider.user.type == UsersTypes.engineer && (ppm.visitStatusId != 270 && ppm.visitStatusId != 269))
AppFilledButton( AppFilledButton(
onPressed: () { onPressed: () async {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => EditPpm(ppm: ppm, details: request))); await Navigator.of(context).push(MaterialPageRoute(builder: (_) => EditPpm(ppm: ppm, details: widget.request)));
setState(() {});
}, },
label: context.translation.updateRequest, label: context.translation.updateRequest,
).paddingAll(16) ).paddingAll(16)

@ -60,8 +60,8 @@ class _EditPpmState extends State<EditPpm> with SingleTickerProviderStateMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
_userProvider = Provider.of<UserProvider>(context); _userProvider = Provider.of<UserProvider>(context,listen: false);
_regularVisitsProvider = Provider.of<PpmProvider>(context); _regularVisitsProvider = Provider.of<PpmProvider>(context,listen: false);
return Scaffold( return Scaffold(
appBar: DefaultAppBar(title: context.translation.preventiveMaintenance), appBar: DefaultAppBar(title: context.translation.preventiveMaintenance),
key: _scaffoldKey, key: _scaffoldKey,

@ -28,24 +28,10 @@ class PentryTBSForm extends StatefulWidget {
} }
class _PentryTBSFormState extends State<PentryTBSForm> { class _PentryTBSFormState extends State<PentryTBSForm> {
Ppm _model;
@override
void initState() {
_model = widget.model;
super.initState();
}
@override
void dispose() {
print("disposeddddddd");
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
_model?.files ??= []; widget.model?.files ??= [];
_model?.files = (_model.files ?? []).where((element) => element.attachmentName != null && element.attachmentName.isNotEmpty).toList(); widget.model?.files = (widget.model.files ?? []).where((element) => element.attachmentName != null && element.attachmentName.isNotEmpty).toList();
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(
@ -54,7 +40,7 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
8.height, 8.height,
SingleItemDropDownMenu<Lookup, PPMVisitStatusProvider>( SingleItemDropDownMenu<Lookup, PPMVisitStatusProvider>(
context: context, context: context,
initialValue: _model.visitStatusId == null ? null : Lookup(name: _model.visitStatusName ?? "", id: _model.visitStatusId), initialValue: widget.model.visitStatusId == null ? null : Lookup(name: widget.model.visitStatusName ?? "", id: widget.model.visitStatusId),
title: context.translation.ppmVisit, title: context.translation.ppmVisit,
onSelect: (value) { onSelect: (value) {
if (value?.value == 4) { if (value?.value == 4) {
@ -64,93 +50,96 @@ class _PentryTBSFormState extends State<PentryTBSForm> {
} }
if (value != null) { if (value != null) {
_model.visitStatusName = value.name; widget.model.visitStatusName = value.name;
_model.visitStatusId = value.id; widget.model.visitStatusId = value.id;
} }
}, },
), ),
8.height, 8.height,
AppTimer( AppTimer(
label: context.translation.timer, label: context.translation.timer,
timer: _model.tbsTimer, timer: widget.model.tbsTimer,
enabled: _model.tbsTimer.endAt == null, enabled: widget.model.tbsTimer.endAt == null,
timerProgress: (isRunning) {
print("timerProgress:$isRunning");
},
onChange: (timer) async { onChange: (timer) async {
_model.tbsTimer = timer; widget.model.tbsTimer = timer;
return true; return true;
}, },
), ),
8.height, 8.height,
SingleItemDropDownMenu<Lookup, PPMDeviceStatusProvider>( SingleItemDropDownMenu<Lookup, PPMDeviceStatusProvider>(
context: context, context: context,
initialValue: _model.deviceStatusId == null ? null : Lookup(name: _model.deviceStatusName ?? "", id: _model.deviceStatusId), initialValue: widget.model.deviceStatusId == null ? null : Lookup(name: widget.model.deviceStatusName ?? "", id: widget.model.deviceStatusId),
title: context.translation.deviceStatus, title: context.translation.deviceStatus,
onSelect: (value) { onSelect: (value) {
if (value != null) { if (value != null) {
_model.deviceStatusId = value.id; widget.model.deviceStatusId = value.id;
_model.deviceStatusName = value.name; widget.model.deviceStatusName = value.name;
} }
}, },
), ),
8.height, 8.height,
ADatePicker( ADatePicker(
label: context.translation.actualVisitDate, label: context.translation.actualVisitDate,
date: DateTime.tryParse(_model.actualDate ?? ""), date: DateTime.tryParse(widget.model.actualDate ?? ""),
from: DateTime.now().subtract(const Duration(days: 30)), from: DateTime.now().subtract(const Duration(days: 30)),
onDatePicker: (date) { onDatePicker: (date) {
if (date == null) return; if (date == null) return;
_model.actualDate = date?.toIso8601String(); widget.model.actualDate = date?.toIso8601String();
setState(() {}); setState(() {});
}, },
), ),
8.height, 8.height,
ADatePicker( ADatePicker(
label: context.translation.expectedVisitDate, label: context.translation.expectedVisitDate,
date: DateTime.tryParse(_model.expectedDate ?? ""), date: DateTime.tryParse(widget.model.expectedDate ?? ""),
from: DateTime.now().subtract(const Duration(days: 30)), from: DateTime.now().subtract(const Duration(days: 30)),
enable: false, enable: false,
onDatePicker: (date) { onDatePicker: (date) {
if (date == null) return; if (date == null) return;
_model.expectedDate = date?.toIso8601String(); widget.model.expectedDate = date?.toIso8601String();
setState(() {}); setState(() {});
}, },
), ),
8.height, 8.height,
AppTextFormField( AppTextFormField(
labelText: context.translation.travelingHours, labelText: context.translation.travelingHours,
initialValue: (_model.travelingHours ?? "").toString(), initialValue: (widget.model.travelingHours ?? "").toString(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.titleMedium, style: Theme.of(context).textTheme.titleMedium,
textInputType: TextInputType.number, textInputType: TextInputType.number,
onChange: (value) { onChange: (value) {
_model.travelingHours = value; widget.model.travelingHours = value;
}, },
), ),
8.height, 8.height,
MultiFilesPicker( MultiFilesPicker(
label: context.translation.attachImage, label: context.translation.attachImage,
files: _model.files.map((e) => File(e.attachmentName)).toList(), files: widget.model.files.map((e) => File(e.attachmentName)).toList(),
onChange: (files) { onChange: (files) {
_model.files = files.map((e) => PpmAttachments(attachmentName: e.path)).toList(); widget.model.files = files.map((e) => PpmAttachments(attachmentName: e.path)).toList();
}, },
), ),
8.height, 8.height,
ESignature( ESignature(
title: context.translation.nurseSignature, title: context.translation.nurseSignature,
oldSignature: _model.nurseSignature, oldSignature: widget.model.nurseSignature,
newSignature: _model.localNurseSignature, newSignature: widget.model.localNurseSignature,
onChange: (signature) { onChange: (signature) {
_model.localNurseSignature = signature; widget.model.localNurseSignature = signature;
_model.nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}"; widget.model.nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
}, },
), ),
8.height, 8.height,
ESignature( ESignature(
title: context.translation.engSign, title: context.translation.engSign,
oldSignature: _model.engSignature, oldSignature: widget.model.engSignature,
newSignature: _model.localEngineerSignature, newSignature: widget.model.localEngineerSignature,
onChange: (signature) { onChange: (signature) {
_model.localEngineerSignature = signature; widget.model.localEngineerSignature = signature;
_model.engSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}"; widget.model.engSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
}, },
), ),
8.height, 8.height,

Loading…
Cancel
Save