biz9-logic 4.8.6 → 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 +473 -428
  3. package/package.json +1 -1
  4. package/test.js +149 -71
package/index.js CHANGED
@@ -20,173 +20,169 @@ 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.title='title_'+_id;
39
- item_test.title_url=Str.get_title_url(item_test.title);
40
- item_test.sub_note='sub_note_'+_id;
41
- item_test.note='note_'+_id;
42
- item_test.category='category_'+_id;
43
- item_test.group_id=_id;
44
- if(option.get_value){
45
- for(let b=1;b<20;b++){
46
- item_test['value_'+String(b)] = 'value ' + String(b);
47
- }
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);
48
39
  }
49
- if(data_type == DataType.BLOG_POST)
50
- {
51
- item_test.author = "Author "+String(Number.get_id());
52
- item_test.tag = "tag 1, tag 2, tag 3";
53
- }else if(data_type == DataType.PRODUCT)
54
- {
55
- item_test.cost = String(Number.get_id()) + "." + String(Number.get_id());
56
- item_test.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
57
- item_test.type = "Type "+String(Number.get_id());
58
- item_test.sub_type = "Sub Type "+String(Number.get_id());
59
- item_test.stock = String(Number.get_id(3-1));
60
- }else if(data_type == DataType.SERVICE)
61
- {
62
- item_test.cost = String(Number.get_id()) + "." + String(Number.get_id());
63
- item_test.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
64
- item_test.type = "Type "+String(Number.get_id());
65
- item_test.sub_type = "Sub Type "+String(Number.get_id());
66
- item_test.stock = String(Number.get_id(3-1));
67
- }else if(data_type == DataType.EVENT){
68
- item_test.cost = String(Number.get_id()) + "." + String(Number.get_id());
69
- item_test.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
70
- item_test.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
71
- item_test.time = String(Number.get_id(24)) + ":" + String(Number.get_id(59));
72
- item_test.website = "Website "+String(Number.get_id());
73
- item_test.location = "Location "+String(Number.get_id());
74
- item_test.meeting_link = "Meeting Link "+String(Number.get_id());
75
- item_test.stock = String(Number.get_id(3-1));
76
- }
77
- return item_test;
40
+ return item;
78
41
  }
79
- static get_test_item_list = (data_type,option) =>{
80
- if(data_type==null){
81
- data_type = DataType.BLANK;
82
- }
83
- if(option==null){
84
- option = {item_count:9};
85
- }
86
- if(option.item_count==null){
87
- option.item_count = 10;
88
- }
89
- let new_list = [];
90
- for(let a=1;a<option.item_count;a++){
91
- 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));
92
47
  }
93
- return new_list;
48
+ return item_list;
94
49
  }
95
50
  }
96
-
97
51
  class Template_Logic {
98
- static get_test = () =>{
52
+ static get_test = (title,option) =>{
53
+ if(!title){
54
+ title = "Template "+ Number.get_id();
55
+ option = {};
56
+ }
57
+ option = Field_Logic.get_option(DataType.TEMPLATE,option?option:{});
99
58
  let template = DataItem.get_new_full_item(
100
- DataItem.get_new(DataType.TEMPLATE,Number.get_id()),
101
59
  DataItem.get_new(DataType.TEMPLATE,0),
102
60
  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);
61
+ DataItem.get_new(DataType.TEMPLATE,0),
62
+ Field_Logic.get_test(title,option));
63
+ if(option.get_item){
64
+ template.items = Sub_Item_Logic.get_test_item_list(template,template,option);
107
65
  }
108
- template = Sub_Item.get_test_bind_item_sub_item(template);
109
66
  return template;
110
67
  };
111
68
  }
112
- class Page_Logic {
113
- static get_test = (option) =>{
114
- if(!option){
115
- option = {item_count:9,page_count:9,get_value:false,get_item:false,value_count:20};
69
+ class Team_Logic {
70
+ static get_test = (title,option) =>{
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
+ }
116
86
  }
117
- if(!option.item_count){
118
- option.item_count=10;
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));
108
+ }
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));
119
116
  }
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 = {};
125
+ }
126
+ option = Field_Logic.get_option(DataType.PAGE,option?option:{});
120
127
  let page = DataItem.get_new_full_item(
121
- DataItem.get_new(DataType.PAGE,Number.get_id()),
122
128
  DataItem.get_new(DataType.PAGE,0),
123
129
  DataItem.get_new(DataType.PAGE,0),
124
- Field.get_test("Page "+ String(Number.get_id()),option));
130
+ DataItem.get_new(DataType.PAGE,0),
131
+ Field_Logic.get_test(title,option));
125
132
  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);
