@neutron.co.id/operasional-interfaces 1.14.9 → 1.15.0

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 (128) hide show
  1. package/build/@common/composables/index.d.ts +1 -0
  2. package/build/@common/composables/index.mjs +1 -0
  3. package/build/@common/composables/period.use.d.ts +9 -0
  4. package/build/@common/composables/period.use.mjs +40 -0
  5. package/build/@common/config.d.ts +5 -0
  6. package/build/@common/config.mjs +16 -0
  7. package/build/@common/index.d.ts +1 -0
  8. package/build/@common/index.mjs +1 -0
  9. package/build/@office/common/NeonTime/NeonTime.vue +3 -0
  10. package/build/@office/common/PeriodButton/PeriodButton.vue +67 -0
  11. package/build/@office/common/PeriodButton/index.d.ts +1 -0
  12. package/build/@office/common/PeriodButton/index.mjs +1 -0
  13. package/build/@office/common/index.d.ts +1 -0
  14. package/build/@office/common/index.mjs +1 -0
  15. package/build/@office/common/utils/util.date.d.ts +2 -0
  16. package/build/@office/common/utils/util.date.mjs +2 -0
  17. package/build/@office/config.mjs +15 -3
  18. package/build/@office/models/personalia/attendance/AttendanceCollection/AttendanceCollection.vue +0 -1
  19. package/build/@office/models/personalia/attendance/AttendanceDelegate.vue +286 -0
  20. package/build/@office/models/personalia/attendance/AttendanceStaff.vue +77 -5
  21. package/build/@office/models/personalia/attendance/AttendanceSupervisor.vue +66 -4
  22. package/build/@office/models/personalia/attendance/index.d.ts +1 -0
  23. package/build/@office/models/personalia/attendance/index.mjs +1 -0
  24. package/build/@office/models/personalia/attendance/sections/AttendanceNoteTab/AttendanceNoteTab.vue +43 -0
  25. package/build/@office/models/personalia/attendance/sections/AttendanceNoteTab/index.d.ts +1 -0
  26. package/build/@office/models/personalia/attendance/sections/AttendanceNoteTab/index.mjs +1 -0
  27. package/build/@office/models/personalia/attendance/sections/index.d.ts +1 -0
  28. package/build/@office/models/personalia/attendance/sections/index.mjs +1 -0
  29. package/build/@office/models/personalia/checkIn/CheckInPresenceCollection.vue +0 -1
  30. package/build/@office/models/personalia/checkIn/CheckInScanner.vue +0 -3
  31. package/build/@office/models/personalia/checkIn/CheckInSingle/CheckInSingle.vue +0 -2
  32. package/build/@office/models/personalia/checkIn/CheckInSupervisor.vue +0 -1
  33. package/build/@office/models/personalia/index.d.ts +2 -0
  34. package/build/@office/models/personalia/index.mjs +2 -0
  35. package/build/@office/models/personalia/progress/ProgressCollection/ProgressCollection.vue +0 -1
  36. package/build/@office/models/personalia/shift/ShiftAdministrator.vue +241 -28
  37. package/build/@office/models/personalia/shift/ShiftCollection/ShiftCollection.vue +9 -58
  38. package/build/@office/models/personalia/shift/ShiftSingle/ShiftSingle.vue +213 -28
  39. package/build/@office/models/personalia/shift/ShiftSupervisor.vue +275 -0
  40. package/build/@office/models/personalia/shift/index.d.ts +1 -1
  41. package/build/@office/models/personalia/shift/index.mjs +1 -1
  42. package/build/@office/models/personalia/shiftStaff/ShiftStaffCollection/ShiftStaffCollection.stories.d.ts +7 -0
  43. package/build/@office/models/personalia/shiftStaff/ShiftStaffCollection/ShiftStaffCollection.stories.mjs +36 -0
  44. package/build/@office/models/personalia/shiftStaff/ShiftStaffCollection/ShiftStaffCollection.vue +94 -0
  45. package/build/@office/models/personalia/shiftStaff/ShiftStaffCollection/index.d.ts +1 -0
  46. package/build/@office/models/personalia/shiftStaff/ShiftStaffCollection/index.mjs +1 -0
  47. package/build/@office/models/personalia/shiftStaff/ShiftStaffCollectionBranch.vue +31 -0
  48. package/build/@office/models/personalia/shiftStaff/ShiftStaffCollectionStaff.vue +31 -0
  49. package/build/@office/models/personalia/shiftStaff/ShiftStaffSingle/ShiftStaffSingle.stories.d.ts +8 -0
  50. package/build/@office/models/personalia/shiftStaff/ShiftStaffSingle/ShiftStaffSingle.stories.mjs +47 -0
  51. package/build/@office/models/personalia/shiftStaff/ShiftStaffSingle/ShiftStaffSingle.vue +169 -0
  52. package/build/@office/models/personalia/shiftStaff/ShiftStaffSingle/index.d.ts +1 -0
  53. package/build/@office/models/personalia/shiftStaff/ShiftStaffSingle/index.mjs +1 -0
  54. package/build/@office/models/personalia/shiftStaff/ShiftStaffSingleBranch.vue +137 -0
  55. package/build/@office/models/personalia/shiftStaff/ShiftStaffWrapper/ShiftStaffDisplay.vue +140 -0
  56. package/build/@office/models/personalia/shiftStaff/ShiftStaffWrapper/ShiftStaffWrapper.stories.d.ts +5 -0
  57. package/build/@office/models/personalia/shiftStaff/ShiftStaffWrapper/ShiftStaffWrapper.stories.mjs +24 -0
  58. package/build/@office/models/personalia/shiftStaff/ShiftStaffWrapper/ShiftStaffWrapper.vue +237 -0
  59. package/build/@office/models/personalia/shiftStaff/ShiftStaffWrapper/index.d.ts +2 -0
  60. package/build/@office/models/personalia/shiftStaff/ShiftStaffWrapper/index.mjs +2 -0
  61. package/build/@office/models/personalia/shiftStaff/index.d.ts +6 -0
  62. package/build/@office/models/personalia/shiftStaff/index.mjs +6 -0
  63. package/build/@office/models/personalia/shiftType/ShiftTypeCollection/ShiftTypeCollection.stories.d.ts +7 -0
  64. package/build/@office/models/personalia/shiftType/ShiftTypeCollection/ShiftTypeCollection.stories.mjs +36 -0
  65. package/build/@office/models/personalia/shiftType/ShiftTypeCollection/ShiftTypeCollection.vue +22 -0
  66. package/build/@office/models/personalia/shiftType/ShiftTypeCollection/index.d.ts +1 -0
  67. package/build/@office/models/personalia/shiftType/ShiftTypeCollection/index.mjs +1 -0
  68. package/build/@office/models/personalia/shiftType/ShiftTypeSingle/ShiftTypeSingle.stories.d.ts +8 -0
  69. package/build/@office/models/personalia/shiftType/ShiftTypeSingle/ShiftTypeSingle.stories.mjs +47 -0
  70. package/build/@office/models/personalia/shiftType/ShiftTypeSingle/ShiftTypeSingle.vue +86 -0
  71. package/build/@office/models/personalia/shiftType/ShiftTypeSingle/index.d.ts +1 -0
  72. package/build/@office/models/personalia/shiftType/ShiftTypeSingle/index.mjs +1 -0
  73. package/build/@office/models/personalia/shiftType/index.d.ts +2 -0
  74. package/build/@office/models/personalia/shiftType/index.mjs +2 -0
  75. package/build/@office/models/personalia/staff/StaffIdentity.vue +5 -0
  76. package/build/@office/models/personalia/staff/StaffSingle/StaffSingle.vue +0 -18
  77. package/build/@office/models/personalia/submission/SubmissionAudit.vue +16 -0
  78. package/build/@office/models/personalia/submission/SubmissionStaff.vue +66 -66
  79. package/build/@package/@common/composables/index.d.ts +1 -0
  80. package/build/@package/@common/composables/period.use.d.ts +9 -0
  81. package/build/@package/@common/index.d.ts +1 -0
  82. package/build/@package/@office/common/PeriodButton/PeriodButton.vue.d.ts +11 -0
  83. package/build/@package/@office/common/PeriodButton/index.d.ts +1 -0
  84. package/build/@package/@office/common/index.d.ts +1 -0
  85. package/build/@package/@office/common/utils/util.date.d.ts +2 -0
  86. package/build/@package/@office/models/personalia/attendance/index.d.ts +1 -0
  87. package/build/@package/@office/models/personalia/attendance/sections/AttendanceNoteTab/AttendanceNoteTab.vue.d.ts +2 -0
  88. package/build/@package/@office/models/personalia/attendance/sections/AttendanceNoteTab/index.d.ts +1 -0
  89. package/build/@package/@office/models/personalia/attendance/sections/index.d.ts +1 -0
  90. package/build/@package/@office/models/personalia/index.d.ts +2 -0
  91. package/build/@package/@office/models/personalia/shift/ShiftCollection/ShiftCollection.vue.d.ts +1 -42
  92. package/build/@package/@office/models/personalia/shift/ShiftSupervisor.vue.d.ts +2 -0
  93. package/build/@package/@office/models/personalia/shift/index.d.ts +1 -1
  94. package/build/@package/@office/models/personalia/shiftStaff/ShiftStaffCollection/ShiftStaffCollection.vue.d.ts +65 -0
  95. package/build/@package/@office/models/personalia/shiftStaff/ShiftStaffCollection/index.d.ts +1 -0
  96. package/build/@package/@office/models/personalia/shiftStaff/ShiftStaffCollectionBranch.vue.d.ts +2 -0
  97. package/build/@package/@office/models/personalia/shiftStaff/ShiftStaffCollectionStaff.vue.d.ts +2 -0
  98. package/build/@package/@office/models/personalia/shiftStaff/ShiftStaffSingle/ShiftStaffSingle.vue.d.ts +2 -0
  99. package/build/@package/@office/models/personalia/shiftStaff/ShiftStaffSingle/index.d.ts +1 -0
  100. package/build/@package/@office/models/personalia/shiftStaff/ShiftStaffSingleBranch.vue.d.ts +2 -0
  101. package/build/@package/@office/models/personalia/shiftStaff/ShiftStaffWrapper/ShiftStaffDisplay.vue.d.ts +90 -0
  102. package/build/@package/@office/models/personalia/shiftStaff/ShiftStaffWrapper/ShiftStaffWrapper.vue.d.ts +125 -0
  103. package/build/@package/@office/models/personalia/shiftStaff/ShiftStaffWrapper/index.d.ts +2 -0
  104. package/build/@package/@office/models/personalia/shiftStaff/index.d.ts +6 -0
  105. package/build/@package/@office/models/personalia/shiftType/ShiftTypeCollection/ShiftTypeCollection.vue.d.ts +2 -0
  106. package/build/@package/@office/models/personalia/shiftType/ShiftTypeCollection/index.d.ts +1 -0
  107. package/build/@package/@office/models/personalia/shiftType/ShiftTypeSingle/ShiftTypeSingle.vue.d.ts +2 -0
  108. package/build/@package/@office/models/personalia/shiftType/ShiftTypeSingle/index.d.ts +1 -0
  109. package/build/@package/@office/models/personalia/shiftType/index.d.ts +2 -0
  110. package/build/module.json +1 -1
  111. package/build/nuxt.d.mts +1 -1
  112. package/build/nuxt.d.ts +1 -1
  113. package/build/nuxt.json +1 -1
  114. package/build/nuxt.mjs +15 -3
  115. package/build/runtime/plugins/plugin.operasional.js +1 -1
  116. package/build/types.d.mts +3 -3
  117. package/build/types.d.ts +3 -3
  118. package/package.json +11 -12
  119. package/build/@office/models/personalia/shift/ShiftStaff.vue +0 -92
  120. package/build/index.cjs +0 -1
  121. package/build/index.d.ts +0 -1
  122. package/build/index.mjs +0 -1
  123. package/build/mock/index.cjs +0 -23640
  124. package/build/mock/index.mjs +0 -23623
  125. package/build/mock/qr-scanner-worker.min-Bu8FMiXO.mjs +0 -101
  126. package/build/mock/qr-scanner-worker.min-DyvREpyM.js +0 -101
  127. package/build/mock/style.css +0 -409
  128. /package/build/@package/@office/models/personalia/{shift/ShiftStaff.vue.d.ts → attendance/AttendanceDelegate.vue.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { GraphUtil, NeonSingle, useSingle } from '@neon.id/context'
3
- import { NeonField, NeonForm } from '@neon.id/form'
3
+ import { NeonCheck, NeonField, NeonForm } from '@neon.id/form'
4
4
  import { NeonButton, NeonDivider, useToastStore } from '@neon.id/interfaces'
5
5
  import { OfficeRelation, OfficeTab, OfficeTabs } from '@neon.id/office'
6
6
  import { computed, ref, watch } from 'vue'
@@ -136,10 +136,13 @@ async function generateAttendance() {
136
136
  submitStaffId: values.value.submitStaffId,
137
137
  type: values.value.type,
138
138
  decideStaffId: values.value.decideStaffId,
139
+ delegateStaffIds: values.value.delegateStaffIds,
140
+ monitoringStaffIds: values.value.monitoringStaffIds,
139
141
  notes: values.value.notes,
140
142
  submittedAt: values.value.submittedAt,
141
143
  startedAt: values.value.startedAt,
142
144
  endedAt: values.value.endedAt,
145
+ delegateNotes: values.value.delegateNotes,
143
146
  },
144
147
  })
