biz9-logic 4.7.15 → 4.8.10

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 +154 -136
  3. package/package.json +1 -1
  4. package/test.js +23 -3
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='4.8.5'
1
+ VERSION='4.9.0'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -35,14 +35,19 @@ class Item_Logic {
35
35
  }
36
36
  let _id=Number.get_id(9999);
37
37
  let item_test = {data_type:data_type,id:id};
38
- item_test.title='title_'+_id;
38
+ item_test.top_id = 0;
39
+ item_test.top_data_type = data_type;
40
+ item_test.setting_visible = "1";
41
+ item_test.parent_id = 0;
42
+ item_test.parent_data_type = data_type;
43
+ item_test.title=data_type +" "+_id;
39
44
  item_test.title_url=Str.get_title_url(item_test.title);
40
45
  item_test.sub_note='sub_note_'+_id;
41
46
  item_test.note='note_'+_id;
42
47
  item_test.category='category_'+_id;
43
48
  item_test.group_id=_id;
44
49
  if(option.get_value){
45
- for(let b=1;b<20;b++){
50
+ for(let b=1;b<10;b++){
46
51
  item_test['value_'+String(b)] = 'value ' + String(b);
47
52
  }
48
53
  }
@@ -81,11 +86,14 @@ class Item_Logic {
81
86
  data_type = DataType.BLANK;
82
87
  }
83
88
  if(option==null){
84
- option = {item_count:9};
89
+ option = {item_count:9,get_value:false};
85
90
  }
86
91
  if(option.item_count==null){
87
92
  option.item_count = 10;
88
93
  }
94
+ if(option.get_value==null){
95
+ option.get_value = false;
96
+ }
89
97
  let new_list = [];
90
98
  for(let a=1;a<option.item_count;a++){
91
99
  new_list.push(DataItem.get_new(data_type,0,Item_Logic.get_test_item(data_type,0,option)));
@@ -93,40 +101,62 @@ class Item_Logic {
93
101
  return new_list;
94
102
  }
95
103
  }
96
-
97
104
  class Template_Logic {
98
- static get_test = () =>{
105
+ static get_test = (title,option) =>{
106
+ if(!option){
107
+ option = {get_value:false,get_item:false};
108
+ }
109
+ if(!option.item_count){
110
+ option.item_count=10;
111
+ }
112
+ if(!option.get_value){
113
+ option.get_value=false;
114
+ }
115
+ if(!option.get_item){
116
+ option.get_item=false;
117
+ }
99
118
  let template = DataItem.get_new_full_item(
100
- DataItem.get_new(DataType.TEMPLATE,Number.get_id()),
101
119
  DataItem.get_new(DataType.TEMPLATE,0),
102
120
  DataItem.get_new(DataType.TEMPLATE,0),
103
- Field.get_test("Primary"));
104
- let template_sub_title_list = ["Header","Navigation","Body","Footer"];
105
- for(let a=0;a<template_sub_title_list.length;a++){
106
- template = Sub_Item.get_test_bind_new_child(Number.get_id(),template_sub_title_list[a],template,template,template);
121
+ DataItem.get_new(DataType.TEMPLATE,0),
122
+ Field_Logic.get_test(title,option));
123
+ if(option.get_item){
124
+ template.items = [];
125
+ let template_sub_title_list = ["Header","Navigation","Body","Footer"];
126
+ for(let a=0;a<template_sub_title_list.length;a++){
127
+ template.items.push(Sub_Item_Logic.get_test(template_sub_title_list[a],template,template,option));
128
+ }
107
129
  }
108
- template = Sub_Item.get_test_bind_item_sub_item(template);
109
130
  return template;
110
131
  };
111
132
  }
112
133
  class Page_Logic {
113
- static get_test = (option) =>{
134
+ static get_test = (title,option) =>{
114
135
  if(!option){
115
- option = {item_count:9,page_count:9,get_value:false,get_item:false,value_count:20};
136
+ option = {get_value:false,get_item:false,get_photo:false,item_count:9,value_count:10};
137
+ }
138
+ if(!option.get_photo){
139
+ option.get_photo=false;
140
+ }
141
+ if(!option.get_value){
142
+ option.get_value=false;
143
+ }
144
+ if(!option.get_item){
145
+ option.get_item=false;
116
146
  }
117
147
  if(!option.item_count){
118
148
  option.item_count=10;
119
149
  }
150
+ if(!option.value_count){
151
+ option.value_count=10;
152
+ }
120
153
  let page = DataItem.get_new_full_item(
121
- DataItem.get_new(DataType.PAGE,Number.get_id()),
122
154
  DataItem.get_new(DataType.PAGE,0),
123
155
  DataItem.get_new(DataType.PAGE,0),
124
- Field.get_test("Page "+ String(Number.get_id()),option));
156
+ DataItem.get_new(DataType.PAGE,0),
157
+ Field_Logic.get_test(title,option));
125
158
  if(option.get_item){
126
- for(let a=0;a<option.item_count;a++){
127
- page=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,page,page,page);
128
- }
129
- page=Sub_Item.get_test_bind_item_sub_item(page);
159
+ page.items = Sub_Item_Logic.get_test_section_list(page,page,option);
130
160
  }
131
161
  return page;
132
162
  };
@@ -140,7 +170,7 @@ class Product_Logic {
140
170
  DataItem.get_new(DataType.PRODUCT,Number.get_id()),
141
171
  DataItem.get_new(DataType.PRODUCT,0),
142
172
  DataItem.get_new(DataType.PRODUCT,0),
143
- Field.get_test("Product "+Number.get_id(),option));
173
+ Field_Logic.get_test("Product "+Number.get_id(),option));
144
174
  product.cost = String(Number.get_id()) + "." + String(Number.get_id());
145
175
  product.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
146
176
  product.type = "Type "+String(Number.get_id());
@@ -148,10 +178,7 @@ class Product_Logic {
148
178
  product.stock = String(Number.get_id(3-1));
149
179
  product.category ="Category " + String(Number.get_id());
150
180
  if(option.get_item){
151
- for(let a=0;a<option.item_count;a++){
152
- product=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,product,product,product);
153
- }
154
- product=Sub_Item.get_test_bind_item_sub_item(product);
181
+ page.items = Sub_Item_Logic.get_test_section_list(product,product,option);
155
182
  }
156
183
  return product;
157
184
  };
