@7365admin1/layer-common 3.0.30-staging.2 → 3.0.30-staging.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1560,18 +1560,27 @@ const dashboardWidgetPermissions: Record<string, string> = {
1560
1560
  };
1561
1561
 
1562
1562
  const propertyWidgetPermissions: Record<string, string[]> = {
1563
- workOrders: ["workOrder:see-all-work-orders"],
1563
+ workOrders: [
1564
+ "workOrder:see-all-work-orders",
1565
+ "work-order:see-all-work-orders",
1566
+ ],
1564
1567
  incidents: ["incident-reports:see-incident-reports"],
1565
1568
  visitors: ["visitorManagement:see-all-visitor"],
1566
1569
  facilityBookings: ["facility-booking-mgmt:see-all-facility-booking"],
1567
- activity: ["workOrder:see-all-work-orders"],
1570
+ activity: [
1571
+ "workOrder:see-all-work-orders",
1572
+ "work-order:see-all-work-orders",
1573
+ ],
1568
1574
  upcomingEvents: ["event-mgmt:see-all-event"],
1569
1575
  todayReminders: ["event-mgmt:see-all-event"],
1570
1576
  todayAttentions: [
1571
1577
  "incident-reports:see-incident-reports",
1572
1578
  "facility-booking-mgmt:see-all-facility-booking",
1573
1579
  ],
1574
- workOrderStatus: ["workOrder:see-all-work-orders"],
1580
+ workOrderStatus: [
1581
+ "workOrder:see-all-work-orders",
1582
+ "work-order:see-all-work-orders",
1583
+ ],
1575
1584
  feedbacks: ["feedbacks:see-all-feedback"],
1576
1585
  activePatrol: ["virtual-patrol:see-all-virtual-patrol-logs"],
1577
1586
  };
@@ -1587,6 +1596,11 @@ const moduleWidgetPermissions: Record<string, string[]> = {
1587
1596
  "work-order:see-all-work-orders",
1588
1597
  "work-orders:see-all-work-orders",
1589
1598
  ],