145
148
  .toPromise()
@@ -153,6 +156,13 @@ async function generate() {
153
156
  await getNotified()
154
157
  await syncOne()
155
158
  }
159
+
160
+ // set default values
161
+ // const default = {
162
+ // delegateStaffIds: staffId,
163
+ // delegateStaffs: staff.value,
164
+ // isDelegateStaff: false,
165
+ // } satisfies Schema.attendance
156
166
  </script>
157
167
 
158
168
  <template>
@@ -257,21 +267,73 @@ async function generate() {
257
267
  values.status == 'approved' || values.status == 'rejected'
258
268
  "
259
269
  /> -->
260
-
261
270
  <OfficeRelation
262
- v-if="values.type == 'leave'"
271
+ v-if="
272
+ values.type == 'leave' ||
273
+ values.type == 'sick' ||
274
+ values.type == 'dayOff' ||
275
+ values.type == 'permission'
276
+ "
277
+ v-model="values"
278
+ :field="fields.monitoringStaffs"
279
+ :is-disabled="
280
+ values.status == 'approved' || values.status == 'rejected'
281
+ "
282
+ />
283
+ <OfficeRelation
284
+ v-if="
285
+ values.type == 'leave' ||
286
+ values.type == 'dayOff' ||
287
+ values.type == 'sick' ||
288
+ values.type == 'permission'
289
+ "
263
290
  v-model="values"
264
291
  :field="fields.delegateStaffs"
265
292
  :is-disabled="
266
293
  values.status == 'approved' || values.status == 'rejected'
267
294
  "
268
295
  />
269
-
296
+ <!-- <NeonField
297
+ v-if="
298
+ values.type == 'leave' ||
299
+ values.type == 'dayOff' ||
300
+ values.type == 'sick' ||
301
+ values.type == 'permission'
302
+ "
303
+ v-model="values.isNotes"
304
+ v-bind="fields.isNotes"
305
+ :is-hidden="values.isNotes == false"
306
+ :is-disabled="
307
+ values.status == 'approved' || values.status == 'rejected'
308
+ "
309
+ >
310
+ <template #input>
311
+ <NeonCheck
312
+ v-if="values.isNotes == true"
313
+ v-model="values.isNotes"
314
+ label="Catatan"
315
+ class="mt-2"
316
+ :is-disabled="
317
+ values.status == 'approved' || values.isNotes == true
318
+ "
319
+ />
320
+ </template>
321
+ </NeonField> -->
270
322
  <NeonField
271
323
  v-if="isNew || isReady"
272
324
  v-model="values.notes"
273
325
  v-bind="fields.notes"
274
326
  />
327
+ <NeonField
328
+ v-if="
329
+ values.type == 'leave' ||
330
+ values.type == 'dayOff' ||
331
+ values.type == 'sick' ||
332
+ values.type == 'permission'
333
+ "
334
+ v-model="values.delegateNotes"
335
+ v-bind="fields.delegateNotes"
336
+ />
275
337
 
276
338
  <NeonDivider v-if="values.type" is-dashed label="Keterangan" />
277
339
 
@@ -3,3 +3,4 @@ export * from './AttendanceSingle';
3
3
  export { default as AttendanceManager } from './AttendanceManager.vue';
4
4
  export { default as AttendanceStaff } from './AttendanceStaff.vue';
5
5
  export { default as AttendanceSupervisor } from './AttendanceSupervisor.vue';
6
+ export { default as AttendanceDelegate } from './AttendanceDelegate.vue';
@@ -3,3 +3,4 @@ export * from "./AttendanceSingle/index.mjs";
3
3
  export { default as AttendanceManager } from "./AttendanceManager.vue";
4
4
  export { default as AttendanceStaff } from "./AttendanceStaff.vue";
5
5
  export { default as AttendanceSupervisor } from "./AttendanceSupervisor.vue";
6
+ export { default as AttendanceDelegate } from "./AttendanceDelegate.vue";
@@ -0,0 +1,43 @@
1
+ <script setup lang="ts">
2
+ import { CatatPaperPad } from '@neon.id/edukasi-interfaces/catat'
3
+ import { useApp, useSingle } from '@neon.id/context'
4
+ import { OfficeTab } from '@neon.id/office'
5
+ import type { NDefinition } from '@neon.id/types'
6
+ import { computed } from 'vue'
7
+ import type {
8
+ TPersonaliaAttendanceModel,
9
+ Schema,
10
+ } from '@neutron.co.id/personalia-models'
11
+
12
+ defineOptions({ name: 'AttendanceNoteTab' })
13
+
14
+ const { appId } = useApp()
15
+ const { isNew, isReady, isLoading, id, values } = useSingle<
16
+ Schema.Attendance,
17
+ TPersonaliaAttendanceModel
18
+ >()
19
+
20
+ const paperObject = computed<NDefinition.ObjectDef>(
21
+ () => `neu:operasional:attendance:${id.value}:office`,
22
+ )
23
+ </script>
24
+
25
+ <template>
26
+ <OfficeTab
27
+ v-slot="{ isTouched }"
28
+ :is-hidden="isNew || !isReady || !values.isNotes"
29
+ handle="catatan"
30
+ icon="circle-info"
31
+ title="Catatan"
32
+ >
33
+ <CatatPaperPad
34
+ :application-id="appId"
35
+ :object="paperObject"
36
+ :use-pages="false"
37
+ :is-ready="isReady && isTouched"
38
+ :is-loading="isLoading"
39
+ />
40
+ </OfficeTab>
41
+ </template>
42
+
43
+ <style scoped></style>
@@ -0,0 +1 @@
1
+ export { default as AttendanceNoteTab } from './AttendanceNoteTab.vue';
@@ -0,0 +1 @@
1
+ export { default as AttendanceNoteTab } from "./AttendanceNoteTab.vue";
@@ -0,0 +1 @@
1
+ export * from './AttendanceNoteTab';
@@ -0,0 +1 @@
1
+ export * from "./AttendanceNoteTab/index.mjs";
@@ -155,7 +155,6 @@ async function checkInStaff(
155
155
  ) {
156
156
  const toastId = 'neu:personalia:staff:checkIn'
157
157
  let checkInId
158
- console.log('bangunan...', qrKey)
159
158
 
160
159
  try {
161
160
  const resp = await client
@@ -1,5 +1,4 @@
1
1
  <script setup lang="ts">
2
- // import mitt, { Emitter } from 'mitt'
3
2
  import { useIntervalFn, useThrottleFn } from '@vueuse/core'
4
3
  import { storeToRefs } from 'pinia'
5
4
  import Scanner from 'qr-scanner'
@@ -23,8 +22,6 @@ const frameEl = ref()
23
22
  const videoEl = ref()
24
23
  const scanner = ref<Scanner>()
25
24
 
26
- // const { height, width } = useElementSize(frameEl)
27
-
28
25
  const state = reactive({
29
26
  isScanning: false,
30
27
  isInvalid: false,
@@ -22,7 +22,6 @@ const {
22
22
  const { staff } = useOperasional()
23
23
 
24
24
  onMounted(() => {
25
- console.log('idnya?', id.value)
26
25
  if (id.value === 'new') {
27
26
  values.value.staffId = staff.value?.id
28
27
  values.value.staff = {
@@ -64,7 +63,6 @@ onMounted(() => {
64
63
  </div>
65
64
 
66
65
  <OfficeRelation v-model="values" :field="fields.staff" is-disabled />
67
-
68
66
  <NeonField v-model="values.note" v-bind="fields.note" />
69
67
  </NeonForm>
70
68
  </OfficeTab>
@@ -29,7 +29,6 @@ const { staff } = useOperasional()
29
29
  const isOperasional = computed(() => (route.name as string)?.includes('rapor'))
30
30
 
31
31
  onMounted(() => {
32
- console.log('idnya?', id.value)
33
32
  if (id.value === 'new' && isOperasional) {
34
33
  values.value.staffId = staff.value?.id
35
34
  values.value.staff = {
@@ -14,3 +14,5 @@ export * from './submissionType';
14
14
  export * from './target';
15
15
  export * from './task';
16
16
  export * from './shift';
17
+ export * from './shiftType';
18
+ export * from './shiftStaff';
@@ -14,3 +14,5 @@ export * from "./submissionType/index.mjs";
14
14
  export * from "./target/index.mjs";
15
15
  export * from "./task/index.mjs";
16
16
  export * from "./shift/index.mjs";
17
+ export * from "./shiftType/index.mjs";
18
+ export * from "./shiftStaff/index.mjs";
@@ -44,7 +44,6 @@ const emit = defineEmits<{
44
44
  }>()
45
45
 
46
46
  function onCalendarPeriodUpdate(period: NCalendar.PeriodData) {
47
- console.log('calendar', period)
48
47
  emit('update:period', period)
49
48
  }
50
49
  </script>
@@ -1,36 +1,128 @@
1
1
  <script setup lang="ts">
2
- import { NeonSingle, useSingle } from '@neon.id/context'
2
+ import { GraphUtil, NeonSingle, useSingle } from '@neon.id/context'
3
3
  import { NeonField, NeonFields, NeonForm } from '@neon.id/form'
4
- import { NeonButton, NeonDivider, NeonCopy } from '@neon.id/interfaces'
4
+ import { useToastStore, NeonAlert, NeonButton } from '@neon.id/interfaces'
5
5
  import { OfficeRelation, OfficeTab, OfficeTabs } from '@neon.id/office'
6
- import { Query } from '@neon.id/query'
7
- import { useOperasional } from '../../../common/providers/operasional'
8
- import { computed, watch } from 'vue'
9
- import { PromiseUtil } from '@neon.id/utils/promise'
10
- import type {
11
- TPersonaliaShiftModel,
12
- Schema,
6
+ import {
7
+ type TPersonaliaShiftModel,
8
+ type Schema,
9
+ ShiftModel,
13
10
  } from '@neutron.co.id/personalia-models'
11
+ import { computed, ref, watch, watchEffect } from 'vue'
12
+ import { useOperasional } from '../../../common'
13
+ import { useClientHandle } from '@urql/vue'
14
+ import { PromiseUtil } from '@neon.id/utils/promise'
15
+ import { Query } from '@neon.id/query'
16
+
17
+ import dayjs from 'dayjs'
18
+ import utc from 'dayjs/plugin/utc'
19
+ import timezone from 'dayjs/plugin/timezone'
20
+
21
+ // import { ShiftStaffWrapper } from './ShiftStaffWrapper'
22
+ defineOptions({ name: 'OfficeSingleSync' })
23
+
24
+ dayjs.extend(utc)
25
+ dayjs.extend(timezone)
14
26
 
15
27
  const {
16
- fields,
17
28
  id,
29
+ fields,
18
30
  initialValues,
19
31
  values,
20
32
  isLoading,
21
33
  isChanged,
22
- isReady,
23
- isMain,
24
34
  isNew,
25
- syncOne,
35
+ isReady,
26
36
  saveOne,
27
37
  discardChanges,
28
38
  executeOne,
39
+ syncOne,
29
40
  } = useSingle<Schema.Shift, TPersonaliaShiftModel>()
30
41
 
42
+ const key = ref(0)
31
43
  const { staff } = useOperasional()
32
- </script>
44
+ const { client } = useClientHandle()
45
+ const staffId = staff.value?.id || ''
46
+
47
+ const branchOptions = computed(() => {
48
+ return {
49
+ filter: [
50
+ {
51
+ handle: '_id',
52
+ operator: 'in',
53
+ value: staff.value?.branchIds,
54
+ },
55
+ ],
56
+ }
57
+ })
58
+
59
+ const diff = computed(() => {
60
+ return dayjs
61
+ .utc(values.value.endedAt)
62
+ .diff(dayjs.utc(values.value.startedAt), 'day')
63
+ })
64
+
65
+ watch(isNew, setDefaultValues, { immediate: true })
33
66
 
67
+ async function setDefaultValues() {
68
+ if (!isNew.value) return
69
+ await PromiseUtil.wait(500)
70
+
71
+ const defaultValues = {
72
+ administratorStaffId: staffId,
73
+ administratorStaff: staff.value,
74
+ isGenerate: false,
75
+ } satisfies Schema.Shift
76
+
77
+ values.value.administratorStaffId = defaultValues.administratorStaffId
78
+ values.value.administratorStaff = defaultValues.administratorStaff
79
+ values.value.isGenerate = defaultValues.isGenerate
80
+ }
81
+
82
+ const toast = useToastStore()
83
+ const generateShiftState = ref()
84
+
85
+ async function getNotified() {
86
+ if (generateShiftState.value === 'shiftGenerated') {
87
+ toast.push({
88
+ id: 'generate:successfully',
89
+ color: 'success',
90
+ content: 'Shift berhasil generate.',
91
+ })
92
+ } else {
93
+ toast.push({
94
+ id: 'generate:conflictShift',
95
+ color: 'warning',
96
+ content: 'Shift tidak dapat digenerate karena konflik jadwal.',
97
+ })
98
+ }
99
+ }
100
+
101
+ async function generateShift() {
102
+ const resp = await client
103
+ .mutation(GraphUtil.executeOne(ShiftModel, {}), {
104
+ action: 'generateShift',
105
+ input: {
106
+ titleShift: values.value.titleShift,
107
+ administratorStaffId: values.value.administratorStaffId,
108
+ branchIds: values.value.branchIds,
109
+ shiftingStaffIds: values.value.shiftingStaffIds,
110
+ typeShiftId: values.value.typeShiftId,
111
+ buildingIds: values.value.buildingIds,
112
+ totalTime: values.value.totalTime,
113
+ startedAt: values.value.startedAt,
114
+ endedAt: values.value.endedAt,
115
+ },
116
+ })
117
+ .toPromise()
118
+ generateShiftState.value = resp?.data?.executeShift?.info?.state
119
+ }
120
+
121
+ async function generate() {
122
+ await generateShift()
123
+ await getNotified()
124
+ }
125
+ </script>
34
126
 
35
127
  <template>
36
128
  <NeonSingle class="neu-shift-single">
@@ -45,28 +137,149 @@ const { staff } = useOperasional()
45
137
  @cancel="discardChanges"
46
138
  @submit="saveOne"
47
139
  >
140
+ <OfficeRelation
141
+ v-model="values"
142
+ :field="fields.administratorStaff"
143
+ is-disabled
144
+ />
48
145
  <NeonField v-model="values.titleShift" v-bind="fields.titleShift" />
49
-
50
- <OfficeRelation v-model="values" :field="fields.branch" />
51
- <OfficeRelation v-model="values" :field="fields.shiftingStaff" />
52
-
53
- <OfficeRelation v-model="values" :field="fields.building" />
54
-
146
+ <OfficeRelation
147
+ v-model="values"
148
+ :field="fields.branches"
149
+ :query="Query.define(branchOptions)"
150
+ />
151
+ <OfficeRelation
152
+ v-model="values"
153
+ :field="fields.typeShift"
154
+ :query="
155
+ Query.define({
156
+ filter: {
157
+ branchIds: { $in: values.branchIds },
158
+ },
159
+ })
160
+ "
161
+ />
162
+ <OfficeRelation
163
+ v-model="values"
164
+ :field="fields.shiftingStaffs"
165
+ :query="
166
+ Query.define({
167
+ filter: {
168
+ branchIds: { $in: values.branchIds },
169
+ },
170
+ })
171
+ "
172
+ />
55
173
  <NeonFields md="grid-cols-2">
56
- <NeonField v-model="values.expPresent" v-bind="fields.expPresent" />
57
- <NeonField
58
- v-model="values.expPresentEnd"
59
- v-bind="fields.expPresentEnd"
60
- />
174
+ <NeonField v-model="values.startedAt" v-bind="fields.startedAt" />
175
+ <NeonField v-model="values.endedAt" v-bind="fields.endedAt" />
61
176
  </NeonFields>
62
177
  <NeonField
63
- v-model="values.expTime"
64
- v-bind="fields.expTime"
178
+ v-if="!isNew"
179
+ v-model="values.totalTime"
180
+ v-bind="fields.totalTime"
65
181
  is-disabled
66
182
  />
67
-
183
+ <!-- <div class="grid gap-2 sm:grid-cols-2">
184
+ <NeonField
185
+ v-model="values.startedTime"
186
+ v-bind="{
187
+ handle: 'startedTime',
188
+ name: 'Jam mulai',
189
+ options: {
190
+ note: 'Jam datang shift.',
191
+ },
192
+ }"
193
+ is-disabled
194
+ >
195
+ <template #input>
196
+ <NeonTime v-model="values.startedTime" is-disabled />
197
+ </template>
198
+ </NeonField>
199
+ <NeonField
200
+ v-model="values.endedTime"
201
+ v-bind="{
202
+ handle: 'endedTime',
203
+ name: 'Jam Selesai',
204
+ options: {
205
+ note: 'Jam selesai shift.',
206
+ },
207
+ }"
208
+ is-disabled
209
+ >
210
+ <template #input>
211
+ <NeonTime v-model="values.endedTime" is-disabled />
212
+ </template>
213
+ </NeonField>
214
+ </div> -->
215
+ <OfficeRelation
216
+ v-model="values"
217
+ :field="fields.building"
218
+ :query="
219
+ Query.define({
220
+ filter: {
221
+ branchIds: { $in: values.branchIds },
222
+ },
223
+ })
224
+ "
225
+ />
226
+ <NeonField v-model="values.note" v-bind="fields.note" />
227
+ <NeonButton
228
+ v-if="!isNew"
229
+ icon-left="bolt"
230
+ label="Generate Jadwal Shift"
231
+ color="success"
232
+ size="sm"
233
+ :is-loading="isLoading"
234
+ is-rounded
235
+ :is-disabled="values.isGenerate == true"
236
+ @click="generate"
237
+ />
68
238
  </NeonForm>
69
239
  </OfficeTab>
240
+
241
+ <OfficeTab
242
+ v-if="!isNew"
243
+ v-slot="{ isTouched }"
244
+ icon="business-time"
245
+ title="Jadwal Shift"
246
+ handle="shiftStaff"
247
+ >
248
+ <OfficeCollectionRelated
249
+ scope="shiftStaff"
250
+ definition="neu:personalia:shiftStaff"
251
+ title="Jadwal Shift"
252
+ description="Jadwal shift karyawan."
253
+ :query="
254
+ Query.define({
255
+ filter: [
256
+ {
257
+ shiftingStaffId: { $in: values.shiftingStaffIds },
258
+ },
259
+ {
260
+ startedAt: { $gte: values.startedAt },
261
+ endedAt: { $lte: values.endedAt },
262
+ },
263
+ ],
264
+ limit: 10,
265
+ })
266
+ "
267
+ :columns="[
268
+ 'titleShift',
269
+ 'shiftingStaff',
270
+ 'branches',
271
+ 'typeShift',
272
+ 'startedAt',
273
+ 'hourStartedTime',
274
+ 'hourEndedTime',
275
+ 'attendShift',
276
+ 'backHomeShift',
277
+ 'totalTime',
278
+ ]"
279
+ :is-ready="isReady && isTouched"
280
+ :excludes="['create']"
281
+ />
282
+ </OfficeTab>
70
283
  </OfficeTabs>
71
284
  </NeonSingle>
72
285
  </template>
@@ -1,73 +1,24 @@
1
1
  <script setup lang="ts">
2
2
  import { NeonCollection, useCollection } from '@neon.id/context'
3
- import { OfficeCollectionTable } from '@neon.id/office'
4
- import type { NCalendar } from '@neon.id/display'
5
3
  import {
4
+ OfficeCollectionTable,
6
5
  OfficeCollectionCalendar,
7
- OfficeTabs,
8
- OfficeTab,
9
6
  } from '@neon.id/office'
10
7
  import type {
11
- TPersonaliaShiftModel,
12
8
  Schema,
9
+ TPersonaliaShiftModel,
13
10
  } from '@neutron.co.id/personalia-models'
14
11
 
15
- defineOptions({
16
- name: 'ShiftCollection',
17
- })
18
-
19
- const { resource, display, items, userQuery } = useCollection<
20
- Schema.Shift,
21
- TPersonaliaShiftModel
22
- >()
23
- const props = defineProps({
24
- expPresentField: {
25
- type: String,
26
- default: 'expPresent',
27
- },
28
- endedAtField: {
29
- type: String,
30
- default: 'endedAt',
31
- },
32
- period: {
33
- type: Object as any,
34
- default: () => ({
35
- expPresent: new Date(),
36
- endedAt: new Date(),
37
- }),
38
- },
39
- })
12
+ defineOptions({ name: 'ShiftCollection' })
40
13
 
41
- const emit = defineEmits<{
42
- (e: 'update:period', period: NCalendar.PeriodData): void
43
- }>()
44
-
45
- function onCalendarPeriodUpdate(period: NCalendar.PeriodData) {
46
- console.log('calendar', period)
47
- emit('update:period', period)
48
- }
14
+ const { userQuery } = useCollection<Schema.Shift, TPersonaliaShiftModel>()
49
15
  </script>
50
16
 
51
17
  <template>
52
- <OfficeTabs>
53
- <OfficeTab handle="shift" icon="circle-info" title="Kehadiran">
54
- <NeonCollection class="neu-shift-collection">
55
- <OfficeCollectionTable v-if="userQuery.display === 'table'" />
56
-
57
- <OfficeCollectionCalendar
58
- v-else-if="userQuery.display === 'calendar' && period.expPresent"
59
- :default-all-day="false"
60
- :views="['month']"
61
- :period="period"
62
- @update:period="onCalendarPeriodUpdate"
63
- />
64
- </NeonCollection>
65
- </OfficeTab>
66
- </OfficeTabs>
18
+ <NeonCollection class="neu-shift-collection">
19
+ <OfficeCollectionTable v-if="userQuery.display === 'table'" />
20
+ <OfficeCollectionCalendar v-else-if="userQuery.display === 'calendar'" />
21
+ </NeonCollection>
67
22
  </template>
68
23
 
69
- <style scoped>
70
- .neu-shift-collection {
71
- --neon-calendar-min-height: auto;
72
- }
73
- </style>
24
+ <style scoped></style>