133
+ page.items = Sub_Item_Logic.get_test_section_list(page,page,option);
130
134
  }
131
135
  return page;
132
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
+ }
133
145
  }
134
146
  class Product_Logic {
135
- static get_test = (option) =>{
136
- if(!option){
137
- 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 = {};
138
151
  }
152
+ option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
139
153
  let product = DataItem.get_new_full_item(
140
- DataItem.get_new(DataType.PRODUCT,Number.get_id()),
141
154
  DataItem.get_new(DataType.PRODUCT,0),
142
155
  DataItem.get_new(DataType.PRODUCT,0),
143
- Field.get_test("Product "+Number.get_id(),option));
156
+ DataItem.get_new(DataType.PRODUCT,0),
157
+ Field_Logic.get_test(title,option));
144
158
  product.cost = String(Number.get_id()) + "." + String(Number.get_id());
145
159
  product.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
146
160
  product.type = "Type "+String(Number.get_id());
147
161
  product.sub_type = "Sub Type "+String(Number.get_id());
148
162
  product.stock = String(Number.get_id(3-1));
149
- product.category ="Category " + String(Number.get_id());
150
163
  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);
164
+ product.items = Sub_Item_Logic.get_test_item_list(product,product,option);
155
165
  }
156
166
  return product;
157
167
  };
158
- static get_test_list=(option)=>{
159
- if(!option){
160
- option={product_count:10};
161
- }
162
- let item_list=[];
168
+ static get_test_list = (option) =>{
169
+ option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
170
+ let item_list = [];
163
171
  for(let a=0;a<option.product_count;a++){
164
- item_list.push(Product_Logic.get_test(option));
172
+ item_list.push(Product_Logic.get_test("Product "+String(parseInt(a+1)),option));
165
173
  }
166
174
  return item_list;
167
- };
175
+ }
168
176
  static get_test_list_by_category = (option) =>{
177
+ option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
169
178
  let product_list = [];
170
- let category_count = 9;
171
- let product_count = 19;
172
- if(!option){
173
- option={};
174
- }
175
- else{
176
- if(option.category_count){
177
- category_count = parseInt(option.category_count);
178
- }
179
- if(option.category_count){
180
- product_count = parseInt(option.product_count);
181
- }
182
- }
183
- 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);
184
180
  let item_count = 0;
185
181
  for(let a=0;a<category_list.length;a++){
186
- for(let b=0;b<product_count;b++){
182
+ for(let b=0;b<option.product_count;b++){
187
183
  item_count++;
188
- let product = Product_Logic.get_test({item_count:0,product_count:product_count,get_value:false,get_item:false,value_count:20});
189
- 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;
190
186
  product_list.push(product);
191
187
  }
192
188
  }
@@ -194,85 +190,147 @@ class Product_Logic {
194
190
  };
195
191
  }
196
192
  class Service_Logic {
197
- static get_test = (option) =>{
198
- if(!option){
199
- option = {item_count:10,get_value:false,get_item:false,value_count:20};
200
- }
201
- if(!option.item_count){
202
- option.item_count=10;
193
+ static get_test = (title,option) =>{
194
+ if(!title){
195
+ title = "Service 1";
196
+ option = {};
203
197
  }
198
+ option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
204
199
  let service = DataItem.get_new_full_item(
205
- DataItem.get_new(DataType.SERVICE,Number.get_id()),
206
200
  DataItem.get_new(DataType.SERVICE,0),
207
201
  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);
202
+ DataItem.get_new(DataType.SERVICE,0),
203
+ Field_Logic.get_test(title,option));
210
204
  service.cost = String(Number.get_id()) + "." + String(Number.get_id());
211
205
  service.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
212
206
  service.type = "Type "+String(Number.get_id());
213
207
  service.sub_type = "Sub Type "+String(Number.get_id());
214
208
  service.stock = String(Number.get_id(3-1));
215
- service.category ="Category " + String(Number.get_id());
216
209
  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);
210
+ service.items = Sub_Item_Logic.get_test_item_list(service,service,option);
221
211
  }
222
212
  return service;
223
213
  };