@@ -205,8 +232,8 @@ class Service_Logic {
205
232
  DataItem.get_new(DataType.SERVICE,Number.get_id()),
206
233
  DataItem.get_new(DataType.SERVICE,0),
207
234
  DataItem.get_new(DataType.SERVICE,0),
208
- Field.get_test("Service "+ String(Number.get_id()),option));
209
- service = Sub_Item.get_test_bind_new_child(Number.get_id(),"Service "+Number.get_id(),service,service,service);
235
+ Field_Logic.get_test("Service "+ String(Number.get_id()),option));
236
+ service = Sub_Item_Logic.get_test_bind_new_child("Service "+Number.get_id(),service,service,service);
210
237
  service.cost = String(Number.get_id()) + "." + String(Number.get_id());
211
238
  service.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
212
239
  service.type = "Type "+String(Number.get_id());
@@ -214,10 +241,7 @@ class Service_Logic {
214
241
  service.stock = String(Number.get_id(3-1));
215
242
  service.category ="Category " + String(Number.get_id());
216
243
  if(option.get_item){
217
- for(let a=0;a<option.item_count;a++){
218
- service=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,service,service,service);
219
- }
220
- service=Sub_Item.get_test_bind_item_sub_item(service);
244
+ service.items = Sub_Item_Logic.get_test_section_list(service,service,option);
221
245
  }
222
246
  return service;
223
247
  };
