@simitgroup/simpleapp-generator 1.3.5-alpha → 1.4.1-alpha
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/dist/buildinschemas/permission.d.ts.map +1 -1
- package/dist/buildinschemas/permission.js +10 -6
- package/dist/buildinschemas/permission.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +22 -2
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/generate.js +20 -6
- package/dist/generate.js.map +1 -1
- package/dist/type.d.ts +2 -0
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/permission.ts +10 -6
- package/src/buildinschemas/user.ts +23 -3
- package/src/generate.ts +19 -6
- package/src/type.ts +3 -1
- package/templates/basic/nest/service.ts.eta +7 -3
- package/templates/basic/nuxt/pages.[id].vue.eta +4 -4
- package/templates/basic/nuxt/pages.mobile.[id].vue.eta +39 -0
- package/templates/basic/nuxt/pages.mobile.landing.vue.eta +69 -0
- package/templates/nest/src/simpleapp/apischemas/index.ts._eta +29 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +22 -12
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +26 -1
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +2 -1
- package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +1 -1
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +1 -1
- package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +1 -1
- package/templates/nest/src/simpleapp/services/perm.service.ts.eta +5 -7
- package/templates/nest/src/simpleapp/services/user.service.ts.eta.old +118 -0
- package/templates/nest/src/simpleapp/types/index.ts._eta +8 -0
- package/templates/nuxt/app.vue._eta +31 -17
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +1 -1
- package/templates/nuxt/components/calendar/CalendarByResource.vue.eta +181 -163
- package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +8 -6
- package/templates/nuxt/components/form/FormDocnoformat.vue.eta +174 -0
- package/templates/nuxt/components/form/FormUser.vue._eta +91 -0
- package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +83 -0
- package/templates/nuxt/components/header/HeaderBar.vue._eta +43 -39
- package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +7 -9
- package/templates/nuxt/components/page/PageDocList.vue.eta +6 -4
- package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +13 -0
- package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +6 -3
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +3 -4
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +48 -4
- package/templates/nuxt/composables/date.generate.ts.eta +3 -1
- package/templates/nuxt/composables/goTo.generate.ts.eta +4 -1
- package/templates/nuxt/layouts/mobile.vue._eta +26 -12
- package/templates/nuxt/nuxt.config.ts._eta +27 -20
- package/templates/nuxt/pages/[xorg]/{user/index.vue.eta → docnoformat/[id].vue.eta} +11 -9
- package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +51 -20
- package/templates/nuxt/pages/[xorg]/mobile/docnoformat/index.vue.eta +59 -0
- package/templates/nuxt/pages/[xorg]/mobile/index.vue._eta +19 -0
- package/templates/nuxt/pages/[xorg]/mobile/organization/index.vue.eta +138 -0
- package/templates/nuxt/pages/[xorg]/mobile/pickgroup.vue._eta +35 -0
- package/templates/nuxt/pages/[xorg]/mobile/user/index.vue.eta +231 -0
- package/templates/nuxt/pages/[xorg]/pickgroup.vue._eta +35 -0
- package/templates/nuxt/pages/[xorg]/user.vue.eta +91 -74
- package/templates/nuxt/pages/profile.vue.eta +7 -7
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +14 -3
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +18 -16
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +1 -1
- package/templates/nuxt/types/events.ts.eta +1 -0
- package/templates/nuxt/types/simpleappinput.ts.eta +3 -2
- package/templates/nuxt/types/user.ts.eta +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nest/src/simpleapp/services/user.service.ts.etax +0 -66
- package/templates/nuxt/pages/[xorg]/docnoformat/[doctype]/[id].vue.eta +0 -13
- package/templates/nuxt/pages/[xorg]/docnoformat/[doctype]/new.vue.eta +0 -229
- package/templates/nuxt/pages/[xorg]/docnoformat/[doctype].vue.eta +0 -38
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +0 -11
- package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +0 -39
- package/templates/nuxt/pages/[xorg]/user/form.vue.eta +0 -334
- package/templates/nuxt/pages/[xorg]/user/new.vue.eta +0 -18
- package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +0 -29
|
@@ -1,38 +1,36 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
>
|
|
35
|
-
<!-- <div
|
|
1
|
+
<template>
|
|
2
|
+
<VueCal
|
|
3
|
+
:id="id"
|
|
4
|
+
ref="vueresourcecal"
|
|
5
|
+
:disable-views="['years', 'year', 'month', 'week']"
|
|
6
|
+
:time-from="8 * 60"
|
|
7
|
+
:time-to="22 * 60"
|
|
8
|
+
:time-step="60"
|
|
9
|
+
active-view="day"
|
|
10
|
+
:snap-to-time="15"
|
|
11
|
+
hide-view-selector
|
|
12
|
+
:events="allEvents"
|
|
13
|
+
:editable-events="calendarMode"
|
|
14
|
+
:split-days="allresources"
|
|
15
|
+
:min-split-width="100"
|
|
16
|
+
sticky-split-labels
|
|
17
|
+
:selected-date="selectedDate"
|
|
18
|
+
:drag-to-create-threshold="15"
|
|
19
|
+
:on-event-click="onEventClick"
|
|
20
|
+
|
|
21
|
+
@event-drag-create="onDragNew"
|
|
22
|
+
@event-drop="onEventDrop"
|
|
23
|
+
@view-change="viewChange"
|
|
24
|
+
@cell-click="onCellClick"
|
|
25
|
+
@cell-contextmenu="eventHappend"
|
|
26
|
+
>
|
|
27
|
+
<!-- header template -->
|
|
28
|
+
<template #split-label="{ split }">
|
|
29
|
+
<div
|
|
30
|
+
@click="clickResource(split._id, split.label)"
|
|
31
|
+
class="cursor-pointer"
|
|
32
|
+
>
|
|
33
|
+
<!-- <div
|
|
36
34
|
v-if="resourceType == CalResourceType.teacher && split.email"
|
|
37
35
|
class="w-full text-center"
|
|
38
36
|
>
|
|
@@ -40,153 +38,173 @@
|
|
|
40
38
|
:src="getAvatarLink(split.email, 48)"
|
|
41
39
|
class="overflow-hidden object-cover rounded-full border-2 border-white dark:border-gray-700 shadow"
|
|
42
40
|
/> -->
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
<div>
|
|
42
|
+
{{ split.displayName }}
|
|
43
|
+
<span v-if="split._id == '?'" class="pi pi-plus"></span>
|
|
47
44
|
</div>
|
|
48
|
-
</
|
|
45
|
+
<!-- </div>
|
|
46
|
+
<div v-else>{{ split.displayName }}</div> -->
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
</div>
|
|
63
|
-
</template>
|
|
64
|
-
</VueCal>
|
|
50
|
+
<!-- event template -->
|
|
51
|
+
<!-- @contextmenu="onRightClick($event, event)" -->
|
|
52
|
+
<template #event="{ event }">
|
|
53
|
+
<div class="cursor-pointer h-full">
|
|
54
|
+
<slot name="default" :event="<CalEventType<T>>event">
|
|
55
|
+
<div>{{ event.title }}</div>
|
|
56
|
+
<div>{{ event.start }}</div>
|
|
57
|
+
<div>{{ event.end }}</div>
|
|
58
|
+
</slot>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
</VueCal>
|
|
65
62
|
</template>
|
|
66
63
|
<script setup lang="ts" generic="T">
|
|
67
64
|
/**
|
|
68
|
-
* This file was automatically generated by simpleapp generator during initialization.
|
|
65
|
+
* This file was automatically generated by simpleapp generator during initialization.
|
|
69
66
|
* IT IS NOT CHANGABLE
|
|
70
67
|
* last change 2024-02-22
|
|
71
68
|
* author: Ks Tan
|
|
72
69
|
*/
|
|
73
70
|
|
|
74
|
-
|
|
71
|
+
|
|
75
72
|
import VueCal, { Event, SplitDaysAttributes } from "vue-cal";
|
|
76
|
-
import {
|
|
73
|
+
import {
|
|
74
|
+
CalEventType,
|
|
75
|
+
CalViewClickSlotEvent,
|
|
76
|
+
CalResource,
|
|
77
|
+
CalResourceType,
|
|
78
|
+
RelocateEvent,
|
|
79
|
+
} from "~/types";
|
|
77
80
|
import { emit } from "process";
|
|
78
|
-
import moment from
|
|
79
|
-
const timezoneoffset = new Date().getTimezoneOffset()
|
|
80
|
-
const eventsdata = ref<CalEventType<T>[]>()
|
|
81
|
-
const vueresourcecal = ref()
|
|
82
|
-
const emits = defineEmits([
|
|
81
|
+
import moment from "moment";
|
|
82
|
+
const timezoneoffset = new Date().getTimezoneOffset();
|
|
83
|
+
const eventsdata = ref<CalEventType<T>[]>();
|
|
84
|
+
const vueresourcecal = ref();
|
|
85
|
+
const emits = defineEmits([
|
|
86
|
+
"eventRightClick",
|
|
87
|
+
"eventClick",
|
|
88
|
+
"eventDrop",
|
|
89
|
+
"eventDragNew",
|
|
90
|
+
"viewChange",
|
|
91
|
+
"resourceClick",
|
|
92
|
+
"slotClick",
|
|
93
|
+
]);
|
|
83
94
|
const props = defineProps<{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}>()
|
|
89
|
-
const selectedDate = defineModel<Date>()
|
|
90
|
-
const selectedSchedule = ref<
|
|
91
|
-
|
|
95
|
+
id: string;
|
|
96
|
+
items: CalEventType<T>[];
|
|
97
|
+
resources: CalResource[];
|
|
98
|
+
resourceType: CalResourceType;
|
|
99
|
+
}>();
|
|
100
|
+
const selectedDate = defineModel<Date>();
|
|
101
|
+
const selectedSchedule = ref<CalEventType<T>>();
|
|
102
|
+
const allEvents = ref<CalEventType[]>([]);
|
|
92
103
|
|
|
104
|
+
const mapEvents = () => {
|
|
105
|
+
allEvents.value = props.items.map((item) => {
|
|
106
|
+
if (item.start instanceof Date)
|
|
107
|
+
item.start = item.start
|
|
108
|
+
.addMinutes(timezoneoffset)
|
|
109
|
+
.format("YYYY-MM-DD HH:mm");
|
|
110
|
+
if (item.end instanceof Date)
|
|
111
|
+
item.end = item.end.addMinutes(timezoneoffset).format("YYYY-MM-DD HH:mm");
|
|
112
|
+
if (!item.split) item.split = "?";
|
|
113
|
+
return item;
|
|
114
|
+
});
|
|
115
|
+
};
|
|
93
116
|
|
|
94
|
-
const
|
|
117
|
+
const eventHappend = (e: any) => {
|
|
118
|
+
console.log("eventHappend", e);
|
|
119
|
+
// alert("event happend")
|
|
120
|
+
};
|
|
121
|
+
const viewChange = (e: any) => {
|
|
122
|
+
selectedDate.value = e.startDate;
|
|
123
|
+
emits("viewChange", e);
|
|
124
|
+
};
|
|
125
|
+
const allresources = computed(() => {
|
|
126
|
+
const tmplist = props.resources.map((r) => {
|
|
127
|
+
if (!r.id) r.id = r._id;
|
|
128
|
+
if (r.hide === undefined) r.hide = false;
|
|
129
|
+
if (!r.displayName) r.displayName = r.label;
|
|
130
|
+
return r;
|
|
131
|
+
});
|
|
132
|
+
tmplist.push({
|
|
133
|
+
_id: "?",
|
|
134
|
+
id: "?",
|
|
135
|
+
hide: false,
|
|
136
|
+
label: t("unknown"),
|
|
137
|
+
displayName: t("unknown"),
|
|
138
|
+
code: "",
|
|
139
|
+
email: "",
|
|
140
|
+
});
|
|
141
|
+
return tmplist;
|
|
142
|
+
});
|
|
143
|
+
const onCellClick = async (e: CalViewClickSlotEvent) => {
|
|
144
|
+
const date = e.date;
|
|
145
|
+
date.setHours(date.getHours() + Math.floor(date.getMinutes() / 60));
|
|
146
|
+
date.setMinutes(0, 0, 0); // Resets also seconds and milliseconds
|
|
95
147
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if(!r.displayName) r.displayName=r.label
|
|
122
|
-
return r
|
|
123
|
-
})
|
|
124
|
-
tmplist.push({
|
|
125
|
-
_id:'?',
|
|
126
|
-
id:'?',
|
|
127
|
-
hide:false,
|
|
128
|
-
label:t('unknown'),
|
|
129
|
-
displayName:t('unknown'),
|
|
130
|
-
code:'',
|
|
131
|
-
email:'',
|
|
132
|
-
})
|
|
133
|
-
return tmplist
|
|
134
|
-
})
|
|
135
|
-
const onCellClick = async(e:CalViewClickSlotEvent)=>{
|
|
136
|
-
const date =e.date
|
|
137
|
-
date.setHours(date.getHours() + Math.floor(date.getMinutes()/60));
|
|
138
|
-
date.setMinutes(0, 0, 0); // Resets also seconds and milliseconds
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const newevent:CalEventType<T> = {
|
|
142
|
-
id: 'new',
|
|
143
|
-
start: date,
|
|
144
|
-
end: date.addHours(1),
|
|
145
|
-
class: 'nostudent',
|
|
146
|
-
title: t('new'),
|
|
147
|
-
// content?: string | undefined;
|
|
148
|
-
split: e.split,
|
|
149
|
-
data: {} as T
|
|
150
|
-
}
|
|
151
|
-
// emits('slotClick',e)
|
|
152
|
-
emits('eventDragNew',newevent)
|
|
153
|
-
}
|
|
154
|
-
const onEventDrop = async (relocateData: RelocateEvent<T>)=>{
|
|
155
|
-
emits('eventDrop', relocateData)
|
|
156
|
-
}
|
|
157
|
-
const clickResource = async (splitid:string, splitlabel:string)=> emits('resourceClick', splitid,splitlabel)
|
|
158
|
-
const onDragNew = (e: CalEventType<T>)=> emits('eventDragNew', e)
|
|
148
|
+
const newevent: CalEventType<T> = {
|
|
149
|
+
id: randomUUID(),
|
|
150
|
+
start: date.format("YYYY-MM-DD HH:mm"),
|
|
151
|
+
end: date.addHours(1).format("YYYY-MM-DD HH:mm"),
|
|
152
|
+
class: "nostudent",
|
|
153
|
+
title: t("new"),
|
|
154
|
+
// content?: string | undefined;
|
|
155
|
+
split: e.split,
|
|
156
|
+
data: { _id: randomUUID(), day: "tue" } as T,
|
|
157
|
+
};
|
|
158
|
+
// emits('slotClick',e)
|
|
159
|
+
// console.log("Before add ",allEvents.value)
|
|
160
|
+
allEvents.value.push(newevent);
|
|
161
|
+
setTimeout(() => {
|
|
162
|
+
mapEvents();
|
|
163
|
+
}, 300);
|
|
164
|
+
// console.log("after add ",allEvents.value)
|
|
165
|
+
emits("eventDragNew", newevent);
|
|
166
|
+
};
|
|
167
|
+
const onEventDrop = async (relocateData: RelocateEvent<T>) => {
|
|
168
|
+
emits("eventDrop", relocateData);
|
|
169
|
+
};
|
|
170
|
+
const clickResource = async (splitid: string, splitlabel: string) =>
|
|
171
|
+
emits("resourceClick", splitid, splitlabel);
|
|
172
|
+
const onDragNew = (e: CalEventType<T>) => emits("eventDragNew", e);
|
|
159
173
|
|
|
160
|
-
const onRightClick = (clickevent: any, scheduledata:
|
|
174
|
+
const onRightClick = (clickevent: any, scheduledata: CalEventType<T>) => {
|
|
161
175
|
selectedSchedule.value = scheduledata;
|
|
162
|
-
emits(
|
|
176
|
+
emits("eventRightClick", clickevent, scheduledata);
|
|
163
177
|
};
|
|
164
|
-
const onEventClick = (eventdata:
|
|
178
|
+
const onEventClick = (eventdata: CalEventType<T>, e:MouseEvent) => {
|
|
165
179
|
selectedSchedule.value = eventdata;
|
|
166
|
-
emits(
|
|
180
|
+
emits("eventClick", eventdata,e);
|
|
181
|
+
// e.stopPropagation();
|
|
167
182
|
};
|
|
168
183
|
|
|
169
|
-
const calendarMode = computed(()=>{
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
184
|
+
const calendarMode = computed(() => {
|
|
185
|
+
if (useDevice().isMobile) {
|
|
186
|
+
return {
|
|
187
|
+
title: false,
|
|
188
|
+
drag: true,
|
|
189
|
+
resize: false,
|
|
190
|
+
delete: false,
|
|
191
|
+
// create: true,
|
|
192
|
+
};
|
|
193
|
+
} else {
|
|
194
|
+
return {
|
|
195
|
+
title: false,
|
|
196
|
+
drag: true,
|
|
197
|
+
resize: false,
|
|
198
|
+
delete: false,
|
|
199
|
+
create: true,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
onMounted(() => {
|
|
204
|
+
mapEvents();
|
|
205
|
+
watch(
|
|
206
|
+
() => props.items,
|
|
207
|
+
() => mapEvents(),
|
|
208
|
+
);
|
|
209
|
+
});
|
|
210
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<VueCal
|
|
3
3
|
:id="id"
|
|
4
4
|
class="w-full"
|
|
5
5
|
hide-view-selector
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<div @click="chooseDate(new Date(), true)">{{ t("today") }}</div>
|
|
21
21
|
</template>
|
|
22
22
|
<template #cell-content="{ cell, events }">
|
|
23
|
-
<div
|
|
23
|
+
<div>
|
|
24
24
|
<div>
|
|
25
25
|
<s
|
|
26
26
|
v-if="dateExists(new Date(cell.formattedDate), alloffdays)"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
</div>
|
|
43
43
|
</div>
|
|
44
44
|
</template>
|
|
45
|
-
</
|
|
45
|
+
</VueCal>
|
|
46
46
|
</template>
|
|
47
47
|
<script lang="ts" setup generic="T">
|
|
48
48
|
/**
|
|
@@ -51,7 +51,9 @@
|
|
|
51
51
|
* last change 2024-02-22
|
|
52
52
|
* author: Ks Tan
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
//, { Event, SplitDaysAttributes }
|
|
55
|
+
import VueCal from "vue-cal";
|
|
56
|
+
import "vue-cal/dist/vuecal.css";
|
|
55
57
|
import {
|
|
56
58
|
CalEventType,
|
|
57
59
|
CalRightClickEvent,
|
|
@@ -82,9 +84,9 @@ const allevents = computed(() => {
|
|
|
82
84
|
const viewChange = (event: CalViewChange) => {
|
|
83
85
|
viewStatus.value = event;
|
|
84
86
|
};
|
|
85
|
-
const chooseDate = (date1: Date, force?: boolean) => {
|
|
87
|
+
const chooseDate = (date1: Date, force?: boolean) => {
|
|
86
88
|
if (force || !viewStatus.value || viewStatus.value.view == "month") {
|
|
87
|
-
selectedDate.value = date1;
|
|
89
|
+
selectedDate.value = date1;
|
|
88
90
|
emits("chooseDate", date1);
|
|
89
91
|
}
|
|
90
92
|
};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<title v-if="id">{{ data.docNoFormatName ?? data.docNoFormatNo }}</title>
|
|
4
|
+
|
|
5
|
+
<SimpleAppForm #default="o" :document="doc">
|
|
6
|
+
<SimpleAppFormToolBar
|
|
7
|
+
:document="doc"
|
|
8
|
+
@on="actionListener"
|
|
9
|
+
></SimpleAppFormToolBar>
|
|
10
|
+
<div
|
|
11
|
+
class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 p-2"
|
|
12
|
+
>
|
|
13
|
+
<SimpleAppInput
|
|
14
|
+
:input-type="SimpleAppInputType.autocomplete"
|
|
15
|
+
:setting="o.getField('#/properties/branch')"
|
|
16
|
+
v-model="data.branch"
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<SimpleAppInput
|
|
20
|
+
:input-type="SimpleAppInputType.text"
|
|
21
|
+
:setting="o.getField('#/properties/docNoFormatNo')"
|
|
22
|
+
v-model="data.docNoFormatNo"
|
|
23
|
+
/>
|
|
24
|
+
|
|
25
|
+
<SimpleAppInput
|
|
26
|
+
:input-type="SimpleAppInputType.text"
|
|
27
|
+
:setting="o.getField('#/properties/docNoFormatName')"
|
|
28
|
+
v-model="data.docNoFormatName"
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<SimpleAppInput
|
|
32
|
+
:input-type="SimpleAppInputType.checkbox"
|
|
33
|
+
:setting="o.getField('#/properties/active')"
|
|
34
|
+
v-model="data.active"
|
|
35
|
+
/>
|
|
36
|
+
<SimpleAppInput
|
|
37
|
+
:input-type="SimpleAppInputType.checkbox"
|
|
38
|
+
:setting="o.getField('#/properties/default')"
|
|
39
|
+
v-model="data.default"
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<SimpleAppInput
|
|
43
|
+
:readonly="!doc.isNew()"
|
|
44
|
+
:input-type="SimpleAppInputType.select"
|
|
45
|
+
:setting="o.getField('#/properties/docNoType')"
|
|
46
|
+
:options="getAllDocFormats().map((item) => item.docType)"
|
|
47
|
+
v-model="data.docNoType"
|
|
48
|
+
/>
|
|
49
|
+
|
|
50
|
+
<SimpleAppInput
|
|
51
|
+
:input-type="SimpleAppInputType.text"
|
|
52
|
+
:setting="o.getField('#/properties/docNoPattern')"
|
|
53
|
+
v-model="data.docNoPattern"
|
|
54
|
+
@keyup="updateSample"
|
|
55
|
+
:description="sample"
|
|
56
|
+
v-tooltip="'Examples: PO-[00000], SI{YY}/[000], SI{YYMM}/[000]'"
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
<SimpleAppInput
|
|
60
|
+
:input-type="SimpleAppInputType.number"
|
|
61
|
+
:setting="o.getField('#/properties/nextNumber')"
|
|
62
|
+
v-model="data.nextNumber"
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
</SimpleAppForm>
|
|
66
|
+
<DebugDocumentData v-model="data" :label="doc.getDocName()" />
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script setup lang="ts">
|
|
71
|
+
/**
|
|
72
|
+
* This file was automatically generated by simpleapp generator.
|
|
73
|
+
* last change 2024-02-16
|
|
74
|
+
* Author: Ks Tan
|
|
75
|
+
*/
|
|
76
|
+
import { SimpleAppInputType, FormCrudEvent } from "~/types";
|
|
77
|
+
import { Docnoformat } from "~/simpleapp/generate/types";
|
|
78
|
+
import { DocnoformatDoc } from "~/simpleapp/docs/DocnoformatDoc";
|
|
79
|
+
|
|
80
|
+
const props = defineProps<{
|
|
81
|
+
_id?: string;
|
|
82
|
+
doc?: DocnoformatDoc;
|
|
83
|
+
paras?: Docnoformat;
|
|
84
|
+
}>();
|
|
85
|
+
|
|
86
|
+
const doc = props.doc ?? useNuxtApp().$DocnoformatDoc();
|
|
87
|
+
const data = doc.getReactiveData();
|
|
88
|
+
const sample = ref("");
|
|
89
|
+
const emits = defineEmits(["after"]);
|
|
90
|
+
const id = computed(() => props._id ?? "");
|
|
91
|
+
|
|
92
|
+
/************ start default methods ****************/
|
|
93
|
+
|
|
94
|
+
const newData = () => doc.setNew();
|
|
95
|
+
|
|
96
|
+
const getRecord = async () => {
|
|
97
|
+
if (id.value && id.value != "new") {
|
|
98
|
+
await doc.getById(id.value);
|
|
99
|
+
} else {
|
|
100
|
+
newData();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
getRecord();
|
|
105
|
+
watch(id, async () => await getRecord());
|
|
106
|
+
/************ end default methods ****************/
|
|
107
|
+
|
|
108
|
+
const actionListener = async (actionName: string) => {
|
|
109
|
+
emits("after", actionName, data.value);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
onMounted(async () => {
|
|
113
|
+
await actionListener(FormCrudEvent.mount);
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
updateSample();
|
|
116
|
+
}, 300);
|
|
117
|
+
});
|
|
118
|
+
/************ start api methods ****************/
|
|
119
|
+
|
|
120
|
+
// const runListDocFormats = async () => {
|
|
121
|
+
// const data = {
|
|
122
|
+
// id: id.value,
|
|
123
|
+
// };
|
|
124
|
+
// const result = await doc.runListDocFormats(
|
|
125
|
+
// doctype,
|
|
126
|
+
|
|
127
|
+
// data,
|
|
128
|
+
// );
|
|
129
|
+
// };
|
|
130
|
+
/************ end api methods ****************/
|
|
131
|
+
const updateSample = () => {
|
|
132
|
+
sample.value = "Example: " + previewDocNo();
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const previewDocNo = (): string => {
|
|
136
|
+
const pattern = data.value.docNoPattern;
|
|
137
|
+
if (pattern) {
|
|
138
|
+
const numberReg: RegExp = /\[(.*?)\]/g;
|
|
139
|
+
const dateReg: RegExp = /\{(.*?)\}/g;
|
|
140
|
+
let newvalue = pattern;
|
|
141
|
+
const numberpattern = pattern.match(numberReg);
|
|
142
|
+
const datepattern = pattern.match(dateReg);
|
|
143
|
+
|
|
144
|
+
if (numberpattern && numberpattern.length > 0) {
|
|
145
|
+
const numberlength = numberpattern[0]
|
|
146
|
+
.replace("[", "")
|
|
147
|
+
.replace("]", "").length;
|
|
148
|
+
|
|
149
|
+
let nextnumber = (data.value.nextNumber ?? 0).toString();
|
|
150
|
+
|
|
151
|
+
const numberdiff = numberlength - nextnumber.length;
|
|
152
|
+
|
|
153
|
+
for (let n = 0; n < numberdiff; n++) {
|
|
154
|
+
nextnumber = "0" + nextnumber;
|
|
155
|
+
}
|
|
156
|
+
newvalue = newvalue.replace(numberpattern[0], nextnumber);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (datepattern && datepattern.length > 0) {
|
|
160
|
+
for (let d = 0; d < datepattern.length; d++) {
|
|
161
|
+
const dpattern = datepattern[d];
|
|
162
|
+
const date = new Date();
|
|
163
|
+
const formatteddate = getDayJs()().format(
|
|
164
|
+
dpattern.replace("{", "").replace("}", ""),
|
|
165
|
+
);
|
|
166
|
+
newvalue = newvalue.replace(dpattern, formatteddate);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return newvalue;
|
|
170
|
+
} else {
|
|
171
|
+
return "";
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
</script>
|