224
- static get_test_list=(option)=>{
225
- if(!option){
226
- option={service_count:10};
227
- }
228
- let item_list=[];
214
+ static get_test_list = (option) =>{
215
+ option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
216
+ let item_list = [];
229
217
  for(let a=0;a<option.service_count;a++){
230
- item_list.push(Service.get_test(option));
218
+ item_list.push(Service_Logic.get_test("Service "+String(parseInt(a+1))),option);
231
219
  }
232
220
  return item_list;
233
- };
221
+ }
234
222
  static get_test_list_by_category = (option) =>{
223
+ option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
235
224
  let service_list = [];
236
- let category_count = 9;
237
- let service_count = 19;
238
- if(!option){
239
- option={};
240
- }
241
- else{
242
- if(option.category_count){
243
- 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);
244
233
  }
245
- if(option.category_count){
246
- 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);
247
274
  }
248
275
  }
249
- 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);
250
310
  let item_count = 0;
251
311
  for(let a=0;a<category_list.length;a++){
252
- for(let b=0;b<service_count;b++){
312
+ for(let b=0;b<option.blog_post_count;b++){
253
313
  item_count++;
254
- let service = Service.get_test({item_count:0,service_count:service_count,get_value:false,get_item:false});
255
- service.category = category_list[Number.get_id(category_list.length-1)].title;
256
- 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);
257
317
  }
258
318
  }
259
- return [category_list,service_list]
319
+ return [category_list,blog_post_list]
260
320
  };
261
321
  }
262
322
  class Event_Logic {
263
- static get_test = (option) =>{
264
- if(!option){
265
- option = {item_count:9,get_value:false,get_item:false,value_count:20};
266
- }
267
- if(!option.item_count){
268
- option.item_count=10;
323
+ static get_test = (title,option) =>{
324
+ if(!title){
325
+ title = "Event " + Number.get_id();
326
+ option = {};
269
327
  }
328
+ option = Field_Logic.get_option(DataType.EVENT,option?option:{});
270
329
  let event = DataItem.get_new_full_item(
271
- DataItem.get_new(DataType.EVENT,Number.get_id()),
272
330
  DataItem.get_new(DataType.EVENT,0),
273
331
  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);
332
+ DataItem.get_new(DataType.EVENT,0),
333
+ Field_Logic.get_test(title,option));
276
334
  event.cost = String(Number.get_id()) + "." + String(Number.get_id());
277
335
  event.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
278
336
  event.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
@@ -283,78 +341,145 @@ class Event_Logic {
283
341
  event.stock = String(Number.get_id(3-1));
284
342
  event.category ="Category " + String(Number.get_id());
285
343
  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);
344
+ event.items = Sub_Item_Logic.get_test_item_list(event,event,option);
290
345
  }
291
346
  return event;
292
347
  };
293
- static get_test_list=(option)=>{
294
- if(!option){
295
- option={service_count:10};
296
- }
297
- let item_list=[];
348
+ static get_test_list = (option) =>{
349
+ option = Field_Logic.get_option(DataType.EVENT,option?option:{});
350
+ let item_list = [];
298
351
  for(let a=0;a<option.event_count;a++){
299
- item_list.push(Event_Logic.get_test(option));
352
+ item_list.push(Event_Logic.get_test("Event "+String(parseInt(a+1)),option));
300
353
  }
301
354
  return item_list;
302
- };
355
+ }
303
356
  static get_test_list_by_category = (option) =>{
357
+ option = Field_Logic.get_option(DataType.EVENT,option?option:{});
304
358
  let event_list = [];
305
- let category_count = 9;
306
- let event_count = 19;
307
- if(!option){
308
- option={};
309
- }
310
- else{
311
- if(option.category_count){
312
- category_count = parseInt(option.category_count);
313
- }
314
- if(option.category_count){
315
- event_count = parseInt(option.event_count);
316
- }
317
- }
318
- 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);
319
360
  let item_count = 0;
320
361
  for(let a=0;a<category_list.length;a++){
321
- for(let b=0;b<event_count;b++){
362
+ for(let b=0;b<option.event_count;b++){
322
363
  item_count++;
323
- let event = Event_Logic.get_test({item_count:0,event_count:event_count,get_value:false,get_item:false,value_count:20});
324
- 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;
325
366
  event_list.push(event);
326
367
  }
327
368
  }
328
369
  return [category_list,event_list]
329
370
  };
330
371
  }
