@7365admin1/layer-common 4.17.1-staging.331 → 4.17.1-staging.332
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.
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
:key="card.key"
|
|
18
18
|
class="print-kpi-card"
|
|
19
19
|
>
|
|
20
|
-
<span class="print-kpi-title">{{ card
|
|
20
|
+
<span class="print-kpi-title">{{ cardTitle(card) }}</span>
|
|
21
21
|
<template
|
|
22
22
|
v-if="card.key === 'supplyAlert' && Array.isArray(card.raw?.items)"
|
|
23
23
|
>
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
:icon="card.icon"
|
|
332
332
|
:tint="card.tint"
|
|
333
333
|
:color="card.color"
|
|
334
|
-
:label="card
|
|
334
|
+
:label="cardTitle(card)"
|
|
335
335
|
:value="card.value"
|
|
336
336
|
:chip="kpiChipText(card)"
|
|
337
337
|
:down="Number(card.percentage) < 0"
|
|
@@ -1422,7 +1422,15 @@ const moduleWidgetPermissions: Record<string, string[]> = {
|
|
|
1422
1422
|
],
|
|
1423
1423
|
staffStatus: ["attendance-mgmt:see-all-attendance"],
|
|
1424
1424
|
attendance: ["attendance-mgmt:see-all-attendance"],
|
|
1425
|
-
|
|
1425
|
+
// Inventory roles see the tile too: where a store serves the site it lists
|
|
1426
|
+
// the items at or below their alert level (core new-dashboard.repo).
|
|
1427
|
+
supplyAlert: [
|
|
1428
|
+
"supply-mgmt:see-all-supplies",
|
|
1429
|
+
"inventory:view-inventory",
|
|
1430
|
+
"inventory:request-stock",
|
|
1431
|
+
"inventory:approve-requests",
|
|
1432
|
+
"inventory:manage-inventory",
|
|
1433
|
+
],
|
|
1426
1434
|
feedbacks: [
|
|
1427
1435
|
"feedbacks:see-all-feedback",
|
|
1428
1436
|
"feedback:see-all-feedback",
|
|
@@ -1880,6 +1888,14 @@ const finalDashboardData = computed<Record<string, any>>(() => {
|
|
|
1880
1888
|
* new colour. That also makes each tile the design's own chip pairing, which
|
|
1881
1889
|
* is the ruling this project already follows.
|
|
1882
1890
|
*/
|
|
1891
|
+
/**
|
|
1892
|
+
* Where an Inventory store serves the site, the supply tile lists real low
|
|
1893
|
+
* stock (items at or below their alert level), so it is named for that.
|
|
1894
|
+
*/
|
|
1895
|
+
function cardTitle(card: { key: string; title: string; raw?: any }) {
|
|
1896
|
+
return card.key === "supplyAlert" && card.raw?.basis === "below-alert-level" ? "Low Stock" : card.title;
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1883
1899
|
const KPI_TONES = {
|
|
1884
1900
|
info: { color: "var(--info)", tint: "var(--info-bg)" },
|
|
1885
1901
|
err: { color: "var(--err)", tint: "var(--err-bg)" },
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-dialog v-model="show" max-width="720" persistent scrollable>
|
|
3
|
+
<v-card class="screen-modal">
|
|
4
|
+
<v-card-title class="d-flex align-center">
|
|
5
|
+
Copy from the old Equipment list
|
|
6
|
+
<v-spacer />
|
|
7
|
+
<v-btn icon="mdi-close" variant="text" class="screen-modal__close" aria-label="Close" @click="show = false" />
|
|
8
|
+
</v-card-title>
|
|
9
|
+
<v-card-text class="screen-modal__body">
|
|
10
|
+
<p class="text-body-2 mb-4">
|
|
11
|
+
Bring the items already kept under Equipment Management into this store, with their current quantities.
|
|
12
|
+
We check first; nothing is added until you confirm. Items already in the store are skipped.
|
|
13
|
+
</p>
|
|
14
|
+
<v-progress-linear v-if="loading" indeterminate color="primary" />
|
|
15
|
+
<p v-else-if="!groups.length" class="text-body-2 text-medium-emphasis">There is no old Equipment list at this store's properties.</p>
|
|
16
|
+
<v-radio-group v-else v-model="serviceType" hide-details class="mb-2" @update:model-value="result = null">
|
|
17
|
+
<v-radio v-for="g in groups" :key="g.serviceType" :value="g.serviceType" :label="`${label(g.serviceType)} (${g.count} items)`" />
|
|
18
|
+
</v-radio-group>
|
|
19
|
+
|
|
20
|
+
<template v-if="result">
|
|
21
|
+
<v-alert :type="result.errors ? 'warning' : 'success'" variant="tonal" class="mb-3">
|
|
22
|
+
<template v-if="result.committed">{{ result.ready }} item(s) added.</template>
|
|
23
|
+
<template v-else>{{ result.ready }} item(s) ready to add.</template>
|
|
24
|
+
<span v-if="result.skipped"> {{ result.skipped }} skipped.</span>
|
|
25
|
+
<span v-if="result.errors"> {{ result.errors }} could not be read.</span>
|
|
26
|
+
</v-alert>
|
|
27
|
+
<v-table density="compact" height="260" fixed-header>
|
|
28
|
+
<thead>
|
|
29
|
+
<tr>
|
|
30
|
+
<th>Item</th>
|
|
31
|
+
<th>Result</th>
|
|
32
|
+
</tr>
|
|
33
|
+
</thead>
|
|
34
|
+
<tbody>
|
|
35
|
+
<tr v-for="r in result.rows" :key="r.row">
|
|
36
|
+
<td>{{ r.name || "—" }}</td>
|
|
37
|
+
<td :class="r.status === 'error' ? 'text-error' : r.status === 'skipped' ? 'text-medium-emphasis' : 'text-success'">{{ r.message }}</td>
|
|
38
|
+
</tr>
|
|
39
|
+
</tbody>
|
|
40
|
+
</v-table>
|
|
41
|
+
</template>
|
|
42
|
+
</v-card-text>
|
|
43
|
+
<div class="screen-modal__footer">
|
|
44
|
+
<v-btn class="screen-btn-ghost" variant="outlined" :disabled="busy" @click="show = false">{{ result?.committed ? "Close" : "Cancel" }}</v-btn>
|
|
45
|
+
<v-btn v-if="!result" class="screen-btn-primary" variant="flat" :disabled="!serviceType" :loading="busy" @click="run(false)">Check</v-btn>
|
|
46
|
+
<v-btn v-else-if="!result.committed" class="screen-btn-primary" variant="flat" :disabled="!result.ready" :loading="busy" @click="run(true)">
|
|
47
|
+
Add {{ result.ready }} item(s)
|
|
48
|
+
</v-btn>
|
|
49
|
+
</div>
|
|
50
|
+
</v-card>
|
|
51
|
+
</v-dialog>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import useInventory from "../composables/useInventory";
|
|
56
|
+
|
|
57
|
+
const show = defineModel<boolean>({ default: false });
|
|
58
|
+
const props = defineProps({ store: { type: Object as PropType<TInventoryStore>, required: true } });
|
|
59
|
+
const emit = defineEmits(["done"]);
|
|
60
|
+
|
|
61
|
+
const { getLegacyEquipment, importLegacyEquipment } = useInventory();
|
|
62
|
+
const notify = inject<(text: string, color?: string) => void>("inventoryNotify", () => {});
|
|
63
|
+
|
|
64
|
+
const SERVICE_LABELS: Record<string, string> = {
|
|
65
|
+
cleaning_services: "Cleaning",
|
|
66
|
+
mechanical_electrical_services: "M&E",
|
|
67
|
+
pest_control_services: "Pest Control",
|
|
68
|
+
pool_maintenance_services: "Pool Maintenance",
|
|
69
|
+
landscaping_services: "Landscaping",
|
|
70
|
+
};
|
|
71
|
+
const label = (serviceType: string) => SERVICE_LABELS[serviceType] ?? serviceType;
|
|
72
|
+
|
|
73
|
+
const groups = ref<{ serviceType: string; count: number }[]>([]);
|
|
74
|
+
const serviceType = ref("");
|
|
75
|
+
const loading = ref(false);
|
|
76
|
+
const busy = ref(false);
|
|
77
|
+
const result = ref<Awaited<ReturnType<typeof importLegacyEquipment>> | null>(null);
|
|
78
|
+
|
|
79
|
+
async function run(commit: boolean) {
|
|
80
|
+
busy.value = true;
|
|
81
|
+
try {
|
|
82
|
+
result.value = await importLegacyEquipment(props.store._id, serviceType.value, commit);
|
|
83
|
+
if (commit) {
|
|
84
|
+
notify(`${result.value.ready} item(s) added.`);
|
|
85
|
+
emit("done");
|
|
86
|
+
}
|
|
87
|
+
} catch (error: any) {
|
|
88
|
+
notify(error?.data?.message || "Could not copy the list.", "error");
|
|
89
|
+
} finally {
|
|
90
|
+
busy.value = false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
watch(show, async (open) => {
|
|
95
|
+
if (!open) return;
|
|
96
|
+
result.value = null;
|
|
97
|
+
serviceType.value = "";
|
|
98
|
+
loading.value = true;
|
|
99
|
+
try {
|
|
100
|
+
groups.value = await getLegacyEquipment(props.store._id);
|
|
101
|
+
if (groups.value.length === 1) serviceType.value = groups.value[0].serviceType;
|
|
102
|
+
} catch {
|
|
103
|
+
groups.value = [];
|
|
104
|
+
} finally {
|
|
105
|
+
loading.value = false;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
</script>
|
|
@@ -5,8 +5,20 @@
|
|
|
5
5
|
<v-btn value="movement" class="text-none">Stock Movement</v-btn>
|
|
6
6
|
<v-btn value="usage" class="text-none">Usage</v-btn>
|
|
7
7
|
<v-btn value="technicians" class="text-none">Technicians</v-btn>
|
|
8
|
+
<v-btn value="purchases" class="text-none">Purchases</v-btn>
|
|
8
9
|
</v-btn-toggle>
|
|
9
|
-
<v-
|
|
10
|
+
<v-select
|
|
11
|
+
v-if="report === 'purchases'"
|
|
12
|
+
v-model="span"
|
|
13
|
+
:items="[
|
|
14
|
+
{ value: 'month', title: 'One month' },
|
|
15
|
+
{ value: 'year', title: 'Last 12 months' },
|
|
16
|
+
]"
|
|
17
|
+
density="compact"
|
|
18
|
+
hide-details
|
|
19
|
+
style="max-width: 180px"
|
|
20
|
+
/>
|
|
21
|
+
<v-text-field v-model="month" type="month" :label="report === 'purchases' && span === 'year' ? 'Up to month' : 'Month'" density="compact" hide-details style="max-width: 180px" />
|
|
10
22
|
<v-select
|
|
11
23
|
v-if="report === 'usage' && sites.length > 1"
|
|
12
24
|
v-model="site"
|
|
@@ -29,6 +41,7 @@
|
|
|
29
41
|
hide-details
|
|
30
42
|
style="max-width: 260px"
|
|
31
43
|
/>
|
|
44
|
+
<v-checkbox v-if="report === 'usage'" v-model="uncheckedOnly" label="Not checked yet" density="compact" hide-details class="flex-grow-0" />
|
|
32
45
|
<v-spacer />
|
|
33
46
|
<v-btn class="text-none screen-btn-ghost" variant="outlined" prepend-icon="mdi-file-excel-outline" :loading="exporting" @click="exportExcel">
|
|
34
47
|
Export Excel
|
|
@@ -36,14 +49,57 @@
|
|
|
36
49
|
</div>
|
|
37
50
|
|
|
38
51
|
<p class="text-caption text-medium-emphasis mb-2">{{ help[report] }}</p>
|
|
39
|
-
|
|
40
|
-
|
|
52
|
+
|
|
53
|
+
<div v-if="report === 'usage' && rows.length" class="d-flex flex-wrap align-center ga-3 mb-2">
|
|
54
|
+
<div class="text-body-2 font-weight-medium">
|
|
55
|
+
{{ rows.length }} record(s) · {{ totals.qty }} item(s) used · Total cost {{ money(totals.cost) }}
|
|
56
|
+
</div>
|
|
57
|
+
<v-spacer />
|
|
58
|
+
<template v-if="canCheck">
|
|
59
|
+
<span class="text-caption">{{ selected.length }} selected</span>
|
|
60
|
+
<v-btn class="text-none screen-btn-primary" variant="flat" size="small" :disabled="!selected.length" :loading="checking === 'on'" @click="setChecked(true)">
|
|
61
|
+
Mark checked
|
|
62
|
+
</v-btn>
|
|
63
|
+
<v-btn class="text-none screen-btn-ghost" variant="outlined" size="small" :disabled="!selected.length" :loading="checking === 'off'" @click="setChecked(false)">
|
|
64
|
+
Clear check
|
|
65
|
+
</v-btn>
|
|
66
|
+
</template>
|
|
41
67
|
</div>
|
|
42
68
|
|
|
69
|
+
<template v-if="report === 'purchases' && rows.length">
|
|
70
|
+
<div class="text-body-2 font-weight-medium mb-2">Total purchases {{ money(totals.cost) }}</div>
|
|
71
|
+
<v-row dense class="mb-2">
|
|
72
|
+
<v-col cols="12" md="6">
|
|
73
|
+
<AppCard class="pa-3">
|
|
74
|
+
<div class="text-subtitle-2 mb-2">By month</div>
|
|
75
|
+
<div v-for="m in purchases.byMonth" :key="m.month" class="d-flex align-center ga-2 mb-1">
|
|
76
|
+
<span class="text-body-2" style="width: 72px">{{ m.month }}</span>
|
|
77
|
+
<div class="flex-grow-1 bg-grey-lighten-3 rounded" style="height: 10px">
|
|
78
|
+
<div class="bg-primary rounded" :style="{ height: '10px', width: `${barWidth(m.totalCost)}%` }" />
|
|
79
|
+
</div>
|
|
80
|
+
<span class="text-body-2 text-right" style="width: 96px">{{ money(m.totalCost) }}</span>
|
|
81
|
+
</div>
|
|
82
|
+
</AppCard>
|
|
83
|
+
</v-col>
|
|
84
|
+
<v-col cols="12" md="6">
|
|
85
|
+
<AppCard class="pa-3">
|
|
86
|
+
<div class="text-subtitle-2 mb-2">By supplier</div>
|
|
87
|
+
<div v-for="s in purchases.bySupplier" :key="s.supplier" class="d-flex justify-space-between text-body-2 mb-1">
|
|
88
|
+
<span>{{ s.supplier }} <span class="text-medium-emphasis">({{ s.deliveries }} {{ s.deliveries === 1 ? "delivery" : "deliveries" }})</span></span>
|
|
89
|
+
<span>{{ money(s.totalCost) }}</span>
|
|
90
|
+
</div>
|
|
91
|
+
</AppCard>
|
|
92
|
+
</v-col>
|
|
93
|
+
</v-row>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
43
96
|
<v-data-table
|
|
97
|
+
v-model="selected"
|
|
44
98
|
:headers="headers[report]"
|
|
45
99
|
:items="rows"
|
|
46
100
|
:loading="loading"
|
|
101
|
+
:show-select="report === 'usage' && canCheck"
|
|
102
|
+
item-value="_id"
|
|
47
103
|
density="compact"
|
|
48
104
|
:items-per-page="50"
|
|
49
105
|
class="border rounded"
|
|
@@ -55,10 +111,13 @@
|
|
|
55
111
|
<template #item.totalCost="{ value }">{{ money(value) }}</template>
|
|
56
112
|
<template #item.receivedCost="{ value }">{{ money(value) }}</template>
|
|
57
113
|
<template #item.usedCost="{ value }">{{ money(value) }}</template>
|
|
114
|
+
<template #item.checkedByName="{ item }">
|
|
115
|
+
<v-chip v-if="item.checkedByName" size="x-small" color="success" variant="tonal">{{ item.checkedByName }}</v-chip>
|
|
116
|
+
<span v-else class="text-medium-emphasis">—</span>
|
|
117
|
+
</template>
|
|
58
118
|
<template #item.closing="{ item }">
|
|
59
119
|
<span :class="item.reorderLevel && item.closing <= item.reorderLevel ? 'text-error font-weight-bold' : 'font-weight-medium'">{{ item.closing }}</span>
|
|
60
120
|
</template>
|
|
61
|
-
|
|
62
121
|
</v-data-table>
|
|
63
122
|
</div>
|
|
64
123
|
</template>
|
|
@@ -78,20 +137,31 @@ const notify = inject<(text: string, color?: string) => void>("inventoryNotify",
|
|
|
78
137
|
|
|
79
138
|
const now = new Date();
|
|
80
139
|
const month = ref(`${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}`);
|
|
81
|
-
const report = ref<"movement" | "usage" | "technicians">("movement");
|
|
140
|
+
const report = ref<"movement" | "usage" | "technicians" | "purchases">("movement");
|
|
141
|
+
const span = ref<"month" | "year">("year");
|
|
82
142
|
const site = ref("");
|
|
83
143
|
const locationType = ref("");
|
|
144
|
+
const uncheckedOnly = ref(false);
|
|
84
145
|
const rows = ref<any[]>([]);
|
|
146
|
+
const selected = ref<string[]>([]);
|
|
147
|
+
const purchases = reactive({ byMonth: [] as { month: string; deliveries: number; totalCost: number }[], bySupplier: [] as { supplier: string; deliveries: number; totalCost: number }[] });
|
|
85
148
|
const totals = reactive({ qty: 0, cost: 0 });
|
|
86
149
|
const loading = ref(false);
|
|
87
150
|
const exporting = ref(false);
|
|
151
|
+
const checking = ref<"" | "on" | "off">("");
|
|
88
152
|
|
|
153
|
+
const canCheck = computed(() => props.store.access.canApprove || props.store.access.canManage);
|
|
89
154
|
const money = (v: number) => (v === undefined || v === null ? "—" : `$${Number(v).toFixed(2)}`);
|
|
155
|
+
const barWidth = (v: number) => {
|
|
156
|
+
const max = Math.max(...purchases.byMonth.map((m) => m.totalCost), 0);
|
|
157
|
+
return max ? Math.round((v / max) * 100) : 0;
|
|
158
|
+
};
|
|
90
159
|
|
|
91
160
|
const help: Record<string, string> = {
|
|
92
161
|
movement: "For each item: stock at the start of the month, what came in, what was issued and returned, count differences, and stock at the end.",
|
|
93
|
-
usage: "Every recorded usage: where it was used, for which tenant, by whom, and the cost. Use this for tenant billing.",
|
|
162
|
+
usage: "Every recorded usage: where it was used, for which tenant, by whom, and the cost. Use this for tenant billing. Tick records and mark them checked once verified.",
|
|
94
163
|
technicians: "For each person: stock they held at the start, took, used, returned, and hold at the end of the month.",
|
|
164
|
+
purchases: "Every delivery received, with totals by month and by supplier, to see how purchasing changes over time.",
|
|
95
165
|
};
|
|
96
166
|
|
|
97
167
|
const headers: Record<string, any[]> = {
|
|
@@ -115,13 +185,12 @@ const headers: Record<string, any[]> = {
|
|
|
115
185
|
{ title: "Unit / Area", key: "location" },
|
|
116
186
|
{ title: "Tenant", key: "tenantName" },
|
|
117
187
|
{ title: "Item", key: "itemName" },
|
|
118
|
-
{ title: "Unit", key: "unit" },
|
|
119
188
|
{ title: "Qty", key: "qty" },
|
|
120
189
|
{ title: "Unit price", key: "unitCost" },
|
|
121
190
|
{ title: "Total", key: "totalCost" },
|
|
122
191
|
{ title: "Technician", key: "technician" },
|
|
123
192
|
{ title: "Reference", key: "reference" },
|
|
124
|
-
{ title: "
|
|
193
|
+
{ title: "Checked by", key: "checkedByName" },
|
|
125
194
|
],
|
|
126
195
|
technicians: [
|
|
127
196
|
{ title: "Name", key: "technician" },
|
|
@@ -134,28 +203,43 @@ const headers: Record<string, any[]> = {
|
|
|
134
203
|
{ title: "Holding at end", key: "closing" },
|
|
135
204
|
{ title: "In hand now", key: "inHandNow" },
|
|
136
205
|
],
|
|
206
|
+
purchases: [
|
|
207
|
+
{ title: "Date", key: "date" },
|
|
208
|
+
{ title: "Supplier", key: "supplier" },
|
|
209
|
+
{ title: "PO No.", key: "reference" },
|
|
210
|
+
{ title: "Item", key: "itemName" },
|
|
211
|
+
{ title: "Unit", key: "unit" },
|
|
212
|
+
{ title: "Qty", key: "qty" },
|
|
213
|
+
{ title: "Unit price", key: "unitCost" },
|
|
214
|
+
{ title: "Total", key: "totalCost" },
|
|
215
|
+
{ title: "Received by", key: "receivedBy" },
|
|
216
|
+
],
|
|
137
217
|
};
|
|
138
218
|
|
|
139
|
-
function period(): TInventoryPeriod {
|
|
219
|
+
function period(): TInventoryPeriod & { unchecked?: boolean } {
|
|
140
220
|
const [y, m] = month.value.split("-").map(Number);
|
|
141
|
-
const from = new Date(y, m - 1, 1, 0, 0, 0, 0);
|
|
142
221
|
const to = new Date(y, m, 0, 23, 59, 59, 999);
|
|
222
|
+
const from = report.value === "purchases" && span.value === "year" ? new Date(y, m - 12, 1, 0, 0, 0, 0) : new Date(y, m - 1, 1, 0, 0, 0, 0);
|
|
143
223
|
return {
|
|
144
224
|
from: from.toISOString(),
|
|
145
225
|
to: to.toISOString(),
|
|
146
226
|
...(report.value === "usage" && site.value ? { site: site.value } : {}),
|
|
147
227
|
...(report.value === "usage" && locationType.value ? { locationType: locationType.value } : {}),
|
|
228
|
+
...(report.value === "usage" && uncheckedOnly.value ? { unchecked: true } : {}),
|
|
148
229
|
};
|
|
149
230
|
}
|
|
150
231
|
|
|
151
232
|
async function load() {
|
|
152
233
|
if (!month.value) return;
|
|
153
234
|
loading.value = true;
|
|
235
|
+
selected.value = [];
|
|
154
236
|
try {
|
|
155
|
-
const res = await api.getReport(props.store._id, report.value, period());
|
|
237
|
+
const res: any = await api.getReport(props.store._id, report.value, period());
|
|
156
238
|
rows.value = res.rows;
|
|
157
239
|
totals.qty = res.totalQty ?? 0;
|
|
158
240
|
totals.cost = res.totalCost ?? 0;
|
|
241
|
+
purchases.byMonth = res.byMonth ?? [];
|
|
242
|
+
purchases.bySupplier = res.bySupplier ?? [];
|
|
159
243
|
} catch (error: any) {
|
|
160
244
|
rows.value = [];
|
|
161
245
|
notify(error?.data?.message || "Could not load the report.", "error");
|
|
@@ -164,6 +248,20 @@ async function load() {
|
|
|
164
248
|
}
|
|
165
249
|
}
|
|
166
250
|
|
|
251
|
+
async function setChecked(checked: boolean) {
|
|
252
|
+
if (!selected.value.length) return;
|
|
253
|
+
checking.value = checked ? "on" : "off";
|
|
254
|
+
try {
|
|
255
|
+
const res = await api.checkUsage(props.store._id, selected.value, checked);
|
|
256
|
+
notify(checked ? `${res.updated} record(s) marked checked.` : `Check cleared on ${res.updated} record(s).`);
|
|
257
|
+
await load();
|
|
258
|
+
} catch (error: any) {
|
|
259
|
+
notify(error?.data?.message || "Could not update the records.", "error");
|
|
260
|
+
} finally {
|
|
261
|
+
checking.value = "";
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
167
265
|
async function exportExcel() {
|
|
168
266
|
exporting.value = true;
|
|
169
267
|
try {
|
|
@@ -176,6 +274,6 @@ async function exportExcel() {
|
|
|
176
274
|
}
|
|
177
275
|
}
|
|
178
276
|
|
|
179
|
-
watch([report, month, site, locationType, () => props.store._id], load);
|
|
277
|
+
watch([report, month, span, site, locationType, uncheckedOnly, () => props.store._id], load);
|
|
180
278
|
onMounted(load);
|
|
181
279
|
</script>
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
<v-list density="compact">
|
|
27
27
|
<v-list-item prepend-icon="mdi-plus" title="Add one item" @click="editItem(null)" />
|
|
28
28
|
<v-list-item prepend-icon="mdi-file-excel-outline" title="Import from Excel" @click="showImport = true" />
|
|
29
|
+
<v-list-item prepend-icon="mdi-content-copy" title="Copy from old Equipment list" @click="showLegacy = true" />
|
|
29
30
|
</v-list>
|
|
30
31
|
</v-menu>
|
|
31
32
|
<v-spacer />
|
|
@@ -85,6 +86,7 @@
|
|
|
85
86
|
<InventoryLinesDialog v-model="lines.show" :mode="lines.mode" :store="store" :site-id="siteId" :sites="sites" @done="done" />
|
|
86
87
|
<InventoryItemDialog v-model="itemDialog.show" :store="store" :item="itemDialog.item" @done="done" />
|
|
87
88
|
<InventoryImportDialog v-model="showImport" :store="store" @done="done" />
|
|
89
|
+
<InventoryLegacyImportDialog v-model="showLegacy" :store="store" @done="done" />
|
|
88
90
|
<InventoryItemDetail v-model="detail.show" :store="store" :item="detail.item" @edit="editItem" @done="done" />
|
|
89
91
|
</div>
|
|
90
92
|
</template>
|
|
@@ -163,6 +165,7 @@ function openItem(item: TInventoryItem) {
|
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
const showImport = ref(false);
|
|
168
|
+
const showLegacy = ref(false);
|
|
166
169
|
|
|
167
170
|
function done() {
|
|
168
171
|
load();
|
|
@@ -54,10 +54,18 @@ export default function useInventory() {
|
|
|
54
54
|
getCommonAreas: (store: string, site: string) => api<string[]>(`/stores/${store}/common-areas`, { query: { site } }),
|
|
55
55
|
getPeople: (store: string, search = "") => api<{ _id: string; name: string; orgName: string }[]>(`/stores/${store}/people`, { query: { search } }),
|
|
56
56
|
|
|
57
|
-
getReport: (store: string, report: "movement" | "usage" | "technicians", query: TInventoryPeriod) =>
|
|
57
|
+
getReport: (store: string, report: "movement" | "usage" | "technicians" | "purchases", query: TInventoryPeriod & { unchecked?: boolean }) =>
|
|
58
58
|
api<{ rows: any[]; totalQty?: number; totalCost?: number }>(`/stores/${store}/reports/${report}`, { query }),
|
|
59
59
|
exportReport: (store: string, report: string, query: TInventoryPeriod) =>
|
|
60
60
|
api<Blob>(`/stores/${store}/reports/${report}/export`, { query, responseType: "blob" }),
|
|
61
|
+
checkUsage: (store: string, ids: string[], checked: boolean) =>
|
|
62
|
+
api<{ updated: number }>(`/stores/${store}/usage/check`, { method: "POST", body: { ids, checked } }),
|
|
63
|
+
getLegacyEquipment: (store: string) => api<{ serviceType: string; count: number }[]>(`/stores/${store}/legacy-equipment`),
|
|
64
|
+
importLegacyEquipment: (store: string, serviceType: string, commit: boolean) =>
|
|
65
|
+
api<{ committed: boolean; ready: number; skipped: number; errors: number; rows: { row: number; name: string; status: string; message: string }[] }>(
|
|
66
|
+
`/stores/${store}/legacy-equipment/import`,
|
|
67
|
+
{ method: "POST", body: { serviceType, commit } },
|
|
68
|
+
),
|
|
61
69
|
importTemplate: () => api<Blob>("/import-template", { responseType: "blob" }),
|
|
62
70
|
importItems: (store: string, file: File, commit: boolean) => {
|
|
63
71
|
const body = new FormData();
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.17.1-staging.
|
|
5
|
+
"version": "4.17.1-staging.332",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|