1599
+ activity: [
1600
+ "work_order:see-all-work-orders",
1601
+ "work-order:see-all-work-orders",
1602
+ "work-orders:see-all-work-orders",
1603
+ ],
1590
1604
  taskSchedule: [
1591
1605
  "cleaning-schedule-mgmt:see-all-schedules",
1592
1606
  "schedule-task-mgmt:see-all-schedule-tasks",
@@ -221,7 +221,7 @@ const headers = computed(() => {
221
221
  title: "Status",
222
222
  value: "status",
223
223
  },
224
-
224
+
225
225
  ];
226
226
 
227
227
  if (props.status === "pending" && props.cancelInvitation) {
@@ -270,10 +270,11 @@ const {
270
270
  page: page.value,
271
271
  status: props.status,
272
272
  search: headerSearch.value,
273
- type: "user-invite,member-invite",
273
+ // type: "user-invite,member-invite",
274
+ type: "member-invite",
274
275
  app: props.app,
275
276
  orgId: props.org,
276
- siteId: props.siteId,
277
+ // siteId: props.siteId,
277
278
  }),
278
279
  {
279
280
  watch: [() => props.status]
@@ -77,6 +77,53 @@
77
77
  </v-col>
78
78
  </v-row>
79
79
  </v-col>
80
+ <v-col
81
+ v-if="item.reject && (item.remarks || item.attachment?.length)"
82
+ cols="12"
83
+ class="mt-2"
84
+ >
85
+ <v-sheet
86
+ border
87
+ rounded="lg"
88
+ class="d-inline-flex flex-column pa-3 bg-grey-lighten-5"
89
+ style="max-width: 420px"
90
+ >
91
+ <div class="d-flex align-center ga-2 mb-2">
92
+ <v-icon color="error" size="18">mdi-close-circle</v-icon>
93
+ <span class="text-caption font-weight-bold">
94
+ Rejection details
95
+ </span>
96
+ <v-chip size="x-small" color="error" variant="tonal">
97
+ Rejected
98
+ </v-chip>
99
+ </div>
100
+ <div v-if="item.remarks" class="text-body-2 text-medium-emphasis">
101
+ {{ item.remarks }}
102
+ </div>
103
+ <div
104
+ v-if="item.attachment?.length"
105
+ class="d-flex flex-wrap ga-2 mt-3"
106
+ >
107
+ <v-sheet
108
+ v-for="attachmentId in item.attachment"
109
+ :key="attachmentId"
110
+ rounded="lg"
111
+ border
112
+ class="overflow-hidden"
113
+ style="width: 96px; height: 96px"
114
+ >
115
+ <v-img
116
+ :src="getFileUrl(attachmentId)"
117
+ width="96"
118
+ height="96"
119
+ cover
120
+ style="cursor: zoom-in"
121
+ @click="openFullImage(getFileUrl(attachmentId))"
122
+ />
123
+ </v-sheet>
124
+ </div>
125
+ </v-sheet>
126
+ </v-col>
80
127
  </v-row>
81
128
  </template>
82
129
 
@@ -97,6 +144,8 @@
97
144
  : 'text'
98
145
  "
99
146
  color="error"
147
+ :loading="!!loadingActions[getKey(item, group.set)]"
148
+ :disabled="!!loadingActions[getKey(item, group.set)]"
100
149
  @click.stop="handleItemActionClick(item, group.set, 'reject')"
101
150
  />
102
151
  </v-col>
@@ -221,6 +270,69 @@
221
270
  </v-card>
222
271
  </v-dialog>
223
272
 
273
+ <v-dialog v-model="showRejectModal" max-width="600" persistent>
274
+ <v-card>
275
+ <v-card-title class="text-h5 pa-4">Reject Checklist Item</v-card-title>
276
+
277
+ <v-divider />
278
+
279
+ <v-card-text class="pa-4">
280
+ <v-row>
281
+ <v-col cols="12">
282
+ <InputLabel title="Remarks" :required="true" class="mb-2" />
283
+ <v-textarea
284
+ v-model="rejectModal.remarks"
285
+ placeholder="Enter remarks"
286
+ rows="4"
287
+ variant="outlined"
288
+ density="comfortable"
289
+ hide-details
290
+ />
291
+ </v-col>
292
+
293
+ <v-col cols="12">
294
+ <v-divider class="mb-4" />
295
+ <PhotoUpload
296
+ title="Take/Upload Photo"
297
+ :required="false"
298
+ v-model="rejectModal.photos"
299
+ v-model:photo-ids="rejectModal.photoIds"
300
+ @error="handlePhotoError"
301
+ />
302
+ </v-col>
303
+ </v-row>
304
+ </v-card-text>
305
+
306
+ <v-divider />
307
+
308
+ <v-card-actions class="pa-0">
309
+ <v-btn
310
+ color="grey"
311
+ variant="flat"
312
+ rounded="0"
313
+ class="flex-grow-1 text-none"
314
+ height="48"
315
+ :disabled="rejectModal.submitting"
316
+ @click="closeRejectDialog"
317
+ >
318
+ Cancel
319
+ </v-btn>
320
+ <v-btn
321
+ color="error"
322
+ variant="flat"
323
+ rounded="0"
324
+ class="flex-grow-1 text-none"
325
+ height="48"
326
+ :loading="rejectModal.submitting"
327
+ :disabled="!isRejectModalValid || rejectModal.submitting"
328
+ @click="submitRejectDialog"
329
+ >
330
+ Confirm
331
+ </v-btn>
332
+ </v-card-actions>
333
+ </v-card>
334
+ </v-dialog>
335
+
224
336
  <v-dialog v-model="showAttachmentDialog" max-width="700" scrollable>
225
337
  <v-card>
226
338
  <v-card-title class="d-flex align-center pa-4">
@@ -492,6 +604,20 @@ const isModalValid = computed(() => {
492
604
  return modalData.remark?.trim().length > 0;
493
605
  });
494
606
 
607
+ const showRejectModal = ref(false);
608
+ const rejectModal = reactive({
609
+ item: null as TUnitChecklistItem | null,
610
+ set: undefined as number | undefined,
611
+ remarks: "",
612
+ photos: [] as string[],
613
+ photoIds: [] as string[],
614
+ submitting: false,
615
+ });
616
+
617
+ const isRejectModalValid = computed(
618
+ () => rejectModal.remarks.trim().length > 0
619
+ );
620
+
495
621
  const {
496
622
  data: getUnitCleanerChecklistReq,
497
623
  refresh: getUnitCleanerChecklistRefresh,
@@ -590,6 +716,29 @@ function resetModalData(): void {
590
716
  modalData.lastApprovedKey = null;
591
717
  }
592
718
 
719
+ function resetRejectModal(): void {
720
+ rejectModal.item = null;
721
+ rejectModal.set = undefined;
722
+ rejectModal.remarks = "";
723
+ rejectModal.photos = [];
724
+ rejectModal.photoIds = [];
725
+ rejectModal.submitting = false;
726
+ }
727
+
728
+ function closeRejectDialog(): void {
729
+ if (rejectModal.submitting) return;
730
+ showRejectModal.value = false;
731
+ resetRejectModal();
732
+ }
733
+
734
+ function openRejectDialog(item: TUnitChecklistItem, set: number): void {
735
+ rejectModal.item = item;
736
+ rejectModal.set = set;
737
+ rejectModal.remarks = item.remarks || "";
738
+ rejectModal.photoIds = item.attachment || [];
739
+ showRejectModal.value = true;
740
+ }
741
+
593
742
  function closeModal(): void {
594
743
  const setNumber = modalData.currentSet;
595
744
  showCompletionModal.value = false;
@@ -661,6 +810,41 @@ async function submitModal(): Promise<void> {
661
810
  closeModal();
662
811
  }
663
812
 
813
+ async function submitRejectDialog(): Promise<void> {
814
+ const item = rejectModal.item;
815
+ const set = rejectModal.set;
816
+
817
+ if (!item || set === undefined || !isRejectModalValid.value) return;
818
+
819
+ const key = getKey(item, set);
820
+ rejectModal.submitting = true;
821
+ loadingActions[key] = true;
822
+
823
+ try {
824
+ const response = await updateUnitChecklist(
825
+ props.scheduleAreaId,
826
+ item.unit,
827
+ set,
828
+ "reject",
829
+ rejectModal.remarks.trim(),
830
+ rejectModal.photoIds
831
+ );
832
+ showMessage(response?.message || "Unit rejected successfully", "success");
833
+ showRejectModal.value = false;
834
+ resetRejectModal();
835
+ await getUnitCleanerChecklistRefresh();
836
+ } catch (error: any) {
837
+ console.error("Error rejecting unit checklist:", error);
838
+ showMessage(
839
+ error?.data?.message || error?.message || "Failed to reject checklist",
840
+ "error"
841
+ );
842
+ } finally {
843
+ delete loadingActions[key];
844
+ rejectModal.submitting = false;
845
+ }
846
+ }
847
+
664
848
  async function handleItemActionClick(
665
849
  item: TUnitChecklistItem,
666
850
  set: number | undefined,
@@ -688,13 +872,13 @@ async function handleItemActionClick(
688
872
  return;
689
873
  }
690
874
 
691
- activeActions[key] = action;
692
-
693
875
  if (action === "reject") {
694
- await _callUpdateUnitChecklist(item, set, action);
876
+ openRejectDialog(item, set);
695
877
  return;
696
878
  }
697
879
 
880
+ activeActions[key] = action;
881
+
698
882
  // Approve: check if this completes the entire set
699
883
  lastApprovedKey.value = key;
700
884
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "3.0.30-staging.2",
5
+ "version": "3.0.30-staging.4",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {