biz9-logic 10.0.16 → 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 +311 -265
  3. package/package.json +3 -2
  4. package/test.js +2 -9
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='10.1.6'
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
@@ -18,6 +18,7 @@ class Message {
18
18
  static USER_EMAIL_NEW_CONFIRM_BAD="The New and Confirm Email Dont Match.";
19
19
  static USER_PASSWORD_NEW_CONFIRM_BAD="The New and Confirm Password Dont Match.";
20
20
  static USER_PASSWORD_BAD="Please Enter A Valid Password.";
21
+ static USER_PASSWORD_NOT_VALID="Password must be between 7 and 15 characters long, have at least one uppercase and lowercase letter, and also contain at least one digit and one special character.";
21
22
  static USER_EMAIL_NOT_UNIQUE="Email Not Availble. Please Choose Another.";
22
23
  static USER_USERNAME_BAD="Please Enter A Valid Username.";
23
24
  static USER_USERNAME_NOT_UNIQUE="Username Not Availble. Please Choose Another.";
@@ -37,7 +38,29 @@ class Item_Logic {
37
38
  const item = DataItem.get_new(data_type,0,{title:title,title_url:Str.get_title_url(title),setting_visible:"1"});
38
39
  return item;
39
40
  };
40
-
41
+ static copy = (data_type,item)=>{
42
+ let copy_item = DataItem.get_new(data_type,0);
43
+ const keys = Object.keys(item);
44
+ keys.forEach(key => {
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
+ ){
59
+ copy_item[key]=item[key];
60
+ }
61
+ });
62
+ return copy_item;
63
+ };
41
64
  static bind_child_parent_obj = (child_obj,parent_obj)=>{
42
65
  for(const prop in parent_obj) {
43
66
  child_obj['parent_'+prop] = parent_obj[prop];
@@ -50,18 +73,18 @@ class Item_Logic {
50
73
  option = Field_Logic.get_option(data_type,option?option:{});
51
74
  let item = DataItem.get_new(data_type,0,Field_Logic.get_test(title,option));
52
75
  if(option.get_item){
53
- item.items = Sub_Item_Logic.get_test_list(item,item,option);
54
- 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);
55
78
  }
56
79
  return item;
57
80
  }
58
- static get_test_list = (data_type,option) =>{
81
+ static get_test_items = (data_type,option) =>{
59
82
  option = Field_Logic.get_option(data_type,option?option:{});
60
- let item_list = [];
83
+ let items = [];
61
84
  for(let a=0;a<parseInt(option.item_count)+1;a++){
62
- 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));
63
86
  }
64
- return item_list;
87
+ return items;
65
88
  }
66
89
  }
