biz9-logic 3.5.38 → 3.5.39
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/biz9_config +1 -1
- package/index.js +71 -1
- package/package.json +1 -1
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -5,13 +5,18 @@ License GNU General Public License v3.0
|
|
|
5
5
|
Description: BiZ9 Framework: Logic-JS
|
|
6
6
|
*/
|
|
7
7
|
const { get_new_item_main,get_data_config_main,get_cloud_url_main,get_biz_item_main,get_cloud_filter_obj_main,get_title_url_main } = require('./main');
|
|
8
|
-
const {Log,Test,Str,DateTime} = require('biz9-utility');
|
|
8
|
+
const { Log,Test,Str,DateTime } = require('biz9-utility');
|
|
9
|
+
|
|
9
10
|
class Message {
|
|
11
|
+
|
|
10
12
|
static SUCCESS="Update Success";
|
|
11
13
|
static LOGIN_GOOD="Login Success";
|
|
12
14
|
static LOGIN_BAD="Login Incorrect";
|
|
15
|
+
|
|
13
16
|
}
|
|
17
|
+
|
|
14
18
|
class DataType {
|
|
19
|
+
|
|
15
20
|
static get_title = (data_type) => {
|
|
16
21
|
if(!data_type){
|
|
17
22
|
return "";
|
|
@@ -19,6 +24,7 @@ class DataType {
|
|
|
19
24
|
return String(Str.get_title(data_type.replaceAll('_',' ').replaceAll('dt','').replace('biz',''))).trim();
|
|
20
25
|
}
|
|
21
26
|
}
|
|
27
|
+
|
|
22
28
|
static DT_ADMIN='admin_biz';
|
|
23
29
|
static DT_BLANK='blank_biz';
|
|
24
30
|
static DT_BUSINESS='business_biz';
|
|
@@ -43,12 +49,15 @@ class DataType {
|
|
|
43
49
|
static DT_VIDEO='video_biz';
|
|
44
50
|
}
|
|
45
51
|
class DataItem {
|
|
52
|
+
|
|
46
53
|
static get_new = (data_type,id) => {
|
|
47
54
|
return get_new_item_main(data_type,id);
|
|
48
55
|
};
|
|
56
|
+
|
|
49
57
|
static get_biz = (biz9_config,item,options)=>{
|
|
50
58
|
return get_biz_item_main(biz9_config,item,options);
|
|
51
59
|
}
|
|
60
|
+
|
|
52
61
|
static get_biz_by_list = (biz9_config,list,options)=>{
|
|
53
62
|
let r_list = [];
|
|
54
63
|
for(let a=0;a<list.length;a++){
|
|
@@ -56,76 +65,107 @@ class DataItem {
|
|
|
56
65
|
}
|
|
57
66
|
return r_list;
|
|
58
67
|
}
|
|
68
|
+
|
|
59
69
|
}
|
|
60
70
|
class BiZ_Url {
|
|
71
|
+
|
|
61
72
|
static get_item=(biz9_config,data_type,id)=>{
|
|
62
73
|
let action_url="main/biz_item/get/"+data_type+"/"+id ;
|
|
63
74
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
64
75
|
};
|
|
76
|
+
|
|
65
77
|
static delete_item=(biz9_config,data_type,id)=>{
|
|
66
78
|
let action_url= "main/biz_item/delete/"+data_type+"/"+id ;
|
|
67
79
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
68
80
|
};
|
|
81
|
+
|
|
69
82
|
static get_full_item=(biz9_config,data_type,id)=>{
|
|
70
83
|
let action_url= "main/biz_item/get_full/"+data_type+"/"+id;
|
|
71
84
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
72
85
|
};
|
|
86
|
+
|
|
87
|
+
static get_page=(biz9_config,data_type,title_url)=>{
|
|
88
|
+
let action_url= "main/biz_item/get_page/"+data_type+"/"+title_url;
|
|
89
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
static get_template=(biz9_config,title_url)=>{
|
|
93
|
+
let action_url= "main/biz_item/get_template/"+title_url;
|
|
94
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
95
|
+
};
|
|
96
|
+
|
|
73
97
|
}
|
|
74
98
|
class Url {
|
|
99
|
+
|
|
75
100
|
static get = (biz9_config,action_url,params)=>{
|
|
76
101
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,params);
|
|
77
102
|
}
|
|
103
|
+
|
|
78
104
|
static connect = (biz9_config) => {
|
|
79
105
|
let action_url= "main/test/connect/";
|
|
80
106
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
81
107
|
};
|
|
108
|
+
|
|
82
109
|
static upload_file = (biz9_config,data_type,id) => {
|
|
83
110
|
let action_url= "main/crud/update/"+data_type + "/" + id;
|
|
84
111
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
85
112
|
};
|
|
113
|
+
|
|
86
114
|
static update_item = (biz9_config,data_type,id) => {
|
|
87
115
|
let action_url= "main/crud/update/"+data_type + "/" + id;
|
|
88
116
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
89
117
|
};
|
|
118
|
+
|
|
90
119
|
static get_item = (biz9_config,data_type,id) => {
|
|
91
120
|
let action_url= "main/crud/get/"+data_type + "/" + id;
|
|
92
121
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
93
122
|
};
|
|
123
|
+
|
|
94
124
|
static delete_item = (biz9_config,data_type,id) => {
|
|
95
125
|
let action_url= "main/crud/delete/"+data_type + "/" + id;
|
|
96
126
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
97
127
|
};
|
|
128
|
+
|
|
98
129
|
static get_list = (biz9_config,data_type) => {
|
|
99
130
|
let action_url= "main/crud/get_list/"+data_type;
|
|
100
131
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
101
132
|
};
|
|
133
|
+
|
|
102
134
|
static update_list = (biz9_config,data_type) => {
|
|
103
135
|
let action_url= "main/crud/update_list/"+data_type;
|
|
104
136
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
105
137
|
};
|
|
138
|
+
|
|
106
139
|
static delete_list = (biz9_config,data_type) => {
|
|
107
140
|
let action_url= "main/crud/delete_list/"+data_type;
|
|
108
141
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
109
142
|
};
|
|
143
|
+
|
|
110
144
|
static delete_biz_item = (biz9_config,data_type,id) => {
|
|
111
145
|
let action_url= "main/biz_item/delete/"+data_type + "/" + id;
|
|
112
146
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
113
147
|
};
|
|
148
|
+
|
|
114
149
|
static get_biz_list = (biz9_config,data_type) => {
|
|
115
150
|
let action_url= "main/biz_item/get_list/"+data_type;
|
|
116
151
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
117
152
|
};
|
|
153
|
+
|
|
118
154
|
static delete_biz_list = (biz9_config,data_type) => {
|
|
119
155
|
let action_url= "main/biz_item/delete_list/"+data_type;
|
|
120
156
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
121
157
|
};
|
|
158
|
+
|
|
122
159
|
}
|
|
123
160
|
class Obj {
|
|
161
|
+
|
|
124
162
|
static get_filter = (biz9_config,data_type,filter,sort_by,page_current,page_size)=>{
|
|
125
163
|
return get_cloud_filter_obj_main(data_type,filter,sort_by,page_current,page_size);
|
|
126
164
|
}
|
|
165
|
+
|
|
127
166
|
};
|
|
128
167
|
class Cat {
|
|
168
|
+
|
|
129
169
|
static get_category_drop_down_list_by_list = (cat_list) => {
|
|
130
170
|
let category_list = [];
|
|
131
171
|
for(let a=0;a<cat_list.length;a++){
|
|
@@ -133,6 +173,7 @@ class Cat {
|
|
|
133
173
|
}
|
|
134
174
|
return category_list;
|
|
135
175
|
};
|
|
176
|
+
|
|
136
177
|
static get_category_list = () => {
|
|
137
178
|
return [
|
|
138
179
|
{ value: DataType.BLOG_POST, label: "Blog Posts" },
|
|
@@ -144,6 +185,7 @@ class Cat {
|
|
|
144
185
|
{ value: DataType.DT_TEMPLATE, label: "Template" }
|
|
145
186
|
];
|
|
146
187
|
};
|
|
188
|
+
|
|
147
189
|
static get_title_by_type = (data_type) => {
|
|
148
190
|
switch (data_type) {
|
|
149
191
|
case DataType.DT_EVENT:
|
|
@@ -183,8 +225,10 @@ class Cat {
|
|
|
183
225
|
return "Blank";
|
|
184
226
|
}
|
|
185
227
|
}
|
|
228
|
+
|
|
186
229
|
};
|
|
187
230
|
class CMS {
|
|
231
|
+
|
|
188
232
|
static Tab_Edit_Title_General = 'general';
|
|
189
233
|
static Tab_Edit_Title_Photo = 'photo';
|
|
190
234
|
static Tab_Edit_Title_List = 'list';
|
|
@@ -194,6 +238,7 @@ class CMS {
|
|
|
194
238
|
static Tab_Edit_Title_Video = 'video';
|
|
195
239
|
static Tab_Edit_Title_Note = 'note';
|
|
196
240
|
static get_new_query_item_by_item = (item) => {
|
|
241
|
+
|
|
197
242
|
return {
|
|
198
243
|
id: item.id ? item.id : 0,
|
|
199
244
|
data_type:item.data_type ? item.data_type : DataType.DT_BLANK,
|
|
@@ -205,6 +250,7 @@ class CMS {
|
|
|
205
250
|
top_data_type:item.top_data_type ? item.top_data_type : DataType.DT_BLANK
|
|
206
251
|
}
|
|
207
252
|
};
|
|
253
|
+
|
|
208
254
|
static get_new_query_item = (item,parent_item,top_item) => {
|
|
209
255
|
return {
|
|
210
256
|
id: item.id ? item.id : 0,
|
|
@@ -216,27 +262,35 @@ class CMS {
|
|
|
216
262
|
top_data_type:top_item.data_type ? top_item.data_type : DataType.DT_BLANK
|
|
217
263
|
}
|
|
218
264
|
};
|
|
265
|
+
|
|
219
266
|
static get_query_itemz_by_query = (item) => {
|
|
220
267
|
return [];
|
|
221
268
|
};
|
|
269
|
+
|
|
222
270
|
static get_query_item_by_page = (item) => {
|
|
223
271
|
return { id:item.id ? item.id : 0, data_type:item.data_type ? item.data_type : DataType.DT_BLANK };
|
|
224
272
|
};
|
|
273
|
+
|
|
225
274
|
static get_query_parent_item_by_page = (parent_item) => {
|
|
226
275
|
return { id:parent_item.id ? parent_item.id : 0, data_type:parent_item.data_type ? parent_item.data_type : DataType.DT_BLANK };
|
|
227
276
|
};
|
|
277
|
+
|
|
228
278
|
static get_query_top_item_by_page = (top_item) => {
|
|
229
279
|
return { id:top_item.id ? top_item.id : 0, data_type:top_item.data_type ? top_item.data_type : DataType.DT_BLANK };
|
|
230
280
|
};
|
|
281
|
+
|
|
231
282
|
static get_query_item_by_query = (query) => {
|
|
232
283
|
return { id:query.get('id') ? query.get('id') : 0, data_type:query.get('data_type') ? query.get('data_type') : DataType.DT_BLANK } ;
|
|
233
284
|
};
|
|
285
|
+
|
|
234
286
|
static get_query_parent_item_by_query = (query) => {
|
|
235
287
|
return { id:query.get('parent_id') ? query.get('parent_id') : 0, data_type:query.get('parent_data_type') ? query.get('parent_data_type') : DataType.DT_BLANK } ;
|
|
288
|
+
|
|
236
289
|
};
|
|
237
290
|
static get_query_top_item_by_query = (query) => {
|
|
238
291
|
return { id:query.get('top_id') ? query.get('top_id') : 0, data_type:query.get('top_data_type') ? query.get('top_data_type') : DataType.DT_BLANK } ;
|
|
239
292
|
};
|
|
293
|
+
|
|
240
294
|
static get_sub_page_title = (title) => {
|
|
241
295
|
switch(title)
|
|
242
296
|
{
|
|
@@ -266,6 +320,7 @@ class CMS {
|
|
|
266
320
|
break;
|
|
267
321
|
}
|
|
268
322
|
}
|
|
323
|
+
|
|
269
324
|
static get_page_url = (url,tab_title,item,parent_item,top_item,parms) => {
|
|
270
325
|
let r_url="?tab_title="+tab_title
|
|
271
326
|
+"&id="+item.id
|
|
@@ -284,8 +339,10 @@ class CMS {
|
|
|
284
339
|
}
|
|
285
340
|
return url+r_url;
|
|
286
341
|
}
|
|
342
|
+
|
|
287
343
|
}
|
|
288
344
|
class Stock {
|
|
345
|
+
|
|
289
346
|
static get_event_stock_list = () => {
|
|
290
347
|
const r_list=
|
|
291
348
|
[
|
|
@@ -296,6 +353,7 @@ class Stock {
|
|
|
296
353
|
];
|
|
297
354
|
return r_list;
|
|
298
355
|
};
|
|
356
|
+
|
|
299
357
|
static get_event_stock_by_value = (stock_val) => {
|
|
300
358
|
switch(stock_val)
|
|
301
359
|
{
|
|
@@ -313,6 +371,7 @@ class Stock {
|
|
|
313
371
|
break;
|
|
314
372
|
}
|
|
315
373
|
};
|
|
374
|
+
|
|
316
375
|
static get_service_stock_list = () => {
|
|
317
376
|
const r_list=
|
|
318
377
|
[
|
|
@@ -322,6 +381,7 @@ class Stock {
|
|
|
322
381
|
];
|
|
323
382
|
return r_list;
|
|
324
383
|
};
|
|
384
|
+
|
|
325
385
|
static get_service_stock_by_value = (stock_val) => {
|
|
326
386
|
switch(stock_val)
|
|
327
387
|
{
|
|
@@ -336,6 +396,7 @@ class Stock {
|
|
|
336
396
|
break;
|
|
337
397
|
}
|
|
338
398
|
};
|
|
399
|
+
|
|
339
400
|
static get_product_stock_list = () => {
|
|
340
401
|
const r_list=
|
|
341
402
|
[
|
|
@@ -346,6 +407,7 @@ class Stock {
|
|
|
346
407
|
];
|
|
347
408
|
return r_list;
|
|
348
409
|
};
|
|
410
|
+
|
|
349
411
|
static get_product_stock_by_value = (stock_val) => {
|
|
350
412
|
switch(stock_val)
|
|
351
413
|
{
|
|
@@ -369,6 +431,7 @@ class Stock {
|
|
|
369
431
|
|
|
370
432
|
}
|
|
371
433
|
class Schedule {
|
|
434
|
+
|
|
372
435
|
static get_start_date_time = (item) =>{
|
|
373
436
|
if(!item.date){
|
|
374
437
|
item.date = new Date();
|
|
@@ -381,6 +444,7 @@ class Schedule {
|
|
|
381
444
|
item.start_date_time = DateTime.get_full_date_time_by_date_time(item.date,item.time);
|
|
382
445
|
return item;
|
|
383
446
|
}
|
|
447
|
+
|
|
384
448
|
static get_start_date_time_by_list = (list) =>{
|
|
385
449
|
for(let a=0;a<list.length;a++){
|
|
386
450
|
if(!list[a].date){
|
|
@@ -395,8 +459,10 @@ class Schedule {
|
|
|
395
459
|
}
|
|
396
460
|
return list;
|
|
397
461
|
}
|
|
462
|
+
|
|
398
463
|
};
|
|
399
464
|
class Storage {
|
|
465
|
+
|
|
400
466
|
static KEY_ADMIN="key_admin";
|
|
401
467
|
static KEY_USER="key_user";
|
|
402
468
|
static KEY_BUSINESS="key_business";
|
|
@@ -404,15 +470,19 @@ class Storage {
|
|
|
404
470
|
static get = (window,key) => {
|
|
405
471
|
return JSON.parse(window.localStorage.getItem(key));
|
|
406
472
|
}
|
|
473
|
+
|
|
407
474
|
static set = (window,key,obj) => {
|
|
408
475
|
window.localStorage.setItem(key,JSON.stringify(obj));
|
|
409
476
|
}
|
|
477
|
+
|
|
410
478
|
static remove = (window,key) =>{
|
|
411
479
|
window.localStorage.removeItem(key);
|
|
412
480
|
}
|
|
481
|
+
|
|
413
482
|
static clear = (window) =>{
|
|
414
483
|
window.localStorage.clear();
|
|
415
484
|
}
|
|
485
|
+
|
|
416
486
|
}
|
|
417
487
|
module.exports = {
|
|
418
488
|
BiZ_Url,
|