zet-lib 3.0.6 → 3.0.7
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/zGeneratorRouter.js +26 -4
- package/package.json +1 -1
package/lib/zGeneratorRouter.js
CHANGED
|
@@ -177,12 +177,12 @@ router.post("/fields", async (req, res) => {
|
|
|
177
177
|
let othersArr = Object.keys(others) || [];
|
|
178
178
|
let json = {}
|
|
179
179
|
if(othersArr.length) {
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
console.log('masuk ke container')
|
|
181
|
+
json = await Api.modalWithContainer(objData);
|
|
182
182
|
} else {
|
|
183
|
-
|
|
183
|
+
json = await Api.modalClassic(objData);
|
|
184
184
|
}
|
|
185
|
-
|
|
185
|
+
|
|
186
186
|
res.json(json);
|
|
187
187
|
} catch (e) {
|
|
188
188
|
console.log(e);
|
|
@@ -1132,6 +1132,28 @@ router.post("/save_setting", async (req, res) => {
|
|
|
1132
1132
|
return res.json(Util.flashError("Table is locked"));
|
|
1133
1133
|
}
|
|
1134
1134
|
const post = req.body;
|
|
1135
|
+
for(let key in post) {
|
|
1136
|
+
for(let q in post[key]){
|
|
1137
|
+
if(q == "select"){
|
|
1138
|
+
let selects = post[key][q] || []
|
|
1139
|
+
if(selects.length){
|
|
1140
|
+
// Validasi setiap item harus memiliki value dan label yang terisi
|
|
1141
|
+
for(let i = 0; i < selects.length; i++){
|
|
1142
|
+
const item = selects[i];
|
|
1143
|
+
if(!item || typeof item !== 'object'){
|
|
1144
|
+
return res.json(Util.flashError(`Select item at index ${i} must be an object`));
|
|
1145
|
+
}
|
|
1146
|
+
if(!item.hasOwnProperty('value') || item.value === null || item.value === undefined || item.value === ''){
|
|
1147
|
+
return res.json(Util.flashError(`Select item at index ${i} must have a non-empty value`));
|
|
1148
|
+
}
|
|
1149
|
+
if(!item.hasOwnProperty('label') || item.label === null || item.label === undefined || item.label === ''){
|
|
1150
|
+
return res.json(Util.flashError(`Select item at index ${i} must have a non-empty label`));
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1135
1157
|
let data = await connection.result({
|
|
1136
1158
|
table: "zfields",
|
|
1137
1159
|
where: { table: table },
|