331
- class Field {
372
+ class Field_Logic {
332
373
  static get_test = (title,option) =>{
333
374
  if(!title){
334
375
  title="";
376
+ option={};
335
377
  }
336
378
  if(!option){
337
- option={get_value:true,value_count:10};
379
+ option= {};
380
+ }
381
+ if(!option.category_title){
382
+ option.category_title = 'Category '+String(Number.get_id());
338
383
  }
339
384
  let item = {
340
- date_create:new moment().toISOString(),
341
- date_save:new moment().toISOString(),
342
385
  title:title,
343
386
  setting_visible:"1",
344
- photo_data:"images/no_img.jpg",
345
387
  title_url:Str.get_title_url(title),
346
- sub_note : "Sub Note "+String(Number.get_id()),
347
- note : "Note "+String(Number.get_id())
388
+ category:option.category_title,
389
+ sub_note:"Sub Note "+String(Number.get_id()),
390
+ note:"Note "+String(Number.get_id())
348
391
  }
349
392
  if(option.get_value){
350
- if(!option.value_count){
351
- option.value_count = 10;
393
+ item = Field_Logic.get_value_list(item,option);
394
+ }
395
+ return item;
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;
352
439
  }
353
- for(let b = 1;b<parseInt(option.value_count);b++){
354
- item['value_'+String(b)] = 'value ' + String(b);
440
+ }
441
+ if(option.data_type==DataType.PRODUCT){
442
+ if(!option.product_count){
443
+ option.product_count=9;
355
444
  }
356
445
  }
357
- return item;
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;
358
483
  }
359
484
  }
360
485
  class FieldType {
@@ -486,147 +611,72 @@ class DataType {
486
611
  static VIDEO='video_biz';
487
612
  }
488
613
  class Blank_Logic {
489
- static get_test = (option) =>{
490
- if(!option){
491
- option = {item_count:10,get_value:false,get_item:false,value_count:20};
492
- }
493
- if(!option.item_count){
494
- option.item_count=10;
614
+ static get_test = (title,option) =>{
615
+ if(!title){
616
+ title = "Blank " + Number.get_id();
617
+ option={};
495
618
  }
619
+ option = Field_Logic.get_option(DataType.BLANK,option?option:{});
496
620
  let blank = DataItem.get_new_full_item(
497
- DataItem.get_new(DataType.BLANK,Number.get_id()),
498
621
  DataItem.get_new(DataType.BLANK,0),
499
622
  DataItem.get_new(DataType.BLANK,0),
500
- Field.get_test("Blog Post "+Number.get_id(),option));
501
- blank.tag="tag 1,tag 2,tag 3";
502
- blank.category ="Category " + String(Number.get_id());
623
+ DataItem.get_new(DataType.BLANK,0),
624
+ Field_Logic.get_test(title,option));
503
625
  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);
626
+ blank.items = Sub_Item_Logic.get_test_item_list(blank,blank,option);
508
627
  }
509
628
  return blank;
510
629
  };
511
- static get_test_list=(option)=>{
512
- if(!option){
513
- option = {blank_count:10,get_value:false,get_item:false,value_count:20};
514
- }
515
- let item_list=[];
630
+ static get_test_list = (option) =>{
631
+ option = Field_Logic.get_option(DataType.BLANK,option?option:{});
632
+ let item_list = [];
516
633
  for(let a=0;a<option.blank_count;a++){
517
- item_list.push(Blank_Logic.get_test(option));
634
+ item_list.push(Blank_Logic.get_test("Blank " +String(parseInt(a+1)),option));
518
635
  }
519
636
  return item_list;
520
- };
637
+ }
521
638
  static get_test_list_by_category = (option) =>{
639
+ option = Field_Logic.get_option(DataType.BLANK,option?option:{});
522
640
  let blank_list = [];
523
- let category_count = 9;
524
- let blank_count = 19;
525
- if(!option){
526
- option={};
527
- }
528
- else{
529
- if(option.category_count){
530
- category_count = parseInt(option.category_count);
531
- }
532
- if(option.category_count){
533
- blank_count = parseInt(option.blank_count);
534
- }
535
- }
536
- 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);
537
642
  let item_count = 0;
538
643
  for(let a=0;a<category_list.length;a++){
539
- for(let b=0;b<blank_count;b++){
644
+ for(let b=0;b<option.blank_count;b++){
540
645
  item_count++;
541
- let blank = Blank_Logic.get_test({item_count:0,blank_count:blank_count,get_value:false,get_item:false,value_count:20});
542
- 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;
543
648
  blank_list.push(blank);
544
649
  }
545
650
  }
546
651
  return [category_list,blank_list]
547
652
  };
548
653
  }
549
-
550
- class Blog_Post_Logic {
551
- static get_test = (option) =>{
552
- if(!option){
553
- option = {item_count:10,get_value:false,get_item:false,value_count:20};
554
- }
555
- if(!option.item_count){
556
- option.item_count=10;
557
- }
558
- let blog_post = DataItem.get_new_full_item(
559
- DataItem.get_new(DataType.BLOG_POST,Number.get_id()),
560
- DataItem.get_new(DataType.BLOG_POST,0),
561
- DataItem.get_new(DataType.BLOG_POST,0),
562
- Field.get_test("Blog Post "+Number.get_id(),option));
563
- blog_post.author="First Name "+ Number.get_id();
564
- blog_post.tag="tag 1,tag 2,tag 3";
565
- blog_post.category ="Category " + String(Number.get_id());
566
- 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);
571
- }
572
- return blog_post;
573
- };
574
- static get_test_list=(option)=>{
575
- if(!option){
576
- option = {blog_post_count:10,get_value:false,get_item:false,value_count:20};
577
- }
578
- let item_list=[];
579
- for(let a=0;a<option.blog_post_count;a++){
580
- item_list.push(Blog_Post_Logic.get_test(option));
581
- }
582
- return item_list;
583
- };
584
- static get_test_list_by_category = (option) =>{
585
- let blog_post_list = [];
586
- let category_count = 9;
587
- let blog_post_count = 19;
588
- if(!option){
654
+ class Faq_Logic {
655
+ static get_test = (title,option) =>{
656
+ if(!title){
657
+ title = "Faq " + Number.get_id();
589
658
  option={};
590
659
  }
591
- else{
592
- if(option.category_count){
593
- category_count = parseInt(option.category_count);
594
- }
595
- if(option.category_count){
596
- blog_post_count = parseInt(option.blog_post_count);
597
- }
598
- }
599
- let category_list = Category_Logic.get_type_category_list(DataType.BLOG_POST,category_count);
600
- let item_count = 0;
601
- for(let a=0;a<category_list.length;a++){
602
- for(let b=0;b<blog_post_count;b++){
603
- item_count++;
604
- 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});
605
- blog_post.category = category_list[Number.get_id(category_list.length-1)].title;
606
- blog_post_list.push(blog_post);
607
- }
608
- }
609
- return [category_list,blog_post_list]
610
- };
611
- }
612
- class Faq_Logic {
613
- static get_test = () =>{
660
+ option = Field_Logic.get_option(DataType.FAQ,option?option:{});
661
+ option.get_value = false;
614
662
  let faq = DataItem.get_new_full_item(
615
- DataItem.get_new(DataType.FAQ,Number.get_id()),
616
663
  DataItem.get_new(DataType.FAQ,0),
617
664
  DataItem.get_new(DataType.FAQ,0),
618
- Field.get_test("Faq "+Number.get_id(),{get_value:false}));
619
- faq.question="What Is Title " + Number.get_id();
620
- 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
+
621
673
  return faq;
622
674
  };
623
675
  static get_test_list=(option)=>{
624
- if(!option){
625
- option = {faq_count:19};
626
- }
676
+ option = Field_Logic.get_option(DataType.FAQ,option?option:{});
627
677
  let item_list = [];
628
- for(let a=0;a<option.faq_count;a++){
629
- 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));
630
680
  }