@@ -271,8 +295,8 @@ class Event_Logic {
271
295
  DataItem.get_new(DataType.EVENT,Number.get_id()),
272
296
  DataItem.get_new(DataType.EVENT,0),
273
297
  DataItem.get_new(DataType.EVENT,0),
274
- Field.get_test("Event "+ String(Number.get_id()),option));
275
- event = Sub_Item.get_test_bind_new_child(Number.get_id(),"Event "+Number.get_id(),event,event,event);
298
+ Field_Logic.get_test("Event "+ String(Number.get_id()),option));
299
+ event = Sub_Item_Logic.get_test_bind_new_child("Event "+Number.get_id(),event,event,event);
276
300
  event.cost = String(Number.get_id()) + "." + String(Number.get_id());
277
301
  event.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
278
302
  event.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
@@ -283,10 +307,7 @@ class Event_Logic {
283
307
  event.stock = String(Number.get_id(3-1));
284
308
  event.category ="Category " + String(Number.get_id());
285
309
  if(option.get_item){
286
- for(let a=0;a<option.item_count;a++){
287
- event=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,event,event,event);
288
- }
289
- event=Sub_Item.get_test_bind_item_sub_item(event);
310
+ event.items = Sub_Item_Logic.get_test_section_list(event,event,option);
290
311
  }
291
312
  return event;
292
313
  };
@@ -328,7 +349,7 @@ class Event_Logic {
328
349
  return [category_list,event_list]
329
350
  };
330
351
  }
331
- class Field {
352
+ class Field_Logic {
332
353
  static get_test = (title,option) =>{
333
354
  if(!title){
334
355
  title="";
@@ -336,22 +357,24 @@ class Field {
336
357
  if(!option){
337
358
  option={get_value:true,value_count:10};
338
359
  }
360
+ if(!option.get_value){
361
+ option.get_value=false;
362
+ }
363
+ if(!option.value_count){
364
+ option.value_count=10;
365
+ }
339
366
  let item = {
340
367
  date_create:new moment().toISOString(),
341
368
  date_save:new moment().toISOString(),
342
369
  title:title,
343
370
  setting_visible:"1",
344
- photo_data:"images/no_img.jpg",
345
371
  title_url:Str.get_title_url(title),
346
- sub_note : "Sub Note "+String(Number.get_id()),
347
- note : "Note "+String(Number.get_id())
372
+ sub_note:"Sub Note "+String(Number.get_id()),
373
+ note:"Note "+String(Number.get_id())
348
374
  }
349
375
  if(option.get_value){
350
- if(!option.value_count){
351
- option.value_count = 10;
352
- }
353
376
  for(let b = 1;b<parseInt(option.value_count);b++){
354
- item['value_'+String(b)] = 'value ' + String(b);
377
+ item['value_'+String(b)] = title + ' value ' + String(b);
355
378
  }
356
379
  }
357
380
  return item;
@@ -497,14 +520,11 @@ class Blank_Logic {
497
520
  DataItem.get_new(DataType.BLANK,Number.get_id()),
498
521
  DataItem.get_new(DataType.BLANK,0),
499
522
  DataItem.get_new(DataType.BLANK,0),
500
- Field.get_test("Blog Post "+Number.get_id(),option));
523
+ Field_Logic.get_test("Blog Post "+Number.get_id(),option));
501
524
  blank.tag="tag 1,tag 2,tag 3";
502
525
  blank.category ="Category " + String(Number.get_id());
503
526
  if(option.get_item){
504
- for(let a=0;a<option.item_count;a++){
505
- blank=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,blank,blank,blank);
506
- }
507
- blank=Sub_Item.get_test_bind_item_sub_item(blank);
527
+ blank.items = Sub_Item_Logic.get_test_section_list(blank,blank,option);
508
528
  }
509
529
  return blank;
510
530
  };
@@ -546,7 +566,6 @@ class Blank_Logic {
546
566
  return [category_list,blank_list]
547
567
  };
548
568
  }
549
-
550
569
  class Blog_Post_Logic {
551
570
  static get_test = (option) =>{
552
571
  if(!option){
@@ -559,15 +578,12 @@ class Blog_Post_Logic {
559
578
  DataItem.get_new(DataType.BLOG_POST,Number.get_id()),
560
579
  DataItem.get_new(DataType.BLOG_POST,0),
561
580
  DataItem.get_new(DataType.BLOG_POST,0),
562
- Field.get_test("Blog Post "+Number.get_id(),option));
581
+ Field_Logic.get_test("Blog Post "+Number.get_id(),option));
563
582
  blog_post.author="First Name "+ Number.get_id();
564
583
  blog_post.tag="tag 1,tag 2,tag 3";
565
584
  blog_post.category ="Category " + String(Number.get_id());
566
585
  if(option.get_item){
567
- for(let a=0;a<option.item_count;a++){
568
- blog_post=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,blog_post,blog_post,blog_post);
569
- }
570
- blog_post=Sub_Item.get_test_bind_item_sub_item(blog_post);
586
+ blog_post.items = Sub_Item_Logic.get_test_section_list(blog_post,blog_post,option);
571
587
  }
572
588
  return blog_post;
573
589
  };
@@ -615,7 +631,7 @@ class Faq_Logic {
615
631
  DataItem.get_new(DataType.FAQ,Number.get_id()),
616
632
  DataItem.get_new(DataType.FAQ,0),
617
633
  DataItem.get_new(DataType.FAQ,0),
618
- Field.get_test("Faq "+Number.get_id(),{get_value:false}));
634
+ Field_Logic.get_test("Faq "+Number.get_id(),{get_value:false}));
619
635
  faq.question="What Is Title " + Number.get_id();
