gas refill fixes

design_3.0_task_module_new
WaseemAbbasi22 7 months ago
parent 045c890a27
commit 5031c3cbb8

@ -169,12 +169,12 @@ class URLs {
static get getGasCylinderSize => "$_baseUrl/Lookups/GetLookup?lookupEnum=608"; // get
static get getGasCylinderType => "$_baseUrl/Lookups/GetLookup?lookupEnum=607"; // get
static get getGasStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=609"; // get
static get requestGasRefill => "$_baseUrl/GazRefill/AddGazRefill"; // get
static get updateGasRefill => "$_baseUrl/GazRefill/UpdateGazRefill"; // get
static get getGasRefill => "$_baseUrl/GazRefill/GetGazRefills"; // get
static get getGasRefillById => "$_baseUrl/GazRefill/GetGazRefillById"; // get
static get getGazRefillComments => "$_baseUrl/GazRefill/GetHistoryComments"; // get
static get addGazRefillComment => "$_baseUrl/GazRefill/AddHistoryComment"; // add
static get requestGasRefill => "$_baseUrl/GasRefill/AddGasRefill"; // get
static get updateGasRefill => "$_baseUrl/GasRefill/UpdateGasRefill"; // get
static get getGasRefill => "$_baseUrl/GasRefill/GetGasRefills"; // get
static get getGasRefillById => "$_baseUrl/GasRefill/GetGasRefillById"; // get
static get getGasRefillComments => "$_baseUrl/GasRefill/GetHistoryComments"; // get
static get addGasRefillComment => "$_baseUrl/GasRefill/AddHistoryComment"; // add
//device transfer
static get requestDeviceTransfer => "$_baseUrl/AssetTransfer/AddAssetTransfer"; // get

@ -47,7 +47,7 @@ class GasRefillCommentsProvider extends ChangeNotifier {
notifyListeners();
late Response response;
try {
response = await ApiManager.instance.get(URLs.getGazRefillComments + "?gasRefillId=$callId");
response = await ApiManager.instance.get(URLs.getGasRefillComments + "?gasRefillId=$callId");
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
@ -87,7 +87,7 @@ class GasRefillCommentsProvider extends ChangeNotifier {
late Response response;
try {
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
response = await ApiManager.instance.post(URLs.addGazRefillComment, body: {"id": 0, "gasRefillId": id, "comment": comment});
response = await ApiManager.instance.post(URLs.addGasRefillComment, body: {"id": 0, "gasRefillId": id, "comment": comment});
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {

@ -46,7 +46,7 @@ class GasRefillProvider extends ChangeNotifier {
Future<GasRefillModel?> getGasRefillObjectById(num id) async {
try {
Response response = await ApiManager.instance.get(URLs.getGasRefillById + "?gazRefillId=$id");
Response response = await ApiManager.instance.get(URLs.getGasRefillById + "?gasRefillId=$id");
if (response.statusCode >= 200 && response.statusCode < 300) {
return GasRefillModel.fromJson(json.decode(response.body)["data"]);

@ -12,7 +12,6 @@ class ActivityMaintenanceHelperModel {
//remove this
int? lastSituationId;
Lookup? lastSituation;
Lookup? activityStatus;
DateTime? startTime;
DateTime? endTime;

@ -42,7 +42,7 @@ class GasRefillModel {
GasRefillModel.fromJson(dynamic json) {
id = json['id'];
gazRefillNo = json['gazRefillNo'];
gazRefillNo = json['gasRefillNo'];
expectedDate = json['expectedDate'];
expectedTime = json['expectedTime'];
startDate = json['startDate'];
@ -80,9 +80,9 @@ class GasRefillModel {
department = json['department'] != null ? Department.fromJson(json['department']) : null;
assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null;
status = json['status'] != null ? Lookup.fromJson(json['status']) : null;
if (json['gazRefillDetails'] != null) {
if (json['gasRefillDetails'] != null) {
gazRefillDetails = [];
json['gazRefillDetails'].forEach((v) {
json['gasRefillDetails'].forEach((v) {
gazRefillDetails!.add(GasRefillDetails.fromJson(v)); // Use '!' since gazRefillDetails is initialized here
});
}
@ -167,7 +167,7 @@ class GasRefillModel {
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id ?? 0;
map['gazRefillNo'] = "GR-${DateTime.now().toString().split(" ").first}";
map['gasRefillNo'] = "GR-${DateTime.now().toString().split(" ").first}";
map['expectedDate'] = expectedDate;
map['expectedTime'] = expectedTime;
map['startDate'] = startDate;
@ -201,7 +201,7 @@ class GasRefillModel {
map['status'] = status?.toJson(); // Use '?.' for null safety
}
if (gazRefillDetails != null) {
map['gazRefillDetails'] = gazRefillDetails!.map((v) => v.toJson()).toList(); // Use '!' since gazRefillDetails could be null
map['gasRefillDetails'] = gazRefillDetails!.map((v) => v.toJson()).toList(); // Use '!' since gazRefillDetails could be null
}
return map;
}

@ -21,7 +21,9 @@ class GasRefillItemView extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (requestData != null) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [

@ -109,9 +109,9 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
context.translation.gasRefillRequest.heading5(context),
8.height,
'${context.translation.gasRequest}: ${gasRefillModel.gazRefillDetails![0].gasType?.name}'.bodyText(context),
'${context.translation.cylinderType}: ${gasRefillModel.gazRefillDetails![0].cylinderType?.name}'.bodyText(context),
'${context.translation.cylinderSize}: ${gasRefillModel.gazRefillDetails![0].cylinderSize?.name}'.bodyText(context),
'${context.translation.gasRequest}: ${gasRefillModel.gazRefillDetails?[0].gasType?.name}'.bodyText(context),
'${context.translation.cylinderType}: ${gasRefillModel.gazRefillDetails?[0].cylinderType?.name}'.bodyText(context),
'${context.translation.cylinderSize}: ${gasRefillModel.gazRefillDetails?[0].cylinderSize?.name}'.bodyText(context),
'${context.translation.site}: ${gasRefillModel.site?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context),
'${context.translation.department}: ${gasRefillModel.department?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context),
'${context.translation.requestNo}: ${gasRefillModel.gazRefillNo}'.bodyText(context),
@ -122,8 +122,8 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
infoText(label:context.translation.createdDate ,value:gasRefillModel.createdDate?.toInitialVisitCardFormat),
const Divider().defaultStyle(context),
'${context.translation.requestedQuantity}: ${gasRefillModel.gazRefillDetails![0].requestedQty ?? 0}'.bodyText(context),
'${context.translation.deliveredQuantity}: ${gasRefillModel.gazRefillDetails![0].deliverdQty ?? 0}'.bodyText(context),
'${context.translation.requestedQuantity}: ${gasRefillModel.gazRefillDetails?[0].requestedQty ?? 0}'.bodyText(context),
'${context.translation.deliveredQuantity}: ${gasRefillModel.gazRefillDetails?[0].deliverdQty ?? 0}'.bodyText(context),
8.height,
if (gasRefillModel.comment?.isNotEmpty ?? false) ...[
const Divider().defaultStyle(context),

Loading…
Cancel
Save