631
681
  return item_list;
632
682
  };
@@ -639,7 +689,7 @@ class Review_Logic {
639
689
  DataItem.get_new(DataType.REVIEW,Number.get_id()),
640
690
  DataItem.get_new(DataType.REVIEW,0),
641
691
  DataItem.get_new(DataType.REVIEW,0),
642
- Field.get_test("Review "+Number.get_id(),{get_value:false}));
692
+ Field_Logic.get_test("Review "+Number.get_id(),{get_value:false}));
643
693
  review.email="ceo@biz"+String(Number.get_id())+".com";
644
694
  review.first_name="First Name "+ Number.get_id();
645
695
  review.last_name="Last Name "+ Number.get_id();
@@ -661,15 +711,15 @@ class Review_Logic {
661
711
  };
662
712
  }
663
713
  class Business_Logic {
664
- static get_new = () =>{
714
+ static get_new = (title) =>{
665
715
  if(!title){
666
- title="";
716
+ title="Business "+Number.get_id();
667
717
  }
668
718
  return DataItem.get_new_full_item(
669
719
  DataItem.get_new(DataType.BUSINESS,0),
670
720
  DataItem.get_new(DataType.BUSINESS,0),
671
721
  DataItem.get_new(DataType.BUSINESS,0),{
672
- title:"Business " + Number.get_id(),
722
+ title:title,
673
723
  email:"",
674
724
  phone:"",
675
725
  address_1:"",
@@ -684,15 +734,21 @@ class Business_Logic {
684
734
  twitter:""
685
735
  });
686
736
  };
687
- static get_test = () =>{
688
- 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);
689
745
  let city_list = ["Miami","Atlanta","Chicago","Seattle","New York City"];
690
746
  let state_list = ["Georgia","New York","Illinois","Washington","Flordia"];
691
747
  let business = DataItem.get_new_full_item(
692
748
  DataItem.get_new(DataType.BUSINESS,Number.get_id()),
693
749
  DataItem.get_new(DataType.BUSINESS,0),
694
750
  DataItem.get_new(DataType.BUSINESS,0),
695
- Field.get_test("Title "+Number.get_id()));
751
+ Field_Logic.get_test("Title "+Number.get_id()));
696
752
  item.email="ceo@business.com";
697
753
  item.phone="123-456-"+Number.get_id(3333);
698
754
  item.address_1=Number.get_id(99)+" Apple St.";
@@ -724,19 +780,19 @@ class Business_Logic {
724
780
  }
725
781
  }
726
782
  class DataItem {
727
- static get_new = (data_type,id,options) => {
728
- 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:{});
729
785
  };
730
- static get_new_full_item = (item,parent_item,top_item,options) => {
731
- 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:{});
732
788
  };
