@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
@@ -0,0 +1 @@
1
+ export * from './period.use';
@@ -0,0 +1 @@
1
+ export * from "./period.use.mjs";
@@ -0,0 +1,9 @@
1
+ import { Query } from '@neon.id/query';
2
+ export declare function usePeriod(): {
3
+ query: import("vue").ComputedRef<Query>;
4
+ isLoading: import("vue").Ref<boolean>;
5
+ date: import("vue").Ref<Date>;
6
+ header: import("vue").ComputedRef<string>;
7
+ startedAt: import("vue").ComputedRef<Date | undefined>;
8
+ endedAt: import("vue").ComputedRef<Date | undefined>;
9
+ };
@@ -0,0 +1,40 @@
1
+ import { DateUtil } from "@neon.id/utils/date";
2
+ import { PeriodUtil } from "@neon.id/utils/period";
3
+ import { Query } from "@neon.id/query";
4
+ import { computed, ref } from "vue";
5
+ import { useOperasional } from "../../../@package/@office/common";
6
+ export function usePeriod() {
7
+ const { staff } = useOperasional();
8
+ const isLoading = ref(false);
9
+ const date = ref(/* @__PURE__ */ new Date());
10
+ const startedAt = computed(() => DateUtil.startOfWeek(date.value));
11
+ const endedAt = computed(() => DateUtil.endOfWeek(date.value));
12
+ const header = computed(() => {
13
+ const options = { pattern: "eeee, dd MMMM yyyy" };
14
+ const start = DateUtil.format(startedAt.value, options);
15
+ const end = DateUtil.format(endedAt.value, options);
16
+ return `Sesi Tanggal: ${start} - ${end}`;
17
+ });
18
+ const query = computed(() => {
19
+ const period = PeriodUtil.period(
20
+ "startedAt",
21
+ startedAt.value,
22
+ endedAt.value
23
+ );
24
+ const filter = {
25
+ ...period,
26
+ shiftingStaffId: staff.value?.id
27
+ };
28
+ return Query.define({
29
+ filter
30
+ });
31
+ });
32
+ return {
33
+ query,
34
+ isLoading,
35
+ date,
36
+ header,
37
+ startedAt,
38
+ endedAt
39
+ };
40
+ }
@@ -0,0 +1,5 @@
1
+ import { CoreInterface, type TCoreInterfaceSelector } from '@neon.id/context/helpers';
2
+ export type TCommonFeature = string;
3
+ export interface TOperasionalCommonInterfaceOptions extends TCoreInterfaceSelector<TCommonFeature> {
4
+ }
5
+ export declare const config: CoreInterface<string>;
@@ -0,0 +1,16 @@
1
+ import {
2
+ CoreInterface
3
+ } from "@neon.id/context/helpers";
4
+ export const config = CoreInterface.define({
5
+ components: {
6
+ common: [],
7
+ features: {}
8
+ },
9
+ imports: {
10
+ common: [
11
+ // Composables
12
+ "usePeriod"
13
+ ],
14
+ features: {}
15
+ }
16
+ });
@@ -0,0 +1 @@
1
+ export * from './composables';
@@ -0,0 +1 @@
1
+ export * from "./composables/index.mjs";
@@ -119,5 +119,8 @@ function onUpdate(newValue: Date) {
119
119
  .vc-time-icon {
120
120
  @apply hidden;
121
121
  }
122
+ .vc-time-header {
123
+ @apply hidden;
124
+ }
122
125
  }
123
126
  </style>