620
636
  faq.answer="My comment "+ Number.get_id() + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
621
637
  return faq;
@@ -639,7 +655,7 @@ class Review_Logic {
639
655
  DataItem.get_new(DataType.REVIEW,Number.get_id()),
640
656
  DataItem.get_new(DataType.REVIEW,0),
641
657
  DataItem.get_new(DataType.REVIEW,0),
642
- Field.get_test("Review "+Number.get_id(),{get_value:false}));
658
+ Field_Logic.get_test("Review "+Number.get_id(),{get_value:false}));
643
659
  review.email="ceo@biz"+String(Number.get_id())+".com";
644
660
  review.first_name="First Name "+ Number.get_id();
645
661
  review.last_name="Last Name "+ Number.get_id();
@@ -692,7 +708,7 @@ class Business_Logic {
692
708
  DataItem.get_new(DataType.BUSINESS,Number.get_id()),
693
709
  DataItem.get_new(DataType.BUSINESS,0),
694
710
  DataItem.get_new(DataType.BUSINESS,0),
695
- Field.get_test("Title "+Number.get_id()));
711
+ Field_Logic.get_test("Title "+Number.get_id()));
696
712
  item.email="ceo@business.com";
697
713
  item.phone="123-456-"+Number.get_id(3333);
698
714
  item.address_1=Number.get_id(99)+" Apple St.";
@@ -911,19 +927,19 @@ class Team_Url {
911
927
  }