733
- static get_biz = (biz9_config,item,options)=>{
734
- 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:{});
735
791
  }
736
- static get_biz_by_list = (biz9_config,list,options)=>{
792
+ static get_biz_by_list = (biz9_config,list,option)=>{
737
793
  let r_list = [];
738
794
  for(let a=0;a<list.length;a++){
739
- 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));
740
796
  }
741
797
  return r_list;
742
798
  }
@@ -910,20 +966,23 @@ class Team_Url {
910
966
  };
911
967
  }
912
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
+ };
913
972
  static copy_item = (biz9_config,data_type,id) => {
914
- let action_url= "main/crud/copy/"+data_type + "/" + id;
973
+ let action_url = "main/crud/copy/"+data_type + "/" + id;
915
974
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
916
975
  };
917
976
  static delete_item = (biz9_config,data_type,id) => {
918
- let action_url= "main/crud/delete/"+data_type + "/" + id;
977
+ let action_url = "main/crud/delete/"+data_type + "/" + id;
919
978
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
920
979
  };
921
980
  static delete_item_check_protection = (biz9_config,data_type,id) => {
922
- let action_url= "main/crud/delete_item_check_protection/"+data_type + "/" + id;
981
+ let action_url = "main/crud/delete_item_check_protection/"+data_type + "/" + id;
923
982
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
924
983
  };
