Compare commits
101 Commits
v.1.9.0
...
main_produ
@ -0,0 +1,5 @@
|
|||||||
|
<svg width="14" height="9" viewBox="0 0 14 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M10.2983 1.2631C10.6276 1.09844 10.7611 0.697989 10.5965 0.36867C10.4318 0.0393513 10.0313 -0.0941316 9.70202 0.0705279C8.12823 0.857424 6.54486 2.42431 5.28996 3.87608C5.04918 4.15463 5.07981 4.57563 5.35836 4.8164C5.63691 5.05718 6.05791 5.02656 6.29868 4.74801C7.536 3.31658 8.9753 1.9246 10.2983 1.2631Z" fill="#3DA5E5"/>
|
||||||
|
<path d="M0.937592 4.94649C0.601136 4.79696 0.207161 4.94849 0.0576253 5.28494C-0.0904934 5.61821 0.0567727 6.00791 0.386557 6.16059C0.388304 6.16147 0.391922 6.16332 0.397355 6.16623C0.41272 6.17447 0.442691 6.19128 0.485999 6.21884C0.572533 6.2739 0.712934 6.3723 0.896879 6.53172C1.2645 6.85032 1.80902 7.41527 2.44547 8.36995C2.5726 8.56065 2.78878 8.67267 3.01789 8.66658C3.24698 8.66049 3.4572 8.53661 3.57403 8.33946L3.577 8.3345L3.5909 8.31156C3.60369 8.29058 3.62348 8.25844 3.65012 8.21608C3.70339 8.13135 3.78397 8.00585 3.89053 7.84726C4.09588 7.54165 4.01459 7.12744 3.70898 6.92209C3.49769 6.78012 3.23449 6.77516 3.02429 6.88662C2.5429 6.25821 2.11389 5.82206 1.77012 5.52413C1.5374 5.32244 1.34447 5.18472 1.20183 5.09395C1.0989 5.02536 0.982785 4.96707 0.937592 4.94649Z" fill="#3DA5E5"/>
|
||||||
|
<path d="M13.6316 1.2631C13.961 1.09844 14.0944 0.697989 13.9298 0.36867C13.7651 0.0393513 13.3647 -0.0941316 13.0354 0.0705279C11.2311 0.972653 9.40453 2.90685 8.06812 4.5356C7.38925 5.36297 6.81727 6.13626 6.41498 6.70264C6.38209 6.74895 6.35032 6.79389 6.31971 6.83738C5.8537 6.23534 5.43817 5.81422 5.10345 5.52413C4.87073 5.32244 4.6778 5.18472 4.53517 5.09395C4.45256 5.03938 4.32459 4.97291 4.27093 4.94649C3.93447 4.79696 3.54049 4.94849 3.39096 5.28494C3.24284 5.61821 3.39011 6.00791 3.71989 6.16059C3.72164 6.16147 3.72526 6.16332 3.73069 6.16623C3.74605 6.17447 3.77602 6.19128 3.81933 6.21884C3.90587 6.2739 4.04627 6.3723 4.23021 6.53172C4.59783 6.85032 5.14235 7.41527 5.7788 8.36995C5.90334 8.55676 6.11355 8.66833 6.33807 8.6668C6.56255 8.66526 6.7715 8.55034 6.89348 8.3619L6.89508 8.35944L6.9022 8.34852L6.93185 8.3034C6.95834 8.26328 6.9981 8.20348 7.05015 8.12634C7.15429 7.97205 7.30751 7.74858 7.50202 7.47474C7.8914 6.92653 8.44442 6.17899 9.09888 5.38136C10.4291 3.76011 12.1026 2.02764 13.6316 1.2631Z" fill="#3DA5E5"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.2 KiB |
@ -0,0 +1,4 @@
|
|||||||
|
<svg width="21" height="23" viewBox="0 0 21 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.0125 1.44721C11.0932 1.60832 10.9314 1.8355 10.6079 2.28986C9.91025 3.26945 9.5 4.46755 9.5 5.76138C9.5 9.07218 12.1863 11.7561 15.5 11.7561C16.0799 11.7561 16.6405 11.6739 17.171 11.5206C17.7329 11.3581 18.0138 11.2769 18.1632 11.328C18.3126 11.3792 18.4902 11.6231 18.8454 12.111L18.8953 12.1794C19.0559 12.3997 19.2328 12.6424 19.3697 12.8561C19.6255 13.2556 19.8754 13.7373 19.9613 14.2985C20.2416 16.1297 18.9494 17.3153 17.6625 17.8466C16.8262 18.1919 15.931 18.4734 14.9988 18.6913C15.0049 18.7949 14.9948 18.9013 14.9667 19.0071C14.3896 21.1786 12.3697 22.7502 10.0002 22.7502C7.63084 22.7502 5.61087 21.1786 5.03379 19.0071C5.00568 18.9013 4.99562 18.795 5.00171 18.6914C4.06928 18.4735 3.17396 18.1919 2.33746 17.8466C1.05056 17.3153 -0.241638 16.1297 0.0386759 14.2985C0.124594 13.7373 0.374521 13.2556 0.630335 12.8561C0.775277 12.6298 0.966356 12.3685 1.13291 12.1407C1.76864 11.2713 1.92776 10.3598 1.92786 9.28573C1.92789 4.85418 5.54419 1.26583 10 1.26583C10.0497 1.26583 10.1105 1.26264 10.1775 1.25912C10.4766 1.24343 10.8993 1.22125 11.0125 1.44721ZM7.19327 19.079C9.04012 19.307 10.9604 19.307 12.8073 19.079C12.3003 20.0591 11.2441 20.7502 10.0002 20.7502C8.75643 20.7502 7.7002 20.0591 7.19327 19.079Z" fill="#767676"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.0001 1C17.0001 0.447715 16.5524 0 16.0001 0C15.4478 0 15.0001 0.447715 15.0001 1V1.39864C14.2597 1.56884 13.5904 1.92409 13.0489 2.41399L12.5409 2.08741C12.0763 1.78874 11.4576 1.92323 11.159 2.38779C10.8603 2.85236 10.9948 3.47107 11.4593 3.76974L11.9236 4.06817C11.7576 4.51495 11.6668 4.99727 11.6668 5.5C11.6668 6.00281 11.7577 6.48521 11.9236 6.93205L11.4598 7.23026C10.9952 7.52893 10.8607 8.14764 11.1594 8.61221C11.458 9.07677 12.0768 9.21126 12.5413 8.91259L13.0491 8.58617C13.5905 9.07598 14.2598 9.43118 15.0001 9.60137V10C15.0001 10.5523 15.4478 11 16.0001 11C16.5524 11 17.0001 10.5523 17.0001 10V9.60137C17.7404 9.43118 18.4097 9.07598 18.9512 8.58617L19.4589 8.91259C19.9235 9.21126 20.5422 9.07677 20.8409 8.61221C21.1395 8.14764 21.005 7.52893 20.5405 7.23026L20.0766 6.93205C20.2426 6.48521 20.3335 6.00281 20.3335 5.5C20.3335 4.99727 20.2426 4.51495 20.0767 4.06817L20.5409 3.76974C21.0055 3.47107 21.1399 2.85236 20.8413 2.38779C20.5426 1.92323 19.9239 1.78874 19.4593 2.08741L18.9513 2.41399C18.4099 1.92409 17.7405 1.56884 17.0001 1.39864V1ZM14.0483 4.28631C14.4615 3.68984 15.1753 3.28571 16.0001 3.28571C16.825 3.28571 17.5387 3.68984 17.9519 4.28631C18.1945 4.6366 18.3335 5.05259 18.3335 5.5C18.3335 5.94747 18.1945 6.36351 17.9518 6.71382C17.5386 7.31022 16.8249 7.71429 16.0001 7.71429C15.1753 7.71429 14.4616 7.31022 14.0484 6.71382C13.8057 6.36351 13.6668 5.94747 13.6668 5.5C13.6668 5.05259 13.8057 4.6366 14.0483 4.28631Z" fill="#767676"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.9 KiB |
@ -1,30 +1,39 @@
|
|||||||
class AssetTransferAttachment {
|
//TODO: need to remove this class
|
||||||
AssetTransferAttachment({
|
// import 'package:test_sa/models/lookup.dart';
|
||||||
this.id,
|
//
|
||||||
this.attachmentName,
|
// class AssetTransferAttachment {
|
||||||
});
|
// AssetTransferAttachment({
|
||||||
|
// this.id,
|
||||||
AssetTransferAttachment.fromJson(dynamic json) {
|
// this.attachmentName,
|
||||||
id = json['id'];
|
// this.documentType,
|
||||||
attachmentName = json['attachmentName'];
|
//
|
||||||
}
|
// });
|
||||||
|
//
|
||||||
num? id; // Now nullable
|
// AssetTransferAttachment.fromJson(dynamic json) {
|
||||||
String? attachmentName; // Now nullable
|
// id = json['id'];
|
||||||
|
// attachmentName = json['attachmentName'];
|
||||||
AssetTransferAttachment copyWith({
|
// }
|
||||||
num? id, // Parameter is now nullable
|
//
|
||||||
String? attachmentName, // Parameter is now nullable
|
// num? id; // Now nullable
|
||||||
}) =>
|
// String? attachmentName; // Now nullable
|
||||||
AssetTransferAttachment(
|
// Lookup ? documentType;
|
||||||
id: id ?? this.id,
|
//
|
||||||
attachmentName: attachmentName ?? this.attachmentName,
|
// AssetTransferAttachment copyWith({
|
||||||
);
|
// num? id, // Parameter is now nullable
|
||||||
|
// String? attachmentName, // Parameter is now nullable
|
||||||
Map<String, dynamic> toJson() {
|
// Lookup? documentType, // Parameter is now nullable
|
||||||
final map = <String, dynamic>{};
|
// }) =>
|
||||||
map['id'] = id;
|
// AssetTransferAttachment(
|
||||||
map['attachmentName'] = attachmentName;
|
// id: id ?? this.id,
|
||||||
return map;
|
// attachmentName: attachmentName ?? this.attachmentName,
|
||||||
}
|
// documentType: documentType ?? this.documentType,
|
||||||
}
|
// );
|
||||||
|
//
|
||||||
|
// Map<String, dynamic> toJson() {
|
||||||
|
// final map = <String, dynamic>{};
|
||||||
|
// map['id'] = id;
|
||||||
|
// map['attachmentName'] = attachmentName;
|
||||||
|
// map['documentTypeId'] = documentType?.id;
|
||||||
|
// return map;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@ -0,0 +1,213 @@
|
|||||||
|
|
||||||
|
enum RequestAttachmentTypeEnum {
|
||||||
|
correctiveMaintenance, // 1
|
||||||
|
gasRefill, // 2
|
||||||
|
transferAsset, // 3
|
||||||
|
preventiveMaintenance, // 4
|
||||||
|
recurrentWo, // 5
|
||||||
|
taskRequest, // 6
|
||||||
|
recallAndAlert, // 7
|
||||||
|
assetInventory, // 8
|
||||||
|
assessmentOfNeedAndTechnology, // 9
|
||||||
|
equipmentInternalAudit, // 10
|
||||||
|
systemInternalAudit, // 11
|
||||||
|
loanEquipment, // 12
|
||||||
|
assetDelivery, // 13
|
||||||
|
medicalGasInspection, // 14
|
||||||
|
demo, // 15
|
||||||
|
incidents, // 16
|
||||||
|
sparePartActivity, // 17
|
||||||
|
updateDeliveryNotes, // 18
|
||||||
|
traf,//19
|
||||||
|
ppmSparePartActivity// 20
|
||||||
|
}
|
||||||
|
|
||||||
|
extension RequestAttachmentTypeEnumExtension on RequestAttachmentTypeEnum {
|
||||||
|
int get id {
|
||||||
|
switch (this) {
|
||||||
|
case RequestAttachmentTypeEnum.correctiveMaintenance:
|
||||||
|
return 1;
|
||||||
|
case RequestAttachmentTypeEnum.gasRefill:
|
||||||
|
return 2;
|
||||||
|
case RequestAttachmentTypeEnum.transferAsset:
|
||||||
|
return 3;
|
||||||
|
case RequestAttachmentTypeEnum.preventiveMaintenance:
|
||||||
|
return 4;
|
||||||
|
case RequestAttachmentTypeEnum.recurrentWo:
|
||||||
|
return 5;
|
||||||
|
case RequestAttachmentTypeEnum.taskRequest:
|
||||||
|
return 6;
|
||||||
|
case RequestAttachmentTypeEnum.recallAndAlert:
|
||||||
|
return 7;
|
||||||
|
case RequestAttachmentTypeEnum.assetInventory:
|
||||||
|
return 8;
|
||||||
|
case RequestAttachmentTypeEnum.assessmentOfNeedAndTechnology:
|
||||||
|
return 9;
|
||||||
|
case RequestAttachmentTypeEnum.equipmentInternalAudit:
|
||||||
|
return 10;
|
||||||
|
case RequestAttachmentTypeEnum.systemInternalAudit:
|
||||||
|
return 11;
|
||||||
|
case RequestAttachmentTypeEnum.loanEquipment:
|
||||||
|
return 12;
|
||||||
|
case RequestAttachmentTypeEnum.assetDelivery:
|
||||||
|
return 13;
|
||||||
|
case RequestAttachmentTypeEnum.medicalGasInspection:
|
||||||
|
return 14;
|
||||||
|
case RequestAttachmentTypeEnum.demo:
|
||||||
|
return 15;
|
||||||
|
case RequestAttachmentTypeEnum.incidents:
|
||||||
|
return 16;
|
||||||
|
case RequestAttachmentTypeEnum.sparePartActivity:
|
||||||
|
return 17;
|
||||||
|
case RequestAttachmentTypeEnum.updateDeliveryNotes:
|
||||||
|
return 18;
|
||||||
|
case RequestAttachmentTypeEnum.traf:
|
||||||
|
return 19;
|
||||||
|
case RequestAttachmentTypeEnum.ppmSparePartActivity:
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int get lookupEnumId {
|
||||||
|
switch (this) {
|
||||||
|
///values with 0 we need to check with backend team for the correct lookupEnumId
|
||||||
|
case RequestAttachmentTypeEnum.correctiveMaintenance:
|
||||||
|
return 40305;
|
||||||
|
case RequestAttachmentTypeEnum.gasRefill:
|
||||||
|
return 40307;
|
||||||
|
case RequestAttachmentTypeEnum.transferAsset:
|
||||||
|
return 40304;
|
||||||
|
case RequestAttachmentTypeEnum.preventiveMaintenance:
|
||||||
|
return 40313;
|
||||||
|
case RequestAttachmentTypeEnum.recurrentWo:
|
||||||
|
return 40314;
|
||||||
|
case RequestAttachmentTypeEnum.taskRequest:
|
||||||
|
return 40317;
|
||||||
|
case RequestAttachmentTypeEnum.recallAndAlert:
|
||||||
|
return 40316;
|
||||||
|
case RequestAttachmentTypeEnum.assetInventory:
|
||||||
|
return 40303;
|
||||||
|
case RequestAttachmentTypeEnum.assessmentOfNeedAndTechnology:
|
||||||
|
return 40319;
|
||||||
|
case RequestAttachmentTypeEnum.equipmentInternalAudit:
|
||||||
|
return 40323;
|
||||||
|
case RequestAttachmentTypeEnum.systemInternalAudit:
|
||||||
|
return 40322;
|
||||||
|
case RequestAttachmentTypeEnum.loanEquipment:
|
||||||
|
return 3053;
|
||||||
|
case RequestAttachmentTypeEnum.assetDelivery:
|
||||||
|
return 5009;
|
||||||
|
case RequestAttachmentTypeEnum.medicalGasInspection:
|
||||||
|
return 3012;
|
||||||
|
case RequestAttachmentTypeEnum.demo:
|
||||||
|
return 4106;
|
||||||
|
case RequestAttachmentTypeEnum.incidents:
|
||||||
|
return 40308;
|
||||||
|
case RequestAttachmentTypeEnum.sparePartActivity:
|
||||||
|
return 40321;
|
||||||
|
case RequestAttachmentTypeEnum.ppmSparePartActivity:
|
||||||
|
return 4021;
|
||||||
|
case RequestAttachmentTypeEnum.updateDeliveryNotes:
|
||||||
|
return 40309;
|
||||||
|
case RequestAttachmentTypeEnum.traf:
|
||||||
|
return 40319;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// String getName(BuildContext context) {
|
||||||
|
// switch (this) {
|
||||||
|
// case RequestTypeEnum.correctiveMaintenance:
|
||||||
|
// return context.translation.correctiveMaintenance;
|
||||||
|
// case RequestTypeEnum.gasRefill:
|
||||||
|
// return context.translation.gasRefill;
|
||||||
|
// case RequestTypeEnum.transferAsset:
|
||||||
|
// return context.translation.transferAsset;
|
||||||
|
// case RequestTypeEnum.preventiveMaintenance:
|
||||||
|
// return context.translation.preventiveMaintenance;
|
||||||
|
// case RequestTypeEnum.recurrentWo:
|
||||||
|
// return context.translation.recurrentWo;
|
||||||
|
// case RequestTypeEnum.taskRequest:
|
||||||
|
// return context.translation.taskRequest;
|
||||||
|
// case RequestTypeEnum.recallAndAlert:
|
||||||
|
// return 'Recall and Alert';
|
||||||
|
// case RequestTypeEnum.assetInventory:
|
||||||
|
// return 'Asset Inventory';
|
||||||
|
// case RequestTypeEnum.assessmentOfNeedAndTechnology:
|
||||||
|
// return 'Assessment of Need & Technology';
|
||||||
|
// case RequestTypeEnum.equipmentInternalAudit:
|
||||||
|
// return 'Equipment Internal Audit';
|
||||||
|
// case RequestTypeEnum.systemInternalAudit:
|
||||||
|
// return 'System Internal Audit';
|
||||||
|
// case RequestTypeEnum.loanEquipment:
|
||||||
|
// return 'Loan Equipment';
|
||||||
|
// case RequestTypeEnum.assetDelivery:
|
||||||
|
// return 'Asset Delivery';
|
||||||
|
// case RequestTypeEnum.medicalGasInspection:
|
||||||
|
// return 'Medical Gas Inspection';
|
||||||
|
// case RequestTypeEnum.demo:
|
||||||
|
// return 'Demo';
|
||||||
|
// case RequestTypeEnum.incidents:
|
||||||
|
// return 'Incidents';
|
||||||
|
// case RequestTypeEnum.sparePartActivity:
|
||||||
|
// return 'Spare Part Activity';
|
||||||
|
// case RequestTypeEnum.updateDeliveryNotes:
|
||||||
|
// return 'Update Delivery Notes';
|
||||||
|
// case RequestTypeEnum.traf:
|
||||||
|
// return 'Traf';
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
static RequestAttachmentTypeEnum? fromId(int? id) {
|
||||||
|
if (id == null) return null;
|
||||||
|
switch (id) {
|
||||||
|
case 1:
|
||||||
|
return RequestAttachmentTypeEnum.correctiveMaintenance;
|
||||||
|
case 2:
|
||||||
|
return RequestAttachmentTypeEnum.gasRefill;
|
||||||
|
case 3:
|
||||||
|
return RequestAttachmentTypeEnum.transferAsset;
|
||||||
|
case 4:
|
||||||
|
return RequestAttachmentTypeEnum.preventiveMaintenance;
|
||||||
|
case 5:
|
||||||
|
return RequestAttachmentTypeEnum.recurrentWo;
|
||||||
|
case 6:
|
||||||
|
return RequestAttachmentTypeEnum.taskRequest;
|
||||||
|
case 7:
|
||||||
|
return RequestAttachmentTypeEnum.recallAndAlert;
|
||||||
|
case 8:
|
||||||
|
return RequestAttachmentTypeEnum.assetInventory;
|
||||||
|
case 9:
|
||||||
|
return RequestAttachmentTypeEnum.assessmentOfNeedAndTechnology;
|
||||||
|
case 10:
|
||||||
|
return RequestAttachmentTypeEnum.equipmentInternalAudit;
|
||||||
|
case 11:
|
||||||
|
return RequestAttachmentTypeEnum.systemInternalAudit;
|
||||||
|
case 12:
|
||||||
|
return RequestAttachmentTypeEnum.loanEquipment;
|
||||||
|
case 13:
|
||||||
|
return RequestAttachmentTypeEnum.assetDelivery;
|
||||||
|
case 14:
|
||||||
|
return RequestAttachmentTypeEnum.medicalGasInspection;
|
||||||
|
case 15:
|
||||||
|
return RequestAttachmentTypeEnum.demo;
|
||||||
|
case 16:
|
||||||
|
return RequestAttachmentTypeEnum.incidents;
|
||||||
|
case 17:
|
||||||
|
return RequestAttachmentTypeEnum.sparePartActivity;
|
||||||
|
case 18:
|
||||||
|
return RequestAttachmentTypeEnum.updateDeliveryNotes;
|
||||||
|
case 19:
|
||||||
|
return RequestAttachmentTypeEnum.traf;
|
||||||
|
case 20:
|
||||||
|
return RequestAttachmentTypeEnum.ppmSparePartActivity;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// static String getNameFromId(int id, BuildContext context) {
|
||||||
|
// final requestType = fromId(id);
|
||||||
|
// return requestType?.getName(context) ?? "Type $id";
|
||||||
|
// }
|
||||||
|
static int? getLookupEnumIdFromId(int? id) {
|
||||||
|
final requestType = fromId(id);
|
||||||
|
return requestType?.lookupEnumId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,33 +1,358 @@
|
|||||||
import 'dart:io';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||||
import 'package:test_sa/models/lookup.dart';
|
import 'package:test_sa/models/lookup.dart';
|
||||||
|
|
||||||
|
|
||||||
class GenericAttachmentModel {
|
class GenericAttachmentModel {
|
||||||
GenericAttachmentModel({this.id, this.name, this.originalName, this.createdBy, this.documentTypeId});
|
GenericAttachmentModel({
|
||||||
|
this.id,
|
||||||
|
this.name,
|
||||||
|
this.module,
|
||||||
|
this.subModule,
|
||||||
|
this.uploadedBy,
|
||||||
|
this.originalName,
|
||||||
|
this.createdBy,
|
||||||
|
this.documentType,
|
||||||
|
this.attachmentDescription,
|
||||||
|
this.attachmentURL,
|
||||||
|
this.moduleReferenceId,
|
||||||
|
this.attachmentTypeId,
|
||||||
|
this.createdDate,
|
||||||
|
this.modifiedBy,
|
||||||
|
this.modifiedDate,
|
||||||
|
this.supplierId,
|
||||||
|
});
|
||||||
|
|
||||||
int? id;
|
int? id;
|
||||||
String? name;
|
String? name;
|
||||||
|
String? module;
|
||||||
|
String? subModule;
|
||||||
|
String? uploadedBy;
|
||||||
String? createdBy;
|
String? createdBy;
|
||||||
String? originalName;
|
String? originalName;
|
||||||
Lookup? documentTypeId;
|
Lookup? documentType;
|
||||||
|
String? attachmentDescription;
|
||||||
|
String? attachmentURL;
|
||||||
|
num? moduleReferenceId;
|
||||||
|
num? attachmentTypeId;
|
||||||
|
String? createdDate;
|
||||||
|
String? modifiedBy;
|
||||||
|
String? modifiedDate;
|
||||||
|
num? supplierId;
|
||||||
|
|
||||||
GenericAttachmentModel.fromJson(Map<String, dynamic> json, {bool convertToLink = false}) {
|
GenericAttachmentModel.fromJson(Map<String, dynamic> json, {bool convertToLink = false}) {
|
||||||
id = json['id'];
|
id = json['id'];
|
||||||
name = json['name'] ?? json['imageName'];
|
name = json['name'] ?? json['attachmentName'] ?? json['imageName'];
|
||||||
createdBy = json['createdBy'];
|
createdBy = json['createdBy'];
|
||||||
|
documentType = json['attachmentType'] != null ? Lookup.fromJson(json['attachmentType']) : null;
|
||||||
originalName = json['originalName'] ?? json['imageOriginalName'];
|
originalName = json['originalName'] ?? json['imageOriginalName'];
|
||||||
if (convertToLink) {
|
if (convertToLink) {
|
||||||
name = URLs.getFileUrl(name);
|
name = URLs.getFileUrl(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromAssetDocumentJson(Map<String, dynamic> json, {bool convertToLink = false}) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['attachmentName'] ?? json['name'] ?? json['imageName'];
|
||||||
|
module = json['module'];
|
||||||
|
subModule = json['subModule'];
|
||||||
|
createdBy = json['createdBy'];
|
||||||
|
createdDate = json['createdDate'];
|
||||||
|
uploadedBy = json['uploadedBy'];
|
||||||
|
originalName = json['originalName'] ?? json['imageOriginalName'];
|
||||||
|
documentType = json['attachmentType'] != null ? Lookup(name: json['attachmentType'], id: 0) : null;
|
||||||
|
if (convertToLink && name != null) {
|
||||||
|
name = URLs.getFileUrl(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromWorkOrderJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['name'];
|
||||||
|
documentType = json['attachmentType'] != null ? Lookup.fromJson(json['attachmentType']) : null;
|
||||||
|
createdBy = json['createdBy'];
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromLoanJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id']?.toInt();
|
||||||
|
name = json['attachmentName'];
|
||||||
|
attachmentDescription = json['attachmentDescription'];
|
||||||
|
documentType = json['documentType'] != null ? Lookup.fromJson(json['documentType']) : null;
|
||||||
|
moduleReferenceId = json['loanId'];
|
||||||
|
attachmentTypeId = json['loanAttachmentTypeId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromLoanDetailJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['attachmentName'];
|
||||||
|
attachmentDescription = json['attachmentDescription'];
|
||||||
|
moduleReferenceId = json['loanId'];
|
||||||
|
documentType = json['documentType'] != null ? Lookup.fromJson(json['documentType']) : null;
|
||||||
|
attachmentTypeId = json['loanAttachmentTypeId'];
|
||||||
|
createdBy = json['createdBy'];
|
||||||
|
createdDate = json['createdDate'];
|
||||||
|
modifiedBy = json['modifiedBy'];
|
||||||
|
modifiedDate = json['modifiedDate'];
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromPpmJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['attachmentName'] ?? json['name'];
|
||||||
|
moduleReferenceId = json['visitId'];
|
||||||
|
documentType = json['attachmentType'] != null ? Lookup.fromJson(json['attachmentType']) : null;
|
||||||
|
attachmentURL = json['attachmentURL'];
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromSupplierJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['attachmentName'] ?? json['name'];
|
||||||
|
supplierId = json['supplierId'];
|
||||||
|
moduleReferenceId = json['visitId'];
|
||||||
|
documentType = json['attachmentType'] != null ? Lookup.fromJson(json['attachmentType']) : null;
|
||||||
|
attachmentURL = json['attachmentURL'];
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromGasRefillJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['attachmentName'];
|
||||||
|
moduleReferenceId = json['gasRefillId'];
|
||||||
|
documentType = json['documentType'] != null ? Lookup.fromJson(json['documentType']) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromIncidentJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['attachmentName'];
|
||||||
|
moduleReferenceId = json['incidentId'];
|
||||||
|
attachmentDescription = json['attachmentDescription'];
|
||||||
|
documentType = json['attachmentType'] != null ? Lookup.fromJson(json['attachmentType']) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromAssetTransferJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['attachmentName'];
|
||||||
|
documentType = json['attachmentType'] != null ? Lookup.fromJson(json['attachmentType']) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromDemoJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['attachmentName'];
|
||||||
|
originalName = json['originalName'];
|
||||||
|
documentType = json['documentType'] != null ? Lookup.fromJson(json['documentType']) : null;
|
||||||
|
moduleReferenceId = json['demoRequestId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromInternalAuditJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = (json['name'] != null && !json['name'].toString().startsWith('data:image/jpeg')) ? json['name'] : null;
|
||||||
|
originalName = json['originalName'];
|
||||||
|
createdBy = json['createdBy'];
|
||||||
|
documentType = json['attachmentType'] != null ? Lookup.fromJson(json['attachmentType']) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromPreventiveVisitJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['attachmentName'];
|
||||||
|
documentType = json['attachmentType'] != null ? Lookup.fromJson(json['attachmentType']) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromAssetJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['attachmentName'];
|
||||||
|
attachmentURL = json['attachmentURL'];
|
||||||
|
documentType = json['documentType'] != null ? Lookup.fromJson(json['documentType']) : null;
|
||||||
|
originalName = json['originalName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromAssetInventoryJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['attachmentName'];
|
||||||
|
attachmentURL = json['attachmentURL'];
|
||||||
|
documentType = json['attachmentType'] != null ? Lookup.fromJson(json['attachmentType']) : null;
|
||||||
|
originalName = json['originalName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericAttachmentModel.fromTrafJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
moduleReferenceId = json['trafId'];
|
||||||
|
name = json['attachmentName'];
|
||||||
|
attachmentDescription = json['attachmentDescription'];
|
||||||
|
moduleReferenceId = json['trafId'];
|
||||||
|
documentType = json['attachmentType'] != null ? Lookup.fromJson(json['attachmentType']) : null;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
data['id'] = id;
|
data['id'] = id;
|
||||||
data['name'] = name;
|
data['name'] = name;
|
||||||
data['createdBy'] = createdBy;
|
data['createdBy'] = createdBy;
|
||||||
data['originalName'] = originalName;
|
data['originalName'] = originalName;
|
||||||
|
data['documentTypeId'] = documentType?.id;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toSparePartJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['name'] = name;
|
||||||
|
data['createdBy'] = createdBy;
|
||||||
|
data['originalName'] = originalName;
|
||||||
|
data['attachmentTypeId'] = documentType?.id;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toWorkOrderJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['name'] = name;
|
||||||
|
data['createdBy'] = createdBy;
|
||||||
|
|
||||||
|
///TODO need to keep same variable for document type in backend for all modules, currently it is different for different modules
|
||||||
|
if (documentType != null) {
|
||||||
|
data['attachmentTypeId'] = documentType?.id;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toLoanJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['attachmentName'] = name;
|
||||||
|
data['loanId'] = moduleReferenceId;
|
||||||
|
data['loanAttachmentTypeId'] = documentType?.id;
|
||||||
|
// data['documentTypeId'] = documentType?.id;
|
||||||
|
data['attachmentDescription'] = attachmentDescription;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toLoanDetailJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['attachmentName'] = name;
|
||||||
|
data['loanId'] = moduleReferenceId;
|
||||||
|
data['loanAttachmentTypeId'] = attachmentTypeId;
|
||||||
|
data['attachmentDescription'] = attachmentDescription;
|
||||||
|
data['createdBy'] = createdBy;
|
||||||
|
data['createdDate'] = createdDate;
|
||||||
|
data['documentTypeId'] = documentType?.id;
|
||||||
|
|
||||||
|
data['modifiedBy'] = modifiedBy;
|
||||||
|
data['modifiedDate'] = modifiedDate;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toGasRefillJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['gasRefillId'] = moduleReferenceId;
|
||||||
|
data['attachmentName'] = name;
|
||||||
|
data['documentTypeId'] = documentType?.id;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toIncidentJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['attachmentName'] = name;
|
||||||
|
data['incidentId'] = moduleReferenceId;
|
||||||
|
data['attachmentTypeId'] = documentType?.id;
|
||||||
|
data['attachmentDescription'] = attachmentDescription;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toAssetTransferJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['attachmentName'] = name;
|
||||||
|
data['attachmentTypeId'] = documentType?.id;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toDemoJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['attachmentName'] = name;
|
||||||
|
data['demoRequestId'] = moduleReferenceId;
|
||||||
|
data['originalName'] = originalName;
|
||||||
|
if (documentType != null) {
|
||||||
|
data['documentTypeId'] = documentType?.id;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toInternalAuditJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['name'] = name;
|
||||||
|
data['originalName'] = originalName;
|
||||||
|
data['attachmentTypeId'] = documentType?.id;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toPreventiveVisitJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['attachmentName'] = name;
|
||||||
|
data['attachmentTypeId'] = documentType?.id;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toAssetJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['attachmentName'] = name;
|
||||||
|
data['attachmentURL'] = attachmentURL;
|
||||||
|
data['documentTypeId'] = documentType?.id;
|
||||||
|
data['originalName'] = originalName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toAssetDeliveryJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['name'] = name;
|
||||||
|
data['attachmentTypeId'] = documentType?.id;
|
||||||
|
data['originalName'] = originalName;
|
||||||
|
data['createdBy'] = createdBy;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toInventoryJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['Name'] = name;
|
||||||
|
data['attachmentURL'] = attachmentURL;
|
||||||
|
data['attachmentTypeId'] = documentType?.id;
|
||||||
|
data['originalName'] = originalName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toTrafJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['trafId'] = moduleReferenceId;
|
||||||
|
data['attachmentName'] = name;
|
||||||
|
data['attachmentTypeId'] = documentType?.id;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toSupplierJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['supplierId'] = supplierId;
|
||||||
|
data['documentTypeId'] = documentType?.id;
|
||||||
|
data['attachmentName'] = name;
|
||||||
|
data['attachmentURL'] = attachmentURL;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toTaskJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['name'] = name;
|
||||||
|
data['createdBy'] = createdBy;
|
||||||
|
data['originalName'] = originalName;
|
||||||
|
data['attachmentTypeId'] = documentType?.id;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,67 @@
|
|||||||
|
import 'package:test_sa/models/base.dart';
|
||||||
|
|
||||||
|
class ModuleWithSubModulesModel extends Base {
|
||||||
|
int? id;
|
||||||
|
String? name;
|
||||||
|
List<SubModuleModel>? subModules;
|
||||||
|
|
||||||
|
ModuleWithSubModulesModel({
|
||||||
|
this.id,
|
||||||
|
this.name,
|
||||||
|
this.subModules,
|
||||||
|
});
|
||||||
|
|
||||||
|
ModuleWithSubModulesModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
identifier = id?.toString();
|
||||||
|
name = json['name'];
|
||||||
|
if (json['subModules'] != null) {
|
||||||
|
subModules = <SubModuleModel>[];
|
||||||
|
json['subModules'].forEach((v) {
|
||||||
|
subModules!.add(SubModuleModel.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['name'] = name;
|
||||||
|
if (subModules != null) {
|
||||||
|
data['subModules'] = subModules!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => name ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
class SubModuleModel extends Base {
|
||||||
|
int? id;
|
||||||
|
String? name;
|
||||||
|
String? mainTableName;
|
||||||
|
|
||||||
|
SubModuleModel({
|
||||||
|
this.id,
|
||||||
|
this.name,
|
||||||
|
this.mainTableName,
|
||||||
|
});
|
||||||
|
|
||||||
|
SubModuleModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
name = json['name'];
|
||||||
|
mainTableName = json['mainTableName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['name'] = name;
|
||||||
|
data['mainTableName'] = mainTableName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => name ?? '';
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
class NotificationFilterModel {
|
||||||
|
List<int>? priorityIds;
|
||||||
|
List<int>? channelIds;
|
||||||
|
List<int>? recipientIds;
|
||||||
|
List<int>? moduleIds;
|
||||||
|
List<int>? subModuleIds;
|
||||||
|
DateTime? startDate;
|
||||||
|
DateTime? endDate;
|
||||||
|
String? searchText;
|
||||||
|
bool? isAscending;
|
||||||
|
int? isRead; // 0 = All, 1 = Unread, 2 = Read
|
||||||
|
|
||||||
|
NotificationFilterModel({
|
||||||
|
this.priorityIds,
|
||||||
|
this.channelIds,
|
||||||
|
this.recipientIds,
|
||||||
|
this.moduleIds,
|
||||||
|
this.subModuleIds,
|
||||||
|
this.startDate,
|
||||||
|
this.endDate,
|
||||||
|
this.searchText,
|
||||||
|
this.isAscending,
|
||||||
|
this.isRead,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if any filters are active
|
||||||
|
bool get hasActiveFilters {
|
||||||
|
return (priorityIds?.isNotEmpty ?? false) ||
|
||||||
|
(channelIds?.isNotEmpty ?? false) ||
|
||||||
|
(recipientIds?.isNotEmpty ?? false) ||
|
||||||
|
(moduleIds?.isNotEmpty ?? false) ||
|
||||||
|
(subModuleIds?.isNotEmpty ?? false) ||
|
||||||
|
startDate != null ||
|
||||||
|
endDate != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert to API body (only include non-null/non-empty values)
|
||||||
|
Map<String, dynamic> toApiBody() {
|
||||||
|
final Map<String, dynamic> body = {};
|
||||||
|
|
||||||
|
if (priorityIds?.isNotEmpty ?? false) body['priorityIds'] = priorityIds;
|
||||||
|
if (channelIds?.isNotEmpty ?? false) body['channelIds'] = channelIds;
|
||||||
|
if (recipientIds?.isNotEmpty ?? false) body['recipientIds'] = recipientIds;
|
||||||
|
if (moduleIds?.isNotEmpty ?? false) body['moduleId'] = moduleIds!.first; // API expects single moduleId
|
||||||
|
if (subModuleIds?.isNotEmpty ?? false) body['subModuleIds'] = subModuleIds;
|
||||||
|
if (startDate != null) body['createdDateFrom'] = startDate!.toIso8601String();
|
||||||
|
if (endDate != null) body['createdDateTo'] = endDate!.toIso8601String();
|
||||||
|
if (searchText?.isNotEmpty ?? false) body['searchText'] = searchText;
|
||||||
|
if (isAscending != null) body['isAscending'] = isAscending;
|
||||||
|
if (isRead != null) body['isRead'] = isRead;
|
||||||
|
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear() {
|
||||||
|
priorityIds?.clear();
|
||||||
|
channelIds?.clear();
|
||||||
|
recipientIds?.clear();
|
||||||
|
moduleIds?.clear();
|
||||||
|
subModuleIds?.clear();
|
||||||
|
startDate = null;
|
||||||
|
endDate = null;
|
||||||
|
searchText = null;
|
||||||
|
isAscending = null;
|
||||||
|
isRead = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,40 +1,42 @@
|
|||||||
class PpmAttachments {
|
//TODO need to delete this
|
||||||
PpmAttachments({
|
|
||||||
this.id,
|
|
||||||
this.visitId,
|
|
||||||
this.attachmentName,
|
|
||||||
this.attachmentURL,
|
|
||||||
});
|
|
||||||
|
|
||||||
PpmAttachments.fromJson(dynamic json) {
|
// class PpmAttachments {
|
||||||
id = json['id'];
|
// PpmAttachments({
|
||||||
visitId = json['visitId'];
|
// this.id,
|
||||||
attachmentName = json['attachmentName'] ?? json['attachmentURL']; // Handle potential null and prioritize'attachmentName'
|
// this.visitId,
|
||||||
}
|
// this.attachmentName,
|
||||||
|
// this.attachmentURL,
|
||||||
num? id; // Now nullable
|
// });
|
||||||
num? visitId; // Now nullable
|
//
|
||||||
String? attachmentName; // Now nullable
|
// PpmAttachments.fromJson(dynamic json) {
|
||||||
String? attachmentURL; // Now nullable
|
// id = json['id'];
|
||||||
|
// visitId = json['visitId'];
|
||||||
PpmAttachments copyWith({
|
// attachmentName = json['attachmentName'] ?? json['attachmentURL']; // Handle potential null and prioritize'attachmentName'
|
||||||
num? id,
|
// }
|
||||||
num? visitId,
|
//
|
||||||
String? attachmentName,
|
// num? id; // Now nullable
|
||||||
String? attachmentURL,
|
// num? visitId; // Now nullable
|
||||||
}) =>
|
// String? attachmentName; // Now nullable
|
||||||
PpmAttachments(
|
// String? attachmentURL; // Now nullable
|
||||||
id: id ?? this.id,
|
//
|
||||||
visitId: visitId ?? this.visitId,
|
// PpmAttachments copyWith({
|
||||||
attachmentName: attachmentName ?? this.attachmentName,attachmentURL: attachmentURL ?? this.attachmentURL,
|
// num? id,
|
||||||
);
|
// num? visitId,
|
||||||
|
// String? attachmentName,
|
||||||
Map<String, dynamic> toJson() {
|
// String? attachmentURL,
|
||||||
final map = <String, dynamic>{};
|
// }) =>
|
||||||
map['id'] = id;
|
// PpmAttachments(
|
||||||
map['visitId'] = visitId;
|
// id: id ?? this.id,
|
||||||
map['attachmentName'] = attachmentName;
|
// visitId: visitId ?? this.visitId,
|
||||||
map['attachmentURL'] = attachmentURL;
|
// attachmentName: attachmentName ?? this.attachmentName,attachmentURL: attachmentURL ?? this.attachmentURL,
|
||||||
return map;
|
// );
|
||||||
}
|
//
|
||||||
}
|
// Map<String, dynamic> toJson() {
|
||||||
|
// final map = <String, dynamic>{};
|
||||||
|
// map['id'] = id;
|
||||||
|
// map['visitId'] = visitId;
|
||||||
|
// map['attachmentName'] = attachmentName;
|
||||||
|
// map['attachmentURL'] = attachmentURL;
|
||||||
|
// return map;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
@ -1,273 +1,216 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:test_sa/extensions/context_extension.dart';
|
|
||||||
import 'package:test_sa/extensions/int_extensions.dart';
|
import 'package:test_sa/extensions/int_extensions.dart';
|
||||||
import 'package:test_sa/extensions/text_extensions.dart';
|
import 'package:test_sa/extensions/text_extensions.dart';
|
||||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||||
import 'package:test_sa/models/helper_data_models/workorder/work_order_helper_models.dart';
|
import 'package:test_sa/models/helper_data_models/workorder/work_order_helper_models.dart';
|
||||||
import 'package:test_sa/models/new_models/work_order_detail_model.dart';
|
|
||||||
import 'package:test_sa/modules/cm_module/cm_detail_provider.dart';
|
|
||||||
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
|
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
|
||||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||||
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
||||||
import 'package:test_sa/new_views/common_widgets/app_lazy_loading.dart';
|
import 'package:test_sa/new_views/common_widgets/app_lazy_loading.dart';
|
||||||
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
|
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
|
||||||
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
||||||
import 'package:test_sa/providers/service_request_providers/equipment_status_provider.dart';
|
|
||||||
|
|
||||||
class CostDetailFormScreen extends StatefulWidget {
|
class CostDetailFormScreen extends StatefulWidget {
|
||||||
static const String id = "/cost-detail-form-screen";
|
static const String id = "/cost-detail-form-screen";
|
||||||
bool isEdit = false;
|
final WorkOrderCostModel? model;
|
||||||
|
final dynamic provider; // CMDetailProvider or PpmProvider
|
||||||
|
|
||||||
CostDetailFormScreen({Key? key, required this.isEdit}) : super(key: key);
|
const CostDetailFormScreen({
|
||||||
|
Key? key,
|
||||||
|
required this.model,
|
||||||
|
required this.provider,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_CostDetailFormScreenState createState() => _CostDetailFormScreenState();
|
_CostDetailFormScreenState createState() => _CostDetailFormScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CostDetailFormScreenState extends State<CostDetailFormScreen> with TickerProviderStateMixin {
|
class _CostDetailFormScreenState extends State<CostDetailFormScreen> {
|
||||||
CMDetailProvider? _requestDetailProvider;
|
late WorkOrderCostModel _localModel;
|
||||||
|
|
||||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
_localModel = WorkOrderCostModel(
|
||||||
|
workOrderId: widget.model?.workOrderId,
|
||||||
void assignValues() {
|
labourCost: widget.model?.labourCost,
|
||||||
// ServiceRequestDetailProvider requestDetailProvider = Provider.of<ServiceRequestDetailProvider>(context, listen: false);
|
sparePartCost: widget.model?.sparePartCost,
|
||||||
// _requestDetailProvider = Provider.of<ServiceRequestDetailProvider>(context, listen: false);
|
travelCost: widget.model?.travelCost,
|
||||||
WorkOrderData currentWorkOrderData = _requestDetailProvider!.currentWorkOrder!.data!;
|
qAmount: widget.model?.qAmount,
|
||||||
_requestDetailProvider!.workOrderCostModel = WorkOrderCostModel(
|
prNo: widget.model?.prNo,
|
||||||
workOrderId: currentWorkOrderData.requestId,
|
poNo: widget.model?.poNo,
|
||||||
labourCost: currentWorkOrderData.labourCost,
|
mrNo: widget.model?.mrNo,
|
||||||
sparePartCost: currentWorkOrderData.sparePartCost,
|
exchangeCost: widget.model?.exchangeCost,
|
||||||
travelCost: currentWorkOrderData.travelCost,
|
|
||||||
qAmount: currentWorkOrderData.qAmount,
|
|
||||||
prNo: currentWorkOrderData.prNo,
|
|
||||||
poNo: currentWorkOrderData.poNo,
|
|
||||||
mrNo: currentWorkOrderData.mrNo,
|
|
||||||
exchangeCost: currentWorkOrderData.exchangeCost,
|
|
||||||
);
|
);
|
||||||
|
log('Initialized Cost Model: ${_localModel.toJson()}');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_requestDetailProvider == null) {
|
|
||||||
_requestDetailProvider = Provider.of<CMDetailProvider>(context, listen: false);
|
|
||||||
assignValues();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: _scaffoldKey,
|
|
||||||
appBar: const DefaultAppBar(title: "Cost Details"),
|
appBar: const DefaultAppBar(title: "Cost Details"),
|
||||||
body: Consumer<CMDetailProvider>(builder: (context, CMDetailProvider requestDetailProvider, child) {
|
body: ListenableBuilder(
|
||||||
return Column(
|
listenable: widget.provider,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
builder: (context, child) {
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
return Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
SingleChildScrollView(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
child: Column(
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
Expanded(
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
AppTextFormField(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
labelText: "Spare Part Cost",
|
mainAxisSize: MainAxisSize.min,
|
||||||
backgroundColor: AppColor.neutral100,
|
children: [
|
||||||
initialValue: requestDetailProvider.workOrderCostModel?.sparePartCost?.toString(),
|
AppTextFormField(
|
||||||
textAlign: TextAlign.center,
|
labelText: "Spare Part Cost",
|
||||||
enable: false,
|
backgroundColor: AppColor.neutral100,
|
||||||
labelStyle: AppTextStyles.textFieldLabelStyle,
|
initialValue: _localModel.sparePartCost?.toString() ?? '0',
|
||||||
textInputType: TextInputType.number,
|
textAlign: TextAlign.center,
|
||||||
showShadow: false,
|
enable: false,
|
||||||
onChange: (value) {
|
labelStyle: AppTextStyles.textFieldLabelStyle,
|
||||||
requestDetailProvider.workOrderCostModel?.sparePartCost = num.parse(value);
|
textInputType: TextInputType.number,
|
||||||
},
|
showShadow: false,
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
8.height,
|
8.height,
|
||||||
AppTextFormField(
|
AppTextFormField(
|
||||||
initialValue: requestDetailProvider.workOrderCostModel?.labourCost?.toString(),
|
initialValue: _localModel.labourCost?.toString() ?? '',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
labelText: "Labor Cost",
|
labelText: "Labor Cost",
|
||||||
backgroundColor: AppColor.fieldBgColor(context),
|
backgroundColor: AppColor.fieldBgColor(context),
|
||||||
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
||||||
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
||||||
showShadow: false,
|
showShadow: false,
|
||||||
onChange: (value) {
|
onChange: (value) {
|
||||||
requestDetailProvider.workOrderCostModel?.labourCost = num.parse(value);
|
_localModel.labourCost = num.tryParse(value);
|
||||||
},
|
},
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
8.height,
|
8.height,
|
||||||
AppTextFormField(
|
AppTextFormField(
|
||||||
labelText: "Travel Cost",
|
labelText: "Travel Cost",
|
||||||
backgroundColor: AppColor.fieldBgColor(context),
|
backgroundColor: AppColor.fieldBgColor(context),
|
||||||
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
||||||
initialValue: requestDetailProvider.workOrderCostModel?.travelCost?.toString(),
|
initialValue: _localModel.travelCost?.toString() ?? '',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
||||||
showShadow: false,
|
showShadow: false,
|
||||||
onChange: (value) {
|
onChange: (value) {
|
||||||
requestDetailProvider.workOrderCostModel?.travelCost = num.parse(value);
|
_localModel.travelCost = num.tryParse(value);
|
||||||
},
|
},
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
8.height,
|
8.height,
|
||||||
AppTextFormField(
|
AppTextFormField(
|
||||||
labelText: "Quot Amount",
|
labelText: "Quot Amount",
|
||||||
backgroundColor: AppColor.fieldBgColor(context),
|
backgroundColor: AppColor.fieldBgColor(context),
|
||||||
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
||||||
initialValue: requestDetailProvider.workOrderCostModel?.qAmount?.toString(),
|
initialValue: _localModel.qAmount?.toString() ?? '',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
||||||
showShadow: false,
|
showShadow: false,
|
||||||
onChange: (value) {
|
onChange: (value) {
|
||||||
requestDetailProvider.workOrderCostModel?.qAmount = num.parse(value);
|
_localModel.qAmount = num.tryParse(value);
|
||||||
},
|
},
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
8.height,
|
8.height,
|
||||||
AppTextFormField(
|
AppTextFormField(
|
||||||
labelText: "PR No",
|
labelText: "PR No",
|
||||||
backgroundColor: AppColor.fieldBgColor(context),
|
backgroundColor: AppColor.fieldBgColor(context),
|
||||||
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
||||||
initialValue: requestDetailProvider.workOrderCostModel?.prNo,
|
initialValue: _localModel.prNo ?? '',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
textInputType: TextInputType.text,
|
||||||
showShadow: false,
|
showShadow: false,
|
||||||
onChange: (value) {
|
onChange: (value) {
|
||||||
requestDetailProvider.workOrderCostModel?.prNo = value;
|
_localModel.prNo = value.isEmpty ? null : value;
|
||||||
},
|
},
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
8.height,
|
8.height,
|
||||||
AppTextFormField(
|
AppTextFormField(
|
||||||
labelText: "PO No",
|
labelText: "PO No",
|
||||||
backgroundColor: AppColor.fieldBgColor(context),
|
backgroundColor: AppColor.fieldBgColor(context),
|
||||||
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
||||||
initialValue: requestDetailProvider.workOrderCostModel?.poNo,
|
initialValue: _localModel.poNo ?? '',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
textInputType: TextInputType.text,
|
||||||
showShadow: false,
|
showShadow: false,
|
||||||
onChange: (value) {
|
onChange: (value) {
|
||||||
requestDetailProvider.workOrderCostModel?.poNo = value;
|
_localModel.poNo = value.isEmpty ? null : value;
|
||||||
},
|
},
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
8.height,
|
8.height,
|
||||||
AppTextFormField(
|
AppTextFormField(
|
||||||
labelText: "MR No",
|
labelText: "MR No",
|
||||||
backgroundColor: AppColor.fieldBgColor(context),
|
backgroundColor: AppColor.fieldBgColor(context),
|
||||||
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
||||||
initialValue: requestDetailProvider.workOrderCostModel?.mrNo,
|
initialValue: _localModel.mrNo ?? '',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
textInputType: TextInputType.text,
|
||||||
showShadow: false,
|
showShadow: false,
|
||||||
onChange: (value) {
|
onChange: (value) {
|
||||||
requestDetailProvider.workOrderCostModel?.mrNo = value;
|
_localModel.mrNo = value.isEmpty ? null : value;
|
||||||
},
|
},
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
8.height,
|
8.height,
|
||||||
AppTextFormField(
|
AppTextFormField(
|
||||||
labelText: "Exchange Cost",
|
labelText: "Exchange Cost",
|
||||||
backgroundColor: AppColor.fieldBgColor(context),
|
backgroundColor: AppColor.fieldBgColor(context),
|
||||||
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
|
||||||
initialValue: requestDetailProvider.workOrderCostModel?.exchangeCost != null ? requestDetailProvider.workOrderCostModel?.exchangeCost.toString() : '',
|
initialValue: _localModel.exchangeCost?.toString() ?? '',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
||||||
showShadow: false,
|
showShadow: false,
|
||||||
onChange: (value) {
|
onChange: (value) {
|
||||||
requestDetailProvider.workOrderCostModel?.exchangeCost = num.parse(value);
|
_localModel.exchangeCost = num.tryParse(value);
|
||||||
},
|
},
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
).toShadowContainer(context).paddingAll(16),
|
).toShadowContainer(context).paddingAll(16),
|
||||||
).expanded,
|
),
|
||||||
FooterActionButton.footerContainer(
|
|
||||||
context: context,
|
|
||||||
child: AppFilledButton(
|
|
||||||
label: "Update Cost Details",
|
|
||||||
buttonColor: AppColor.primary10,
|
|
||||||
onPressed: () async {
|
|
||||||
if (validateForm(requestDetailProvider: requestDetailProvider)) {
|
|
||||||
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
|
|
||||||
await requestDetailProvider.engineerUpdateCost().then((success) {
|
|
||||||
Navigator.pop(context);
|
|
||||||
if (success) {
|
|
||||||
Navigator.pop(context);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
FooterActionButton.footerContainer(
|
||||||
],
|
context: context,
|
||||||
);
|
child: AppFilledButton(
|
||||||
}),
|
label: "Update Cost Details",
|
||||||
|
buttonColor: AppColor.primary10,
|
||||||
|
onPressed: () => _onSubmit(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool validateForm({required CMDetailProvider requestDetailProvider}) {
|
Future<void> _onSubmit() async {
|
||||||
bool isValid = true;
|
widget.provider.workOrderCostModel = _localModel;
|
||||||
if (!widget.isEdit) {
|
showDialog(
|
||||||
return true;
|
context: context,
|
||||||
}
|
barrierDismissible: false,
|
||||||
// if (requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus != null) {
|
builder: (context) => const AppLazyLoading(),
|
||||||
// if (requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.value == 1 || requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.value == 2) {
|
);
|
||||||
// if (requestDetailProvider.engineerUpdateWorkOrderHelperModel!.returnToService == null) {
|
|
||||||
// Fluttertoast.showToast(msg: "Return to service is required ", toastLength: Toast.LENGTH_LONG);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return isValid;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget assetStatusWidget({required BuildContext context, required EngineerUpdateWorkOrderHelperModel workOrderData}) {
|
try {
|
||||||
return Consumer<EquipmentStatusProvider>(builder: (cxt, snapshot, _) {
|
final success = await widget.provider.engineerUpdateCost();
|
||||||
return Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
if (mounted) Navigator.pop(context); // Close loading
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
if (success && mounted) {
|
||||||
context.translation.assetStatus.bodyText(context).custom(color: AppColor.black20),
|
Navigator.pop(context);
|
||||||
8.height,
|
}
|
||||||
Wrap(
|
} catch (e) {
|
||||||
runSpacing: 8,
|
if (mounted) Navigator.pop(context);
|
||||||
spacing: 8,
|
log('Error updating cost: $e');
|
||||||
children: [
|
}
|
||||||
for (var element in snapshot.items)
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
child: Radio(
|
|
||||||
value: element,
|
|
||||||
activeColor: Colors.red,
|
|
||||||
fillColor: WidgetStateColor.resolveWith((states) {
|
|
||||||
if (states.contains(WidgetState.selected)) return AppColor.primary10;
|
|
||||||
return AppColor.neutral130;
|
|
||||||
}),
|
|
||||||
groupValue: workOrderData.equipmentStatus,
|
|
||||||
onChanged: (state) {
|
|
||||||
setState(() {
|
|
||||||
workOrderData.equipmentStatus = element;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
8.width,
|
|
||||||
Text(element.name ?? '', style: AppTextStyles.tinyFont.copyWith(color: AppColor.neutral120)),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
).toShimmer(isShow: snapshot.loading, context: context),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,31 +1,33 @@
|
|||||||
import 'package:test_sa/models/lookup.dart';
|
//TODO : need to remove this class
|
||||||
|
|
||||||
class DemoAttachments {
|
// import 'package:test_sa/models/lookup.dart';
|
||||||
int? id;
|
//
|
||||||
num? demoRequestId;
|
// class DemoAttachments {
|
||||||
num? documentTypeId;
|
// int? id;
|
||||||
Lookup? documentType;
|
// num? demoRequestId;
|
||||||
String? attachmentName;
|
// Lookup? documentType;
|
||||||
String? originalName;
|
// String? attachmentName;
|
||||||
|
// String? originalName;
|
||||||
DemoAttachments({this.id, this.documentTypeId, this.documentType, this.attachmentName, this.demoRequestId, this.originalName});
|
//
|
||||||
|
// DemoAttachments({this.id, this.documentType, this.attachmentName, this.demoRequestId, this.originalName});
|
||||||
DemoAttachments.fromJson(dynamic json) {
|
//
|
||||||
id = json['id'];
|
// DemoAttachments.fromJson(dynamic json) {
|
||||||
documentTypeId = json['documentTypeId'];
|
// id = json['id'];
|
||||||
documentType = json['documentType'] != null ? Lookup.fromJson(json['documentType']) : null;
|
// documentType = json['documentType'] != null ? Lookup.fromJson(json['documentType']) : null;
|
||||||
demoRequestId = json['demoRequestId'];
|
// demoRequestId = json['demoRequestId'];
|
||||||
attachmentName = json['attachmentName'];
|
// attachmentName = json['attachmentName'];
|
||||||
originalName = json['originalName'];
|
// originalName = json['originalName'];
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Map<String, dynamic> toJson() {
|
// Map<String, dynamic> toJson() {
|
||||||
final map = <String, dynamic>{};
|
// final map = <String, dynamic>{};
|
||||||
map['id'] = id;
|
// map['id'] = id;
|
||||||
map['documentTypeId'] = documentTypeId;
|
// if(documentType!=null){
|
||||||
map['attachmentName'] = attachmentName;
|
// map['documentTypeId'] = documentType?.id;
|
||||||
map['demoRequestId'] = demoRequestId;
|
// }
|
||||||
map['originalName'] = originalName;
|
// map['attachmentName'] = attachmentName;
|
||||||
return map;
|
// map['demoRequestId'] = demoRequestId;
|
||||||
}
|
// map['originalName'] = originalName;
|
||||||
}
|
// return map;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@ -1,24 +1,26 @@
|
|||||||
class IncidentAttachments {
|
//TODO : need to delete this
|
||||||
num? id;
|
|
||||||
num? incidentId;
|
|
||||||
String? attachmentName;
|
|
||||||
String? attachmentDescription;
|
|
||||||
|
|
||||||
IncidentAttachments({this.id, this.attachmentName, this.incidentId, this.attachmentDescription});
|
// class IncidentAttachments {
|
||||||
|
// num? id;
|
||||||
IncidentAttachments.fromJson(dynamic json) {
|
// num? incidentId;
|
||||||
id = json['id'];
|
// String? attachmentName;
|
||||||
incidentId = json['incidentId'];
|
// String? attachmentDescription;
|
||||||
attachmentName = json['attachmentName'];
|
//
|
||||||
attachmentDescription = json['attachmentDescription'];
|
// IncidentAttachments({this.id, this.attachmentName, this.incidentId, this.attachmentDescription});
|
||||||
}
|
//
|
||||||
|
// IncidentAttachments.fromJson(dynamic json) {
|
||||||
Map<String, dynamic> toJson() {
|
// id = json['id'];
|
||||||
final map = <String, dynamic>{};
|
// incidentId = json['incidentId'];
|
||||||
map['id'] = id;
|
// attachmentName = json['attachmentName'];
|
||||||
map['attachmentName'] = attachmentName;
|
// attachmentDescription = json['attachmentDescription'];
|
||||||
map['incidentId'] = incidentId;
|
// }
|
||||||
map['attachmentDescription'] = attachmentDescription;
|
//
|
||||||
return map;
|
// Map<String, dynamic> toJson() {
|
||||||
}
|
// final map = <String, dynamic>{};
|
||||||
}
|
// map['id'] = id;
|
||||||
|
// map['attachmentName'] = attachmentName;
|
||||||
|
// map['incidentId'] = incidentId;
|
||||||
|
// map['attachmentDescription'] = attachmentDescription;
|
||||||
|
// return map;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@ -1,26 +1,32 @@
|
|||||||
import 'dart:developer';
|
//TODO : need to remove this class.
|
||||||
|
// import 'dart:developer';
|
||||||
class InternalAuditAttachments {
|
//
|
||||||
InternalAuditAttachments({this.id, this.originalName, this.name, this.createdBy});
|
// import 'package:test_sa/models/lookup.dart';
|
||||||
|
//
|
||||||
int? id;
|
// class InternalAuditAttachments {
|
||||||
String? name;
|
// InternalAuditAttachments({this.id, this.originalName, this.name, this.createdBy,this.documentType});
|
||||||
String? originalName;
|
//
|
||||||
String? createdBy;
|
// int? id;
|
||||||
|
// String? name;
|
||||||
InternalAuditAttachments.fromJson(Map<String, dynamic> json) {
|
// String? originalName;
|
||||||
id = json['id'];
|
// String? createdBy;
|
||||||
name = (json['name'] != null && !json['name'].toString().startsWith('data:image/jpeg')) ? json['name'] : null;
|
// Lookup ? documentType;
|
||||||
originalName = json['originalName'];
|
//
|
||||||
createdBy = json['createdBy'];
|
// InternalAuditAttachments.fromJson(Map<String, dynamic> json) {
|
||||||
}
|
// id = json['id'];
|
||||||
|
// name = (json['name'] != null && !json['name'].toString().startsWith('data:image/jpeg')) ? json['name'] : null;
|
||||||
Map<String, dynamic> toJson() {
|
// originalName = json['originalName'];
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
// createdBy = json['createdBy'];
|
||||||
data['id'] = id;
|
// documentType =json['documentType'];
|
||||||
data['name'] = name;
|
// }
|
||||||
data['originalName'] = originalName;
|
//
|
||||||
// data['createdBy'] = createdBy;
|
// Map<String, dynamic> toJson() {
|
||||||
return data;
|
// final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
}
|
// data['id'] = id;
|
||||||
}
|
// data['name'] = name;
|
||||||
|
// data['originalName'] = originalName;
|
||||||
|
// data['documentTypeId'] = documentType?.id;
|
||||||
|
// // data['createdBy'] = createdBy;
|
||||||
|
// return data;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue