@neutron.co.id/operasional-interfaces 1.16.0-beta.3 → 1.16.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.
- package/build/@mock/mock.interfaces.d.ts +1 -0
- package/build/@office/common/Import/ImportForm.vue +183 -0
- package/build/@office/common/NeutronImportButton/NeutronImportButton.vue +28 -0
- package/build/@office/common/NeutronImportButton/index.d.ts +1 -0
- package/build/@office/common/NeutronImportButton/index.mjs +1 -0
- package/build/@office/common/index.d.ts +1 -0
- package/build/@office/common/index.mjs +1 -0
- package/build/@office/common/providers/import/index.d.ts +1 -0
- package/build/@office/common/providers/import/index.mjs +1 -0
- package/build/@office/common/providers/import/useImportShift.d.ts +7 -0
- package/build/@office/common/providers/import/useImportShift.mjs +137 -0
- package/build/@office/common/providers/index.d.ts +3 -0
- package/build/@office/common/providers/index.mjs +3 -0
- package/build/@office/common/providers/office/index.d.ts +1 -0
- package/build/@office/common/providers/office/index.mjs +1 -0
- package/build/@office/common/providers/office/office.store.d.ts +7 -0
- package/build/@office/common/providers/office/office.store.mjs +11 -0
- package/build/@office/config.mjs +2 -1
- package/build/@office/models/personalia/shiftStaff/ShiftStaffImport.vue +159 -0
- package/build/@office/models/personalia/shiftStaff/ShiftStaffWrapper/ShiftStaffDisplay.vue +4 -1
- package/build/@office/models/personalia/shiftStaff/index.d.ts +1 -0
- package/build/@office/models/personalia/shiftStaff/index.mjs +1 -0
- package/build/@office/models/personalia/shiftType/ShiftTypeSingle/ShiftTypeSingle.vue +1 -0
- package/build/@office/models/personalia/staff/StaffSingle/StaffSingle.vue +2 -2
- package/build/@package/@office/common/Import/ImportForm.vue.d.ts +78 -0
- package/build/@package/@office/common/NeutronImportButton/NeutronImportButton.vue.d.ts +2 -0
- package/build/@package/@office/common/NeutronImportButton/index.d.ts +1 -0
- package/build/@package/@office/common/index.d.ts +1 -0
- package/build/@package/@office/common/providers/import/index.d.ts +1 -0
- package/build/@package/@office/common/providers/import/useImportShift.d.ts +7 -0
- package/build/@package/@office/common/providers/index.d.ts +3 -0
- package/build/@package/@office/common/providers/office/index.d.ts +1 -0
- package/build/@package/@office/common/providers/office/office.store.d.ts +7 -0
- package/build/@package/@office/models/personalia/shiftStaff/ShiftStaffImport.vue.d.ts +2 -0
- package/build/@package/@office/models/personalia/shiftStaff/index.d.ts +1 -0
- package/build/mock/index.cjs +1970 -632
- package/build/mock/index.mjs +1971 -633
- package/build/mock/style.css +65 -7
- package/build/module.json +1 -1
- package/build/nuxt.d.mts +2 -0
- package/build/nuxt.d.ts +2 -0
- package/build/nuxt.json +1 -1
- package/build/nuxt.mjs +4 -2
- package/build/runtime/plugins/plugin.operasional.js +8 -1
- package/package.json +6 -2
|
@@ -4,6 +4,7 @@ import '@neon.id/discovery/style.css';
|
|
|
4
4
|
import '@neon.id/field/style.css';
|
|
5
5
|
import '@neon.id/form/style.css';
|
|
6
6
|
import '@neon.id/interfaces/style.css';
|
|
7
|
+
import '@neon.id/media/style.css';
|
|
7
8
|
import '@neon.id/editor/style.css';
|
|
8
9
|
import '@neon.id/relation/style.css';
|
|
9
10
|
import '@neon.id/display/style.css';
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { NeonAlert, NeonButton, NeonPart, useToast } from '@neon.id/interfaces'
|
|
3
|
+
import {
|
|
4
|
+
type NFileType,
|
|
5
|
+
type NFileUpload,
|
|
6
|
+
NeonFile,
|
|
7
|
+
NeonFileDrop,
|
|
8
|
+
} from '@neon.id/media'
|
|
9
|
+
import type { Mightbe } from '@neon.id/types'
|
|
10
|
+
import { StringUtil } from '@neon.id/utils'
|
|
11
|
+
import { useTimeAgo } from '@vueuse/core'
|
|
12
|
+
import { computed, ref, defineProps, defineEmits, type PropType } from 'vue'
|
|
13
|
+
|
|
14
|
+
defineOptions({ name: 'ImportForm' })
|
|
15
|
+
|
|
16
|
+
// Define props
|
|
17
|
+
defineProps({
|
|
18
|
+
title: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: 'Import Shift',
|
|
21
|
+
},
|
|
22
|
+
description: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'Download template CSV lalu masukkan data shift, Kemudian import',
|
|
25
|
+
},
|
|
26
|
+
fileTypes: {
|
|
27
|
+
type: Array as PropType<NFileType[]>,
|
|
28
|
+
default: () => [],
|
|
29
|
+
},
|
|
30
|
+
icon: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'duotone:file-import',
|
|
33
|
+
},
|
|
34
|
+
downloadLabel: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'Unduh Template',
|
|
37
|
+
},
|
|
38
|
+
uploadLabel: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'Upload',
|
|
41
|
+
},
|
|
42
|
+
importLabel: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: 'Import',
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
// Emit events
|
|
49
|
+
const emit = defineEmits(['file-uploaded', 'file-cancelled', 'imported'])
|
|
50
|
+
|
|
51
|
+
const isUploading = ref(false)
|
|
52
|
+
const willUpload = ref(false)
|
|
53
|
+
const upload = ref<NFileUpload | null>(null)
|
|
54
|
+
|
|
55
|
+
const uploaded = computed(() => {
|
|
56
|
+
return null
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
function onDrop(dropped: File[] | null) {
|
|
60
|
+
if (!dropped) return
|
|
61
|
+
|
|
62
|
+
willUpload.value = false
|
|
63
|
+
|
|
64
|
+
const file = dropped[0]
|
|
65
|
+
upload.value = {
|
|
66
|
+
file,
|
|
67
|
+
progress: 0,
|
|
68
|
+
isUploaded: false,
|
|
69
|
+
isUploading: false,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
emit('file-uploaded', file)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function onCancel() {
|
|
76
|
+
upload.value = null
|
|
77
|
+
emit('file-cancelled')
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function timeAgo(date: Mightbe<string>, word: string) {
|
|
81
|
+
if (!date) return `Never ${word}`
|
|
82
|
+
const time = useTimeAgo(date, {})
|
|
83
|
+
return `${StringUtil.capital(word)} ${time.value?.toLowerCase()}`
|
|
84
|
+
}
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<template>
|
|
88
|
+
<NeonPart :icon="icon" :title="title" use-wrapper is-expanded>
|
|
89
|
+
<NeonAlert
|
|
90
|
+
:icon="icon"
|
|
91
|
+
:title="title"
|
|
92
|
+
:description="description"
|
|
93
|
+
color="base"
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
<div class="button-cols">
|
|
97
|
+
<div class="button-row">
|
|
98
|
+
<NeonButton
|
|
99
|
+
:icon="icon"
|
|
100
|
+
:label="downloadLabel"
|
|
101
|
+
color="base"
|
|
102
|
+
size="sm"
|
|
103
|
+
is-rounded
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<NeonFileDrop
|
|
109
|
+
v-if="(!upload && !uploaded) || willUpload"
|
|
110
|
+
:types="fileTypes"
|
|
111
|
+
@drop="onDrop"
|
|
112
|
+
/>
|
|
113
|
+
|
|
114
|
+
<div v-else class="upload-items">
|
|
115
|
+
<NeonFile
|
|
116
|
+
v-if="upload"
|
|
117
|
+
:file="upload.file"
|
|
118
|
+
:progress="upload.progress"
|
|
119
|
+
:is-uploading="upload.isUploading || isUploading"
|
|
120
|
+
:is-uploaded="upload.isUploaded"
|
|
121
|
+
>
|
|
122
|
+
<template #actions>
|
|
123
|
+
<NeonButton
|
|
124
|
+
v-if="!upload.isUploaded"
|
|
125
|
+
size="xs"
|
|
126
|
+
icon-left="times"
|
|
127
|
+
display="fill"
|
|
128
|
+
color="base"
|
|
129
|
+
is-squared
|
|
130
|
+
@click="onCancel"
|
|
131
|
+
/>
|
|
132
|
+
</template>
|
|
133
|
+
</NeonFile>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<div class="button-cols">
|
|
137
|
+
<div class="button-row">
|
|
138
|
+
<NeonButton
|
|
139
|
+
:icon="icon"
|
|
140
|
+
:label="uploadLabel"
|
|
141
|
+
color="base"
|
|
142
|
+
size="sm"
|
|
143
|
+
is-rounded
|
|
144
|
+
/>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<div class="button-end">
|
|
148
|
+
<NeonButton
|
|
149
|
+
:icon="icon"
|
|
150
|
+
:label="importLabel"
|
|
151
|
+
color="dark"
|
|
152
|
+
size="md"
|
|
153
|
+
is-rounded
|
|
154
|
+
@click="$emit('imported')"
|
|
155
|
+
/>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</NeonPart>
|
|
159
|
+
</template>
|
|
160
|
+
|
|
161
|
+
<style scoped>
|
|
162
|
+
.button-cols {
|
|
163
|
+
@apply flex flex-col space-y-2 space-x-2 space-x-reverse;
|
|
164
|
+
@apply sm:flex-row sm:items-center;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.button-row {
|
|
168
|
+
@apply flex-1 flex items-center space-x-2;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.time-ago {
|
|
172
|
+
@apply font-medium text-sm text-fg-subdued leading-none;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.button-end {
|
|
176
|
+
@apply flex-1 flex sm:justify-end space-x-2;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.warning-label {
|
|
180
|
+
@apply font-medium text-sm text-fg-subdued leading-none;
|
|
181
|
+
@apply text-yellow-600;
|
|
182
|
+
}
|
|
183
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { NeonButton } from '@neon.id/interfaces'
|
|
3
|
+
import { useRouter } from 'vue-router'
|
|
4
|
+
|
|
5
|
+
defineOptions({ name: 'NeutronImportButton' })
|
|
6
|
+
|
|
7
|
+
const router = useRouter()
|
|
8
|
+
|
|
9
|
+
async function redirectImportGrading() {
|
|
10
|
+
router.push({ path: '/jadwal/import' })
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div id="grading-actions">
|
|
16
|
+
<NeonButton
|
|
17
|
+
color="info"
|
|
18
|
+
size="sm"
|
|
19
|
+
is-rounded
|
|
20
|
+
icon-left="duotone:file-import"
|
|
21
|
+
@click="redirectImportGrading"
|
|
22
|
+
>
|
|
23
|
+
Import Shift
|
|
24
|
+
</NeonButton>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<style scoped></style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NeutronImportButton } from './NeutronImportButton.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NeutronImportButton } from "./NeutronImportButton.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useImportShift';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useImportShift.mjs";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NFileUpload } from '@neon.id/media';
|
|
2
|
+
import type { Mightbe } from '@neon.id/types';
|
|
3
|
+
export declare function useImportShift(): {
|
|
4
|
+
loadings: import("vue").Ref<Set<string> & Omit<Set<string>, keyof Set<any>>>;
|
|
5
|
+
onDownloadTemplateCsvFile: () => Promise<void>;
|
|
6
|
+
onUploadCsvFile: (upload: Mightbe<NFileUpload>) => Promise<void>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { useToastStore } from "@neon.id/interfaces";
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import { ofetch } from "ofetch";
|
|
4
|
+
import Papa from "papaparse";
|
|
5
|
+
import { useOperasionalOfficeStore } from "../office/index.mjs";
|
|
6
|
+
import { useAuthStore } from "@neon.id/identitas-interfaces";
|
|
7
|
+
export function useImportShift() {
|
|
8
|
+
const store = useOperasionalOfficeStore();
|
|
9
|
+
const toast = useToastStore();
|
|
10
|
+
const authStore = useAuthStore();
|
|
11
|
+
const loadings = ref(/* @__PURE__ */ new Set());
|
|
12
|
+
const isLoading = ref(false);
|
|
13
|
+
return {
|
|
14
|
+
loadings,
|
|
15
|
+
onDownloadTemplateCsvFile,
|
|
16
|
+
onUploadCsvFile
|
|
17
|
+
};
|
|
18
|
+
async function onDownloadTemplateCsvFile() {
|
|
19
|
+
console.log("onDownloadTemplateCsvFile: start");
|
|
20
|
+
isLoading.value = true;
|
|
21
|
+
try {
|
|
22
|
+
const response = await ofetch(
|
|
23
|
+
`${store.officeApiUrl}/downloadTemplateShift`,
|
|
24
|
+
{
|
|
25
|
+
method: "GET",
|
|
26
|
+
headers: {
|
|
27
|
+
"X-Neon-Key": "CH7JLKT6MW"
|
|
28
|
+
},
|
|
29
|
+
responseType: "text"
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
isLoading.value = false;
|
|
33
|
+
const blob = new Blob([response], { type: "text/csv;charset=utf-8;" });
|
|
34
|
+
const url = URL.createObjectURL(blob);
|
|
35
|
+
const link = document.createElement("a");
|
|
36
|
+
link.setAttribute("href", url);
|
|
37
|
+
link.setAttribute("download", "template-shift.csv");
|
|
38
|
+
document.body.appendChild(link);
|
|
39
|
+
link.click();
|
|
40
|
+
document.body.removeChild(link);
|
|
41
|
+
console.log("onDownloadTemplateCsvFile: end");
|
|
42
|
+
} catch (error) {
|
|
43
|
+
if (error) {
|
|
44
|
+
console.error("onDownloadTemplateCsvFile: error", error);
|
|
45
|
+
toast.push({
|
|
46
|
+
content: "Template Shift gagal di download.",
|
|
47
|
+
canClose: true,
|
|
48
|
+
color: "danger"
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function onUploadCsvFile(upload) {
|
|
54
|
+
console.log("onUploadCsvFile: start");
|
|
55
|
+
console.log("upload:", upload?.file);
|
|
56
|
+
if (!upload?.file) {
|
|
57
|
+
console.error("CSV file not found.");
|
|
58
|
+
toast.push({
|
|
59
|
+
content: "File CSV tidak ditemukan.",
|
|
60
|
+
canClose: true,
|
|
61
|
+
color: "danger"
|
|
62
|
+
});
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
Papa.parse(upload.file, {
|
|
66
|
+
header: true,
|
|
67
|
+
skipEmptyLines: true,
|
|
68
|
+
// Hindari baris kosong
|
|
69
|
+
complete: async (results) => {
|
|
70
|
+
const csvData = results.data;
|
|
71
|
+
console.log("csvData:", csvData);
|
|
72
|
+
if (!csvData.length) {
|
|
73
|
+
console.error("CSV file kosong atau tidak valid.");
|
|
74
|
+
toast.push({
|
|
75
|
+
content: "File CSV kosong atau format tidak valid.",
|
|
76
|
+
canClose: true,
|
|
77
|
+
color: "danger"
|
|
78
|
+
});
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const formData = new FormData();
|
|
82
|
+
formData.append("file", upload.file, upload.file.name || "shift.csv");
|
|
83
|
+
try {
|
|
84
|
+
isLoading.value = true;
|
|
85
|
+
const response = await ofetch(`${store.officeApiUrl}/importData`, {
|
|
86
|
+
method: "POST",
|
|
87
|
+
headers: {
|
|
88
|
+
"X-Neon-Key": "CH7JLKT6MW",
|
|
89
|
+
Authorization: `Bearer ${authStore.accessToken}`
|
|
90
|
+
},
|
|
91
|
+
body: formData
|
|
92
|
+
});
|
|
93
|
+
console.log("response:", response);
|
|
94
|
+
toast.push({
|
|
95
|
+
content: "Data shifting berhasil diimport.",
|
|
96
|
+
canClose: true,
|
|
97
|
+
color: "success"
|
|
98
|
+
});
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error("onUploadCsvFile: error", error);
|
|
101
|
+
toast.push({
|
|
102
|
+
content: "Data Shift gagal diimport. Pastikan format data benar.",
|
|
103
|
+
canClose: true,
|
|
104
|
+
color: "danger"
|
|
105
|
+
});
|
|
106
|
+
} finally {
|
|
107
|
+
isLoading.value = false;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
error: (err) => {
|
|
111
|
+
console.error("CSV parsing error:", err.message);
|
|
112
|
+
toast.push({
|
|
113
|
+
content: "Gagal membaca file CSV. Periksa formatnya.",
|
|
114
|
+
canClose: true,
|
|
115
|
+
color: "danger"
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function notifyOk(content) {
|
|
121
|
+
toast.push({
|
|
122
|
+
id: "neu:operasional:importShift",
|
|
123
|
+
content,
|
|
124
|
+
color: "success",
|
|
125
|
+
icon: "check",
|
|
126
|
+
duration: 6e3
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function notifyFail(content) {
|
|
130
|
+
toast.push({
|
|
131
|
+
id: "neu:operasional:importShift",
|
|
132
|
+
content,
|
|
133
|
+
color: "danger",
|
|
134
|
+
icon: "times"
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './office.store';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./office.store.mjs";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const useOperasionalOfficeStore: import("pinia").StoreDefinition<"neu:operasional:office:store", import("pinia")._UnwrapAll<Pick<{
|
|
2
|
+
officeApiUrl: import("vue").Ref<string | undefined>;
|
|
3
|
+
}, "officeApiUrl">>, Pick<{
|
|
4
|
+
officeApiUrl: import("vue").Ref<string | undefined>;
|
|
5
|
+
}, never>, Pick<{
|
|
6
|
+
officeApiUrl: import("vue").Ref<string | undefined>;
|
|
7
|
+
}, never>>;
|
package/build/@office/config.mjs
CHANGED
|
@@ -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", "PeriodButton"],
|
|
6
|
+
common: ["OfficeSingleSync", "PeriodButton", "NeutronImportButton"],
|
|
7
7
|
models: {
|
|
8
8
|
personalia: [
|
|
9
9
|
// Attendance
|
|
@@ -107,6 +107,7 @@ export const config = OfficeInterfaces.define({
|
|
|
107
107
|
"withOperasional",
|
|
108
108
|
"useAttendanceStore",
|
|
109
109
|
"useOperasionalStore",
|
|
110
|
+
"useOperasionalOfficeStore",
|
|
110
111
|
"NOperasional",
|
|
111
112
|
"useOperasional"
|
|
112
113
|
],
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { NeonAlert, NeonButton, NeonPart } from '@neon.id/interfaces'
|
|
3
|
+
import { type NFileUpload, NeonFile, NeonFileDrop } from '@neon.id/media'
|
|
4
|
+
import type { Mightbe } from '@neon.id/types'
|
|
5
|
+
import { StringUtil } from '@neon.id/utils'
|
|
6
|
+
import { useTimeAgo } from '@vueuse/core'
|
|
7
|
+
import { ref } from 'vue'
|
|
8
|
+
import { useImportShift } from '../../../common/providers/'
|
|
9
|
+
|
|
10
|
+
defineOptions({ name: 'ShiftStaffImport' })
|
|
11
|
+
|
|
12
|
+
const { onDownloadTemplateCsvFile, onUploadCsvFile } = useImportShift()
|
|
13
|
+
|
|
14
|
+
const isUploading = ref(false)
|
|
15
|
+
const willUpload = ref(false)
|
|
16
|
+
const upload = ref<NFileUpload>()
|
|
17
|
+
|
|
18
|
+
function onDrop(dropped: File[] | null) {
|
|
19
|
+
if (!dropped) return
|
|
20
|
+
|
|
21
|
+
willUpload.value = false
|
|
22
|
+
|
|
23
|
+
const file = dropped[0]
|
|
24
|
+
upload.value = {
|
|
25
|
+
file,
|
|
26
|
+
progress: 0,
|
|
27
|
+
isUploaded: false,
|
|
28
|
+
isUploading: false,
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function onCancel() {
|
|
33
|
+
upload.value = undefined
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const goBack = () => {
|
|
37
|
+
window.history.back()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const handleImportCsvFile = async (upload: Mightbe<NFileUpload>) => {
|
|
41
|
+
await onUploadCsvFile(upload)
|
|
42
|
+
goBack()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function timeAgo(date: Mightbe<string>, word: string) {
|
|
46
|
+
if (!date) return `Never ${word}`
|
|
47
|
+
const time = useTimeAgo(date, {})
|
|
48
|
+
return `${StringUtil.capital(word)} ${time.value?.toLowerCase()}`
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
<template>
|
|
52
|
+
<NeonPart
|
|
53
|
+
icon="duotone:file-import"
|
|
54
|
+
title="Import Shift"
|
|
55
|
+
use-wrapper
|
|
56
|
+
is-expanded
|
|
57
|
+
>
|
|
58
|
+
<div class="flex items-center gap-2">
|
|
59
|
+
<NeonButton
|
|
60
|
+
icon="duotone:arrow-left"
|
|
61
|
+
size="sm"
|
|
62
|
+
is-rounded
|
|
63
|
+
@click="goBack"
|
|
64
|
+
/>
|
|
65
|
+
<NeonAlert
|
|
66
|
+
icon="duotone:file-import"
|
|
67
|
+
title="Import Jadwal Shift."
|
|
68
|
+
description="Download template CSV lalu masukkan data shift, Kemudian import"
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<div class="button-cols">
|
|
73
|
+
<div class="button-row">
|
|
74
|
+
<NeonButton
|
|
75
|
+
icon="files"
|
|
76
|
+
label="Unduh Template"
|
|
77
|
+
color="base"
|
|
78
|
+
size="sm"
|
|
79
|
+
is-rounded
|
|
80
|
+
@click="onDownloadTemplateCsvFile"
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<NeonFileDrop
|
|
86
|
+
v-if="!upload || willUpload"
|
|
87
|
+
:types="['csv']"
|
|
88
|
+
@drop="onDrop"
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<div v-else class="upload-items">
|
|
92
|
+
<NeonFile
|
|
93
|
+
v-if="upload"
|
|
94
|
+
:file="upload.file"
|
|
95
|
+
:progress="upload.progress"
|
|
96
|
+
:is-uploading="upload.isUploading || isUploading"
|
|
97
|
+
:is-uploaded="upload.isUploaded"
|
|
98
|
+
>
|
|
99
|
+
<template #actions>
|
|
100
|
+
<NeonButton
|
|
101
|
+
v-if="!upload.isUploaded"
|
|
102
|
+
size="xs"
|
|
103
|
+
icon-left="times"
|
|
104
|
+
display="fill"
|
|
105
|
+
color="base"
|
|
106
|
+
is-squared
|
|
107
|
+
@click="onCancel"
|
|
108
|
+
/>
|
|
109
|
+
</template>
|
|
110
|
+
</NeonFile>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<div class="button-cols">
|
|
114
|
+
<div class="button-row">
|
|
115
|
+
<!-- <NeonButton
|
|
116
|
+
icon="duotone:arrow-up-from-bracket"
|
|
117
|
+
label="Upload"
|
|
118
|
+
color="base"
|
|
119
|
+
size="sm"
|
|
120
|
+
is-rounded
|
|
121
|
+
/> -->
|
|
122
|
+
</div>
|
|
123
|
+
<div class="button-end">
|
|
124
|
+
<NeonButton
|
|
125
|
+
icon="duotone:file-import"
|
|
126
|
+
label="Import"
|
|
127
|
+
color="dark"
|
|
128
|
+
size="sm"
|
|
129
|
+
is-rounded
|
|
130
|
+
@click="handleImportCsvFile(upload)"
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
</NeonPart>
|
|
135
|
+
</template>
|
|
136
|
+
|
|
137
|
+
<style scoped>
|
|
138
|
+
.button-cols {
|
|
139
|
+
@apply flex flex-col space-y-2 space-x-2 space-x-reverse;
|
|
140
|
+
@apply sm:flex-row sm:items-center;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.button-row {
|
|
144
|
+
@apply flex-1 flex items-center space-x-2;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.time-ago {
|
|
148
|
+
@apply font-medium text-sm text-fg-subdued leading-none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.button-end {
|
|
152
|
+
@apply flex-1 flex sm:justify-end space-x-2;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.warning-label {
|
|
156
|
+
@apply font-medium text-sm text-fg-subdued leading-none;
|
|
157
|
+
@apply text-yellow-600;
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
TPersonaliaShiftStaffModel,
|
|
14
14
|
Schema,
|
|
15
15
|
} from '@neutron.co.id/personalia-models'
|
|
16
|
-
import { useOperasional } from '../../../../common'
|
|
16
|
+
import { NeutronImportButton, useOperasional } from '../../../../common'
|
|
17
17
|
|
|
18
18
|
defineOptions({ name: 'ShiftStaffDisplay' })
|
|
19
19
|
|
|
@@ -96,6 +96,9 @@ function onCalendarPeriodUpdate(period: NCalendar.PeriodData) {
|
|
|
96
96
|
|
|
97
97
|
<div class="end">
|
|
98
98
|
<OfficeCollectionQuery :displays="displays">
|
|
99
|
+
<NeutronImportButton
|
|
100
|
+
v-if="permit.isAny(['neu:shiftCabang', 'neu:admin'])"
|
|
101
|
+
/>
|
|
99
102
|
<OfficeCollectionOperation is-main :path="path" />
|
|
100
103
|
</OfficeCollectionQuery>
|
|
101
104
|
</div>
|
|
@@ -4,3 +4,4 @@ export * from './ShiftStaffWrapper';
|
|
|
4
4
|
export { default as ShiftStaffCollectionStaff } from './ShiftStaffCollectionStaff.vue';
|
|
5
5
|
export { default as ShiftStaffCollectionBranch } from './ShiftStaffCollectionBranch.vue';
|
|
6
6
|
export { default as ShiftStaffSingleBranch } from './ShiftStaffSingleBranch.vue';
|
|
7
|
+
export { default as ShiftStaffImport } from './ShiftStaffImport.vue';
|
|
@@ -4,3 +4,4 @@ export * from "./ShiftStaffWrapper/index.mjs";
|
|
|
4
4
|
export { default as ShiftStaffCollectionStaff } from "./ShiftStaffCollectionStaff.vue";
|
|
5
5
|
export { default as ShiftStaffCollectionBranch } from "./ShiftStaffCollectionBranch.vue";
|
|
6
6
|
export { default as ShiftStaffSingleBranch } from "./ShiftStaffSingleBranch.vue";
|
|
7
|
+
export { default as ShiftStaffImport } from "./ShiftStaffImport.vue";
|
|
@@ -35,6 +35,7 @@ const {
|
|
|
35
35
|
@submit="saveOne"
|
|
36
36
|
>
|
|
37
37
|
<NeonField v-model="values.titleShift" v-bind="fields.titleShift" />
|
|
38
|
+
<NeonField v-model="values.code" v-bind="fields.code" />
|
|
38
39
|
<OfficeRelation v-model="values" :field="fields.branch" />
|
|
39
40
|
<div class="grid gap-2 sm:grid-cols-2">
|
|
40
41
|
<NeonField
|
|
@@ -124,7 +124,7 @@ const queryBelajar = computed(() => {
|
|
|
124
124
|
/>
|
|
125
125
|
</OfficeTab>
|
|
126
126
|
|
|
127
|
-
<OfficeTab
|
|
127
|
+
<!-- <OfficeTab
|
|
128
128
|
v-slot="{ isTouched }"
|
|
129
129
|
handle="learning"
|
|
130
130
|
icon="bolt"
|
|
@@ -158,7 +158,7 @@ const queryBelajar = computed(() => {
|
|
|
158
158
|
:is-ready="isReady && isTouched"
|
|
159
159
|
:excludes="['duplicate', 'create', 'delete', 'destroy', 'click']"
|
|
160
160
|
/>
|
|
161
|
-
</OfficeTab>
|
|
161
|
+
</OfficeTab> -->
|
|
162
162
|
</OfficeTabs>
|
|
163
163
|
</NeonSingle>
|
|
164
164
|
</template>
|