@fewangsit/wangsvue-fats 1.0.1-alpha.56 → 1.0.1-alpha.57

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.
@@ -1,24 +1,24 @@
1
- import { defineComponent as V, onMounted as z, shallowRef as f, ref as W, createElementBlock as j, openBlock as H, Fragment as K, createElementVNode as g, createVNode as l, mergeProps as Q, unref as d, withCtx as X, toDisplayString as C } from "vue";
2
- import { AssetServices as Y, DisposalServices as Z, DamageServices as B, MissingServices as O } from "@tagsamurai/fats-api-services";
3
- import { u as ee } from "../assetinfo/index.es.js";
4
- import { u as te } from "../plugins/basei18n.es.js";
1
+ import { defineComponent as Y, onMounted as Z, shallowRef as f, ref as ee, createElementBlock as te, openBlock as se, Fragment as ae, createElementVNode as g, createVNode as i, mergeProps as oe, unref as d, withCtx as re, toDisplayString as M } from "vue";
2
+ import { AssetServices as _, DisposalServices as ne, DamageServices as T, MissingServices as N } from "@tagsamurai/fats-api-services";
3
+ import { u as le } from "../assetinfo/index.es.js";
4
+ import { u as ie } from "../plugins/basei18n.es.js";
5
5
  import "../utils/role.util.es.js";
