zet-lib 1.3.43 → 1.4.1
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/lib/Model.js +3176 -0
- package/lib/index.js +2 -0
- package/lib/views/index_ejs.txt +9 -0
- package/lib/views/indexcss_ejs.txt +2 -0
- package/lib/views/indexjs_ejs.txt +10 -0
- package/lib/views/router.txt +120 -0
- package/lib/views/view_ejs.txt +9 -0
- package/lib/views/view_layout.ejs +228 -0
- package/lib/views/zview.ejs +460 -0
- package/lib/views/zviewcss.ejs +0 -0
- package/lib/views/zviewjs.ejs +851 -0
- package/lib/zCache.js +174 -170
- package/lib/zViewGenerator.js +1064 -0
- package/package.json +1 -1
package/lib/Model.js
ADDED
|
@@ -0,0 +1,3176 @@
|
|
|
1
|
+
const Util = require("./Util");
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
properties
|
|
5
|
+
labels
|
|
6
|
+
defaultValues
|
|
7
|
+
attributes
|
|
8
|
+
validations
|
|
9
|
+
*/
|
|
10
|
+
const Model = {};
|
|
11
|
+
|
|
12
|
+
Model.buildWidget = (fieldName, name, values = {}) => {
|
|
13
|
+
let html = "";
|
|
14
|
+
let properties = Model[name].properties || [];
|
|
15
|
+
let typies = Model[name].typies;
|
|
16
|
+
if (properties.length) {
|
|
17
|
+
let labels = Model[name].labels;
|
|
18
|
+
properties.map((item) => {
|
|
19
|
+
let value = !values[item]
|
|
20
|
+
? Model[name].defaultValues[item]
|
|
21
|
+
: values[item];
|
|
22
|
+
const tag = !typies[item].tag ? "" : typies[item].tag;
|
|
23
|
+
const type = !typies[item].type ? "" : typies[item].type;
|
|
24
|
+
|
|
25
|
+
if (tag == "array") {
|
|
26
|
+
html += `<div class="form-group divselect"><label for="${name}_${item}">${labels[item]}</label>`;
|
|
27
|
+
html += `<button type="button" class="btn btn-success btn-sm float-right select-plus" data-name="${fieldName}" data-item="${item}"><i class="fa fa-plus"></i> </button>`;
|
|
28
|
+
value.forEach(function (val, index) {
|
|
29
|
+
html += `<div class="input-group group-select"><div class="input-group-prepend">
|
|
30
|
+
<input type="number" class="form-control cvalue" placeholder="Value" value="${val.value}" name="${fieldName}[${item}][${index}][value]">
|
|
31
|
+
<input type="text" class="form-control clabel" placeholder="Label" value="${val.label}" name="${fieldName}[${item}][${index}][label]">
|
|
32
|
+
<span class="input-group-text trash-select" data-name="${fieldName}" data-item="${item}"><i class="fa fa-trash text-danger"></i> </span>
|
|
33
|
+
</div></div>`;
|
|
34
|
+
});
|
|
35
|
+
} else if (tag == "select") {
|
|
36
|
+
let dropdownOptions = "";
|
|
37
|
+
if (typies[item].dropdown) {
|
|
38
|
+
for (var key in typies[item].dropdown) {
|
|
39
|
+
const selected = value == key ? " selected " : "";
|
|
40
|
+
dropdownOptions += `<option value="${key}" ${selected}>${typies[item].dropdown[key]}</option>`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
html += `<div class="form-group"><label for="${name}_${item}">${labels[item]}</label>`;
|
|
45
|
+
html += `<select class="form-control changetableselect" data-value="${value}" id="${name}_${item}" name="${fieldName}[${item}]">${dropdownOptions}</select>`;
|
|
46
|
+
} else if (tag == "textarea") {
|
|
47
|
+
html += `<div class="form-group"><label for="${name}_${item}">${labels[item]}</label>`;
|
|
48
|
+
html += `<textarea class="form-control mb-3 editor" id="${name}_${item}" name="${fieldName}[${item}]" rows="4">${value}</textarea>`;
|
|
49
|
+
} else {
|
|
50
|
+
let checked = "";
|
|
51
|
+
if (type == "checkbox") {
|
|
52
|
+
value = !values[item] ? false : values[item];
|
|
53
|
+
checked = value ? " checked " : "";
|
|
54
|
+
html += `<div class="form-check">`;
|
|
55
|
+
html += `<input class="form-check-input" type="checkbox" id="${name}_${item}" name="${fieldName}[${item}]" ${checked} />`;
|
|
56
|
+
html += `<label class="form-check-label" for="${name}_${item}">${labels[item]}</label></div><br>`;
|
|
57
|
+
} else {
|
|
58
|
+
html += `<div class="form-group"><label for="${name}_${item}">${labels[item]}</label>`;
|
|
59
|
+
html += `<${tag} type="${type}" class="form-control" id="${name}_${item}" data-value="${value}" name="${fieldName}[${item}]" value="${value}" >`;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
html += `</div>`;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return html;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
Model.buildSQL = (table, obj) => {
|
|
71
|
+
const notnullor = obj.required ? "NOT NULL" : "NULL";
|
|
72
|
+
const sql = `ALTER TABLE "${table}" ADD COLUMN "${obj.name}" ${obj.sql} ${notnullor} AFTER id;`;
|
|
73
|
+
console.log(sql);
|
|
74
|
+
return sql;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
//available Model type
|
|
78
|
+
Model.keys = {
|
|
79
|
+
text: "Text",
|
|
80
|
+
textarea: "Textarea",
|
|
81
|
+
checkbox: "Checkbox",
|
|
82
|
+
number: "Amount",
|
|
83
|
+
integer: "Integer",
|
|
84
|
+
select: "Select (static) ",
|
|
85
|
+
relation: "Select (relation to other module)",
|
|
86
|
+
image: "Image Upload",
|
|
87
|
+
file: "File Upload",
|
|
88
|
+
dropzone: "Drop Files",
|
|
89
|
+
email: "Email",
|
|
90
|
+
password: "Password",
|
|
91
|
+
datepicker: "Date Picker",
|
|
92
|
+
datetime: "Date Time",
|
|
93
|
+
clockpicker: "Clock Picker",
|
|
94
|
+
range: "Range",
|
|
95
|
+
color: "Color Picker",
|
|
96
|
+
switch: "Switch",
|
|
97
|
+
tags: "Tags",
|
|
98
|
+
editor: "Editor",
|
|
99
|
+
tinymce: "Editor Tiny MCE",
|
|
100
|
+
ide_editor: "IDE Editor (code)",
|
|
101
|
+
multi_line_editor: "Multi Line Editor",
|
|
102
|
+
radio: "Radio ",
|
|
103
|
+
typeahead: "Auto Complete",
|
|
104
|
+
dropdown_multi: "Dropdown Multi",
|
|
105
|
+
lexical: "Lexical Editor (Experimental)",
|
|
106
|
+
//dropdown_chain: "Dropdown Chain",
|
|
107
|
+
dropdown_checkbox: "Dropdown Checkbox",
|
|
108
|
+
table: "Table",
|
|
109
|
+
json: "JSON",
|
|
110
|
+
location: "Location (Google Map)",
|
|
111
|
+
numeric: "Numeric/Double",
|
|
112
|
+
dragdrop: "Drag Drop",
|
|
113
|
+
ltree: "LTree",
|
|
114
|
+
virtual: "Virtual Field (readonly)",
|
|
115
|
+
custom: "Custom",
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
Model.dropzone = {
|
|
119
|
+
properties: ["required", "unique", "tabindex", "hidden"],
|
|
120
|
+
labels: {
|
|
121
|
+
required: "Required",
|
|
122
|
+
unique: "Unique",
|
|
123
|
+
tabindex: "Tab Index",
|
|
124
|
+
hidden: "Hidden",
|
|
125
|
+
},
|
|
126
|
+
defaultValues: {
|
|
127
|
+
required: false,
|
|
128
|
+
unique: false,
|
|
129
|
+
tabindex: 1,
|
|
130
|
+
hidden: false,
|
|
131
|
+
},
|
|
132
|
+
typies: {
|
|
133
|
+
required: {
|
|
134
|
+
tag: "input",
|
|
135
|
+
type: "checkbox",
|
|
136
|
+
},
|
|
137
|
+
unique: {
|
|
138
|
+
tag: "input",
|
|
139
|
+
type: "checkbox",
|
|
140
|
+
},
|
|
141
|
+
tabindex: {
|
|
142
|
+
tag: "input",
|
|
143
|
+
type: "number",
|
|
144
|
+
},
|
|
145
|
+
hidden: {
|
|
146
|
+
tag: "input",
|
|
147
|
+
type: "checkbox",
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
comment: (obj) => {
|
|
151
|
+
return `json_array`;
|
|
152
|
+
},
|
|
153
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
154
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
155
|
+
let defaultValue = "";
|
|
156
|
+
if (!obj.defaultValue) {
|
|
157
|
+
defaultValue = ``;
|
|
158
|
+
} else if (obj.defaultValue == "null") {
|
|
159
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
160
|
+
} else {
|
|
161
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
162
|
+
}
|
|
163
|
+
//ALTER TABLE zuser_company ADD CONSTRAINT fk_user_company_role FOREIGN KEY (role_id) REFERENCES zrole (id);
|
|
164
|
+
return {
|
|
165
|
+
defaultValue: defaultValue,
|
|
166
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" jsonb[];`,
|
|
167
|
+
index: "",
|
|
168
|
+
foreignKey: "",
|
|
169
|
+
};
|
|
170
|
+
},
|
|
171
|
+
columnType: (obj = {}) => {
|
|
172
|
+
return `json_array`;
|
|
173
|
+
},
|
|
174
|
+
category: "json_array",
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
Model.text = {
|
|
178
|
+
properties: [
|
|
179
|
+
"required",
|
|
180
|
+
"unique",
|
|
181
|
+
"tabindex",
|
|
182
|
+
"maxlength",
|
|
183
|
+
"length",
|
|
184
|
+
"hidden",
|
|
185
|
+
"inputGroupLeft",
|
|
186
|
+
"inputGroupRight",
|
|
187
|
+
"defaultValue",
|
|
188
|
+
"information",
|
|
189
|
+
],
|
|
190
|
+
labels: {
|
|
191
|
+
required: "Required",
|
|
192
|
+
unique: "Unique",
|
|
193
|
+
tabindex: "Tab Index",
|
|
194
|
+
maxlength: "Max Length",
|
|
195
|
+
length: "Length",
|
|
196
|
+
hidden: "Hidden",
|
|
197
|
+
inputGroupLeft: "Input Group Left",
|
|
198
|
+
inputGroupRight: "Input Group Right",
|
|
199
|
+
defaultValue: "Default Value",
|
|
200
|
+
information: "Additional Information",
|
|
201
|
+
},
|
|
202
|
+
defaultValues: {
|
|
203
|
+
required: false,
|
|
204
|
+
unique: false,
|
|
205
|
+
tabindex: 1,
|
|
206
|
+
maxlength: 255,
|
|
207
|
+
length: 255,
|
|
208
|
+
hidden: false,
|
|
209
|
+
inputGroupLeft: "",
|
|
210
|
+
inputGroupRight: "",
|
|
211
|
+
defaultValue: null,
|
|
212
|
+
information: "",
|
|
213
|
+
},
|
|
214
|
+
typies: {
|
|
215
|
+
required: {
|
|
216
|
+
tag: "input",
|
|
217
|
+
type: "checkbox",
|
|
218
|
+
},
|
|
219
|
+
hidden: {
|
|
220
|
+
tag: "input",
|
|
221
|
+
type: "checkbox",
|
|
222
|
+
},
|
|
223
|
+
unique: {
|
|
224
|
+
tag: "input",
|
|
225
|
+
type: "checkbox",
|
|
226
|
+
},
|
|
227
|
+
tabindex: {
|
|
228
|
+
tag: "input",
|
|
229
|
+
type: "number",
|
|
230
|
+
},
|
|
231
|
+
maxlength: {
|
|
232
|
+
tag: "input",
|
|
233
|
+
type: "number",
|
|
234
|
+
},
|
|
235
|
+
length: {
|
|
236
|
+
tag: "input",
|
|
237
|
+
type: "number",
|
|
238
|
+
},
|
|
239
|
+
inputGroupLeft: {
|
|
240
|
+
tag: "input",
|
|
241
|
+
type: "text",
|
|
242
|
+
},
|
|
243
|
+
inputGroupRight: {
|
|
244
|
+
tag: "input",
|
|
245
|
+
type: "text",
|
|
246
|
+
},
|
|
247
|
+
defaultValue: {
|
|
248
|
+
tag: "input",
|
|
249
|
+
type: "text",
|
|
250
|
+
},
|
|
251
|
+
information: {
|
|
252
|
+
tag: "textarea",
|
|
253
|
+
type: "",
|
|
254
|
+
class: "",
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
attributes: { maxlength: "this.value" },
|
|
258
|
+
validations: {
|
|
259
|
+
maxlength: {
|
|
260
|
+
title: "Max Length",
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
comment: (obj = {}) => {
|
|
264
|
+
return ``;
|
|
265
|
+
},
|
|
266
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
267
|
+
const length = !obj.length ? 255 : obj.length;
|
|
268
|
+
const required = !obj.required ? false : true;
|
|
269
|
+
const indexing = !obj.unique
|
|
270
|
+
? ""
|
|
271
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
272
|
+
let defaultValue = "";
|
|
273
|
+
if (!obj.defaultValue) {
|
|
274
|
+
defaultValue = ``;
|
|
275
|
+
} else if (obj.defaultValue == "null") {
|
|
276
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
277
|
+
} else {
|
|
278
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
279
|
+
}
|
|
280
|
+
const addTable = `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" varchar(${obj.length});`;
|
|
281
|
+
return {
|
|
282
|
+
defaultValue: defaultValue,
|
|
283
|
+
column: addTable,
|
|
284
|
+
index: indexing,
|
|
285
|
+
foreignKey: "",
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
columnType: (obj = {}) => {
|
|
289
|
+
return `varchar(${obj.length}) `;
|
|
290
|
+
},
|
|
291
|
+
category: "text",
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
Model.checkbox = {
|
|
295
|
+
properties: ["tabindex", "defaultValue", "information"],
|
|
296
|
+
labels: {
|
|
297
|
+
tabindex: "Tab Index",
|
|
298
|
+
defaultValue: "Default Value",
|
|
299
|
+
information: "Additional Information",
|
|
300
|
+
},
|
|
301
|
+
defaultValues: {
|
|
302
|
+
tabindex: 1,
|
|
303
|
+
defaultValue: 0,
|
|
304
|
+
information: "",
|
|
305
|
+
},
|
|
306
|
+
typies: {
|
|
307
|
+
tabindex: {
|
|
308
|
+
tag: "input",
|
|
309
|
+
type: "number",
|
|
310
|
+
},
|
|
311
|
+
defaultValue: {
|
|
312
|
+
tag: "input",
|
|
313
|
+
type: "checkbox",
|
|
314
|
+
},
|
|
315
|
+
information: {
|
|
316
|
+
tag: "textarea",
|
|
317
|
+
type: "",
|
|
318
|
+
class: "",
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
comment: (obj = {}) => {
|
|
322
|
+
return ``;
|
|
323
|
+
},
|
|
324
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
325
|
+
var defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT 0;`;
|
|
326
|
+
return {
|
|
327
|
+
defaultValue: defaultValue,
|
|
328
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" smallint;`,
|
|
329
|
+
index: "",
|
|
330
|
+
foreignKey: "",
|
|
331
|
+
};
|
|
332
|
+
},
|
|
333
|
+
columnType: (obj = {}) => {
|
|
334
|
+
return `smallint`;
|
|
335
|
+
},
|
|
336
|
+
category: "integer",
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
Model.range = {
|
|
340
|
+
properties: [
|
|
341
|
+
"required",
|
|
342
|
+
"tabindex",
|
|
343
|
+
"min",
|
|
344
|
+
"max",
|
|
345
|
+
"hidden",
|
|
346
|
+
"defaultValue",
|
|
347
|
+
"inputGroupLeft",
|
|
348
|
+
"inputGroupRight",
|
|
349
|
+
"information",
|
|
350
|
+
],
|
|
351
|
+
attributes: ["min", "max"],
|
|
352
|
+
labels: {
|
|
353
|
+
required: "Required",
|
|
354
|
+
tabindex: "Tab Index",
|
|
355
|
+
min: "Min",
|
|
356
|
+
max: "Max",
|
|
357
|
+
hidden: "Hidden",
|
|
358
|
+
defaultValue: "Default Value",
|
|
359
|
+
inputGroupLeft: "Input Group Left",
|
|
360
|
+
inputGroupRight: "Input Group Right",
|
|
361
|
+
information: "Additional Information",
|
|
362
|
+
},
|
|
363
|
+
defaultValues: {
|
|
364
|
+
required: false,
|
|
365
|
+
tabindex: 1,
|
|
366
|
+
min: 0,
|
|
367
|
+
max: 100,
|
|
368
|
+
hidden: false,
|
|
369
|
+
defaultValue: null,
|
|
370
|
+
inputGroupLeft: "",
|
|
371
|
+
inputGroupRight: "",
|
|
372
|
+
information: "",
|
|
373
|
+
},
|
|
374
|
+
typies: {
|
|
375
|
+
required: {
|
|
376
|
+
tag: "input",
|
|
377
|
+
type: "checkbox",
|
|
378
|
+
},
|
|
379
|
+
tabindex: {
|
|
380
|
+
tag: "input",
|
|
381
|
+
type: "number",
|
|
382
|
+
},
|
|
383
|
+
min: {
|
|
384
|
+
tag: "input",
|
|
385
|
+
type: "number",
|
|
386
|
+
},
|
|
387
|
+
max: {
|
|
388
|
+
tag: "input",
|
|
389
|
+
type: "number",
|
|
390
|
+
},
|
|
391
|
+
hidden: {
|
|
392
|
+
tag: "input",
|
|
393
|
+
type: "checkbox",
|
|
394
|
+
},
|
|
395
|
+
defaultValue: {
|
|
396
|
+
tag: "input",
|
|
397
|
+
type: "number",
|
|
398
|
+
},
|
|
399
|
+
inputGroupLeft: {
|
|
400
|
+
tag: "input",
|
|
401
|
+
type: "text",
|
|
402
|
+
},
|
|
403
|
+
inputGroupRight: {
|
|
404
|
+
tag: "input",
|
|
405
|
+
type: "text",
|
|
406
|
+
},
|
|
407
|
+
information: {
|
|
408
|
+
tag: "textarea",
|
|
409
|
+
type: "",
|
|
410
|
+
class: "",
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
comment: (obj = {}) => {
|
|
414
|
+
return `number`;
|
|
415
|
+
},
|
|
416
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
417
|
+
const required = !obj.required ? false : true;
|
|
418
|
+
let defaultValue = "";
|
|
419
|
+
if (!obj.defaultValue) {
|
|
420
|
+
defaultValue = ``;
|
|
421
|
+
} else if (obj.defaultValue == "null") {
|
|
422
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
423
|
+
} else {
|
|
424
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT ${obj.defaultValue};`;
|
|
425
|
+
}
|
|
426
|
+
const addTable = `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" numeric;`;
|
|
427
|
+
return {
|
|
428
|
+
defaultValue: defaultValue,
|
|
429
|
+
column: addTable,
|
|
430
|
+
index: "",
|
|
431
|
+
foreignKey: "",
|
|
432
|
+
};
|
|
433
|
+
},
|
|
434
|
+
columnType: (obj = {}) => {
|
|
435
|
+
return `numeric`;
|
|
436
|
+
},
|
|
437
|
+
category: "integer",
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
Model.tags = {
|
|
441
|
+
properties: ["required", "tabindex", "defaultValue", "information"],
|
|
442
|
+
labels: {
|
|
443
|
+
required: "Required",
|
|
444
|
+
tabindex: "Tab Index",
|
|
445
|
+
defaultValue: "Default Value",
|
|
446
|
+
information: "Additional Information",
|
|
447
|
+
},
|
|
448
|
+
defaultValues: {
|
|
449
|
+
required: false,
|
|
450
|
+
tabindex: 1,
|
|
451
|
+
defaultValue: null,
|
|
452
|
+
information: "",
|
|
453
|
+
},
|
|
454
|
+
typies: {
|
|
455
|
+
required: {
|
|
456
|
+
tag: "input",
|
|
457
|
+
type: "checkbox",
|
|
458
|
+
},
|
|
459
|
+
tabindex: {
|
|
460
|
+
tag: "input",
|
|
461
|
+
type: "number",
|
|
462
|
+
},
|
|
463
|
+
defaultValue: {
|
|
464
|
+
tag: "input",
|
|
465
|
+
type: "text",
|
|
466
|
+
},
|
|
467
|
+
information: {
|
|
468
|
+
tag: "textarea",
|
|
469
|
+
type: "",
|
|
470
|
+
class: "",
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
comment: (obj = {}) => {
|
|
474
|
+
return ``;
|
|
475
|
+
},
|
|
476
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
477
|
+
const defaultValue = "";
|
|
478
|
+
return {
|
|
479
|
+
defaultValue: defaultValue,
|
|
480
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" JSON ;`,
|
|
481
|
+
index: "",
|
|
482
|
+
foreignKey: "",
|
|
483
|
+
};
|
|
484
|
+
},
|
|
485
|
+
columnType: (obj = {}) => {
|
|
486
|
+
return `JSON `;
|
|
487
|
+
},
|
|
488
|
+
category: "json",
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
Model.textarea = {
|
|
492
|
+
properties: [
|
|
493
|
+
"required",
|
|
494
|
+
"tabindex",
|
|
495
|
+
"rows",
|
|
496
|
+
"hidden",
|
|
497
|
+
"defaultValue",
|
|
498
|
+
"inputGroupLeft",
|
|
499
|
+
"inputGroupRight",
|
|
500
|
+
"information",
|
|
501
|
+
"hidden",
|
|
502
|
+
],
|
|
503
|
+
labels: {
|
|
504
|
+
required: "Required",
|
|
505
|
+
tabindex: "Tab Index",
|
|
506
|
+
rows: "Rows",
|
|
507
|
+
hidden: "Hidden",
|
|
508
|
+
defaultValue: "Default Value",
|
|
509
|
+
inputGroupLeft: "Input Group Left",
|
|
510
|
+
inputGroupRight: "Input Group Right",
|
|
511
|
+
information: "Additional Information",
|
|
512
|
+
hidden: "Hidden",
|
|
513
|
+
},
|
|
514
|
+
defaultValues: {
|
|
515
|
+
required: false,
|
|
516
|
+
tabindex: 1,
|
|
517
|
+
rows: 3,
|
|
518
|
+
hidden: false,
|
|
519
|
+
defaultValue: null,
|
|
520
|
+
inputGroupLeft: "",
|
|
521
|
+
inputGroupRight: "",
|
|
522
|
+
information: "",
|
|
523
|
+
hidden: false,
|
|
524
|
+
},
|
|
525
|
+
typies: {
|
|
526
|
+
required: {
|
|
527
|
+
tag: "input",
|
|
528
|
+
type: "checkbox",
|
|
529
|
+
},
|
|
530
|
+
tabindex: {
|
|
531
|
+
tag: "input",
|
|
532
|
+
type: "number",
|
|
533
|
+
},
|
|
534
|
+
rows: {
|
|
535
|
+
tag: "input",
|
|
536
|
+
type: "number",
|
|
537
|
+
},
|
|
538
|
+
hidden: {
|
|
539
|
+
tag: "input",
|
|
540
|
+
type: "checkbox",
|
|
541
|
+
},
|
|
542
|
+
defaultValue: {
|
|
543
|
+
tag: "input",
|
|
544
|
+
type: "text",
|
|
545
|
+
},
|
|
546
|
+
inputGroupLeft: {
|
|
547
|
+
tag: "input",
|
|
548
|
+
type: "text",
|
|
549
|
+
},
|
|
550
|
+
inputGroupRight: {
|
|
551
|
+
tag: "input",
|
|
552
|
+
type: "text",
|
|
553
|
+
},
|
|
554
|
+
information: {
|
|
555
|
+
tag: "textarea",
|
|
556
|
+
type: "",
|
|
557
|
+
class: "",
|
|
558
|
+
},
|
|
559
|
+
hidden: {
|
|
560
|
+
tag: "input",
|
|
561
|
+
type: "checkbox",
|
|
562
|
+
},
|
|
563
|
+
},
|
|
564
|
+
attributes: { rows: "this.value" },
|
|
565
|
+
comment: (obj = {}) => {
|
|
566
|
+
return ``;
|
|
567
|
+
},
|
|
568
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
569
|
+
const required = !obj.required ? false : true;
|
|
570
|
+
let defaultValue = "";
|
|
571
|
+
if (!obj.defaultValue) {
|
|
572
|
+
defaultValue = ``;
|
|
573
|
+
} else if (obj.defaultValue == "null") {
|
|
574
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
575
|
+
} else {
|
|
576
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
577
|
+
}
|
|
578
|
+
const addTable = `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" text;`;
|
|
579
|
+
return {
|
|
580
|
+
defaultValue: defaultValue,
|
|
581
|
+
column: addTable,
|
|
582
|
+
index: "",
|
|
583
|
+
foreignKey: "",
|
|
584
|
+
};
|
|
585
|
+
},
|
|
586
|
+
columnType: (obj = {}) => {
|
|
587
|
+
return `text`;
|
|
588
|
+
},
|
|
589
|
+
category: "text",
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
Model.email = {
|
|
593
|
+
properties: [
|
|
594
|
+
"required",
|
|
595
|
+
"unique",
|
|
596
|
+
"tabindex",
|
|
597
|
+
"hidden",
|
|
598
|
+
"defaultValue",
|
|
599
|
+
"inputGroupLeft",
|
|
600
|
+
"inputGroupRight",
|
|
601
|
+
"information",
|
|
602
|
+
],
|
|
603
|
+
labels: {
|
|
604
|
+
required: "Required",
|
|
605
|
+
unique: "Unique",
|
|
606
|
+
tabindex: "Tab Index",
|
|
607
|
+
hidden: "Hidden",
|
|
608
|
+
defaultValue: "Default Value",
|
|
609
|
+
inputGroupLeft: "Input Group Left",
|
|
610
|
+
inputGroupRight: "Input Group Right",
|
|
611
|
+
information: "Additional Information",
|
|
612
|
+
},
|
|
613
|
+
defaultValues: {
|
|
614
|
+
required: false,
|
|
615
|
+
unique: false,
|
|
616
|
+
tabindex: 1,
|
|
617
|
+
hidden: false,
|
|
618
|
+
defaultValue: null,
|
|
619
|
+
inputGroupLeft: "",
|
|
620
|
+
inputGroupRight: "",
|
|
621
|
+
information: "",
|
|
622
|
+
},
|
|
623
|
+
typies: {
|
|
624
|
+
required: {
|
|
625
|
+
tag: "input",
|
|
626
|
+
type: "checkbox",
|
|
627
|
+
},
|
|
628
|
+
unique: {
|
|
629
|
+
tag: "input",
|
|
630
|
+
type: "checkbox",
|
|
631
|
+
},
|
|
632
|
+
tabindex: {
|
|
633
|
+
tag: "input",
|
|
634
|
+
type: "number",
|
|
635
|
+
},
|
|
636
|
+
hidden: {
|
|
637
|
+
tag: "input",
|
|
638
|
+
type: "checkbox",
|
|
639
|
+
},
|
|
640
|
+
defaultValue: {
|
|
641
|
+
tag: "input",
|
|
642
|
+
type: "text",
|
|
643
|
+
},
|
|
644
|
+
inputGroupLeft: {
|
|
645
|
+
tag: "input",
|
|
646
|
+
type: "text",
|
|
647
|
+
},
|
|
648
|
+
inputGroupRight: {
|
|
649
|
+
tag: "input",
|
|
650
|
+
type: "text",
|
|
651
|
+
},
|
|
652
|
+
information: {
|
|
653
|
+
tag: "textarea",
|
|
654
|
+
type: "",
|
|
655
|
+
class: "",
|
|
656
|
+
},
|
|
657
|
+
},
|
|
658
|
+
attributes: { type: "email" },
|
|
659
|
+
comment: (obj = {}) => {
|
|
660
|
+
return ``;
|
|
661
|
+
},
|
|
662
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
663
|
+
const required = !obj.required ? false : true;
|
|
664
|
+
const indexing = !obj.unique
|
|
665
|
+
? ""
|
|
666
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
667
|
+
let defaultValue = "";
|
|
668
|
+
if (!obj.defaultValue) {
|
|
669
|
+
defaultValue = ``;
|
|
670
|
+
} else if (obj.defaultValue == "null") {
|
|
671
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
672
|
+
} else {
|
|
673
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
674
|
+
}
|
|
675
|
+
const addTable = `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" varchar(50);`;
|
|
676
|
+
return {
|
|
677
|
+
defaultValue: defaultValue,
|
|
678
|
+
column: addTable,
|
|
679
|
+
index: indexing,
|
|
680
|
+
foreignKey: "",
|
|
681
|
+
};
|
|
682
|
+
},
|
|
683
|
+
columnType: (obj = {}) => {
|
|
684
|
+
return `varchar(50)`;
|
|
685
|
+
},
|
|
686
|
+
category: "text",
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
Model.color = {
|
|
690
|
+
properties: [
|
|
691
|
+
"required",
|
|
692
|
+
"unique",
|
|
693
|
+
"tabindex",
|
|
694
|
+
"length",
|
|
695
|
+
"hidden",
|
|
696
|
+
"defaultValue",
|
|
697
|
+
"information",
|
|
698
|
+
],
|
|
699
|
+
labels: {
|
|
700
|
+
required: "Required",
|
|
701
|
+
unique: "Unique",
|
|
702
|
+
tabindex: "Tab Index",
|
|
703
|
+
length: "Length",
|
|
704
|
+
hidden: "Hidden",
|
|
705
|
+
defaultValue: "Default Value",
|
|
706
|
+
information: "Additional Information",
|
|
707
|
+
},
|
|
708
|
+
defaultValues: {
|
|
709
|
+
required: false,
|
|
710
|
+
unique: false,
|
|
711
|
+
tabindex: 1,
|
|
712
|
+
length: 20,
|
|
713
|
+
hidden: false,
|
|
714
|
+
defaultValue: null,
|
|
715
|
+
information: "",
|
|
716
|
+
},
|
|
717
|
+
typies: {
|
|
718
|
+
required: {
|
|
719
|
+
tag: "input",
|
|
720
|
+
type: "checkbox",
|
|
721
|
+
},
|
|
722
|
+
hidden: {
|
|
723
|
+
tag: "input",
|
|
724
|
+
type: "checkbox",
|
|
725
|
+
},
|
|
726
|
+
unique: {
|
|
727
|
+
tag: "input",
|
|
728
|
+
type: "checkbox",
|
|
729
|
+
},
|
|
730
|
+
tabindex: {
|
|
731
|
+
tag: "input",
|
|
732
|
+
type: "number",
|
|
733
|
+
},
|
|
734
|
+
length: {
|
|
735
|
+
tag: "input",
|
|
736
|
+
type: "number",
|
|
737
|
+
},
|
|
738
|
+
defaultValue: {
|
|
739
|
+
tag: "input",
|
|
740
|
+
type: "text",
|
|
741
|
+
},
|
|
742
|
+
information: {
|
|
743
|
+
tag: "textarea",
|
|
744
|
+
type: "",
|
|
745
|
+
class: "",
|
|
746
|
+
},
|
|
747
|
+
},
|
|
748
|
+
comment: (obj = {}) => {
|
|
749
|
+
return ``;
|
|
750
|
+
},
|
|
751
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
752
|
+
const length = 20;
|
|
753
|
+
const required = !obj.required ? false : true;
|
|
754
|
+
const indexing = !obj.unique
|
|
755
|
+
? ""
|
|
756
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
757
|
+
const defaultValue = "";
|
|
758
|
+
return {
|
|
759
|
+
defaultValue: defaultValue,
|
|
760
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" varchar(${obj.length});`,
|
|
761
|
+
index: indexing,
|
|
762
|
+
foreignKey: "",
|
|
763
|
+
};
|
|
764
|
+
},
|
|
765
|
+
columnType: (obj = {}) => {
|
|
766
|
+
return `varchar(20) `;
|
|
767
|
+
},
|
|
768
|
+
category: "text",
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
Model.password = {
|
|
772
|
+
properties: ["required", "tabindex", "hidden", "information"],
|
|
773
|
+
labels: {
|
|
774
|
+
required: "Required",
|
|
775
|
+
tabindex: "Tab Index",
|
|
776
|
+
hidden: "Hidden",
|
|
777
|
+
information: "Additional Information",
|
|
778
|
+
},
|
|
779
|
+
defaultValues: {
|
|
780
|
+
required: false,
|
|
781
|
+
tabindex: 1,
|
|
782
|
+
hidden: false,
|
|
783
|
+
information: "",
|
|
784
|
+
},
|
|
785
|
+
typies: {
|
|
786
|
+
required: {
|
|
787
|
+
tag: "input",
|
|
788
|
+
type: "checkbox",
|
|
789
|
+
},
|
|
790
|
+
tabindex: {
|
|
791
|
+
tag: "input",
|
|
792
|
+
type: "email",
|
|
793
|
+
},
|
|
794
|
+
hidden: {
|
|
795
|
+
tag: "input",
|
|
796
|
+
type: "checkbox",
|
|
797
|
+
},
|
|
798
|
+
information: {
|
|
799
|
+
tag: "textarea",
|
|
800
|
+
type: "",
|
|
801
|
+
class: "",
|
|
802
|
+
},
|
|
803
|
+
},
|
|
804
|
+
attributes: { type: "password" },
|
|
805
|
+
comment: (obj = {}) => {
|
|
806
|
+
return ``;
|
|
807
|
+
},
|
|
808
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
809
|
+
const required = !obj.required ? false : true;
|
|
810
|
+
const defaultValue = "";
|
|
811
|
+
const addTable = `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" varchar(255);`;
|
|
812
|
+
return {
|
|
813
|
+
defaultValue: defaultValue,
|
|
814
|
+
column: addTable,
|
|
815
|
+
index: "",
|
|
816
|
+
foreignKey: "",
|
|
817
|
+
};
|
|
818
|
+
},
|
|
819
|
+
columnType: (obj = {}) => {
|
|
820
|
+
return `varchar(255)`;
|
|
821
|
+
},
|
|
822
|
+
category: "text",
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
Model.number = {
|
|
826
|
+
properties: [
|
|
827
|
+
"required",
|
|
828
|
+
"unique",
|
|
829
|
+
"tabindex",
|
|
830
|
+
"min",
|
|
831
|
+
"max",
|
|
832
|
+
"hidden",
|
|
833
|
+
"defaultValue",
|
|
834
|
+
"inputGroupLeft",
|
|
835
|
+
"inputGroupRight",
|
|
836
|
+
"information",
|
|
837
|
+
],
|
|
838
|
+
attributes: ["min", "max"],
|
|
839
|
+
labels: {
|
|
840
|
+
required: "Required",
|
|
841
|
+
unique: "Unique",
|
|
842
|
+
tabindex: "Tab Index",
|
|
843
|
+
min: "Min",
|
|
844
|
+
max: "Max",
|
|
845
|
+
hidden: "Hidden",
|
|
846
|
+
defaultValue: "Default Value",
|
|
847
|
+
inputGroupLeft: "Input Group Left",
|
|
848
|
+
inputGroupRight: "Input Group Right",
|
|
849
|
+
information: "Additional Information",
|
|
850
|
+
},
|
|
851
|
+
defaultValues: {
|
|
852
|
+
required: false,
|
|
853
|
+
unique: false,
|
|
854
|
+
tabindex: 1,
|
|
855
|
+
min: 0,
|
|
856
|
+
max: 0,
|
|
857
|
+
hidden: false,
|
|
858
|
+
defaultValue: null,
|
|
859
|
+
inputGroupLeft: "",
|
|
860
|
+
inputGroupRight: "",
|
|
861
|
+
information: "",
|
|
862
|
+
},
|
|
863
|
+
typies: {
|
|
864
|
+
required: {
|
|
865
|
+
tag: "input",
|
|
866
|
+
type: "checkbox",
|
|
867
|
+
},
|
|
868
|
+
tabindex: {
|
|
869
|
+
tag: "input",
|
|
870
|
+
type: "number",
|
|
871
|
+
},
|
|
872
|
+
unique: {
|
|
873
|
+
tag: "input",
|
|
874
|
+
type: "checkbox",
|
|
875
|
+
},
|
|
876
|
+
min: {
|
|
877
|
+
tag: "input",
|
|
878
|
+
type: "number",
|
|
879
|
+
},
|
|
880
|
+
max: {
|
|
881
|
+
tag: "input",
|
|
882
|
+
type: "number",
|
|
883
|
+
},
|
|
884
|
+
hidden: {
|
|
885
|
+
tag: "input",
|
|
886
|
+
type: "checkbox",
|
|
887
|
+
},
|
|
888
|
+
defaultValue: {
|
|
889
|
+
tag: "input",
|
|
890
|
+
type: "number",
|
|
891
|
+
},
|
|
892
|
+
inputGroupLeft: {
|
|
893
|
+
tag: "input",
|
|
894
|
+
type: "text",
|
|
895
|
+
},
|
|
896
|
+
inputGroupRight: {
|
|
897
|
+
tag: "input",
|
|
898
|
+
type: "text",
|
|
899
|
+
},
|
|
900
|
+
information: {
|
|
901
|
+
tag: "textarea",
|
|
902
|
+
type: "",
|
|
903
|
+
class: "",
|
|
904
|
+
},
|
|
905
|
+
},
|
|
906
|
+
comment: (obj = {}) => {
|
|
907
|
+
return `number`;
|
|
908
|
+
},
|
|
909
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
910
|
+
const required = !obj.required ? false : true;
|
|
911
|
+
let defaultValue = "";
|
|
912
|
+
if (!obj.defaultValue) {
|
|
913
|
+
defaultValue = ``;
|
|
914
|
+
} else if (obj.defaultValue == "null") {
|
|
915
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
916
|
+
} else {
|
|
917
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT ${obj.defaultValue};`;
|
|
918
|
+
}
|
|
919
|
+
const indexing = !obj.unique
|
|
920
|
+
? ""
|
|
921
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
922
|
+
|
|
923
|
+
const addTable = `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" numeric;`;
|
|
924
|
+
return {
|
|
925
|
+
defaultValue: defaultValue,
|
|
926
|
+
column: addTable,
|
|
927
|
+
index: indexing,
|
|
928
|
+
foreignKey: "",
|
|
929
|
+
};
|
|
930
|
+
},
|
|
931
|
+
columnType: (obj = {}) => {
|
|
932
|
+
return `numeric`;
|
|
933
|
+
},
|
|
934
|
+
category: "integer",
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
Model.integer = {
|
|
938
|
+
properties: [
|
|
939
|
+
"required",
|
|
940
|
+
"unique",
|
|
941
|
+
"tabindex",
|
|
942
|
+
"min",
|
|
943
|
+
"max",
|
|
944
|
+
"hidden",
|
|
945
|
+
"defaultValue",
|
|
946
|
+
"inputGroupLeft",
|
|
947
|
+
"inputGroupRight",
|
|
948
|
+
"information",
|
|
949
|
+
],
|
|
950
|
+
attributes: ["min", "max"],
|
|
951
|
+
labels: {
|
|
952
|
+
required: "Required",
|
|
953
|
+
unique: "Unique",
|
|
954
|
+
tabindex: "Tab Index",
|
|
955
|
+
min: "Min",
|
|
956
|
+
max: "Max",
|
|
957
|
+
hidden: "Hidden",
|
|
958
|
+
defaultValue: "Default Value",
|
|
959
|
+
inputGroupLeft: "Input Group Left",
|
|
960
|
+
inputGroupRight: "Input Group Right",
|
|
961
|
+
information: "Additional Information",
|
|
962
|
+
},
|
|
963
|
+
defaultValues: {
|
|
964
|
+
required: false,
|
|
965
|
+
unique: false,
|
|
966
|
+
tabindex: 1,
|
|
967
|
+
min: 0,
|
|
968
|
+
max: 0,
|
|
969
|
+
hidden: false,
|
|
970
|
+
defaultValue: null,
|
|
971
|
+
inputGroupLeft: "",
|
|
972
|
+
inputGroupRight: "",
|
|
973
|
+
information: "",
|
|
974
|
+
},
|
|
975
|
+
typies: {
|
|
976
|
+
required: {
|
|
977
|
+
tag: "input",
|
|
978
|
+
type: "checkbox",
|
|
979
|
+
},
|
|
980
|
+
unique: {
|
|
981
|
+
tag: "input",
|
|
982
|
+
type: "checkbox",
|
|
983
|
+
},
|
|
984
|
+
tabindex: {
|
|
985
|
+
tag: "input",
|
|
986
|
+
type: "number",
|
|
987
|
+
},
|
|
988
|
+
min: {
|
|
989
|
+
tag: "input",
|
|
990
|
+
type: "number",
|
|
991
|
+
},
|
|
992
|
+
max: {
|
|
993
|
+
tag: "input",
|
|
994
|
+
type: "number",
|
|
995
|
+
},
|
|
996
|
+
hidden: {
|
|
997
|
+
tag: "input",
|
|
998
|
+
type: "checkbox",
|
|
999
|
+
},
|
|
1000
|
+
defaultValue: {
|
|
1001
|
+
tag: "input",
|
|
1002
|
+
type: "number",
|
|
1003
|
+
},
|
|
1004
|
+
inputGroupLeft: {
|
|
1005
|
+
tag: "input",
|
|
1006
|
+
type: "text",
|
|
1007
|
+
},
|
|
1008
|
+
inputGroupRight: {
|
|
1009
|
+
tag: "input",
|
|
1010
|
+
type: "text",
|
|
1011
|
+
},
|
|
1012
|
+
information: {
|
|
1013
|
+
tag: "textarea",
|
|
1014
|
+
type: "",
|
|
1015
|
+
class: "",
|
|
1016
|
+
},
|
|
1017
|
+
},
|
|
1018
|
+
comment: (obj = {}) => {
|
|
1019
|
+
return `bigint`;
|
|
1020
|
+
},
|
|
1021
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1022
|
+
const required = !obj.required ? false : true;
|
|
1023
|
+
let defaultValue = "";
|
|
1024
|
+
if (!obj.defaultValue) {
|
|
1025
|
+
defaultValue = ``;
|
|
1026
|
+
} else if (obj.defaultValue == "null") {
|
|
1027
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
1028
|
+
} else {
|
|
1029
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1030
|
+
}
|
|
1031
|
+
const addTable = `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" bigint;`;
|
|
1032
|
+
const indexing = !obj.unique
|
|
1033
|
+
? ""
|
|
1034
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
1035
|
+
|
|
1036
|
+
return {
|
|
1037
|
+
defaultValue: defaultValue,
|
|
1038
|
+
column: addTable,
|
|
1039
|
+
index: indexing,
|
|
1040
|
+
foreignKey: "",
|
|
1041
|
+
};
|
|
1042
|
+
},
|
|
1043
|
+
columnType: (obj = {}) => {
|
|
1044
|
+
return `bigint`;
|
|
1045
|
+
},
|
|
1046
|
+
category: "integer",
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
Model.numeric = {
|
|
1050
|
+
properties: [
|
|
1051
|
+
"required",
|
|
1052
|
+
"tabindex",
|
|
1053
|
+
"hidden",
|
|
1054
|
+
"defaultValue",
|
|
1055
|
+
"inputGroupLeft",
|
|
1056
|
+
"inputGroupRight",
|
|
1057
|
+
"information",
|
|
1058
|
+
],
|
|
1059
|
+
labels: {
|
|
1060
|
+
required: "Required",
|
|
1061
|
+
tabindex: "Tab Index",
|
|
1062
|
+
hidden: "Hidden",
|
|
1063
|
+
defaultValue: "Default Value",
|
|
1064
|
+
inputGroupLeft: "Input Group Left",
|
|
1065
|
+
inputGroupRight: "Input Group Right",
|
|
1066
|
+
information: "Additional Information",
|
|
1067
|
+
},
|
|
1068
|
+
defaultValues: {
|
|
1069
|
+
required: false,
|
|
1070
|
+
tabindex: 1,
|
|
1071
|
+
hidden: false,
|
|
1072
|
+
defaultValue: null,
|
|
1073
|
+
inputGroupLeft: "",
|
|
1074
|
+
inputGroupRight: "",
|
|
1075
|
+
information: "",
|
|
1076
|
+
},
|
|
1077
|
+
typies: {
|
|
1078
|
+
required: {
|
|
1079
|
+
tag: "input",
|
|
1080
|
+
type: "checkbox",
|
|
1081
|
+
},
|
|
1082
|
+
tabindex: {
|
|
1083
|
+
tag: "input",
|
|
1084
|
+
type: "number",
|
|
1085
|
+
},
|
|
1086
|
+
hidden: {
|
|
1087
|
+
tag: "input",
|
|
1088
|
+
type: "checkbox",
|
|
1089
|
+
},
|
|
1090
|
+
defaultValue: {
|
|
1091
|
+
tag: "input",
|
|
1092
|
+
type: "number",
|
|
1093
|
+
},
|
|
1094
|
+
inputGroupLeft: {
|
|
1095
|
+
tag: "input",
|
|
1096
|
+
type: "text",
|
|
1097
|
+
},
|
|
1098
|
+
inputGroupRight: {
|
|
1099
|
+
tag: "input",
|
|
1100
|
+
type: "text",
|
|
1101
|
+
},
|
|
1102
|
+
information: {
|
|
1103
|
+
tag: "textarea",
|
|
1104
|
+
type: "",
|
|
1105
|
+
class: "",
|
|
1106
|
+
},
|
|
1107
|
+
},
|
|
1108
|
+
comment: (obj = {}) => {
|
|
1109
|
+
return `numeric`;
|
|
1110
|
+
},
|
|
1111
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1112
|
+
const required = !obj.required ? false : true;
|
|
1113
|
+
let defaultValue = "";
|
|
1114
|
+
if (!obj.defaultValue) {
|
|
1115
|
+
defaultValue = ``;
|
|
1116
|
+
} else if (obj.defaultValue == "null") {
|
|
1117
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
1118
|
+
} else {
|
|
1119
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1120
|
+
}
|
|
1121
|
+
const addTable = `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" numeric;`;
|
|
1122
|
+
return {
|
|
1123
|
+
defaultValue: defaultValue,
|
|
1124
|
+
column: addTable,
|
|
1125
|
+
index: "",
|
|
1126
|
+
foreignKey: "",
|
|
1127
|
+
};
|
|
1128
|
+
},
|
|
1129
|
+
columnType: (obj = {}) => {
|
|
1130
|
+
return `numeric`;
|
|
1131
|
+
},
|
|
1132
|
+
category: "numeric",
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
Model.image = {
|
|
1136
|
+
properties: ["required", "tabindex"],
|
|
1137
|
+
labels: {
|
|
1138
|
+
required: "Required",
|
|
1139
|
+
tabindex: "Tab Index",
|
|
1140
|
+
},
|
|
1141
|
+
defaultValues: {
|
|
1142
|
+
required: false,
|
|
1143
|
+
tabindex: 1,
|
|
1144
|
+
},
|
|
1145
|
+
typies: {
|
|
1146
|
+
required: {
|
|
1147
|
+
tag: "input",
|
|
1148
|
+
type: "checkbox",
|
|
1149
|
+
},
|
|
1150
|
+
tabindex: {
|
|
1151
|
+
tag: "input",
|
|
1152
|
+
type: "number",
|
|
1153
|
+
},
|
|
1154
|
+
},
|
|
1155
|
+
comment: (obj = {}) => {
|
|
1156
|
+
return `image`;
|
|
1157
|
+
},
|
|
1158
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1159
|
+
const required = !obj.required ? false : true;
|
|
1160
|
+
let defaultValue = "";
|
|
1161
|
+
if (!obj.defaultValue) {
|
|
1162
|
+
defaultValue = ``;
|
|
1163
|
+
} else if (obj.defaultValue == "null") {
|
|
1164
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
1165
|
+
} else {
|
|
1166
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1167
|
+
}
|
|
1168
|
+
const addTable = `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" varchar(255);`;
|
|
1169
|
+
return {
|
|
1170
|
+
defaultValue: defaultValue,
|
|
1171
|
+
column: addTable,
|
|
1172
|
+
index: "",
|
|
1173
|
+
foreignKey: "",
|
|
1174
|
+
};
|
|
1175
|
+
},
|
|
1176
|
+
columnType: (obj = {}) => {
|
|
1177
|
+
return `varchar(255) `;
|
|
1178
|
+
},
|
|
1179
|
+
category: "text",
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
Model.file = {
|
|
1183
|
+
properties: ["required", "tabindex", "information"],
|
|
1184
|
+
labels: {
|
|
1185
|
+
required: "Required",
|
|
1186
|
+
tabindex: "Tab Index",
|
|
1187
|
+
information: "Additional Information",
|
|
1188
|
+
},
|
|
1189
|
+
defaultValues: {
|
|
1190
|
+
required: false,
|
|
1191
|
+
tabindex: 1,
|
|
1192
|
+
information: "",
|
|
1193
|
+
},
|
|
1194
|
+
typies: {
|
|
1195
|
+
required: {
|
|
1196
|
+
tag: "input",
|
|
1197
|
+
type: "checkbox",
|
|
1198
|
+
},
|
|
1199
|
+
tabindex: {
|
|
1200
|
+
tag: "input",
|
|
1201
|
+
type: "number",
|
|
1202
|
+
},
|
|
1203
|
+
information: {
|
|
1204
|
+
tag: "textarea",
|
|
1205
|
+
type: "",
|
|
1206
|
+
class: "",
|
|
1207
|
+
},
|
|
1208
|
+
},
|
|
1209
|
+
comment: (obj = {}) => {
|
|
1210
|
+
return `module_file`;
|
|
1211
|
+
},
|
|
1212
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1213
|
+
const required = !obj.required ? false : true;
|
|
1214
|
+
let defaultValue = "";
|
|
1215
|
+
if (!obj.defaultValue) {
|
|
1216
|
+
defaultValue = ``;
|
|
1217
|
+
} else if (obj.defaultValue == "null") {
|
|
1218
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET NULL;`;
|
|
1219
|
+
} else {
|
|
1220
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET ${obj.defaultValue};`;
|
|
1221
|
+
}
|
|
1222
|
+
var addTable = `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" varchar(255);`;
|
|
1223
|
+
return {
|
|
1224
|
+
defaultValue: defaultValue,
|
|
1225
|
+
column: addTable,
|
|
1226
|
+
index: "",
|
|
1227
|
+
foreignKey: "",
|
|
1228
|
+
};
|
|
1229
|
+
},
|
|
1230
|
+
columnType: (obj = {}) => {
|
|
1231
|
+
return `varchar(255) `;
|
|
1232
|
+
},
|
|
1233
|
+
category: "text",
|
|
1234
|
+
};
|
|
1235
|
+
|
|
1236
|
+
Model.datepicker = {
|
|
1237
|
+
properties: [
|
|
1238
|
+
"required",
|
|
1239
|
+
"unique",
|
|
1240
|
+
"tabindex",
|
|
1241
|
+
"format",
|
|
1242
|
+
"information",
|
|
1243
|
+
"hidden",
|
|
1244
|
+
],
|
|
1245
|
+
labels: {
|
|
1246
|
+
required: "Required",
|
|
1247
|
+
unique: "Unique",
|
|
1248
|
+
tabindex: "Tab Index",
|
|
1249
|
+
hidden: "Hidden",
|
|
1250
|
+
format:
|
|
1251
|
+
"Format <a href='https://momentjs.com/docs/#/displaying/format/' target='blank'>Example Format</a>",
|
|
1252
|
+
information: "Additional Information",
|
|
1253
|
+
},
|
|
1254
|
+
defaultValues: {
|
|
1255
|
+
required: false,
|
|
1256
|
+
unique: false,
|
|
1257
|
+
tabindex: 1,
|
|
1258
|
+
format: "YYYY-MM-DD",
|
|
1259
|
+
information: "",
|
|
1260
|
+
hidden: false,
|
|
1261
|
+
},
|
|
1262
|
+
typies: {
|
|
1263
|
+
required: {
|
|
1264
|
+
tag: "input",
|
|
1265
|
+
type: "checkbox",
|
|
1266
|
+
},
|
|
1267
|
+
unique: {
|
|
1268
|
+
tag: "input",
|
|
1269
|
+
type: "checkbox",
|
|
1270
|
+
},
|
|
1271
|
+
tabindex: {
|
|
1272
|
+
tag: "input",
|
|
1273
|
+
type: "number",
|
|
1274
|
+
},
|
|
1275
|
+
hidden: {
|
|
1276
|
+
tag: "input",
|
|
1277
|
+
type: "checkbox",
|
|
1278
|
+
},
|
|
1279
|
+
format: {
|
|
1280
|
+
tag: "select",
|
|
1281
|
+
type: "",
|
|
1282
|
+
dropdown: {
|
|
1283
|
+
"YYYY-MM-DD": "2021-12-31",
|
|
1284
|
+
"YYYY MM DD": "2021 12 31",
|
|
1285
|
+
"YYYY MMM DD": "2021 Dec 31",
|
|
1286
|
+
"YYYY MMMM DD": "2021 December 31",
|
|
1287
|
+
"DD-MM-YYYY": "31-12-2021",
|
|
1288
|
+
"DD MM YYYY": "31 12 2021",
|
|
1289
|
+
"DD MMM YYYY": "31 Dec 2021",
|
|
1290
|
+
"DD MMMM YYYY": "31 December 2021",
|
|
1291
|
+
"dd YYYY MM DD": "Su 2021 12 31",
|
|
1292
|
+
"ddd YYYY MM DD": "Sun 2021 12 31",
|
|
1293
|
+
"dddd YYYY MM DD": "Sunday 2021 12 31",
|
|
1294
|
+
"DD MMM YYYY ddd": "31 Dec 2021 sun",
|
|
1295
|
+
"DD MM YYYY ddd": "31 12 2021 sun",
|
|
1296
|
+
"YYYY MMM DD": "sun 2021 Dec 31",
|
|
1297
|
+
},
|
|
1298
|
+
},
|
|
1299
|
+
information: {
|
|
1300
|
+
tag: "textarea",
|
|
1301
|
+
type: "",
|
|
1302
|
+
class: "",
|
|
1303
|
+
},
|
|
1304
|
+
},
|
|
1305
|
+
comment: (obj = {}) => {
|
|
1306
|
+
return `datepicker`;
|
|
1307
|
+
},
|
|
1308
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1309
|
+
const required = !obj.required ? false : true;
|
|
1310
|
+
const indexing = !obj.unique
|
|
1311
|
+
? ""
|
|
1312
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
1313
|
+
let defaultValue = "";
|
|
1314
|
+
if (!obj.defaultValue) {
|
|
1315
|
+
defaultValue = ``;
|
|
1316
|
+
} else if (obj.defaultValue == "null") {
|
|
1317
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
1318
|
+
} else {
|
|
1319
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1320
|
+
}
|
|
1321
|
+
return {
|
|
1322
|
+
defaultValue: defaultValue,
|
|
1323
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" date;`,
|
|
1324
|
+
index: indexing,
|
|
1325
|
+
foreignKey: "",
|
|
1326
|
+
};
|
|
1327
|
+
},
|
|
1328
|
+
columnType: (obj = {}) => {
|
|
1329
|
+
return `date`;
|
|
1330
|
+
},
|
|
1331
|
+
category: "date",
|
|
1332
|
+
};
|
|
1333
|
+
|
|
1334
|
+
Model.datetime = {
|
|
1335
|
+
properties: [
|
|
1336
|
+
"required",
|
|
1337
|
+
"unique",
|
|
1338
|
+
"tabindex",
|
|
1339
|
+
"hidden",
|
|
1340
|
+
"format",
|
|
1341
|
+
"information",
|
|
1342
|
+
"defaultValue"
|
|
1343
|
+
],
|
|
1344
|
+
labels: {
|
|
1345
|
+
required: "Required",
|
|
1346
|
+
unique: "Unique",
|
|
1347
|
+
tabindex: "Tab Index",
|
|
1348
|
+
hidden: "Hidden",
|
|
1349
|
+
defaultValue: "Default Value",
|
|
1350
|
+
format:
|
|
1351
|
+
"Format <a href='https://momentjs.com/docs/#/displaying/format/' target='blank'>Example Format</a>",
|
|
1352
|
+
information: "Additional Information, you can set default to CURRENT_TIMESTAMP",
|
|
1353
|
+
},
|
|
1354
|
+
defaultValues: {
|
|
1355
|
+
required: false,
|
|
1356
|
+
unique: false,
|
|
1357
|
+
tabindex: 1,
|
|
1358
|
+
hidden: false,
|
|
1359
|
+
format: "YYYY-MM-DD HH:mm:ss",
|
|
1360
|
+
information: "",
|
|
1361
|
+
defaultValue: null,
|
|
1362
|
+
},
|
|
1363
|
+
typies: {
|
|
1364
|
+
required: {
|
|
1365
|
+
tag: "input",
|
|
1366
|
+
type: "checkbox",
|
|
1367
|
+
},
|
|
1368
|
+
unique: {
|
|
1369
|
+
tag: "input",
|
|
1370
|
+
type: "checkbox",
|
|
1371
|
+
},
|
|
1372
|
+
tabindex: {
|
|
1373
|
+
tag: "input",
|
|
1374
|
+
type: "number",
|
|
1375
|
+
},
|
|
1376
|
+
hidden: {
|
|
1377
|
+
tag: "input",
|
|
1378
|
+
type: "checkbox",
|
|
1379
|
+
},
|
|
1380
|
+
defaultValue: {
|
|
1381
|
+
tag: "input",
|
|
1382
|
+
type: "text",
|
|
1383
|
+
},
|
|
1384
|
+
format: {
|
|
1385
|
+
tag: "select",
|
|
1386
|
+
type: "",
|
|
1387
|
+
dropdown: {
|
|
1388
|
+
"YYYY-MM-DD HH:mm:ss": "2021-12-31 09:15:21",
|
|
1389
|
+
"YYYY MM DD HH:mm": "2021 12 31 09:15",
|
|
1390
|
+
"YYYY MMM DD HH mm": "2021 Dec 31 09 15",
|
|
1391
|
+
"YYYY MMMM DD HH:mm": "2021 December 31 09:15",
|
|
1392
|
+
"DD-MM-YYYY HH:mm:ss": "31-12-2021 09:15:21",
|
|
1393
|
+
"DD MM YYYY HH:mm:ss": "31 12 2021 09:15:21",
|
|
1394
|
+
"DD MMM YYYY HH:mm:ss": "31 Dec 2021 09:15:21",
|
|
1395
|
+
"DD MMMM YYYY HH:mm:ss": "31 December 2021 09:15:21",
|
|
1396
|
+
"dd YYYY MM DD HH:mm:ss": "Su 2021 12 31 09:15:21",
|
|
1397
|
+
"ddd YYYY MM DD HH:mm:ss": "Sun 2021 12 31 09:15:21",
|
|
1398
|
+
"dddd YYYY MM DD HH:mm:ss": "Sunday 2021 12 31 09:15:21",
|
|
1399
|
+
},
|
|
1400
|
+
},
|
|
1401
|
+
information: {
|
|
1402
|
+
tag: "textarea",
|
|
1403
|
+
type: "",
|
|
1404
|
+
class: "",
|
|
1405
|
+
},
|
|
1406
|
+
},
|
|
1407
|
+
comment: (obj = {}) => {
|
|
1408
|
+
return ``;
|
|
1409
|
+
},
|
|
1410
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1411
|
+
const indexing = !obj.unique
|
|
1412
|
+
? ""
|
|
1413
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
1414
|
+
let defaultValue = "";
|
|
1415
|
+
if (!obj.defaultValue) {
|
|
1416
|
+
defaultValue = ``;
|
|
1417
|
+
} else if (obj.defaultValue == "null") {
|
|
1418
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
1419
|
+
} else {
|
|
1420
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1421
|
+
}
|
|
1422
|
+
return {
|
|
1423
|
+
defaultValue: defaultValue,
|
|
1424
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" TIMESTAMP WITH TIME ZONE DEFAULT ${obj.defaultValue};`,
|
|
1425
|
+
index: indexing,
|
|
1426
|
+
foreignKey: "",
|
|
1427
|
+
};
|
|
1428
|
+
},
|
|
1429
|
+
columnType: (obj = {}) => {
|
|
1430
|
+
return `datetime`;
|
|
1431
|
+
},
|
|
1432
|
+
category: "datetime",
|
|
1433
|
+
};
|
|
1434
|
+
|
|
1435
|
+
Model.clockpicker = {
|
|
1436
|
+
properties: ["required", "unique", "tabindex", "information"],
|
|
1437
|
+
labels: {
|
|
1438
|
+
required: "Required",
|
|
1439
|
+
unique: "Unique",
|
|
1440
|
+
tabindex: "Tab Index",
|
|
1441
|
+
information: "Additional Information",
|
|
1442
|
+
},
|
|
1443
|
+
defaultValues: {
|
|
1444
|
+
required: false,
|
|
1445
|
+
unique: false,
|
|
1446
|
+
tabindex: 1,
|
|
1447
|
+
information: "",
|
|
1448
|
+
},
|
|
1449
|
+
typies: {
|
|
1450
|
+
required: {
|
|
1451
|
+
tag: "input",
|
|
1452
|
+
type: "checkbox",
|
|
1453
|
+
},
|
|
1454
|
+
unique: {
|
|
1455
|
+
tag: "input",
|
|
1456
|
+
type: "checkbox",
|
|
1457
|
+
},
|
|
1458
|
+
tabindex: {
|
|
1459
|
+
tag: "input",
|
|
1460
|
+
type: "number",
|
|
1461
|
+
},
|
|
1462
|
+
information: {
|
|
1463
|
+
tag: "textarea",
|
|
1464
|
+
type: "",
|
|
1465
|
+
class: "",
|
|
1466
|
+
},
|
|
1467
|
+
},
|
|
1468
|
+
comment: (obj = {}) => {
|
|
1469
|
+
return `clockpicker`;
|
|
1470
|
+
},
|
|
1471
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1472
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
1473
|
+
const indexing = !obj.unique
|
|
1474
|
+
? ""
|
|
1475
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
1476
|
+
let defaultValue = "";
|
|
1477
|
+
if (!obj.defaultValue) {
|
|
1478
|
+
defaultValue = ``;
|
|
1479
|
+
} else if (obj.defaultValue == "null") {
|
|
1480
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
1481
|
+
} else {
|
|
1482
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1483
|
+
}
|
|
1484
|
+
return {
|
|
1485
|
+
defaultValue: defaultValue,
|
|
1486
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" varchar(12);`,
|
|
1487
|
+
index: indexing,
|
|
1488
|
+
foreignKey: "",
|
|
1489
|
+
};
|
|
1490
|
+
},
|
|
1491
|
+
columnType: (obj = {}) => {
|
|
1492
|
+
return `text`;
|
|
1493
|
+
},
|
|
1494
|
+
category: "text",
|
|
1495
|
+
};
|
|
1496
|
+
|
|
1497
|
+
Model.switch = {
|
|
1498
|
+
properties: [
|
|
1499
|
+
"required",
|
|
1500
|
+
"tabindex",
|
|
1501
|
+
"active",
|
|
1502
|
+
"hidden",
|
|
1503
|
+
"notactive",
|
|
1504
|
+
"information",
|
|
1505
|
+
],
|
|
1506
|
+
labels: {
|
|
1507
|
+
required: "Required",
|
|
1508
|
+
tabindex: "Tab Index",
|
|
1509
|
+
active: "Active",
|
|
1510
|
+
hidden: "Hidden",
|
|
1511
|
+
notactive: "Not Active",
|
|
1512
|
+
information: "Additional Information",
|
|
1513
|
+
},
|
|
1514
|
+
defaultValues: {
|
|
1515
|
+
required: false,
|
|
1516
|
+
tabindex: 1,
|
|
1517
|
+
active: "Yes",
|
|
1518
|
+
hidden: false,
|
|
1519
|
+
notactive: "No",
|
|
1520
|
+
information: "",
|
|
1521
|
+
},
|
|
1522
|
+
typies: {
|
|
1523
|
+
required: {
|
|
1524
|
+
tag: "input",
|
|
1525
|
+
type: "checkbox",
|
|
1526
|
+
},
|
|
1527
|
+
tabindex: {
|
|
1528
|
+
tag: "input",
|
|
1529
|
+
type: "number",
|
|
1530
|
+
},
|
|
1531
|
+
hidden: {
|
|
1532
|
+
tag: "input",
|
|
1533
|
+
type: "checkbox",
|
|
1534
|
+
},
|
|
1535
|
+
active: {
|
|
1536
|
+
tag: "input",
|
|
1537
|
+
type: "text",
|
|
1538
|
+
},
|
|
1539
|
+
notactive: {
|
|
1540
|
+
tag: "input",
|
|
1541
|
+
type: "text",
|
|
1542
|
+
},
|
|
1543
|
+
information: {
|
|
1544
|
+
tag: "textarea",
|
|
1545
|
+
type: "",
|
|
1546
|
+
class: "",
|
|
1547
|
+
},
|
|
1548
|
+
},
|
|
1549
|
+
comment: (obj) => {
|
|
1550
|
+
const active = !obj.active ? "Yes" : obj.active;
|
|
1551
|
+
const notactive = !obj.notactive ? "No" : obj.notactive;
|
|
1552
|
+
return `module_switch_${notactive}_${active}`;
|
|
1553
|
+
},
|
|
1554
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1555
|
+
let defaultValue = "";
|
|
1556
|
+
if (!obj.defaultValue) {
|
|
1557
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT 0;`;
|
|
1558
|
+
} else if (obj.defaultValue == "null") {
|
|
1559
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT 0;`;
|
|
1560
|
+
} else {
|
|
1561
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1562
|
+
}
|
|
1563
|
+
return {
|
|
1564
|
+
defaultValue: defaultValue,
|
|
1565
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" smallint;`,
|
|
1566
|
+
index: "",
|
|
1567
|
+
foreignKey: "",
|
|
1568
|
+
};
|
|
1569
|
+
},
|
|
1570
|
+
columnType: (obj = {}) => {
|
|
1571
|
+
return `smallint`;
|
|
1572
|
+
},
|
|
1573
|
+
category: "integer",
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
Model.editor = {
|
|
1577
|
+
properties: ["required", "tabindex", "height", "information"],
|
|
1578
|
+
labels: {
|
|
1579
|
+
required: "Required",
|
|
1580
|
+
tabindex: "Tab Index",
|
|
1581
|
+
height: "Height (px)",
|
|
1582
|
+
information: "Additional Information",
|
|
1583
|
+
},
|
|
1584
|
+
defaultValues: {
|
|
1585
|
+
required: false,
|
|
1586
|
+
tabindex: 1,
|
|
1587
|
+
height: 400,
|
|
1588
|
+
information: "",
|
|
1589
|
+
},
|
|
1590
|
+
typies: {
|
|
1591
|
+
required: {
|
|
1592
|
+
tag: "input",
|
|
1593
|
+
type: "checkbox",
|
|
1594
|
+
},
|
|
1595
|
+
tabindex: {
|
|
1596
|
+
tag: "input",
|
|
1597
|
+
type: "number",
|
|
1598
|
+
},
|
|
1599
|
+
height: {
|
|
1600
|
+
tag: "input",
|
|
1601
|
+
type: "number",
|
|
1602
|
+
},
|
|
1603
|
+
information: {
|
|
1604
|
+
tag: "textarea",
|
|
1605
|
+
type: "",
|
|
1606
|
+
class: "",
|
|
1607
|
+
},
|
|
1608
|
+
},
|
|
1609
|
+
comment: (obj) => {
|
|
1610
|
+
return "editor";
|
|
1611
|
+
},
|
|
1612
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1613
|
+
const length = !obj.length ? 255 : obj.length;
|
|
1614
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
1615
|
+
let defaultValue = "";
|
|
1616
|
+
if (!obj.defaultValue) {
|
|
1617
|
+
defaultValue = ``;
|
|
1618
|
+
} else if (obj.defaultValue == "null") {
|
|
1619
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
1620
|
+
} else {
|
|
1621
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1622
|
+
}
|
|
1623
|
+
return {
|
|
1624
|
+
defaultValue: defaultValue,
|
|
1625
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" text;`,
|
|
1626
|
+
index: "",
|
|
1627
|
+
foreignKey: "",
|
|
1628
|
+
};
|
|
1629
|
+
},
|
|
1630
|
+
columnType: (obj = {}) => {
|
|
1631
|
+
return `text`;
|
|
1632
|
+
},
|
|
1633
|
+
category: "text",
|
|
1634
|
+
};
|
|
1635
|
+
|
|
1636
|
+
Model.tinymce = {
|
|
1637
|
+
properties: ["required", "tabindex", "height", "information"],
|
|
1638
|
+
labels: {
|
|
1639
|
+
required: "Required",
|
|
1640
|
+
tabindex: "Tab Index",
|
|
1641
|
+
height: "Height (px)",
|
|
1642
|
+
information: "Additional Information",
|
|
1643
|
+
},
|
|
1644
|
+
defaultValues: {
|
|
1645
|
+
required: false,
|
|
1646
|
+
tabindex: 1,
|
|
1647
|
+
height: 400,
|
|
1648
|
+
information: "",
|
|
1649
|
+
},
|
|
1650
|
+
typies: {
|
|
1651
|
+
required: {
|
|
1652
|
+
tag: "input",
|
|
1653
|
+
type: "checkbox",
|
|
1654
|
+
},
|
|
1655
|
+
tabindex: {
|
|
1656
|
+
tag: "input",
|
|
1657
|
+
type: "number",
|
|
1658
|
+
},
|
|
1659
|
+
height: {
|
|
1660
|
+
tag: "input",
|
|
1661
|
+
type: "number",
|
|
1662
|
+
},
|
|
1663
|
+
information: {
|
|
1664
|
+
tag: "textarea",
|
|
1665
|
+
type: "",
|
|
1666
|
+
class: "",
|
|
1667
|
+
},
|
|
1668
|
+
},
|
|
1669
|
+
comment: (obj) => {
|
|
1670
|
+
return "editor";
|
|
1671
|
+
},
|
|
1672
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1673
|
+
const length = !obj.length ? 255 : obj.length;
|
|
1674
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
1675
|
+
let defaultValue = "";
|
|
1676
|
+
if (!obj.defaultValue) {
|
|
1677
|
+
defaultValue = ``;
|
|
1678
|
+
} else if (obj.defaultValue == "null") {
|
|
1679
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
1680
|
+
} else {
|
|
1681
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1682
|
+
}
|
|
1683
|
+
return {
|
|
1684
|
+
defaultValue: defaultValue,
|
|
1685
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" text;`,
|
|
1686
|
+
index: "",
|
|
1687
|
+
foreignKey: "",
|
|
1688
|
+
};
|
|
1689
|
+
},
|
|
1690
|
+
columnType: (obj = {}) => {
|
|
1691
|
+
return `text`;
|
|
1692
|
+
},
|
|
1693
|
+
category: "text",
|
|
1694
|
+
};
|
|
1695
|
+
|
|
1696
|
+
Model.lexical = {
|
|
1697
|
+
properties: ["required", "tabindex", "height", "information"],
|
|
1698
|
+
labels: {
|
|
1699
|
+
required: "Required",
|
|
1700
|
+
tabindex: "Tab Index",
|
|
1701
|
+
height: "Height (px)",
|
|
1702
|
+
information: "Additional Information",
|
|
1703
|
+
},
|
|
1704
|
+
defaultValues: {
|
|
1705
|
+
required: false,
|
|
1706
|
+
tabindex: 1,
|
|
1707
|
+
height: 400,
|
|
1708
|
+
information: "",
|
|
1709
|
+
},
|
|
1710
|
+
typies: {
|
|
1711
|
+
required: {
|
|
1712
|
+
tag: "input",
|
|
1713
|
+
type: "checkbox",
|
|
1714
|
+
},
|
|
1715
|
+
tabindex: {
|
|
1716
|
+
tag: "input",
|
|
1717
|
+
type: "number",
|
|
1718
|
+
},
|
|
1719
|
+
height: {
|
|
1720
|
+
tag: "input",
|
|
1721
|
+
type: "number",
|
|
1722
|
+
},
|
|
1723
|
+
information: {
|
|
1724
|
+
tag: "textarea",
|
|
1725
|
+
type: "",
|
|
1726
|
+
class: "",
|
|
1727
|
+
},
|
|
1728
|
+
},
|
|
1729
|
+
comment: (obj) => {
|
|
1730
|
+
return "editor";
|
|
1731
|
+
},
|
|
1732
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1733
|
+
const length = !obj.length ? 255 : obj.length;
|
|
1734
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
1735
|
+
let defaultValue = "";
|
|
1736
|
+
if (!obj.defaultValue) {
|
|
1737
|
+
defaultValue = ``;
|
|
1738
|
+
} else if (obj.defaultValue == "null") {
|
|
1739
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
1740
|
+
} else {
|
|
1741
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1742
|
+
}
|
|
1743
|
+
return {
|
|
1744
|
+
defaultValue: defaultValue,
|
|
1745
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" json;`,
|
|
1746
|
+
index: "",
|
|
1747
|
+
foreignKey: "",
|
|
1748
|
+
};
|
|
1749
|
+
},
|
|
1750
|
+
columnType: (obj = {}) => {
|
|
1751
|
+
return `json`;
|
|
1752
|
+
},
|
|
1753
|
+
category: "json",
|
|
1754
|
+
};
|
|
1755
|
+
|
|
1756
|
+
Model.ide_editor = {
|
|
1757
|
+
properties: ["required", "tabindex", "languages", "height", "information"],
|
|
1758
|
+
labels: {
|
|
1759
|
+
required: "Required",
|
|
1760
|
+
tabindex: "Tab Index",
|
|
1761
|
+
languages: "Languages",
|
|
1762
|
+
height: "Height (px)",
|
|
1763
|
+
information: "Additional Information",
|
|
1764
|
+
},
|
|
1765
|
+
defaultValues: {
|
|
1766
|
+
required: false,
|
|
1767
|
+
tabindex: 1,
|
|
1768
|
+
languages: "javascript",
|
|
1769
|
+
height: 400,
|
|
1770
|
+
information: "",
|
|
1771
|
+
},
|
|
1772
|
+
typies: {
|
|
1773
|
+
required: {
|
|
1774
|
+
tag: "input",
|
|
1775
|
+
type: "checkbox",
|
|
1776
|
+
},
|
|
1777
|
+
tabindex: {
|
|
1778
|
+
tag: "input",
|
|
1779
|
+
type: "number",
|
|
1780
|
+
},
|
|
1781
|
+
height: {
|
|
1782
|
+
tag: "input",
|
|
1783
|
+
type: "number",
|
|
1784
|
+
},
|
|
1785
|
+
languages: {
|
|
1786
|
+
tag: "select",
|
|
1787
|
+
type: "",
|
|
1788
|
+
dropdown: {
|
|
1789
|
+
"": "",
|
|
1790
|
+
abap: "abap",
|
|
1791
|
+
actionscript: "actionscript",
|
|
1792
|
+
ada: "ada",
|
|
1793
|
+
asciidoc: "asciidoc",
|
|
1794
|
+
assembly_x86: "assembly_x86",
|
|
1795
|
+
autohotkey: "autohotkey",
|
|
1796
|
+
batchfile: "batchfile",
|
|
1797
|
+
c9search: "c9search",
|
|
1798
|
+
c_cpp: "c_cpp",
|
|
1799
|
+
clojure: "clojure",
|
|
1800
|
+
cobol: "cobol",
|
|
1801
|
+
coffee: "coffee",
|
|
1802
|
+
coldfusion: "coldfusion",
|
|
1803
|
+
csharp: "csharp",
|
|
1804
|
+
css: "css",
|
|
1805
|
+
curly: "curly",
|
|
1806
|
+
d: "d",
|
|
1807
|
+
dart: "dart",
|
|
1808
|
+
diff: "diff",
|
|
1809
|
+
django: "django",
|
|
1810
|
+
dot: "dot",
|
|
1811
|
+
ejs: "ejs",
|
|
1812
|
+
erlang: "erlang",
|
|
1813
|
+
forth: "forth",
|
|
1814
|
+
ftl: "ftl",
|
|
1815
|
+
glsl: "glsl",
|
|
1816
|
+
golang: "golang",
|
|
1817
|
+
groovy: "groovy",
|
|
1818
|
+
haml: "haml",
|
|
1819
|
+
handlebars: "handlebars",
|
|
1820
|
+
haskell: "haskell",
|
|
1821
|
+
haxe: "haxe",
|
|
1822
|
+
html: "html",
|
|
1823
|
+
html_ruby: "html_ruby",
|
|
1824
|
+
ini: "ini",
|
|
1825
|
+
jade: "jade",
|
|
1826
|
+
java: "java",
|
|
1827
|
+
javascript: "javascript",
|
|
1828
|
+
json: "json",
|
|
1829
|
+
jsoniq: "jsoniq",
|
|
1830
|
+
jsp: "jsp",
|
|
1831
|
+
jsx: "jsx",
|
|
1832
|
+
julia: "julia",
|
|
1833
|
+
latex: "latex",
|
|
1834
|
+
less: "less",
|
|
1835
|
+
liquid: "liquid",
|
|
1836
|
+
lisp: "lisp",
|
|
1837
|
+
livescript: "livescript",
|
|
1838
|
+
logiql: "logiql",
|
|
1839
|
+
lsl: "lsl",
|
|
1840
|
+
lua: "lua",
|
|
1841
|
+
luapage: "luapage",
|
|
1842
|
+
lucene: "lucene",
|
|
1843
|
+
makefile: "makefile",
|
|
1844
|
+
markdown: "markdown",
|
|
1845
|
+
matlab: "matlab",
|
|
1846
|
+
mushcode: "mushcode",
|
|
1847
|
+
mushcode_high_rules: "mushcode_high_rules",
|
|
1848
|
+
mysql: "mysql",
|
|
1849
|
+
objectivec: "objectivec",
|
|
1850
|
+
ocaml: "ocaml",
|
|
1851
|
+
pascal: "pascal",
|
|
1852
|
+
perl: "perl",
|
|
1853
|
+
pgsql: "pgsql",
|
|
1854
|
+
php: "php",
|
|
1855
|
+
powershell: "powershell",
|
|
1856
|
+
prolog: "prolog",
|
|
1857
|
+
properties: "properties",
|
|
1858
|
+
python: "python",
|
|
1859
|
+
r: "r",
|
|
1860
|
+
rdoc: "rdoc",
|
|
1861
|
+
rhtml: "rhtml",
|
|
1862
|
+
ruby: "ruby",
|
|
1863
|
+
rust: "rust",
|
|
1864
|
+
sass: "sass",
|
|
1865
|
+
scad: "scad",
|
|
1866
|
+
scala: "scala",
|
|
1867
|
+
scheme: "scheme",
|
|
1868
|
+
scss: "scss",
|
|
1869
|
+
sh: "sh",
|
|
1870
|
+
snippets: "snippets",
|
|
1871
|
+
sql: "sql",
|
|
1872
|
+
stylus: "stylus",
|
|
1873
|
+
svg: "svg",
|
|
1874
|
+
tcl: "tcl",
|
|
1875
|
+
tex: "tex",
|
|
1876
|
+
text: "text",
|
|
1877
|
+
textile: "textile",
|
|
1878
|
+
toml: "toml",
|
|
1879
|
+
twig: "twig",
|
|
1880
|
+
typescript: "typescript",
|
|
1881
|
+
vbscript: "vbscript",
|
|
1882
|
+
velocity: "velocity",
|
|
1883
|
+
verilog: "verilog",
|
|
1884
|
+
xml: "xml",
|
|
1885
|
+
xquery: "xquery",
|
|
1886
|
+
yaml: "yaml",
|
|
1887
|
+
},
|
|
1888
|
+
information: {
|
|
1889
|
+
tag: "texarea",
|
|
1890
|
+
type: "text",
|
|
1891
|
+
},
|
|
1892
|
+
},
|
|
1893
|
+
information: {
|
|
1894
|
+
tag: "textarea",
|
|
1895
|
+
type: "",
|
|
1896
|
+
class: "",
|
|
1897
|
+
},
|
|
1898
|
+
},
|
|
1899
|
+
comment: (obj) => {
|
|
1900
|
+
return "ide_editor";
|
|
1901
|
+
},
|
|
1902
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1903
|
+
const length = !obj.length ? 255 : obj.length;
|
|
1904
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
1905
|
+
let defaultValue = "";
|
|
1906
|
+
if (!obj.defaultValue) {
|
|
1907
|
+
defaultValue = ``;
|
|
1908
|
+
} else if (obj.defaultValue == "null") {
|
|
1909
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
1910
|
+
} else {
|
|
1911
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1912
|
+
}
|
|
1913
|
+
return {
|
|
1914
|
+
defaultValue: defaultValue,
|
|
1915
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" text;`,
|
|
1916
|
+
index: "",
|
|
1917
|
+
foreignKey: "",
|
|
1918
|
+
};
|
|
1919
|
+
},
|
|
1920
|
+
columnType: (obj = {}) => {
|
|
1921
|
+
return `text`;
|
|
1922
|
+
},
|
|
1923
|
+
category: "text",
|
|
1924
|
+
};
|
|
1925
|
+
|
|
1926
|
+
Model.radio = {
|
|
1927
|
+
properties: ["required", "unique", "tabindex", "select", "information"],
|
|
1928
|
+
labels: {
|
|
1929
|
+
required: "Required",
|
|
1930
|
+
unique: "Unique",
|
|
1931
|
+
tabindex: "Tab Index",
|
|
1932
|
+
select: "Select",
|
|
1933
|
+
value: "Value",
|
|
1934
|
+
name: "Label",
|
|
1935
|
+
information: "Additional Information",
|
|
1936
|
+
},
|
|
1937
|
+
defaultValues: {
|
|
1938
|
+
required: false,
|
|
1939
|
+
unique: false,
|
|
1940
|
+
tabindex: 1,
|
|
1941
|
+
value: 1,
|
|
1942
|
+
name: "Name",
|
|
1943
|
+
select: [{ value: 1, label: "Please Select" }],
|
|
1944
|
+
information: "",
|
|
1945
|
+
},
|
|
1946
|
+
typies: {
|
|
1947
|
+
required: {
|
|
1948
|
+
tag: "input",
|
|
1949
|
+
type: "checkbox",
|
|
1950
|
+
},
|
|
1951
|
+
unique: {
|
|
1952
|
+
tag: "input",
|
|
1953
|
+
type: "checkbox",
|
|
1954
|
+
},
|
|
1955
|
+
tabindex: {
|
|
1956
|
+
tag: "input",
|
|
1957
|
+
type: "number",
|
|
1958
|
+
},
|
|
1959
|
+
select: {
|
|
1960
|
+
tag: "array",
|
|
1961
|
+
type: "",
|
|
1962
|
+
},
|
|
1963
|
+
concat: {
|
|
1964
|
+
tag: "input",
|
|
1965
|
+
type: "text",
|
|
1966
|
+
},
|
|
1967
|
+
information: {
|
|
1968
|
+
tag: "input",
|
|
1969
|
+
type: "text",
|
|
1970
|
+
},
|
|
1971
|
+
},
|
|
1972
|
+
comment: (obj) => {
|
|
1973
|
+
//dropdown_static_1=Male,2=Female
|
|
1974
|
+
return `dropdown_static_1=Male,2=Female`;
|
|
1975
|
+
},
|
|
1976
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
1977
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
1978
|
+
const indexing = !obj.unique
|
|
1979
|
+
? ""
|
|
1980
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
1981
|
+
let defaultValue = "";
|
|
1982
|
+
if (!obj.defaultValue) {
|
|
1983
|
+
defaultValue = ``;
|
|
1984
|
+
} else if (obj.defaultValue == "null") {
|
|
1985
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
1986
|
+
} else {
|
|
1987
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
1988
|
+
}
|
|
1989
|
+
return {
|
|
1990
|
+
defaultValue: defaultValue,
|
|
1991
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" smallint;`,
|
|
1992
|
+
index: indexing,
|
|
1993
|
+
foreignKey: "",
|
|
1994
|
+
};
|
|
1995
|
+
},
|
|
1996
|
+
columnType: (obj = {}) => {
|
|
1997
|
+
return `smallint`;
|
|
1998
|
+
},
|
|
1999
|
+
category: "integer",
|
|
2000
|
+
};
|
|
2001
|
+
|
|
2002
|
+
Model.select = {
|
|
2003
|
+
properties: [
|
|
2004
|
+
"required",
|
|
2005
|
+
"unique",
|
|
2006
|
+
"tabindex",
|
|
2007
|
+
"select",
|
|
2008
|
+
"please_select",
|
|
2009
|
+
"hidden",
|
|
2010
|
+
"defaultValue",
|
|
2011
|
+
"information",
|
|
2012
|
+
],
|
|
2013
|
+
labels: {
|
|
2014
|
+
required: "Required",
|
|
2015
|
+
unique: "Unique",
|
|
2016
|
+
tabindex: "Tab Index",
|
|
2017
|
+
select: "Select",
|
|
2018
|
+
value: "Value",
|
|
2019
|
+
name: "Label",
|
|
2020
|
+
information: "Additional Information",
|
|
2021
|
+
hidden: "Hidden",
|
|
2022
|
+
defaultValue: "Default Value",
|
|
2023
|
+
please_select: "Please Select (Labeling)",
|
|
2024
|
+
},
|
|
2025
|
+
defaultValues: {
|
|
2026
|
+
required: false,
|
|
2027
|
+
unique: false,
|
|
2028
|
+
tabindex: 1,
|
|
2029
|
+
value: 1,
|
|
2030
|
+
name: "Name",
|
|
2031
|
+
select: [{ value: 1, label: "Please Select" }],
|
|
2032
|
+
information: "",
|
|
2033
|
+
please_select: "",
|
|
2034
|
+
hidden: false,
|
|
2035
|
+
defaultValue: null,
|
|
2036
|
+
},
|
|
2037
|
+
typies: {
|
|
2038
|
+
required: {
|
|
2039
|
+
tag: "input",
|
|
2040
|
+
type: "checkbox",
|
|
2041
|
+
},
|
|
2042
|
+
unique: {
|
|
2043
|
+
tag: "input",
|
|
2044
|
+
type: "checkbox",
|
|
2045
|
+
},
|
|
2046
|
+
tabindex: {
|
|
2047
|
+
tag: "input",
|
|
2048
|
+
type: "number",
|
|
2049
|
+
},
|
|
2050
|
+
select: {
|
|
2051
|
+
tag: "array",
|
|
2052
|
+
type: "",
|
|
2053
|
+
},
|
|
2054
|
+
concat: {
|
|
2055
|
+
tag: "input",
|
|
2056
|
+
type: "text",
|
|
2057
|
+
},
|
|
2058
|
+
please_select: {
|
|
2059
|
+
tag: "input",
|
|
2060
|
+
type: "text",
|
|
2061
|
+
},
|
|
2062
|
+
information: {
|
|
2063
|
+
tag: "input",
|
|
2064
|
+
type: "text",
|
|
2065
|
+
},
|
|
2066
|
+
hidden: {
|
|
2067
|
+
tag: "input",
|
|
2068
|
+
type: "checkbox",
|
|
2069
|
+
},
|
|
2070
|
+
defaultValue: {
|
|
2071
|
+
tag: "input",
|
|
2072
|
+
type: "number",
|
|
2073
|
+
},
|
|
2074
|
+
},
|
|
2075
|
+
comment: (obj) => {
|
|
2076
|
+
//dropdown_static_1=Male,2=Female
|
|
2077
|
+
return `dropdown_static_1=Male,2=Female`;
|
|
2078
|
+
},
|
|
2079
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2080
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
2081
|
+
const indexing = !obj.unique
|
|
2082
|
+
? ""
|
|
2083
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
2084
|
+
let defaultValue = "";
|
|
2085
|
+
if (!obj.defaultValue) {
|
|
2086
|
+
defaultValue = ``;
|
|
2087
|
+
} else if (obj.defaultValue == "null") {
|
|
2088
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
2089
|
+
} else {
|
|
2090
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
2091
|
+
}
|
|
2092
|
+
return {
|
|
2093
|
+
defaultValue: defaultValue,
|
|
2094
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" smallint;`,
|
|
2095
|
+
index: indexing,
|
|
2096
|
+
foreignKey: "",
|
|
2097
|
+
};
|
|
2098
|
+
},
|
|
2099
|
+
columnType: (obj = {}) => {
|
|
2100
|
+
return `smallint`;
|
|
2101
|
+
},
|
|
2102
|
+
category: "integer",
|
|
2103
|
+
};
|
|
2104
|
+
|
|
2105
|
+
Model.multi_line_editor = {
|
|
2106
|
+
properties: [
|
|
2107
|
+
"required",
|
|
2108
|
+
"unique",
|
|
2109
|
+
"tabindex",
|
|
2110
|
+
"table",
|
|
2111
|
+
"description",
|
|
2112
|
+
"information",
|
|
2113
|
+
],
|
|
2114
|
+
labels: {
|
|
2115
|
+
required: "Required",
|
|
2116
|
+
unique: "Unique",
|
|
2117
|
+
tabindex: "Tab Index",
|
|
2118
|
+
table: "Module Name",
|
|
2119
|
+
description: "Description",
|
|
2120
|
+
information: "Additional Information",
|
|
2121
|
+
},
|
|
2122
|
+
defaultValues: {
|
|
2123
|
+
required: false,
|
|
2124
|
+
unique: false,
|
|
2125
|
+
tabindex: 1,
|
|
2126
|
+
table: "zuser",
|
|
2127
|
+
name: "username",
|
|
2128
|
+
description: "This is your Text ",
|
|
2129
|
+
information: "",
|
|
2130
|
+
},
|
|
2131
|
+
typies: {
|
|
2132
|
+
required: {
|
|
2133
|
+
tag: "input",
|
|
2134
|
+
type: "checkbox",
|
|
2135
|
+
},
|
|
2136
|
+
unique: {
|
|
2137
|
+
tag: "input",
|
|
2138
|
+
type: "checkbox",
|
|
2139
|
+
},
|
|
2140
|
+
tabindex: {
|
|
2141
|
+
tag: "input",
|
|
2142
|
+
type: "number",
|
|
2143
|
+
},
|
|
2144
|
+
table: {
|
|
2145
|
+
tag: "select",
|
|
2146
|
+
type: "",
|
|
2147
|
+
},
|
|
2148
|
+
description: {
|
|
2149
|
+
tag: "textarea",
|
|
2150
|
+
type: "",
|
|
2151
|
+
class: "editor",
|
|
2152
|
+
},
|
|
2153
|
+
information: {
|
|
2154
|
+
tag: "input",
|
|
2155
|
+
type: "text",
|
|
2156
|
+
},
|
|
2157
|
+
},
|
|
2158
|
+
comment: (obj) => {
|
|
2159
|
+
return `dropdown_table`;
|
|
2160
|
+
},
|
|
2161
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2162
|
+
var required = !obj.required ? "NULL" : "NOT NULL";
|
|
2163
|
+
return {
|
|
2164
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" JSON;`,
|
|
2165
|
+
index: "",
|
|
2166
|
+
foreignKey: "",
|
|
2167
|
+
};
|
|
2168
|
+
},
|
|
2169
|
+
columnType: (obj = {}) => {
|
|
2170
|
+
return `json`;
|
|
2171
|
+
},
|
|
2172
|
+
category: "json",
|
|
2173
|
+
};
|
|
2174
|
+
|
|
2175
|
+
Model.relation = {
|
|
2176
|
+
properties: [
|
|
2177
|
+
"required",
|
|
2178
|
+
"unique",
|
|
2179
|
+
"tabindex",
|
|
2180
|
+
"table",
|
|
2181
|
+
"name",
|
|
2182
|
+
"concat",
|
|
2183
|
+
"please_select",
|
|
2184
|
+
"isChain",
|
|
2185
|
+
"isAttributes",
|
|
2186
|
+
"information",
|
|
2187
|
+
"defaultValue",
|
|
2188
|
+
"hidden",
|
|
2189
|
+
"isSearch",
|
|
2190
|
+
"order_by",
|
|
2191
|
+
"import_field"
|
|
2192
|
+
],
|
|
2193
|
+
labels: {
|
|
2194
|
+
required: "Required",
|
|
2195
|
+
unique: "Unique",
|
|
2196
|
+
tabindex: "Tab Index",
|
|
2197
|
+
table: "Module Name",
|
|
2198
|
+
name: "Label",
|
|
2199
|
+
concat: "Concat",
|
|
2200
|
+
isChain: "is Chain",
|
|
2201
|
+
isAttributes: "With Attributes",
|
|
2202
|
+
information: "Additional Information",
|
|
2203
|
+
please_select: "Please Select (Labeling)",
|
|
2204
|
+
defaultValue: "Default Value",
|
|
2205
|
+
hidden: "Hidden",
|
|
2206
|
+
isSearch:"Auto complete Search",
|
|
2207
|
+
order_by : "Order By",
|
|
2208
|
+
import_field :"Default Import Field (id)"
|
|
2209
|
+
},
|
|
2210
|
+
defaultValues: {
|
|
2211
|
+
required: false,
|
|
2212
|
+
unique: false,
|
|
2213
|
+
tabindex: 1,
|
|
2214
|
+
table: "user",
|
|
2215
|
+
name: "username",
|
|
2216
|
+
concat: "CONCAT(fullname, ' ',email)",
|
|
2217
|
+
isChain: false,
|
|
2218
|
+
isAttributes: false,
|
|
2219
|
+
information: "",
|
|
2220
|
+
please_select: "",
|
|
2221
|
+
defaultValue: null,
|
|
2222
|
+
hidden: false,
|
|
2223
|
+
isSearch:false,
|
|
2224
|
+
order_by : "",
|
|
2225
|
+
import_field :"id"
|
|
2226
|
+
},
|
|
2227
|
+
typies: {
|
|
2228
|
+
required: {
|
|
2229
|
+
tag: "input",
|
|
2230
|
+
type: "checkbox",
|
|
2231
|
+
},
|
|
2232
|
+
unique: {
|
|
2233
|
+
tag: "input",
|
|
2234
|
+
type: "checkbox",
|
|
2235
|
+
},
|
|
2236
|
+
tabindex: {
|
|
2237
|
+
tag: "input",
|
|
2238
|
+
type: "number",
|
|
2239
|
+
},
|
|
2240
|
+
table: {
|
|
2241
|
+
tag: "select",
|
|
2242
|
+
type: "",
|
|
2243
|
+
},
|
|
2244
|
+
name: {
|
|
2245
|
+
tag: "select",
|
|
2246
|
+
type: "",
|
|
2247
|
+
},
|
|
2248
|
+
concat: {
|
|
2249
|
+
tag: "input",
|
|
2250
|
+
type: "text",
|
|
2251
|
+
},
|
|
2252
|
+
isChain: {
|
|
2253
|
+
tag: "input",
|
|
2254
|
+
type: "checkbox",
|
|
2255
|
+
},
|
|
2256
|
+
isAttributes: {
|
|
2257
|
+
tag: "input",
|
|
2258
|
+
type: "checkbox",
|
|
2259
|
+
},
|
|
2260
|
+
information: {
|
|
2261
|
+
tag: "input",
|
|
2262
|
+
type: "text",
|
|
2263
|
+
},
|
|
2264
|
+
please_select: {
|
|
2265
|
+
tag: "input",
|
|
2266
|
+
type: "text",
|
|
2267
|
+
},
|
|
2268
|
+
defaultValue: {
|
|
2269
|
+
tag: "input",
|
|
2270
|
+
type: "text",
|
|
2271
|
+
},
|
|
2272
|
+
hidden: {
|
|
2273
|
+
tag: "input",
|
|
2274
|
+
type: "checkbox",
|
|
2275
|
+
},
|
|
2276
|
+
isSearch: {
|
|
2277
|
+
tag: "input",
|
|
2278
|
+
type: "checkbox",
|
|
2279
|
+
},
|
|
2280
|
+
order_by : {
|
|
2281
|
+
tag: "input",
|
|
2282
|
+
type: "text",
|
|
2283
|
+
},
|
|
2284
|
+
import_field : {
|
|
2285
|
+
tag: "input",
|
|
2286
|
+
type: "text",
|
|
2287
|
+
},
|
|
2288
|
+
},
|
|
2289
|
+
comment: (obj) => {
|
|
2290
|
+
return `select`;
|
|
2291
|
+
},
|
|
2292
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2293
|
+
const length = !obj.length ? 255 : obj.length;
|
|
2294
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
2295
|
+
const indexing = !obj.unique
|
|
2296
|
+
? ""
|
|
2297
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
2298
|
+
const fk = `ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT fk_${MYMODEL.table}_${key} FOREIGN KEY (${key}) REFERENCES ${obj.table};`;
|
|
2299
|
+
let defaultValue = "";
|
|
2300
|
+
if (!obj.defaultValue) {
|
|
2301
|
+
defaultValue = ``;
|
|
2302
|
+
} else if (obj.defaultValue == "null") {
|
|
2303
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
2304
|
+
} else {
|
|
2305
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
2306
|
+
}
|
|
2307
|
+
//ALTER TABLE zuser_company ADD CONSTRAINT fk_user_company_role FOREIGN KEY (role_id) REFERENCES zrole (id);
|
|
2308
|
+
return {
|
|
2309
|
+
defaultValue: defaultValue,
|
|
2310
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" bigint;`,
|
|
2311
|
+
index: indexing,
|
|
2312
|
+
foreignKey: fk,
|
|
2313
|
+
};
|
|
2314
|
+
},
|
|
2315
|
+
columnType: (obj = {}) => {
|
|
2316
|
+
return `bigint`;
|
|
2317
|
+
},
|
|
2318
|
+
category: "integer",
|
|
2319
|
+
};
|
|
2320
|
+
|
|
2321
|
+
Model.typeahead = {
|
|
2322
|
+
properties: [
|
|
2323
|
+
"required",
|
|
2324
|
+
"unique",
|
|
2325
|
+
"tabindex",
|
|
2326
|
+
"table",
|
|
2327
|
+
"name",
|
|
2328
|
+
"concat",
|
|
2329
|
+
"information",
|
|
2330
|
+
"order_by",
|
|
2331
|
+
"import_field",
|
|
2332
|
+
],
|
|
2333
|
+
labels: {
|
|
2334
|
+
required: "Required",
|
|
2335
|
+
unique: "Unique",
|
|
2336
|
+
tabindex: "Tab Index",
|
|
2337
|
+
table: "Module Name",
|
|
2338
|
+
name: "Label",
|
|
2339
|
+
concat: "Concat",
|
|
2340
|
+
information: "Additional Information",
|
|
2341
|
+
order_by : "Order By",
|
|
2342
|
+
import_field :"Default Import Field (id)",
|
|
2343
|
+
},
|
|
2344
|
+
defaultValues: {
|
|
2345
|
+
required: false,
|
|
2346
|
+
unique: false,
|
|
2347
|
+
tabindex: 1,
|
|
2348
|
+
table: "user",
|
|
2349
|
+
concat: "CONCAT(fullname, ' ',email)",
|
|
2350
|
+
information: "",
|
|
2351
|
+
order_by : "",
|
|
2352
|
+
import_field :"id"
|
|
2353
|
+
},
|
|
2354
|
+
typies: {
|
|
2355
|
+
required: {
|
|
2356
|
+
tag: "input",
|
|
2357
|
+
type: "checkbox",
|
|
2358
|
+
},
|
|
2359
|
+
unique: {
|
|
2360
|
+
tag: "input",
|
|
2361
|
+
type: "checkbox",
|
|
2362
|
+
},
|
|
2363
|
+
tabindex: {
|
|
2364
|
+
tag: "input",
|
|
2365
|
+
type: "number",
|
|
2366
|
+
},
|
|
2367
|
+
table: {
|
|
2368
|
+
tag: "select",
|
|
2369
|
+
type: "",
|
|
2370
|
+
},
|
|
2371
|
+
name: {
|
|
2372
|
+
tag: "select",
|
|
2373
|
+
type: "",
|
|
2374
|
+
},
|
|
2375
|
+
concat: {
|
|
2376
|
+
tag: "input",
|
|
2377
|
+
type: "text",
|
|
2378
|
+
},
|
|
2379
|
+
information: {
|
|
2380
|
+
tag: "input",
|
|
2381
|
+
type: "text",
|
|
2382
|
+
},
|
|
2383
|
+
order_by : {
|
|
2384
|
+
tag: "input",
|
|
2385
|
+
type: "text",
|
|
2386
|
+
},
|
|
2387
|
+
import_field : {
|
|
2388
|
+
tag: "input",
|
|
2389
|
+
type: "text",
|
|
2390
|
+
},
|
|
2391
|
+
},
|
|
2392
|
+
comment: (obj) => {
|
|
2393
|
+
//module_typeahead_CONCAT(name, " (code) : ", code)
|
|
2394
|
+
const name = !obj.name ? "id" : obj.name;
|
|
2395
|
+
return `module_typeahead_${name}`;
|
|
2396
|
+
},
|
|
2397
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2398
|
+
const length = !obj.length ? 255 : obj.length;
|
|
2399
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
2400
|
+
const indexing = !obj.unique
|
|
2401
|
+
? ""
|
|
2402
|
+
: `CREATE UNIQUE INDEX idx_${MYMODEL.table}_${key} ON ${MYMODEL.table}(${key});`;
|
|
2403
|
+
const fk = `ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT fk_${MYMODEL.table}_${key} FOREIGN KEY (${key}) REFERENCES ${obj.table};`;
|
|
2404
|
+
let defaultValue = "";
|
|
2405
|
+
if (!obj.defaultValue) {
|
|
2406
|
+
defaultValue = ``;
|
|
2407
|
+
} else if (obj.defaultValue == "null") {
|
|
2408
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
2409
|
+
} else {
|
|
2410
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
2411
|
+
}
|
|
2412
|
+
return {
|
|
2413
|
+
defaultValue: defaultValue,
|
|
2414
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" bigint;`,
|
|
2415
|
+
index: indexing,
|
|
2416
|
+
foreignKey: fk,
|
|
2417
|
+
};
|
|
2418
|
+
},
|
|
2419
|
+
columnType: (obj = {}) => {
|
|
2420
|
+
return `bigint`;
|
|
2421
|
+
},
|
|
2422
|
+
category: "integer",
|
|
2423
|
+
};
|
|
2424
|
+
|
|
2425
|
+
Model.table = {
|
|
2426
|
+
properties: ["required", "unique", "tabindex", "table", "search"],
|
|
2427
|
+
labels: {
|
|
2428
|
+
required: "Required",
|
|
2429
|
+
unique: "Unique",
|
|
2430
|
+
tabindex: "Tab Index",
|
|
2431
|
+
table: "Module Name",
|
|
2432
|
+
search: "Search column Name",
|
|
2433
|
+
},
|
|
2434
|
+
defaultValues: {
|
|
2435
|
+
required: false,
|
|
2436
|
+
unique: false,
|
|
2437
|
+
tabindex: 1,
|
|
2438
|
+
table: "user",
|
|
2439
|
+
name: "username",
|
|
2440
|
+
search: "",
|
|
2441
|
+
},
|
|
2442
|
+
typies: {
|
|
2443
|
+
required: {
|
|
2444
|
+
tag: "input",
|
|
2445
|
+
type: "checkbox",
|
|
2446
|
+
},
|
|
2447
|
+
unique: {
|
|
2448
|
+
tag: "input",
|
|
2449
|
+
type: "checkbox",
|
|
2450
|
+
},
|
|
2451
|
+
tabindex: {
|
|
2452
|
+
tag: "input",
|
|
2453
|
+
type: "number",
|
|
2454
|
+
},
|
|
2455
|
+
table: {
|
|
2456
|
+
tag: "select",
|
|
2457
|
+
type: "",
|
|
2458
|
+
},
|
|
2459
|
+
search: {
|
|
2460
|
+
tag: "input",
|
|
2461
|
+
type: "text",
|
|
2462
|
+
},
|
|
2463
|
+
},
|
|
2464
|
+
comment: (obj) => {
|
|
2465
|
+
return `dropdown_table`;
|
|
2466
|
+
},
|
|
2467
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2468
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
2469
|
+
return {
|
|
2470
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" JSON;`,
|
|
2471
|
+
index: "",
|
|
2472
|
+
foreignKey: "",
|
|
2473
|
+
};
|
|
2474
|
+
},
|
|
2475
|
+
columnType: (obj = {}) => {
|
|
2476
|
+
return `json`;
|
|
2477
|
+
},
|
|
2478
|
+
category: "json",
|
|
2479
|
+
};
|
|
2480
|
+
|
|
2481
|
+
Model.dropdown_multi = {
|
|
2482
|
+
properties: [
|
|
2483
|
+
"required",
|
|
2484
|
+
"unique",
|
|
2485
|
+
"tabindex",
|
|
2486
|
+
"table",
|
|
2487
|
+
"name",
|
|
2488
|
+
"concat",
|
|
2489
|
+
"information",
|
|
2490
|
+
"order_by",
|
|
2491
|
+
"import_field",
|
|
2492
|
+
],
|
|
2493
|
+
labels: {
|
|
2494
|
+
required: "Required",
|
|
2495
|
+
unique: "Unique",
|
|
2496
|
+
tabindex: "Tab Index",
|
|
2497
|
+
table: "Module Name",
|
|
2498
|
+
name: "Name",
|
|
2499
|
+
concat: "Concat",
|
|
2500
|
+
information: "Additional Information",
|
|
2501
|
+
order_by : "Order By",
|
|
2502
|
+
import_field :"Default Import Field (id)",
|
|
2503
|
+
},
|
|
2504
|
+
defaultValues: {
|
|
2505
|
+
required: false,
|
|
2506
|
+
unique: false,
|
|
2507
|
+
tabindex: 1,
|
|
2508
|
+
table: "user",
|
|
2509
|
+
name: "username",
|
|
2510
|
+
concat: "CONCAT(fullname, ' ',email)",
|
|
2511
|
+
information: "",
|
|
2512
|
+
order_by : "",
|
|
2513
|
+
import_field :"id"
|
|
2514
|
+
},
|
|
2515
|
+
typies: {
|
|
2516
|
+
required: {
|
|
2517
|
+
tag: "input",
|
|
2518
|
+
type: "checkbox",
|
|
2519
|
+
},
|
|
2520
|
+
unique: {
|
|
2521
|
+
tag: "input",
|
|
2522
|
+
type: "checkbox",
|
|
2523
|
+
},
|
|
2524
|
+
tabindex: {
|
|
2525
|
+
tag: "input",
|
|
2526
|
+
type: "number",
|
|
2527
|
+
},
|
|
2528
|
+
table: {
|
|
2529
|
+
tag: "select",
|
|
2530
|
+
type: "",
|
|
2531
|
+
},
|
|
2532
|
+
name: {
|
|
2533
|
+
tag: "select",
|
|
2534
|
+
type: "",
|
|
2535
|
+
},
|
|
2536
|
+
concat: {
|
|
2537
|
+
tag: "input",
|
|
2538
|
+
type: "text",
|
|
2539
|
+
},
|
|
2540
|
+
information: {
|
|
2541
|
+
tag: "input",
|
|
2542
|
+
type: "text",
|
|
2543
|
+
},
|
|
2544
|
+
order_by : {
|
|
2545
|
+
tag: "input",
|
|
2546
|
+
type: "text",
|
|
2547
|
+
},
|
|
2548
|
+
import_field : {
|
|
2549
|
+
tag: "input",
|
|
2550
|
+
type: "text",
|
|
2551
|
+
},
|
|
2552
|
+
},
|
|
2553
|
+
comment: (obj) => {
|
|
2554
|
+
return ``;
|
|
2555
|
+
},
|
|
2556
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2557
|
+
const length = !obj.length ? 255 : obj.length;
|
|
2558
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
2559
|
+
let defaultValue = "";
|
|
2560
|
+
if (!obj.defaultValue) {
|
|
2561
|
+
defaultValue = ``;
|
|
2562
|
+
} else if (obj.defaultValue == "null") {
|
|
2563
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
2564
|
+
} else {
|
|
2565
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
2566
|
+
}
|
|
2567
|
+
return {
|
|
2568
|
+
defaultValue: defaultValue,
|
|
2569
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" jsonb;`,
|
|
2570
|
+
index: "",
|
|
2571
|
+
foreignKey: "",
|
|
2572
|
+
};
|
|
2573
|
+
},
|
|
2574
|
+
columnType: (obj = {}) => {
|
|
2575
|
+
return `jsonb`;
|
|
2576
|
+
},
|
|
2577
|
+
category: "jsonb",
|
|
2578
|
+
};
|
|
2579
|
+
|
|
2580
|
+
Model.dropdown_chain = {
|
|
2581
|
+
properties: [
|
|
2582
|
+
"required",
|
|
2583
|
+
"unique",
|
|
2584
|
+
"tabindex",
|
|
2585
|
+
"table",
|
|
2586
|
+
"name",
|
|
2587
|
+
"concat",
|
|
2588
|
+
"field",
|
|
2589
|
+
],
|
|
2590
|
+
labels: {
|
|
2591
|
+
required: "Required",
|
|
2592
|
+
unique: "Unique",
|
|
2593
|
+
tabindex: "Tab Index",
|
|
2594
|
+
table: "Module Name",
|
|
2595
|
+
name: "Name",
|
|
2596
|
+
concat: "Concat",
|
|
2597
|
+
field: "Field",
|
|
2598
|
+
},
|
|
2599
|
+
defaultValues: {
|
|
2600
|
+
required: false,
|
|
2601
|
+
unique: false,
|
|
2602
|
+
tabindex: 1,
|
|
2603
|
+
table: "user",
|
|
2604
|
+
name: "username",
|
|
2605
|
+
concat: "CONCAT(fullname, ' ',email)",
|
|
2606
|
+
field: "role_id",
|
|
2607
|
+
},
|
|
2608
|
+
typies: {
|
|
2609
|
+
required: {
|
|
2610
|
+
tag: "input",
|
|
2611
|
+
type: "checkbox",
|
|
2612
|
+
},
|
|
2613
|
+
unique: {
|
|
2614
|
+
tag: "input",
|
|
2615
|
+
type: "checkbox",
|
|
2616
|
+
},
|
|
2617
|
+
tabindex: {
|
|
2618
|
+
tag: "input",
|
|
2619
|
+
type: "number",
|
|
2620
|
+
},
|
|
2621
|
+
table: {
|
|
2622
|
+
tag: "select",
|
|
2623
|
+
type: "",
|
|
2624
|
+
},
|
|
2625
|
+
name: {
|
|
2626
|
+
tag: "select",
|
|
2627
|
+
type: "",
|
|
2628
|
+
},
|
|
2629
|
+
concat: {
|
|
2630
|
+
tag: "input",
|
|
2631
|
+
type: "text",
|
|
2632
|
+
},
|
|
2633
|
+
field: {
|
|
2634
|
+
tag: "input",
|
|
2635
|
+
type: "text",
|
|
2636
|
+
},
|
|
2637
|
+
},
|
|
2638
|
+
comment: (obj) => {
|
|
2639
|
+
return ``;
|
|
2640
|
+
},
|
|
2641
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2642
|
+
const length = !obj.length ? 255 : obj.length;
|
|
2643
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
2644
|
+
//var indexing = !obj.unique ? "" : "ALTER TABLE `"+MYMODEL.table+"` ADD UNIQUE INDEX `"+MYMODEL.table+"_"+key+"_UNIQUE` (`"+key+"`)";
|
|
2645
|
+
//var fk = "ALTER TABLE `"+MYMODEL.table+"` ADD CONSTRAINT `"+MYMODEL.table+"_"+key+"_FK` FOREIGN KEY (`"+key+"`) REFERENCES `"+obj.table+"`(`id`) ;";
|
|
2646
|
+
const indexing = !obj.unique
|
|
2647
|
+
? ""
|
|
2648
|
+
: ` ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT unique_${MYMODEL.table}_${key} UNIQUE (${key});`;
|
|
2649
|
+
const fk = `ALTER TABLE "${MYMODEL.table}" ADD CONSTRAINT fk_${MYMODEL.table}_${key} FOREIGN KEY (${key}) REFERENCES ${obj.table};`;
|
|
2650
|
+
return {
|
|
2651
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" bigint ;`,
|
|
2652
|
+
index: indexing,
|
|
2653
|
+
foreignKey: fk,
|
|
2654
|
+
};
|
|
2655
|
+
},
|
|
2656
|
+
columnType: (obj = {}) => {
|
|
2657
|
+
return `bigint`;
|
|
2658
|
+
},
|
|
2659
|
+
category: "integer",
|
|
2660
|
+
};
|
|
2661
|
+
|
|
2662
|
+
Model.dropdown_checkbox = {
|
|
2663
|
+
properties: ["required", "unique", "tabindex", "array"],
|
|
2664
|
+
labels: {
|
|
2665
|
+
required: "Required",
|
|
2666
|
+
unique: "Unique",
|
|
2667
|
+
tabindex: "Tab Index",
|
|
2668
|
+
array: "Array (with comma)",
|
|
2669
|
+
},
|
|
2670
|
+
defaultValues: {
|
|
2671
|
+
required: false,
|
|
2672
|
+
unique: false,
|
|
2673
|
+
tabindex: 1,
|
|
2674
|
+
array: "PHP, Javascript, Python",
|
|
2675
|
+
},
|
|
2676
|
+
typies: {
|
|
2677
|
+
required: {
|
|
2678
|
+
tag: "input",
|
|
2679
|
+
type: "checkbox",
|
|
2680
|
+
},
|
|
2681
|
+
unique: {
|
|
2682
|
+
tag: "input",
|
|
2683
|
+
type: "checkbox",
|
|
2684
|
+
},
|
|
2685
|
+
tabindex: {
|
|
2686
|
+
tag: "input",
|
|
2687
|
+
type: "number",
|
|
2688
|
+
},
|
|
2689
|
+
array: {
|
|
2690
|
+
tag: "input",
|
|
2691
|
+
type: "text",
|
|
2692
|
+
},
|
|
2693
|
+
},
|
|
2694
|
+
comment: (obj) => {
|
|
2695
|
+
//dropdown_static_1=Male,2=Female
|
|
2696
|
+
return `multi_checkbox`;
|
|
2697
|
+
},
|
|
2698
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2699
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
2700
|
+
let defaultValue = "";
|
|
2701
|
+
if (!obj.defaultValue) {
|
|
2702
|
+
defaultValue = ``;
|
|
2703
|
+
} else if (obj.defaultValue == "null") {
|
|
2704
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
2705
|
+
} else {
|
|
2706
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
2707
|
+
}
|
|
2708
|
+
//ALTER TABLE zuser_company ADD CONSTRAINT fk_user_company_role FOREIGN KEY (role_id) REFERENCES zrole (id);
|
|
2709
|
+
return {
|
|
2710
|
+
defaultValue: defaultValue,
|
|
2711
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" jsonb;`,
|
|
2712
|
+
index: "",
|
|
2713
|
+
foreignKey: "",
|
|
2714
|
+
};
|
|
2715
|
+
},
|
|
2716
|
+
columnType: (obj = {}) => {
|
|
2717
|
+
return `jsonb`;
|
|
2718
|
+
},
|
|
2719
|
+
category: "jsonb",
|
|
2720
|
+
};
|
|
2721
|
+
|
|
2722
|
+
Model.json = {
|
|
2723
|
+
properties: ["required", "unique", "tabindex", "hidden"],
|
|
2724
|
+
labels: {
|
|
2725
|
+
required: "Required",
|
|
2726
|
+
unique: "Unique",
|
|
2727
|
+
tabindex: "Tab Index",
|
|
2728
|
+
hidden: "Hidden",
|
|
2729
|
+
},
|
|
2730
|
+
defaultValues: {
|
|
2731
|
+
required: false,
|
|
2732
|
+
unique: false,
|
|
2733
|
+
tabindex: 1,
|
|
2734
|
+
hidden: false,
|
|
2735
|
+
},
|
|
2736
|
+
typies: {
|
|
2737
|
+
required: {
|
|
2738
|
+
tag: "input",
|
|
2739
|
+
type: "checkbox",
|
|
2740
|
+
},
|
|
2741
|
+
unique: {
|
|
2742
|
+
tag: "input",
|
|
2743
|
+
type: "checkbox",
|
|
2744
|
+
},
|
|
2745
|
+
tabindex: {
|
|
2746
|
+
tag: "input",
|
|
2747
|
+
type: "number",
|
|
2748
|
+
},
|
|
2749
|
+
hidden: {
|
|
2750
|
+
tag: "input",
|
|
2751
|
+
type: "checkbox",
|
|
2752
|
+
},
|
|
2753
|
+
},
|
|
2754
|
+
comment: (obj) => {
|
|
2755
|
+
return `json`;
|
|
2756
|
+
},
|
|
2757
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2758
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
2759
|
+
let defaultValue = "";
|
|
2760
|
+
if (!obj.defaultValue) {
|
|
2761
|
+
defaultValue = ``;
|
|
2762
|
+
} else if (obj.defaultValue == "null") {
|
|
2763
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
2764
|
+
} else {
|
|
2765
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
2766
|
+
}
|
|
2767
|
+
//ALTER TABLE zuser_company ADD CONSTRAINT fk_user_company_role FOREIGN KEY (role_id) REFERENCES zrole (id);
|
|
2768
|
+
return {
|
|
2769
|
+
defaultValue: defaultValue,
|
|
2770
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" JSON;`,
|
|
2771
|
+
index: "",
|
|
2772
|
+
foreignKey: "",
|
|
2773
|
+
};
|
|
2774
|
+
},
|
|
2775
|
+
columnType: (obj = {}) => {
|
|
2776
|
+
return `json`;
|
|
2777
|
+
},
|
|
2778
|
+
category: "json",
|
|
2779
|
+
};
|
|
2780
|
+
|
|
2781
|
+
|
|
2782
|
+
Model.location = {
|
|
2783
|
+
properties: ["required", "unique", "tabindex","height", "hidden"],
|
|
2784
|
+
labels: {
|
|
2785
|
+
required: "Required",
|
|
2786
|
+
unique: "Unique",
|
|
2787
|
+
tabindex: "Tab Index",
|
|
2788
|
+
height: "Height (px)",
|
|
2789
|
+
hidden: "Hidden",
|
|
2790
|
+
},
|
|
2791
|
+
defaultValues: {
|
|
2792
|
+
required: false,
|
|
2793
|
+
unique: false,
|
|
2794
|
+
tabindex: 1,
|
|
2795
|
+
height:200,
|
|
2796
|
+
hidden: false,
|
|
2797
|
+
},
|
|
2798
|
+
typies: {
|
|
2799
|
+
required: {
|
|
2800
|
+
tag: "input",
|
|
2801
|
+
type: "checkbox",
|
|
2802
|
+
},
|
|
2803
|
+
unique: {
|
|
2804
|
+
tag: "input",
|
|
2805
|
+
type: "checkbox",
|
|
2806
|
+
},
|
|
2807
|
+
tabindex: {
|
|
2808
|
+
tag: "input",
|
|
2809
|
+
type: "number",
|
|
2810
|
+
},
|
|
2811
|
+
height: {
|
|
2812
|
+
tag: "input",
|
|
2813
|
+
type: "number",
|
|
2814
|
+
},
|
|
2815
|
+
hidden: {
|
|
2816
|
+
tag: "input",
|
|
2817
|
+
type: "checkbox",
|
|
2818
|
+
},
|
|
2819
|
+
},
|
|
2820
|
+
comment: (obj) => {
|
|
2821
|
+
return `json`;
|
|
2822
|
+
},
|
|
2823
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2824
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
2825
|
+
let defaultValue = "";
|
|
2826
|
+
if (!obj.defaultValue) {
|
|
2827
|
+
defaultValue = ``;
|
|
2828
|
+
} else if (obj.defaultValue == "null") {
|
|
2829
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
2830
|
+
} else {
|
|
2831
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
2832
|
+
}
|
|
2833
|
+
//ALTER TABLE zuser_company ADD CONSTRAINT fk_user_company_role FOREIGN KEY (role_id) REFERENCES zrole (id);
|
|
2834
|
+
return {
|
|
2835
|
+
defaultValue: defaultValue,
|
|
2836
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" JSON;`,
|
|
2837
|
+
index: "",
|
|
2838
|
+
foreignKey: "",
|
|
2839
|
+
};
|
|
2840
|
+
},
|
|
2841
|
+
columnType: (obj = {}) => {
|
|
2842
|
+
return `json`;
|
|
2843
|
+
},
|
|
2844
|
+
category: "json",
|
|
2845
|
+
};
|
|
2846
|
+
|
|
2847
|
+
Model.dragdrop = {
|
|
2848
|
+
properties: [
|
|
2849
|
+
"required",
|
|
2850
|
+
"unique",
|
|
2851
|
+
"tabindex",
|
|
2852
|
+
"table",
|
|
2853
|
+
"name",
|
|
2854
|
+
"concat",
|
|
2855
|
+
"where",
|
|
2856
|
+
"left",
|
|
2857
|
+
"right"
|
|
2858
|
+
],
|
|
2859
|
+
labels: {
|
|
2860
|
+
required: "Required",
|
|
2861
|
+
unique: "Unique",
|
|
2862
|
+
tabindex: "Tab Index",
|
|
2863
|
+
table: "Module Name",
|
|
2864
|
+
name: "Label",
|
|
2865
|
+
concat: "Concat",
|
|
2866
|
+
where: "Where Query",
|
|
2867
|
+
left: "Left",
|
|
2868
|
+
right: "Right",
|
|
2869
|
+
},
|
|
2870
|
+
defaultValues: {
|
|
2871
|
+
required: false,
|
|
2872
|
+
unique: false,
|
|
2873
|
+
tabindex: 1,
|
|
2874
|
+
table: "user",
|
|
2875
|
+
where: "",
|
|
2876
|
+
name: "username",
|
|
2877
|
+
concat: "CONCAT(fullname, ' ',email)",
|
|
2878
|
+
left: "Active",
|
|
2879
|
+
right: "Not Active",
|
|
2880
|
+
},
|
|
2881
|
+
typies: {
|
|
2882
|
+
required: {
|
|
2883
|
+
tag: "input",
|
|
2884
|
+
type: "checkbox",
|
|
2885
|
+
},
|
|
2886
|
+
unique: {
|
|
2887
|
+
tag: "input",
|
|
2888
|
+
type: "checkbox",
|
|
2889
|
+
},
|
|
2890
|
+
tabindex: {
|
|
2891
|
+
tag: "input",
|
|
2892
|
+
type: "number",
|
|
2893
|
+
},
|
|
2894
|
+
table: {
|
|
2895
|
+
tag: "select",
|
|
2896
|
+
type: "",
|
|
2897
|
+
},
|
|
2898
|
+
where: {
|
|
2899
|
+
tag: "input",
|
|
2900
|
+
type: "text",
|
|
2901
|
+
},
|
|
2902
|
+
name: {
|
|
2903
|
+
tag: "select",
|
|
2904
|
+
type: "",
|
|
2905
|
+
},
|
|
2906
|
+
concat: {
|
|
2907
|
+
tag: "input",
|
|
2908
|
+
type: "text",
|
|
2909
|
+
},
|
|
2910
|
+
left: {
|
|
2911
|
+
tag: "input",
|
|
2912
|
+
type: "text",
|
|
2913
|
+
},
|
|
2914
|
+
right: {
|
|
2915
|
+
tag: "input",
|
|
2916
|
+
type: "text",
|
|
2917
|
+
}
|
|
2918
|
+
},
|
|
2919
|
+
comment: (obj) => {
|
|
2920
|
+
return ``;
|
|
2921
|
+
},
|
|
2922
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2923
|
+
const length = !obj.length ? 255 : obj.length;
|
|
2924
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
2925
|
+
let defaultValue = "";
|
|
2926
|
+
if (!obj.defaultValue) {
|
|
2927
|
+
defaultValue = ``;
|
|
2928
|
+
} else if (obj.defaultValue == "null") {
|
|
2929
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
2930
|
+
} else {
|
|
2931
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
2932
|
+
}
|
|
2933
|
+
return {
|
|
2934
|
+
defaultValue: defaultValue,
|
|
2935
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" jsonb;`,
|
|
2936
|
+
index: "",
|
|
2937
|
+
foreignKey: "",
|
|
2938
|
+
};
|
|
2939
|
+
},
|
|
2940
|
+
columnType: (obj = {}) => {
|
|
2941
|
+
return `jsonb`;
|
|
2942
|
+
},
|
|
2943
|
+
category: "jsonb",
|
|
2944
|
+
};
|
|
2945
|
+
|
|
2946
|
+
Model.ltree = {
|
|
2947
|
+
properties: ["required", "unique", "tabindex"],
|
|
2948
|
+
labels: {
|
|
2949
|
+
required: "Required",
|
|
2950
|
+
unique: "Unique",
|
|
2951
|
+
tabindex: "Tab Index",
|
|
2952
|
+
},
|
|
2953
|
+
defaultValues: {
|
|
2954
|
+
required: false,
|
|
2955
|
+
unique: false,
|
|
2956
|
+
tabindex: 1,
|
|
2957
|
+
},
|
|
2958
|
+
typies: {
|
|
2959
|
+
required: {
|
|
2960
|
+
tag: "input",
|
|
2961
|
+
type: "checkbox",
|
|
2962
|
+
},
|
|
2963
|
+
unique: {
|
|
2964
|
+
tag: "input",
|
|
2965
|
+
type: "checkbox",
|
|
2966
|
+
},
|
|
2967
|
+
tabindex: {
|
|
2968
|
+
tag: "input",
|
|
2969
|
+
type: "number",
|
|
2970
|
+
},
|
|
2971
|
+
},
|
|
2972
|
+
comment: (obj) => {
|
|
2973
|
+
return ``;
|
|
2974
|
+
},
|
|
2975
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
2976
|
+
const required = !obj.required ? "NULL" : "NOT NULL";
|
|
2977
|
+
let defaultValue = "";
|
|
2978
|
+
if (!obj.defaultValue) {
|
|
2979
|
+
defaultValue = `CREATE EXTENSION IF NOT EXISTS ltree; `;
|
|
2980
|
+
} else if (obj.defaultValue == "null") {
|
|
2981
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT NULL;`;
|
|
2982
|
+
} else {
|
|
2983
|
+
defaultValue = `ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" SET DEFAULT '${obj.defaultValue}';`;
|
|
2984
|
+
}
|
|
2985
|
+
//ALTER TABLE zuser_company ADD CONSTRAINT fk_user_company_role FOREIGN KEY (role_id) REFERENCES zrole (id);
|
|
2986
|
+
return {
|
|
2987
|
+
defaultValue: defaultValue,
|
|
2988
|
+
column: `ALTER TABLE "${MYMODEL.table}" ADD COLUMN "${key}" ltree;`,
|
|
2989
|
+
index: "",
|
|
2990
|
+
foreignKey: "",
|
|
2991
|
+
};
|
|
2992
|
+
},
|
|
2993
|
+
columnType: (obj = {}) => {
|
|
2994
|
+
return `ltree`;
|
|
2995
|
+
},
|
|
2996
|
+
category: "text",
|
|
2997
|
+
};
|
|
2998
|
+
|
|
2999
|
+
Model.virtual = {
|
|
3000
|
+
properties: ["required", "tabindex", "sql"],
|
|
3001
|
+
labels: {
|
|
3002
|
+
required: "Required",
|
|
3003
|
+
tabindex: "Tab Index",
|
|
3004
|
+
sql: "SQL Query",
|
|
3005
|
+
},
|
|
3006
|
+
defaultValues: {
|
|
3007
|
+
required: false,
|
|
3008
|
+
tabindex: 1,
|
|
3009
|
+
sql: " date_part('year',age(birth_date)) as age ",
|
|
3010
|
+
},
|
|
3011
|
+
typies: {
|
|
3012
|
+
required: {
|
|
3013
|
+
tag: "input",
|
|
3014
|
+
type: "checkbox",
|
|
3015
|
+
},
|
|
3016
|
+
tabindex: {
|
|
3017
|
+
tag: "input",
|
|
3018
|
+
type: "number",
|
|
3019
|
+
},
|
|
3020
|
+
sql: {
|
|
3021
|
+
tag: "input",
|
|
3022
|
+
type: "text",
|
|
3023
|
+
},
|
|
3024
|
+
},
|
|
3025
|
+
comment: (obj = {}) => {
|
|
3026
|
+
return ``;
|
|
3027
|
+
},
|
|
3028
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
3029
|
+
return {
|
|
3030
|
+
column: "",
|
|
3031
|
+
index: "",
|
|
3032
|
+
foreignKey: "",
|
|
3033
|
+
};
|
|
3034
|
+
},
|
|
3035
|
+
columnType: (obj = {}) => {
|
|
3036
|
+
return ``;
|
|
3037
|
+
},
|
|
3038
|
+
category: "virtual",
|
|
3039
|
+
};
|
|
3040
|
+
|
|
3041
|
+
Model.custom = {
|
|
3042
|
+
properties: ["code"],
|
|
3043
|
+
labels: {
|
|
3044
|
+
code: "Code",
|
|
3045
|
+
},
|
|
3046
|
+
defaultValues: {
|
|
3047
|
+
code: "",
|
|
3048
|
+
},
|
|
3049
|
+
typies: {
|
|
3050
|
+
code: {
|
|
3051
|
+
tag: "input",
|
|
3052
|
+
type: "text",
|
|
3053
|
+
},
|
|
3054
|
+
},
|
|
3055
|
+
comment: (obj = {}) => {
|
|
3056
|
+
return ``;
|
|
3057
|
+
},
|
|
3058
|
+
sql: (key, MYMODEL, obj = {}) => {
|
|
3059
|
+
return {
|
|
3060
|
+
column: "",
|
|
3061
|
+
index: "",
|
|
3062
|
+
foreignKey: "",
|
|
3063
|
+
};
|
|
3064
|
+
},
|
|
3065
|
+
columnType: (obj = {}) => {
|
|
3066
|
+
return ``;
|
|
3067
|
+
},
|
|
3068
|
+
category: "custom",
|
|
3069
|
+
};
|
|
3070
|
+
|
|
3071
|
+
Model.hardcodeGrid = `const data = await zRoute.listData(req, res, MYMODEL, zRole);
|
|
3072
|
+
${Util.tab}res.json(data);`;
|
|
3073
|
+
|
|
3074
|
+
Model.hardcodeGridOld = `const relations = await zRoute.relations(req, res, MYMODEL.table);
|
|
3075
|
+
const body = req.body;
|
|
3076
|
+
const fields = body.fields;
|
|
3077
|
+
const select = Util.selectMysql(fields,relations);
|
|
3078
|
+
let whereArray = [];
|
|
3079
|
+
const columns = body.columns;
|
|
3080
|
+
whereArray.push({
|
|
3081
|
+
field: "company_id",
|
|
3082
|
+
option: "=",
|
|
3083
|
+
value : res.locals.companyId,
|
|
3084
|
+
operator: "AND"
|
|
3085
|
+
});
|
|
3086
|
+
columns.forEach(function (item) {
|
|
3087
|
+
if (item.search.value) {
|
|
3088
|
+
whereArray.push({
|
|
3089
|
+
field: fields[item.data],
|
|
3090
|
+
option: MYMODEL.options[fields[item.data]],
|
|
3091
|
+
value : item.search.value,
|
|
3092
|
+
operator: "AND"
|
|
3093
|
+
})
|
|
3094
|
+
}
|
|
3095
|
+
});
|
|
3096
|
+
const orderColumn = fields[body.order[0].column] == "actionColumn" ? "id" : fields[body.order[0].column] == "no" ? "id" : fields[body.order[0].column] == "actionColum" ? "id" : fields[body.order[0].column];
|
|
3097
|
+
const rows = await connection.results({
|
|
3098
|
+
select: select,
|
|
3099
|
+
table: MYMODEL.table,
|
|
3100
|
+
whereArray: whereArray,
|
|
3101
|
+
limit: body.length,
|
|
3102
|
+
offset : body.start,
|
|
3103
|
+
orderBy: [orderColumn, body.order[0].dir]
|
|
3104
|
+
});
|
|
3105
|
+
const count = await connection.result({
|
|
3106
|
+
select: "count(id) as count",
|
|
3107
|
+
table: MYMODEL.table,
|
|
3108
|
+
whereArray: whereArray
|
|
3109
|
+
|
|
3110
|
+
});
|
|
3111
|
+
let datas = [];
|
|
3112
|
+
const levels = zRole.levels(MYMODEL.routeName, zRole.routes.indexOf(MYMODEL.routeName) > -1 ? await zRole.rules(res.locals.roleId) : {});
|
|
3113
|
+
rows.forEach(function (row, index) {
|
|
3114
|
+
let arr = [];
|
|
3115
|
+
fields.forEach(function (item) {
|
|
3116
|
+
if (item == "no") {
|
|
3117
|
+
arr.push((index + 1 + parseInt(body.start)));
|
|
3118
|
+
} else if (item == "actionColumn") {
|
|
3119
|
+
arr.push(zRoute.actionButtons(levels, row, MYMODEL.table));
|
|
3120
|
+
} else {
|
|
3121
|
+
arr.push(zRoute.dataTableData(item, row[item], MYMODEL, relations));
|
|
3122
|
+
}
|
|
3123
|
+
})
|
|
3124
|
+
datas.push(arr)
|
|
3125
|
+
});
|
|
3126
|
+
const data = {
|
|
3127
|
+
draw: body.draw,
|
|
3128
|
+
recordsTotal: count.count || 0,
|
|
3129
|
+
recordsFiltered: count.count || 0,
|
|
3130
|
+
data: datas
|
|
3131
|
+
}
|
|
3132
|
+
//save grid filter async
|
|
3133
|
+
zRoute.dataTableSave(MYMODEL.routeName, res.locals.userId, body);
|
|
3134
|
+
res.json(data);`;
|
|
3135
|
+
|
|
3136
|
+
for (let k in Model.keys) {
|
|
3137
|
+
//for label float
|
|
3138
|
+
Model[k].properties.push("float");
|
|
3139
|
+
Model[k].labels.float = "Label Float";
|
|
3140
|
+
Model[k].defaultValues.float = false;
|
|
3141
|
+
Model[k].typies.float = {
|
|
3142
|
+
tag: "input",
|
|
3143
|
+
type: "checkbox",
|
|
3144
|
+
};
|
|
3145
|
+
|
|
3146
|
+
//for label inline
|
|
3147
|
+
Model[k].properties.push("inline");
|
|
3148
|
+
Model[k].labels.inline = "Label Inline";
|
|
3149
|
+
Model[k].defaultValues.inline = false;
|
|
3150
|
+
Model[k].typies.inline = {
|
|
3151
|
+
tag: "input",
|
|
3152
|
+
type: "checkbox",
|
|
3153
|
+
};
|
|
3154
|
+
//for readonly
|
|
3155
|
+
Model[k].properties.push("readonly");
|
|
3156
|
+
Model[k].labels.readonly = "Read Only";
|
|
3157
|
+
Model[k].defaultValues.readonly = false;
|
|
3158
|
+
Model[k].typies.readonly = {
|
|
3159
|
+
tag: "input",
|
|
3160
|
+
type: "checkbox",
|
|
3161
|
+
};
|
|
3162
|
+
|
|
3163
|
+
if (k == "image") {
|
|
3164
|
+
Model.image.properties.push("width");
|
|
3165
|
+
Model.image.labels.width = "Width (px)";
|
|
3166
|
+
Model.image.defaultValues.width = "300";
|
|
3167
|
+
Model.image.typies.width = {
|
|
3168
|
+
tag: "input",
|
|
3169
|
+
type: "text",
|
|
3170
|
+
};
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
//console.log(k)
|
|
3174
|
+
}
|
|
3175
|
+
|
|
3176
|
+
module.exports = Model;
|