925
984
  static delete_list = (biz9_config,data_type) => {
926
- let action_url= "main/crud/delete_list/"+data_type;
985
+ let action_url = "main/crud/delete_list/"+data_type;
927
986
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
928
987
  };
929
988
  static get = (biz9_config,action_url,params) => {
@@ -933,28 +992,28 @@ class Url{
933
992
  let action_url= "main/crud/get/"+data_type + "/" + key;
934
993
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
935
994
  };
936
- static get_item_parent_top = (biz9_config,data_type,key) => {
937
- let action_url= "main/crud/get_item_parent_top/"+data_type + "/" + key;
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;
938
997
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
939
998
  };
940
999
  static get_list = (biz9_config,data_type) => {
941
- let action_url= "main/crud/get_list/"+data_type;
1000
+ let action_url = "main/crud/get_list/"+data_type;
942
1001
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
943
1002
  };
944
1003
  static upload_file = (biz9_config,data_type,id) => {
945
- let action_url= "main/crud/update/"+data_type + "/" + id;
1004
+ let action_url = "main/crud/update/"+data_type + "/" + id;
946
1005
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
947
1006
  };
948
1007
  static update_item = (biz9_config,data_type,id) => {
949
- let action_url= "main/crud/update/"+data_type + "/" + id;
1008
+ let action_url = "main/crud/update/"+data_type + "/" + id;
950
1009
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
951
1010
  };
952
1011
  static update_item_delete_cache = (biz9_config,data_type,id) => {
953
- let action_url= "main/crud/update_item_delete_cache/"+data_type + "/" + id;
1012
+ let action_url = "main/crud/update_item_delete_cache/"+data_type + "/" + id;
954
1013
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
955
1014
  };
956
1015
  static update_list = (biz9_config,data_type) => {
957
- let action_url= "main/crud/update_list/"+data_type;
1016
+ let action_url = "main/crud/update_list/"+data_type;
958
1017
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
959
1018
  };
960
1019
  }
@@ -964,37 +1023,40 @@ class Obj {
964
1023
  }
965
1024
  };
966
1025
  class Category_Logic {
967
- static get_test(option){
968
- if(!option){
969
- 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={};
970
1030
  }
1031
+ option = Field_Logic.get_option(DataType.CATEGORY,option?option:{});
971
1032
  let category = DataItem.get_new_full_item(
972
- DataItem.get_new(DataType.CATEGORY,Number.get_id()),
973
1033
  DataItem.get_new(DataType.CATEGORY,0),
974
1034
  DataItem.get_new(DataType.CATEGORY,0),
975
- Field.get_test("Category " +Number.get_id()));
976
- category.type = Category_Logic.get_category_list()[Number.get_id(Category_Logic.get_category_list().length-1)].data_type;
977
- return category;
978
- }
979
- static get_test_list = (option) => {
980
- if(!option){
981
- 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);
982
1039
  }
983
- 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 = [];
984
1045
  for(let a=0;a<option.category_count;a++){
985
- item_list.push(Category_Logic.get_test(option));
1046
+ item_list.push(Category_Logic.get_test("Category " +String(parseInt(a+1)),option));
986
1047
  }
987
1048
  return item_list;
988
- };
989
- 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);
990
1052
  let category_list = [];
