biz9-logic 4.8.10 → 4.8.19

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 +418 -391
  3. package/package.json +1 -1
  4. package/test.js +139 -81
package/index.js CHANGED
@@ -20,136 +20,110 @@ class TemplateType {
20
20
  static FOOTER='footer';
21
21
  }
22
22
  class Item_Logic {
23
- static get_test_item = (data_type,id,option)=>{
24
- if(option==null){
25
- option ={get_value:false};
26
- }
27
- if(option.get_value == null){
28
- option.get_value = false;
29
- }
23
+ static get_test = (title,data_type,id,option)=>{
30
24
  if(!data_type){
31
25
  data_type=DataType.BLANK;
32
26
  }
33
27
  if(!id){
34
28
  id=0;
35
29
  }
36
- let _id=Number.get_id(9999);
37
- let item_test = {data_type:data_type,id: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;
44
- item_test.title_url=Str.get_title_url(item_test.title);
45
- item_test.sub_note='sub_note_'+_id;
46
- item_test.note='note_'+_id;
47
- item_test.category='category_'+_id;
48
- item_test.group_id=_id;
49
- if(option.get_value){
50
- for(let b=1;b<10;b++){
51
- item_test['value_'+String(b)] = 'value ' + String(b);
52
- }
30
+ option = Field_Logic.get_option(data_type,option?option:{});
31
+ let item = DataItem.get_new_full_item(
32
+ DataItem.get_new(data_type,0),
33
+ DataItem.get_new(data_type,0),
34
+ DataItem.get_new(data_type,0),
35
+ Field_Logic.get_test(title,option));
36
+
37
+ if(option.get_item){
38
+ item.items = Sub_Item_Logic.get_test_item_list(item,item,option);
53
39
  }
54
- if(data_type == DataType.BLOG_POST)
55
- {
56
- item_test.author = "Author "+String(Number.get_id());
57
- item_test.tag = "tag 1, tag 2, tag 3";
58
- }else if(data_type == DataType.PRODUCT)
59
- {
60
- item_test.cost = String(Number.get_id()) + "." + String(Number.get_id());
61
- item_test.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
62
- item_test.type = "Type "+String(Number.get_id());
63
- item_test.sub_type = "Sub Type "+String(Number.get_id());
64
- item_test.stock = String(Number.get_id(3-1));
65
- }else if(data_type == DataType.SERVICE)
66
- {
67
- item_test.cost = String(Number.get_id()) + "." + String(Number.get_id());
68
- item_test.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
69
- item_test.type = "Type "+String(Number.get_id());
70
- item_test.sub_type = "Sub Type "+String(Number.get_id());
71
- item_test.stock = String(Number.get_id(3-1));
72
- }else if(data_type == DataType.EVENT){
73
- item_test.cost = String(Number.get_id()) + "." + String(Number.get_id());
74
- item_test.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
75
- item_test.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
76
- item_test.time = String(Number.get_id(24)) + ":" + String(Number.get_id(59));
77
- item_test.website = "Website "+String(Number.get_id());
78
- item_test.location = "Location "+String(Number.get_id());
79
- item_test.meeting_link = "Meeting Link "+String(Number.get_id());
80
- item_test.stock = String(Number.get_id(3-1));
81
- }
82
- return item_test;
40
+ return item;
83
41
  }
84
- static get_test_item_list = (data_type,option) =>{
85
- if(data_type==null){
86
- data_type = DataType.BLANK;
87
- }
88
- if(option==null){
89
- option = {item_count:9,get_value:false};
90
- }
91
- if(option.item_count==null){
92
- option.item_count = 10;
93
- }
94
- if(option.get_value==null){
95
- option.get_value = false;
96
- }
97
- let new_list = [];
98
- for(let a=1;a<option.item_count;a++){
99
- new_list.push(DataItem.get_new(data_type,0,Item_Logic.get_test_item(data_type,0,option)));
42
+ static get_test_list = (data_type,option) =>{
43
+ option = Field_Logic.get_option(data_type,option?option:{});
44
+ let item_list = [];
45
+ for(let a=0;a<option.item_count;a++){
46
+ item_list.push(Item_Logic.get_test("Item " +a,data_type,option));
100
47
  }
101
- return new_list;
48
+ return item_list;
102
49
  }
103
50
  }
104
51
  class Template_Logic {
105
52
  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;
53
+ if(!title){
54
+ title = "Template "+ Number.get_id();
55
+ option = {};
117
56
  }
57
+ option = Field_Logic.get_option(DataType.TEMPLATE,option?option:{});
118
58
  let template = DataItem.get_new_full_item(
119
59
  DataItem.get_new(DataType.TEMPLATE,0),
120
60
  DataItem.get_new(DataType.TEMPLATE,0),
121
61
  DataItem.get_new(DataType.TEMPLATE,0),
122
62
  Field_Logic.get_test(title,option));
123
63
  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
- }
64
+ template.items = Sub_Item_Logic.get_test_item_list(template,template,option);
129
65
  }
130
66
  return template;
131
67
  };
132
68
  }
133
- class Page_Logic {
69
+ class Team_Logic {
134
70
  static get_test = (title,option) =>{
135
- if(!option){
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;
71
+ if(!title){
72
+ title = "Team "+Number.get_id();
73
+ option = {};
74
+ }
75
+ option = Field_Logic.get_option(DataType.TEAM,option?option:{});
76
+ let team = DataItem.get_new_full_item(
77
+ DataItem.get_new(DataType.TEAM,0),
78
+ DataItem.get_new(DataType.TEAM,0),
79
+ DataItem.get_new(DataType.TEAM,0),
80
+ Field_Logic.get_test(title,option));
81
+ team.members = [];
82
+ if(option.get_member){
83
+ for(let a=0;a<option.member_count;a++){
84
+ team.members.push(Team_Logic.get_test_member("Full Name " + Number.get_id(),team,option));
85
+ }
143
86
  }
144
- if(!option.get_item){
145
- option.get_item=false;
87
+ return team;
88
+ };
89
+ static get_test_member = (title,team,option) =>{
90
+ option = Field_Logic.get_option(DataType.TEAM,option?option:{});
91
+ let team_member = DataItem.get_new_full_item(
92
+ DataItem.get_new(DataType.ITEM,0),
93
+ DataItem.get_new(DataType.TEAM,team.id),
94
+ DataItem.get_new(DataType.TEAM,team.id));
95
+ team_member.title = title;
96
+ team_member.first_name = "First Name "+ Number.get_id();
97
+ team_member.last_name = "Last Name "+ Number.get_id();
98
+ team_member.position = "Position "+ Number.get_id();
99
+ team_member.city = "City "+ Number.get_id();
100
+ team_member.state = "State "+ Number.get_id();
101
+ return team_member;
102
+ };
103
+ static get_test_member_list = (team,option) =>{
104
+ option = Field_Logic.get_option(DataType.TEAM,option?option:{});
105
+ let item_list = [];
106
+ for(let a=0;a<option.member_count;a++){
107
+ item_list.push(Team_Logic.get_test_member("Full Name " +parseInt(a+1),team,option));
146
108
  }
147
- if(!option.item_count){
148
- option.item_count=10;
109
+ return item_list;
110
+ }
111
+ static get_test_list = (option) =>{
112
+ option = Field_Logic.get_option(DataType.TEAM,option?option:{});
113
+ let item_list = [];
114
+ for(let a=0;a<option.team_count;a++){
115
+ item_list.push(Team_Logic.get_test("Team " +parseInt(a+1),option));
149
116
  }
150
- if(!option.value_count){
151
- option.value_count=10;
117
+ return item_list;
118
+ }
119
+ }
120
+ class Page_Logic {
121
+ static get_test = (title,option) =>{
122
+ if(!title){
123
+ title = "Page "+ Number.get_id();
124
+ option = {};
152
125
  }
126
+ option = Field_Logic.get_option(DataType.PAGE,option?option:{});
153
127
  let page = DataItem.get_new_full_item(
154
128
  DataItem.get_new(DataType.PAGE,0),
155
129
  DataItem.get_new(DataType.PAGE,0),
@@ -160,60 +134,55 @@ class Page_Logic {
160
134
  }
161
135
  return page;
162
136
  };
137
+ static get_test_list = (option) =>{
138
+ option = Field_Logic.get_option(DataType.PAGE,option?option:{});
139
+ let item_list = [];
140
+ for(let a=0;a<option.page_count;a++){
141
+ item_list.push(Page_Logic.get_test("Page " +parseInt(a+1),option));
142
+ }
143
+ return item_list;
144
+ }
163
145
  }
164
146
  class Product_Logic {
165
- static get_test = (option) =>{
166
- if(!option){
167
- option = {item_count:9,product_count:9,get_value:false,get_item:false,value_count:20};
147
+ static get_test = (title,option) =>{
148
+ if(!title){
149
+ title = "Product 1";
150
+ option = {};
168
151
  }
152
+ option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
169
153
  let product = DataItem.get_new_full_item(
170
- DataItem.get_new(DataType.PRODUCT,Number.get_id()),
171
154
  DataItem.get_new(DataType.PRODUCT,0),
172
155
  DataItem.get_new(DataType.PRODUCT,0),
173
- Field_Logic.get_test("Product "+Number.get_id(),option));
156
+ DataItem.get_new(DataType.PRODUCT,0),
157
+ Field_Logic.get_test(title,option));
174
158
  product.cost = String(Number.get_id()) + "." + String(Number.get_id());
175
159
  product.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
176
160
  product.type = "Type "+String(Number.get_id());
177
161
  product.sub_type = "Sub Type "+String(Number.get_id());
178
162
  product.stock = String(Number.get_id(3-1));
179
- product.category ="Category " + String(Number.get_id());
180
163
  if(option.get_item){
181
- page.items = Sub_Item_Logic.get_test_section_list(product,product,option);
164
+ product.items = Sub_Item_Logic.get_test_item_list(product,product,option);
182
165
  }
183
166
  return product;
184
167
  };
185
- static get_test_list=(option)=>{
186
- if(!option){
187
- option={product_count:10};
188
- }
189
- let item_list=[];
168
+ static get_test_list = (option) =>{
169
+ option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
170
+ let item_list = [];
190
171
  for(let a=0;a<option.product_count;a++){
191
- item_list.push(Product_Logic.get_test(option));
172
+ item_list.push(Product_Logic.get_test("Product "+String(parseInt(a+1)),option));
192
173
  }
193
174
  return item_list;
194
- };
175
+ }
195
176
  static get_test_list_by_category = (option) =>{
177
+ option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
196
178
  let product_list = [];
197
- let category_count = 9;
198
- let product_count = 19;
199
- if(!option){
200
- option={};
201
- }
202
- else{
203
- if(option.category_count){
204
- category_count = parseInt(option.category_count);
205
- }
206
- if(option.category_count){
207
- product_count = parseInt(option.product_count);
208
- }
209
- }
210
- let category_list = Category_Logic.get_type_category_list(DataType.PRODUCT,category_count);
179
+ let category_list = Category_Logic.get_type_category_list(DataType.PRODUCT,option.category_count);
211
180
  let item_count = 0;
212
181
  for(let a=0;a<category_list.length;a++){
213
- for(let b=0;b<product_count;b++){
182
+ for(let b=0;b<option.product_count;b++){
214
183
  item_count++;
215
- let product = Product_Logic.get_test({item_count:0,product_count:product_count,get_value:false,get_item:false,value_count:20});
216
- product.category = category_list[Number.get_id(category_list.length-1)].title;
184
+ let product = Product_Logic.get_test("Product "+String(parseInt(b+1)),option);
185
+ product.category = category_list[Number.get_id(category_list.length+1)].title;
217
186
  product_list.push(product);
218
187
  }
219
188
  }
@@ -221,82 +190,147 @@ class Product_Logic {
221
190
  };
222
191
  }
223
192
  class Service_Logic {
224
- static get_test = (option) =>{
225
- if(!option){
226
- option = {item_count:10,get_value:false,get_item:false,value_count:20};
227
- }
228
- if(!option.item_count){
229
- option.item_count=10;
193
+ static get_test = (title,option) =>{
194
+ if(!title){
195
+ title = "Service 1";
196
+ option = {};
230
197
  }
198
+ option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
231
199
  let service = DataItem.get_new_full_item(
232
- DataItem.get_new(DataType.SERVICE,Number.get_id()),
233
200
  DataItem.get_new(DataType.SERVICE,0),
234
201
  DataItem.get_new(DataType.SERVICE,0),
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);
202
+ DataItem.get_new(DataType.SERVICE,0),
203
+ Field_Logic.get_test(title,option));
237
204
  service.cost = String(Number.get_id()) + "." + String(Number.get_id());
238
205
  service.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
239
206
  service.type = "Type "+String(Number.get_id());
240
207
  service.sub_type = "Sub Type "+String(Number.get_id());
241
208
  service.stock = String(Number.get_id(3-1));
242
- service.category ="Category " + String(Number.get_id());
243
209
  if(option.get_item){
244
- service.items = Sub_Item_Logic.get_test_section_list(service,service,option);
210
+ service.items = Sub_Item_Logic.get_test_item_list(service,service,option);
245
211
  }
246
212
  return service;
247
213
  };
248
- static get_test_list=(option)=>{
249
- if(!option){
250
- option={service_count:10};
251
- }
252
- let item_list=[];
214
+ static get_test_list = (option) =>{
215
+ option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
216
+ let item_list = [];
253
217
  for(let a=0;a<option.service_count;a++){
254
- item_list.push(Service.get_test(option));
218
+ item_list.push(Service_Logic.get_test("Service "+String(parseInt(a+1))),option);
255
219
  }
256
220
  return item_list;
257
- };
221
+ }
258
222
  static get_test_list_by_category = (option) =>{
223
+ option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
259
224
  let service_list = [];
260
- let category_count = 9;
261
- let service_count = 19;
262
- if(!option){
263
- option={};
264
- }
265
- else{
266
- if(option.category_count){
267
- category_count = parseInt(option.category_count);
225
+ let category_list = Category_Logic.get_type_category_list(DataType.SERVICE,option.category_count);
226
+ let item_count = 0;
227
+ for(let a=0;a<category_list.length;a++){
228
+ for(let b=0;b<option.service_count;b++){
229
+ item_count++;
230
+ let service = Service_Logic.get_test("Service "+String(parseInt(b+1)),option);
231
+ service.category = category_list[Number.get_id(category_list.length+1)].title;
232
+ service_list.push(service);
268
233
  }
269
- if(option.category_count){
270
- service_count = parseInt(option.service_count);
234
+ }
235
+ return [category_list,service_list]
236
+ };
237
+ }
238
+ class Content_Logic {
239
+ static get_test = (title,option) =>{
240
+ if(!title){
241
+ title = "Content 1";
242
+ option = {};
243
+ }
244
+ option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
245
+ let content = DataItem.get_new_full_item(
246
+ DataItem.get_new(DataType.CONTENT,0),
247
+ DataItem.get_new(DataType.CONTENT,0),
248
+ DataItem.get_new(DataType.CONTENT,0),
249
+ Field_Logic.get_test(title,option));
250
+ if(option.get_item){
251
+ content.items = Sub_Item_Logic.get_test_section_list(content,content,option);
252
+ }
253
+ return content;
254
+ };
255
+ static get_test_list = (option) =>{
256
+ option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
257
+ let item_list = [];
258
+ for(let a=0;a<option.content_count;a++){
259
+ item_list.push(Content_Logic.get_test("Content " +String(parseInt(a+1)),option));
260
+ }
261
+ return item_list;
262
+ }
263
+ static get_test_list_by_category = (option) =>{
264
+ option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
265
+ let content_list = [];
266
+ let category_list = Category_Logic.get_type_category_list(DataType.CONTENT,option.category_count);
267
+ let item_count = 0;
268
+ for(let a=0;a<category_list.length;a++){
269
+ for(let b=0;b<option.content_count;b++){
270
+ item_count++;
271
+ let content = Content_Logic.get_test("Content "+String(parseInt(b+1)),option);
272
+ content.category = category_list[Number.get_id(category_list.length+1)].title;
273
+ content_list.push(content);
271
274
  }
272
275
  }
273
- let category_list = Category_Logic.get_type_category_list(DataType.SERVICE,category_count);
276
+ return [category_list,content_list]
277
+ };
278
+ }
279
+ class Blog_Post_Logic {
280
+ static get_test = (title,option) =>{
281
+ if(!title){
282
+ title = "Blog Post 1";
283
+ option = {};
284
+ }
285
+ option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
286
+ let blog_post = DataItem.get_new_full_item(
287
+ DataItem.get_new(DataType.BLOG_POST,0),
288
+ DataItem.get_new(DataType.BLOG_POST,0),
289
+ DataItem.get_new(DataType.BLOG_POST,0),
290
+ Field_Logic.get_test(title,option));
291
+ blog_post.author="First Name "+ Number.get_id();
292
+ blog_post.tag="tag 1,tag 2,tag 3";
293
+ if(option.get_item){
294
+ blog_post.items = Sub_Item_Logic.get_test_item_list(blog_post,blog_post,option);
295
+ }
296
+ return blog_post;
297
+ };
298
+ static get_test_list = (option) =>{
299
+ option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
300
+ let item_list = [];
301
+ for(let a=0;a<option.blog_post_count;a++){
302
+ item_list.push(Blog_Post_Logic.get_test("Blog_Post " +String(parseInt(a+1)),option));
303
+ }
304
+ return item_list;
305
+ }
306
+ static get_test_list_by_category = (option) =>{
307
+ option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
308
+ let blog_post_list = [];
309
+ let category_list = Category_Logic.get_type_category_list(DataType.BLOG_POST,option.category_count);
274
310
  let item_count = 0;
275
311
  for(let a=0;a<category_list.length;a++){
276
- for(let b=0;b<service_count;b++){
312
+ for(let b=0;b<option.blog_post_count;b++){
277
313
  item_count++;
278
- let service = Service.get_test({item_count:0,service_count:service_count,get_value:false,get_item:false});
279
- service.category = category_list[Number.get_id(category_list.length-1)].title;
280
- service_list.push(service);
314
+ let blog_post = Blog_Post_Logic.get_test("Blog_Post "+String(parseInt(b+1)),option);
315
+ blog_post.category = category_list[Number.get_id(category_list.length+1)].title;
316
+ blog_post_list.push(blog_post);
281
317
  }
282
318
  }
283
- return [category_list,service_list]
319
+ return [category_list,blog_post_list]
284
320
  };
285
321
  }
286
322
  class Event_Logic {
287
- static get_test = (option) =>{
288
- if(!option){
289
- option = {item_count:9,get_value:false,get_item:false,value_count:20};
290
- }
291
- if(!option.item_count){
292
- option.item_count=10;
323
+ static get_test = (title,option) =>{
324
+ if(!title){
325
+ title = "Event " + Number.get_id();
326
+ option = {};
293
327
  }
328
+ option = Field_Logic.get_option(DataType.EVENT,option?option:{});
294
329
  let event = DataItem.get_new_full_item(
295
- DataItem.get_new(DataType.EVENT,Number.get_id()),
296
330
  DataItem.get_new(DataType.EVENT,0),
297
331
  DataItem.get_new(DataType.EVENT,0),
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);
332
+ DataItem.get_new(DataType.EVENT,0),
333
+ Field_Logic.get_test(title,option));
300
334
  event.cost = String(Number.get_id()) + "." + String(Number.get_id());
301
335
  event.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
302
336
  event.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
@@ -307,42 +341,28 @@ class Event_Logic {
307
341
  event.stock = String(Number.get_id(3-1));
308
342
  event.category ="Category " + String(Number.get_id());
309
343
  if(option.get_item){
310
- event.items = Sub_Item_Logic.get_test_section_list(event,event,option);
344
+ event.items = Sub_Item_Logic.get_test_item_list(event,event,option);
311
345
  }
312
346
  return event;
313
347
  };
314
- static get_test_list=(option)=>{
315
- if(!option){
316
- option={service_count:10};
317
- }
318
- let item_list=[];
348
+ static get_test_list = (option) =>{
349
+ option = Field_Logic.get_option(DataType.EVENT,option?option:{});
350
+ let item_list = [];
319
351
  for(let a=0;a<option.event_count;a++){
320
- item_list.push(Event_Logic.get_test(option));
352
+ item_list.push(Event_Logic.get_test("Event "+String(parseInt(a+1)),option));
321
353
  }
322
354
  return item_list;
323
- };
355
+ }
324
356
  static get_test_list_by_category = (option) =>{
357
+ option = Field_Logic.get_option(DataType.EVENT,option?option:{});
325
358
  let event_list = [];
326
- let category_count = 9;
327
- let event_count = 19;
328
- if(!option){
329
- option={};
330
- }
331
- else{
332
- if(option.category_count){
333
- category_count = parseInt(option.category_count);
334
- }
335
- if(option.category_count){
336
- event_count = parseInt(option.event_count);
337
- }
338
- }
339
- let category_list = Category_Logic.get_type_category_list(DataType.EVENT,category_count);
359
+ let category_list = Category_Logic.get_type_category_list(DataType.EVENT,option.category_count);
340
360
  let item_count = 0;
341
361
  for(let a=0;a<category_list.length;a++){
342
- for(let b=0;b<event_count;b++){
362
+ for(let b=0;b<option.event_count;b++){
343
363
  item_count++;
344
- let event = Event_Logic.get_test({item_count:0,event_count:event_count,get_value:false,get_item:false,value_count:20});
345
- event.category = category_list[Number.get_id(category_list.length-1)].title;
364
+ let event = Event_Logic.get_test("Event "+String(parseInt(b+1)),option);
365
+ event.category = category_list[Number.get_id(category_list.length+1)].title;
346
366
  event_list.push(event);
347
367
  }
348
368
  }
@@ -353,32 +373,114 @@ class Field_Logic {
353
373
  static get_test = (title,option) =>{
354
374
  if(!title){
355
375
  title="";
376
+ option={};
356
377
  }
357
378
  if(!option){
358
- option={get_value:true,value_count:10};
379
+ option= {};
359
380
  }
360
- if(!option.get_value){
361
- option.get_value=false;
362
- }
363
- if(!option.value_count){
364
- option.value_count=10;
381
+ if(!option.category_title){
382
+ option.category_title = 'Category '+String(Number.get_id());
365
383
  }
366
384
  let item = {
367
- date_create:new moment().toISOString(),
368
- date_save:new moment().toISOString(),
369
385
  title:title,
370
386
  setting_visible:"1",
371
387
  title_url:Str.get_title_url(title),
388
+ category:option.category_title,
372
389
  sub_note:"Sub Note "+String(Number.get_id()),
373
390
  note:"Note "+String(Number.get_id())
374
391
  }
375
392
  if(option.get_value){
376
- for(let b = 1;b<parseInt(option.value_count);b++){
377
- item['value_'+String(b)] = title + ' value ' + String(b);
378
- }
393
+ item = Field_Logic.get_value_list(item,option);
379
394
  }
380
395
  return item;
381
396
  }
397
+ static get_value_list(item,option){
398
+ for(let b=0;b<option.value_count;b++){
399
+ item['value_'+String(b+1)] = 'value ' + String(b+1);
400
+ item['field_'+String(b+1)] = Str.get_title_url(item['value_'+String(b+1)]);
401
+ item[Str.get_title_url('value ' + String(b+1))] = item.title + ' value ' + String(b+1);
402
+ }
403
+ return item;
404
+ };
405
+ static get_option(data_type,option){
406
+ if(!data_type){
407
+ data_type = DataType.BLANK;
408
+ }
409
+ if(!option){
410
+ option = {get_value:false,get_item:false,get_photo:false,item_count:9,value_count:9};
411
+ }
412
+ if(!option.get_photo){
413
+ option.get_photo=false;
414
+ }
415
+ if(!option.get_value){
416
+ option.get_value=false;
417
+ }
418
+ if(!option.value_count){
419
+ option.value_count=9;
420
+ }
421
+ if(!option.section_count){
422
+ option.section_count=9;
423
+ }
424
+ if(!option.get_item){
425
+ option.get_item=false;
426
+ }
427
+ if(!option.item_count){
428
+ option.item_count=9;
429
+ }
430
+ if(!option.category_count){
431
+ option.category_count=9;
432
+ }
433
+ if(!option.category_title){
434
+ option.category_title=null;
435
+ }
436
+ if(option.data_type==DataType.PAGE){
437
+ if(!option.page_count){
438
+ option.page_count=9;
439
+ }
440
+ }
441
+ if(option.data_type==DataType.PRODUCT){
442
+ if(!option.product_count){
443
+ option.product_count=9;
444
+ }
445
+ }
446
+ if(data_type==DataType.SERVICE){
447
+ if(!option.service_count){
448
+ option.service_count=9;
449
+ }
450
+ }
451
+ if(data_type==DataType.BLOG_POST){
452
+ if(!option.blog_post_count){
453
+ option.blog_post_count=9;
454
+ }
455
+ }
456
+ if(data_type==DataType.EVENT){
457
+ if(!option.event_count){
458
+ option.event_count=9;
459
+ }
460
+ }
461
+ if(data_type==DataType.TEAM){
462
+ if(!option.get_member){
463
+ option.get_member=false;
464
+ }
465
+ if(!option.member_count){
466
+ option.member_count=9;
467
+ }
468
+ }
469
+ if(data_type==DataType.FAQ){
470
+ if(!option.get_question){
471
+ option.get_question=false;
472
+ }
473
+ if(!option.question_count){
474
+ option.question_count=9;
475
+ }
476
+ }
477
+ if(data_type==DataType.CONTENT){
478
+ if(!option.content_count){
479
+ option.content_count=9;
480
+ }
481
+ }
482
+ return option;
483
+ }
382
484
  }
383
485
  class FieldType {
384
486
  static APP_ID='app_id';
@@ -509,140 +611,72 @@ class DataType {
509
611
  static VIDEO='video_biz';
510
612
  }
511
613
  class Blank_Logic {
512
- static get_test = (option) =>{
513
- if(!option){
514
- option = {item_count:10,get_value:false,get_item:false,value_count:20};
515
- }
516
- if(!option.item_count){
517
- option.item_count=10;
614
+ static get_test = (title,option) =>{
615
+ if(!title){
616
+ title = "Blank " + Number.get_id();
617
+ option={};
518
618
  }
619
+ option = Field_Logic.get_option(DataType.BLANK,option?option:{});
519
620
  let blank = DataItem.get_new_full_item(
520
- DataItem.get_new(DataType.BLANK,Number.get_id()),
521
621
  DataItem.get_new(DataType.BLANK,0),
522
622
  DataItem.get_new(DataType.BLANK,0),
523
- Field_Logic.get_test("Blog Post "+Number.get_id(),option));
524
- blank.tag="tag 1,tag 2,tag 3";
525
- blank.category ="Category " + String(Number.get_id());
623
+ DataItem.get_new(DataType.BLANK,0),
624
+ Field_Logic.get_test(title,option));
526
625
  if(option.get_item){
527
- blank.items = Sub_Item_Logic.get_test_section_list(blank,blank,option);
626
+ blank.items = Sub_Item_Logic.get_test_item_list(blank,blank,option);
528
627
  }
529
628
  return blank;
530
629
  };
531
- static get_test_list=(option)=>{
532
- if(!option){
533
- option = {blank_count:10,get_value:false,get_item:false,value_count:20};
534
- }
535
- let item_list=[];
630
+ static get_test_list = (option) =>{
631
+ option = Field_Logic.get_option(DataType.BLANK,option?option:{});
632
+ let item_list = [];
536
633
  for(let a=0;a<option.blank_count;a++){
537
- item_list.push(Blank_Logic.get_test(option));
634
+ item_list.push(Blank_Logic.get_test("Blank " +String(parseInt(a+1)),option));
538
635
  }
539
636
  return item_list;
540
- };
637
+ }
541
638
  static get_test_list_by_category = (option) =>{
639
+ option = Field_Logic.get_option(DataType.BLANK,option?option:{});
542
640
  let blank_list = [];
543
- let category_count = 9;
544
- let blank_count = 19;
545
- if(!option){
546
- option={};
547
- }
548
- else{
549
- if(option.category_count){
550
- category_count = parseInt(option.category_count);
551
- }
552
- if(option.category_count){
553
- blank_count = parseInt(option.blank_count);
554
- }
555
- }
556
- let category_list = Category_Logic.get_type_category_list(DataType.BLANK,category_count);
641
+ let category_list = Category_Logic.get_type_category_list(DataType.BLANK,option.category_count);
557
642
  let item_count = 0;
558
643
  for(let a=0;a<category_list.length;a++){
559
- for(let b=0;b<blank_count;b++){
644
+ for(let b=0;b<option.blank_count;b++){
560
645
  item_count++;
561
- let blank = Blank_Logic.get_test({item_count:0,blank_count:blank_count,get_value:false,get_item:false,value_count:20});
562
- blank.category = category_list[Number.get_id(category_list.length-1)].title;
646
+ let blank = Blank_Logic.get_test("Blank "+String(parseInt(b+1)),option);
647
+ blank.category = category_list[Number.get_id(category_list.length+1)].title;
563
648
  blank_list.push(blank);
564
649
  }
565
650
  }
566
651
  return [category_list,blank_list]
567
652
  };
568
653
  }
569
- class Blog_Post_Logic {
570
- static get_test = (option) =>{
571
- if(!option){
572
- option = {item_count:10,get_value:false,get_item:false,value_count:20};
573
- }
574
- if(!option.item_count){
575
- option.item_count=10;
576
- }
577
- let blog_post = DataItem.get_new_full_item(
578
- DataItem.get_new(DataType.BLOG_POST,Number.get_id()),
579
- DataItem.get_new(DataType.BLOG_POST,0),
580
- DataItem.get_new(DataType.BLOG_POST,0),
581
- Field_Logic.get_test("Blog Post "+Number.get_id(),option));
582
- blog_post.author="First Name "+ Number.get_id();
583
- blog_post.tag="tag 1,tag 2,tag 3";
584
- blog_post.category ="Category " + String(Number.get_id());
585
- if(option.get_item){
586
- blog_post.items = Sub_Item_Logic.get_test_section_list(blog_post,blog_post,option);
587
- }
588
- return blog_post;
589
- };
590
- static get_test_list=(option)=>{
591
- if(!option){
592
- option = {blog_post_count:10,get_value:false,get_item:false,value_count:20};
593
- }
594
- let item_list=[];
595
- for(let a=0;a<option.blog_post_count;a++){
596
- item_list.push(Blog_Post_Logic.get_test(option));
597
- }
598
- return item_list;
599
- };
600
- static get_test_list_by_category = (option) =>{
601
- let blog_post_list = [];
602
- let category_count = 9;
603
- let blog_post_count = 19;
604
- if(!option){
654
+ class Faq_Logic {
655
+ static get_test = (title,option) =>{
656
+ if(!title){
657
+ title = "Faq " + Number.get_id();
605
658
  option={};
606
659
  }
607
- else{
608
- if(option.category_count){
609
- category_count = parseInt(option.category_count);
610
- }
611
- if(option.category_count){
612
- blog_post_count = parseInt(option.blog_post_count);
613
- }
614
- }
615
- let category_list = Category_Logic.get_type_category_list(DataType.BLOG_POST,category_count);
616
- let item_count = 0;
617
- for(let a=0;a<category_list.length;a++){
618
- for(let b=0;b<blog_post_count;b++){
619
- item_count++;
620
- let blog_post = Blog_Post_Logic.get_test({item_count:0,blog_post_count:blog_post_count,get_value:false,get_item:false,value_count:20});
621
- blog_post.category = category_list[Number.get_id(category_list.length-1)].title;
622
- blog_post_list.push(blog_post);
623
- }
624
- }
625
- return [category_list,blog_post_list]
626
- };
627
- }
628
- class Faq_Logic {
629
- static get_test = () =>{
660
+ option = Field_Logic.get_option(DataType.FAQ,option?option:{});
661
+ option.get_value = false;
630
662
  let faq = DataItem.get_new_full_item(
631
- DataItem.get_new(DataType.FAQ,Number.get_id()),
632
663
  DataItem.get_new(DataType.FAQ,0),
633
664
  DataItem.get_new(DataType.FAQ,0),
634
- Field_Logic.get_test("Faq "+Number.get_id(),{get_value:false}));
635
- faq.question="What Is Title " + Number.get_id();
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.";
665
+ DataItem.get_new(DataType.FAQ,0),
666
+ Field_Logic.get_test(title,option));
667
+ for(let b=0;b<option.question_count;b++){
668
+ faq['question_'+String(b+1)] = 'question ' + String(b+1);
669
+ faq['field_'+String(b+1)] = Str.get_title_url(faq['question_'+String(b+1)]);
670
+ faq[Str.get_title_url('question ' + String(b+1))] = 'Answer ' + String(b+1);
671
+ }
672
+
637
673
  return faq;
638
674
  };
639
675
  static get_test_list=(option)=>{
640
- if(!option){
641
- option = {faq_count:19};
642
- }
676
+ option = Field_Logic.get_option(DataType.FAQ,option?option:{});
643
677
  let item_list = [];
644
- for(let a=0;a<option.faq_count;a++){
645
- item_list.push(Faq.get_test());
678
+ for(let a=0;a<option.question_count;a++){
679
+ item_list.push(Faq_Logic.get_test("FAQ Questions " +parseInt(a+1),option));
646
680
  }
647
681
  return item_list;
648
682
  };
@@ -677,15 +711,15 @@ class Review_Logic {
677
711
  };
678
712
  }
679
713
  class Business_Logic {
680
- static get_new = () =>{
714
+ static get_new = (title) =>{
681
715
  if(!title){
682
- title="";
716
+ title="Business "+Number.get_id();
683
717
  }
684
718
  return DataItem.get_new_full_item(
685
719
  DataItem.get_new(DataType.BUSINESS,0),
686
720
  DataItem.get_new(DataType.BUSINESS,0),
687
721
  DataItem.get_new(DataType.BUSINESS,0),{
688
- title:"Business " + Number.get_id(),
722
+ title:title,
689
723
  email:"",
690
724
  phone:"",
691
725
  address_1:"",
@@ -700,8 +734,14 @@ class Business_Logic {
700
734
  twitter:""
701
735
  });
702
736
  };
703
- static get_test = () =>{
704
- let item = DataItem.get_new(DataType.BUSINESS,Number.get_id());
737
+ static get_test = (title,option) =>{
738
+ if(!title){
739
+ title="Business "+Number.get_id();
740
+ option={};
741
+ }
742
+ option = Field_Logic.get_option(DataType.BUSINESS,option?option:{});
743
+ Log.w('option',option);
744
+ let item = DataItem.get_new(DataType.BUSINESS,0);
705
745
  let city_list = ["Miami","Atlanta","Chicago","Seattle","New York City"];
706
746
  let state_list = ["Georgia","New York","Illinois","Washington","Flordia"];
707
747
  let business = DataItem.get_new_full_item(
@@ -740,19 +780,19 @@ class Business_Logic {
740
780
  }
741
781
  }
742
782
  class DataItem {
743
- static get_new = (data_type,id,options) => {
744
- return get_new_item_main(data_type,id,options);
783
+ static get_new = (data_type,id,option) => {
784
+ return get_new_item_main(data_type,id,option?option:{});
745
785
  };
746
- static get_new_full_item = (item,parent_item,top_item,options) => {
747
- return get_new_full_item_main(item,parent_item,top_item,options);
786
+ static get_new_full_item = (item,parent_item,top_item,option) => {
787
+ return get_new_full_item_main(item,parent_item,top_item,option?option:{});
748
788
  };
749
- static get_biz = (biz9_config,item,options)=>{
750
- return get_biz_item_main(biz9_config,item,options);
789
+ static get_biz = (biz9_config,item,option)=>{
790
+ return get_biz_item_main(biz9_config,item,option?option:{});
751
791
  }
752
- static get_biz_by_list = (biz9_config,list,options)=>{
792
+ static get_biz_by_list = (biz9_config,list,option)=>{
753
793
  let r_list = [];
754
794
  for(let a=0;a<list.length;a++){
755
- r_list.push(get_biz_item_main(biz9_config,list[a],options));
795
+ r_list.push(get_biz_item_main(biz9_config,list[a],option));
756
796
  }
757
797
  return r_list;
758
798
  }
@@ -926,6 +966,9 @@ class Team_Url {
926
966
  };
927
967
  }
928
968
  class Url{
969
+ static get_search = (data_type,filter,sort_by,page_current,page_size) => {
970
+ return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
971
+ };
929
972
  static copy_item = (biz9_config,data_type,id) => {
930
973
  let action_url = "main/crud/copy/"+data_type + "/" + id;
931
974
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
@@ -949,8 +992,8 @@ class Url{
949
992
  let action_url= "main/crud/get/"+data_type + "/" + key;
950
993
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
951
994
  };
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;
995
+ static get_item_parent_top = (biz9_config,data_type,id,parent_data_type,parent_id,top_data_type,top_id) => {
996
+ let action_url = "main/crud/get_item_parent_top/"+data_type+"/"+id+"/"+parent_data_type+ "/"+parent_id+"/"+top_data_type+ "/"+top_id;
954
997
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
955
998
  };
956
999
  static get_list = (biz9_config,data_type) => {
@@ -980,37 +1023,40 @@ class Obj {
980
1023
  }
981
1024
  };
982
1025
  class Category_Logic {
983
- static get_test(option){
984
- if(!option){
985
- option = {item_count:9,category_count:9,get_value:false,get_item:false,value_count:20};
1026
+ static get_test = (title,option) =>{
1027
+ if(!title){
1028
+ title="Category 1";
1029
+ option={};
986
1030
  }
1031
+ option = Field_Logic.get_option(DataType.CATEGORY,option?option:{});
987
1032
  let category = DataItem.get_new_full_item(
988
- DataItem.get_new(DataType.CATEGORY,Number.get_id()),
989
1033
  DataItem.get_new(DataType.CATEGORY,0),
990
1034
  DataItem.get_new(DataType.CATEGORY,0),
991
- Field_Logic.get_test("Category " +Number.get_id()));
992
- category.type = Category_Logic.get_category_list()[Number.get_id(Category_Logic.get_category_list().length-1)].data_type;
993
- return category;
994
- }
995
- static get_test_list = (option) => {
996
- if(!option){
997
- option={category_count:10};
1035
+ DataItem.get_new(DataType.CATEGORY,0),
1036
+ Field_Logic.get_test(title,option));
1037
+ if(option.get_item){
1038
+ category.items = Sub_Item_Logic.get_test_item_list(category,category,option);
998
1039
  }
999
- let item_list=[];
1040
+ return category;
1041
+ };
1042
+ static get_test_list = (option) =>{
1043
+ option = Field_Logic.get_option(DataType.CATEGORY,option);
1044
+ let item_list = [];
1000
1045
  for(let a=0;a<option.category_count;a++){
1001
- item_list.push(Category_Logic.get_test(option));
1046
+ item_list.push(Category_Logic.get_test("Category " +String(parseInt(a+1)),option));
1002
1047
  }
1003
1048
  return item_list;
1004
- };
1005
- static get_type_category_list(type,count) {
1049
+ }
1050
+ static get_test_list_by_type = (type,option) =>{
1051
+ option = Field_Logic.get_option(DataType.CATEGORY,option);
1006
1052
  let category_list = [];
1007
- for(let a=0;a<count;a++){
1053
+ for(let a=0;a<option.category_count;a++){
1008
1054
  let category = DataItem.get_new_full_item(
1009
- DataItem.get_new(DataType.CATEGORY,"Category "+Number.get_id()),
1010
1055
  DataItem.get_new(DataType.CATEGORY,0),
1011
1056
  DataItem.get_new(DataType.CATEGORY,0),
1012
- Field_Logic.get_test("Category " +Number.get_id(),{get_value:false}));
1013
- category.type = type
1057
+ DataItem.get_new(DataType.CATEGORY,0),
1058
+ Field_Logic.get_test("Category " +String(parseInt(a+1)),option));
1059
+ category.type = type;
1014
1060
  category_list.push(category);
1015
1061
  }
1016
1062
  return category_list;
@@ -1024,11 +1070,11 @@ class Category_Logic {
1024
1070
  };
1025
1071
  static get_category_list = () => {
1026
1072
  return [
1027
- {data_type:DataType.BLOG_POST,value:DataType.BLOG_POST,label:"Blog Posts"}, //
1028
- {data_type:DataType.CATEGORY,value:DataType.CATEGORY,label:"Category"}, //
1029
- {data_type:DataType.CONTENT,value:DataType.CONTENT,label:"Content"},//
1030
- {data_type:DataType.EVENT,value:DataType.EVENT,label:"Events"},//
1031
- {data_type:DataType.GALLERY,value:DataType.GALLERY,label:"Galleries"}, //
1073
+ {data_type:DataType.BLOG_POST,value:DataType.BLOG_POST,label:"Blog Posts"},
1074
+ {data_type:DataType.CATEGORY,value:DataType.CATEGORY,label:"Category"},
1075
+ {data_type:DataType.CONTENT,value:DataType.CONTENT,label:"Content"},
1076
+ {data_type:DataType.EVENT,value:DataType.EVENT,label:"Events"},
1077
+ {data_type:DataType.GALLERY,value:DataType.GALLERY,label:"Galleries"},
1032
1078
  {data_type:DataType.SERVICE,value:DataType.SERVICE,label:"Services"},
1033
1079
  {data_type:DataType.PRODUCT,value:DataType.PRODUCT,label:"Product"},
1034
1080
  {data_type:DataType.TEMPLATE,value:DataType.TEMPLATE,label:"Template"},
@@ -1314,13 +1360,16 @@ class Storage {
1314
1360
  class Sub_Item_Logic {
1315
1361
  static get_test(title,parent_item,top_item,option){
1316
1362
  if(option==null){
1317
- option={get_value:true,value_count:10};
1363
+ option={get_value:true,value_count:9};
1364
+ }
1365
+ if(option.item_count==null){
1366
+ option.item_count = 9;
1318
1367
  }
1319
1368
  if(option.get_value==null){
1320
1369
  option.get_value = true;
1321
1370
  }
1322
1371
  if(option.value_count==null){
1323
- option.value_count = 10;
1372
+ option.value_count = 9;
1324
1373
  }
1325
1374
  let item_title =title;
1326
1375
  let item = DataItem.get_new(
@@ -1336,47 +1385,23 @@ class Sub_Item_Logic {
1336
1385
  }
1337
1386
  );
1338
1387
  if(option.get_value){
1339
- for(let b=1;b<option.value_count;b++){
1340
- item['value_'+String(b)] = item_title+ ' value ' + String(b);
1341
- }
1388
+ item = Field_Logic.get_value_list(item,option);
1342
1389
  }
1343
1390
  return item;
1344
1391
  }
1345
-
1346
- static get_test_section_list(parent_item,top_item,option){
1392
+ static get_test_item_list(parent_item,top_item,option){
1347
1393
  let new_list = [];
1348
- if(option==null){
1349
- option={item_count:10,get_value:true,value_count:10};
1350
- }
1351
- if(option.item_count==null){
1352
- option.item_count = 10;
1394
+ for(let a=0;a<option.item_count;a++){
1395
+ let item_title ="Item " + String(parseInt(a+1));
1396
+ new_list.push(Sub_Item_Logic.get_test(item_title,parent_item,top_item,option));
1353
1397
  }
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
- }
1378
- }
1379
- new_list.push(sub_item);
1398
+ return new_list;
1399
+ }
1400
+ static get_test_section_list(parent_item,top_item,option){
1401
+ let new_list = [];
1402
+ for(let a=0;a<option.section_count;a++){
1403
+ let item_title ="Section " + String(parseInt(a+1));
1404
+ new_list.push(Sub_Item_Logic.get_test(item_title,parent_item,top_item,option));
1380
1405
  }
1381
1406
  return new_list;
1382
1407
  }
@@ -1390,6 +1415,7 @@ module.exports = {
1390
1415
  Category_Logic,
1391
1416
  Category_Url,
1392
1417
  Content_Url,
1418
+ Content_Logic,
1393
1419
  Custom_Field_Url,
1394
1420
  CMS,
1395
1421
  DataItem,
@@ -1416,6 +1442,7 @@ module.exports = {
1416
1442
  Schedule,
1417
1443
  Stock,
1418
1444
  TemplateType,
1445
+ Team_Logic,
1419
1446
  Template_Logic,
1420
1447
  Url,
1421
1448
  };