@neutron.co.id/operasional-interfaces 1.17.5 → 1.17.7

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.
Files changed (69) hide show
  1. package/build/@office/config.mjs +12 -0
  2. package/build/@office/models/personalia/attendance/AttendanceManager.vue +5 -5
  3. package/build/@office/models/personalia/attendance/AttendanceSingle/AttendanceSingle.vue +2 -1
  4. package/build/@office/models/personalia/attendanceType/AttendanceTypeCollection/AttendanceTypeCollection.vue +23 -0
  5. package/build/@office/models/personalia/attendanceType/AttendanceTypeCollection/AttendanceTypeTypeCollection.stories.d.ts +7 -0
  6. package/build/@office/models/personalia/attendanceType/AttendanceTypeCollection/AttendanceTypeTypeCollection.stories.mjs +40 -0
  7. package/build/@office/models/personalia/attendanceType/AttendanceTypeCollection/index.d.ts +1 -0
  8. package/build/@office/models/personalia/attendanceType/AttendanceTypeCollection/index.mjs +1 -0
  9. package/build/@office/models/personalia/attendanceType/AttendanceTypeSingle/AttendanceTypeSingle.stories.d.ts +8 -0
  10. package/build/@office/models/personalia/attendanceType/AttendanceTypeSingle/AttendanceTypeSingle.stories.mjs +47 -0
  11. package/build/@office/models/personalia/attendanceType/AttendanceTypeSingle/AttendanceTypeSingle.vue +100 -0
  12. package/build/@office/models/personalia/attendanceType/AttendanceTypeSingle/index.d.ts +1 -0
  13. package/build/@office/models/personalia/attendanceType/AttendanceTypeSingle/index.mjs +1 -0
  14. package/build/@office/models/personalia/attendanceType/index.d.ts +2 -0
  15. package/build/@office/models/personalia/attendanceType/index.mjs +2 -0
  16. package/build/@office/models/personalia/index.d.ts +4 -0
  17. package/build/@office/models/personalia/index.mjs +4 -0
  18. package/build/@office/models/personalia/leaveConflict/LeaveConflictCollection/LeaveConflictCollection.vue +34 -0
  19. package/build/@office/models/personalia/leaveConflict/LeaveConflictCollection/index.d.ts +1 -0
  20. package/build/@office/models/personalia/leaveConflict/LeaveConflictCollection/index.mjs +1 -0
  21. package/build/@office/models/personalia/leaveConflict/LeaveConflictSingle/LeaveConflictSingle.vue +27 -0
  22. package/build/@office/models/personalia/leaveConflict/LeaveConflictSingle/index.d.ts +1 -0
  23. package/build/@office/models/personalia/leaveConflict/LeaveConflictSingle/index.mjs +1 -0
  24. package/build/@office/models/personalia/leaveConflict/index.d.ts +2 -0
  25. package/build/@office/models/personalia/leaveConflict/index.mjs +2 -0
  26. package/build/@office/models/personalia/leaveQuota/LeaveQuotaCollection/LeaveQuotaCollection.vue +24 -0
  27. package/build/@office/models/personalia/leaveQuota/LeaveQuotaCollection/index.d.ts +1 -0
  28. package/build/@office/models/personalia/leaveQuota/LeaveQuotaCollection/index.mjs +1 -0
  29. package/build/@office/models/personalia/leaveQuota/LeaveQuotaSingle/LeaveQuotaSingle.vue +210 -0
  30. package/build/@office/models/personalia/leaveQuota/LeaveQuotaSingle/index.d.ts +2 -0
  31. package/build/@office/models/personalia/leaveQuota/LeaveQuotaSingle/index.mjs +2 -0
  32. package/build/@office/models/personalia/leaveQuota/index.d.ts +2 -0
  33. package/build/@office/models/personalia/leaveQuota/index.mjs +2 -0
  34. package/build/@office/models/personalia/leaveStaff/LeaveStaffCollection/LeaveStaffCollection.vue +23 -0
  35. package/build/@office/models/personalia/leaveStaff/LeaveStaffCollection/index.d.ts +1 -0
  36. package/build/@office/models/personalia/leaveStaff/LeaveStaffCollection/index.mjs +1 -0
  37. package/build/@office/models/personalia/leaveStaff/LeaveStaffSingle/LeaveStaffSingle.vue +28 -0
  38. package/build/@office/models/personalia/leaveStaff/LeaveStaffSingle/index.d.ts +1 -0
  39. package/build/@office/models/personalia/leaveStaff/LeaveStaffSingle/index.mjs +1 -0
  40. package/build/@office/models/personalia/leaveStaff/index.d.ts +2 -0
  41. package/build/@office/models/personalia/leaveStaff/index.mjs +2 -0
  42. package/build/@package/@office/models/personalia/attendanceType/AttendanceTypeCollection/AttendanceTypeCollection.vue.d.ts +2 -0
  43. package/build/@package/@office/models/personalia/attendanceType/AttendanceTypeCollection/index.d.ts +1 -0
  44. package/build/@package/@office/models/personalia/attendanceType/AttendanceTypeSingle/AttendanceTypeSingle.vue.d.ts +2 -0
  45. package/build/@package/@office/models/personalia/attendanceType/AttendanceTypeSingle/index.d.ts +1 -0
  46. package/build/@package/@office/models/personalia/attendanceType/index.d.ts +2 -0
  47. package/build/@package/@office/models/personalia/index.d.ts +4 -0
  48. package/build/@package/@office/models/personalia/leaveConflict/LeaveConflictCollection/LeaveConflictCollection.vue.d.ts +2 -0
  49. package/build/@package/@office/models/personalia/leaveConflict/LeaveConflictCollection/index.d.ts +1 -0
  50. package/build/@package/@office/models/personalia/leaveConflict/LeaveConflictSingle/LeaveConflictSingle.vue.d.ts +2 -0
  51. package/build/@package/@office/models/personalia/leaveConflict/LeaveConflictSingle/index.d.ts +1 -0
  52. package/build/@package/@office/models/personalia/leaveConflict/index.d.ts +2 -0
  53. package/build/@package/@office/models/personalia/leaveQuota/LeaveQuotaCollection/LeaveQuotaCollection.vue.d.ts +2 -0
  54. package/build/@package/@office/models/personalia/leaveQuota/LeaveQuotaCollection/index.d.ts +1 -0
  55. package/build/@package/@office/models/personalia/leaveQuota/LeaveQuotaSingle/LeaveQuotaSingle.vue.d.ts +2 -0
  56. package/build/@package/@office/models/personalia/leaveQuota/LeaveQuotaSingle/index.d.ts +2 -0
  57. package/build/@package/@office/models/personalia/leaveQuota/index.d.ts +2 -0
  58. package/build/@package/@office/models/personalia/leaveStaff/LeaveStaffCollection/LeaveStaffCollection.vue.d.ts +2 -0
  59. package/build/@package/@office/models/personalia/leaveStaff/LeaveStaffCollection/index.d.ts +1 -0
  60. package/build/@package/@office/models/personalia/leaveStaff/LeaveStaffSingle/LeaveStaffSingle.vue.d.ts +2 -0
  61. package/build/@package/@office/models/personalia/leaveStaff/LeaveStaffSingle/index.d.ts +1 -0
  62. package/build/@package/@office/models/personalia/leaveStaff/index.d.ts +2 -0
  63. package/build/mock/index.cjs +742 -192
  64. package/build/mock/index.mjs +744 -194
  65. package/build/mock/style.css +6 -2
  66. package/build/module.json +1 -1
  67. package/build/nuxt.json +1 -1
  68. package/build/nuxt.mjs +12 -0
  69. package/package.json +6 -6
