Add Engineer Signature & Nurse Signature to Update Gas Refill

pull/1/head
zaid_daoud 2 years ago
parent 53c1f83bac
commit 0563c545b5

@ -158,6 +158,8 @@ class GasRefillProvider extends ChangeNotifier {
"building": building?.toJson(includeFloors: false),
"floor": floor?.toJson(includeDepartments: false),
"department": department?.toJson(),
"engSignature": newModel.signatureEngineer,
"nurseSignature": newModel.signatureNurse,
};
body["gazRefillDetails"] = newModel.details

@ -1,6 +1,9 @@
import 'dart:typed_data';
import 'package:test_sa/models/gas_refill/gas_refill_details.dart';
import 'package:test_sa/models/lookup.dart';
import '../../controllers/api_routes/urls.dart';
import '../call_request_for_work_order_model.dart';
class GasRefillModel {
@ -14,6 +17,10 @@ class GasRefillModel {
Department department;
List<GasRefillDetails> details;
AssignedEmployee assignedEmployee;
String signatureNurse;
String signatureEngineer;
Uint8List localNurseSignature;
Uint8List localEngineerSignature;
DateTime startDate, endDate, expectedDate;
GasRefillModel({
@ -30,6 +37,10 @@ class GasRefillModel {
this.expectedDate,
this.department,
this.assignedEmployee,
this.signatureNurse,
this.signatureEngineer,
this.localEngineerSignature,
this.localNurseSignature,
});
bool validate() {
@ -58,6 +69,10 @@ class GasRefillModel {
endDate = model.endDate;
expectedDate = model.expectedDate;
assignedEmployee = model.assignedEmployee;
localEngineerSignature = model.localEngineerSignature;
localNurseSignature = model.localNurseSignature;
signatureEngineer = model.signatureEngineer;
signatureNurse = model.signatureNurse;
}
factory GasRefillModel.fromJson(Map<String, dynamic> parsedJson) {
@ -80,6 +95,8 @@ class GasRefillModel {
endDate: DateTime.tryParse(parsedJson['endDate'] ?? ""),
expectedDate: DateTime.tryParse(parsedJson['expectedDate'] ?? ""),
assignedEmployee: AssignedEmployee.fromJson(parsedJson['assignedEmployee'] ?? {}),
signatureEngineer: URLs.getFileUrl(parsedJson["engSignature"]),
signatureNurse: URLs.getFileUrl(parsedJson["nurseSignature"]),
);
}
}

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:provider/provider.dart';
@ -29,6 +31,7 @@ import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
import '../../../../controllers/localization/localization.dart';
import '../../../../controllers/providers/api/hospitals_provider.dart';
import '../../../../models/enums/user_types.dart';
import '../../../widgets/e_signature/e_signature.dart';
class RequestGasRefill extends StatefulWidget {
static const String id = "/request-gas-refill";
@ -483,14 +486,43 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
},
);
}),
if (widget.gasRefillModel != null) const SizedBox(height: 16),
if (widget.gasRefillModel != null) const ASubTitle("Nurse Signature"),
if (widget.gasRefillModel != null)
ESignature(
oldSignature: _formModel.signatureNurse,
newSignature: _formModel.localNurseSignature,
onChange: (signature) {
if (signature == null || signature.isEmpty) {
return;
}
_formModel.localNurseSignature = signature;
_formModel.signatureNurse = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
},
),
if (widget.gasRefillModel != null)
const SizedBox(
height: 8,
),
if (widget.gasRefillModel != null) const ASubTitle("Engineer Signature"),
if (widget.gasRefillModel != null)
ESignature(
oldSignature: _formModel.signatureEngineer,
newSignature: _formModel.localNurseSignature,
onChange: (signature) {
if (signature == null || signature.isEmpty) {
return;
}
_formModel.localNurseSignature = signature;
_formModel.signatureEngineer = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
},
),
const SizedBox(height: 16),
AButton(
text: widget.gasRefillModel == null ? _subtitle.submit : _subtitle.update,
onPressed: _onSubmit,
),
const SizedBox(
height: 100,
)
const SizedBox(height: 100)
],
),
),

Loading…
Cancel
Save