912
928
  class Url{
913
929
  static copy_item = (biz9_config,data_type,id) => {
914
- let action_url= "main/crud/copy/"+data_type + "/" + id;
930
+ let action_url = "main/crud/copy/"+data_type + "/" + id;
915
931
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
916
932
  };
917
933
  static delete_item = (biz9_config,data_type,id) => {
918
- let action_url= "main/crud/delete/"+data_type + "/" + id;
934
+ let action_url = "main/crud/delete/"+data_type + "/" + id;
919
935
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
920
936
  };
921
937
  static delete_item_check_protection = (biz9_config,data_type,id) => {
922
- let action_url= "main/crud/delete_item_check_protection/"+data_type + "/" + id;
938
+ let action_url = "main/crud/delete_item_check_protection/"+data_type + "/" + id;
923
939
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
924
940
  };
925
941
  static delete_list = (biz9_config,data_type) => {
926
- let action_url= "main/crud/delete_list/"+data_type;
942
+ let action_url = "main/crud/delete_list/"+data_type;
927
943
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
928
944
  };
929
945
  static get = (biz9_config,action_url,params) => {
@@ -933,28 +949,28 @@ class Url{
933
949
  let action_url= "main/crud/get/"+data_type + "/" + key;
934
950
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
935
951
  };
936
- static get_item_parent_top = (biz9_config,data_type,key) => {
937
- let action_url= "main/crud/get_item_parent_top/"+data_type + "/" + key;
952
+ static get_item_parent_top = (biz9_config,data_type,key,parent_data_type,parent_id,top_data_type,top_id) => {
953
+ let action_url = "main/crud/get_item_parent_top/"+data_type+"/"+key+"/"+parent_data_type+ "/"+parent_id+"/"+top_data_type+ "/"+top_id;
938
954
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
939
955
  };
940
956
  static get_list = (biz9_config,data_type) => {
941
- let action_url= "main/crud/get_list/"+data_type;
957
+ let action_url = "main/crud/get_list/"+data_type;
942
958
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
943
959
  };
944
960
  static upload_file = (biz9_config,data_type,id) => {
945
- let action_url= "main/crud/update/"+data_type + "/" + id;
961
+ let action_url = "main/crud/update/"+data_type + "/" + id;
946
962
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
947
963
  };
948
964
  static update_item = (biz9_config,data_type,id) => {
949
- let action_url= "main/crud/update/"+data_type + "/" + id;
965
+ let action_url = "main/crud/update/"+data_type + "/" + id;
950
966
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
951
967
  };
952
968
  static update_item_delete_cache = (biz9_config,data_type,id) => {
953
- let action_url= "main/crud/update_item_delete_cache/"+data_type + "/" + id;
969
+ let action_url = "main/crud/update_item_delete_cache/"+data_type + "/" + id;
954
970
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
955
971
  };
956
972
  static update_list = (biz9_config,data_type) => {
957
- let action_url= "main/crud/update_list/"+data_type;
973
+ let action_url = "main/crud/update_list/"+data_type;
958
974
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
959
975
  };
960
976
  }
@@ -972,7 +988,7 @@ class Category_Logic {
972
988
  DataItem.get_new(DataType.CATEGORY,Number.get_id()),
973
989
  DataItem.get_new(DataType.CATEGORY,0),
974
990
  DataItem.get_new(DataType.CATEGORY,0),
975
- Field.get_test("Category " +Number.get_id()));
991
+ Field_Logic.get_test("Category " +Number.get_id()));
976
992
  category.type = Category_Logic.get_category_list()[Number.get_id(Category_Logic.get_category_list().length-1)].data_type;
977
993
  return category;
978
994
  }
@@ -993,7 +1009,7 @@ class Category_Logic {
993
1009
  DataItem.get_new(DataType.CATEGORY,"Category "+Number.get_id()),
994
1010
  DataItem.get_new(DataType.CATEGORY,0),
995
1011
  DataItem.get_new(DataType.CATEGORY,0),
996
- Field.get_test("Category " +Number.get_id(),{get_value:false}));
1012
+ Field_Logic.get_test("Category " +Number.get_id(),{get_value:false}));
997
1013
  category.type = type
998
1014
  category_list.push(category);
999
1015
  }
@@ -1295,73 +1311,75 @@ class Storage {
1295
1311
  window.localStorage.clear();
1296
1312
  }
1297
1313
  }
