biz9-logic 10.0.18 → 10.0.22

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.
Files changed (4) hide show
  1. package/biz9_config +1 -1
  2. package/index.js +301 -265
  3. package/package.json +3 -2
  4. package/test.js +1 -9
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='10.1.8'
1
+ VERSION='10.2.2'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main'
package/index.js CHANGED
@@ -42,7 +42,20 @@ class Item_Logic {
42
42
  let copy_item = DataItem.get_new(data_type,0);
43
43
  const keys = Object.keys(item);
44
44
  keys.forEach(key => {
45
- if(key!=Type.ID&&key!=Type.SOURCE&&key!=Type.TITLE&&key!=Type.TITLE_URL){
45
+ if(
46
+ key!=Type.FIELD_ID&&
47
+ key!=Type.FIELD_SOURCE&&
48
+ key!=Type.FIELD_TITLE&&
49
+ key!=Type.FIELD_TITLE_URL&&
50
+ key!=Type.FIELD_DATE_CREATE&&
51
+ key!=Type.FIELD_DATE_SAVE&&
52
+ key!=Type.TITLE_OBJ&&
53
+ key!=Type.TITLE_USER&&
54
+ key!=Type.TITLE_GROUP&&
55
+ key!=Type.TITLE_ITEM&&
56
+ !Obj.check_is_array(item[key])&&
57
+ Obj.check_is_value(item[key])
58
+ ){
46
59
  copy_item[key]=item[key];
47
60
  }
48
61
  });
@@ -60,18 +73,18 @@ class Item_Logic {
60
73
  option = Field_Logic.get_option(data_type,option?option:{});
61
74
  let item = DataItem.get_new(data_type,0,Field_Logic.get_test(title,option));
62
75
  if(option.get_item){
63
- item.items = Sub_Item_Logic.get_test_list(item,item,option);
64
- item = Sub_Item_Logic.bind_parent_child_list(item,item.items);
76
+ item.items = Sub_Item_Logic.get_test_items(item,item,option);
77
+ item = Sub_Item_Logic.bind_parent_child_items(item,item.items);
65
78
  }
66
79
  return item;
67
80
  }
68
- static get_test_list = (data_type,option) =>{
81
+ static get_test_items = (data_type,option) =>{
69
82
  option = Field_Logic.get_option(data_type,option?option:{});
70
- let item_list = [];
83
+ let items = [];
71
84
  for(let a=0;a<parseInt(option.item_count)+1;a++){
72
- item_list.push(Item_Logic.get_test("Item " +String(parseInt(a+1)),data_type,option));
85
+ items.push(Item_Logic.get_test("Item " +String(parseInt(a+1)),data_type,option));
73
86
  }
74
- return item_list;
87
+ return items;
75
88
  }
76
89
  }
77
90
  class Title {
@@ -140,36 +153,36 @@ class Demo_Logic {
140
153
  option = option ? option : {get_category:false,category_count:6,categorys:'',category_data_type:DataType.BLANK,get_item:false,items:'',item_data_type:DataType.BLANK,item_count:6}; const item = Item_Logic.get_new(title,DataType.TYPE); //category
141
154
  if(option.get_category){
142
155
  item.categorys = [];
143
- let category_title_list = [];
156
+ let category_titles = [];
144
157
  if(option.categorys){
145
- category_title_list = option.categorys.split(',');
146
- option.category_count = category_title_list.length;
158
+ category_titles = option.categorys.split(',');
159
+ option.category_count = category_titles.length;
147
160
  }else{
148
161
  if(!option.category_count){
149
162
  option.category_count = 1;
150
163
  }
151
164
  for(let a = 1;a<parseInt(option.category_count)+1;a++){
152
- category_title_list.push(Title.CATEGORY+" "+a);
165
+ category_titles.push(Title.CATEGORY+" "+a);
153
166
  }
154
167
  }
155
- category_title_list.forEach(cat_item => {
168
+ category_titles.forEach(cat_item => {
156
169
  item.categorys.push(Category_Logic.get_new(cat_item,item.title,option.category_data_type));
157
170
  });
158
171
  }
159
172
  //item
160
173
  if(option.get_item){
161
- let full_item_list = [];
174
+ let full_items = [];
162
175
 
163
- let item_title_list = [];
176
+ let item_titles = [];
164
177
  if(option.items){
165
- item_title_list = option.items.split(',');
166
- option.item_count = item_title_list.length;
178
+ item_titles = option.items.split(',');
179
+ option.item_count = item_titles.length;
167
180
  }else{
168
181
  for(let b = 1;b<parseInt(option.item_count)+1;b++){
169
- item_title_list.push(title+" " +Type.get_title(item.categorys[Num.get_id(option.category_count)].category)+" "+ b);
182
+ item_titles.push(title+" " +Type.get_title(item.categorys[Num.get_id(option.category_count)].category)+" "+ b);
170
183
  }
171
184
  }
172
- for(const child_item_title of item_title_list){
185
+ for(const child_item_title of item_titles){
173
186
  const cat_item = item.categorys[Num.get_id(option.category_count)];
174
187
  if(!cat_item.items){
175
188
  cat_item.items = [];
@@ -185,7 +198,7 @@ class Demo_Logic {
185
198
  child_item.description =Title.DESCRIPTION+" "+ String(Num.get_id());
186
199
  child_item.note = Field_Logic.get_test_note(),
187
200
  cat_item.items.push(child_item);
188
- full_item_list.push(child_item);
201
+ full_items.push(child_item);
189
202
  }
190
203
  }
191
204
  return item;
@@ -200,35 +213,73 @@ class Type {
200
213
  static APP_LINK_TYPE_GOOGLE_PLAY='google_play';
201
214
  static APP_LINK_TYPE_APPLE_STORE='apple_store';
202
215
  static APP_LINK_TYPE_CMS='cms';
216
+
203
217
  //field
204
- static ASC='asc';
205
- static BLANK='blank';
206
- static CART_ITEM_LIST='cart_item_list';
207
- static CART_SUB_ITEM_LIST='cart_sub_item_list';
208
- static DATA_TYPE='data_type';
209
- static DESC='desc';
210
- static DATE_CREATE='date_create';
211
- static DATE_SAVE='date_save';
212
- static ID='id';
213
- static OBJ='obj';
214
- static LIST='list';
215
- static COUNT='count';
216
- static N_A='n/a';
217
- static USER='user';
218
- static USER_ID='user_id';
219
- static CART_ITEM_LIST='cart_item_list';
220
- static CART_SUB_ITEM_LIST='cart_sub_item_list';
221
- static ORDER_ITEM_LIST='order_item_list';
222
- static ORDER_SUB_ITEM_LIST='order_sub_item_list';
223
- static PARENT_ID='parent_id';
224
- static PARENT_ITEM='parent_item';
225
- static PARENT_DATA_TYPE='parent_data_type';
226
- static SETTING_VISIBLE='setting_visible';
227
- static SOURCE='source';
228
- static SOURCE_ID='source_id';
229
- static SOURCE_PARENT_ID='source_parent_id';
230
- static TITLE='title';
231
- static TITLE_URL='title_url';
218
+ static FIELD_AUTHOR = 'author';
219
+ static FIELD_CATEGORY = 'category';
220
+ static FIELD_CATEGORY_TYPE = 'category_type';
221
+ static FIELD_COST = 'cost';
222
+ static FIELD_DATA_TYPE='data_type';
223
+ static FIELD_DATE_CREATE='date_create';
224
+ static FIELD_DATE_SAVE='date_save';
225
+ static FIELD_DATE = 'date';
226
+ static FIELD_DESCRIPTION = 'description';
227
+ static FIELD_EDIT_LOCATION = 'edit_location';
228
+ static FIELD_ID='id';
229
+ static FIELD_IMAGE_FILENAME = 'image_filename';
230
+ static FIELD_LOCATION = 'location';
231
+ static FIELD_MEETING_LINK = 'meeting_link';
232
+ static FIELD_NOTE = 'note';
233
+ static FIELD_OLD_COST = 'old_cost';
234
+ static FIELD_PARAM = 'param';
235
+ static FIELD_PARENT_DATA_TYPE='parent_data_type';
236
+ static FIELD_PARENT_ID='parent_id';
237
+ static FIELD_ROLE = 'role';
238
+ static FIELD_SOURCE='source';
239
+ static FIELD_SOURCE_DATA_TYPE='source_data_type';
240
+ static FIELD_SOURCE_ID='source_id';
241
+ static FIELD_SOURCE_PARENT_ID='source_parent_id';
242
+ static FIELD_SETTING_VISIBLE = 'setting_visible';
243
+ static FIELD_SETTING_DELETE_PROTECTION = 'setting_delete_protection';
244
+ static FIELD_SETTING_SORT_TYPE = 'setting_delete_sort_type';
245
+ static FIELD_STOCK = 'stock';
246
+ static FIELD_TAG = 'tag';
247
+ static FIELD_TIME = 'time';
248
+ static FIELD_TITLE='title';
249
+ static FIELD_TITLE_URL='title_url';
250
+ static FIELD_TYPE = 'type';
251
+ static FIELD_URL = 'url';
252
+ static FIELD_USER_CITY = 'city';
253
+ static FIELD_USER_COUNTRY = 'country';
254
+ static FIELD_USER_EMAIL = 'email';
255
+ static FIELD_USER_FIRST_NAME = 'first_name';
256
+ static FIELD_USER_GENDER = 'gender';
257
+ static FIELD_USER_ID='user_id';
258
+ static FIELD_USER_LAST_NAME = 'last_name';
259
+ static FIELD_USER_USERNAME = 'username';
260
+ static FIELD_USER_PASSWORD = 'password';
261
+ static FIELD_USER_STATE = 'state';
262
+ static FIELD_VALUE = 'value';
263
+ static FIELD_WEBSITE = 'website';
264
+ //title
265
+ static TITLE_BLANK='blank';
266
+ static TITLE_CART_ITEMS='cart_items';
267
+ static TITLE_CART_SUB_ITEMS='cart_sub_items';
268
+ static TITLE_CART_ITEMS='cart_items';
269
+ static TITLE_CART_SUB_ITEMS='cart_sub_items';
270
+ static TITLE_COUNT='count';
271
+ static TITLE_GROUP='group';
272
+ static TITLE_N_A='n/a';
273
+ static TITLE_ITEMS='items';
274
+ static TITLE_OBJ='obj';
275
+ static TITLE_ORDER_ITEMS='order_items';
276
+ static TITLE_ORDER_SUB_ITEMS='order_sub_items';
277
+ static TITLE_PARENT_ITEM='parent_item';
278
+ static TITLE_USER='user';
279
+ static TITLE_SORT_BY_ASC='asc';
280
+ static TITLE_SORT_BY_DESC='desc';
281
+ static TITLE_STAT_ITEMS='stat_items';
282
+ static TITLE_STAT_SUB_ITEMS='stat_items';
232
283
  //page
233
284
  static PAGE_ABOUT='about';
234
285
  static PAGE_CONTACT='contact';
@@ -276,7 +327,7 @@ class Type {
276
327
  static FIELD_VALUE_TEXT="text";
277
328
  static FIELD_VALUE_NOTE="note";
278
329
  static FIELD_VALUE_IMAGE="image";
279
- static FIELD_VALUE_LIST="list";
330
+ static FIELD_VALUE_ITEMS="items";
280
331
  //user_role
281
332
  static USER_ROLE_SUPER_ADMIN='super_admin';
282
333
  static USER_ROLE_ADMIN='admin';
@@ -313,7 +364,7 @@ class Type {
313
364
  static ORDER_STATUS_RETURNED="returned";
314
365
  static ORDER_STATUS_ON_HOLD="on_hold";
315
366
  static ORDER_STATUS_CANCELLED="cancelled";
316
- static get_order_status_list(){
367
+ static get_order_statuses(){
317
368
  return [
318
369
  {value:Type.ORDER_STATUS_NEW,label:Title.ORDER_STATUS_NEW},
319
370
  {value:Type.ORDER_STATUS_OPEN,label:Title.ORDER_STATUS_OPEN},
@@ -323,7 +374,7 @@ class Type {
323
374
  {value:Type.ORDER_STATUS_CANCELLED,label:Title.ORDER_STATUS_CANCELLED},
324
375
  ];
325
376
  };
326
- static get_user_role_list(){
377
+ static get_user_roles(){
327
378
  return [
328
379
  {value:Type.USER_ROLE_ADMIN,label:Title.USER_ROLE_ADMIN},
329
380
  {value:Type.USER_ROLE_MANAGER,label:Title.USER_ROLE_MANAGER},
@@ -331,7 +382,7 @@ class Type {
331
382
  {value:Type.USER_ROLE_GUEST,label:Title.USER_ROLE_GUEST},
332
383
  ];
333
384
  };
334
- static get_page_list(){
385
+ static get_pages(){
335
386
  return [
336
387
  {value:Type.PAGE_ABOUT,label:Title.PAGE_ABOUT,url:Url.PAGE_ABOUT},
337
388
  {value:Type.PAGE_BLOG_POST,label:Title.PAGE_BLOG_POST,url:Url.PAGE_BLOG_POST},
@@ -352,7 +403,7 @@ class Type {
352
403
  {value:Type.PAGE_SERVICE_HOME,label:Title.PAGE_SERVICE_HOME,url:Url.PAGE_SERVICE_HOME},
353
404
  ];
354
405
  };
355
- static get_stat_type_list = () =>{
406
+ static get_stat_types = () =>{
356
407
  return [
357
408
  {title:Type.get_title(Type.STAT_CART),type:Type.STAT_CART,label:Type.get_title(Type.STAT_CART),value:Type.STAT_CART},
358
409
  {title:Type.get_title(Type.STAT_CART_ITEM),type:Type.STAT_CART_ITEM,label:Type.get_title(Type.STAT_CART_ITEM),value:Type.STAT_CART_ITEM},
@@ -369,7 +420,7 @@ class Type {
369
420
  {title:Type.get_title(Type.STAT_VIEW),type:Type.STAT_VIEW,label:Type.get_title(Type.STAT_VIEW),value:Type.STAT_VIEW},
370
421
  ]
371
422
  };
372
- static get_data_type_list = () =>{
423
+ static get_data_types = () =>{
373
424
  return [
374
425
  {title:Type.get_title(DataType.BLOG_POST),type:DataType.BLOG_POST,label:Type.get_title(DataType.BLOG_POST),value:DataType.BLOG_POST},
375
426
  {title:Type.get_title(DataType.CATEGORY),type:DataType.CATEGORY,label:Type.get_title(DataType.CATEGORY),value:DataType.CATEGORY},
@@ -383,7 +434,7 @@ class Type {
383
434
  {title:Type.get_title(DataType.SERVICE),type:DataType.SERVICE,label:Type.get_title(DataType.SERVICE),value:DataType.SERVICE}
384
435
  ]
385
436
  };
386
- static get_type_list = () =>{
437
+ static get_types = () =>{
387
438
  return [
388
439
  {title:Type.get_title(DataType.BLOG_POST),type:DataType.BLOG_POST,label:Type.get_title(DataType.BLOG_POST),value:DataType.BLOG_POST},
389
440
  {title:Type.get_title(DataType.CATEGORY),type:DataType.CATEGORY,label:Type.get_title(DataType.CATEGORY),value:DataType.CATEGORY},
@@ -397,14 +448,14 @@ class Type {
397
448
  {title:Type.get_title(DataType.TYPE),type:DataType.TYPE,label:Type.get_title(DataType.TYPE),value:DataType.TYPE}
398
449
  ]
399
450
  };
400
- static get_app_environment_list = () =>{
451
+ static get_app_environments = () =>{
401
452
  return [
402
453
  {title:Type.get_title(Type.APP_ENV_TEST),type:Type.APP_ENV_TEST,label:Type.get_title(Type.APP_ENV_TEST),value:Type.APP_ENV_TEST},
403
454
  {title:Type.get_title(Type.APP_ENV_STAGE),type:Type.APP_ENV_STAGE,label:Type.get_title(Type.APP_ENV_STAGE),value:Type.APP_ENV_STAGE},
404
455
  {title:Type.get_title(Type.APP_ENV_PROD),type:Type.APP_ENV_PROD,label:Type.get_title(Type.APP_ENV_PROD),value:Type.APP_ENV_PROD},
405
456
  ]
406
457
  };
407
- static get_app_link_list = () =>{
458
+ static get_app_links = () =>{
408
459
  return [
409
460
  {title:Type.get_title(Type.APP_LINK_TYPE_WEBSITE),type:Type.APP_LINK_TYPE_WEBSITE,label:Type.get_title(Type.APP_LINK_TYPE_WEBSITE),value:Type.APP_LINK_TYPE_WEBSITE},
410
461
  {title:Type.get_title(Type.APP_LINK_TYPE_GOOGLE_PLAY),type:Type.APP_LINK_TYPE_GOOGLE_PLAY,label:Type.get_title(Type.APP_LINK_TYPE_GOOGLE_PLAY),value:Type.APP_LINK_TYPE_GOOGLE_PLAY},
@@ -595,17 +646,17 @@ class Stat_Logic {
595
646
  for(const prop in post_data) {
596
647
  const value = post_data[prop];
597
648
  if (!Array.isArray(value)
598
- && prop != Type.SOURCE
599
- && prop != Type.DATE_CREATE
600
- && prop != Type.DATE_SAVE
601
- && prop != Type.DATA_TYPE
602
- && prop != Type.CART_ITEM_LIST
603
- && prop != Type.CART_SUB_ITEM_LIST
604
- && prop != Type.ORDER_ITEM_LIST
605
- && prop != Type.ORDER_SUB_ITEM_LIST
606
- && prop != Type.SOURCE
607
- && prop != Type.SOURCE_ID
608
- && prop != Type.ID) {
649
+ && prop != Type.FIELD_SOURCE
650
+ && prop != Type.FIELD_DATE_CREATE
651
+ && prop != Type.FIELD_DATE_SAVE
652
+ && prop != Type.FIELD_DATA_TYPE
653
+ && prop != Type.TITLE_CART_ITEMS
654
+ && prop != Type.TITLE_CART_SUB_ITEMS
655
+ && prop != Type.TITLE_ORDER_ITEMS
656
+ && prop != Type.TITLE_ORDER_SUB_ITEMS
657
+ && prop != Type.FIELD_SOURCE
658
+ && prop != Type.FIELD_SOURCE_ID
659
+ && prop != Type.FIELD_ID) {
609
660
  filter_stat[prop] = post_data[prop];
610
661
  }
611
662
  }
@@ -618,18 +669,18 @@ static get_test = (title,option) =>{
618
669
  option = Field_Logic.get_option(DataType.PAGE,option?option:{});
619
670
  let page = DataItem.get_new(DataType.PAGE,0,Field_Logic.get_test(title,option));
620
671
  if(option.get_section){
621
- page.items = Sub_Item_Logic.get_test_section_list(page,page,option);
622
- page = Sub_Item_Logic.bind_parent_child_list(page,page.items);
672
+ page.items = Sub_Item_Logic.get_test_sections(page,page,option);
673
+ page = Sub_Item_Logic.bind_parent_child_items(page,page.items);
623
674
  }
624
675
  return page;
625
676
  };
626
- static get_test_list = (option) =>{
677
+ static get_test_items = (option) =>{
627
678
  option = Field_Logic.get_option(DataType.PAGE,option?option:{});
628
- let item_list = [];
679
+ let items = [];
629
680
  for(let a=0;a<parseInt(option.page_count)+1;a++){
630
- item_list.push(Page_Logic.get_test( "Page " +parseInt(a+1)? !option.get_blank : "",option));
681
+ items.push(Page_Logic.get_test( "Page " +parseInt(a+1)? !option.get_blank : "",option));
631
682
  }
632
- return item_list;
683
+ return items;
633
684
  };
634
685
  }
635
686
  class Order_Logic {
@@ -642,23 +693,23 @@ class Order_Logic {
642
693
  cart_number:cart.cart_number,
643
694
  grand_total:cart.grand_total,
644
695
  status:Type.ORDER_STATUS_NEW,
645
- order_item_list:[]
696
+ order_items:[]
646
697
  });
647
698
  for(const key in cart) {
648
699
  if(!Str.check_is_null(cart[key])
649
- && key != Type.ID && key != Type.DATA_TYPE
650
- && key != Type.PARENT_ITEM && key != Type.USER
651
- && key != Type.CART_ITEM_LIST && key != Type.CART_SUB_ITEM_LIST
652
- && key != Type.ORDER_ITEM_LIST && key != Type.ORDER_SUB_ITEM_LIST
653
- && key != Type.SOURCE && key != Type.SOURCE_ID
654
- && key != Type.DATE_CREATE && key != Type.DATE_SAVE){
700
+ && key != Type.FIELD_ID && key != Type.FIELD_DATA_TYPE
701
+ && key != Type.TITLE_PARENT_ITEM && key != Type.TITLE_USER
702
+ && key != Type.TITLE_CART_ITEMS && key != Type.TITLE_CART_SUB_ITEMS
703
+ && key != Type.TITLE_ORDER_ITEMS && key != Type.TITLE_ORDER_SUB_ITEMS
704
+ && key != Type.FIELD_SOURCE && key != Type.FIELD_SOURCE_ID
705
+ && key != Type.FIELD_DATE_CREATE && key != Type.FIELD_DATE_SAVE){
655
706
  order[key] = cart[key];
656
707
  }
657
708
  }
658
709
  if(option.get_payment_plan){
659
710
  order.payment_plan = option.payment_plan;
660
711
  }
661
- cart.cart_item_list.forEach(cart_item => {
712
+ cart.cart_items.forEach(cart_item => {
662
713
  let order_item = DataItem.get_new(DataType.ORDER_ITEM,0,{
663
714
  order_number:order.order_number,
664
715
  parent_data_type:cart_item.parent_data_type,
@@ -666,20 +717,20 @@ class Order_Logic {
666
717
  user_id:order.user_id,
667
718
  quanity:cart_item.quanity?cart_item.quanity:0,
668
719
  cost:cart_item.cost?cart_item.cost:0,
669
- order_sub_item_list:[]
720
+ order_sub_items:[]
670
721
  });
671
722
  for(const key in cart_item){
672
723
  if(!Str.check_is_null(cart_item[key])
673
- && key != Type.ID && key != Type.DATA_TYPE
674
- && key != Type.PARENT_ITEM && key != Type.USER
675
- && key != Type.CART_ITEM_LIST && key != Type.CART_SUB_ITEM_LIST
676
- && key != Type.ORDER_ITEM_LIST && key != Type.ORDER_SUB_ITEM_LIST
677
- && key != Type.SOURCE && key != Type.SOURCE_ID
678
- && key != Type.DATE_CREATE && key != Type.DATE_SAVE){
724
+ && key != Type.FIELD_ID && key != Type.FIELD_DATA_TYPE
725
+ && key != Type.TITLE_PARENT_ITEM && key != Type.TITLE_USER
726
+ && key != Type.TITLE_CART_ITEMS && key != Type.TITLE_CART_SUB_ITEMS
727
+ && key != Type.TITLE_ORDER_ITEMS && key != Type.TITLE_ORDER_SUB_ITEMS
728
+ && key != Type.FIELD_SOURCE && key != Type.FIELD_SOURCE_ID
729
+ && key != Type.FIELD_DATE_CREATE && key != Type.FIELD_DATE_SAVE){
679
730
  order_item[key] = cart_item[key];
680
731
  }
681
732
  }
682
- cart_item.cart_sub_item_list.forEach(cart_sub_item => {
733
+ cart_item.cart_sub_items.forEach(cart_sub_item => {
683
734
  let order_sub_item = DataItem.get_new(DataType.ORDER_SUB_ITEM,0,{
684
735
  order_number:order.order_number,
685
736
  parent_data_type:cart_sub_item.parent_data_type,
@@ -690,18 +741,18 @@ class Order_Logic {
690
741
  })
691
742
  for(const key in cart_sub_item){
692
743
  if(!Str.check_is_null(cart_sub_item[key])
693
- && key != Type.ID && key != Type.DATA_TYPE
694
- && key != Type.PARENT_ITEM && key != Type.USER
695
- && key != Type.CART_ITEM_LIST && key != Type.CART_SUB_ITEM_LIST
696
- && key != Type.ORDER_ITEM_LIST && key != Type.ORDER_SUB_ITEM_LIST
697
- && key != Type.SOURCE && key != Type.SOURCE_ID
698
- && key != Type.DATE_CREATE && key != Type.DATE_SAVE){
744
+ && key != Type.FIELD_ID && key != Type.DATA_TYPE
745
+ && key != Type.TITLE_PARENT_ITEM && key != Type.TITLE_USER
746
+ && key != Type.TITLE_CART_ITEMS && key != Type.TITLE_CART_SUB_ITEMS
747
+ && key != Type.TITLE_ORDER_ITEMS && key != Type.TITLE_ORDER_SUB_ITEMS
748
+ && key != Type.FIELD_SOURCE && key != Type.FIELD_SOURCE_ID
749
+ && key != Type.FIELD_DATE_CREATE && key != Type.FIELD_DATE_SAVE){
699
750
  order_sub_item[key] = cart_sub_item[key];
700
751
  }
701
752
  }
702
- order_item.order_sub_item_list.push(order_sub_item);
753
+ order_item.order_sub_items.push(order_sub_item);
703
754
  });
704
- order.order_item_list.push(order_item);
755
+ order.order_items.push(order_item);
705
756
  });
706
757
  return order;
707
758
  };
@@ -716,13 +767,13 @@ class Order_Logic {
716
767
  };
717
768
  static get_total = (order) => {
718
769
  let grand_total = 0;
719
- order.order_item_list.forEach(order_item => {
770
+ order.order_items.forEach(order_item => {
720
771
  order_item.sub_total = 0;
721
772
  if(!isNaN(order_item.cost)){
722
773
  order_item.sub_total = (order_item.sub_total + order_item.cost) * order_item.quanity;
723
774
  grand_total = grand_total + order_item.sub_total;
724
775
  }
725
- order_item.order_sub_item_list.forEach(order_sub_item => {
776
+ order_item.order_sub_items.forEach(order_sub_item => {
726
777
  order_sub_item.sub_total = 0;
727
778
  if(!isNaN(order_sub_item.cost)){
728
779
  order_sub_item.sub_total = (order_sub_item.sub_total + order_sub_item.cost) * order_sub_item.quanity;
@@ -736,23 +787,23 @@ class Order_Logic {
736
787
  }
737
788
  class Cart_Logic {
738
789
  static get_new = (parent_data_type,user_id) => {
739
- return DataItem.get_new(DataType.CART,0,{user_id:user_id,cart_number:Title.CART_NUMBER + Num.get_id(99999),parent_data_type:parent_data_type,grand_total:0,cart_item_list:[]});
790
+ return DataItem.get_new(DataType.CART,0,{user_id:user_id,cart_number:Title.CART_NUMBER + Num.get_id(99999),parent_data_type:parent_data_type,grand_total:0,cart_items:[]});
740
791
  };
741
792
  static get_new_cart_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
742
- return DataItem.get_new(DataType.CART_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,quanity:quanity?quanity:0,cost:cost?cost:0,cart_sub_item_list:[]});
793
+ return DataItem.get_new(DataType.CART_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,quanity:quanity?quanity:0,cost:cost?cost:0,cart_sub_items:[]});
743
794
  };
744
795
  static get_new_cart_sub_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
745
796
  return DataItem.get_new(DataType.CART_SUB_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,quanity:quanity?quanity:0,cost:cost?cost:0});
746
797
  };
747
798
  static get_total = (cart) => {
748
799
  let grand_total = 0;
749
- cart.cart_item_list.forEach(cart_item => {
800
+ cart.cart_items.forEach(cart_item => {
750
801
  cart_item.sub_total = 0;
751
802
  if(!isNaN(cart_item.cost)){
752
803
  cart_item.sub_total = (cart_item.sub_total + cart_item.cost) * cart_item.quanity;
753
804
  grand_total = grand_total + cart_item.sub_total;
754
805
  }
755
- cart_item.cart_sub_item_list.forEach(cart_sub_item => {
806
+ cart_item.cart_sub_items.forEach(cart_sub_item => {
756
807
  cart_sub_item.sub_total = 0;
757
808
  if(!isNaN(cart_sub_item.cost)){
758
809
  cart_sub_item.sub_total = (cart_sub_item.sub_total + cart_sub_item.cost) * cart_sub_item.quanity;
@@ -772,15 +823,15 @@ static get_new = (title,type,category,option) => {
772
823
  item.category = category = category?category:"";
773
824
  return item;
774
825
  };
775
- static get_stock_list = () => {
776
- const r_list=
826
+ static get_stocks = () => {
827
+ const stocks=
777
828
  [
778
829
  { value: "0", label: "Out of Stock" },
779
830
  { value: "1", label: "Only 1 Left" },
780
831
  { value: "2", label: "Less Than 3 Left" },
781
832
  { value: "3", label: "Availble" }
782
833
  ];
783
- return r_list;
834
+ return stocks;
784
835
  };
785
836
  static get_stock_by_value = (stock_val) => {
786
837
  switch(stock_val)
@@ -824,7 +875,7 @@ static get_new = (title,type,category,option) => {
824
875
  product.tag = "";
825
876
  }
826
877
  if(option.get_item){
827
- product.items = Sub_Item_Logic.get_test_list(product,product,option);
878
+ product.items = Sub_Item_Logic.get_test_items(product,product,option);
828
879
  }
829
880
  return product;
830
881
  };
@@ -836,49 +887,49 @@ static get_new = (title,type,category,option) => {
836
887
  cart.cart_number = cart_number;
837
888
  if(option.get_cart_item){
838
889
  let product_option = {product_count:option.cart_item_count,generate_id:true};
839
- let product_list = Product_Logic.get_test_list(product_option);
840
- cart.cart_item_list = [];
841
- for(let a = 0;a<product_list.length;a++){
842
- let product_cart_item =Cart_Logic.get_test_item(cart_number,cart.id,user_id,product_list[a].data_type,product_list[a].id,{get_value:false,get_cart_sub_item:option.get_cart_sub_item,cart_sub_item_count:option.cart_sub_item_count,generate_id:true});
843
- product_cart_item.item_item = product_list[a];
844
- cart.cart_item_list.push(product_cart_item);
890
+ let products = Product_Logic.get_test_items(product_option);
891
+ cart.cart_items = [];
892
+ for(let a = 0;a<products.length;a++){
893
+ let product_cart_item =Cart_Logic.get_test_item(cart_number,cart.id,user_id,products[a].data_type,products[a].id,{get_value:false,get_cart_sub_item:option.get_cart_sub_item,cart_sub_item_count:option.cart_sub_item_count,generate_id:true});
894
+ product_cart_item.item_item = products[a];
895
+ cart.cart_items.push(product_cart_item);
845
896
  }
846
897
  }
847
898
  return cart;
848
899
  };
849
- static get_test_list = (option) =>{
900
+ static get_test_items = (option) =>{
850
901
  option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
851
- let item_list = [];
902
+ let items = [];
852
903
  for(let a=0;a<option.product_count+1;a++){
853
- item_list.push(Product_Logic.get_test("Product "+String(parseInt(a+1)),option));
904
+ items.push(Product_Logic.get_test("Product "+String(parseInt(a+1)),option));
854
905
  }
855
- return item_list;
906
+ return items;
856
907
  }
857
- static get_test_list_by_category = (option) =>{
908
+ static get_test_items_by_category = (option) =>{
858
909
  option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
859
- let product_list = [];
860
- let category_list = Category_Logic.get_type_category_list(DataType.PRODUCT,option.category_count);
910
+ let products = [];
911
+ let categorys = Category_Logic.get_type_categorys(DataType.PRODUCT,option.category_count);
861
912
  let item_count = 0;
862
- for(let a=0;a<category_list.length;a++){
913
+ for(let a=0;a<categorys.length;a++){
863
914
  for(let b=0;b<option.product_count;b++){
864
915
  item_count++;
865
916
  let product = Product_Logic.get_test("Product "+String(parseInt(b+1)),option);
866
- product.category = category_list[Num.get_id(category_list.length+1)].title;
867
- product_list.push(product);
917
+ product.category = categorys[Num.get_id(categorys.length+1)].title;
918
+ products.push(product);
868
919
  }
869
920
  }
870
- return [category_list,product_list]
921
+ return [categorys,products]
871
922
  };
872
923
  }
873
924
  class Service_Logic {
874
- static get_stock_list = () => {
875
- const r_list=
925
+ static get_stocks = () => {
926
+ const stocks=
876
927
  [
877
928
  { value: "0", label: "No Sessions Availble" },
878
929
  { value: "1", label: "Ready For Booking" },
879
930
  { value: "2", label: "No Sessions Availble" }
880
931
  ];
881
- return r_list;
932
+ return stocks;
882
933
  };
883
934
  static get_stock_by_value = (stock_val) => {
884
935
  switch(stock_val)
@@ -905,32 +956,32 @@ class Service_Logic {
905
956
  service.stock = String(Num.get_id(3-1));
906
957
  service.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
907
958
  if(option.get_item){
908
- service.items = Sub_Item_Logic.get_test_list(service,service,option);
959
+ service.items = Sub_Item_Logic.get_test_items(service,service,option);
909
960
  }
910
961
  return service;
911
962
  };
912
- static get_test_list = (option) =>{
963
+ static get_test_items = (option) =>{
913
964
  option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
914
- let item_list = [];
965
+ let items = [];
915
966
  for(let a=0;a<parseInt(option.service_count)+1;a++){
916
- item_list.push(Service_Logic.get_test("Service "+String(parseInt(a+1)),option));
967
+ items.push(Service_Logic.get_test("Service "+String(parseInt(a+1)),option));
917
968
  }
918
- return item_list;
969
+ return items;
919
970
  }
920
- static get_test_list_by_category = (option) =>{
971
+ static get_test_items_by_category = (option) =>{
921
972
  option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
922
- let service_list = [];
923
- let category_list = Category_Logic.get_type_category_list(DataType.SERVICE,option.category_count);
973
+ let services = [];
974
+ let categorys = Category_Logic.get_type_categorys(DataType.SERVICE,option.category_count);
924
975
  let item_count = 0;
925
- for(let a=0;a<category_list.length;a++){
976
+ for(let a=0;a<categorys.length;a++){
926
977
  for(let b=0;b<parseInt(option.service_count);b++){
927
978
  item_count++;
928
979
  let service = Service_Logic.get_test("Service "+String(parseInt(b+1)),option);
929
- service.category = category_list[Num.get_id(category_list.length+1)].title;
930
- service_list.push(service);
980
+ service.category = categorys[Num.get_id(categorys.length+1)].title;
981
+ services.push(service);
931
982
  }
932
983
  }
933
- return [category_list,service_list]
984
+ return [categorys,services]
934
985
  };
935
986
  }
936
987
  class Content_Logic {
@@ -939,35 +990,35 @@ class Content_Logic {
939
990
  option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
940
991
  let content = DataItem.get_new(DataType.CONTENT,0,Field_Logic.get_test(title,option));
941
992
  if(option.get_item){
942
- content.items = Sub_Item_Logic.get_test_section_list(content,content,option);
993
+ content.items = Sub_Item_Logic.get_test_sections(content,content,option);
943
994
  if(option.get_item_bind){
944
- content = Sub_Item_Logic.bind_parent_child_list(content,content.items);
995
+ content = Sub_Item_Logic.bind_parent_child_items(content,content.items);
945
996
  }
946
997
  }
947
998
  return content;
948
999
  };
949
- static get_test_list = (option) =>{
1000
+ static get_test_items = (option) =>{
950
1001
  option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
951
- let item_list = [];
1002
+ let items = [];
952
1003
  for(let a=0;a<parseInt(option.content_count)+1;a++){
953
- item_list.push(Content_Logic.get_test("Content " +String(parseInt(a+1)),option));
1004
+ items.push(Content_Logic.get_test("Content " +String(parseInt(a+1)),option));
954
1005
  }
955
- return item_list;
1006
+ return items;
956
1007
  }
957
- static get_test_list_by_category = (option) =>{
1008
+ static get_test_items_by_category = (option) =>{
958
1009
  option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
959
- let content_list = [];
960
- let category_list = Category_Logic.get_type_category_list(DataType.CONTENT,option.category_count);
1010
+ let contents = [];
1011
+ let categorys = Category_Logic.get_type_categorys(DataType.CONTENT,option.category_count);
961
1012
  let item_count = 0;
962
- for(let a=0;a<category_list.length;a++){
1013
+ for(let a=0;a<categorys.length;a++){
963
1014
  for(let b=0;b<parseInt(option.content_count);b++){
964
1015
  item_count++;
965
1016
  let content = Content_Logic.get_test("Content "+String(parseInt(b+1)),option);
966
- content.category = category_list[Num.get_id(category_list.length+1)].title;
967
- content_list.push(content);
1017
+ content.category = categorys[Num.get_id(categorys.length+1)].title;
1018
+ contents.push(content);
968
1019
  }
969
1020
  }
970
- return [category_list,content_list]
1021
+ return [categorys,contents]
971
1022
  };
972
1023
  }
973
1024
  class Template_Logic {
@@ -991,32 +1042,32 @@ class Blog_Post_Logic {
991
1042
  blog_post.tag = "";
992
1043
  }
993
1044
  if(option.get_item){
994
- blog_post.items = Sub_Item_Logic.get_test_list(blog_post,blog_post,option);
1045
+ blog_post.items = Sub_Item_Logic.get_test_items(blog_post,blog_post,option);
995
1046
  }
996
1047
  return blog_post;
997
1048
  };
998
- static get_test_list = (option) =>{
1049
+ static get_test_items = (option) =>{
999
1050
  option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
1000
- let item_list = [];
1051
+ let items = [];
1001
1052
  for(let a=0;a<parseInt(option.blog_post_count)+1;a++){
1002
- item_list.push(Blog_Post_Logic.get_test("Blog Post " +String(parseInt(a+1)),option));
1053
+ items.push(Blog_Post_Logic.get_test("Blog Post " +String(parseInt(a+1)),option));
1003
1054
  }
1004
- return item_list;
1055
+ return items;
1005
1056
  }
1006
- static get_test_list_by_category = (option) =>{
1057
+ static get_test_items_by_category = (option) =>{
1007
1058
  option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
1008
- let blog_post_list = [];
1009
- let category_list = Category_Logic.get_type_category_list(DataType.BLOG_POST,option.category_count);
1059
+ let blog_posts = [];
1060
+ let categorys = Category_Logic.get_type_categorys(DataType.BLOG_POST,option.category_count);
1010
1061
  let item_count = 0;
1011
- for(let a=0;a<category_list.length;a++){
1062
+ for(let a=0;a<categorys.length;a++){
1012
1063
  for(let b=0;b<parseInt(option.blog_post_count);b++){
1013
1064
  item_count++;
1014
1065
  let blog_post = Blog_Post_Logic.get_test("Blog Post "+String(parseInt(b+1)),option);
1015
- blog_post.category = category_list[Num.get_id(category_list.length+1)].title;
1016
- blog_post_list.push(blog_post);
1066
+ blog_post.category = categorys[Num.get_id(categorys.length+1)].title;
1067
+ blog_posts.push(blog_post);
1017
1068
  }
1018
1069
  }
1019
- return [category_list,blog_post_list]
1070
+ return [categorys,blog_posts]
1020
1071
  };
1021
1072
  }
1022
1073
  class Gallery_Logic {
@@ -1032,21 +1083,21 @@ class Gallery_Logic {
1032
1083
  gallery.website = "";
1033
1084
  }
1034
1085
  if(option.get_item){
1035
- gallery.items = Sub_Item_Logic.get_test_list(gallery,gallery,option);
1086
+ gallery.items = Sub_Item_Logic.get_test_items(gallery,gallery,option);
1036
1087
  }
1037
1088
  return gallery;
1038
1089
  };
1039
1090
  };
1040
1091
  class Event_Logic {
1041
- static get_stock_list = () => {
1042
- const r_list=
1092
+ static get_stocks = () => {
1093
+ const stocks =
1043
1094
  [
1044
1095
  { value: "0", label: "Sold Out" },
1045
1096
  { value: "1", label: "Less Than 25 Tickets Remaining" },
1046
1097
  { value: "2", label: "Tickets Are Availble" },
1047
1098
  { value: "3", label: "Sold Out" },
1048
1099
  ];
1049
- return r_list;
1100
+ return stocks;
1050
1101
  };
1051
1102
  static get_stock_by_value = (stock_val) => {
1052
1103
  switch(stock_val)
@@ -1093,43 +1144,43 @@ class Event_Logic {
1093
1144
  event.tag = "";
1094
1145
  }
1095
1146
  if(option.get_item){
1096
- event.items = Sub_Item_Logic.get_test_list(event,event,option);
1147
+ event.items = Sub_Item_Logic.get_test_items(event,event,option);
1097
1148
  }
1098
1149
  return event;
1099
1150
  };
1100
- static get_test_list = (option) =>{
1151
+ static get_test_items = (option) =>{
1101
1152
  option = Field_Logic.get_option(DataType.EVENT,option?option:{});
1102
- let item_list = [];
1153
+ let items = [];
1103
1154
  for(let a=0;a<parseInt(option.event_count)+1;a++){
1104
- item_list.push(Event_Logic.get_test("Event "+String(parseInt(a+1)),option));
1155
+ items.push(Event_Logic.get_test("Event "+String(parseInt(a+1)),option));
1105
1156
  }
1106
- return item_list;
1157
+ return items;
1107
1158
  }
1108
- static get_test_list_by_category = (option) =>{
1159
+ static get_test_items_by_category = (option) =>{
1109
1160
  option = Field_Logic.get_option(DataType.EVENT,option?option:{});
1110
- let event_list = [];
1111
- let category_list = Category_Logic.get_type_category_list(DataType.EVENT,option.category_count);
1161
+ let events = [];
1162
+ let categorys = Category_Logic.get_type_categorys(DataType.EVENT,option.category_count);
1112
1163
  let item_count = 0;
1113
- for(let a=0;a<category_list.length;a++){
1164
+ for(let a=0;a<categorys.length;a++){
1114
1165
  for(let b=0;b<parseInt(option.event_count);b++){
1115
1166
  item_count++;
1116
1167
  let event = Event_Logic.get_test("Event "+String(parseInt(b+1)),option);
1117
- event.category = category_list[Num.get_id(category_list.length+1)].title;
1118
- event_list.push(event);
1168
+ event.category = categorys[Num.get_id(categorys.length+1)].title;
1169
+ events.push(event);
1119
1170
  }
1120
1171
  }
1121
- return [category_list,event_list]
1172
+ return [categorys,events]
1122
1173
  };
1123
1174
  }
1124
1175
  class Field_Logic {
1125
- static get_list_item_max_group_id = (value_id,item) => {
1176
+ static get_item_max_group_id = (value_id,item) => {
1126
1177
  let max_group_id = 0;
1127
1178
  let full_prop_str = "";
1128
1179
  for(const prop in item){
1129
1180
  full_prop_str = String(prop + " "+full_prop_str);
1130
1181
  }
1131
1182
  for(let b = 1; b < 75; b++){
1132
- const exists = Str.check_if_str_exist(full_prop_str,"list_value_"+value_id+"_group_"+b);
1183
+ const exists = Str.check_if_str_exist(full_prop_str,"items_value_"+value_id+"_group_"+b);
1133
1184
  if(exists){
1134
1185
  if(b>max_group_id){
1135
1186
  max_group_id = b;
@@ -1138,7 +1189,7 @@ class Field_Logic {
1138
1189
  }
1139
1190
  return max_group_id;
1140
1191
  }
1141
- static get_item_field_value_list = (data) => {
1192
+ static get_item_field_values = (data) => {
1142
1193
  let max_value_id = 1;
1143
1194
  let max_group_id = 1;
1144
1195
  let full_prop_str = "";
@@ -1146,14 +1197,14 @@ class Field_Logic {
1146
1197
  full_prop_str = String(prop + " "+full_prop_str);
1147
1198
  }
1148
1199
  for(let a = 1; a < 75; a++){
1149
- const exists = Str.check_if_str_exist(full_prop_str,"list_value_"+a);
1200
+ const exists = Str.check_if_str_exist(full_prop_str,"items_value_"+a);
1150
1201
  if(exists){
1151
1202
  if(a>max_value_id){
1152
1203
  max_value_id = a;
1153
1204
  }
1154
1205
  }
1155
1206
  for(let b = 1; b < 20; b++){
1156
- const exists = Str.check_if_str_exist(full_prop_str,"list_value_"+a+"_group_"+b);
1207
+ const exists = Str.check_if_str_exist(full_prop_str,"items_value_"+a+"_group_"+b);
1157
1208
  if(exists){
1158
1209
  if(b>max_group_id){
1159
1210
  max_group_id = b;
@@ -1162,7 +1213,7 @@ class Field_Logic {
1162
1213
  }
1163
1214
  }
1164
1215
  for(let a = 1; a <= max_value_id+1; a++){
1165
- let sub_check_str = 'list_value_'+a;
1216
+ let sub_check_str = 'items_value_'+a;
1166
1217
  data[sub_check_str] = [];
1167
1218
  for(let b = 1; b < max_group_id+1; b++){
1168
1219
  let full_sub_check_str = sub_check_str+"_group_"+b;
@@ -1182,19 +1233,19 @@ class Field_Logic {
1182
1233
  }
1183
1234
  return data;
1184
1235
  }
1185
- static get_item_field_value_type_list = () => {
1236
+ static get_item_field_value_types = () => {
1186
1237
  return [
1187
1238
  {value:'text',label:'Text'},
1188
1239
  {value:'note',label:'Note'},
1189
1240
  {value:'image',label:'Image'},
1190
- {value:'list',label:'List'},
1241
+ {value:'items',label:'List'},
1191
1242
  ];
1192
1243
  };
1193
1244
  static get_field_value_value = (value_type,item,value_id) =>{
1194
- if(value_type!=Type.FIELD_VALUE_LIST){
1245
+ if(value_type!=Type.FIELD_VALUE_ITEMS){
1195
1246
  return !Str.check_is_null(item[Field_Logic.get_field_value_title(value_type,value_id)]) ? item[Field_Logic.get_field_value_title(value_type,value_id)] : ""
1196
1247
  }else{
1197
- return item[Field_Logic.get_field_value_list_title(value_id)] ? item[Field_Logic.get_field_value_list_title(value_id)] : [];
1248
+ return item[Field_Logic.get_field_value_items_title(value_id)] ? item[Field_Logic.get_field_value_items_title(value_id)] : [];
1198
1249
  }
1199
1250
  };
1200
1251
  static get_field_value_title = (value_type,value_id,group_id,sub_field_title) =>{
@@ -1208,11 +1259,11 @@ class Field_Logic {
1208
1259
  case Type.FIELD_VALUE_IMAGE:
1209
1260
  return 'image'+'_value_'+value_id;
1210
1261
  break;
1211
- case Type.FIELD_VALUE_LIST:
1262
+ case Type.FIELD_VALUE_ITEMS:
1212
1263
  if(!group_id){
1213
- return 'list'+'_value_'+value_id;
1264
+ return 'items'+'_value_'+value_id;
1214
1265
  }else{
1215
- return 'list'+'_value_'+value_id +'_group_' +group_id+"_"+Str.get_title_url(sub_field_title);
1266
+ return 'items'+'_value_'+value_id +'_group_' +group_id+"_"+Str.get_title_url(sub_field_title);
1216
1267
  }
1217
1268
  break;
1218
1269
  default:
@@ -1255,31 +1306,30 @@ class Field_Logic {
1255
1306
  item.id=Num.get_guid();
1256
1307
  }
1257
1308
  if(option.get_value){
1258
- item = Field_Logic.get_value_list(item,option);
1309
+ item = Field_Logic.get_values(item,option);
1259
1310
  }
1260
1311
  if(option.fields){
1261
- let field_list = String(option.fields).split(',');
1262
- for(let a = 0; a<field_list.length;a++){
1312
+ let field_items = String(option.fields).split(',');
1313
+ for(let a = 0; a<field_items.length;a++){
1263
1314
  if(option.get_blank == true){
1264
- if(item[field_list[a]]){
1265
- item[field_list[a]] = "";
1315
+ if(item[field_items[a]]){
1316
+ item[field_items[a]] = "";
1266
1317
  }
1267
1318
  }else{
1268
- if(!Str.check_is_null(field_list[a])){
1269
- item[Str.get_title_url(field_list[a])] = Str.get_title(field_list[a]) +"_" + Num.get_id();
1319
+ if(!Str.check_is_null(field_items[a])){
1320
+ item[Str.get_title_url(field_items[a])] = Str.get_title(field_items[a]) +"_" + Num.get_id();
1270
1321
  }
1271
1322
  }
1272
1323
  }
1273
1324
  }
1274
1325
  return item;
1275
1326
  }
1276
- //here
1277
- static get_field_value_list_title(value_id){
1278
- return 'list_value_'+value_id;
1327
+ static get_field_value_items_title(value_id){
1328
+ return 'items_value_'+value_id;
1279
1329
  }
1280
- static get_value_list_group(item,value_id,group_id){
1281
- let full_str = 'list_value_'+value_id+"_group_"+group_id;
1282
- let new_list = [];
1330
+ static get_value_items_group(item,value_id,group_id){
1331
+ let full_str = 'items_value_'+value_id+"_group_"+group_id;
1332
+ let items = [];
1283
1333
  Log.w(full_str,full_str);
1284
1334
  let count = 0;
1285
1335
  for(const prop in item){
@@ -1287,12 +1337,12 @@ class Field_Logic {
1287
1337
  if(prop.startsWith(full_str)){
1288
1338
  count = count+1;
1289
1339
  new_item[prop.replace(full_str+"_","")] = item[prop];
1290
- new_list.push(new_item);
1340
+ items.push(new_item);
1291
1341
  }
1292
1342
  }
1293
- return new_list;
1343
+ return items;
1294
1344
  }
1295
- static get_value_list(item,option){
1345
+ static get_values(item,option){
1296
1346
  for(let b=0;b<parseInt(option.value_count);b++){
1297
1347
  if(option.get_blank == false){
1298
1348
  item['value_'+String(b+1)] = 'value ' + String(b+1);
@@ -1491,20 +1541,6 @@ class Favorite_Logic {
1491
1541
  user_id:user_id
1492
1542
  });
1493
1543
  }
1494
- static old_get_favorite_by_list = (favorite_list,item_list) =>{
1495
- if(!item_list){
1496
- item_list = [];
1497
- }
1498
- if(item_list.length>0){
1499
- favorite_list.forEach(item => {
1500
- const item_match = item_list.find(item_find => item_find.id === item.parent_id);
1501
- if (item_match) {
1502
- item_match.is_favorite = true;
1503
- }
1504
- });
1505
- }
1506
- return item_list;
1507
- }
1508
1544
  static get_user_search_filter = (item_data_type,user_id) =>{
1509
1545
  return {
1510
1546
  $and: [
@@ -1566,13 +1602,13 @@ class Review_Logic {
1566
1602
  }
1567
1603
  return review;
1568
1604
  };
1569
- static get_test_list=(option)=>{
1605
+ static get_test_items=(option)=>{
1570
1606
  option = !Obj.check_is_empty(option) ? option : {review_count:19};
1571
- let item_list = [];
1607
+ let items = [];
1572
1608
  for(let a=0;a<option.review_count;a++){
1573
- item_list.push(Review_Logic.get_test(option));
1609
+ items.push(Review_Logic.get_test(option));
1574
1610
  }
1575
- return item_list;
1611
+ return items;
1576
1612
  };
1577
1613
  }
1578
1614
  class Admin_Logic {
@@ -1630,34 +1666,34 @@ class Category_Logic {
1630
1666
  option = Field_Logic.get_option(DataType.CATEGORY,option?option:{});
1631
1667
  let category = DataItem.get_new(DataType.CATEGORY,0,Field_Logic.get_test(title,option));
1632
1668
  if(option.get_item){
1633
- category.items = Sub_Item_Logic.get_test_list(category,category,option);
1669
+ category.items = Sub_Item_Logic.get_test_items(category,category,option);
1634
1670
  }
1635
1671
  return category;
1636
1672
  };
1637
- static get_test_list = (option) =>{
1673
+ static get_test_items = (option) =>{
1638
1674
  option = Field_Logic.get_option(DataType.CATEGORY,option);
1639
- let item_list = [];
1675
+ let items = [];
1640
1676
  for(let a=0;a<option.category_count;a++){
1641
- item_list.push(Category_Logic.get_test("Category " +String(parseInt(a+1)),option));
1677
+ items.push(Category_Logic.get_test("Category " +String(parseInt(a+1)),option));
1642
1678
  }
1643
- return item_list;
1679
+ return items;
1644
1680
  }
1645
- static get_test_list_by_type = (type,option) =>{
1681
+ static get_test_items_by_type = (type,option) =>{
1646
1682
  option = Field_Logic.get_option(DataType.CATEGORY,option);
1647
- let category_list = [];
1683
+ let categorys = [];
1648
1684
  for(let a=0;a<option.category_count;a++){
1649
1685
  let category = DataItem.get_new(DataType.CATEGORY,0,Field_Logic.get_test("Category " +String(parseInt(a+1)),option));
1650
1686
  category.type = type;
1651
- category_list.push(category);
1687
+ categorys.push(category);
1652
1688
  }
1653
- return category_list;
1689
+ return categorys;
1654
1690
  };
1655
- static get_category_drop_down_list_by_list = (cat_list) => {
1656
- let category_list = [];
1657
- for(let a=0;a<cat_list.length;a++){
1658
- category_list.push({value:cat_list[a].title,label:cat_list[a].title});
1691
+ static get_category_drop_down_by_items = (items) => {
1692
+ let categorys = [];
1693
+ for(let a=0;a<items.length;a++){
1694
+ categorys.push({value:items[a].title,label:items[a].title});
1659
1695
  }
1660
- return category_list;
1696
+ return categorys;
1661
1697
  };
1662
1698
  };
1663
1699
  class Storage {
@@ -1778,13 +1814,13 @@ class User_Logic {
1778
1814
  }
1779
1815
  return user;
1780
1816
  };
1781
- static get_test_list = (option) =>{
1817
+ static get_test_items = (option) =>{
1782
1818
  option = Field_Logic.get_option(DataType.USER,option?option:{});
1783
- let item_list = [];
1819
+ let items = [];
1784
1820
  for(let a=0;a<option.user_count+1;a++){
1785
- item_list.push(User_Logic.get_test("User " +String(parseInt(a+1)),option));
1821
+ items.push(User_Logic.get_test("User " +String(parseInt(a+1)),option));
1786
1822
  }
1787
- return item_list;
1823
+ return items;
1788
1824
  }
1789
1825
  }
1790
1826
  class Sub_Item_Logic {
@@ -1804,31 +1840,31 @@ class Sub_Item_Logic {
1804
1840
  }
1805
1841
  );
1806
1842
  if(option.get_value){
1807
- item = Field_Logic.get_value_list(item,option);
1843
+ item = Field_Logic.get_values(item,option);
1808
1844
  }
1809
1845
  return item;
1810
1846
  }
1811
- static get_test_list(parent_item,top_item,option){
1847
+ static get_test_items(parent_item,top_item,option){
1812
1848
  option = Field_Logic.get_option(DataType.SUB_ITEM,option?option:{});
1813
- let new_list = [];
1849
+ let items = [];
1814
1850
  for(let a=0;a<option.item_count;a++){
1815
1851
  let item_title ="Item " + String(parseInt(a+1));
1816
- new_list.push(Sub_Item_Logic.get_test(item_title,parent_item,top_item,option));
1852
+ items.push(Sub_Item_Logic.get_test(item_title,parent_item,top_item,option));
1817
1853
  }
1818
- return new_list;
1854
+ return items;
1819
1855
  }
1820
- static get_test_section_list(parent_item,top_item,option){
1821
- let new_list = [];
1856
+ static get_test_sections(parent_item,top_item,option){
1857
+ let items = [];
1822
1858
  for(let a=0;a<option.section_count;a++){
1823
1859
  let item_title ="Section " + String(parseInt(a+1));
1824
1860
  let item = Sub_Item_Logic.get_test(item_title,parent_item,top_item,option);
1825
- new_list.push(item);
1861
+ items.push(item);
1826
1862
  }
1827
- return new_list;
1863
+ return items;
1828
1864
  }
1829
- static bind_parent_child_list(item,item_list){
1830
- for(let a=0;a<item_list.length;a++){
1831
- item[Str.get_title_url(item_list[a].title)] = item_list[a];
1865
+ static bind_parent_child_items(item,items){
1866
+ for(let a=0;a<items.length;a++){
1867
+ item[Str.get_title_url(items[a].title)] = items[a];
1832
1868
  }
1833
1869
  return item;
1834
1870
  }
@@ -1837,7 +1873,7 @@ class App_Logic {
1837
1873
  static get_url = (app_id,host,url,param) => {
1838
1874
  return get_cloud_url_main(app_id,host,url,param);
1839
1875
  };
1840
- static bind_item_parent_user_list = (item,parent_item,user)=>{
1876
+ static bind_item_parent_users = (item,parent_item,user)=>{
1841
1877
  for(const prop in parent_item) {
1842
1878
  item['parent_'+prop] = parent_item[prop];
1843
1879
  }
@@ -1846,11 +1882,11 @@ class App_Logic {
1846
1882
  }
1847
1883
  return item;
1848
1884
  };
1849
- static bind_item_parent_user_list = (item_list)=>{
1850
- for(let item of item_list) {
1885
+ static bind_item_parent_users = (items)=>{
1886
+ for(let item of items) {
1851
1887
  item = App_Logic.bind_item_parent_user_obj(item);
1852
1888
  }
1853
- return item_list;
1889
+ return items;
1854
1890
  };
1855
1891
  static bind_item_parent_user_obj = (item)=>{
1856
1892
  if(!item.user){
@@ -1961,14 +1997,14 @@ class App_Logic {
1961
1997
  }
1962
1998
  return App_Logic.get_search(query.data_type,filter,sort_by,query.page_current,query.page_size);
1963
1999
  }
1964
- static get_data_search_result = (app_id,data_type,item_count,page_count,filter,data_list,option) =>{
2000
+ static get_data_search_result = (app_id,data_type,item_count,page_count,filter,items,option) =>{
1965
2001
  return{
1966
2002
  option:option?option:{},
1967
2003
  data_type:data_type?data_type:DataType.BLANK,
1968
2004
  item_count:item_count?item_count:0,
1969
2005
  page_count:page_count?page_count:1,
1970
2006
  filter:filter?filter:{},
1971
- data_list:data_list?data_list:[]
2007
+ items:items?items:[]
1972
2008
  }
1973
2009
  }
1974
2010
  }
@@ -2019,7 +2055,7 @@ class Image_Logic {
2019
2055
  item.buffer = !Str.check_is_null(Str.get_file_type_from_base64(item_image.image_data)) ? Buffer.from(item_image.image_data.split(';base64,').pop(), 'base64') : null;
2020
2056
  return item;
2021
2057
  };
2022
- static get_process_list = (upload_dir,image_filename) =>{
2058
+ static get_process_items = (upload_dir,image_filename) =>{
2023
2059
  upload_dir = upload_dir ? upload_dir : "";
2024
2060
  image_filename = image_filename ? image_filename : "";
2025
2061
  return [
@@ -2097,7 +2133,7 @@ class Url {
2097
2133
  static PING_GET="ping_get";
2098
2134
  static PING_POST="ping_post";
2099
2135
  static POST="main/crud/post";
2100
- static POST_LIST="main/crud/post_list";
2136
+ static POST_ITEMS="main/crud/post_items";
2101
2137
  static SEARCH="main/crud/search";
2102
2138
  static DATABASE_INFO="main/crud/database_info";
2103
2139
  //dashboard
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "10.0.18",
3
+ "version": "10.0.22",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -9,8 +9,9 @@
9
9
  "license": "MIT",
10
10
  "dependencies": {
11
11
  "async-series": "^0.0.1",
12
+ "biz9-logic": "^10.0.18",
12
13
  "biz9-scriptz": "^5.8.12",
13
- "biz9-utility": "^3.8.68",
14
+ "biz9-utility": "^4.4.12",
14
15
  "jest": "^29.7.0",
15
16
  "moment": "^2.30.1"
16
17
  },
package/test.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const series = require('async-series');
2
2
  const {DataItem,DataType,Item_Logic,User_Logic,Page_Logic,Product_Logic,Type,Title,Stat_Logic,Service_Logic,Blog_Post_Logic,Event_Logic,Demo_Logic,Cart_Logic,Order_Logic,App_Logic,Field_Logic,Image_Logic,Message} = require('./index');
3
- const {Log,Num,Str} = require('biz9-utility');
3
+ const {Log,Num,Str,Obj} = require('biz9-utility');
4
4
  const {Scriptz}= require('biz9-scriptz');
5
5
 
6
6
  /* --- TEST CONFIG START --- */
@@ -37,14 +37,6 @@ describe("connect", () => {
37
37
  let parent_id = 3334;
38
38
  let user_id = 0;
39
39
 
40
- let image = DataItem.get_new(DataType.IMAGE,0);
41
- image.base64 = 'fsadfsd';
42
- image.parnet_id = '1';
43
- image.apple = 'butter';
44
- Log.w('88_image',image);
45
- image = Image_Logic.get_new_by_base64(image);
46
- Log.w('99_result',image);
47
- Log.w('error_show',Message.USER_PASSWORD_NOT_VALID);
48
40
 
49
41
  //Log.w('Title',Type.get_title(Type.ORDER_STATUS_NEW));
50
42
  //Log.w('Title 2',Type.get_title(Type.ORDER_STATUS_COMPLETE));