biz9-logic 4.8.32 → 4.8.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/biz9_config +1 -1
- package/index.js +104 -173
- package/package.json +2 -2
- package/test.js +19 -5
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Description: BiZ9 Framework: Logic-JS
|
|
|
6
6
|
*/
|
|
7
7
|
const moment = require('moment');
|
|
8
8
|
const { get_new_item_main,get_data_config_main,get_cloud_url_main,get_biz_item_main,get_cloud_filter_obj_main,get_new_full_item_main } = require('./main');
|
|
9
|
-
const { Log,Str,DateTime,Number } = require('biz9-utility');
|
|
9
|
+
const { Log,Str,DateTime,Number,Obj } = require('/home/think2/www/doqbox/biz9-framework/biz9-utility/code');
|
|
10
10
|
class Message {
|
|
11
11
|
static SUCCESS="Update Success";
|
|
12
12
|
static LOGIN_GOOD="Login Success";
|
|
@@ -21,12 +21,8 @@ class TemplateType {
|
|
|
21
21
|
}
|
|
22
22
|
class Item_Logic {
|
|
23
23
|
static get_test = (title,data_type,id,option)=>{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
if(!id){
|
|
28
|
-
id=0;
|
|
29
|
-
}
|
|
24
|
+
data_type = data_type ? data_type : DataType.BLANK;
|
|
25
|
+
id = id ? id : 0;
|
|
30
26
|
option = Field_Logic.get_option(data_type,option?option:{});
|
|
31
27
|
let item = DataItem.get_new_full_item(
|
|
32
28
|
DataItem.get_new(data_type,0),
|
|
@@ -47,6 +43,9 @@ class Item_Logic {
|
|
|
47
43
|
}
|
|
48
44
|
return item_list;
|
|
49
45
|
}
|
|
46
|
+
static get_search = (data_type,filter,sort_by,page_current,page_size) => {
|
|
47
|
+
return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
|
|
48
|
+
}
|
|
50
49
|
}
|
|
51
50
|
class Template_Logic {
|
|
52
51
|
static get_test = (title,option) =>{
|
|
@@ -141,11 +140,21 @@ class Product_Logic {
|
|
|
141
140
|
DataItem.get_new(DataType.PRODUCT,0),
|
|
142
141
|
DataItem.get_new(DataType.PRODUCT,0),
|
|
143
142
|
Field_Logic.get_test(title,option));
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
|
|
144
|
+
if(option.get_blank ==false){
|
|
145
|
+
product.cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
|
|
146
|
+
product.old_cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
|
|
147
|
+
product.type = "Type "+String(Number.get_id());
|
|
148
|
+
product.sub_type = "Sub Type "+String(Number.get_id());
|
|
149
|
+
product.stock = String(Number.get_id(3-1));
|
|
150
|
+
}else{
|
|
151
|
+
product.cost = "";
|
|
152
|
+
product.old_cost = "";
|
|
153
|
+
product.type = "";
|
|
154
|
+
product.sub_type = "";
|
|
155
|
+
product.stock = "";
|
|
156
|
+
}
|
|
157
|
+
|
|
149
158
|
if(option.get_item){
|
|
150
159
|
product.items = Sub_Item_Logic.get_test_item_list(product,product,option);
|
|
151
160
|
}
|
|
@@ -183,8 +192,8 @@ class Service_Logic {
|
|
|
183
192
|
DataItem.get_new(DataType.SERVICE,0),
|
|
184
193
|
DataItem.get_new(DataType.SERVICE,0),
|
|
185
194
|
Field_Logic.get_test(title,option));
|
|
186
|
-
service.cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
187
|
-
service.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
195
|
+
service.cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
|
|
196
|
+
service.old_cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
|
|
188
197
|
service.type = "Type "+String(Number.get_id());
|
|
189
198
|
service.sub_type = "Sub Type "+String(Number.get_id());
|
|
190
199
|
service.stock = String(Number.get_id(3-1));
|
|
@@ -274,7 +283,7 @@ class Blog_Post_Logic {
|
|
|
274
283
|
option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
|
|
275
284
|
let item_list = [];
|
|
276
285
|
for(let a=0;a<option.blog_post_count;a++){
|
|
277
|
-
item_list.push(Blog_Post_Logic.get_test("
|
|
286
|
+
item_list.push(Blog_Post_Logic.get_test("Blog Post " +String(parseInt(a+1)),option));
|
|
278
287
|
}
|
|
279
288
|
return item_list;
|
|
280
289
|
}
|
|
@@ -286,7 +295,7 @@ class Blog_Post_Logic {
|
|
|
286
295
|
for(let a=0;a<category_list.length;a++){
|
|
287
296
|
for(let b=0;b<option.blog_post_count;b++){
|
|
288
297
|
item_count++;
|
|
289
|
-
let blog_post = Blog_Post_Logic.get_test("
|
|
298
|
+
let blog_post = Blog_Post_Logic.get_test("Blog Post "+String(parseInt(b+1)),option);
|
|
290
299
|
blog_post.category = category_list[Number.get_id(category_list.length+1)].title;
|
|
291
300
|
blog_post_list.push(blog_post);
|
|
292
301
|
}
|
|
@@ -302,8 +311,8 @@ class Event_Logic {
|
|
|
302
311
|
DataItem.get_new(DataType.EVENT,0),
|
|
303
312
|
DataItem.get_new(DataType.EVENT,0),
|
|
304
313
|
Field_Logic.get_test(title,option));
|
|
305
|
-
event.cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
306
|
-
event.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
314
|
+
event.cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
|
|
315
|
+
event.old_cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
|
|
307
316
|
event.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
|
|
308
317
|
event.time = String(Number.get_id(24)) + ":" + String(Number.get_id(59));
|
|
309
318
|
event.website = "Website "+String(Number.get_id());
|
|
@@ -344,12 +353,8 @@ class Field_Logic {
|
|
|
344
353
|
static get_test = (title,option) =>{
|
|
345
354
|
let sub_note = "Sub Note "+String(Number.get_id());
|
|
346
355
|
let note = "Note "+String(Number.get_id());
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
if(!option.category_title){
|
|
351
|
-
option.category_title = 'Category '+String(Number.get_id());
|
|
352
|
-
}
|
|
356
|
+
option = option ? option : {};
|
|
357
|
+
option.category_title = !Str.check_is_null(option.category_title) ? option.category_title : 'Category '+String(Number.get_id());
|
|
353
358
|
if(option.get_blank == true){
|
|
354
359
|
title = "";
|
|
355
360
|
sub_note = "";
|
|
@@ -384,113 +389,83 @@ class Field_Logic {
|
|
|
384
389
|
return item;
|
|
385
390
|
};
|
|
386
391
|
static get_option_admin(req){
|
|
387
|
-
|
|
388
|
-
option.
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
392
|
+
let option = {};
|
|
393
|
+
option.value_count = req.query.value_count ? req.query.value_count : 19;
|
|
394
|
+
option.section_count = req.query.section_count ? req.query.section_count : 19;
|
|
395
|
+
option.question_count = req.query.question_count ? req.query.question_count : 19;
|
|
396
|
+
|
|
397
|
+
option.get_blog_post = req.query.get_blog_post ? req.query.get_blog_post : false;
|
|
398
|
+
option.get_category_blog_post = req.query.get_category_blog_post ? req.query.get_category_blog_post : false;
|
|
399
|
+
option.category_blog_post_count = req.query.category_blog_post_count ? req.query.category_blog_post_count : 9;
|
|
400
|
+
option.blog_post_count = req.query.blog_post_count ? req.query.blog_post_count : 9;
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
option.get_product = req.query.get_product ? req.query.get_product : false;
|
|
404
|
+
option.get_category_product = req.query.get_category_product ? req.query.get_category_product : false;
|
|
405
|
+
option.category_product_count = req.query.category_product_count ? req.query.category_product_count : 9;
|
|
406
|
+
option.product_count = req.query.product_count ? req.query.product_count : 19;
|
|
407
|
+
|
|
408
|
+
option.get_service = req.query.get_service ? req.query.get_service : false;
|
|
409
|
+
option.get_category_service = req.query.get_category_service ? req.query.get_category_service : false;
|
|
410
|
+
option.category_service_count = req.query.category_service_count ? req.query.category_service_count : 9;
|
|
411
|
+
option.service_count = req.query.service_count ? req.query.service_count : 19;
|
|
412
|
+
|
|
413
|
+
option.get_event = req.query.get_event ? req.query.get_event : false;
|
|
414
|
+
option.get_category_event = req.query.get_category_event ? req.query.get_category_event : false;
|
|
415
|
+
option.category_event_count = req.query.category_event_count ? req.query.category_event_count : 9;
|
|
416
|
+
option.event_count = req.query.event_count ? req.query.event_count : 19;
|
|
417
|
+
|
|
418
|
+
option.get_admin = req.query.get_admin ? req.query.get_admin : false;
|
|
419
|
+
option.get_business = req.query.get_business ? req.query.get_business : false;
|
|
420
|
+
option.get_faq = req.query.get_faq ? req.query.get_faq : false;
|
|
421
|
+
option.get_template = req.query.get_template ? req.query.get_template : false;
|
|
422
|
+
option.get_page = req.query.get_page ? req.query.get_page : false;
|
|
423
|
+
option.get_team = req.query.get_team ? req.query.get_team : false;
|
|
396
424
|
|
|
397
|
-
option.get_admin = req.query.get_admin?String(req.query.get_admin)=='true': false;
|
|
398
|
-
option.get_business = req.query.get_business?String(req.query.get_business)=='true': false;
|
|
399
|
-
option.get_blog_post = req.query.get_blog_post?String(req.query.get_blog_post)=='true': false;
|
|
400
|
-
option.get_event = req.query.get_event?String(req.query.get_event)=='true': false;
|
|
401
|
-
option.get_faq = req.query.get_faq?String(req.query.get_faq)=='true': false;
|
|
402
|
-
option.get_template = req.query.get_template?String(req.query.get_template)=='true': false;
|
|
403
|
-
option.get_page = req.query.get_page?String(req.query.get_page)=='true': false;
|
|
404
|
-
option.get_product = req.query.get_product?String(req.query.get_product)=='true': false;
|
|
405
|
-
option.get_service = req.query.get_service?String(req.query.get_service)=='true': false;
|
|
406
|
-
option.get_team = req.query.get_team?String(req.query.get_team)=='true': false;
|
|
407
425
|
return option;
|
|
408
426
|
}
|
|
409
427
|
static get_option(data_type,option){
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
422
|
-
if(!option.value_count){
|
|
423
|
-
option.value_count=9;
|
|
424
|
-
}
|
|
425
|
-
if(!option.section_count){
|
|
426
|
-
option.section_count=9;
|
|
427
|
-
}
|
|
428
|
-
if(!option.get_item){
|
|
429
|
-
option.get_item=false;
|
|
430
|
-
}
|
|
431
|
-
if(!option.item_count){
|
|
432
|
-
option.item_count=9;
|
|
433
|
-
}
|
|
434
|
-
if(!option.category_count){
|
|
435
|
-
option.category_count=9;
|
|
436
|
-
}
|
|
437
|
-
if(!option.category_title){
|
|
438
|
-
option.category_title=null;
|
|
439
|
-
}
|
|
440
|
-
if(!option.get_blank){
|
|
441
|
-
option.get_blank=false;
|
|
442
|
-
}
|
|
428
|
+
data_type = data_type ? data_type : DataType.BLANK;
|
|
429
|
+
option = !Obj.check_is_empty(option) ? option : {get_value:false,get_item:false,get_photo:false,item_count:9,value_count:9};
|
|
430
|
+
option.get_photo = option.get_photo ? true : false;
|
|
431
|
+
option.get_value = option.get_value ? true : false;
|
|
432
|
+
option.get_item = option.get_item ? true : false;
|
|
433
|
+
option.get_blank = option.get_blank ? true : false;
|
|
434
|
+
option.value_count = option.value_count ? option.value_count : 19;
|
|
435
|
+
option.section_count = option.section_count ? option.section_count : 19;
|
|
436
|
+
option.item_count = option.item_count ? option.item_count : 9;
|
|
437
|
+
option.category_count = option.category_count ? option.category_count : 9;
|
|
438
|
+
option.category_title = option.category_title ? option.category_title : "";
|
|
443
439
|
if(option.data_type==DataType.PAGE){
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
if(!option.section_count){
|
|
448
|
-
option.section_count=9;
|
|
449
|
-
}
|
|
450
|
-
if(!option.get_section){
|
|
451
|
-
option.get_section=false;
|
|
452
|
-
}
|
|
440
|
+
option.page_count = option.page_count ? option.page_count : 9;
|
|
441
|
+
option.section_count = option.section_count ? option.section_count : 9;
|
|
442
|
+
option.get_section = option.get_section ? true : false;
|
|
453
443
|
}
|
|
454
444
|
if(option.data_type==DataType.PRODUCT){
|
|
455
|
-
|
|
456
|
-
option.product_count=9;
|
|
457
|
-
}
|
|
445
|
+
option.product_count = option.product_count ? option.product_count : 9;
|
|
458
446
|
}
|
|
459
447
|
if(data_type==DataType.SERVICE){
|
|
460
|
-
|
|
461
|
-
option.service_count=9;
|
|
462
|
-
}
|
|
448
|
+
option.service_count = option.service_count ? option.service_count : 9;
|
|
463
449
|
}
|
|
464
450
|
if(data_type==DataType.BLOG_POST){
|
|
465
|
-
|
|
466
|
-
option.blog_post_count=9;
|
|
467
|
-
}
|
|
451
|
+
option.blog_post_count = option.blog_post_count ? option.blog_post_count : 9;
|
|
468
452
|
}
|
|
469
453
|
if(data_type==DataType.EVENT){
|
|
470
|
-
|
|
471
|
-
option.event_count=9;
|
|
472
|
-
}
|
|
454
|
+
option.event_count = option.event_count ? option.event_count : 9;
|
|
473
455
|
}
|
|
474
456
|
if(data_type==DataType.TEAM){
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
if(!option.member_count){
|
|
479
|
-
option.member_count=9;
|
|
480
|
-
}
|
|
457
|
+
option.get_member = option.get_member ? true : false;
|
|
458
|
+
option.member_count = option.member_count ? option.member_count : 9;
|
|
481
459
|
}
|
|
482
460
|
if(data_type==DataType.FAQ){
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
}
|
|
486
|
-
if(!option.question_count){
|
|
487
|
-
option.question_count=9;
|
|
488
|
-
}
|
|
461
|
+
option.get_question = option.get_question ? true : false;
|
|
462
|
+
option.question_count = option.question_count ? option.question_count : 9;
|
|
489
463
|
}
|
|
490
464
|
if(data_type==DataType.CONTENT){
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
465
|
+
option.content_count = option.content_count ? option.content_count : 9;
|
|
466
|
+
}
|
|
467
|
+
if(data_type==DataType.SUB_ITEM){
|
|
468
|
+
option.item_count = option.item_count ? option.item_count : 9;
|
|
494
469
|
}
|
|
495
470
|
return option;
|
|
496
471
|
}
|
|
@@ -618,11 +593,7 @@ class PageType {
|
|
|
618
593
|
}
|
|
619
594
|
class DataType {
|
|
620
595
|
static get_title = (data_type) => {
|
|
621
|
-
|
|
622
|
-
return "";
|
|
623
|
-
}else{
|
|
624
|
-
return String(Str.get_title(data_type.replaceAll('_',' ').replaceAll('dt','').replace('biz',''))).trim();
|
|
625
|
-
}
|
|
596
|
+
return (!data_type) ? "" : String(Str.get_title(data_type.replaceAll('_',' ').replaceAll('dt','').replace('biz',''))).trim();
|
|
626
597
|
}
|
|
627
598
|
static get_item_list = () =>{
|
|
628
599
|
return [
|
|
@@ -737,16 +708,13 @@ class Review_Logic {
|
|
|
737
708
|
review.email="ceo@biz"+String(Number.get_id())+".com";
|
|
738
709
|
review.first_name="First Name "+ Number.get_id();
|
|
739
710
|
review.last_name="Last Name "+ Number.get_id();
|
|
711
|
+
review.hometown="Hometown "+ Number.get_id();
|
|
740
712
|
review.position="Position "+ Number.get_id();
|
|
741
713
|
review.comment="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.";
|
|
742
|
-
review.city=city_list[Number.get_id(city_list.length-1)];
|
|
743
|
-
review.state=state_list[Number.get_id(state_list.length-1)];
|
|
744
714
|
return review;
|
|
745
715
|
};
|
|
746
716
|
static get_test_list=(option)=>{
|
|
747
|
-
|
|
748
|
-
option = {review_count:19};
|
|
749
|
-
}
|
|
717
|
+
option = !Obj.check_is_empty(option) ? option : {review_count:19};
|
|
750
718
|
let item_list = [];
|
|
751
719
|
for(let a=0;a<option.review_count;a++){
|
|
752
720
|
item_list.push(Review_Logic.get_test());
|
|
@@ -756,9 +724,7 @@ class Review_Logic {
|
|
|
756
724
|
}
|
|
757
725
|
class Business_Logic {
|
|
758
726
|
static get_new = (title) =>{
|
|
759
|
-
|
|
760
|
-
title="Business "+Number.get_id();
|
|
761
|
-
}
|
|
727
|
+
title=(title) ? title : "Business "+Number.get_id();
|
|
762
728
|
return DataItem.get_new_full_item(
|
|
763
729
|
DataItem.get_new(DataType.BUSINESS,0),
|
|
764
730
|
DataItem.get_new(DataType.BUSINESS,0),
|
|
@@ -780,7 +746,6 @@ class Business_Logic {
|
|
|
780
746
|
};
|
|
781
747
|
static get_test = (title,option) =>{
|
|
782
748
|
option = Field_Logic.get_option(DataType.BUSINESS,option?option:{});
|
|
783
|
-
Log.w('option',option);
|
|
784
749
|
let item = DataItem.get_new(DataType.BUSINESS,0);
|
|
785
750
|
let city_list = ["Miami","Atlanta","Chicago","Seattle","New York City"];
|
|
786
751
|
let state_list = ["Georgia","New York","Illinois","Washington","Flordia"];
|
|
@@ -804,18 +769,11 @@ class Business_Logic {
|
|
|
804
769
|
return item;
|
|
805
770
|
};
|
|
806
771
|
static get_full_address(business){
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
}
|
|
813
|
-
if(!business.city){
|
|
814
|
-
business.city = "";
|
|
815
|
-
}
|
|
816
|
-
if(!business.state){
|
|
817
|
-
business.state = "";
|
|
818
|
-
}
|
|
772
|
+
business.address_1 = (business.address_1) ? business.address_1 : "";
|
|
773
|
+
business.address_2 = (business.address_2) ? business.address_2 : "";
|
|
774
|
+
business.city = (business.city) ? business.city : "";
|
|
775
|
+
business.state = (business.state) ? business.state : "";
|
|
776
|
+
business.zip = (business.zip) ? business.zip : "";
|
|
819
777
|
return business.address_1 + " "+ business.address_2 + " " + business.city + " " + business.state + " " + business.zip;
|
|
820
778
|
}
|
|
821
779
|
}
|
|
@@ -1058,17 +1016,9 @@ class Url{
|
|
|
1058
1016
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
|
|
1059
1017
|
};
|
|
1060
1018
|
}
|
|
1061
|
-
class Obj {
|
|
1062
|
-
static get_search = (data_type,filter,sort_by,page_current,page_size) => {
|
|
1063
|
-
return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
|
|
1064
|
-
}
|
|
1065
|
-
};
|
|
1066
1019
|
class Category_Logic {
|
|
1067
1020
|
static get_test = (title,option) =>{
|
|
1068
|
-
|
|
1069
|
-
title="Category 1";
|
|
1070
|
-
option={};
|
|
1071
|
-
}
|
|
1021
|
+
title = (title) ? title : "Category 1";
|
|
1072
1022
|
option = Field_Logic.get_option(DataType.CATEGORY,option?option:{});
|
|
1073
1023
|
let category = DataItem.get_new_full_item(
|
|
1074
1024
|
DataItem.get_new(DataType.CATEGORY,0),
|
|
@@ -1353,12 +1303,8 @@ class Stock {
|
|
|
1353
1303
|
}
|
|
1354
1304
|
class Schedule {
|
|
1355
1305
|
static get_start_date_time = (item) => {
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
}
|
|
1359
|
-
if(!item.time){
|
|
1360
|
-
item.time = new Date();
|
|
1361
|
-
}
|
|
1306
|
+
item.date = (item.date) ? item.date : new Date();
|
|
1307
|
+
item.time = (item.time) ? item.time : new Date();
|
|
1362
1308
|
item.start_date = DateTime.get_full_date_by_date_time(item.date,item.time);
|
|
1363
1309
|
item.start_time = DateTime.get_full_time_by_date_time(item.date,item.time);
|
|
1364
1310
|
item.start_date_time = DateTime.get_full_date_time_by_date_time(item.date,item.time);
|
|
@@ -1366,12 +1312,8 @@ class Schedule {
|
|
|
1366
1312
|
}
|
|
1367
1313
|
static get_start_date_time_by_list = (list) => {
|
|
1368
1314
|
for(let a=0;a<list.length;a++){
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
}
|
|
1372
|
-
if(!list[a].time){
|
|
1373
|
-
list[a].time = new Date();
|
|
1374
|
-
}
|
|
1315
|
+
list[a].date = (list[a].date) ? list[a].date : new Date();
|
|
1316
|
+
list[a].time = (list[a].time) ? list[a].time : new Date();
|
|
1375
1317
|
list[a].start_date = DateTime.get_full_date_by_date_time(list[a].date,list[a].time);
|
|
1376
1318
|
list[a].start_time = DateTime.get_full_time_by_date_time(list[a].date,list[a].time);
|
|
1377
1319
|
list[a].start_date_time = DateTime.get_full_date_time_by_date_time(list[a].date,list[a].time);
|
|
@@ -1400,18 +1342,7 @@ class Storage {
|
|
|
1400
1342
|
}
|
|
1401
1343
|
class Sub_Item_Logic {
|
|
1402
1344
|
static get_test(title,parent_item,top_item,option){
|
|
1403
|
-
|
|
1404
|
-
option={get_value:true,value_count:9};
|
|
1405
|
-
}
|
|
1406
|
-
if(option.item_count==null){
|
|
1407
|
-
option.item_count = 9;
|
|
1408
|
-
}
|
|
1409
|
-
if(option.get_value==null){
|
|
1410
|
-
option.get_value = true;
|
|
1411
|
-
}
|
|
1412
|
-
if(option.value_count==null){
|
|
1413
|
-
option.value_count = 9;
|
|
1414
|
-
}
|
|
1345
|
+
option = Field_Logic.get_option(DataType.ITEM,option?option:{});
|
|
1415
1346
|
let item_title =title;
|
|
1416
1347
|
let item = DataItem.get_new(
|
|
1417
1348
|
DataType.ITEM,0, {
|
|
@@ -1430,7 +1361,8 @@ class Sub_Item_Logic {
|
|
|
1430
1361
|
}
|
|
1431
1362
|
return item;
|
|
1432
1363
|
}
|
|
1433
|
-
static
|
|
1364
|
+
static get_test_list(parent_item,top_item,option){
|
|
1365
|
+
option = Field_Logic.get_option(DataType.SUB_ITEM,option?option:{});
|
|
1434
1366
|
let new_list = [];
|
|
1435
1367
|
for(let a=0;a<option.item_count;a++){
|
|
1436
1368
|
let item_title ="Item " + String(parseInt(a+1));
|
|
@@ -1484,7 +1416,6 @@ module.exports = {
|
|
|
1484
1416
|
Item_Logic,
|
|
1485
1417
|
Event_Logic,
|
|
1486
1418
|
Message,
|
|
1487
|
-
Obj,
|
|
1488
1419
|
Page_Logic,
|
|
1489
1420
|
Page_Url,
|
|
1490
1421
|
Product_Url,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "biz9-logic",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.42",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"async-series": "^0.0.1",
|
|
12
12
|
"biz9-scriptz": "^5.8.1",
|
|
13
|
-
"biz9-utility": "^3.8.
|
|
13
|
+
"biz9-utility": "^3.8.5",
|
|
14
14
|
"jest": "^29.7.0",
|
|
15
15
|
"moment": "^2.30.1"
|
|
16
16
|
},
|
package/test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const series = require('async-series');
|
|
3
|
-
const {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock,Schedule,Storage,Business,Product,Service,Event,Template,Page,Category,Review,Blog_Post,Faq_Logic,Category_Url,Blank_Url,Blank_Logic,Item_Logic,Service_Logic,Template_Logic,Page_Logic,Product_Logic,Event_Logic,Blog_Post_Logic,Content_Logic,Category_Logic,Team_Logic,Business_Logic,PageType,Page_Url} = require('./index');
|
|
3
|
+
const {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock,Schedule,Storage,Business,Product,Service,Event,Template,Page,Category,Review,Blog_Post,Faq_Logic,Category_Url,Blank_Url,Blank_Logic,Item_Logic,Service_Logic,Template_Logic,Page_Logic,Product_Logic,Event_Logic,Blog_Post_Logic,Content_Logic,Category_Logic,Team_Logic,Business_Logic,PageType,Sub_Item_Logic,Page_Url} = require('./index');
|
|
4
4
|
const {Log,Number} = require('biz9-utility');
|
|
5
5
|
const {Scriptz}= require('biz9-scriptz');
|
|
6
6
|
|
|
@@ -50,8 +50,8 @@ describe("connect", () => {
|
|
|
50
50
|
/* --PAGE--START */
|
|
51
51
|
//let page = Page_Logic.get_test()
|
|
52
52
|
//let page = Page_Logic.get_test("Page "+Number.get_id())
|
|
53
|
-
let page = Page_Logic.get_test("Page "+Number.get_id(),{get_value:true,value_count:5,get_section:false,section_count:2})
|
|
54
|
-
Log.w("page",page);
|
|
53
|
+
//let page = Page_Logic.get_test("Page "+Number.get_id(),{get_value:true,value_count:5,get_section:false,section_count:2,get_photo:true,get_blank:true})
|
|
54
|
+
//Log.w("page",page);
|
|
55
55
|
//Log.w("page_section_1",page.section_1);
|
|
56
56
|
//Log.w("page_section_6",page.section_6.items);
|
|
57
57
|
//Log.w("page_section_1_section_1",page.section_1.section_1);
|
|
@@ -91,9 +91,23 @@ describe("connect", () => {
|
|
|
91
91
|
//Log.w('category_list',category_list);
|
|
92
92
|
/* --CATEGORY--END */
|
|
93
93
|
|
|
94
|
+
/* --SUB_ITEM--START */
|
|
95
|
+
console.log('TEST-SUB_ITEM-START');
|
|
96
|
+
let item = DataItem.get_new(DataType.BLANK,0);
|
|
97
|
+
let parent_item = DataItem.get_new(DataType.BLANK,0);
|
|
98
|
+
let top_item = DataItem.get_new(DataType.BLANK,0);
|
|
99
|
+
let sub_item = Sub_Item_Logic.get_test("cool 1",item,top_item);
|
|
100
|
+
//Log.w('sub_item',sub_item);
|
|
101
|
+
let sub_item_list = Sub_Item_Logic.get_test_list(item,top_item,{get_value:true});
|
|
102
|
+
// Log.w('sub_item',sub_item);
|
|
103
|
+
Log.w('sub_item_list',sub_item_list);
|
|
104
|
+
Log.w('sub_item_list_len',sub_item_list.length);
|
|
105
|
+
console.log('TEST-SUB_ITEM-END');
|
|
106
|
+
/* --SUB_ITEM--END */
|
|
107
|
+
|
|
94
108
|
|
|
95
109
|
/* --CONTENT--START */
|
|
96
|
-
//let content = Content_Logic.get_test()
|
|
110
|
+
//let content = Content_Logic.get_test("cool 1");
|
|
97
111
|
//let content = Content_Logic.get_test("Content 1",{get_value:true,get_item:true})
|
|
98
112
|
//Log.w("content",content);
|
|
99
113
|
//let content_list = Content_Logic.get_test_list();
|
|
@@ -150,7 +164,7 @@ describe("connect", () => {
|
|
|
150
164
|
|
|
151
165
|
//let product = Product_Logic.get_test("Product 1",{get_value:true,get_item:true})
|
|
152
166
|
//Log.w("product",product);
|
|
153
|
-
//let product_list = Product_Logic.get_test_list({product_count:10});
|
|
167
|
+
//let product_list = Product_Logic.get_test_list({product_count:10,get_blank:true});
|
|
154
168
|
//let product_list = Product_Logic.get_test_list();
|
|
155
169
|
//Log.w('product_list',product_list);
|
|
156
170
|
//let [category_list,product_list]=Product.get_test_list_by_category({category_count:5,product_count:9});
|