@@ -13,6 +13,18 @@ export const config = OfficeInterfaces.define({
13
13
  "AttendanceManager",
14
14
  "AttendanceSupervisor",
15
15
  "AttendanceDelegate",
16
+ // Attendance Type
17
+ "AttendanceTypeCollection",
18
+ "AttendanceTypeSingle",
19
+ // Leave Quota
20
+ "LeaveQuotaCollection",
21
+ "LeaveQuotaSingle",
22
+ // Leave Staff
23
+ "LeaveStaffCollection",
24
+ "LeaveStaffSingle",
25
+ // Leave Conflict
26
+ "LeaveConflictCollection",
27
+ "LeaveConflictSingle",
16
28
  // Check In
17
29
  "CheckInCollection",
18
30
  "CheckInSingle",
@@ -197,7 +197,7 @@ const rejectedAbsensi = async () => {
197
197
  />
198
198
 
199
199
  <OfficeRelation
200
- v-if="values.type == 'leave'"
200
+ v-if="values.type === 'leave'"
201
201
  v-model="values"
202
202
  :field="fields.delegateStaffs"
203
203
  :is-disabled="
@@ -215,10 +215,10 @@ const rejectedAbsensi = async () => {
215
215
 
216
216
  <NeonField
217
217
  v-if="
218
- values.type == 'dayOff' ||
219
- values.type == 'sick' ||
220
- values.type == 'permission' ||
221
- values.type == 'leave'
218
+ values.type === 'dayOff' ||
219
+ values.type === 'sick' ||
220
+ values.type === 'permission' ||
221
+ values.type === 'leave'
222
222
  "
223
223
  v-model="values.submittedAt"
224
224
  v-bind="fields.submittedAt"
@@ -10,6 +10,7 @@ import type {
10
10
  } from '@neutron.co.id/personalia-models'
11
11
  import { NeonTime } from '../../../../common'
12
12
  import { DateUtil } from '../../../../common/utils/util.date'
13
+ import { Query } from '@neon.id/query'
13
14
 
14
15
  const {
15
16
  fields,
@@ -90,7 +91,7 @@ function onStartedAtUpdate(date: any) {
90
91
  @update:model-value="onStartedAtUpdate"
91
92
  />
92
93
 
93
- <NeonField v-model="values.type" v-bind="fields.type" />
94
+ <OfficeRelation v-model="values" :field="fields.type" />
94
95
 
95
96
  <OfficeRelation v-model="values" :field="fields.decideStaff" />
96
97
 
@@ -0,0 +1,23 @@
1
+ <script setup lang="ts">
2
+ import { NeonCollection, useCollection } from '@neon.id/context'
3
+ import { OfficeCollectionTable } from '@neon.id/office'
4
+ import type {
5
+ Schema,
6
+ TPersonaliaAttendanceTypeModel,
7
+ } from '@neutron.co.id/personalia-models'
8
+
9
+ defineOptions({ name: 'AttendanceTypeCollection' })
10
+
11
+ const { resource, display, items, userQuery } = useCollection<
12
+ Schema.AttendanceType,
13
+ TPersonaliaAttendanceTypeModel
14
+ >()
15
+ </script>
16
+
17
+ <template>
18
+ <NeonCollection class="neu-attendance-type-collection">
19
+ <OfficeCollectionTable />
20
+ </NeonCollection>
21
+ </template>
22
+
23
+ <style scoped></style>
@@ -0,0 +1,7 @@
1
+ import type { Meta } from '@storybook/vue3';
2
+ import AttendanceTypeCollection from './AttendanceTypeCollection.vue';
3
+ declare const _default: Meta<typeof AttendanceTypeCollection>;
4
+ export default _default;
5
+ export declare const Main: import("@storybook/csf").StoryAnnotations<import("@storybook/vue3").VueRenderer, {}, {}>;
6
+ export declare const InsideContent: import("@storybook/csf").StoryAnnotations<import("@storybook/vue3").VueRenderer, {}, {}>;
7
+ export declare const $DefaultView: any;
@@ -0,0 +1,40 @@
1
+ import { decorateCollection, viewCollection, wrapCollection } from "@mock";
2
+ import { StoryUtil } from "@neon.id/story/helpers";
3
+ import { AttendanceTypeCollectionView } from "@neutron.co.id/operasional-modules";
4
+ import { AttendanceTypeModel } from "@neutron.co.id/personalia-models";
5
+ import { withOperasional } from "../../../../common/providers/index.mjs";
6
+ import AttendanceTypeCollection from "./AttendanceTypeCollection.vue";
7
+ export default {
8
+ title: "Office/AttendanceType/Collection",
9
+ tags: [],
10
+ component: AttendanceTypeCollection,
11
+ parameters: StoryUtil.parameters({
12
+ description: "`AttendanceTypeCollection`",
13
+ layout: "fullscreen",
14
+ controls: { exclude: ["colors"] },
15
+ backgrounds: { default: "light" }
16
+ })
17
+ };
18
+ export const Main = StoryUtil.story({
19
+ description: "Main.",
20
+ decorators: decorateCollection({
21
+ model: AttendanceTypeModel
22
+ })
23
+ });
24
+ export const InsideContent = StoryUtil.story({
25
+ description: "Inside content.",
26
+ render: wrapCollection(AttendanceTypeCollection),
27
+ decorators: decorateCollection({
28
+ model: AttendanceTypeModel
29
+ })
30
+ });
31
+ export const $DefaultView = viewCollection({
32
+ description: "Default view.",
33
+ component: AttendanceTypeCollectionView,
34
+ setup() {
35
+ withOperasional();
36
+ },
37
+ props: {
38
+ overrides: {}
39
+ }
40
+ });
@@ -0,0 +1 @@
1
+ export { default as AttendanceTypeCollection } from './AttendanceTypeCollection.vue';
@@ -0,0 +1 @@
1
+ export { default as AttendanceTypeCollection } from "./AttendanceTypeCollection.vue";
@@ -0,0 +1,8 @@
1
+ import type { Meta } from '@storybook/vue3';
2
+ import AttendanceTypeSingle from './AttendanceTypeSingle.vue';
3
+ declare const _default: Meta<typeof AttendanceTypeSingle>;
4
+ export default _default;
5
+ export declare const New: import("@storybook/csf").StoryAnnotations<import("@storybook/vue3").VueRenderer, {}, {}>;
6
+ export declare const Existing: import("@storybook/csf").StoryAnnotations<import("@storybook/vue3").VueRenderer, {}, {}>;
7
+ export declare const Content: import("@storybook/csf").StoryAnnotations<import("@storybook/vue3").VueRenderer, {}, {}>;
8
+ export declare const $DefaultView: any;
@@ -0,0 +1,47 @@
1
+ import { StoryUtil } from "@neon.id/story/helpers";
2
+ import { AttendanceTypeModel } from "@neutron.co.id/personalia-models";
3
+ import { AttendanceTypeSingleView } from "@neutron.co.id/operasional-modules";
4
+ import AttendanceTypeSingle from "./AttendanceTypeSingle.vue";
5
+ import { decorateSingle, viewSingle, wrapSingle } from "@mock";
6
+ export default {
7
+ title: "Office/AttendanceType/Single",
8
+ tags: [],
9
+ component: AttendanceTypeSingle,
10
+ parameters: StoryUtil.parameters({
11
+ description: "`AttendanceTypeSingle`",
12
+ layout: "fullscreen",
13
+ controls: { exclude: ["colors"] },
14
+ backgrounds: { default: "light" }
15
+ })
16
+ };
17
+ export const New = StoryUtil.story({
18
+ description: "New.",
19
+ decorators: decorateSingle({
20
+ model: AttendanceTypeModel
21
+ })
22
+ });
23
+ export const Existing = StoryUtil.story({
24
+ description: "Existing.",
25
+ args: { id: "" },
26
+ decorators: decorateSingle({
27
+ model: AttendanceTypeModel
28
+ // id: '___',
29
+ })
30
+ });
31
+ export const Content = StoryUtil.story({
32
+ description: "Inside content.",
33
+ render: wrapSingle(AttendanceTypeSingle),
34
+ args: { id: "" },
35
+ decorators: decorateSingle({
36
+ model: AttendanceTypeModel
37
+ // id: '___',
38
+ })
39
+ });
40
+ export const $DefaultView = viewSingle({
41
+ description: "Default view.",
42
+ component: AttendanceTypeSingleView,
43
+ props: {
44
+ // id: '___',
45
+ overrides: {}
46
+ }
47
+ });
@@ -0,0 +1,100 @@
1
+ <script setup lang="ts">
2
+ import { NeonSingle, useSingle } from '@neon.id/context'
3
+ import { NeonField, NeonForm, NeonCheck } from '@neon.id/form'
4
+ import { OfficeRelation, OfficeTab, OfficeTabs } from '@neon.id/office'
5
+ import { useToast } from '@neon.id/interfaces'
6
+ import type {
7
+ TPersonaliaAttendanceTypeModel,
8
+ Schema,
9
+ } from '@neutron.co.id/personalia-models'
10
+
11
+ const {
12
+ fields,
13
+ initialValues,
14
+ values,
15
+ isLoading,
16
+ isChanged,
17
+ isMain,
18
+ saveOne,
19
+ discardChanges,
20
+ } = useSingle<Schema.AttendanceType, TPersonaliaAttendanceTypeModel>()
21
+
22
+ const toast = useToast()
23
+
24
+ async function saveCheck() {
25
+ if (
26
+ initialValues.value.code === '' ||
27
+ values.value.code === '' ||
28
+ !values.value.code
29
+ ) {
30
+ toast.push({
31
+ id: 'neu:attendance-type:code',
32
+ icon: 'warning',
33
+ content: 'Kode dari Tipe Absensi belum diisi!',
34
+ color: 'danger',
35
+ placement: 'bottom-right',
36
+ })
37
+ return
38
+ } else if (values.value.name !== '') {
39
+ await saveOne()
40
+ }
41
+ }
42
+ </script>
43
+
44
+ <template>
45
+ <NeonSingle class="neu-attendance-type-single">
46
+ <OfficeTabs :use-url="isMain">
47
+ <OfficeTab handle="info" icon="circle-info" title="Info">
48
+ <NeonForm
49
+ handle="info"
50
+ :initial-values="initialValues"
51
+ :is-loading="isLoading"
52
+ :is-changed="isChanged"
53
+ use-unsaved
54
+ @cancel="discardChanges"
55
+ @submit="saveCheck"
56
+ >
57
+ <NeonField v-model="values.name" v-bind="fields.name" />
58
+ <NeonField v-model="values.code" v-bind="fields.code" />
59
+ <NeonField v-model="values.leaveQuota" v-bind="fields.leaveQuota" />
60
+ <OfficeRelation v-model="values" :field="fields.branches" />
61
+ <NeonField
62
+ v-model="values.maxDurationDays"
63
+ v-bind="fields.maxDurationDays"
64
+ />
65
+ <NeonField
66
+ v-model="values.showLeaveQuota"
67
+ v-bind="fields.showLeaveQuota"
68
+ >
69
+ <template #input>
70
+ <NeonCheck
71
+ v-model="values.showLeaveQuota"
72
+ label="Tampilkan"
73
+ class="mt-2"
74
+ />
75
+ </template>
76
+ </NeonField>
77
+ <NeonField
78
+ v-model="values.showAttendanceType"
79
+ v-bind="fields.showAttendanceType"
80
+ >
81
+ <template #input>
82
+ <NeonCheck
83
+ v-model="values.showAttendanceType"
84
+ label="Tampilkan"
85
+ class="mt-2"
86
+ />
87
+ </template>
88
+ </NeonField>
89
+ <NeonField v-model="values.description" v-bind="fields.description" />
90
+ </NeonForm>
91
+ </OfficeTab>
92
+ </OfficeTabs>
93
+ </NeonSingle>
94
+ </template>
95
+
96
+ <style scoped>
97
+ .neu-AttendanceType-single {
98
+ @apply block;
99
+ }
100
+ </style>
@@ -0,0 +1 @@
1
+ export { default as AttendanceTypeSingle } from './AttendanceTypeSingle.vue';
@@ -0,0 +1 @@
1
+ export { default as AttendanceTypeSingle } from "./AttendanceTypeSingle.vue";
@@ -0,0 +1,2 @@
1
+ export * from './AttendanceTypeCollection';
2
+ export * from './AttendanceTypeSingle';
@@ -0,0 +1,2 @@
1
+ export * from "./AttendanceTypeCollection/index.mjs";
2
+ export * from "./AttendanceTypeSingle/index.mjs";
@@ -1,4 +1,5 @@
1
1
  export * from './attendance';
2
+ export * from './attendanceType';
2
3
  export * from './checkIn';
3
4
  export * from './plan';
4
5
  export * from './planType';
@@ -16,3 +17,6 @@ export * from './task';
16
17
  export * from './shift';
17
18
  export * from './shiftType';
18
19
  export * from './shiftStaff';
20
+ export * from './leaveQuota';
21
+ export * from './leaveStaff';
22
+ export * from './leaveConflict';
@@ -1,4 +1,5 @@
1
1
  export * from "./attendance/index.mjs";
2
+ export * from "./attendanceType/index.mjs";
2
3
  export * from "./checkIn/index.mjs";
3
4
  export * from "./plan/index.mjs";
4
5
  export * from "./planType/index.mjs";
@@ -16,3 +17,6 @@ export * from "./task/index.mjs";
16
17
  export * from "./shift/index.mjs";
17
18
  export * from "./shiftType/index.mjs";
18
19
  export * from "./shiftStaff/index.mjs";
20
+ export * from "./leaveQuota/index.mjs";
21
+ export * from "./leaveStaff/index.mjs";
22
+ export * from "./leaveConflict/index.mjs";
@@ -0,0 +1,34 @@
1
+ <script setup lang="ts">
2
+ import { NeonCollection, useCollection } from '@neon.id/context'
3
+ import { NeonField } from '@neon.id/form'
4
+ import { OfficeCollectionTable } from '@neon.id/office'
5
+ import {
6
+ type Schema,
7
+ type TPersonaliaLeaveConflictModel,
8
+ } from '@neutron.co.id/personalia-models'
9
+
10
+ defineOptions({ name: 'LeaveConflictCollection' })
11
+
12
+ const { fields } = useCollection<
13
+ Schema.LeaveConflict,
14
+ TPersonaliaLeaveConflictModel
15
+ >()
16
+ </script>
17
+
18
+ <template>
19
+ <NeonCollection class="neu-leave-conflict-collection">
20
+ <OfficeCollectionTable
21
+ :freeze="1"
22
+ :bulk="{ update: 'updateConflict' }"
23
+ use-bulk
24
+ use-select
25
+ size="lg"
26
+ >
27
+ <template #update-form="{ values }">
28
+ <NeonField v-model="values.deleteType" v-bind="fields.deleteType" />
29
+ </template>
30
+ </OfficeCollectionTable>
31
+ </NeonCollection>
32
+ </template>
33
+
34
+ <style scoped></style>
@@ -0,0 +1 @@
1
+ export { default as LeaveConflictCollection } from './LeaveConflictCollection.vue';
@@ -0,0 +1 @@
1
+ export { default as LeaveConflictCollection } from "./LeaveConflictCollection.vue";
@@ -0,0 +1,27 @@
1
+ <script setup lang="ts">
2
+ import { OfficeCollectionRelated, OfficeTab } from '@neon.id/office'
3
+ import { Query } from '@neon.id/query'
4
+ import { useSingle } from '@neon.id/context'
5
+ import type {
6
+ Schema,
7
+ TPersonaliaLeaveConflictModel,
8
+ } from '@neutron.co.id/personalia-models'
9
+
10
+ const { fields, values } = useSingle<
11
+ Schema.LeaveConflict,
12
+ TPersonaliaLeaveConflictModel
13
+ >()
14
+ </script>
15
+
16
+ <template>
17
+ <NeonSingle>
18
+ <OfficeTabs>
19
+ <OfficeTab handle="info" icon="circle-info" title="Info">
20
+ <NeonForm handle="info">
21
+ <NeonField v-model="values.staff" v-bind="fields.staff" is-disabled />
22
+ </NeonForm>
23
+ </OfficeTab>
24
+ </OfficeTabs>
25
+ </NeonSingle>
26
+ </template>
27
+ <style></style>
@@ -0,0 +1 @@
1
+ export { default as LeaveConflictSingle } from './LeaveConflictSingle.vue';
@@ -0,0 +1 @@
1
+ export { default as LeaveConflictSingle } from "./LeaveConflictSingle.vue";
@@ -0,0 +1,2 @@
1
+ export * from './LeaveConflictCollection';
2
+ export * from './LeaveConflictSingle';
@@ -0,0 +1,2 @@
1
+ export * from "./LeaveConflictCollection/index.mjs";
2
+ export * from "./LeaveConflictSingle/index.mjs";
@@ -0,0 +1,24 @@
1
+ <script setup lang="ts">
2
+ import { NeonCollection, useCollection } from '@neon.id/context'
3
+ import { OfficeCollectionTable } from '@neon.id/office'
4
+ import { NeonAlert } from '@neon.id/interfaces'
5
+ import type {
6
+ Schema,
7
+ TPersonaliaLeaveQuotaModel,
8
+ } from '@neutron.co.id/personalia-models'
9
+
10
+ defineOptions({ name: 'LeaveQuotaCollection' })
11
+
12
+ const { userQuery } = useCollection<
13
+ Schema.LeaveQuota,
14
+ TPersonaliaLeaveQuotaModel
15
+ >()
16
+ </script>
17
+
18
+ <template>
19
+ <NeonCollection class="neu-leave-quota-collection">
20
+ <OfficeCollectionTable />
21
+ </NeonCollection>
22
+ </template>
23
+
24
+ <style scoped></style>
@@ -0,0 +1 @@
1
+ export { default as LeaveQuotaCollection } from './LeaveQuotaCollection.vue';
@@ -0,0 +1 @@
1
+ export { default as LeaveQuotaCollection } from "./LeaveQuotaCollection.vue";
@@ -0,0 +1,210 @@
1
+ <script setup lang="ts">
2
+ import { NeonSingle, useSingle } from '@neon.id/context'
3
+ import {
4
+ OfficeCollectionRelated,
5
+ OfficeRelation,
6
+ OfficeTab,
7
+ OfficeTabs,
8
+ } from '@neon.id/office'
9
+ import {
10
+ type Schema,
11
+ type TPersonaliaLeaveQuotaModel,
12
+ } from '@neutron.co.id/personalia-models'
13
+ import { NeonAlert, useToast, NeonButton } from '@neon.id/interfaces'
14
+ import { NeonField, NeonFields, NeonForm } from '@neon.id/form'
15
+ import { ref } from 'vue'
16
+ import { Query } from '@neon.id/query'
17
+
18
+ const {
19
+ fields,
20
+ initialValues,
21
+ values,
22
+ isLoading,
23
+ isChanged,
24
+ isMain,
25
+ isNew,
26
+ saveOne,
27
+ discardChanges,
28
+ syncOne,
29
+ executeOne,
30
+ } = useSingle<Schema.LeaveQuota, TPersonaliaLeaveQuotaModel>()
31
+
32
+ const toast = useToast()
33
+ const responseState = ref()
34
+
35
+ function getNotified() {
36
+ if (responseState.value === 'leaveStaffGenerated') {
37
+ toast.push({
38
+ id: 'generate:leaveQuota',
39
+ content: 'Successfully generated leave quota.',
40
+ color: 'success',
41
+ })
42
+ }
43
+ }
44
+
45
+ async function generateLeave() {
46
+ const result = await executeOne('generateLeave', {
47
+ nameLeave: values.value.nameLeave,
48
+ nameStaffs: values.value.nameStaffs,
49
+ typeLeave: values.value.typeLeave,
50
+ leaveQuota: values.value.leaveQuota,
51
+ startedAt: values.value.startedAt,
52
+ endedAt: values.value.endedAt,
53
+ branches: values.value.branches,
54
+ conflictResolved: false,
55
+ leaveQuotaId: values.value.id,
56
+ })
57
+ if (result) {
58
+ values.value.hasConflict = result.data.executeLeaveQuota.output.hasConflict
59
+ await syncOne()
60
+ await saveOne()
61
+ }
62
+ getNotified()
63
+ }
64
+
65
+ async function saveCheck() {
66
+ if (values.value.attendanceTypeId == null) {
67
+ toast.push({
68
+ id: 'neu:attendance-type:code',
69
+ icon: 'warning',
70
+ content:
71
+ 'Tipe Absensi belum diisi! Silahkan pilih Tipe Absensi terlebih dahulu.',
72
+ color: 'danger',
73
+ placement: 'bottom-right',
74
+ })
75
+ return
76
+ } else {
77
+ await saveOne()
78
+ }
79
+ }
80
+ </script>
81
+
82
+ <template>
83
+ <NeonSingle>
84
+ <OfficeTabs>
85
+ <OfficeTab handle="info" icon="circle-info" title="Info">
86
+ <NeonForm
87
+ handle="info"
88
+ :initial-values="initialValues"
89
+ :is-loading="isLoading"
90
+ :is-changed="isChanged"
91
+ use-unsaved
92
+ @cancel="discardChanges"
93
+ @submit="saveCheck"
94
+ >
95
+ <NeonAlert
96
+ v-if="values.hasConflict"
97
+ icon="circle-exclamation"
98
+ title="Konflik Karyawan!."
99
+ description="Ada data karyawan yang dipilih sudah ada didata Kuota Cuti lainnya. Silahkan hapus data karyawan dan pilih karyawan lainnya."
100
+ color="warning"
101
+ />
102
+
103
+ <NeonField v-model="values.nameLeave" v-bind="fields.nameLeave" />
104
+ <OfficeRelation v-model="values" :field="fields.branches" />
105
+ <OfficeRelation v-model="values" :field="fields.typeLeave" />
106
+ <NeonFields class="grid grid-cols-[3fr_1fr]">
107
+ <OfficeRelation v-model="values" :field="fields.nameStaffs" />
108
+ <NeonButton
109
+ v-if="values.hasGenerated === false"
110
+ class="mt-4"
111
+ icon-left="sync"
112
+ label="Generate"
113
+ is-rounded
114
+ size="sm"
115
+ color="success"
116
+ @click="generateLeave"
117
+ />
118
+ </NeonFields>
119
+ <NeonField
120
+ v-model="values.leaveQuota"
121
+ v-bind="fields.leaveQuota"
122
+ is-disabled
123
+ />
124
+ <NeonField v-model="values.startedAt" v-bind="fields.startedAt" />
125
+ <NeonField v-model="values.endedAt" v-bind="fields.endedAt" />
126
+ <NeonField v-model="values.note" v-bind="fields.note" />
127
+ </NeonForm>
128
+ </OfficeTab>
129
+
130
+ <!-- Cuti Karyawan-->
131
+ <OfficeTab
132
+ v-if="!isNew && !values.hasConflict"
133
+ handle="cutiKaryawan"
134
+ icon="house-person-leave"
135
+ title="Cuti Karyawan"
136
+ >
137
+ <OfficeCollectionRelated
138
+ definition="neu:personalia:leaveStaff"
139
+ title="Cuti Karyawan"
140
+ :query="
141
+ Query.define({
142
+ filter: {
143
+ leaveQuotaStaffId: values.id,
144
+ },
145
+ sort: {
146
+ handle: 'startedAt',
147
+ direction: 'ascending',
148
+ },
149
+ })
150
+ "
151
+ :excludes="['click', 'create']"
152
+ :columns="[
153
+ 'staff',
154
+ 'typeLeave',
155
+ 'leaveQuota',
156
+ 'startedAt',
157
+ 'endedAt',
158
+ ]"
159
+ :sorts="['startedAt', 'createdAt', 'updatedAt']"
160
+ :filters="['staff']"
161
+ >
162
+ </OfficeCollectionRelated>
163
+ </OfficeTab>
164
+
165
+ <OfficeTab
166
+ v-if="!isNew && values.hasConflict"
167
+ handle="konflik"
168
+ icon="circle-exclamation"
169
+ title="Konflik Karyawan"
170
+ >
171
+ <NeonAlert
172
+ icon="circle-exclamation"
173
+ title="Perhatian!"
174
+ description="Selesaikan konflik yang terjadi di kuota cuti."
175
+ color="warning"
176
+ />
177
+ <OfficeCollectionRelated
178
+ definition="neu:personalia:leaveConflict"
179
+ title="Konlfik Cuti Karyawan"
180
+ :query="
181
+ Query.define({
182
+ filter: {
183
+ leaveQuotaId: values.id,
184
+ deletedAt: { $exists: false },
185
+ },
186
+ sort: {
187
+ handle: 'startedAt',
188
+ direction: 'ascending',
189
+ },
190
+ })
191
+ "
192
+ use-bulk
193
+ :excludes="['click', 'create']"
194
+ :columns="[
195
+ 'staff',
196
+ 'leaveQuotaOldName',
197
+ 'leaveQuotaOld',
198
+ 'leaveQuotaNewName',
199
+ 'leaveQuotaNew',
200
+ ]"
201
+ :sorts="['startedAt', 'createdAt', 'updatedAt']"
202
+ :filters="['staff']"
203
+ >
204
+ </OfficeCollectionRelated>
205
+ </OfficeTab>
206
+ </OfficeTabs>
207
+ </NeonSingle>
208
+ </template>
209
+
210
+ <style></style>