@@ -0,0 +1,67 @@
1
+ <script setup lang="ts">
2
+ import { NeonButton } from '@neon.id/interfaces'
3
+ import { DateUtil } from '@neon.id/utils/date'
4
+ import type { NCalendar } from '@neon.id/display'
5
+ import { usePeriod } from '../../../@common'
6
+ import { computed } from 'vue'
7
+
8
+ const emit = defineEmits<{
9
+ (e: 'update:period', period: Partial<NCalendar.PeriodData>): void
10
+ (e: 'update:date', period: Partial<NCalendar.PeriodData>): void
11
+ (e: 'sync'): void
12
+ }>()
13
+
14
+ const { date, startedAt, endedAt } = usePeriod()
15
+
16
+ const dates = computed(() => {
17
+ return { startedAt: startedAt.value, endedAt: endedAt.value }
18
+ })
19
+
20
+ thisWeek()
21
+
22
+ function thisWeek() {
23
+ date.value = DateUtil.startOfWeek(new Date()) || new Date()
24
+ emit('update:date', dates.value)
25
+ }
26
+
27
+ function prevWeek() {
28
+ date.value = DateUtil.substract(date.value, { weeks: 1 }) || date.value
29
+ emit('update:date', dates.value)
30
+ }
31
+
32
+ function nextWeek() {
33
+ date.value = DateUtil.add(date.value, { weeks: 1 }) || date.value
34
+ emit('update:date', dates.value)
35
+ }
36
+
37
+ defineOptions({ name: 'PeriodButton' })
38
+ </script>
39
+ <template>
40
+ <div class="period-button">
41
+ <NeonButton
42
+ icon-left="chevron-left"
43
+ size="xs"
44
+ color="dark"
45
+ @click="prevWeek"
46
+ />
47
+ <NeonButton
48
+ label="Saat Ini"
49
+ icon-left="calendar"
50
+ size="xs"
51
+ color="dark"
52
+ @click="thisWeek"
53
+ />
54
+ <NeonButton
55
+ icon-right="chevron-right"
56
+ size="xs"
57
+ color="dark"
58
+ @click="nextWeek"
59
+ />
60
+ </div>
61
+ </template>
62
+
63
+ <style scoped>
64
+ .period-button {
65
+ @apply flex flex-row gap-2;
66
+ }
67
+ </style>
@@ -0,0 +1 @@
1
+ export { default as PeriodButton } from './PeriodButton.vue';
@@ -0,0 +1 @@
1
+ export { default as PeriodButton } from "./PeriodButton.vue";
@@ -2,3 +2,4 @@ export * from './OperasionalIdentitas';
2
2
  export * from './NeonTime';
3
3
  export * from './providers';
4
4
  export * from './OfficeSingleSync';
5
+ export * from './PeriodButton';
@@ -2,3 +2,4 @@ export * from "./OperasionalIdentitas/index.mjs";
2
2
  export * from "./NeonTime/index.mjs";
3
3
  export * from "./providers/index.mjs";
4
4
  export * from "./OfficeSingleSync/index.mjs";
5
+ export * from "./PeriodButton/index.mjs";
@@ -1,5 +1,7 @@
1
1
  import 'dayjs/esm/locale/en.js';
2
2
  import 'dayjs/esm/locale/id.js';
3
3
  export declare class DateUtil {
4
+ static formatTz: any;
5
+ static startOf: any;
4
6
  static get day(): any;
5
7
  }
@@ -11,6 +11,8 @@ dayjs.extend(advancedFormat);
11
11
  dayjs.extend(isoWeek);
12
12
  dayjs.locale("id");
