@iservice365/layer-common 1.2.0 → 1.3.1

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,19 +1,20 @@
1
- export default function(){
2
-
1
+ export default function () {
3
2
  type TVisitorSelection = {
4
3
  label: string;
5
- value: TVisitorType
6
- }
4
+ value: TVisitorType;
5
+ };
7
6
 
8
7
  const visitorSelection: TVisitorSelection[] =[
8
+ { label: "Guest", value: "guest" },
9
9
  { label: "Contractor", value: "contractor" },
10
10
  { label: "Delivery", value: "delivery" },
11
- { label: "Walk-In", value: "walk-in"},
12
- { label: "Pick-Up", value: "pick-up"},
13
- { label: "Drop-Off", value: "drop-off"}
11
+ { label: "Walk-In", value: "walk-in" },
12
+ { label: "Pick-Up", value: "pick-up" },
13
+ { label: "Drop-Off", value: "drop-off" },
14
14
  ];
15
15
 
16
16
  const typeFieldMap: Record<TVisitorType, (keyof TVisitorPayload)[]> = {
17
+ guest: ['name', 'nric', 'contact', 'block', 'level', 'unit' , 'unitName', 'remarks'],
17
18
  contractor: ['contractorType', 'name', 'nric', 'company', 'contact', 'plateNumber', 'block', 'level', 'unit', 'unitName', 'remarks'],
18
19
  delivery: ['attachments', 'name', 'deliveryType', 'company', 'nric', 'contact', 'plateNumber', 'block', 'level', 'unit' , 'unitName', 'remarks'],
19
20
  'walk-in': ['name', 'company', 'nric', 'contact', 'block', 'level', 'unit' , 'unitName', 'remarks'],
@@ -22,58 +23,81 @@ export default function(){
22
23
  }
23
24
 
24
25
  const contractorTypes = [
25
- { title: "Estate Contractor", value: "estate-contractor" },
26
- { title: "Home Contractor", value: "home-contractor" },
27
- { title: "Property Agent", value: "property-agent" },
28
- { title: "House Mover", value: "house-mover" },
29
- ]
30
-
26
+ { title: "Estate Contractor", value: "estate-contractor" },
27
+ { title: "Home Contractor", value: "home-contractor" },
28
+ { title: "Property Agent", value: "property-agent" },
29
+ { title: "House Mover", value: "house-mover" },
30
+ ];
31
31
 
32
- async function getVisitors({
33
- page = 1,
34
- limit = 10,
35
- sort = "asc",
36
- search = "",
37
- org = "",
38
- site = "",
39
- dateTo = "",
40
- dateFrom = "",
41
- type="",
42
- displayNoCheckOut=false
43
- } = {}) {
44
- return await useNuxtApp().$api<Record<string, any>>("/api/visitor-transactions", {
32
+ async function getVisitors({
33
+ page = 1,
34
+ limit = 10,
35
+ sort = "asc",
36
+ search = "",
37
+ org = "",
38
+ site = "",
39
+ dateTo = "",
40
+ dateFrom = "",
41
+ type = "",
42
+ status = "registered",
43
+ // status = "registered"
44
+ } = {}) {
45
+ return await useNuxtApp().$api<Record<string, any>>(
46
+ "/api/visitor-transactions",
47
+ {
45
48
  method: "GET",
46
- query: { page, limit, sort, search, org, site, dateTo, dateFrom, ...(type.length > 0 && {type}), ...(displayNoCheckOut === true && {checkedOut: false}) },
47
- });
49
+ query: {
50
+ page,
51
+ limit,
52
+ sort,
53
+ search,
54
+ org,
55
+ site,
56
+ dateTo,
57
+ dateFrom,
58
+ type,
59
+ status,
60
+ },
61
+ }
62
+ );
48
63
  }
49
64
 
50
- async function createVisitor(payload: Partial<TVisitorPayload>){
51
- return await useNuxtApp().$api<Record<string, any>>("/api/visitor-transactions", {
65
+ async function createVisitor(payload: Partial<TVisitorPayload>) {
66
+ return await useNuxtApp().$api<Record<string, any>>(
67
+ "/api/visitor-transactions",
68
+ {
52
69
  method: "POST",
53
70
  body: payload,
54
- });
55
- }
71
+ }
72
+ );
73
+ }
56
74
 
57
- async function updateVisitor(_id: string, payload: Partial<TVisitorPayload>){
58
- return await useNuxtApp().$api<Record<string, any>>(`/api/visitor-transactions/id/${_id}`, {
75
+ async function updateVisitor(_id: string, payload: Partial<TVisitorPayload>) {
76
+ return await useNuxtApp().$api<Record<string, any>>(
77
+ `/api/visitor-transactions/id/${_id}`,
78
+ {
59
79
  method: "PUT",
60
80
  body: payload,
61
- });
62
- }
81
+ }
82
+ );
83
+ }
63
84
 
64
- async function deleteVisitor(_id: string){
65
- return await useNuxtApp().$api<Record<string, any>>(`/api/visitor-transactions/id/${_id}`, {
85
+ async function deleteVisitor(_id: string) {
86
+ return await useNuxtApp().$api<Record<string, any>>(
87
+ `/api/visitor-transactions/id/${_id}`,
88
+ {
66
89
  method: "DELETE",
67
- });
68
- }
90
+ }
91
+ );
92
+ }
69
93
 
70
- return {
71
- typeFieldMap,
72
- visitorSelection,
73
- contractorTypes,
74
- createVisitor,
75
- getVisitors,
76
- updateVisitor,
77
- deleteVisitor
78
- }
79
- }
94
+ return {
95
+ typeFieldMap,
96
+ visitorSelection,
97
+ contractorTypes,
98
+ createVisitor,
99
+ getVisitors,
100
+ updateVisitor,
101
+ deleteVisitor,
102
+ };
103
+ }
@@ -32,18 +32,18 @@ export default function useWorkOrder() {
32
32
 
33
33
  async function getWorkOrders({
34
34
  page = 1,
35
- organization = "",
36
35
  site = "",
37
36
  status = "to-do",
38
37
  search = "",
39
38
  limit = 10,
39
+ category = "",
40
40
  } = {}) {
41
41
  try {
42
42
  return useNuxtApp().$api<Record<string, any>>(
43
- `/api/work-orders/organization/${organization}/site/${site}/status/${status}`,
43
+ `/api/work-orders/site/${site}/status/${status}`,
44
44
  {
45
45
  method: "GET",
46
- query: { page, search, limit },
46
+ query: { page, search, limit, category },
47
47
  }
48
48
  );
49
49
  } catch (err) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@iservice365/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.2.0",
5
+ "version": "1.3.1",
6
6
  "main": "./nuxt.config.ts",
7
7
  "scripts": {
8
8
  "dev": "nuxi dev .playground",
@@ -4,6 +4,7 @@ declare type TBuilding = {
4
4
  name: string;
5
5
  block: number | null;
6
6
  levels: string[];
7
+ buildingFloorPlan: string[]
7
8
  };
8
9
 
9
10
  declare type TBuildingUnit = {
@@ -16,4 +17,5 @@ declare type TBuildingUnit = {
16
17
  level: string | null;
17
18
  category: string;
18
19
  status: string;
20
+ buildingUnitFiles: string[]
19
21
  };
package/types/people.d.ts CHANGED
@@ -2,17 +2,18 @@ declare type TPeople = {
2
2
  name?: string;
3
3
  block?: number | string;
4
4
  level?: string;
5
- unit?: string | Partial<TBuildingUnit>;
5
+ unit?: string
6
+ companyName?: sring[];
6
7
  unitName?: string;
7
- contact: string;
8
- plateNumber: string;
8
+ contact?: string;
9
+ plateNumber?: string;
9
10
  nric?: string;
10
11
  contact?: string;
11
12
  remarks?: string;
12
- start: string;
13
- end: string;
14
- org: string;
15
- site: string,
13
+ start?: string;
14
+ end?: string;
15
+ org?: string;
16
+ site?: string,
16
17
  type?: TPeoplePayload;
17
18
  };
18
19
 
@@ -21,7 +21,7 @@ declare type TVisitor = {
21
21
  manualCheckout?: boolean;
22
22
  };
23
23
 
24
- declare type TVisitorType = "contractor" | "delivery" | "walk-in" | "pick-up" | "drop-off";
24
+ declare type TVisitorType = "contractor" | "delivery" | "walk-in" | "pick-up" | "drop-off" | "guest";
25
25
 
26
26
  declare type TVisitorPayload = Pick<TVisitor, "name" | "type" | "company" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "checkOut" | "contractorType" | "deliveryType" | "nric" | "contact" | "remarks" | "attachments" | "org" | "site"> & {
27
27
  members?: TMemberInfo[]