1298
- class Sub_Item {
1299
- static get_bind_new_child = (id,title,item,parent_item,top_item,options) =>{
1300
- let new_sub_item = DataItem.get_new_full_item(
1301
- DataItem.get_new(DataType.ITEM,id),
1302
- DataItem.get_new(parent_item.data_type,parent_item.id),
1303
- DataItem.get_new(top_item.data_type,top_item.id)
1304
- );
1305
- new_sub_item.title = title;
1306
- if(options){
1307
- for (const key in options) {
1308
- item[key] = options[key];
1309
- }
1310
- }
1311
- if(!item.items){
1312
- item.items = [];
1314
+ class Sub_Item_Logic {
1315
+ static get_test(title,parent_item,top_item,option){
1316
+ if(option==null){
1317
+ option={get_value:true,value_count:10};
1313
1318
  }
1314
- item[Str.get_title_url(title)] = new_sub_item;
1315
- item.items.push(new_sub_item);
1316
- return item;
1317
- };
1318
- static get_test_bind_item_sub_item = (item) =>{
1319
- for(let b=0;b<item.items.length;b++){
1320
- for(let c=0;c<20;c++){
1321
- item.items[b]=Sub_Item.get_test_bind_new_child(Number.get_id(),'Section '+String(c),item.items[b],item,item);
1322
- for(let d=0;d<item.items[b].items.length;d++){
1323
- item.items[b].items[d]=Sub_Item.get_test_bind_new_child(Number.get_id(),'Section '+String(d),item.items[b].items[d],item.items[b],item);
1324
- }
1319
+ if(option.get_value==null){
1320
+ option.get_value = true;
1321
+ }
1322
+ if(option.value_count==null){
1323
+ option.value_count = 10;
1324
+ }
1325
+ let item_title =title;
1326
+ let item = DataItem.get_new(
1327
+ DataType.ITEM,0, {
1328
+ top_id:top_item.id,
1329
+ top_data_type:top_item.data_type,
1330
+ parent_id:parent_item.id,
1331
+ parent_data_type:parent_item.data_type,
1332
+ title:item_title,
1333
+ title_url:Str.get_title_url(item_title),
1334
+ sub_note:"Sub Note "+String(Number.get_id()),
1335
+ note:"Note "+String(Number.get_id()),
1336
+ }
1337
+ );
1338
+ if(option.get_value){
1339
+ for(let b=1;b<option.value_count;b++){
1340
+ item['value_'+String(b)] = item_title+ ' value ' + String(b);
1325
1341
  }
1326
1342
  }
1327
1343
  return item;
1328
1344
  }
1329
- static get_test_bind_new_child = (id,title,item,parent_item,top_item,options) =>{
1330
- let new_sub_item = DataItem.get_new_full_item(
1331
- DataItem.get_new(DataType.ITEM,id),
1332
- DataItem.get_new(parent_item.data_type,parent_item.id),
1333
- DataItem.get_new(top_item.data_type,top_item.id),
1334
- get_bind_test_field(title)
1335
- )
1336
- new_sub_item.title = title;
1337
- if(options){
1338
- for (const key in options) {
1339
- item[key] = options[key];
1340
- }
1345
+
1346
+ static get_test_section_list(parent_item,top_item,option){
1347
+ let new_list = [];
1348
+ if(option==null){
1349
+ option={item_count:10,get_value:true,value_count:10};
1341
1350
  }
1342
- if(!item.items){
1343
- item.items = [];
1351
+ if(option.item_count==null){
1352
+ option.item_count = 10;
1344
1353
  }
1345
- item[Str.get_title_url(title)] = new_sub_item;
1346
- item.items.push(new_sub_item);
1347
- return item;
1348
- function get_bind_test_field(title){
1349
- let item = {
1350
- date_create:new moment().toISOString(),
1351
- date_save:new moment().toISOString(),
1352
- title:title,
1353
- setting_visible:"1",
1354
- photo_data:"images/no_img.jpg",
1355
- title_url:Str.get_title_url(title),
1356
- sub_note : "Sub Note "+String(Number.get_id()),
1357
- note : "Note "+String(Number.get_id())
1358
- }
1359
- for(let b = 1;b<20;b++){
1360
- item['value_'+String(b)] = title+ ' value ' + String(b);
1354
+ if(option.get_value==null){
1355
+ option.get_value = true;
1356
+ }
1357
+ if(option.value_count==null){
1358
+ option.value_count = 10;
1359
+ }
1360
+ for(let a=1;a<option.item_count;a++){
1361
+ let item_title ="Section " + String(a);
1362
+ let sub_item = DataItem.get_new(
1363
+ DataType.ITEM,0, {
1364
+ top_id:top_item.id,
1365
+ top_data_type:top_item.data_type,
1366
+ parent_id:parent_item.id,
1367
+ parent_data_type:parent_item.data_type,
1368
+ title:item_title,
1369
+ title_url:Str.get_title_url(item_title),
1370
+ sub_note:"Sub Note "+String(Number.get_id()),
1371
+ note:"Note "+String(Number.get_id()),
1372
+ }
1373
+ );
1374
+ if(option.get_value){
1375
+ for(let b=1;b<option.value_count;b++){
1376
+ sub_item['value_'+String(b)] = 'Section '+ String(a) + ' value ' + String(b);
1377
+ }
1361
1378
  }
1362
- return item;
1363
- };
1364
- };
1379
+ new_list.push(sub_item);
1380
+ }
1381
+ return new_list;
1382
+ }
1365
1383
  }
1366
1384
  module.exports = {
1367
1385
  Business_Logic,
@@ -1377,12 +1395,12 @@ module.exports = {
1377
1395
  DataItem,
1378
1396
  DataType,
1379
1397
  Event_Url,
1380
- Field,
1398
+ Field_Logic,
1381
1399
  FieldType,
1382
1400
  Faq_Logic,
1383
1401
  Gallery_Url,
1384
- Event_Logic,
1385
1402
  Item_Logic,
1403
+ Event_Logic,
1386
1404
  Message,
1387
1405
  Obj,
1388
1406
  Page_Logic,
@@ -1390,14 +1408,14 @@ module.exports = {
1390
1408
  PageType,
1391
1409
  Product_Logic,
1392
1410
  Review_Logic,
1393
- TemplateType,
1394
- Template_Logic,
1395
- Url,
1396
1411
  Service_Logic,
1397
1412
  Service_Url,
1398
1413
  Social,
1399
- Sub_Item,
1414
+ Sub_Item_Logic,
1400
1415
  Storage,
1401
1416
  Schedule,
1402
1417
  Stock,
1418
+ TemplateType,
1419
+ Template_Logic,
1420
+ Url,
1403
1421
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.7.15",
3
+ "version": "4.8.10",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -45,11 +45,31 @@ describe("connect", () => {
45
45
  */
46
46
 
47
47
  function(call) {
48
+ /* --ITEM-PARENT-TOP-URL-TEST--START */
49
+ let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
50
+ let cloud_url = Url.get_item_parent_top(biz9_config,DataType.SERVICE,0,DataType.BLOG_POST,1,DataType.PRODUCT,2);
51
+ console.log(cloud_url);
52
+ //let item_test_list = Item_Logic.get_test_item_list(DataType.BLANK,{item_count:10,get_value:true});
53
+ //Log.w('item_test_list',item_test_list);
54
+ /* --ITEM-PARENT-TOP-TEST-URL-START */
48
55
 
49
- //let item_test = Item_Logic.get_test_item(DataType.SERVICE,0);
50
- let item_test_list = Item_Logic.get_test_item_list(DataType.BLANK,{item_count:10,get_value:true});
51
56
 
52
- Log.w('item_test_list',item_test_list);
57
+ /* --PAGE--START */
58
+ /*
59
+ let page = Page.get_test({item_count:2,page_count:2,get_value:true,get_item:true,value_count:50})
60
+ Log.w("Page",page);
61
+ let page = Page.get_test({item_count:9,page_count:19,get_item:true,get_value:true})
62
+ //let page = Page.get_test()
63
+ Log.w("Page_section_1",page.section_1);
64
+ Log.w("Page_section_1_section_1_section_1",page.section_1.section_1.section_1);
65
+ */
66
+ /* --PAGE--END */
67
+
68
+ /* --ITEM-TEST--START */
69
+ //let item_test = Item_Logic.get_test_item(DataType.SERVICE,0);
70
+ //let item_test_list = Item_Logic.get_test_item_list(DataType.BLANK,{item_count:10,get_value:true});
71
+ //Log.w('item_test_list',item_test_list);
72
+ /* --ITEM-TEST--END */
53
73
 
54
74
  //console.log('CONNECT-START');
55
75
  /* --BLANK--START */