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

@ -261,9 +261,7 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
context.translation.transferDetails.heading5(context),
8.height,
'${context.translation.assetName}: ${_formModel.assetName.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context),
///TBDZ
'${context.translation.requesterName}: '.bodyText(context),
'${context.translation.requesterName}: ${_formModel?.receiverEndUserName?.cleanupWhitespace?.capitalizeFirstOfEach??""}'.bodyText(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 '../../../widgets/requests/request_status.dart';
class PpmDetailsPage extends StatelessWidget {
class PpmDetailsPage extends StatefulWidget {
static const String id = "/visit-details";
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
Widget build(BuildContext context) {
UserProvider userProvider = Provider.of<UserProvider>(context);
PpmProvider ppmProvider = Provider.of<PpmProvider>(context);
userProvider ??= Provider.of<UserProvider>(context, listen: false);
ppmProvider ??= Provider.of<PpmProvider>(context, listen: false);
return Scaffold(
appBar: DefaultAppBar(title: context.translation.preventiveMaintenance),
body: SafeArea(
child: FutureBuilder(
future: ppmProvider.getPpmById(request.id),
future: ppmProvider.getPpmById(widget.request.id),
builder: (context, snap) {
if (snap.connectionState == ConnectionState.waiting) {
return const ALoading();
@ -48,13 +69,13 @@ class PpmDetailsPage extends StatelessWidget {
children: [
Row(
children: [
if (request.priority != null)
if (widget.request.priority != null)
StatusLabel(
label: request.priority,
textColor: AppColor.getRequestStatusTextColorByName(context, request.priority),
backgroundColor: AppColor.getRequestStatusColorByName(context, request.priority),
label: widget.request.priority,
textColor: AppColor.getRequestStatusTextColorByName(context, widget.request.priority),
backgroundColor: AppColor.getRequestStatusColorByName(context, widget.request.priority),
),
if (request.priority != null) 8.width,
if (widget.request.priority != null) 8.width,
StatusLabel(
label: ppm.visitStatusName,
id: ppm.deviceStatusId,
@ -82,8 +103,9 @@ class PpmDetailsPage extends StatelessWidget {
).expanded,
if (userProvider.user.type == UsersTypes.engineer && (ppm.visitStatusId != 270 && ppm.visitStatusId != 269))
AppFilledButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => EditPpm(ppm: ppm, details: request)));
onPressed: () async {
await Navigator.of(context).push(MaterialPageRoute(builder: (_) => EditPpm(ppm: ppm, details: widget.request)));
setState(() {});
},
label: context.translation.updateRequest,
).paddingAll(16)

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

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

Loading…
Cancel
Save