6
- import { u as se } from "../utils/toast.util.es.js";
7
- import { _ as D } from "../badge/index.es.js";
8
- import { _ as w } from "../button/index.es.js";
9
- import { _ as ae } from "../buttonfilter/index.es.js";
10
- import { _ as oe } from "../buttonsearch/index.es.js";
11
- import { D as re } from "../datatable/index.es.js";
12
- import { _ as M } from "../dialogconfirm/index.es.js";
13
- import { _ as ne } from "../image/index.es.js";
14
- import { _ as le } from "../textarea/index.es.js";
15
- import { _ as ie } from "../disposalreportbulkaction/index.es.js";
16
- import { _ as de } from "../disposalreportdialogselectasset/index.es.js";
17
- import { _ as pe } from "../disposalreporttablefilter/index.es.js";
18
- const ue = {
6
+ import { u as de } from "../utils/toast.util.es.js";
7
+ import { _ as I } from "../badge/index.es.js";
8
+ import { _ as x } from "../button/index.es.js";
9
+ import { _ as pe } from "../buttonfilter/index.es.js";
10
+ import { _ as ue } from "../buttonsearch/index.es.js";
11
+ import { D as me } from "../datatable/index.es.js";
12
+ import { _ as $ } from "../dialogconfirm/index.es.js";
13
+ import { _ as ce } from "../image/index.es.js";
14
+ import { _ as fe } from "../textarea/index.es.js";
15
+ import { _ as ge } from "../disposalreportbulkaction/index.es.js";
16
+ import { _ as ye } from "../disposalreportdialogselectasset/index.es.js";
17
+ import { _ as ve } from "../disposalreporttablefilter/index.es.js";
18
+ const be = {
19
19
  class: "flex flex-col gap-2",
20
20
  "data-ts-section": "disposalreporttablewrapper"
21
- }, me = { class: "flex gap-1 justify-end" }, ce = { class: "flex gap-1 justify-end" }, Me = /* @__PURE__ */ V({
21
+ }, he = { class: "flex gap-1 justify-end" }, De = { class: "flex gap-1 justify-end" }, Le = /* @__PURE__ */ Y({
22
22
  __name: "DisposalReportTable",
23
23
  props: {
24
24
  treeTable: { type: Boolean },
@@ -60,16 +60,16 @@ const ue = {
60
60
  reason: {},
61
61
  from: {}
62
62
  },
63
- setup(T) {
64
- const u = T;
65
- z(() => {
66
- $();
63
+ setup(E) {
64
+ const p = E;
65
+ Z(() => {
66
+ L();
67
67
  });
68
- const m = se(), { t: a } = te(), { setLoading: c } = ee(), y = f(!1), v = f(!1), b = f(!1), x = f([]), h = f(), n = f(
68
+ const m = de(), { t: r } = ie(), { setLoading: c } = le(), y = f(!1), v = f(!1), b = f(!1), w = f([]), h = f(), n = f(
69
69
  []
70
- ), p = W(
70
+ ), u = ee(
71
71
  /* @__PURE__ */ new Map()
72
- ), k = [
72
+ ), P = [
73
73
  {
74
74
  field: "assetImageSmall",
75
75
  header: "Photo",
@@ -78,7 +78,7 @@ const ue = {
78
78
  sortable: !1,
79
79
  excluded: !0,
80
80
  bodyComponent: (s) => ({
81
- component: ne,
81
+ component: ce,
82
82
  props: {
83
83
  src: s.assetImage,
84
84
  description: "asset-report-photo",
@@ -110,11 +110,10 @@ const ue = {
110
110
  bodyComponent: (s) => {
111
111
  var e;
112
112
  return {
113
- component: D,
113
+ component: I,
114
114
  props: {
115
115
  label: (e = s.brand) == null ? void 0 : e.name,
116
- severity: "dark",
117
- format: "nowrap"
116
+ severity: "dark"
118
117
  }
119
118
  };
120
119
  }
@@ -127,11 +126,10 @@ const ue = {
127
126
  bodyComponent: (s) => {
128
127
  var e;
129
128
  return {
130
- component: D,
129
+ component: I,
131
130
  props: {
132
131
  label: (e = s.model) == null ? void 0 : e.name,
133
- severity: "dark",
134
- format: "nowrap"
132
+ severity: "dark"
135
133
  }
136
134
  };
137
135
  }
@@ -144,10 +142,9 @@ const ue = {
144
142
  bodyComponent: (s) => {
145
143
  var e;
146
144
  return {
147
- component: D,
145
+ component: I,
148
146
  props: {
149
- label: (e = s.group) == null ? void 0 : e.name,
150
- format: "nowrap"
147
+ label: (e = s.group) == null ? void 0 : e.name
151
148
  }
152
149
  };
153
150
  }
@@ -159,18 +156,18 @@ const ue = {
159
156
  bodyComponent: (s) => {
160
157
  var e;
161
158
  return {
162
- component: le,
159
+ component: fe,
163
160
  props: {
164
- modelValue: (e = p.value.get(s._id ?? "assetId")) == null ? void 0 : e.notes,
165
- placeholder: a("Enter note"),
161
+ modelValue: (e = u.value.get(s._id ?? "assetId")) == null ? void 0 : e.notes,
162
+ placeholder: r("Enter note"),
166
163
  rows: 1,
167
164
  maxlength: 30,
168
165
  preventInputOnMaxLength: !0
169
166
  },
170
167
  events: {
171
168
  "update:modelValue": (t) => {
172
- const o = p.value.get(s._id ?? "assetId");
173
- p.value.set(s._id ?? "assetId", {
169
+ const o = u.value.get(s._id ?? "assetId");
170
+ u.value.set(s._id ?? "assetId", {
174
171
  ...o,
175
172
  notes: t
176
173
  }), s.note = t;
@@ -179,22 +176,22 @@ const ue = {
179
176
  };
180
177
  }
181
178
  }
182
- ], $ = async () => {
179
+ ], L = async () => {
183
180
  const s = sessionStorage.getItem("assetsDisposalReport");
184
181
  if (!s) {
185
182
  m.add({
186
- message: a("Error, no assets found for disposal report."),
183
+ message: r("Error, no assets found for disposal report."),
187
184
  severity: "error"
188
185
  });
189
186
  return;
190
187
  }
191
188
  try {
192
189
  c(!0);
193
- const { data: e } = await Y.getAllAssets({ _id: s });
190
+ const { data: e } = await _.getAllAssets({ _id: s });
194
191
  e.data.data.forEach((t) => {
195
- p.value.set(t._id ?? "", {
192
+ u.value.set(t._id ?? "", {
196
193
  notes: null,
197
- reason: ["Damaged", "Missing"].includes(t.status) ? t.status : u.reason
194
+ reason: ["Damaged", "Missing"].includes(t.status) ? t.status : p.reason
198
195
  });
199
196
  }), n.value = e.data.data;
200
197
  } catch (e) {
@@ -205,39 +202,39 @@ const ue = {
205
202
  } finally {
206
203
  c(!1);
207
204
  }
208
- }, N = [
205
+ }, q = [
209
206
  {
210
- label: a("Remove from List"),
207
+ label: r("Remove from List"),
211
208
  icon: "delete-bin",
212
209
  danger: !0,
213
210
  command: () => {
214
211
  v.value = !0;
215
212
  }
216
213
  }
217
- ], I = (s) => {
214
+ ], R = (s) => {
218
215
  n.value = n.value.filter(
219
216
  (e) => !s.some((t) => e._id === t._id)
220
- ), E(s);
221
- }, E = (s) => {
217
+ ), F(s);
218
+ }, F = (s) => {
222
219
  s.forEach((e) => {
223
- p.value.delete(e._id ?? "");
224
- }), n.value.length || _(), m.add({
225
- message: a("Success, asset has been removed from the list."),
220
+ u.value.delete(e._id ?? "");
221
+ }), n.value.length || D(), m.add({
222
+ message: r("Success, asset has been removed from the list."),
226
223
  severity: "success"
227
224
  });
228
- }, P = (s, e) => {
225
+ }, J = (s, e) => {
229
226
  s.forEach((t) => {
230
- p.value.set(t._id ?? "", {
227
+ u.value.set(t._id ?? "", {
231
228
  notes: e ?? null,
232
- reason: ["Damaged", "Missing"].includes(t.status) ? t.status : u.reason
229
+ reason: ["Damaged", "Missing"].includes(t.status) ? t.status : p.reason
233
230
  });
234
231
  });
235
- }, _ = () => {
232
+ }, D = () => {
236
233
  const s = window.location.pathname, e = s.slice(0, s.lastIndexOf("/"));
237
- u.router.replace(e), sessionStorage.removeItem("assetsDisposalReport");
238
- }, L = async () => {
234
+ p.router.replace(e), sessionStorage.removeItem("assetsDisposalReport");
235
+ }, U = async () => {
239
236
  const s = [];
240
- p.value.forEach((e, t) => {
237
+ u.value.forEach((e, t) => {
241
238
  const o = {
242
239
  asset: t,
243
240
  notes: e.notes,
@@ -246,33 +243,33 @@ const ue = {
246
243
  s.push(o);
247
244
  });
248
245
  try {
249
- c(!0), await Z.postReportDisposal({ data: s }), m.add({
250
- message: a("Success, disposal report has been submitted.")
251
- }), _();
246
+ c(!0), await ne.postReportDisposal({ data: s }), m.add({
247
+ message: r("Success, disposal report has been submitted.")
248
+ }), D();
252
249
  } catch (e) {
253
250
  console.error(e), m.add({
254
251
  error: e,
255
- message: a("Error, failed to submit disposal report.")
252
+ message: r("Error, failed to submit disposal report.")
256
253
  });
257
254
  } finally {
258
255
  c(!1);
259
256
  }
260
- }, F = async (s) => {
257
+ }, G = async (s) => {
261
258
  try {
262
259
  c(!0);
263
260
  const e = s.map((t) => {
264
- var o, r, i, R, S, A;
265
- return p.value.set(t.asset ?? "", {
261
+ var o, a, l, A, S, O, C, B, k;
262
+ return u.value.set(t.asset ?? "", {
266
263
  notes: null,
267
- reason: ["Damaged", "Missing"].includes(t.status) ? t.status : u.reason
264
+ reason: ["Damaged", "Missing"].includes(t.status) ? t.status : p.reason
268
265
  }), {
269
266
  ...t,
270
267
  reportId: t._id,
271
268
  _id: t.asset,
272
- name: t.assetName,
269
+ name: t.name ?? t.assetName,
273
270
  assetImage: t.assetImage ?? t.damageImage,
274
- brand: t.assetBrand,
275
- model: t.assetModel,
271
+ brand: t.brand ?? t.assetBrand,
272
+ model: t.model ?? t.assetModel,
276
273
  rfid: !1,
277
274
  qr: !1,
278
275
  transactions: null,
@@ -280,13 +277,13 @@ const ue = {
280
277
  licenseStatuses: null,
281
278
  category: {
282
279
  _id: (o = t.category) == null ? void 0 : o._id,
283
- name: (r = t.category) == null ? void 0 : r.name,
284
- key: (i = t.category) == null ? void 0 : i.key
280
+ name: (a = t.category) == null ? void 0 : a.name,
281
+ key: (l = t.category) == null ? void 0 : l.key
285
282
  },
286
283
  group: {
287
- _id: (R = t.assetGroup) == null ? void 0 : R._id,
288
- name: (S = t.assetGroup) == null ? void 0 : S.name,
289
- key: (A = t.assetGroup) == null ? void 0 : A.key
284
+ _id: ((A = t.group) == null ? void 0 : A._id) ?? ((S = t.assetGroup) == null ? void 0 : S._id),
285
+ name: ((O = t.group) == null ? void 0 : O.name) ?? ((C = t.assetGroup) == null ? void 0 : C.name),
286
+ key: ((B = t.group) == null ? void 0 : B.key) ?? ((k = t.assetGroup) == null ? void 0 : k.key)
290
287
  }
291
288
  };
292
289
  });
@@ -300,82 +297,102 @@ const ue = {
300
297
  } finally {
301
298
  c(!1);
302
299
  }
303
- }, q = async (s) => {
304
- var r;
300
+ }, V = async (s) => {
301
+ var a;
305
302
  const e = JSON.stringify(
306
- ((r = n.value) == null ? void 0 : r.map((i) => i.reportId)) ?? []
303
+ ((a = n.value) == null ? void 0 : a.map((l) => l.reportId)) ?? []
307
304
  ), t = {
308
305
  excludeId: e,
309
306
  excludeIds: e,
310
307
  status: '["Damaged", "Reported Disposal", "On Disposal Process"]',
311
308
  ...s
312
- }, { data: o } = await B.getDamageReportList(t);
309
+ }, { data: o } = await T.getDamageReportList(t);
313
310
  return o;
314
- }, U = async (s) => {
315
- var r;
311
+ }, z = async (s) => {
312
+ var a;
316
313
  const e = JSON.stringify(
317
- ((r = n.value) == null ? void 0 : r.map((i) => i.reportId)) ?? []
314
+ ((a = n.value) == null ? void 0 : a.map((l) => l.reportId)) ?? []
318
315
  ), t = {
319
316
  excludeId: e,
320
317
  excludeIds: e,
321
318
  status: '["Missing", "Reported Disposal", "On Disposal Process"]',
322
319
  ...s
323
- }, { data: o } = await O.getData(t);
320
+ }, { data: o } = await N.getData(t);
324
321
  return o;
325
- }, G = async (s) => {
326
- var r;
322
+ }, W = async (s) => {
323
+ var a;
327
324
  const e = JSON.stringify(
328
- ((r = n.value) == null ? void 0 : r.map((i) => i.reportId)) ?? []
325
+ ((a = n.value) == null ? void 0 : a.map((l) => l.reportId)) ?? []
329
326
  ), t = {
330
327
  excludeId: e,
331
328
  excludeIds: e,
332
- status: '["Missing", "Reported Disposal", "On Disposal Process"]',
329
+ ...s
330
+ }, { data: o } = await _.getAllAssets(t);
331
+ return o;
332
+ }, j = async (s) => p.from === "damage" ? V(s) : p.from === "missing" ? z(s) : W(s), H = async (s) => {
333
+ var a;
334
+ const e = JSON.stringify(
335
+ ((a = n.value) == null ? void 0 : a.map((l) => l.reportId)) ?? []
336
+ ), t = {
337
+ excludeId: e,
338
+ excludeIds: e,
339
+ status: '["Damaged", "Reported Disposal", "On Disposal Process"]',
333
340
  reportedByOptions: "true",
334
341
  [s]: !0
335
- }, { data: o } = await O.getDataOptions(t);
342
+ }, { data: o } = await T.getDamageReportListFilterOptions(t);
336
343
  return o.data[s] ?? [];
337
- }, J = async (s) => {
338
- var r;
344
+ }, K = async (s) => {
345
+ var a;
339
346
  const e = JSON.stringify(
340
- ((r = n.value) == null ? void 0 : r.map((i) => i.reportId)) ?? []
347
+ ((a = n.value) == null ? void 0 : a.map((l) => l.reportId)) ?? []
341
348
  ), t = {
342
349
  excludeId: e,
343
350
  excludeIds: e,
344
351
  status: '["Missing", "Reported Disposal", "On Disposal Process"]',
345
352
  reportedByOptions: "true",
346
353
  [s]: !0
347
- }, { data: o } = await B.getDamageReportListFilterOptions(t);
354
+ }, { data: o } = await N.getDataOptions(t);
355
+ return o.data[s] ?? [];
356
+ }, Q = async (s) => {
357
+ var a;
358
+ const e = JSON.stringify(
359
+ ((a = n.value) == null ? void 0 : a.map((l) => l.reportId)) ?? []
360
+ ), t = {
361
+ excludeId: e,
362
+ excludeIds: e,
363
+ [s]: !0
364
+ }, { data: o } = await _.getAllAssetsOptions(t);
348
365
  return o.data[s] ?? [];
349
- };
350
- return (s, e) => (H(), j(K, null, [
351
- g("div", ue, [
352
- g("div", me, [
353
- l(ie, {
366
+ }, X = async (s) => p.from === "damage" ? H(s) : p.from === "missing" ? K(s) : Q(s);
367
+ return (s, e) => (se(), te(ae, null, [
368
+ g("div", be, [
369
+ g("div", he, [
370
+ i(ge, {
354
371
  "assets-to-report": n.value,
355
372
  "onUpdate:assetsToReport": e[0] || (e[0] = (t) => n.value = t),
356
- "selected-data": x.value,
357
- "onUpdate:selectedData": e[1] || (e[1] = (t) => x.value = t),
358
- onNoted: P,
359
- onRemoved: e[2] || (e[2] = (t) => I(t)),
373
+ "selected-data": w.value,
374
+ "onUpdate:selectedData": e[1] || (e[1] = (t) => w.value = t),
375
+ onNoted: J,
376
+ onRemoved: e[2] || (e[2] = (t) => R(t)),
360
377
  "table-name": "disposal-report-page-table"
361
378
  }, null, 8, ["assets-to-report", "selected-data"]),
362
- l(oe, {
379
+ i(ue, {
363
380
  class: "ml-auto",
364
381
  "table-name": "disposal-report-page-table"
365
382
  }),
366
- l(ae, { "table-name": "disposal-report-page-table" }),
367
- l(w, {
383
+ i(pe, { "table-name": "disposal-report-page-table" }),
384
+ i(x, {
368
385
  onClick: e[3] || (e[3] = (t) => y.value = !0),
369
386
  icon: "add",
370
387
  label: "Asset"
371
388
  })
372
389
  ]),
373
- l(pe, { "table-name": "disposal-report-page-table" }),
374
- l(re, Q(s.$props, {
375
- columns: k,
390
+ i(ve, { "table-name": "disposal-report-page-table" }),
391
+ i(me, oe(s.$props, {
392
+ columns: P,
376
393
  data: n.value,
377
394
  lazy: !1,
378
- options: N,
395
+ options: q,
379
396
  rows: 10,
380
397
  onToggleOption: e[4] || (e[4] = (t) => h.value = t),
381
398
  "data-key": "_id",
@@ -386,48 +403,49 @@ const ue = {
386
403
  "use-paginator": ""
387
404
  }), null, 16, ["data"])
388
405
  ]),
389
- l(de, {
406
+ i(ye, {
390
407
  visible: y.value,
391
408
  "onUpdate:visible": e[5] || (e[5] = (t) => y.value = t),
392
- "fetch-function": u.from === "damage" ? q : U,
393
- "fetch-option-function": u.from === "damage" ? J : G,
394
- onSelect: F
395
- }, null, 8, ["visible", "fetch-function", "fetch-option-function"]),
396
- l(M, {
409
+ "fetch-function": j,
410
+ "fetch-option-function": X,
411
+ from: s.from,
412
+ onSelect: G
413
+ }, null, 8, ["visible", "from"]),
414
+ i($, {
397
415
  visible: v.value,
398
416
  "onUpdate:visible": e[6] || (e[6] = (t) => v.value = t),
399
- body: d(a)("Are you sure you want to remove it?"),
400
- "confirm-label": d(a)("Remove"),
401
- header: d(a)("Remove from List"),
417
+ body: d(r)("Are you sure you want to remove it?"),
418
+ "confirm-label": d(r)("Remove"),
419
+ header: d(r)("Remove from List"),
402
420
  lists: [h.value],
403
- onConfirm: e[7] || (e[7] = (t) => I([h.value])),
421
+ onConfirm: e[7] || (e[7] = (t) => R([h.value])),
404
422
  "list-label": "name.nameWithSequence",
405
423
  severity: "danger"
406
424
  }, null, 8, ["visible", "body", "confirm-label", "header", "lists"]),
407
- l(M, {
425
+ i($, {
408
426
  visible: b.value,
409
427
  "onUpdate:visible": e[8] || (e[8] = (t) => b.value = t),
410
- "confirm-label": d(a)("Continue"),
411
- header: d(a)("Cancel Report"),
412
- onConfirm: _,
428
+ "confirm-label": d(r)("Continue"),
429
+ header: d(r)("Cancel Report"),
430
+ onConfirm: D,
413
431
  severity: "danger"
414
432
  }, {
415
- body: X(() => [
416
- g("p", null, C(d(a)("This action will cancel the disposal report.")), 1),
417
- g("p", null, C(d(a)("Are you sure you want to continue?")), 1)
433
+ body: re(() => [
434
+ g("p", null, M(d(r)("This action will cancel the disposal report.")), 1),
435
+ g("p", null, M(d(r)("Are you sure you want to continue?")), 1)
418
436
  ]),
419
437
  _: 1
420
438
  }, 8, ["visible", "confirm-label", "header"]),
421
- g("div", ce, [
422
- l(w, {
423
- label: d(a)("Cancel"),
439
+ g("div", De, [
440
+ i(x, {
441
+ label: d(r)("Cancel"),
424
442
  onClick: e[9] || (e[9] = (t) => b.value = !0),
425
443
  severity: "dark",
426
444
  text: ""
427
445
  }, null, 8, ["label"]),
428
- l(w, {
429
- label: d(a)("Submit"),
430
- onClick: L,
446
+ i(x, {
447
+ label: d(r)("Submit"),
448
+ onClick: U,
431
449
  severity: "success"
432
450
  }, null, 8, ["label"])
433
451
  ])
@@ -435,5 +453,5 @@ const ue = {
435
453
  }
436
454
  });
437
455
  export {
438
- Me as _
456
+ Le as _
439
457
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fewangsit/wangsvue-fats",
3
- "version": "1.0.1-alpha.56",
3
+ "version": "1.0.1-alpha.57",
4
4
  "author": "Wangsit FE Developer",
5
5
  "description": "Fixed Asset Tagsamurai VueJS Component Library",
6
6
  "type": "module",