13
13
  export class DateUtil {
14
+ static formatTz;
15
+ static startOf;
14
16
  static get day() {
15
17
  return dayjs;
16
18
  }
@@ -3,7 +3,7 @@ import {
3
3
  } from "@neon.id/context/helpers";
4
4
  export const config = OfficeInterfaces.define({
5
5
  components: {
6
- common: ["OfficeSingleSync"],
6
+ common: ["OfficeSingleSync", "PeriodButton"],
7
7
  models: {
8
8
  personalia: [
9
9
  // Attendance
@@ -12,6 +12,7 @@ export const config = OfficeInterfaces.define({
12
12
  "AttendanceStaff",
13
13
  "AttendanceManager",
14
14
  "AttendanceSupervisor",
15
+ "AttendanceDelegate",
15
16
  // Check In
16
17
  "CheckInCollection",
17
18
  "CheckInSingle",
@@ -47,11 +48,22 @@ export const config = OfficeInterfaces.define({
47
48
  // Responsibility Type
48
49
  "ResponsibilityTypeCollection",
49
50
  "ResponsibilityTypeSingle",
50
- //Shift
51
+ // Shift
51
52
  "ShiftCollection",
52
53
  "ShiftSingle",
53
- "ShiftStaff",
54
54
  "ShiftAdministrator",
55
+ "ShiftSupervisor",
56
+ // Shift Type
57
+ "ShiftTypeCollection",
58
+ "ShiftTypeSingle",
59
+ // Shift Staff
60
+ "ShiftStaffCollection",
61
+ "ShiftStaffCollectionStaff",
62
+ "ShiftStaffCollectionBranch",
63
+ "ShiftStaffSingleBranch",
64
+ "ShiftStaffSingle",
65
+ "ShiftStaffWrapper",
66
+ "ShiftStaffDisplay",
55
67
  // Situation
56
68
  "SituationCollection",
57
69
  "SituationSingle",
@@ -54,7 +54,6 @@ function transformItem(item: any) {
54
54
  }
55
55
 
56
56
  function onCalendarPeriodUpdate(period: NCalendar.PeriodData) {
57
- console.log('calendar', period)
58
57
  emit('update:period', period)
59
58
  }
60
59
  </script>
@@ -0,0 +1,286 @@
1
+ <script setup lang="ts">
2
+ import { GraphUtil, NeonSingle, useSingle } from '@neon.id/context'
3
+ import { NeonCheck, NeonField, NeonForm } from '@neon.id/form'
4
+ import {
5
+ NeonAlert,
6
+ NeonButton,
7
+ NeonDivider,
8
+ useToastStore,
9
+ NeonCopy,
10
+ } from '@neon.id/interfaces'
11
+ import { OfficeRelation, OfficeTab, OfficeTabs } from '@neon.id/office'
12
+ import { Query } from '@neon.id/query'
13
+ import { computed, ref, watch } from 'vue'
14
+ import { PromiseUtil } from '@neon.id/utils/promise'
15
+ import {
16
+ AttendanceModel,
17
+ type TPersonaliaAttendanceModel,
18
+ type Schema,
19
+ } from '@neutron.co.id/personalia-models'
20
+ import { DateUtil } from '../../../common/utils/util.date'
21
+ import { NeonTime, useOperasional } from '../../../common'
22
+ import { AttendanceNoteTab } from './sections'
23
+ import { useClientHandle } from '@urql/vue'
24
+
25
+ const {
26
+ fields,
27
+ id,
28
+ initialValues,
29
+ values,
30
+ isLoading,
31
+ isChanged,
32
+ isReady,
33
+ isMain,
34
+ isNew,
35
+ saveOne,
36
+ discardChanges,
37
+ syncOne,
38
+ executeOne,
39
+ } = useSingle<Schema.Attendance, TPersonaliaAttendanceModel>()
40
+
41
+ const key = ref(0)
42
+ const responseState = ref()
43
+ const toast = useToastStore()
44
+
45
+ const diff = computed(() => {
46
+ return DateUtil.day(values.value.endedAt).diff(values.value.startedAt)
47
+ })
48
+
49
+ const duration = computed(() => {
50
+ if (isNaN(diff.value)) return '-'
51
+ const duration = DateUtil.day.duration(diff.value)
52
+ return duration.format('HH [jam] mm [menit]')
53
+ })
54
+
55
+ function setDefaultSchedule() {
56
+ const today = DateUtil.day()
57
+ const startedAt = today.second(0).millisecond(0)
58
+ const endedAt = startedAt.add(90, 'minute')
59
+
60
+ key.value++
61
+ }
62
+
63
+ function onStartedAtUpdate(date: any) {
64
+ if (!date) return
65
+
66
+ const currentEndedendedAt = DateUtil.day(values.value.endedAt)
67
+ let startedAt = DateUtil.day(date)
68
+ let endedAt = DateUtil.day(date)
69
+
70
+ startedAt = startedAt.second(0).millisecond(0)
71
+ endedAt = endedAt
72
+ .hour(currentEndedendedAt.hour())
73
+ .minute(currentEndedendedAt.minute())
74
+ .second(0)
75
+ .millisecond(0)
76
+
77
+ values.value.startedAt = startedAt.toISOString()
78
+ values.value.endedAt = endedAt.toISOString()
79
+ conflictAtt.value = false
80
+ }
81
+
82
+ // OTHER
83
+
84
+ const { staff } = useOperasional()
85
+ const staffId = staff.value?.id || ''
86
+
87
+ watch(isNew, setDefaultValues, { immediate: true })
88
+
89
+ async function setDefaultValues() {
90
+ if (!isNew.value) return
91
+ await PromiseUtil.wait(500)
92
+
93
+ const defaultValues = {
94
+ submitStaffId: staffId,
95
+ submitStaff: staff.value,
96
+ } satisfies Schema.Attendance
97
+
98
+ values.value.submitStaffId = defaultValues.submitStaffId
99
+ values.value.submitStaff = defaultValues.submitStaff
100
+ }
101
+
102
+ const submitAbsensi = async () => {
103
+ await executeOne('submitAttendance', { attendanceId: id.value })
104
+ await syncOne()
105
+ }
106
+
107
+ const changeAbsensi = async () => {
108
+ await executeOne('changeAttendance', { attendanceId: id.value })
109
+ await syncOne()
110
+ }
111
+
112
+ const conflictAtt = ref(false)
113
+
114
+ async function conflictAttendance() {
115
+ const resp = await executeOne('checkAttendance', {
116
+ staffId: staff.value?.id,
117
+ startedAt: values.value.startedAt,
118
+ })
119
+ const countAtt = resp.data.executeAttendance.output.countAttendance
120
+ if (values.value.startedAt) {
121
+ if (countAtt > 1) {
122
+ conflictAtt.value = true
123
+ } else {
124
+ await submitAbsensi()
125
+ await syncOne()
126
+ conflictAtt.value = false
127
+ }
128
+ } else {
129
+ conflictAtt.value = true
130
+ }
131
+ }
132
+
133
+ const staffOptions = computed(() => {
134
+ return {
135
+ filter: [
136
+ {
137
+ handle: '_id',
138
+ operator: 'nin',
139
+ value: staff.value?.id,
140
+ },
141
+ ],
142
+ }
143
+ })
144
+
145
+ //Generate Attendance
146
+ const { client } = useClientHandle()
147
+
148
+ function getNotified() {
149
+ if (responseState.value === 'attendanceGenerated') {
150
+ toast.push({
151
+ id: 'generate:attendance',
152
+ content: 'Successfully generated attendance.',
153
+ color: 'success',
154
+ })
155
+ }
156
+ }
157
+
158
+ async function generateAttendance() {
159
+ const responseGenerateAttendance = await client
160
+ .mutation(GraphUtil.executeOne(AttendanceModel, {}), {
161
+ action: 'generateAttendance',
162
+ input: {
163
+ attendanceId: values.value.id,
164
+ // Attendance input.
165
+ status: values.value.status,
166
+ submitStaffId: values.value.submitStaffId,
167
+ type: values.value.type,
168
+ decideStaffId: values.value.decideStaffId,
169
+ delegateStaffIds: values.value.delegateStaffIds,
170
+ monitoringStaffIds: values.value.monitoringStaffIds,
171
+ notes: values.value.notes,
172
+ submittedAt: values.value.submittedAt,
173
+ startedAt: values.value.startedAt,
174
+ endedAt: values.value.endedAt,
175
+ },
176
+ })
177
+ .toPromise()
178
+
179
+ const wrapper = responseGenerateAttendance.data?.executeAttendance
180
+ responseState.value = wrapper?.info?.state
181
+ }
182
+
183
+ async function generate() {
184
+ await generateAttendance()
185
+ await getNotified()
186
+ await syncOne()
187
+ }
188
+ </script>
189
+
190
+ <template>
191
+ <NeonSingle class="neu-attendance-single">
192
+ <OfficeTabs :use-url="isMain">
193
+ <OfficeTab handle="info" icon="circle-info" title="Info">
194
+ <NeonForm
195
+ handle="info"
196
+ :initial-values="initialValues"
197
+ :is-loading="isLoading"
198
+ :is-changed="isChanged"
199
+ use-unsaved
200
+ @cancel="discardChanges"
201
+ @submit="saveOne"
202
+ >
203
+ <OfficeRelation
204
+ v-if="
205
+ values.type == 'leave' ||
206
+ values.type == 'dayOff' ||
207
+ values.type == 'sick' ||
208
+ values.type == 'permission'
209
+ "
210
+ v-model="values"
211
+ :field="fields.delegateStaffs"
212
+ :is-disabled="
213
+ values.status == 'notApproved' ||
214
+ values.status == 'approved' ||
215
+ values.status == 'rejected'
216
+ "
217
+ />
218
+ <NeonField
219
+ :key="key"
220
+ :model-value="values.startedAt"
221
+ v-bind="{
222
+ handle: 'startedAt',
223
+ name: 'Tanggal',
224
+ type: 'date',
225
+ input: 'date2',
226
+ options: {
227
+ note: 'Tanggal absensi.',
228
+ },
229
+ }"
230
+ :is-disabled="
231
+ values.status == 'notApproved' ||
232
+ values.status == 'approved' ||
233
+ values.status == 'rejected'
234
+ "
235
+ @update:model-value="onStartedAtUpdate"
236
+ />
237
+ <OfficeRelation
238
+ v-model="values"
239
+ :field="fields.submitStaff"
240
+ is-disabled
241
+ />
242
+ <OfficeRelation
243
+ v-model="values"
244
+ :field="fields.decideStaff"
245
+ :query="Query.define(staffOptions)"
246
+ :is-disabled="
247
+ values.status == 'notApproved' ||
248
+ values.status == 'approved' ||
249
+ values.status == 'rejected'
250
+ "
251
+ />
252
+ <!-- <OfficeRelation
253
+ v-if="
254
+ values.type == 'leave' ||
255
+ values.type == 'sick' ||
256
+ values.type == 'dayOff' ||
257
+ values.type == 'permission'
258
+ "
259
+ v-model="values"
260
+ :field="fields.monitoringStaffs"
261
+ :is-disabled="
262
+ values.status == 'approved' || values.status == 'rejected'
263
+ "
264
+ /> -->
265
+ <NeonField
266
+ v-if="
267
+ values.type == 'leave' ||
268
+ values.type == 'dayOff' ||
269
+ values.type == 'sick' ||
270
+ values.type == 'permission'
271
+ "
272
+ v-model="values.delegateNotes"
273
+ v-bind="fields.delegateNotes"
274
+ />
275
+ </NeonForm>
276
+ </OfficeTab>
277
+ <!-- <AttendanceNoteTab /> -->
278
+ </OfficeTabs>
279
+ </NeonSingle>
280
+ </template>
281
+
282
+ <style scoped>
283
+ .neu-attendance-single {
284
+ @apply block;
285
+ }
286
+ </style>
@@ -1,11 +1,12 @@
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 {
5
5
  NeonAlert,
6
6
  NeonButton,
7
7
  NeonDivider,
8
8
  useToastStore,
9
+ NeonCopy,
9
10
  } from '@neon.id/interfaces'
10
11
  import { OfficeRelation, OfficeTab, OfficeTabs } from '@neon.id/office'
11
12
  import { Query } from '@neon.id/query'
@@ -18,6 +19,7 @@ import {
18
19
  } from '@neutron.co.id/personalia-models'
19
20
  import { DateUtil } from '../../../common/utils/util.date'
20
21
  import { NeonTime, useOperasional } from '../../../common'
22
+ import { AttendanceNoteTab } from './sections'
21
23
  import { useClientHandle } from '@urql/vue'
22
24
 
23
25
  const {
@@ -164,10 +166,13 @@ async function generateAttendance() {
164
166
  submitStaffId: values.value.submitStaffId,
165
167
  type: values.value.type,
166
168
  decideStaffId: values.value.decideStaffId,
169
+ delegateStaffIds: values.value.delegateStaffIds,
170
+ monitoringStaffIds: values.value.monitoringStaffIds,
167
171
  notes: values.value.notes,
168
172
  submittedAt: values.value.submittedAt,
169
173
  startedAt: values.value.startedAt,
170
174
  endedAt: values.value.endedAt,
175
+ delegateNotes: values.value.delegateNotes,
171
176
  },
172
177
  })
173
178
  .toPromise()
@@ -176,13 +181,16 @@ async function generateAttendance() {
176
181
  responseState.value = wrapper?.info?.state
177
182
  }
178
183
 
179
- console.log('decideStaffId', values.value.decideStaffId)
180
-
181
184
  async function generate() {
182
185
  await generateAttendance()
183
186
  await getNotified()
184
187
  await syncOne()
185
188
  }
189
+
190
+ //copy link for catatan
191
+ const copy = ref({
192
+ copyDelegate: `${window.location.origin}/penugasan/staff-attendances/?peek=neu:personalia:attendance:${id.value}:single-staff-view:s`,
193
+ })
186
194
  </script>
187
195
 
188
196
  <template>
@@ -288,9 +296,16 @@ async function generate() {
288
296
  values.status == 'rejected'
289
297
  "
290
298
  />
291
-
299
+ <!-- <div class="flex items-right">
300
+ <div class="flex-grow">
301
+ <NeonFields class="flex-1"> -->
292
302
  <OfficeRelation
293
- v-if="values.type == 'leave'"
303
+ v-if="
304
+ values.type == 'leave' ||
305
+ values.type == 'dayOff' ||
306
+ values.type == 'sick' ||
307
+ values.type == 'permission'
308
+ "
294
309
  v-model="values"
295
310
  :field="fields.delegateStaffs"
296
311
  :is-disabled="
@@ -299,12 +314,68 @@ async function generate() {
299
314
  values.status == 'rejected'
300
315
  "
301
316
  />
317
+ <!-- </NeonFields>
318
+ </div> -->
319
+ <!-- <div class="ml-2 flex items-end pb-1">
320
+ <NeonCopy
321
+ v-if="
322
+ values.type == 'leave' ||
323
+ values.type == 'dayOff' ||
324
+ values.type == 'sick' ||
325
+ values.type == 'permission' ||
326
+ values.isNotes == true
327
+ "
328
+ :size="'sm'"
329
+ :value="copy.copyDelegate"
330
+ />
331
+ </div>
332
+ </div> -->
333
+ <!-- <NeonField
334
+ v-if="
335
+ values.type == 'leave' ||
336
+ values.type == 'dayOff' ||
337
+ values.type == 'sick' ||
338
+ values.type == 'permission'
339
+ "
340
+ v-model="values.isNotes"
341
+ v-bind="fields.isNotes"
342
+ :is-disabled="
343
+ values.status == 'notApproved' ||
344
+ values.status == 'rejected' ||
345
+ values.status == 'approved'
346
+ "
347
+ > -->
348
+ <!-- <template #input>
349
+ <NeonCheck
350
+ v-if="
351
+ values.type == 'leave' ||
352
+ values.type == 'dayOff' ||
353
+ values.type == 'sick' ||
354
+ values.type == 'permission'
355
+ "
356
+ v-model="values.isNotes"
357
+ label="Catatan"
358
+ class="mt-2"
359
+ :is-disabled="values.status == 'approved'"
360
+ />
361
+ </template> -->
362
+ <!-- </NeonField> -->
302
363
 
303
364
  <NeonField
304
365
  v-if="isNew || isReady"
305
366
  v-model="values.notes"
306
367
  v-bind="fields.notes"
307
368
  />
369
+ <NeonField
370
+ v-if="
371
+ values.type == 'leave' ||
372
+ values.type == 'dayOff' ||
373
+ values.type == 'sick' ||
374
+ values.type == 'permission'
375
+ "
376
+ v-model="values.delegateNotes"
377
+ v-bind="fields.delegateNotes"
378
+ />
308
379
 
309
380
  <NeonDivider v-if="values.type" is-dashed label="Keterangan" />
310
381
 
@@ -537,6 +608,7 @@ async function generate() {
537
608
  </div>
538
609
  </NeonForm>
539
610
  </OfficeTab>
611
+ <!-- <AttendanceNoteTab /> -->
540
612
  </OfficeTabs>
541
613
  </NeonSingle>
542
614
  </template>