991
- for(let a=0;a<count;a++){
1053
+ for(let a=0;a<option.category_count;a++){
992
1054
  let category = DataItem.get_new_full_item(
993
- DataItem.get_new(DataType.CATEGORY,"Category "+Number.get_id()),
994
1055
  DataItem.get_new(DataType.CATEGORY,0),
995
1056
  DataItem.get_new(DataType.CATEGORY,0),
996
- Field.get_test("Category " +Number.get_id(),{get_value:false}));
997
- 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;
998
1060
  category_list.push(category);
999
1061
  }
1000
1062
  return category_list;
@@ -1008,11 +1070,11 @@ class Category_Logic {
1008
1070
  };
1009
1071
  static get_category_list = () => {
1010
1072
  return [
1011
- {data_type:DataType.BLOG_POST,value:DataType.BLOG_POST,label:"Blog Posts"}, //
1012
- {data_type:DataType.CATEGORY,value:DataType.CATEGORY,label:"Category"}, //
1013
- {data_type:DataType.CONTENT,value:DataType.CONTENT,label:"Content"},//
1014
- {data_type:DataType.EVENT,value:DataType.EVENT,label:"Events"},//
1015
- {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"},
1016
1078
  {data_type:DataType.SERVICE,value:DataType.SERVICE,label:"Services"},
1017
1079
  {data_type:DataType.PRODUCT,value:DataType.PRODUCT,label:"Product"},
1018
1080
  {data_type:DataType.TEMPLATE,value:DataType.TEMPLATE,label:"Template"},
@@ -1295,73 +1357,54 @@ class Storage {
1295
1357
  window.localStorage.clear();
1296
1358
  }
1297
1359
  }
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 = [];
1360
+ class Sub_Item_Logic {
1361
+ static get_test(title,parent_item,top_item,option){
1362
+ if(option==null){
1363
+ option={get_value:true,value_count:9};
1313
1364
  }
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
- }
1365
+ if(option.item_count==null){
1366
+ option.item_count = 9;
1367
+ }
1368
+ if(option.get_value==null){
1369
+ option.get_value = true;
1370
+ }
1371
+ if(option.value_count==null){
1372
+ option.value_count = 9;
1373
+ }
1374
+ let item_title =title;
1375
+ let item = DataItem.get_new(
1376
+ DataType.ITEM,0, {
1377
+ top_id:top_item.id,
1378
+ top_data_type:top_item.data_type,
1379
+ parent_id:parent_item.id,
1380
+ parent_data_type:parent_item.data_type,
1381
+ title:item_title,
1382
+ title_url:Str.get_title_url(item_title),
1383
+ sub_note:"Sub Note "+String(Number.get_id()),
1384
+ note:"Note "+String(Number.get_id()),
1325
1385
  }
1386
+ );
1387
+ if(option.get_value){
1388
+ item = Field_Logic.get_value_list(item,option);
1326
1389
  }
1327
1390
  return item;
1328
1391
  }
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
- }
1392
+ static get_test_item_list(parent_item,top_item,option){
1393
+ let new_list = [];
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));
1341
1397
  }
1342
- if(!item.items){
1343
- item.items = [];
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));
1344
1405
  }
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);
1361
- }
1362
- return item;
1363
- };
1364
- };
1406
+ return new_list;
1407
+ }
1365
1408
  }
1366
1409
  module.exports = {
1367
1410
  Business_Logic,
@@ -1372,17 +1415,18 @@ module.exports = {
1372
1415
  Category_Logic,
1373
1416
  Category_Url,
1374
1417
  Content_Url,
1418
+ Content_Logic,
1375
1419
  Custom_Field_Url,
1376
1420
  CMS,
1377
1421
  DataItem,
1378
1422
  DataType,
1379
1423
  Event_Url,
1380
- Field,
1424
+ Field_Logic,
1381
1425
  FieldType,
1382
1426
  Faq_Logic,
1383
1427
  Gallery_Url,
1384
- Event_Logic,
1385
1428
  Item_Logic,
1429
+ Event_Logic,
1386
1430
  Message,
1387
1431
  Obj,
1388
1432
  Page_Logic,
@@ -1390,14 +1434,15 @@ module.exports = {
1390
1434
  PageType,
1391
1435
  Product_Logic,
1392
1436
  Review_Logic,
1393
- TemplateType,
1394
- Template_Logic,
1395
- Url,
1396
1437
  Service_Logic,
1397
1438
  Service_Url,
1398
1439
  Social,
1399
- Sub_Item,
1440
+ Sub_Item_Logic,
1400
1441
  Storage,
1401
1442
  Schedule,
1402
1443
  Stock,
1444
+ TemplateType,
1445
+ Team_Logic,
1446
+ Template_Logic,
1447
+ Url,
1403
1448
  };