@neutron.co.id/operasional-modules 1.18.0-beta.1 → 1.20.0-beta.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,6 +1,18 @@
1
1
  import { Resource } from '@neon.id/context';
2
2
  import { type Schema } from '@neutron.co.id/personalia-models';
3
+ export declare const WAIT_FOR_RAISE_LABEL: {
4
+ iconLeft: string;
5
+ label: string;
6
+ color: string;
7
+ style: {
8
+ '--neon-label-color': string;
9
+ };
10
+ };
11
+ export declare function getStaffStatus(item: Schema.Submission, staffId?: string): string;
12
+ export declare function renderSubmissionStaffStatus(item: Schema.Submission, staffId?: string): import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
13
+ [key: string]: any;
14
+ }>;
3
15
  export declare function renderSubmissionStatus(item: Schema.Submission, staffId?: string): import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
4
16
  [key: string]: any;
5
17
  }>;
6
- export declare const SubmissionResource: Resource<Schema.Submission, import("@neon.id/model").Model<"neu:personalia:submission", "branches" | "status" | "image" | "code" | "type" | "title" | "nameStaff" | "department" | "statusStaff" | "agreedStaffs" | "approvedAt" | "brand" | "changes" | "deadline" | "decideStaffs" | "decidedAt" | "delayAt" | "delayStaffs" | "detailDecide" | "detailDecideOther" | "detailProcess" | "detailRaise" | "document" | "followUpStaffs" | "hasProcessStaffs" | "hasRaiseStaffs" | "nominal" | "preparedAt" | "processedAt" | "raiseStaffs" | "raisedAt" | "specifications" | "submissionStaffs" | "virtualFollowUpStaffs" | "workingHours" | "yetProcessStaffs" | "yetRaiseStaffs", Schema.Submission>>;
18
+ export declare const SubmissionResource: Resource<Schema.Submission, import("@neon.id/model").Model<"neu:personalia:submission", "branches" | "status" | "image" | "code" | "type" | "title" | "nameStaff" | "department" | "statusStaff" | "agreedStaffs" | "approvedAt" | "brand" | "changes" | "deadline" | "decideStaffs" | "decidedAt" | "delayAt" | "delayStaffs" | "detailDecide" | "detailDecideOther" | "detailProcess" | "detailRaise" | "document" | "followUpStaffs" | "hasProcessStaffs" | "hasRaiseStaffs" | "isDeletable" | "raiseRound" | "nominal" | "preparedAt" | "processedAt" | "raiseStaffs" | "raisedAt" | "specifications" | "submissionStaffs" | "virtualFollowUpStaffs" | "waitRaiseStaffs" | "workingHours" | "yetProcessStaffs" | "yetRaiseStaffs", Schema.Submission>>;
@@ -4,13 +4,21 @@ import {
4
4
  } from "@neutron.co.id/personalia-models";
5
5
  import { computed, h } from "vue";
6
6
  import { NeonLabel } from "@neon.id/interfaces";
