@simitgroup/simpleapp-generator 2.0.3-k-alpha → 2.0.3-l-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/ReleaseNote.md
CHANGED
package/package.json
CHANGED
|
@@ -1,240 +0,0 @@
|
|
|
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 class="grid grid-cols-1 lg:grid-cols-2 gap-4 p-2">
|
|
11
|
-
<SimpleAppInput
|
|
12
|
-
:input-type="SimpleAppInputType.autocomplete"
|
|
13
|
-
:setting="o.getField('#/properties/branch')"
|
|
14
|
-
v-model="data.branch"
|
|
15
|
-
/>
|
|
16
|
-
<SimpleAppInput
|
|
17
|
-
:readonly="!doc.isNew()"
|
|
18
|
-
:input-type="SimpleAppInputType.select"
|
|
19
|
-
:setting="o.getField('#/properties/docNoType')"
|
|
20
|
-
:options="
|
|
21
|
-
getAllDocFormats().map((item) => ({
|
|
22
|
-
label: docNoTypeMapping[item.docType] || item.docType,
|
|
23
|
-
value: item.docType,
|
|
24
|
-
}))
|
|
25
|
-
"
|
|
26
|
-
v-model="data.docNoType"
|
|
27
|
-
/>
|
|
28
|
-
|
|
29
|
-
<SimpleAppInput
|
|
30
|
-
:input-type="SimpleAppInputType.text"
|
|
31
|
-
:setting="o.getField('#/properties/docNoFormatNo')"
|
|
32
|
-
v-model="data.docNoFormatNo"
|
|
33
|
-
/>
|
|
34
|
-
|
|
35
|
-
<SimpleAppInput
|
|
36
|
-
:input-type="SimpleAppInputType.text"
|
|
37
|
-
:setting="o.getField('#/properties/docNoFormatName')"
|
|
38
|
-
v-model="data.docNoFormatName"
|
|
39
|
-
/>
|
|
40
|
-
|
|
41
|
-
<SimpleAppInput
|
|
42
|
-
:input-type="SimpleAppInputType.checkbox"
|
|
43
|
-
:setting="o.getField('#/properties/active')"
|
|
44
|
-
v-model="data.active"
|
|
45
|
-
/>
|
|
46
|
-
<SimpleAppInput
|
|
47
|
-
:input-type="SimpleAppInputType.checkbox"
|
|
48
|
-
:setting="o.getField('#/properties/default')"
|
|
49
|
-
v-model="data.default"
|
|
50
|
-
/>
|
|
51
|
-
|
|
52
|
-
<SimpleAppInput
|
|
53
|
-
:input-type="SimpleAppInputType.text"
|
|
54
|
-
:setting="o.getField('#/properties/docNoPattern')"
|
|
55
|
-
v-model="data.docNoPattern"
|
|
56
|
-
@keyup="updateSample"
|
|
57
|
-
:description="sample"
|
|
58
|
-
v-tooltip="'Examples: PO-[00000], SI{YY}/[000], SI{YYMM}/[000]'"
|
|
59
|
-
/>
|
|
60
|
-
|
|
61
|
-
<SimpleAppInput
|
|
62
|
-
:input-type="SimpleAppInputType.number"
|
|
63
|
-
:setting="o.getField('#/properties/nextNumber')"
|
|
64
|
-
v-model="data.nextNumber"
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
</SimpleAppForm>
|
|
68
|
-
<DebugDocumentData v-model="data" :label="doc.getDocName()" />
|
|
69
|
-
<DataTable
|
|
70
|
-
:value="formatParams"
|
|
71
|
-
class="p-datatable-sm mt-6"
|
|
72
|
-
stripedRows
|
|
73
|
-
responsiveLayout="scroll"
|
|
74
|
-
>
|
|
75
|
-
<template #header>
|
|
76
|
-
<div class="text-sm font-semibold">Format Parameters</div>
|
|
77
|
-
</template>
|
|
78
|
-
<Column
|
|
79
|
-
field="placeholder"
|
|
80
|
-
header="Placeholder"
|
|
81
|
-
style="width: 30%"
|
|
82
|
-
class="text-xs"
|
|
83
|
-
/>
|
|
84
|
-
<Column field="description" header="Description" class="text-xs" />
|
|
85
|
-
</DataTable>
|
|
86
|
-
</div>
|
|
87
|
-
</template>
|
|
88
|
-
|
|
89
|
-
<script setup lang="ts">
|
|
90
|
-
/**
|
|
91
|
-
* This file was automatically generated by simpleapp generator.
|
|
92
|
-
* last change 2024-02-16
|
|
93
|
-
* Author: Ks Tan
|
|
94
|
-
*/
|
|
95
|
-
import { SimpleAppInputType, FormCrudEvent } from "~/types";
|
|
96
|
-
import { DocumentNoFormat } from "~/simpleapp/generate/openapi";
|
|
97
|
-
import { DocumentnoformatDoc } from "~/simpleapp/docs/DocumentnoformatDoc";
|
|
98
|
-
|
|
99
|
-
const props = defineProps<{
|
|
100
|
-
_id?: string;
|
|
101
|
-
doc?: DocumentnoformatDoc;
|
|
102
|
-
paras?: Partial<DocumentNoFormat>;
|
|
103
|
-
}>();
|
|
104
|
-
|
|
105
|
-
const doc = props.doc ?? useNuxtApp().$DocumentnoformatDoc()
|
|
106
|
-
const data = doc.getReactiveData();
|
|
107
|
-
const sample = ref("");
|
|
108
|
-
const emits = defineEmits(["after"]);
|
|
109
|
-
const id = computed(() => props._id ?? "");
|
|
110
|
-
|
|
111
|
-
/************ start default methods ****************/
|
|
112
|
-
|
|
113
|
-
const newData = () => {
|
|
114
|
-
doc.setNew();
|
|
115
|
-
delete data.value.branch;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const formatParams = [
|
|
119
|
-
{
|
|
120
|
-
placeholder: "[0000]",
|
|
121
|
-
description: "0001 displays the transaction numbering.",
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
placeholder: "{YYYY}",
|
|
125
|
-
description: "Displays 4-digit current year (e.g., 2025-9999).",
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
placeholder: "{YY}",
|
|
129
|
-
description: "Displays 2-digit current year (e.g., 25).",
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
placeholder: "{MM}",
|
|
133
|
-
description: "Displays 2-digit current month (e.g., 01-12).",
|
|
134
|
-
},
|
|
135
|
-
{ placeholder: "{ddd}", description: "Displays current day (e.g., Tue)." },
|
|
136
|
-
{
|
|
137
|
-
placeholder: "{DD}",
|
|
138
|
-
description: "Displays 2-digit day of the month (e.g., 01-31).",
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
placeholder: "{YYMM}",
|
|
142
|
-
description: "Displays 2-digit year and 2-digit month (e.g., 2504).",
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
placeholder: "{YYYYMM}",
|
|
146
|
-
description: "Displays 4-digit year and 2-digit month (e.g., 202504).",
|
|
147
|
-
},
|
|
148
|
-
];
|
|
149
|
-
|
|
150
|
-
const getRecord = async () => {
|
|
151
|
-
if (id.value && id.value != "new") {
|
|
152
|
-
await doc.getById(id.value);
|
|
153
|
-
} else {
|
|
154
|
-
newData();
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const docNoTypeMapping: Record<string, string> = {
|
|
159
|
-
CN: "Credit Note",
|
|
160
|
-
ANNOUNCEMENT: "Announcement",
|
|
161
|
-
ENROLL: "Enrolment",
|
|
162
|
-
INV: "Invoice",
|
|
163
|
-
PAY: "Payment",
|
|
164
|
-
REFUND: "Refund",
|
|
165
|
-
STU: "Student",
|
|
166
|
-
TEACHER: "Teacher",
|
|
167
|
-
TUITION: "Tuition Class",
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
getRecord();
|
|
171
|
-
watch(id, async () => await getRecord());
|
|
172
|
-
/************ end default methods ****************/
|
|
173
|
-
|
|
174
|
-
const actionListener = async (actionName: string) => {
|
|
175
|
-
emits("after", actionName, data.value);
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
onMounted(async () => {
|
|
179
|
-
await actionListener(FormCrudEvent.mount);
|
|
180
|
-
setTimeout(() => {
|
|
181
|
-
updateSample();
|
|
182
|
-
}, 300);
|
|
183
|
-
});
|
|
184
|
-
/************ start api methods ****************/
|
|
185
|
-
|
|
186
|
-
// const runListDocFormats = async () => {
|
|
187
|
-
// const data = {
|
|
188
|
-
// id: id.value,
|
|
189
|
-
// };
|
|
190
|
-
// const result = await doc.runListDocFormats(
|
|
191
|
-
// doctype,
|
|
192
|
-
|
|
193
|
-
// data,
|
|
194
|
-
// );
|
|
195
|
-
// };
|
|
196
|
-
/************ end api methods ****************/
|
|
197
|
-
const updateSample = () => {
|
|
198
|
-
sample.value = "Format Sample: " + previewDocNo();
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
const previewDocNo = (): string => {
|
|
202
|
-
const pattern = data.value.docNoPattern;
|
|
203
|
-
if (pattern) {
|
|
204
|
-
const numberReg: RegExp = /\[(.*?)\]/g;
|
|
205
|
-
const dateReg: RegExp = /\{(.*?)\}/g;
|
|
206
|
-
let newvalue = pattern;
|
|
207
|
-
const numberpattern = pattern.match(numberReg);
|
|
208
|
-
const datepattern = pattern.match(dateReg);
|
|
209
|
-
|
|
210
|
-
if (numberpattern && numberpattern.length > 0) {
|
|
211
|
-
const numberlength = numberpattern[0]
|
|
212
|
-
.replace("[", "")
|
|
213
|
-
.replace("]", "").length;
|
|
214
|
-
|
|
215
|
-
let nextnumber = (data.value.nextNumber ?? 0).toString();
|
|
216
|
-
|
|
217
|
-
const numberdiff = numberlength - nextnumber.length;
|
|
218
|
-
|
|
219
|
-
for (let n = 0; n < numberdiff; n++) {
|
|
220
|
-
nextnumber = "0" + nextnumber;
|
|
221
|
-
}
|
|
222
|
-
newvalue = newvalue.replace(numberpattern[0], nextnumber);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (datepattern && datepattern.length > 0) {
|
|
226
|
-
for (let d = 0; d < datepattern.length; d++) {
|
|
227
|
-
const dpattern = datepattern[d];
|
|
228
|
-
const date = new Date();
|
|
229
|
-
const formatteddate = getDayJs()().format(
|
|
230
|
-
dpattern.replace("{", "").replace("}", ""),
|
|
231
|
-
);
|
|
232
|
-
newvalue = newvalue.replace(dpattern, formatteddate);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return newvalue;
|
|
236
|
-
} else {
|
|
237
|
-
return "";
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
</script>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<LazyFormDocnoformat :_id="_id" @after="after" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script setup lang="ts">
|
|
6
|
-
/**
|
|
7
|
-
* This file was automatically generated by simpleapp generator.
|
|
8
|
-
* last change 2023-09-09
|
|
9
|
-
* author: Ks Tan
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { Docnoformat } from "~/simpleapp/generate/types";
|
|
13
|
-
const doc = useNuxtApp().$DocnoformatDoc();
|
|
14
|
-
|
|
15
|
-
const props = defineProps<{ _id: string }>();
|
|
16
|
-
const after = (actionName: string, data: Docnoformat) => {
|
|
17
|
-
switch (actionName) {
|
|
18
|
-
case "new":
|
|
19
|
-
goTo(doc.getDocName(), "new");
|
|
20
|
-
break;
|
|
21
|
-
case "create":
|
|
22
|
-
goTo(doc.getDocName(), data._id);
|
|
23
|
-
refreshDocumentList(doc.getDocName());
|
|
24
|
-
useNuxtApp().$event("CloseDialog", doc.getDocName().toLowerCase());
|
|
25
|
-
break;
|
|
26
|
-
case "update":
|
|
27
|
-
refreshDocumentList(doc.getDocName());
|
|
28
|
-
useNuxtApp().$event("CloseDialog", doc.getDocName().toLowerCase());
|
|
29
|
-
break;
|
|
30
|
-
case "delete":
|
|
31
|
-
goTo(doc.getDocName(), "new");
|
|
32
|
-
refreshDocumentList(doc.getDocName());
|
|
33
|
-
useNuxtApp().$event("CloseDialog", doc.getDocName().toLowerCase());
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
</script>
|