@7365admin1/layer-common 3.0.14 → 3.0.15
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.
- package/CHANGELOG.md +6 -0
- package/components/DashboardMain.vue +78 -27
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -653,7 +653,15 @@
|
|
|
653
653
|
<button
|
|
654
654
|
class="figma-row-action"
|
|
655
655
|
type="button"
|
|
656
|
-
@click="
|
|
656
|
+
@click="
|
|
657
|
+
navigateTo(
|
|
658
|
+
item.type === 'facility-booking'
|
|
659
|
+
? `${dashboardPath('facility/bookings')}?booking=${
|
|
660
|
+
item.id
|
|
661
|
+
}`
|
|
662
|
+
: dashboardPath(`incident-reports/${item.id}`)
|
|
663
|
+
)
|
|
664
|
+
"
|
|
657
665
|
>
|
|
658
666
|
{{ item.actionLabel || "Review" }}
|
|
659
667
|
</button>
|
|
@@ -1146,6 +1154,8 @@ type DashboardListItem = {
|
|
|
1146
1154
|
tone?: string;
|
|
1147
1155
|
color?: string;
|
|
1148
1156
|
actionLabel?: string;
|
|
1157
|
+
type?: string;
|
|
1158
|
+
raw?: Record<string, any>;
|
|
1149
1159
|
};
|
|
1150
1160
|
|
|
1151
1161
|
type TaskItem = {
|
|
@@ -1236,21 +1246,36 @@ function canViewWidget(key: string) {
|
|
|
1236
1246
|
|
|
1237
1247
|
const widgetToModulePermissionMap: Record<string, string[]> = {
|
|
1238
1248
|
workOrders: ["work-orders:see-all-work-orders"],
|
|
1239
|
-
incidents: [
|
|
1249
|
+
incidents: [
|
|
1250
|
+
"incident-reports:see-incident-reports",
|
|
1251
|
+
"incident-reports:see-all-incident-reports",
|
|
1252
|
+
],
|
|
1240
1253
|
visitors: ["visitor:see-all-visitor"],
|
|
1241
1254
|
facilityBookings: ["facility-booking:see-all-facility-booking"],
|
|
1242
|
-
patrolCompliance: [
|
|
1255
|
+
patrolCompliance: [
|
|
1256
|
+
"virtual-patrol:see-all-virtual-patrol-logs",
|
|
1257
|
+
"virtual-patrol:see-all-virtual-patrol-route",
|
|
1258
|
+
],
|
|
1243
1259
|
staffStatus: ["attendance:see-all-attendance"],
|
|
1244
1260
|
attendance: ["attendance:see-all-attendance"],
|
|
1245
1261
|
feedbacks: ["feedbacks:see-all-feedbacks"],
|
|
1246
|
-
upcomingEvents: [
|
|
1262
|
+
upcomingEvents: [
|
|
1263
|
+
"bulletin-boards:see-all-bulletin-boards",
|
|
1264
|
+
"bulletin-board:see-all-bulletin-board",
|
|
1265
|
+
],
|
|
1247
1266
|
workOrderStatus: ["work-orders:see-all-work-orders"],
|
|
1248
|
-
activePatrol: [
|
|
1249
|
-
|
|
1267
|
+
activePatrol: [
|
|
1268
|
+
"virtual-patrol:see-all-virtual-patrol-logs",
|
|
1269
|
+
"virtual-patrol:see-all-virtual-patrol-route",
|
|
1270
|
+
],
|
|
1271
|
+
taskSchedule: ["cleaning-schedule-mgmt:see-all-schedules"],
|
|
1250
1272
|
};
|
|
1251
1273
|
|
|
1252
1274
|
const modulePerms = widgetToModulePermissionMap[key];
|
|
1253
|
-
if (
|
|
1275
|
+
if (
|
|
1276
|
+
modulePerms &&
|
|
1277
|
+
modulePerms.some((p) => userAppRole.value.permissions?.includes(p))
|
|
1278
|
+
) {
|
|
1254
1279
|
return true;
|
|
1255
1280
|
}
|
|
1256
1281
|
|
|
@@ -2034,23 +2059,26 @@ function computeFacilityMetric(): DashboardMetric {
|
|
|
2034
2059
|
).toLowerCase();
|
|
2035
2060
|
return val === selected.toLowerCase();
|
|
2036
2061
|
});
|
|
2062
|
+
const ongoing = items.filter((i: any) => {
|
|
2063
|
+
const s = String(i.status || "").toLowerCase();
|
|
2064
|
+
return (
|
|
2065
|
+
s.includes("ongoing") ||
|
|
2066
|
+
s.includes("approved") ||
|
|
2067
|
+
s.includes("in-progress")
|
|
2068
|
+
);
|
|
2069
|
+
}).length;
|
|
2070
|
+
const waitingApproval = items.filter((i: any) => {
|
|
2071
|
+
const s = String(i.status || "").toLowerCase();
|
|
2072
|
+
return (
|
|
2073
|
+
s.includes("pending") || s.includes("review") || s.includes("approval")
|
|
2074
|
+
);
|
|
2075
|
+
}).length;
|
|
2076
|
+
|
|
2037
2077
|
return {
|
|
2038
2078
|
...metric,
|
|
2039
|
-
count:
|
|
2040
|
-
ongoing
|
|
2041
|
-
|
|
2042
|
-
return (
|
|
2043
|
-
s.includes("ongoing") ||
|
|
2044
|
-
s.includes("approved") ||
|
|
2045
|
-
s.includes("in-progress")
|
|
2046
|
-
);
|
|
2047
|
-
}).length,
|
|
2048
|
-
waitingApproval: items.filter((i: any) => {
|
|
2049
|
-
const s = String(i.status || "").toLowerCase();
|
|
2050
|
-
return (
|
|
2051
|
-
s.includes("pending") || s.includes("review") || s.includes("approval")
|
|
2052
|
-
);
|
|
2053
|
-
}).length,
|
|
2079
|
+
count: ongoing + waitingApproval,
|
|
2080
|
+
ongoing,
|
|
2081
|
+
waitingApproval,
|
|
2054
2082
|
};
|
|
2055
2083
|
}
|
|
2056
2084
|
|
|
@@ -2413,7 +2441,9 @@ function getMetricMeta(metric: DashboardMetric) {
|
|
|
2413
2441
|
parts.push(`${formatNumber(toNumber(metric.ongoing))} ongoing`);
|
|
2414
2442
|
if (typeof metric.waitingApproval !== "undefined")
|
|
2415
2443
|
parts.push(
|
|
2416
|
-
`${formatNumber(toNumber(metric.waitingApproval))}
|
|
2444
|
+
`${formatNumber(toNumber(metric.waitingApproval))} ${
|
|
2445
|
+
isPropertyMode.value ? "for approval" : "waiting approval"
|
|
2446
|
+
}`
|
|
2417
2447
|
);
|
|
2418
2448
|
if (typeof metric.lowStock !== "undefined")
|
|
2419
2449
|
parts.push(`${formatNumber(toNumber(metric.lowStock))} low stock`);
|
|
@@ -2446,6 +2476,10 @@ function getFilteredVisitorMetric(): DashboardMetric {
|
|
|
2446
2476
|
};
|
|
2447
2477
|
}
|
|
2448
2478
|
|
|
2479
|
+
if (!items || !items.length) {
|
|
2480
|
+
return metric;
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2449
2483
|
const filtered = items.filter(
|
|
2450
2484
|
(item: any) => getVisitorFilterValue(item) === selected
|
|
2451
2485
|
);
|
|
@@ -2487,6 +2521,8 @@ function normalizeListItems(keys: string[]): DashboardListItem[] {
|
|
|
2487
2521
|
icon: item.icon || getListIcon(context),
|
|
2488
2522
|
tone: item.tone,
|
|
2489
2523
|
actionLabel: item.actionLabel,
|
|
2524
|
+
type: item.type,
|
|
2525
|
+
raw: item,
|
|
2490
2526
|
}));
|
|
2491
2527
|
}
|
|
2492
2528
|
|
|
@@ -2865,16 +2901,26 @@ function dashboardPath(path: string) {
|
|
|
2865
2901
|
return `/${props.orgId}/${props.site}/${path}`;
|
|
2866
2902
|
}
|
|
2867
2903
|
|
|
2904
|
+
function getSchedulePath() {
|
|
2905
|
+
const service = props.serviceType;
|
|
2906
|
+
if (service === "cleaning_services") return "cleaning-schedule";
|
|
2907
|
+
if (service === "landscaping_services") return "landscape-schedule";
|
|
2908
|
+
if (service === "pest_control_services") return "pest-schedule";
|
|
2909
|
+
if (service === "pool_maintenance_services") return "pool-schedule";
|
|
2910
|
+
if (service === "mechanical_electrical_services") return "technician-schedule";
|
|
2911
|
+
return "schedule-task";
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2868
2914
|
function goToDashboardRoute(routeKey: string) {
|
|
2869
2915
|
if (!props.orgId || !props.site) return;
|
|
2870
2916
|
const pathMap: Record<string, string> = {
|
|
2871
2917
|
attendance: "attendance",
|
|
2872
2918
|
feedbacks: "feedbacks",
|
|
2873
|
-
scheduleTask:
|
|
2919
|
+
scheduleTask: getSchedulePath(),
|
|
2874
2920
|
virtualPatrol: "virtual-patrol/logs",
|
|
2875
2921
|
manpower: "manpower-monitoring/attendance",
|
|
2876
2922
|
incidentReports: "incident-reports",
|
|
2877
|
-
"virtual-patrol": "virtual-patrol",
|
|
2923
|
+
"virtual-patrol": "virtual-patrol/logs",
|
|
2878
2924
|
"work-orders": "work-orders",
|
|
2879
2925
|
"event-mgmt": "event-mgmt",
|
|
2880
2926
|
calendar: "calendar",
|
|
@@ -2896,10 +2942,15 @@ function goToListItem(item: TaskItem | FeedbackItem, routeKey: string) {
|
|
|
2896
2942
|
}
|
|
2897
2943
|
const pathMap: Record<string, string> = {
|
|
2898
2944
|
feedbacks: "feedbacks",
|
|
2899
|
-
scheduleTask:
|
|
2945
|
+
scheduleTask: getSchedulePath(),
|
|
2900
2946
|
};
|
|
2901
2947
|
const path = pathMap[routeKey] || routeKey;
|
|
2902
|
-
|
|
2948
|
+
const scheduleId = item.raw?.schedule?._id || item.raw?.schedule;
|
|
2949
|
+
if (routeKey === "scheduleTask" && scheduleId) {
|
|
2950
|
+
router.push(`/${props.orgId}/${props.site}/${path}/${scheduleId}/${id}`);
|
|
2951
|
+
} else {
|
|
2952
|
+
router.push(`/${props.orgId}/${props.site}/${path}/${id}`);
|
|
2953
|
+
}
|
|
2903
2954
|
}
|
|
2904
2955
|
|
|
2905
2956
|
// ─── Widget Management ────────────────────────────────────────────────────────
|