67
90
  class Title {
@@ -130,36 +153,36 @@ class Demo_Logic {
130
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
131
154
  if(option.get_category){
132
155
  item.categorys = [];
133
- let category_title_list = [];
156
+ let category_titles = [];
134
157
  if(option.categorys){
135
- category_title_list = option.categorys.split(',');
136
- option.category_count = category_title_list.length;
158
+ category_titles = option.categorys.split(',');
159
+ option.category_count = category_titles.length;
137
160
  }else{
138
161
  if(!option.category_count){
139
162
  option.category_count = 1;
140
163
  }
141
164
  for(let a = 1;a<parseInt(option.category_count)+1;a++){
142
- category_title_list.push(Title.CATEGORY+" "+a);
165
+ category_titles.push(Title.CATEGORY+" "+a);
143
166
  }
144
167
  }
145
- category_title_list.forEach(cat_item => {
168
+ category_titles.forEach(cat_item => {
146
169
  item.categorys.push(Category_Logic.get_new(cat_item,item.title,option.category_data_type));
147
170
  });
148
171
  }
149
172
  //item
150
173
  if(option.get_item){
151
- let full_item_list = [];
174
+ let full_items = [];
152
175
 
153
- let item_title_list = [];
176
+ let item_titles = [];
154
177
  if(option.items){
155
- item_title_list = option.items.split(',');
156
- option.item_count = item_title_list.length;
178
+ item_titles = option.items.split(',');
179
+ option.item_count = item_titles.length;
157
180
  }else{
158
181
  for(let b = 1;b<parseInt(option.item_count)+1;b++){
159
- 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);
160
183
  }
161
184
  }
162
- for(const child_item_title of item_title_list){
185
+ for(const child_item_title of item_titles){
163
186
  const cat_item = item.categorys[Num.get_id(option.category_count)];
164
187
  if(!cat_item.items){
165
188
  cat_item.items = [];
@@ -175,7 +198,7 @@ class Demo_Logic {
175
198
  child_item.description =Title.DESCRIPTION+" "+ String(Num.get_id());
176
199
  child_item.note = Field_Logic.get_test_note(),
177
200
  cat_item.items.push(child_item);
178
- full_item_list.push(child_item);
201
+ full_items.push(child_item);
179
202
  }
180
203
  }
181
204
  return item;
@@ -190,35 +213,73 @@ class Type {
190
213
  static APP_LINK_TYPE_GOOGLE_PLAY='google_play';
191
214
  static APP_LINK_TYPE_APPLE_STORE='apple_store';
192
215
  static APP_LINK_TYPE_CMS='cms';
216
+
193
217
  //field
194
- static ASC='asc';
195
- static BLANK='blank';
196
- static CART_ITEM_LIST='cart_item_list';
197
- static CART_SUB_ITEM_LIST='cart_sub_item_list';
198
- static DATA_TYPE='data_type';
199
- static DESC='desc';
200
- static DATE_CREATE='date_create';
201
- static DATE_SAVE='date_save';
202
- static ID='id';
203
- static OBJ='obj';
204
- static LIST='list';
205
- static COUNT='count';
206
- static N_A='n/a';
207
- static USER='user';
208
- static USER_ID='user_id';
209
- static CART_ITEM_LIST='cart_item_list';
210
- static CART_SUB_ITEM_LIST='cart_sub_item_list';
211
- static ORDER_ITEM_LIST='order_item_list';
212
- static ORDER_SUB_ITEM_LIST='order_sub_item_list';
213
- static PARENT_ID='parent_id';
214
- static PARENT_ITEM='parent_item';
215
- static PARENT_DATA_TYPE='parent_data_type';
216
- static SETTING_VISIBLE='setting_visible';
217
- static SOURCE='source';
218
- static SOURCE_ID='source_id';
219
- static SOURCE_PARENT_ID='source_parent_id';
220
- static TITLE='title';
221
- 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';
222
283
  //page
223
284
  static PAGE_ABOUT='about';
224
285
  static PAGE_CONTACT='contact';
@@ -266,7 +327,7 @@ class Type {
266
327
  static FIELD_VALUE_TEXT="text";
267
328
  static FIELD_VALUE_NOTE="note";
268
329
  static FIELD_VALUE_IMAGE="image";
269
- static FIELD_VALUE_LIST="list";
330
+ static FIELD_VALUE_ITEMS="items";
270
331
  //user_role
271
332
  static USER_ROLE_SUPER_ADMIN='super_admin';
272
333
  static USER_ROLE_ADMIN='admin';
@@ -303,7 +364,7 @@ class Type {
303
364
  static ORDER_STATUS_RETURNED="returned";
304
365
  static ORDER_STATUS_ON_HOLD="on_hold";
305
366
  static ORDER_STATUS_CANCELLED="cancelled";
306
- static get_order_status_list(){
367
+ static get_order_statuses(){
307
368
  return [
308
369
  {value:Type.ORDER_STATUS_NEW,label:Title.ORDER_STATUS_NEW},
309
370
  {value:Type.ORDER_STATUS_OPEN,label:Title.ORDER_STATUS_OPEN},
@@ -313,7 +374,7 @@ class Type {
313
374
  {value:Type.ORDER_STATUS_CANCELLED,label:Title.ORDER_STATUS_CANCELLED},
314
375
  ];
315
376
  };
316
- static get_user_role_list(){
377
+ static get_user_roles(){
317
378
  return [
318
379
  {value:Type.USER_ROLE_ADMIN,label:Title.USER_ROLE_ADMIN},
319
380
  {value:Type.USER_ROLE_MANAGER,label:Title.USER_ROLE_MANAGER},
@@ -321,7 +382,7 @@ class Type {
321
382
  {value:Type.USER_ROLE_GUEST,label:Title.USER_ROLE_GUEST},
322
383
  ];
323
384
  };
324
- static get_page_list(){
385
+ static get_pages(){
325
386
  return [
326
387
  {value:Type.PAGE_ABOUT,label:Title.PAGE_ABOUT,url:Url.PAGE_ABOUT},
327
388
  {value:Type.PAGE_BLOG_POST,label:Title.PAGE_BLOG_POST,url:Url.PAGE_BLOG_POST},
@@ -342,7 +403,7 @@ class Type {
342
403
  {value:Type.PAGE_SERVICE_HOME,label:Title.PAGE_SERVICE_HOME,url:Url.PAGE_SERVICE_HOME},
343
404
  ];
344
405
  };
345
- static get_stat_type_list = () =>{
406
+ static get_stat_types = () =>{
346
407
  return [
347
408
  {title:Type.get_title(Type.STAT_CART),type:Type.STAT_CART,label:Type.get_title(Type.STAT_CART),value:Type.STAT_CART},
348
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},
@@ -359,7 +420,7 @@ class Type {
359
420
  {title:Type.get_title(Type.STAT_VIEW),type:Type.STAT_VIEW,label:Type.get_title(Type.STAT_VIEW),value:Type.STAT_VIEW},
360
421
  ]
361
422
  };
362
- static get_data_type_list = () =>{
423
+ static get_data_types = () =>{
363
424
  return [
364
425
  {title:Type.get_title(DataType.BLOG_POST),type:DataType.BLOG_POST,label:Type.get_title(DataType.BLOG_POST),value:DataType.BLOG_POST},
365
426
  {title:Type.get_title(DataType.CATEGORY),type:DataType.CATEGORY,label:Type.get_title(DataType.CATEGORY),value:DataType.CATEGORY},
@@ -373,7 +434,7 @@ class Type {
373
434
  {title:Type.get_title(DataType.SERVICE),type:DataType.SERVICE,label:Type.get_title(DataType.SERVICE),value:DataType.SERVICE}
374
435
  ]
375
436
  };
376
- static get_type_list = () =>{
437
+ static get_types = () =>{
377
438
  return [
378
439
  {title:Type.get_title(DataType.BLOG_POST),type:DataType.BLOG_POST,label:Type.get_title(DataType.BLOG_POST),value:DataType.BLOG_POST},
379
440
  {title:Type.get_title(DataType.CATEGORY),type:DataType.CATEGORY,label:Type.get_title(DataType.CATEGORY),value:DataType.CATEGORY},
@@ -387,14 +448,14 @@ class Type {
387
448
  {title:Type.get_title(DataType.TYPE),type:DataType.TYPE,label:Type.get_title(DataType.TYPE),value:DataType.TYPE}
388
449
  ]
389
450
  };
390
- static get_app_environment_list = () =>{
451
+ static get_app_environments = () =>{
391
452
  return [
392
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},
393
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},
394
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},
395
456
  ]
396
457
  };
397
- static get_app_link_list = () =>{
458
+ static get_app_links = () =>{
398
459
  return [
399
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},
400
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},
@@ -585,17 +646,17 @@ class Stat_Logic {
585
646
  for(const prop in post_data) {
586
647
  const value = post_data[prop];
587
648
  if (!Array.isArray(value)
588
- && prop != Type.SOURCE
589
- && prop != Type.DATE_CREATE
590
- && prop != Type.DATE_SAVE
591
- && prop != Type.DATA_TYPE
592
- && prop != Type.CART_ITEM_LIST
593
- && prop != Type.CART_SUB_ITEM_LIST
594
- && prop != Type.ORDER_ITEM_LIST
595
- && prop != Type.ORDER_SUB_ITEM_LIST
596
- && prop != Type.SOURCE
597
- && prop != Type.SOURCE_ID
598
- && 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) {
599
660
  filter_stat[prop] = post_data[prop];
600
661
  }
601
662
  }
@@ -608,18 +669,18 @@ static get_test = (title,option) =>{
608
669
  option = Field_Logic.get_option(DataType.PAGE,option?option:{});
609
670
  let page = DataItem.get_new(DataType.PAGE,0,Field_Logic.get_test(title,option));
610
671
  if(option.get_section){
611
- page.items = Sub_Item_Logic.get_test_section_list(page,page,option);
612
- 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);
613
674
  }
614
675
  return page;
615
676
  };
616
- static get_test_list = (option) =>{
677
+ static get_test_items = (option) =>{
617
678
  option = Field_Logic.get_option(DataType.PAGE,option?option:{});
618
- let item_list = [];
679
+ let items = [];
619
680
  for(let a=0;a<parseInt(option.page_count)+1;a++){
620
- 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));
621
682
  }
622
- return item_list;
683
+ return items;
623
684
  };
624
685
  }
625
686
  class Order_Logic {
@@ -632,23 +693,23 @@ class Order_Logic {
632
693
  cart_number:cart.cart_number,
633
694
  grand_total:cart.grand_total,
634
695
  status:Type.ORDER_STATUS_NEW,
635
- order_item_list:[]
696
+ order_items:[]
636
697
  });
637
698
  for(const key in cart) {
638
699
  if(!Str.check_is_null(cart[key])
639
- && key != Type.ID && key != Type.DATA_TYPE
640
- && key != Type.PARENT_ITEM && key != Type.USER
641
- && key != Type.CART_ITEM_LIST && key != Type.CART_SUB_ITEM_LIST
642
- && key != Type.ORDER_ITEM_LIST && key != Type.ORDER_SUB_ITEM_LIST
643
- && key != Type.SOURCE && key != Type.SOURCE_ID
644
- && 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){
645
706
  order[key] = cart[key];
646
707
  }
647
708
  }
648
709
  if(option.get_payment_plan){
649
710
  order.payment_plan = option.payment_plan;
650
711
  }
651
- cart.cart_item_list.forEach(cart_item => {
712
+ cart.cart_items.forEach(cart_item => {
652
713
  let order_item = DataItem.get_new(DataType.ORDER_ITEM,0,{
653
714
  order_number:order.order_number,
654
715
  parent_data_type:cart_item.parent_data_type,
@@ -656,20 +717,20 @@ class Order_Logic {
656
717
  user_id:order.user_id,
657
718
  quanity:cart_item.quanity?cart_item.quanity:0,
658
719
  cost:cart_item.cost?cart_item.cost:0,
659
- order_sub_item_list:[]
720
+ order_sub_items:[]
660
721
  });
661
722
  for(const key in cart_item){
662
723
  if(!Str.check_is_null(cart_item[key])
663
- && key != Type.ID && key != Type.DATA_TYPE
664
- && key != Type.PARENT_ITEM && key != Type.USER
665
- && key != Type.CART_ITEM_LIST && key != Type.CART_SUB_ITEM_LIST
666
- && key != Type.ORDER_ITEM_LIST && key != Type.ORDER_SUB_ITEM_LIST
667
- && key != Type.SOURCE && key != Type.SOURCE_ID
668
- && 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){
669
730
  order_item[key] = cart_item[key];
670
731
  }
671
732
  }
672
- cart_item.cart_sub_item_list.forEach(cart_sub_item => {
733
+ cart_item.cart_sub_items.forEach(cart_sub_item => {
673
734
  let order_sub_item = DataItem.get_new(DataType.ORDER_SUB_ITEM,0,{
674
735
  order_number:order.order_number,
675
736
  parent_data_type:cart_sub_item.parent_data_type,
@@ -680,18 +741,18 @@ class Order_Logic {
680
741
  })
681
742
  for(const key in cart_sub_item){
682
743
  if(!Str.check_is_null(cart_sub_item[key])
683
- && key != Type.ID && key != Type.DATA_TYPE
684
- && key != Type.PARENT_ITEM && key != Type.USER
685
- && key != Type.CART_ITEM_LIST && key != Type.CART_SUB_ITEM_LIST
686
- && key != Type.ORDER_ITEM_LIST && key != Type.ORDER_SUB_ITEM_LIST
687
- && key != Type.SOURCE && key != Type.SOURCE_ID
688
- && 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){
689
750
  order_sub_item[key] = cart_sub_item[key];
690
751
  }
691
752
  }
692
- order_item.order_sub_item_list.push(order_sub_item);
753
+ order_item.order_sub_items.push(order_sub_item);
693
754
  });
694
- order.order_item_list.push(order_item);
755
+ order.order_items.push(order_item);
695
756
  });
696
757
  return order;
697
758
  };
@@ -706,13 +767,13 @@ class Order_Logic {
706
767
  };
707
768
  static get_total = (order) => {
708
769
  let grand_total = 0;
709
- order.order_item_list.forEach(order_item => {
770
+ order.order_items.forEach(order_item => {
710
771
  order_item.sub_total = 0;
711
772
  if(!isNaN(order_item.cost)){
712
773
  order_item.sub_total = (order_item.sub_total + order_item.cost) * order_item.quanity;
713
774
  grand_total = grand_total + order_item.sub_total;
714
775
  }
715
- order_item.order_sub_item_list.forEach(order_sub_item => {
776
+ order_item.order_sub_items.forEach(order_sub_item => {
716
777
  order_sub_item.sub_total = 0;
717
778
  if(!isNaN(order_sub_item.cost)){
718
779
  order_sub_item.sub_total = (order_sub_item.sub_total + order_sub_item.cost) * order_sub_item.quanity;
@@ -726,23 +787,23 @@ class Order_Logic {
726
787
  }
727
788
  class Cart_Logic {
728
789
  static get_new = (parent_data_type,user_id) => {
729
- 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:[]});
730
791
  };
731
792
  static get_new_cart_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
732
- 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:[]});
733
794
  };
734
795
  static get_new_cart_sub_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
735
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});
736
797
  };
737
798
  static get_total = (cart) => {
738
799
  let grand_total = 0;
739
- cart.cart_item_list.forEach(cart_item => {
800
+ cart.cart_items.forEach(cart_item => {
740
801
  cart_item.sub_total = 0;
741
802
  if(!isNaN(cart_item.cost)){
742
803
  cart_item.sub_total = (cart_item.sub_total + cart_item.cost) * cart_item.quanity;
743
804
  grand_total = grand_total + cart_item.sub_total;
744
805
  }
745
- cart_item.cart_sub_item_list.forEach(cart_sub_item => {
806
+ cart_item.cart_sub_items.forEach(cart_sub_item => {
746
807
  cart_sub_item.sub_total = 0;
747
808
  if(!isNaN(cart_sub_item.cost)){
748
809
  cart_sub_item.sub_total = (cart_sub_item.sub_total + cart_sub_item.cost) * cart_sub_item.quanity;
@@ -762,15 +823,15 @@ static get_new = (title,type,category,option) => {
762
823
  item.category = category = category?category:"";
763
824
  return item;
764
825
  };
765
- static get_stock_list = () => {
766
- const r_list=
826
+ static get_stocks = () => {
827
+ const stocks=
767
828
  [
768
829
  { value: "0", label: "Out of Stock" },
769
830
  { value: "1", label: "Only 1 Left" },
770
831
  { value: "2", label: "Less Than 3 Left" },
771
832
  { value: "3", label: "Availble" }
772
833
  ];
773
- return r_list;
834
+ return stocks;
774
835
  };
775
836
  static get_stock_by_value = (stock_val) => {
776
837
  switch(stock_val)
@@ -814,7 +875,7 @@ static get_new = (title,type,category,option) => {
814
875
  product.tag = "";
815
876
  }
816
877
  if(option.get_item){
817
- product.items = Sub_Item_Logic.get_test_list(product,product,option);
878
+ product.items = Sub_Item_Logic.get_test_items(product,product,option);
818
879
  }
819
880
  return product;
820
881
  };
@@ -826,49 +887,49 @@ static get_new = (title,type,category,option) => {
826
887
  cart.cart_number = cart_number;
827
888
  if(option.get_cart_item){
828
889
  let product_option = {product_count:option.cart_item_count,generate_id:true};
829
- let product_list = Product_Logic.get_test_list(product_option);
830
- cart.cart_item_list = [];
831
- for(let a = 0;a<product_list.length;a++){
832
- 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});
833
- product_cart_item.item_item = product_list[a];
834
- 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);
835
896
  }
836
897
  }
837
898
  return cart;
838
899
  };
839
- static get_test_list = (option) =>{
900
+ static get_test_items = (option) =>{
840
901
  option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
841
- let item_list = [];
902
+ let items = [];
842
903
  for(let a=0;a<option.product_count+1;a++){
843
- 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));
844
905
  }
845
- return item_list;
906
+ return items;
846
907
  }
847
- static get_test_list_by_category = (option) =>{
908
+ static get_test_items_by_category = (option) =>{
848
909
  option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
849
- let product_list = [];
850
- 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);
851
912
  let item_count = 0;
852
- for(let a=0;a<category_list.length;a++){
913
+ for(let a=0;a<categorys.length;a++){
853
914
  for(let b=0;b<option.product_count;b++){
854
915
  item_count++;
855
916
  let product = Product_Logic.get_test("Product "+String(parseInt(b+1)),option);
856
- product.category = category_list[Num.get_id(category_list.length+1)].title;
857
- product_list.push(product);
917
+ product.category = categorys[Num.get_id(categorys.length+1)].title;
918
+ products.push(product);
858
919
  }
859
920
  }
860
- return [category_list,product_list]
921
+ return [categorys,products]
861
922
  };
862
923
  }
863
924
  class Service_Logic {
864
- static get_stock_list = () => {
865
- const r_list=
925
+ static get_stocks = () => {
926
+ const stocks=
866
927
  [
867
928
  { value: "0", label: "No Sessions Availble" },
868
929
  { value: "1", label: "Ready For Booking" },
869
930
  { value: "2", label: "No Sessions Availble" }
870
931
  ];
871
- return r_list;
932
+ return stocks;
872
933
  };
873
934
  static get_stock_by_value = (stock_val) => {
874
935
  switch(stock_val)
@@ -895,32 +956,32 @@ class Service_Logic {
895
956
  service.stock = String(Num.get_id(3-1));
896
957
  service.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
897
958
  if(option.get_item){
898
- service.items = Sub_Item_Logic.get_test_list(service,service,option);
959
+ service.items = Sub_Item_Logic.get_test_items(service,service,option);
899
960
  }
900
961
  return service;
901
962
  };
902
- static get_test_list = (option) =>{
963
+ static get_test_items = (option) =>{
903
964
  option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
904
- let item_list = [];
965
+ let items = [];
905
966
  for(let a=0;a<parseInt(option.service_count)+1;a++){
906
- 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));
907
968
  }
908
- return item_list;
969
+ return items;
909
970
  }
910
- static get_test_list_by_category = (option) =>{
971
+ static get_test_items_by_category = (option) =>{
911
972
  option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
912
- let service_list = [];
913
- 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);
914
975
  let item_count = 0;
915
- for(let a=0;a<category_list.length;a++){
976
+ for(let a=0;a<categorys.length;a++){
916
977
  for(let b=0;b<parseInt(option.service_count);b++){
917
978
  item_count++;
918
979
  let service = Service_Logic.get_test("Service "+String(parseInt(b+1)),option);
919
- service.category = category_list[Num.get_id(category_list.length+1)].title;
920
- service_list.push(service);
980
+ service.category = categorys[Num.get_id(categorys.length+1)].title;
981
+ services.push(service);
921
982
  }
922
983
  }
923
- return [category_list,service_list]
984
+ return [categorys,services]
924
985
  };
925
986
  }
926
987
  class Content_Logic {
@@ -929,35 +990,35 @@ class Content_Logic {
929
990
  option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
930
991
  let content = DataItem.get_new(DataType.CONTENT,0,Field_Logic.get_test(title,option));
931
992
  if(option.get_item){
932
- content.items = Sub_Item_Logic.get_test_section_list(content,content,option);
993
+ content.items = Sub_Item_Logic.get_test_sections(content,content,option);
933
994
  if(option.get_item_bind){
934
- content = Sub_Item_Logic.bind_parent_child_list(content,content.items);
995
+ content = Sub_Item_Logic.bind_parent_child_items(content,content.items);
935
996
  }
936
997
  }
937
998
  return content;
938
999
  };
939
- static get_test_list = (option) =>{
1000
+ static get_test_items = (option) =>{
940
1001
  option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
941
- let item_list = [];
1002
+ let items = [];
942
1003
  for(let a=0;a<parseInt(option.content_count)+1;a++){
943
- 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));
944
1005
  }
945
- return item_list;
1006
+ return items;
946
1007
  }
947
- static get_test_list_by_category = (option) =>{
1008
+ static get_test_items_by_category = (option) =>{
948
1009
  option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
949
- let content_list = [];
950
- 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);
951
1012
  let item_count = 0;
952
- for(let a=0;a<category_list.length;a++){
1013
+ for(let a=0;a<categorys.length;a++){
953
1014
  for(let b=0;b<parseInt(option.content_count);b++){
954
1015
  item_count++;
955
1016
  let content = Content_Logic.get_test("Content "+String(parseInt(b+1)),option);
956
- content.category = category_list[Num.get_id(category_list.length+1)].title;
957
- content_list.push(content);
1017
+ content.category = categorys[Num.get_id(categorys.length+1)].title;
1018
+ contents.push(content);
958
1019
  }
959
1020
  }
960
- return [category_list,content_list]
1021
+ return [categorys,contents]
961
1022
  };
962
1023
  }
963
1024
  class Template_Logic {
@@ -981,32 +1042,32 @@ class Blog_Post_Logic {
981
1042
  blog_post.tag = "";
982
1043
  }
983
1044
  if(option.get_item){
984
- 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);
985
1046
  }
986
1047
  return blog_post;
987
1048
  };
988
- static get_test_list = (option) =>{
1049
+ static get_test_items = (option) =>{
989
1050
  option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
990
- let item_list = [];
1051
+ let items = [];
991
1052
  for(let a=0;a<parseInt(option.blog_post_count)+1;a++){
992
- 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));
993
1054
  }
994
- return item_list;
1055
+ return items;
995
1056
  }
996
- static get_test_list_by_category = (option) =>{
1057
+ static get_test_items_by_category = (option) =>{
997
1058
  option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
998
- let blog_post_list = [];
999
- 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);
1000
1061
  let item_count = 0;
1001
- for(let a=0;a<category_list.length;a++){
1062
+ for(let a=0;a<categorys.length;a++){
1002
1063
  for(let b=0;b<parseInt(option.blog_post_count);b++){
1003
1064
  item_count++;
1004
1065
  let blog_post = Blog_Post_Logic.get_test("Blog Post "+String(parseInt(b+1)),option);
1005
- blog_post.category = category_list[Num.get_id(category_list.length+1)].title;
1006
- blog_post_list.push(blog_post);
1066
+ blog_post.category = categorys[Num.get_id(categorys.length+1)].title;
1067
+ blog_posts.push(blog_post);
1007
1068
  }
1008
1069
  }
1009
- return [category_list,blog_post_list]
1070
+ return [categorys,blog_posts]
1010
1071
  };
1011
1072
  }
1012
1073
  class Gallery_Logic {
@@ -1022,21 +1083,21 @@ class Gallery_Logic {
1022
1083
  gallery.website = "";
1023
1084
  }
1024
1085
  if(option.get_item){
1025
- gallery.items = Sub_Item_Logic.get_test_list(gallery,gallery,option);
1086
+ gallery.items = Sub_Item_Logic.get_test_items(gallery,gallery,option);
1026
1087
  }
1027
1088
  return gallery;
1028
1089
  };
1029
1090
  };
1030
1091
  class Event_Logic {
1031
- static get_stock_list = () => {
1032
- const r_list=
1092
+ static get_stocks = () => {
1093
+ const stocks =
1033
1094
  [
1034
1095
  { value: "0", label: "Sold Out" },
1035
1096
  { value: "1", label: "Less Than 25 Tickets Remaining" },
1036
1097
  { value: "2", label: "Tickets Are Availble" },
1037
1098
  { value: "3", label: "Sold Out" },
1038
1099
  ];
1039
- return r_list;
1100
+ return stocks;
1040
1101
  };
1041
1102
  static get_stock_by_value = (stock_val) => {
1042
1103
  switch(stock_val)
@@ -1083,43 +1144,43 @@ class Event_Logic {
1083
1144
  event.tag = "";
1084
1145
  }
1085
1146
  if(option.get_item){
1086
- event.items = Sub_Item_Logic.get_test_list(event,event,option);
1147
+ event.items = Sub_Item_Logic.get_test_items(event,event,option);
1087
1148
  }
1088
1149
  return event;
1089
1150
  };
1090
- static get_test_list = (option) =>{
1151
+ static get_test_items = (option) =>{
1091
1152
  option = Field_Logic.get_option(DataType.EVENT,option?option:{});
1092
- let item_list = [];
1153
+ let items = [];
1093
1154
  for(let a=0;a<parseInt(option.event_count)+1;a++){
1094
- 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));
1095
1156
  }
1096
- return item_list;
1157
+ return items;
1097
1158
  }
1098
- static get_test_list_by_category = (option) =>{
1159
+ static get_test_items_by_category = (option) =>{
1099
1160
  option = Field_Logic.get_option(DataType.EVENT,option?option:{});
1100
- let event_list = [];
1101
- 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);
1102
1163
  let item_count = 0;
1103
- for(let a=0;a<category_list.length;a++){
1164
+ for(let a=0;a<categorys.length;a++){
1104
1165
  for(let b=0;b<parseInt(option.event_count);b++){
1105
1166
  item_count++;
1106
1167
  let event = Event_Logic.get_test("Event "+String(parseInt(b+1)),option);
1107
- event.category = category_list[Num.get_id(category_list.length+1)].title;
1108
- event_list.push(event);
1168
+ event.category = categorys[Num.get_id(categorys.length+1)].title;
1169
+ events.push(event);
1109
1170
  }
1110
1171
  }
1111
- return [category_list,event_list]
1172
+ return [categorys,events]
1112
1173
  };
1113
1174
  }
1114
1175
  class Field_Logic {
1115
- static get_list_item_max_group_id = (value_id,item) => {
1176
+ static get_item_max_group_id = (value_id,item) => {
1116
1177
  let max_group_id = 0;
1117
1178
  let full_prop_str = "";
1118
1179
  for(const prop in item){
1119
1180
  full_prop_str = String(prop + " "+full_prop_str);
1120
1181
  }
1121
1182
  for(let b = 1; b < 75; b++){
1122
- 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);
1123
1184
  if(exists){
1124
1185
  if(b>max_group_id){
1125
1186
  max_group_id = b;
@@ -1128,7 +1189,7 @@ class Field_Logic {
1128
1189
  }
1129
1190
  return max_group_id;
1130
1191
  }
1131
- static get_item_field_value_list = (data) => {
1192
+ static get_item_field_values = (data) => {
1132
1193
  let max_value_id = 1;
1133
1194
  let max_group_id = 1;
1134
1195
  let full_prop_str = "";
@@ -1136,14 +1197,14 @@ class Field_Logic {
1136
1197
  full_prop_str = String(prop + " "+full_prop_str);
1137
1198
  }
1138
1199
  for(let a = 1; a < 75; a++){
1139
- 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);
1140
1201
  if(exists){
1141
1202
  if(a>max_value_id){
1142
1203
  max_value_id = a;
1143
1204
  }
1144
1205
  }
1145
1206
  for(let b = 1; b < 20; b++){
1146
- 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);
1147
1208
  if(exists){
1148
1209
  if(b>max_group_id){
1149
1210
  max_group_id = b;
@@ -1152,7 +1213,7 @@ class Field_Logic {
1152
1213
  }
1153
1214
  }
1154
1215
  for(let a = 1; a <= max_value_id+1; a++){
1155
- let sub_check_str = 'list_value_'+a;
1216
+ let sub_check_str = 'items_value_'+a;
1156
1217
  data[sub_check_str] = [];
1157
1218
  for(let b = 1; b < max_group_id+1; b++){
1158
1219
  let full_sub_check_str = sub_check_str+"_group_"+b;
@@ -1172,19 +1233,19 @@ class Field_Logic {
1172
1233
  }
1173
1234
  return data;
1174
1235
  }
1175
- static get_item_field_value_type_list = () => {
1236
+ static get_item_field_value_types = () => {
1176
1237
  return [
1177
1238
  {value:'text',label:'Text'},
1178
1239
  {value:'note',label:'Note'},
1179
1240
  {value:'image',label:'Image'},
1180
- {value:'list',label:'List'},
1241
+ {value:'items',label:'List'},
1181
1242
  ];
1182
1243
  };
1183
1244
  static get_field_value_value = (value_type,item,value_id) =>{
1184
- if(value_type!=Type.FIELD_VALUE_LIST){
1245
+ if(value_type!=Type.FIELD_VALUE_ITEMS){
1185
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)] : ""
1186
1247
  }else{
1187
- 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)] : [];
1188
1249
  }
1189
1250
  };
1190
1251
  static get_field_value_title = (value_type,value_id,group_id,sub_field_title) =>{
@@ -1198,11 +1259,11 @@ class Field_Logic {
1198
1259
  case Type.FIELD_VALUE_IMAGE:
1199
1260
  return 'image'+'_value_'+value_id;
1200
1261
  break;
1201
- case Type.FIELD_VALUE_LIST:
1262
+ case Type.FIELD_VALUE_ITEMS:
1202
1263
  if(!group_id){
1203
- return 'list'+'_value_'+value_id;
1264
+ return 'items'+'_value_'+value_id;
1204
1265
  }else{
1205
- 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);
1206
1267
  }
1207
1268
  break;
1208
1269
  default:
@@ -1245,31 +1306,30 @@ class Field_Logic {
1245
1306
  item.id=Num.get_guid();
1246
1307
  }
1247
1308
  if(option.get_value){
1248
- item = Field_Logic.get_value_list(item,option);
1309
+ item = Field_Logic.get_values(item,option);
1249
1310
  }
1250
1311
  if(option.fields){
1251
- let field_list = String(option.fields).split(',');
1252
- 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++){
1253
1314
  if(option.get_blank == true){
1254
- if(item[field_list[a]]){
1255
- item[field_list[a]] = "";
1315
+ if(item[field_items[a]]){
1316
+ item[field_items[a]] = "";
1256
1317
  }
1257
1318
  }else{
1258
- if(!Str.check_is_null(field_list[a])){
1259
- 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();
1260
1321
  }
1261
1322
  }
1262
1323
  }
1263
1324
  }
1264
1325
  return item;
1265
1326
  }
1266
- //here
1267
- static get_field_value_list_title(value_id){
1268
- return 'list_value_'+value_id;
1327
+ static get_field_value_items_title(value_id){
1328
+ return 'items_value_'+value_id;
1269
1329
  }
1270
- static get_value_list_group(item,value_id,group_id){
1271
- let full_str = 'list_value_'+value_id+"_group_"+group_id;
1272
- 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 = [];
1273
1333
  Log.w(full_str,full_str);
1274
1334
  let count = 0;
1275
1335
  for(const prop in item){
@@ -1277,12 +1337,12 @@ class Field_Logic {
1277
1337
  if(prop.startsWith(full_str)){
1278
1338
  count = count+1;
1279
1339
  new_item[prop.replace(full_str+"_","")] = item[prop];
1280
- new_list.push(new_item);
1340
+ items.push(new_item);
1281
1341
  }
1282
1342
  }
1283
- return new_list;
1343
+ return items;
1284
1344
  }
1285
- static get_value_list(item,option){
1345
+ static get_values(item,option){
1286
1346
  for(let b=0;b<parseInt(option.value_count);b++){
1287
1347
  if(option.get_blank == false){
1288
1348
  item['value_'+String(b+1)] = 'value ' + String(b+1);
@@ -1481,20 +1541,6 @@ class Favorite_Logic {
1481
1541
  user_id:user_id
1482
1542
  });
1483
1543
  }
1484
- static old_get_favorite_by_list = (favorite_list,item_list) =>{
1485
- if(!item_list){
1486
- item_list = [];
1487
- }
1488
- if(item_list.length>0){
1489
- favorite_list.forEach(item => {
1490
- const item_match = item_list.find(item_find => item_find.id === item.parent_id);
1491
- if (item_match) {
1492
- item_match.is_favorite = true;
1493
- }
1494
- });
1495
- }
1496
- return item_list;
1497
- }
1498
1544
  static get_user_search_filter = (item_data_type,user_id) =>{
1499
1545
  return {
1500
1546
  $and: [
@@ -1556,13 +1602,13 @@ class Review_Logic {
1556
1602
  }
1557
1603
  return review;
1558
1604
  };
1559
- static get_test_list=(option)=>{
1605
+ static get_test_items=(option)=>{
1560
1606
  option = !Obj.check_is_empty(option) ? option : {review_count:19};
1561
- let item_list = [];
1607
+ let items = [];
1562
1608
  for(let a=0;a<option.review_count;a++){
1563
- item_list.push(Review_Logic.get_test(option));
1609
+ items.push(Review_Logic.get_test(option));
1564
1610
  }
1565
- return item_list;
1611
+ return items;
1566
1612
  };
1567
1613
  }
1568
1614
  class Admin_Logic {
@@ -1620,34 +1666,34 @@ class Category_Logic {
1620
1666
  option = Field_Logic.get_option(DataType.CATEGORY,option?option:{});
1621
1667
  let category = DataItem.get_new(DataType.CATEGORY,0,Field_Logic.get_test(title,option));
1622
1668
  if(option.get_item){
1623
- category.items = Sub_Item_Logic.get_test_list(category,category,option);
1669
+ category.items = Sub_Item_Logic.get_test_items(category,category,option);
1624
1670
  }
1625
1671
  return category;
1626
1672
  };
1627
- static get_test_list = (option) =>{
1673
+ static get_test_items = (option) =>{
1628
1674
  option = Field_Logic.get_option(DataType.CATEGORY,option);
1629
- let item_list = [];
1675
+ let items = [];
1630
1676
  for(let a=0;a<option.category_count;a++){
1631
- 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));
1632
1678
  }
1633
- return item_list;
1679
+ return items;
1634
1680
  }
1635
- static get_test_list_by_type = (type,option) =>{
1681
+ static get_test_items_by_type = (type,option) =>{
1636
1682
  option = Field_Logic.get_option(DataType.CATEGORY,option);
1637
- let category_list = [];
1683
+ let categorys = [];
1638
1684
  for(let a=0;a<option.category_count;a++){
1639
1685
  let category = DataItem.get_new(DataType.CATEGORY,0,Field_Logic.get_test("Category " +String(parseInt(a+1)),option));
1640
1686
  category.type = type;
1641
- category_list.push(category);
1687
+ categorys.push(category);
1642
1688
  }
1643
- return category_list;
1689
+ return categorys;
1644
1690
  };
1645
- static get_category_drop_down_list_by_list = (cat_list) => {
1646
- let category_list = [];
1647
- for(let a=0;a<cat_list.length;a++){
1648
- 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});
1649
1695
  }
1650
- return category_list;
1696
+ return categorys;
1651
1697
  };
1652
1698
  };
1653
1699
  class Storage {
@@ -1768,13 +1814,13 @@ class User_Logic {
1768
1814
  }
1769
1815
  return user;
1770
1816
  };
1771
- static get_test_list = (option) =>{
1817
+ static get_test_items = (option) =>{
1772
1818
  option = Field_Logic.get_option(DataType.USER,option?option:{});
1773
- let item_list = [];
1819
+ let items = [];
1774
1820
  for(let a=0;a<option.user_count+1;a++){
1775
- 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));
1776
1822
  }
1777
- return item_list;
1823
+ return items;
1778
1824
  }
1779
1825
  }
1780
1826
  class Sub_Item_Logic {
@@ -1794,31 +1840,31 @@ class Sub_Item_Logic {
1794
1840
  }
1795
1841
  );
1796
1842
  if(option.get_value){
1797
- item = Field_Logic.get_value_list(item,option);
1843
+ item = Field_Logic.get_values(item,option);
1798
1844
  }
1799
1845
  return item;
1800
1846
  }
1801
- static get_test_list(parent_item,top_item,option){
1847
+ static get_test_items(parent_item,top_item,option){
1802
1848
  option = Field_Logic.get_option(DataType.SUB_ITEM,option?option:{});
1803
- let new_list = [];
1849
+ let items = [];
1804
1850
  for(let a=0;a<option.item_count;a++){
1805
1851
  let item_title ="Item " + String(parseInt(a+1));
1806
- 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));
1807
1853
  }
1808
- return new_list;
1854
+ return items;
1809
1855
  }
1810
- static get_test_section_list(parent_item,top_item,option){
1811
- let new_list = [];
1856
+ static get_test_sections(parent_item,top_item,option){
1857
+ let items = [];
1812
1858
  for(let a=0;a<option.section_count;a++){
1813
1859
  let item_title ="Section " + String(parseInt(a+1));
1814
1860
  let item = Sub_Item_Logic.get_test(item_title,parent_item,top_item,option);
1815
- new_list.push(item);
1861
+ items.push(item);
1816
1862
  }
1817
- return new_list;
1863
+ return items;
1818
1864
  }
1819
- static bind_parent_child_list(item,item_list){
1820
- for(let a=0;a<item_list.length;a++){
1821
- 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];
1822
1868
  }
1823
1869
  return item;
1824
1870
  }
@@ -1827,7 +1873,7 @@ class App_Logic {
1827
1873
  static get_url = (app_id,host,url,param) => {
1828
1874
  return get_cloud_url_main(app_id,host,url,param);
1829
1875
  };
1830
- static bind_item_parent_user_list = (item,parent_item,user)=>{
1876
+ static bind_item_parent_users = (item,parent_item,user)=>{
1831
1877
  for(const prop in parent_item) {
1832
1878
  item['parent_'+prop] = parent_item[prop];
1833
1879
  }
@@ -1836,11 +1882,11 @@ class App_Logic {
1836
1882
  }
1837
1883
  return item;
1838
1884
  };
1839
- static bind_item_parent_user_list = (item_list)=>{
1840
- for(let item of item_list) {
1885
+ static bind_item_parent_users = (items)=>{
1886
+ for(let item of items) {
1841
1887
  item = App_Logic.bind_item_parent_user_obj(item);
1842
1888
  }
1843
- return item_list;
1889
+ return items;
1844
1890
  };
1845
1891
  static bind_item_parent_user_obj = (item)=>{
1846
1892
  if(!item.user){
@@ -1951,14 +1997,14 @@ class App_Logic {
1951
1997
  }
1952
1998
  return App_Logic.get_search(query.data_type,filter,sort_by,query.page_current,query.page_size);
1953
1999
  }
1954
- 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) =>{
1955
2001
  return{
1956
2002
  option:option?option:{},
1957
2003
  data_type:data_type?data_type:DataType.BLANK,
1958
2004
  item_count:item_count?item_count:0,
1959
2005
  page_count:page_count?page_count:1,
1960
2006
  filter:filter?filter:{},
1961
- data_list:data_list?data_list:[]
2007
+ items:items?items:[]
1962
2008
  }
1963
2009
  }
1964
2010
  }
@@ -2009,7 +2055,7 @@ class Image_Logic {
2009
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;
2010
2056
  return item;
2011
2057
  };
2012
- static get_process_list = (upload_dir,image_filename) =>{
2058
+ static get_process_items = (upload_dir,image_filename) =>{
2013
2059
  upload_dir = upload_dir ? upload_dir : "";
2014
2060
  image_filename = image_filename ? image_filename : "";
2015
2061
  return [
@@ -2087,7 +2133,7 @@ class Url {
2087
2133
  static PING_GET="ping_get";
2088
2134
  static PING_POST="ping_post";
2089
2135
  static POST="main/crud/post";
2090
- static POST_LIST="main/crud/post_list";
2136
+ static POST_ITEMS="main/crud/post_items";
2091
2137
  static SEARCH="main/crud/search";
2092
2138
  static DATABASE_INFO="main/crud/database_info";
2093
2139
  //dashboard
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "10.0.16",
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
- 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} = require('./index');
3
- const {Log,Num,Str} = require('biz9-utility');
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,Obj} = require('biz9-utility');
4
4
  const {Scriptz}= require('biz9-scriptz');
5
5
 
6
6
  /* --- TEST CONFIG START --- */
@@ -37,13 +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
40
 
48
41
  //Log.w('Title',Type.get_title(Type.ORDER_STATUS_NEW));
49
42
  //Log.w('Title 2',Type.get_title(Type.ORDER_STATUS_COMPLETE));