@neutron.co.id/operasional-interfaces 1.16.1-beta.3 → 1.16.1-beta.5

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,13 +1,22 @@
1
1
  import { useToastStore } from "@neon.id/interfaces";
2
- import { ref } from "vue";
2
+ import { computed, ref } from "vue";
3
3
  import { ofetch } from "ofetch";
4
4
  import Papa from "papaparse";
5
5
  import { useOperasionalOfficeStore } from "../office/index.mjs";
6
6
  import { useAuthStore } from "@neon.id/identitas-interfaces";
7
+ import { useAppStore } from "@neon.id/context";
7
8
  export function useImportShift() {
8
9
  const store = useOperasionalOfficeStore();
9
10
  const toast = useToastStore();
10
11
  const authStore = useAuthStore();
12
+ const appStore = useAppStore();
13
+ const officeAppUrl = computed(() => {
14
+ if (appStore.appEnv === "dev")
15
+ return "https://dev.api.office.operasional.neutron.neon.id";
16
+ if (appStore.appEnv === "prod")
17
+ return "https://api.office.operasional.neutron.neon.id";
18
+ return "http://localhost:7020";
19
+ });
11
20
  const loadings = ref(/* @__PURE__ */ new Set());
12
21
  const isLoading = ref(false);
13
22
  return {
@@ -20,7 +29,7 @@ export function useImportShift() {
20
29
  isLoading.value = true;
21
30
  try {
22
31
  const response = await ofetch(
23
- `${store.officeApiUrl}/downloadTemplateShift`,
32
+ `${officeAppUrl.value}/downloadTemplateShift`,
24
33
  {
25
34
  method: "GET",
26
35
  headers: {
@@ -83,7 +92,7 @@ export function useImportShift() {
83
92
  try {
84
93
  isLoading.value = true;
85
94
  const response = await ofetch(
86
- `${store.officeApiUrl}/importDataShift`,
95
+ `${officeAppUrl.value}/importDataShift`,
87
96
  {
88
97
  method: "POST",
89
98
  headers: {
@@ -99,6 +108,7 @@ export function useImportShift() {
99
108
  canClose: true,
100
109
  color: "success"
101
110
  });
111
+ window.history.back();
102
112
  } catch (error) {
103
113
  console.error("onUploadCsvFile: error", error);
104
114
  toast.push({
@@ -1,7 +1,7 @@
1
1
  export declare const useOperasionalOfficeStore: import("pinia").StoreDefinition<"neu:operasional:office:store", import("pinia")._UnwrapAll<Pick<{
2
- officeApiUrl: import("vue").Ref<string>;
2
+ officeApiUrl: import("vue").Ref<string | undefined>;
3
3
  }, "officeApiUrl">>, Pick<{
4
- officeApiUrl: import("vue").Ref<string>;
4
+ officeApiUrl: import("vue").Ref<string | undefined>;
5
5
  }, never>, Pick<{
6
- officeApiUrl: import("vue").Ref<string>;
6
+ officeApiUrl: import("vue").Ref<string | undefined>;
7
7
  }, never>>;
@@ -3,9 +3,7 @@ import { ref } from "vue";
3
3
  export const useOperasionalOfficeStore = defineStore(
4
4
  "neu:operasional:office:store",
5
5
  () => {
6
- const officeApiUrl = ref(
7
- process.env.APP_ENVIRONMENT === "prod" ? "https://api.office.operasional.neutron.neon.id" : process.env.APP_ENVIRONMENT === "dev" ? "https://dev.api.office.operasional.neutron.neon.id" : process.env.NEU_OPERASIONAL_OFFICE_API_URL
8
- );
6
+ const officeApiUrl = ref();
9
7
  return {
10
8
  officeApiUrl
11
9
  };
@@ -37,11 +37,6 @@ const goBack = () => {
37
37
  window.history.back()
38
38
  }
39
39
 
40
- const handleImportCsvFile = async (upload: Mightbe<NFileUpload>) => {
41
- await onUploadCsvFile(upload)
42
- goBack()
43
- }
44
-
45
40
  function timeAgo(date: Mightbe<string>, word: string) {
46
41
  if (!date) return `Never ${word}`
47
42
  const time = useTimeAgo(date, {})
@@ -127,7 +122,7 @@ function timeAgo(date: Mightbe<string>, word: string) {
127
122
  color="dark"
128
123
  size="sm"
129
124
  is-rounded
130
- @click="handleImportCsvFile(upload)"
125
+ @click="onUploadCsvFile(upload)"
131
126
  />
132
127
  </div>
133
128
  </div>
@@ -1,7 +1,7 @@
1
1
  export declare const useOperasionalOfficeStore: import("pinia").StoreDefinition<"neu:operasional:office:store", import("pinia")._UnwrapAll<Pick<{
2
- officeApiUrl: import("vue").Ref<string>;
2
+ officeApiUrl: import("vue").Ref<string | undefined>;
3
3
  }, "officeApiUrl">>, Pick<{
4
- officeApiUrl: import("vue").Ref<string>;
4
+ officeApiUrl: import("vue").Ref<string | undefined>;
5
5
  }, never>, Pick<{
6
- officeApiUrl: import("vue").Ref<string>;
6
+ officeApiUrl: import("vue").Ref<string | undefined>;
7
7
  }, never>>;
@@ -12776,18 +12776,24 @@ const Papa = /* @__PURE__ */ getDefaultExportFromCjs(papaparse_minExports);
12776
12776
  const useOperasionalOfficeStore = pinia.defineStore(
12777
12777
  "neu:operasional:office:store",
12778
12778
  () => {
12779
- const officeApiUrl = vue.ref(
12780
- process.env.APP_ENVIRONMENT === "prod" ? "https://api.office.operasional.neutron.neon.id" : process.env.APP_ENVIRONMENT === "dev" ? "https://dev.api.office.operasional.neutron.neon.id" : process.env.NEU_OPERASIONAL_OFFICE_API_URL
12781
- );
12779
+ const officeApiUrl = vue.ref();
12782
12780
  return {
12783
12781
  officeApiUrl
12784
12782
  };
12785
12783
  }
12786
12784
  );
12787
12785
  function useImportShift() {
12788
- const store = useOperasionalOfficeStore();
12786
+ useOperasionalOfficeStore();
12789
12787
  const toast = interfaces.useToastStore();
12790
12788
  const authStore = identitasInterfaces.useAuthStore();
12789
+ const appStore = context.useAppStore();
12790
+ const officeAppUrl = vue.computed(() => {
12791
+ if (appStore.appEnv === "dev")
12792
+ return "https://dev.api.office.operasional.neutron.neon.id";
12793
+ if (appStore.appEnv === "prod")
12794
+ return "https://api.office.operasional.neutron.neon.id";
12795
+ return "http://localhost:7020";
12796
+ });
12791
12797
  const loadings = vue.ref(/* @__PURE__ */ new Set());
12792
12798
  const isLoading = vue.ref(false);
12793
12799
  return {
@@ -12800,7 +12806,7 @@ function useImportShift() {
12800
12806
  isLoading.value = true;
12801
12807
  try {
12802
12808
  const response = await ofetch(
12803
- `${store.officeApiUrl}/downloadTemplateShift`,
12809
+ `${officeAppUrl.value}/downloadTemplateShift`,
12804
12810
  {
12805
12811
  method: "GET",
12806
12812
  headers: {
@@ -12863,7 +12869,7 @@ function useImportShift() {
12863
12869
  try {
12864
12870
  isLoading.value = true;
12865
12871
  const response = await ofetch(
12866
- `${store.officeApiUrl}/importDataShift`,
12872
+ `${officeAppUrl.value}/importDataShift`,
12867
12873
  {
12868
12874
  method: "POST",
12869
12875
  headers: {
@@ -12879,6 +12885,7 @@ function useImportShift() {
12879
12885
  canClose: true,
12880
12886
  color: "success"
12881
12887
  });
12888
+ window.history.back();
12882
12889
  } catch (error) {
12883
12890
  console.error("onUploadCsvFile: error", error);
12884
12891
  toast.push({
@@ -26366,7 +26373,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
26366
26373
  };
26367
26374
  }
26368
26375
  });
26369
- const _withScopeId = (n) => (vue.pushScopeId("data-v-63e9ee2c"), n = n(), vue.popScopeId(), n);
26376
+ const _withScopeId = (n) => (vue.pushScopeId("data-v-818a1e6a"), n = n(), vue.popScopeId(), n);
26370
26377
  const _hoisted_1 = { class: "flex items-center gap-2" };
26371
26378
  const _hoisted_2 = { class: "button-cols" };
26372
26379
  const _hoisted_3 = { class: "button-row" };
@@ -26410,10 +26417,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
26410
26417
  const goBack = () => {
26411
26418
  window.history.back();
26412
26419
  };
26413
- const handleImportCsvFile = async (upload2) => {
26414
- await onUploadCsvFile(upload2);
26415
- goBack();
26416
- };
26417
26420
  return (_ctx, _cache) => {
26418
26421
  return vue.openBlock(), vue.createBlock(vue.unref(interfaces.NeonPart), {
26419
26422
  icon: "duotone:file-import",
@@ -26483,7 +26486,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
26483
26486
  color: "dark",
26484
26487
  size: "sm",
26485
26488
  "is-rounded": "",
26486
- onClick: _cache[0] || (_cache[0] = ($event) => handleImportCsvFile(upload.value))
26489
+ onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(onUploadCsvFile)(upload.value))
26487
26490
  })
26488
26491
  ])
26489
26492
  ])
@@ -26494,7 +26497,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
26494
26497
  };
26495
26498
  }
26496
26499
  });
26497
- const ShiftStaffImport = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-63e9ee2c"]]);
26500
+ const ShiftStaffImport = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-818a1e6a"]]);
26498
26501
  const all = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
26499
26502
  __proto__: null,
26500
26503
  AttendanceCollection: _sfc_main$1g,
@@ -23,7 +23,7 @@ import "@neon.id/identitas-interfaces/fluffy.css";
23
23
  import { ComponentUtil } from "@neon.id/utils/component";
24
24
  import { OfficeInterfaces } from "@neon.id/context/helpers";
25
25
  import { useRouter, useRoute } from "vue-router";
26
- import { GraphUtil, useSingle, useCollection, NeonCollection, NeonSingle, NeonCollectionContext, usePermit, useApp, withCollection } from "@neon.id/context";
26
+ import { GraphUtil, useAppStore, useSingle, useCollection, NeonCollection, NeonSingle, NeonCollectionContext, usePermit, useApp, withCollection } from "@neon.id/context";
27
27
  import { defineStore, storeToRefs } from "pinia";
28
28
  import { models as models$2 } from "@neutron.co.id/sentral-models";
29
29
  import { useClientHandle } from "@urql/vue";
@@ -12757,18 +12757,24 @@ const Papa = /* @__PURE__ */ getDefaultExportFromCjs(papaparse_minExports);
12757
12757
  const useOperasionalOfficeStore = defineStore(
12758
12758
  "neu:operasional:office:store",
12759
12759
  () => {
12760
- const officeApiUrl = ref(
12761
- process.env.APP_ENVIRONMENT === "prod" ? "https://api.office.operasional.neutron.neon.id" : process.env.APP_ENVIRONMENT === "dev" ? "https://dev.api.office.operasional.neutron.neon.id" : process.env.NEU_OPERASIONAL_OFFICE_API_URL
12762
- );
12760
+ const officeApiUrl = ref();
12763
12761
  return {
12764
12762
  officeApiUrl
12765
12763
  };
12766
12764
  }
12767
12765
  );
12768
12766
  function useImportShift() {
12769
- const store = useOperasionalOfficeStore();
12767
+ useOperasionalOfficeStore();
12770
12768
  const toast = useToastStore();
12771
12769
  const authStore = useAuthStore();
12770
+ const appStore = useAppStore();
12771
+ const officeAppUrl = computed(() => {
12772
+ if (appStore.appEnv === "dev")
12773
+ return "https://dev.api.office.operasional.neutron.neon.id";
12774
+ if (appStore.appEnv === "prod")
12775
+ return "https://api.office.operasional.neutron.neon.id";
12776
+ return "http://localhost:7020";
12777
+ });
12772
12778
  const loadings = ref(/* @__PURE__ */ new Set());
12773
12779
  const isLoading = ref(false);
12774
12780
  return {
@@ -12781,7 +12787,7 @@ function useImportShift() {
12781
12787
  isLoading.value = true;
12782
12788
  try {
12783
12789
  const response = await ofetch(
12784
- `${store.officeApiUrl}/downloadTemplateShift`,
12790
+ `${officeAppUrl.value}/downloadTemplateShift`,
12785
12791
  {
12786
12792
  method: "GET",
12787
12793
  headers: {
@@ -12844,7 +12850,7 @@ function useImportShift() {
12844
12850
  try {
12845
12851
  isLoading.value = true;
12846
12852
  const response = await ofetch(
12847
- `${store.officeApiUrl}/importDataShift`,
12853
+ `${officeAppUrl.value}/importDataShift`,
12848
12854
  {
12849
12855
  method: "POST",
12850
12856
  headers: {
@@ -12860,6 +12866,7 @@ function useImportShift() {
12860
12866
  canClose: true,
12861
12867
  color: "success"
12862
12868
  });
12869
+ window.history.back();
12863
12870
  } catch (error) {
12864
12871
  console.error("onUploadCsvFile: error", error);
12865
12872
  toast.push({
@@ -26347,7 +26354,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
26347
26354
  };
26348
26355
  }
26349
26356
  });
26350
- const _withScopeId = (n) => (pushScopeId("data-v-63e9ee2c"), n = n(), popScopeId(), n);
26357
+ const _withScopeId = (n) => (pushScopeId("data-v-818a1e6a"), n = n(), popScopeId(), n);
26351
26358
  const _hoisted_1 = { class: "flex items-center gap-2" };
26352
26359
  const _hoisted_2 = { class: "button-cols" };
26353
26360
  const _hoisted_3 = { class: "button-row" };
@@ -26391,10 +26398,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
26391
26398
  const goBack = () => {
26392
26399
  window.history.back();
26393
26400
  };
26394
- const handleImportCsvFile = async (upload2) => {
26395
- await onUploadCsvFile(upload2);
26396
- goBack();
26397
- };
26398
26401
  return (_ctx, _cache) => {
26399
26402
  return openBlock(), createBlock(unref(NeonPart), {
26400
26403
  icon: "duotone:file-import",
@@ -26464,7 +26467,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
26464
26467
  color: "dark",
26465
26468
  size: "sm",
26466
26469
  "is-rounded": "",
26467
- onClick: _cache[0] || (_cache[0] = ($event) => handleImportCsvFile(upload.value))
26470
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(onUploadCsvFile)(upload.value))
26468
26471
  })
26469
26472
  ])
26470
26473
  ])
@@ -26475,7 +26478,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
26475
26478
  };
26476
26479
  }
26477
26480
  });
26478
- const ShiftStaffImport = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-63e9ee2c"]]);
26481
+ const ShiftStaffImport = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-818a1e6a"]]);
26479
26482
  const all = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
26480
26483
  __proto__: null,
26481
26484
  AttendanceCollection: _sfc_main$1g,
@@ -486,11 +486,11 @@
486
486
  padding-bottom: 0.5rem
487
487
  }
488
488
 
489
- .button-cols[data-v-63e9ee2c] {
489
+ .button-cols[data-v-818a1e6a] {
490
490
  display: flex;
491
491
  flex-direction: column
492
492
  }
493
- .button-cols[data-v-63e9ee2c] > :not([hidden]) ~ :not([hidden]) {
493
+ .button-cols[data-v-818a1e6a] > :not([hidden]) ~ :not([hidden]) {
494
494
  --tw-space-y-reverse: 0;
495
495
  margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
496
496
  margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));
@@ -499,43 +499,43 @@
499
499
  --tw-space-x-reverse: 1
500
500
  }
501
501
  @media (min-width: 576px) {
502
- .button-cols[data-v-63e9ee2c] {
502
+ .button-cols[data-v-818a1e6a] {
503
503
  flex-direction: row;
504
504
  align-items: center
505
505
  }
506
506
  }
507
- .button-row[data-v-63e9ee2c] {
507
+ .button-row[data-v-818a1e6a] {
508
508
  display: flex;
509
509
  flex: 1 1 0%;
510
510
  align-items: center
511
511
  }
512
- .button-row[data-v-63e9ee2c] > :not([hidden]) ~ :not([hidden]) {
512
+ .button-row[data-v-818a1e6a] > :not([hidden]) ~ :not([hidden]) {
513
513
  --tw-space-x-reverse: 0;
514
514
  margin-right: calc(0.5rem * var(--tw-space-x-reverse));
515
515
  margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))
516
516
  }
517
- .time-ago[data-v-63e9ee2c] {
517
+ .time-ago[data-v-818a1e6a] {
518
518
  font-size: 0.875rem;
519
519
  font-weight: 500;
520
520
  line-height: 1;
521
521
  --tw-text-opacity: 1;
522
522
  color: rgb(161 161 170 / var(--tw-text-opacity))
523
523
  }
524
- .button-end[data-v-63e9ee2c] {
524
+ .button-end[data-v-818a1e6a] {
525
525
  display: flex;
526
526
  flex: 1 1 0%
527
527
  }
528
- .button-end[data-v-63e9ee2c] > :not([hidden]) ~ :not([hidden]) {
528
+ .button-end[data-v-818a1e6a] > :not([hidden]) ~ :not([hidden]) {
529
529
  --tw-space-x-reverse: 0;
530
530
  margin-right: calc(0.5rem * var(--tw-space-x-reverse));
531
531
  margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))
532
532
  }
533
533
  @media (min-width: 576px) {
534
- .button-end[data-v-63e9ee2c] {
534
+ .button-end[data-v-818a1e6a] {
535
535
  justify-content: flex-end
536
536
  }
537
537
  }
538
- .warning-label[data-v-63e9ee2c] {
538
+ .warning-label[data-v-818a1e6a] {
539
539
  font-size: 0.875rem;
540
540
  font-weight: 500;
541
541
  line-height: 1;
package/build/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "1.16.1-beta.3",
7
+ "version": "1.16.1-beta.5",
8
8
  "builder": {
9
9
  "@neon.id/module-builder": "1.8.0",
10
10
  "unbuild": "2.0.0"
package/build/nuxt.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "1.16.1-beta.3",
7
+ "version": "1.16.1-beta.5",
8
8
  "builder": {
9
9
  "@neon.id/module-builder": "1.8.0",
10
10
  "unbuild": "2.0.0"
package/build/nuxt.mjs CHANGED
@@ -208,8 +208,8 @@ function setupConfig(options) {
208
208
  isDebug: false,
209
209
  isProd: env === "prod",
210
210
  mode: options.mode || "office",
211
- office: {}
212
- // officeApiUrl: process.env.NEU_OPERASIONAL_OFFICE_API_URL as string,
211
+ office: {},
212
+ officeApiUrl: process.env.NEU_OPERASIONAL_OFFICE_API_URL
213
213
  });
214
214
  const key = "neu:operasional:interfaces";
215
215
  nuxt.options.runtimeConfig[key] = config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neutron.co.id/operasional-interfaces",
3
- "version": "1.16.1-beta.3",
3
+ "version": "1.16.1-beta.5",
4
4
  "description": "Interface library of Neutron Operasional.",
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -164,5 +164,5 @@
164
164
  "publishConfig": {
165
165
  "access": "public"
166
166
  },
167
- "build": 173
167
+ "build": 175
168
168
  }