zet-lib 3.1.5 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -171,20 +171,249 @@ Api.index = async (req, res) => {
171
171
  }
172
172
  }
173
173
 
174
- Api.modal = async (req, res) => {
175
- let body = req.body;
176
- let result = body.result;
177
- let others = result.others || {}
178
- let othersArr = Object.keys(others) || [];
179
- let json = {}
180
- if(othersArr.length) {
181
- console.log('masuk ke container')
182
- json = await Api.modalWithContainer(req,res);
183
- } else {
184
- json = await Api.modalClassic(req,res);
174
+ Api.modal = async (body) => {
175
+ try {
176
+ let table = body.table || "";
177
+ let html = '';
178
+ let fields = [];
179
+ let datas = {table: '', tabs: [], labels: {}, details: {}, left: [], right: []};
180
+ let count = 1;
181
+ let tabView = '';
182
+ let tabBox = '';
183
+ let tabUl = '';
184
+ let tabContent = '';
185
+ let left = '', right = '', oneColumn = '';
186
+ let hasTab = false;
187
+ let properties = {};
188
+ let rowsFields;
189
+ let result = body.result;
190
+ const others = result.others || {};
191
+ let othersArr = Object.keys(others) || [];
192
+ const hasContainer = othersArr.length > 0;
193
+
194
+ let leftData = others.LEFT || [];
195
+ let rightData = others.RIGHT || [];
196
+ let oneColumnData = others.ONE_COLUMN || [];
197
+ let leftsNew = [], rightsNew = [], oneColumnsNew = [];
198
+ let ALL_FIELDS = {};
199
+
200
+ if (table) {
201
+ rowsFields = body.rowsFields;
202
+ if (result.id) {
203
+ datas = {
204
+ details: result.details || {},
205
+ labels: result.labels || {},
206
+ tabs: result.tabs || [],
207
+ left: result.left || [],
208
+ right: result.right || [],
209
+ oneColumn: result.one_column || [],
210
+ sorting: result.sorting || [],
211
+ property: result.properties || {}
212
+ };
213
+ let details = datas.details;
214
+ properties = datas.property;
215
+ let tabs = datas.tabs;
216
+
217
+ // Jika ada container, gunakan containerObject untuk memproses data
218
+ if (hasContainer) {
219
+ ALL_FIELDS = containerObject(leftData, rightData, oneColumnData, tabs);
220
+ }
221
+
222
+ if (tabs.length) {
223
+ hasTab = true;
224
+ }
225
+
226
+ if (hasTab) {
227
+ let tabLeft = [], tabRight = [], tabOneColum = [];
228
+
229
+ tabUl += '<ul class="nav nav-tabs" id="myTab" role="tablist">';
230
+ tabContent += '<div class="tab-content" id="myTabContent">';
231
+ tabs.forEach(function (item, i) {
232
+ let navlink = i == 0 ? ' active' : '';
233
+ let ariaselected = i == 0 ? "true" : "false";
234
+ let showActive = i == 0 ? ' show active ' : '';
235
+ let n = i + 1;
236
+ let arrName = 'arr' + i;
237
+ let dynamicsLeft = '', dynamicsRight = '', dynamicsOneColumn = '';
238
+
239
+ if (hasContainer) {
240
+ // Logika untuk container
241
+ tabLeft = ALL_FIELDS.tabLeft[arrName] || [];
242
+ tabRight = ALL_FIELDS.tabRight[arrName] || [];
243
+ tabOneColum = ALL_FIELDS.tabOneColumn[arrName] || [];
244
+
245
+ if (tabLeft.length) {
246
+ tabLeft.map((o) => {
247
+ dynamicsLeft += makeItemsOl(o, "LEFT", i, datas);
248
+ });
249
+ }
250
+ if (tabRight.length) {
251
+ tabRight.map((o) => {
252
+ dynamicsRight += makeItemsOl(o, "RIGHT", i, datas);
253
+ });
254
+ }
255
+ if (tabOneColum.length) {
256
+ tabOneColum.map((o) => {
257
+ dynamicsOneColumn += makeItemsOl(o, "ONE_COLUMN", i, datas);
258
+ });
259
+ }
260
+ } else {
261
+ // Logika untuk classic
262
+ if (datas.left.length) {
263
+ datas.left.forEach(function (o) {
264
+ if (typeof o == "object") {
265
+ for (var key in o) {
266
+ if (key == arrName) {
267
+ tabLeft = o[key];
268
+ }
269
+ }
270
+ }
271
+ });
272
+ }
273
+ if (datas.right.length) {
274
+ datas.right.forEach(function (o) {
275
+ if (typeof o == "object") {
276
+ for (var key in o) {
277
+ if (key == arrName) {
278
+ tabRight = o[key];
279
+ }
280
+ }
281
+ }
282
+ });
283
+ }
284
+ if (datas.oneColumn.length) {
285
+ datas.oneColumn.forEach(function (o) {
286
+ if (typeof o == "object") {
287
+ for (var key in o) {
288
+ if (key == arrName) {
289
+ tabOneColum = o[key];
290
+ }
291
+ }
292
+ }
293
+ });
294
+ }
295
+
296
+ if (tabLeft.length) {
297
+ tabLeft.map((o) => {
298
+ if(datas.property[o] && datas.property[o].hasOwnProperty("type") ) {
299
+ dynamicsLeft += dragable_with_icon(o, datas.labels[o], i, "LEFT", datas.property[o].type);
300
+ }
301
+ });
302
+ }
303
+ if (tabRight.length) {
304
+ tabRight.map((o) => {
305
+ if(datas.property[o] && datas.property[o].hasOwnProperty("type") ) {
306
+ dynamicsRight += dragable_with_icon(o, datas.labels[o], i, "RIGHT", datas.property[o].type);
307
+ }
308
+ });
309
+ }
310
+ if (tabOneColum.length) {
311
+ tabOneColum.map((o) => {
312
+ if(datas.property[o] && datas.property[o].hasOwnProperty("type") ) {
313
+ dynamicsOneColumn += dragable_with_icon(o, datas.labels[o], i, "ONE_COLUMN", datas.property[o].type);
314
+ }
315
+ });
316
+ }
317
+ }
318
+
319
+ tabView += `<li class="item" draggable="true"><div class='divtabs'>${n}. <span class="tabname"> ${item}</span><input type='hidden' name='tabs[]' value='${item}' /> <button type='button' class='btn btn-sm btn-info edittab' data-toggle="modal" data-target="#modal_tab" data-name="${item}" data-id="${i}" > <i class='fas fa-edit'></i> </button> <button type='button' onclick='deleteTab(this)' class='btn btn-sm btn-danger trashtab'><i class='fas fa-trash'></i> </button></div></li>`;
320
+ tabUl += `<li class="nav-item">
321
+ <a class="nav-link ${navlink}" id="tabid${i}" data-toggle="tab" href="#tabgo${i}" role="tab" aria-controls="tabgo${i}" aria-selected="${ariaselected}">${item}</a>
322
+ </li>`;
323
+
324
+ tabContent += `<div class="tab-pane fade ${showActive}" id="tabgo${i}" role="tabpanel" aria-labelledby="tabtabgo${i}">
325
+ <div class="container">
326
+ <div class="row">
327
+ <div class="col-md-6"><ol class="mydragable divbox" data-name="LEFT" id="arr${i}">${dynamicsLeft}</ol></div>
328
+ <div class="col-md-6"><ol class="mydragable divbox" data-name="RIGHT" id="arr${i}">${dynamicsRight}</ol></div>
329
+ </div>
330
+ <div class="row">
331
+ <div class="col-md-12"><ol class="mydragable divbox" data-name="ONE_COLUMN" id="arr${i}">${dynamicsOneColumn}</ol></div>
332
+ </div>
333
+ </div>
334
+ </div>`;
335
+ });
336
+ tabUl += '</ul>';
337
+ tabContent += '</div>';
338
+ count = tabs.length + 1;
339
+ }
340
+ }
341
+ }
342
+
343
+ // Proses data untuk left, right, dan oneColumn di luar tabs
344
+ if (hasContainer) {
345
+ // Logika untuk container
346
+ let datasLeft = ALL_FIELDS.left || [];
347
+ let datasRight = ALL_FIELDS.right || [];
348
+ let datasOneColumn = ALL_FIELDS.oneColumn || [];
349
+
350
+ if (datasLeft.length) {
351
+ datasLeft.forEach(function (item) {
352
+ if(!Util.in_array(item, leftsNew)) {
353
+ left += makeItemsOl(item, "LEFT", "", datas);
354
+ }
355
+ });
356
+ }
357
+ if (datasRight.length) {
358
+ datasRight.forEach(function (item) {
359
+ if(!Util.in_array(item, rightsNew)) {
360
+ right += makeItemsOl(item, "RIGHT", "", datas);
361
+ }
362
+ });
363
+ }
364
+ if (datasOneColumn.length) {
365
+ datasOneColumn.forEach(function (item) {
366
+ if(!Util.in_array(item, oneColumnsNew)) {
367
+ oneColumn += makeItemsOl(item, "ONE_COLUMN", "", datas);
368
+ }
369
+ });
370
+ }
371
+ } else {
372
+ // Logika untuk classic
373
+ if (datas.left.length) {
374
+ datas.left.forEach(function (item) {
375
+ if (properties.hasOwnProperty(item)) {
376
+ left += dragable_with_icon(item, datas.labels[item], "", "LEFT", datas.property[item].type);
377
+ }
378
+ });
379
+ }
380
+ if (datas.right.length) {
381
+ datas.right.forEach(function (item) {
382
+ if (properties.hasOwnProperty(item)) {
383
+ right += dragable_with_icon(item, datas.labels[item], "", "RIGHT", datas.property[item].type);
384
+ }
385
+ });
386
+ }
387
+ if (datas.oneColumn.length) {
388
+ datas.oneColumn.forEach(function (item) {
389
+ if (properties.hasOwnProperty(item)) {
390
+ oneColumn += dragable_with_icon(item, datas.labels[item], "", "ONE_COLUMN", datas.property[item].type);
391
+ }
392
+ });
393
+ }
394
+ }
395
+
396
+ datas.sorting.forEach(function (item, index) {
397
+ if (item == 1) {
398
+ html += columnOne(oneColumn);
399
+ } else {
400
+ html += `<div class="row sortable"><i class="fa fa-arrows icon-floats"></i>${columnLR(left, "LEFT")} ${columnLR(right, "RIGHT")}</div>`;
401
+ }
402
+ });
403
+
404
+ datas.others = others;
405
+ let json = {}
406
+ json.html = html;
407
+ json.datas = datas;
408
+ json.tabview = tabView;
409
+ json.count = count;
410
+ json.tabBox = tabUl + tabContent;
411
+
412
+ return json;
413
+ } catch (e) {
414
+ console.log(e)
415
+ return Util.flashError(e.toString());
185
416
  }
186
- //console.log(JSON.stringify(json))
187
- res.json(json)
188
417
  };
189
418
 
190
419
  function containerObject(left,right,oneColumn,tabs = []) {
@@ -367,368 +596,6 @@ function containerObject(left,right,oneColumn,tabs = []) {
367
596
  }
368
597
  }
369
598
 
370
- Api.modalWithContainer = async (body) => {
371
- try {
372
- //let body = req.body;
373
- /* console.log(body)
374
- console.log("Container....")*/
375
- let table = body.table || "";
376
- let html = '';
377
- let fields = [];
378
- let datas = {table: '', tabs: [], labels: {}, details: {}, left: [], right: []};
379
- let count = 1;
380
- let tabView = '';
381
- let tabBox = '';
382
- let tabUl = '';
383
- let tabContent = '';
384
- let left = '', right = '', oneColumn = '';
385
- let hasTab = false;
386
- let properties = {};
387
- let rowsFields;
388
- let result = body.result;
389
- const others = result.others || {};
390
- let leftData = others.LEFT || [];
391
- //console.log(leftData);
392
- let rightData = others.RIGHT || [];
393
- let oneColumnData = others.ONE_COLUMN || [];
394
- let leftsNew = [], rightsNew = [], oneColumnsNew = [];
395
- let ALL_FIELDS = {};
396
- if (table) {
397
- rowsFields = body.rowsFields;
398
- //console.log('result : ' + JSON.stringify(result))
399
- if (result.id) {
400
- datas = {
401
- details: result.details || {},
402
- labels: result.labels || {},
403
- tabs: result.tabs || [],
404
- left: result.left || [],
405
- right: result.right || [],
406
- oneColumn: result.one_column || [],
407
- sorting: result.sorting || [],
408
- property: result.properties || {}
409
- };
410
- let details = datas.details;
411
- properties = datas.property;
412
- let tabs = datas.tabs;
413
- ALL_FIELDS = containerObject(leftData,rightData,oneColumnData,tabs);
414
- console.log(ALL_FIELDS);
415
- if (tabs.length) {
416
- hasTab = true;
417
- }
418
- if (hasTab) {
419
- let tabLeft = [], tabRight = [], tabOneColum = [];
420
-
421
- tabUl += '<ul class="nav nav-tabs" id="myTab" role="tablist">';
422
- tabContent += '<div class="tab-content" id="myTabContent">';
423
- tabs.forEach(function (item, i) {
424
- let navlink = i == 0 ? ' active' : '';
425
- let ariaselected = i == 0 ? "true" : "false";
426
- let showActive = i == 0 ? ' show active ' : '';
427
- let n = i + 1;
428
- let arrName = 'arr' + i;
429
- let dynamicsLeft = '', dynamicsRight = '', dynamicsOneColumn = '';
430
- tabLeft = ALL_FIELDS.tabLeft[arrName];
431
- tabRight = ALL_FIELDS.tabRight[arrName];
432
- tabOneColum = ALL_FIELDS.tabOneColumn[arrName];
433
- if (tabLeft.length) {
434
- if(i==0) {
435
- console.log(JSON.stringify(tabLeft))
436
- }
437
- tabLeft.map((o) => {
438
- dynamicsLeft += makeItemsOl(o,"LEFT",i,datas);
439
- });
440
- }
441
-
442
- if (tabRight.length) {
443
- tabRight.map((o) => {
444
- dynamicsRight += makeItemsOl(o,"RIGHT",i,datas);
445
- });
446
- }
447
-
448
- if (tabOneColum.length) {
449
- tabOneColum.map((o) => {
450
- dynamicsOneColumn += makeItemsOl(o,"ONE_COLUMN",i,datas);
451
- });
452
- }
453
-
454
-
455
- tabView += `<li class="item" draggable="true"><div class='divtabs'>${n}. <span class="tabname"> ${item}</span><input type='hidden' name='tabs[]' value='${item}' /> <button type='button' class='btn btn-sm btn-info edittab' data-toggle="modal" data-target="#modal_tab" data-name="${item}" data-id="${i}" > <i class='fas fa-edit'></i> </button> <button type='button' onclick='$(this).parent().remove();' class='btn btn-sm btn-danger trashtab'><i class='fas fa-trash'></i> </button></div></li>`;
456
- tabUl += `<li class="nav-item">
457
- <a class="nav-link ${navlink}" id="tabid${i}" data-toggle="tab" href="#tabgo${i}" role="tab" aria-controls="tabgo${i}" aria-selected="${ariaselected}">${item}</a>
458
- </li>`;
459
-
460
- tabContent += `<div class="tab-pane fade ${showActive}" id="tabgo${i}" role="tabpanel" aria-labelledby="tabtabgo${i}">
461
- <div class="container">
462
- <div class="row">
463
- <div class="col-md-6"><ol class="mydragable divbox" data-name="LEFT" id="arr${i}">${dynamicsLeft}</ol></div>
464
- <div class="col-md-6"><ol class="mydragable divbox" data-name="RIGHT" id="arr${i}">${dynamicsRight}</ol></div>
465
- </div>
466
- <div class="row">
467
- <div class="col-md-12"><ol class="mydragable divbox" data-name="ONE_COLUMN" id="arr${i}">${dynamicsOneColumn}</ol></div>
468
- </div>
469
- </div>
470
- </div>`;
471
- });
472
- //end tabs
473
- tabUl += '</ul>';
474
- tabContent += '</div>';
475
- count = tabs.length + 1;
476
- }
477
- }
478
- }
479
-
480
-
481
- //caption left or right
482
- let datasLeft = ALL_FIELDS.left;
483
- let datasRight = ALL_FIELDS.right;
484
- let datasOneColumn = ALL_FIELDS.oneColumn;
485
- //console.log(JSON.stringify(ALL_FIELDS));
486
-
487
- if (datasLeft.length) {
488
- datasLeft.forEach(function (item) {
489
- if(!Util.in_array(item,leftsNew)) {
490
- left += makeItemsOl(item,"LEFT","",datas);
491
- }
492
- });
493
- }
494
- if (datasRight.length) {
495
- datasRight.forEach(function (item) {
496
- if(!Util.in_array(item,rightsNew)) {
497
- right += makeItemsOl(item,"RIGHT","",datas);
498
- }
499
- });
500
- }
501
- if (datasOneColumn.length) {
502
- datasOneColumn.forEach(function (item) {
503
- //console.log(`item ${item}`);
504
- if(!Util.in_array(item,oneColumnsNew)) {
505
- oneColumn += makeItemsOl(item,"ONE_COLUMN","",datas);
506
- }
507
- });
508
- }
509
-
510
- datas.sorting.forEach(function (item, index) {
511
- if (item == 1) {
512
- html += columnOne(oneColumn);
513
- } else {
514
- html += `<div class="row sortable"><i class="fa fa-arrows icon-floats"></i>${columnLR(left, "LEFT")} ${columnLR(right, "RIGHT")}</div>`;
515
- }
516
- });
517
- datas.others = others;
518
- let json = {}
519
- json.html = html;
520
- json.datas = datas;
521
- json.tabview = tabView;
522
- json.count = count;
523
- json.tabBox = tabUl + tabContent;
524
-
525
- //console.log(JSON.stringify(json))
526
- //res.json(json);
527
- return json;
528
- } catch (e) {
529
- console.log(e)
530
- //res.status(400).json({message: e.toString()})
531
- return Util.flashError(e.toString());
532
- }
533
- };
534
-
535
- Api.modalClassic = async (body) => {
536
- try {
537
- //const body = req.body;
538
- //console.log(body)
539
- const table = body.table || "";
540
- let html = '';
541
- var datas = {table: '', tabs: [], labels: {}, details: {}, left: [], right: []};
542
- let count = 1;
543
- let tabView = '';
544
- let tabUl = '';
545
- let tabContent = '';
546
- let left = '', right = '', oneColumn = '';
547
- let hasTab = false;
548
- let properties = {}
549
- let rowsFields;
550
- if (table) {
551
- let result = body.result;
552
- rowsFields = body.rowsFields;
553
- //console.log('result : ' + JSON.stringify(result))
554
- if (result.id) {
555
- datas = {
556
- details: result.details || {},
557
- labels: result.labels || {},
558
- tabs: result.tabs || [],
559
- left: result.left || [],
560
- right: result.right || [],
561
- oneColumn: result.one_column || [],
562
- sorting: result.sorting || [],
563
- property: result.properties || {}
564
- };
565
- let details = datas.details;
566
- properties = datas.property;
567
- let tabs = datas.tabs;
568
- if (tabs.length) {
569
- hasTab = true;
570
- }
571
- if (hasTab) {
572
- tabUl += '<ul class="nav nav-tabs" id="myTab" role="tablist">';
573
- tabContent += '<div class="tab-content" id="myTabContent">';
574
- tabs.forEach(function (item, i) {
575
- const navlink = i == 0 ? ' active' : '';
576
- const ariaselected = i == 0 ? "true" : "false";
577
- const showActive = i == 0 ? ' show active ' : '';
578
- const n = i + 1;
579
- const arrName = 'arr' + i;
580
- let dynamicsLeft = '', dynamicsRight = '', dynamicsOneColumn = '';
581
- let tabLeft = [], tabRight = [], tabOneColum = [];
582
- if (datas.left.length) {
583
- datas.left.forEach(function (o) {
584
- if (typeof o == "object") {
585
- for (var key in o) {
586
- if (key == arrName) {
587
- tabLeft = o[key];
588
- }
589
- }
590
- }
591
- });
592
- }
593
- if (datas.right.length) {
594
- datas.right.forEach(function (o) {
595
- if (typeof o == "object") {
596
- for (var key in o) {
597
- if (key == arrName) {
598
- tabRight = o[key];
599
- }
600
- }
601
- }
602
- });
603
- }
604
- if (datas.oneColumn.length) {
605
- datas.oneColumn.forEach(function (o) {
606
- if (typeof o == "object") {
607
- for (var key in o) {
608
- if (key == arrName) {
609
- tabOneColum = o[key];
610
- }
611
- }
612
- }
613
- });
614
- }
615
-
616
- /* console.log(arrName);
617
- console.log("tableft");
618
- console.log(JSON.stringify(tabLeft));
619
- console.log("tableft end");
620
- console.log("tabright");
621
- console.log(JSON.stringify(tabRight));
622
- console.log("tabright");
623
- console.log("tabonecolumn");
624
- console.log(JSON.stringify(tabOneColum));
625
- console.log("tabonecolumn end");*/
626
-
627
-
628
- if (tabLeft.length) {
629
- tabLeft.map((o) => {
630
- if(datas.property[o] && datas.property[o].hasOwnProperty("type") ) {
631
- dynamicsLeft += dragable_with_icon(o, datas.labels[o], i, "LEFT", datas.property[o].type);
632
- }
633
- });
634
- }
635
- if (tabRight.length) {
636
- tabRight.map((o) => {
637
- if(datas.property[o] && datas.property[o].hasOwnProperty("type") ) {
638
- dynamicsRight += dragable_with_icon(o, datas.labels[o], i, "RIGHT", datas.property[o].type);
639
- }
640
- });
641
- }
642
-
643
- if (tabOneColum.length) {
644
- tabOneColum.map((o) => {
645
- if(datas.property[o] && datas.property[o].hasOwnProperty("type") ) {
646
- dynamicsOneColumn += dragable_with_icon(o, datas.labels[o], i, "ONE_COLUMN", datas.property[o].type);
647
- }
648
- });
649
- }
650
-
651
- tabView += `<li class="item" draggable="true"><div class='divtabs'>${n}. <span class="tabname"> ${item}</span><input type='hidden' name='tabs[]' value='${item}' /> <button type='button' class='btn btn-sm btn-info edittab' data-toggle="modal" data-target="#modal_tab" data-name="${item}" data-id="${i}" > <i class='fas fa-edit'></i> </button> <button type='button' onclick='$(this).parent().remove();' class='btn btn-sm btn-danger trashtab'><i class='fas fa-trash'></i> </button></div></li>`;
652
- tabUl += `<li class="nav-item">
653
- <a class="nav-link ${navlink}" id="tabid${i}" data-toggle="tab" href="#tabgo${i}" role="tab" aria-controls="tabgo${i}" aria-selected="${ariaselected}">${item}</a>
654
- </li>`;
655
-
656
- tabContent += `<div class="tab-pane fade ${showActive}" id="tabgo${i}" role="tabpanel" aria-labelledby="tabtabgo${i}">
657
- <div class="container">
658
- <div class="row">
659
- <div class="col-md-6"><ol class="mydragable divbox" data-name="LEFT" id="arr${i}">${dynamicsLeft}</ol></div>
660
- <div class="col-md-6"><ol class="mydragable divbox" data-name="RIGHT" id="arr${i}">${dynamicsRight}</ol></div>
661
- </div>
662
- <div class="row">
663
- <div class="col-md-12"><ol class="mydragable divbox" data-name="ONE_COLUMN" id="arr${i}">${dynamicsOneColumn}</ol></div>
664
- </div>
665
- </div>
666
- </div>`;
667
- });
668
- //end tabs
669
- tabUl += '</ul>';
670
- tabContent += '</div>';
671
- count = tabs.length + 1;
672
- }
673
- }
674
- }
675
-
676
- /* var rows = [];
677
- if (Util.isEmptyObject(datas.details)) {
678
- rows = await fieldsTable(table, rowsFields);
679
- } else {
680
- var d = datas.details;
681
- var notabs = d.hasOwnProperty('notabs') ? d.notabs : [];
682
- for (var i = 0; i < notabs.length; i++) {
683
- rows.push({name: notabs[i], label: datas.labels[notabs[i]]})
684
- }
685
- }*/
686
-
687
- //caption left or right
688
- if (datas.left.length) {
689
- datas.left.forEach(function (item) {
690
- if (properties.hasOwnProperty(item)) {
691
- left += dragable_with_icon(item, datas.labels[item], "", "LEFT", datas.property[item].type);
692
- }
693
- });
694
- }
695
- if (datas.right.length) {
696
- datas.right.forEach(function (item) {
697
- if (properties.hasOwnProperty(item)) {
698
- right += dragable_with_icon(item, datas.labels[item], "", "RIGHT", datas.property[item].type);
699
- }
700
- });
701
- }
702
- if (datas.oneColumn.length) {
703
- datas.oneColumn.forEach(function (item) {
704
- if (properties.hasOwnProperty(item)) {
705
- oneColumn += dragable_with_icon(item, datas.labels[item], "", "ONE_COLUMN", datas.property[item].type);
706
- }
707
- });
708
- }
709
- datas.sorting.forEach(function (item, index) {
710
- if (item == 1) {
711
- html += columnOne(oneColumn);
712
- } else {
713
- html += `<div class="row sortable"><i class="fa fa-arrows icon-floats"></i>${columnLR(left, "LEFT")} ${columnLR(right, "RIGHT")}</div>`;
714
- }
715
- });
716
- let json = {}
717
- json.html = html;
718
- json.datas = datas;
719
- json.tabview = tabView;
720
- json.count = count;
721
- json.tabBox = tabUl + tabContent;
722
-
723
- return json;
724
- //res.json(json);
725
- } catch (e) {
726
- console.log(e)
727
- //res.status(400).json({message: e.toString()})
728
- //json = {}
729
- return {}
730
- }
731
- }
732
599
 
733
600
  const makeItemsOl = (o,columnName,tabName, datas) => {
734
601
  let html = '';
@@ -392,6 +392,16 @@ me.prepare = (MYMODEL) => {
392
392
  widgets[key].please_select = property.values.please_select;
393
393
  widgets[key].order_by = property.values.order_by;
394
394
  widgets[key].import_field = property.values.import_field || "id";
395
+ widgets[key].relation_info = property.values.relation_info ? true : false;
396
+ if(widgets[key].relation_info) {
397
+ //create file info to runtime
398
+ let dirInfo = `${dirRoot}/public/runtime/info/${MYMODEL.table}`
399
+ //Util.writeFile(`${dirRoot}/runtime/info/${MYMODEL.tab}`)
400
+ if(!fs.existsSync(dirInfo)) {
401
+ fs.mkdirSync(dirInfo, { recursive: true });
402
+ }
403
+ fs.writeFileSync(`${dirInfo}/${key}.txt`, property.values.relation_info);
404
+ }
395
405
  break;
396
406
  case "dragdrop":
397
407
  widgets[key].table = property.values.table;