|
|
|
|
@ -91,23 +91,47 @@ class GasRefillApiClient {
|
|
|
|
|
required GasRefillModel? oldModel,
|
|
|
|
|
required GasRefillModel newModel,
|
|
|
|
|
}) async {
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> body = {
|
|
|
|
|
"uid": UserApiClient().user?.id.toString(),
|
|
|
|
|
"token": UserApiClient().user?.token,
|
|
|
|
|
"title": newModel.title,
|
|
|
|
|
"status": newModel.status?.id.toString(),
|
|
|
|
|
"id": oldModel?.id,
|
|
|
|
|
"gazRefillNo": await generateGazRefillNo(),
|
|
|
|
|
"assignedEmployee": {
|
|
|
|
|
"id": UserApiClient().user?.id.toString(),
|
|
|
|
|
"name": UserApiClient().user?.username.toString()
|
|
|
|
|
},
|
|
|
|
|
"status": {
|
|
|
|
|
"id": 0,
|
|
|
|
|
"name": "",
|
|
|
|
|
"value": 0
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
body["gazRefillDetails"] = jsonEncode(newModel.details
|
|
|
|
|
body["gazRefillDetails"] = newModel.details
|
|
|
|
|
?.map((model) => {
|
|
|
|
|
"gasType": model.type?.id.toString(),
|
|
|
|
|
"cylinderSize": model.cylinderSize?.id.toString(),
|
|
|
|
|
"requestedQty": model.requestedQuantity.toString(),
|
|
|
|
|
"deliverdQty": model.deliveredQuantity.toString(),
|
|
|
|
|
})
|
|
|
|
|
.toList());
|
|
|
|
|
"gasType": {
|
|
|
|
|
"id": model.type?.id,
|
|
|
|
|
"name": model.type?.label.toString(),
|
|
|
|
|
"value": model.type?.id
|
|
|
|
|
},
|
|
|
|
|
"cylinderType": {
|
|
|
|
|
"id": 0,
|
|
|
|
|
"name": "",
|
|
|
|
|
"value": 0
|
|
|
|
|
},
|
|
|
|
|
"cylinderSize": {
|
|
|
|
|
"id": model.cylinderSize?.id,
|
|
|
|
|
"name": model.cylinderSize?.label.toString(),
|
|
|
|
|
"value": model.cylinderSize?.id,
|
|
|
|
|
},
|
|
|
|
|
"requestedQty": model.requestedQuantity,
|
|
|
|
|
"deliverdQty": 0
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final reponse = await ApiClient().postJsonForResponse("${URLs.host1}${URLs.updateGasRefill}/${newModel.id}", body);
|
|
|
|
|
final reponse = await ApiClient().putJsonForResponse("${URLs.host1}${URLs.updateGasRefill}/${newModel.id}", body);
|
|
|
|
|
|
|
|
|
|
oldModel?.fromGasRefillModel(newModel);
|
|
|
|
|
}
|
|
|
|
|
|