7
- function formatRupiah(money) {
8
- return new Intl.NumberFormat("id-ID", {
9
- style: "currency",
10
- currency: "IDR",
11
- minimumFractionDigits: 0
12
- }).format(money);
7
+ function formatNominal(value) {
8
+ if (value == null || value === "")
9
+ return "-";
10
+ const number = Number(value);
11
+ if (Number.isNaN(number))
12
+ return "-";
13
+ return `Rp ${number.toLocaleString("id-ID", { maximumFractionDigits: 0 })}`;
13
14
  }
15
+ export const WAIT_FOR_RAISE_LABEL = {
16
+ iconLeft: "hourglass",
17
+ label: "Menunggu Dinaikkan",
18
+ color: "#FEF3C7",
19
+ // NeonLabel's color is the background; its text color is only reachable through the CSS variable.
20
+ style: { "--neon-label-color": "#B45309" }
21
+ };
14
22
  function formatStatus(status, yetProcessStaffIds, staffId) {
15
23
  const actions = {
16
24
  prepared: {
@@ -18,6 +26,7 @@ function formatStatus(status, yetProcessStaffIds, staffId) {
18
26
  label: "Disiapkan",
19
27
  color: "base"
20
28
  },
29
+ waitForRaise: WAIT_FOR_RAISE_LABEL,
21
30
  raised: {
22
31
  iconLeft: "arrow-up-from-line",
23
32
  label: "Dinaikkan",
@@ -68,9 +77,19 @@ function formatStatus(status, yetProcessStaffIds, staffId) {
68
77
  icon: action.value?.iconLeft,
69
78
  text: action.value?.label,
70
79
  size: "md",
71
- color: action.value?.color
80
+ color: action.value?.color,
81
+ style: action.value?.style
72
82
  });
73
83
  }
84
+ export function getStaffStatus(item, staffId) {
85
+ if (item?.status === "prepared" && !!staffId && (item.waitRaiseStaffIds ?? []).map(String).includes(staffId)) {
86
+ return "waitForRaise";
87
+ }
88
+ return item?.statusStaff || item?.status || "";
89
+ }
90
+ export function renderSubmissionStaffStatus(item, staffId) {
91
+ return formatStatus(getStaffStatus(item, staffId), [], staffId || "");
92
+ }
74
93
  export function renderSubmissionStatus(item, staffId) {
75
94
  return formatStatus(
76
95
  item?.status || "",
@@ -167,7 +186,7 @@ export const SubmissionResource = Resource.define({
167
186
  },
168
187
  fragments: SubmissionModel.fragments,
169
188
  renders: {
170
- nominal: (item) => item.nominal ? formatRupiah(item.nominal) : "-"
189
+ nominal: (item) => formatNominal(item.nominal)
171
190
  // status: item => renderSubmissionStatus(item),
172
191
  }
173
192
  });
@@ -3,10 +3,17 @@ import { NeonLabel } from "@neon.id/interfaces";
3
3
  import { ResourceUtil } from "@neon.id/office";
4
4
  import { Query } from "@neon.id/query";
5
5
  import {
6
+ formatNominal,
7
+ refreshStaleSubmissionList,
6
8
  useOperasionalStore
7
9
  } from "@neutron.co.id/operasional-interfaces/office";
8
10
  import { computed, h, resolveComponent } from "vue";
9
- import { renderSubmissionStatus } from "./submission.resource.mjs";
11
+ import {
12
+ WAIT_FOR_RAISE_LABEL,
13
+ getStaffStatus,
14
+ renderSubmissionStaffStatus,
15
+ renderSubmissionStatus
16
+ } from "./submission.resource.mjs";
10
17
  export const SubmissionCollectionView = ResourceUtil.createCollection({
11
18
  name: "default",
12
19
  definition: "neu:personalia:submission",
@@ -55,8 +62,18 @@ export const SubmissionCollectionStaffView = ResourceUtil.createCollection({
55
62
  "nominal"
56
63
  // 'areas',
57
64
  ],
65
+ renders: {
66
+ statusStaff: (item) => {
67
+ const { staff } = useOperasionalStore().getAllStoreValue();
68
+ return renderSubmissionStaffStatus(item, staff?.id);
69
+ },
70
+ // View renders replace the resource renders, so nominal must be repeated here.
71
+ nominal: (item) => formatNominal(item.nominal)
72
+ },
73
+ excludes: ["delete"],
74
+ onSetup: refreshStaleSubmissionList,
58
75
  filters: [
59
- "status",
76
+ "statusStaff",
60
77
  "department",
61
78
  "type",
62
79
  // 'specifications',
@@ -97,6 +114,7 @@ export const SubmissionSingleStaffView = ResourceUtil.createSingle({
97
114
  name: "staff",
98
115
  definition: "neu:personalia:submission",
99
116
  title: "Pengajuan",
117
+ excludes: ["delete", "duplicate"],
100
118
  slots: {
101
119
  default: "staff",
102
120
  actions: {
@@ -218,8 +236,12 @@ export const SubmissionCollectionAuditView = ResourceUtil.createCollection({
218
236
  status: (item) => {
219
237
  const { staff } = useOperasionalStore().getAllStoreValue();
220
238
  return renderSubmissionStatus(item, staff?.id);
221
- }
239
+ },
240
+ // View renders replace the resource renders, so nominal must be repeated here.
241
+ nominal: (item) => formatNominal(item.nominal)
222
242
  },
243
+ excludes: ["delete"],
244
+ onSetup: refreshStaleSubmissionList,
223
245
  filters: [
224
246
  "status",
225
247
  "department",
@@ -262,6 +284,7 @@ export const SubmissionSingleAuditView = ResourceUtil.createSingle({
262
284
  name: "audit",
263
285
  definition: "neu:personalia:submission",
264
286
  title: "Pengajuan",
287
+ excludes: ["delete", "duplicate"],
265
288
  slots: {
266
289
  default: "audit",
267
290
  actions: () => h(resolveComponent("SubmissionAction"))
@@ -694,12 +717,14 @@ function getLabel() {
694
717
  }
695
718
  function getLabelStaff() {
696
719
  const { isNew, values, isLoading } = useSingle();
720
+ const store = useOperasionalStore();
697
721
  const actions = {
698
722
  prepared: {
699
723
  iconLeft: "pen-line",
700
724
  label: "Disiapkan",
701
725
  color: "base"
702
726
  },
727
+ waitForRaise: WAIT_FOR_RAISE_LABEL,
703
728
  raised: {
704
729
  iconLeft: "arrow-up-from-line",
705
730
  label: "Dinaikkan",
@@ -741,7 +766,10 @@ function getLabelStaff() {
741
766
  color: "success"
742
767
  }
743
768
  };
744
- const action = computed(() => actions[values.value.statusStaff]);
769
+ const action = computed(() => {
770
+ const { staff } = store.getAllStoreValue();
771
+ return actions[getStaffStatus(values.value, staff?.id)];
772
+ });
745
773
  return () => {
746
774
  if (isNew.value || !action.value)
747
775
  return null;
@@ -751,6 +779,7 @@ function getLabelStaff() {
751
779
  text: action.value?.label,
752
780
  size: "md",
753
781
  color: action.value?.color,
782
+ style: action.value?.style,
754
783
  isLoading: isLoading.value
755
784
  })
756
785
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neutron.co.id/operasional-modules",
3
- "version": "1.18.0-beta.1",
3
+ "version": "1.20.0-beta.1",
4
4
  "description": "Modules of Neutron Operasional.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "contributors": [
@@ -48,7 +48,7 @@
48
48
  "@neon.id/interfaces": "^1.57.0",
49
49
  "@neon.id/office": "1.46.0",
50
50
  "@neon.id/query": "^1.12.0",
51
- "@neutron.co.id/personalia-models": "1.18.1-beta.1",
51
+ "@neutron.co.id/personalia-models": "1.19.0-beta.1",
52
52
  "pretty-bytes": "^6.1.1",
53
53
  "vue": "^3.4.31"
54
54
  },
@@ -78,12 +78,12 @@
78
78
  "@neon.id/interfaces": "^1.57.0",
79
79
  "@neon.id/office": "1.46.0",
80
80
  "@neon.id/query": "^1.12.0",
81
- "@neutron.co.id/personalia-models": "1.18.1-beta.1",
81
+ "@neutron.co.id/personalia-models": "1.19.0-beta.1",
82
82
  "@nuxt/kit": "^3.12.3",
83
83
  "pretty-bytes": "^6.1.1"
84
84
  },
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "build": 140
88
+ "build": 143
89
89
  }