biz9-logic 10.0.29 → 10.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -5,8 +5,7 @@ License GNU General Public License v3.0
5
5
  Description: BiZ9 Framework: Logic-JS
6
6
  */
7
7
  const moment = require('moment');
8
- const { get_new_item_main,get_data_config_main,get_cloud_url_main,get_biz_item_main,get_cloud_filter_obj_main,get_new_full_item_main } = require('./main');
9
- const { Log,Str,DateTime,Num,Obj } = require('biz9-utility');
8
+ const {Str,Num,Obj} = require('biz9-utility');
10
9
  class Message {
11
10
  static SUCCESS="Success";
12
11
  static CONFIRM="Are You Sure?";
@@ -32,178 +31,6 @@ class Message {
32
31
  static REVIEW_REMOVE_SUCCESS="Review Remove Success.";
33
32
  static REVIEW_USER_LOGIN="Please Login To Add Review.";
34
33
  }
35
- class Item_Logic {
36
- static get_new = (title,data_type,option)=>{
37
- option = option ? option : {};
38
- const item = DataItem.get_new(data_type,0,{title:title,title_url:Str.get_title_url(title),setting_visible:"1"});
39
- return item;
40
- };
41
- static copy = (data_type,item)=>{
42
- let copy_item = DataItem.get_new(data_type,0);
43
- const keys = Object.keys(item);
44
- keys.forEach(key => {
45
- if(
46
- key!=Type.FIELD_ID&&
47
- key!=Type.FIELD_SOURCE&&
48
- key!=Type.FIELD_TITLE&&
49
- key!=Type.FIELD_TITLE_URL&&
50
- key!=Type.FIELD_DATE_CREATE&&
51
- key!=Type.FIELD_DATE_SAVE&&
52
- key!=Type.TITLE_OBJ&&
53
- key!=Type.TITLE_USER&&
54
- key!=Type.TITLE_GROUP&&
55
- key!=Type.TITLE_ITEM&&
56
- !Obj.check_is_array(item[key])&&
57
- Obj.check_is_value(item[key])
58
- ){
59
- copy_item[key]=item[key];
60
- }
61
- });
62
- return copy_item;
63
- };
64
- static bind_child_parent_obj = (child_obj,parent_obj)=>{
65
- for(const prop in parent_obj) {
66
- child_obj['parent_'+prop] = parent_obj[prop];
67
- }
68
- return child_obj;
69
- };
70
- static get_test = (title,data_type,id,option)=>{
71
- data_type = data_type ? data_type : Type.DATA_BLANK;
72
- id = id ? id : 0;
73
- option = Field_Logic.get_option(data_type,option?option:{});
74
- let item = DataItem.get_new(data_type,0,Field_Logic.get_test(title,option));
75
- if(option.get_item){
76
- item.items = Sub_Item_Logic.get_test_items(item,item,option);
77
- item = Sub_Item_Logic.bind_parent_child_items(item,item.items);
78
- }
79
- return item;
80
- }
81
- static get_test_items = (data_type,option) =>{
82
- option = Field_Logic.get_option(data_type,option?option:{});
83
- let items = [];
84
- for(let a=0;a<parseInt(option.item_count)+1;a++){
85
- items.push(Item_Logic.get_test("Item " +String(parseInt(a+1)),data_type,option));
86
- }
87
- return items;
88
- }
89
- }
90
- class Title {
91
- //page
92
- static PAGE_ABOUT='About';
93
- static PAGE_BLOG_POST='Blog Post';
94
- static PAGE_BLOG_POST_HOME='Blog Post Home';
95
- static PAGE_CONTACT='Contact';
96
- static PAGE_EVENT='Event';
97
- static PAGE_EVENT_HOME='Event Home';
98
- static PAGE_FAQ='FAQs';
99
- static PAGE_GALLERY='Gallery';
100
- static PAGE_GALLERY_HOME='Gallery Home';
101
- static PAGE_HOME='Home';
102
- static PAGE_LOGIN='Login';
103
- static PAGE_PRODUCT='Product';
104
- static PAGE_PRODUCT_HOME='Product Home';
105
- static PAGE_SERVICE='Service';
106
- static PAGE_SERVICE_HOME='Service Home';
107
- static PAGE_REGISTER='Register';
108
- static PAGE_REVIEW_HOME='Review Home';
109
- //order
110
- static ORDER_NUMBER="OR-";
111
- static ORDER_TRANSACTION_ID="TR-";
112
- static ORDER_STATUS_CANCELLED="Cancelled";
113
- static ORDER_STATUS_COMPLETE="Complete";
114
- static ORDER_STATUS_NEW="New";
115
- static ORDER_STATUS_OPEN="Open";
116
- static ORDER_STATUS_ON_HOLD="On Hold";
117
- static ORDER_STATUS_RETURNED="Returned";
118
- static ORDER_PAYMENT_PLAN_NEW="New";
119
- static ORDER_PAYMENT_PLAN_1="1 Payment";
120
- static ORDER_PAYMENT_PLAN_2="2 Payments";
121
- static ORDER_PAYMENT_PLAN_3="3 Payments";
122
- static ORDER_PAYMENT_PLAN_4="4 Payments";
123
- static ORDER_PAYMENT_METHOD_STRIPE="Stripe";
124
- static ORDER_PAYMENT_METHOD_CASH="Cash";
125
- static ORDER_PAYMENT_METHOD_OTHER="Other";
126
- static ORDER_PAYMENT_METHOD_TEST="Test";
127
- //cart
128
- static CART_NUMBER="CA-";
129
- //role
130
- static USER_ROLE_SUPER_ADMIN='Super Admin';
131
- static USER_ROLE_ADMIN='Admin';
132
- static USER_ROLE_MANAGER='Manager';
133
- static USER_ROLE_USER='User';
134
- static USER_ROLE_GUEST='Guest';
135
- //app
136
- static APP_MOBILE="Mobile";
137
- static APP_WEBSITE="Website";
138
- static APP_LANDING="Landing";
139
- //social
140
- static SOCIAL_URL_FACEBOOK="https://facebook.com/";
141
- static SOCIAL_URL_TWITTER="https://twitter.com/";
142
- static SOCIAL_URL_INSTAGRAM="https://instagram.com/";
143
- static SOCIAL_URL_YOUTUBE="https://youtube.com/";
144
- static SOCIAL_URL_LINKEDIN="https://linkedin.com/";
145
- //str
146
- static CATEGORY='Category';
147
- static DESCRIPTION='Description';
148
- static TYPE='Type';
149
- }
150
- class Demo_Logic {
151
- static get_new_type = (title,option) => {
152
- title = !Str.check_is_null(title)?title:Title.TYPE+" " +Num.get_id(999);
153
- option = option ? option : {get_category:false,category_count:6,categorys:'',category_data_type:Type.DATA_BLANK,get_item:false,items:'',item_data_type:Type.DATA_BLANK,item_count:6}; const item = Item_Logic.get_new(title,Type.DATA_TYPE); //category
154
- if(option.get_category){
155
- item.categorys = [];
156
- let category_titles = [];
157
- if(option.categorys){
158
- category_titles = option.categorys.split(',');
159
- option.category_count = category_titles.length;
160
- }else{
161
- if(!option.category_count){
162
- option.category_count = 1;
163
- }
164
- for(let a = 1;a<parseInt(option.category_count)+1;a++){
165
- category_titles.push(Title.CATEGORY+" "+a);
166
- }
167
- }
168
- category_titles.forEach(cat_item => {
169
- item.categorys.push(Category_Logic.get_new(cat_item,item.title,option.category_data_type));
170
- });
171
- }
172
- //item
173
- if(option.get_item){
174
- let full_items = [];
175
-
176
- let item_titles = [];
177
- if(option.items){
178
- item_titles = option.items.split(',');
179
- option.item_count = item_titles.length;
180
- }else{
181
- for(let b = 1;b<parseInt(option.item_count)+1;b++){
182
- item_titles.push(title+" " +Type.get_title(item.categorys[Num.get_id(option.category_count)].category)+" "+ b);
183
- }
184
- }
185
- for(const child_item_title of item_titles){
186
- const cat_item = item.categorys[Num.get_id(option.category_count)];
187
- if(!cat_item.items){
188
- cat_item.items = [];
189
- }
190
- let child_item = Item_Logic.get_new(child_item_title,option.item_data_type);
191
- if(option.item_data_type == Type.DATA_PRODUCT){
192
- child_item.cost = Num.get_id(9000);
193
- child_item.old_cost = Num.get_id(90000);
194
- }
195
- child_item.type = cat_item.type;
196
- child_item.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
197
- child_item.category = cat_item.title;
198
- child_item.description =Title.DESCRIPTION+" "+ String(Num.get_id());
199
- child_item.note = Field_Logic.get_test_note(),
200
- cat_item.items.push(child_item);
201
- full_items.push(child_item);
202
- }
203
- }
204
- return item;
205
- };
206
- }
207
34
  class Type {
208
35
  //app_status
209
36
  static APP_ENV_TEST='test';
@@ -213,7 +40,6 @@ class Type {
213
40
  static APP_LINK_TYPE_GOOGLE_PLAY='google_play';
214
41
  static APP_LINK_TYPE_APPLE_STORE='apple_store';
215
42
  static APP_LINK_TYPE_CMS='cms';
216
-
217
43
  //data
218
44
  static DATA_APP='app_biz';
219
45
  static DATA_BLANK='blank_biz';
@@ -232,7 +58,6 @@ class Type {
232
58
  static DATA_FILE='file_biz';
233
59
  static DATA_GALLERY='gallery_biz';
234
60
  static DATA_IMAGE='image_biz';
235
- static DATA_ITEM='item_biz';
236
61
  static DATA_LINK='link_biz';
237
62
  static DATA_ORDER="order_biz";
238
63
  static DATA_ORDER_ITEM="order_item_biz";
@@ -248,25 +73,24 @@ class Type {
248
73
  static DATA_TYPE='type_biz';
249
74
  static DATA_USER='user_biz';
250
75
  static DATA_VIDEO='video_biz';
251
-
252
76
  //field
253
- static FIELD_AUTHOR = 'author';
254
- static FIELD_CATEGORY = 'category';
255
- static FIELD_CATEGORY_TYPE = 'category_type';
256
- static FIELD_COST = 'cost';
77
+ static FIELD_AUTHOR = 'author';
78
+ static FIELD_CATEGORY = 'category';
79
+ static FIELD_CATEGORY_TYPE = 'category_type';
80
+ static FIELD_COST = 'cost';
257
81
  static FIELD_DATA_TYPE='data_type';
258
82
  static FIELD_DATE_CREATE='date_create';
259
83
  static FIELD_DATE_SAVE='date_save';
260
84
  static FIELD_DATE = 'date';
261
- static FIELD_DESCRIPTION = 'description';
262
- static FIELD_EDIT_LOCATION = 'edit_location';
85
+ static FIELD_DESCRIPTION = 'description';
86
+ static FIELD_EDIT_LOCATION = 'edit_location';
263
87
  static FIELD_ID='id';
264
- static FIELD_IMAGE_FILENAME = 'image_filename';
265
- static FIELD_LOCATION = 'location';
266
- static FIELD_MEETING_LINK = 'meeting_link';
267
- static FIELD_NOTE = 'note';
268
- static FIELD_OLD_COST = 'old_cost';
269
- static FIELD_PARAM = 'param';
88
+ static FIELD_IMAGE_FILENAME = 'image_filename';
89
+ static FIELD_LOCATION = 'location';
90
+ static FIELD_MEETING_LINK = 'meeting_link';
91
+ static FIELD_NOTE = 'note';
92
+ static FIELD_OLD_COST = 'old_cost';
93
+ static FIELD_PARAM = 'param';
270
94
  static FIELD_PARENT_DATA_TYPE='parent_data_type';
271
95
  static FIELD_PARENT_ID='parent_id';
272
96
  static FIELD_ROLE = 'role';
@@ -275,48 +99,114 @@ class Type {
275
99
  static FIELD_SOURCE_KEY='source_key';
276
100
  static FIELD_SOURCE_ID='source_id';
277
101
  static FIELD_SOURCE_PARENT_ID='source_parent_id';
278
- static FIELD_SETTING_VISIBLE = 'setting_visible';
279
- static FIELD_SETTING_DELETE_PROTECTION = 'setting_delete_protection';
280
- static FIELD_SETTING_SORT_TYPE = 'setting_delete_sort_type';
281
- static FIELD_STOCK = 'stock';
282
- static FIELD_TAG = 'tag';
283
- static FIELD_TIME = 'time';
284
- static FIELD_TITLE='title';
102
+ static FIELD_SETTING_VISIBLE = 'setting_visible';
103
+ static FIELD_SETTING_DELETE_PROTECTION = 'setting_delete_protection';
104
+ static FIELD_SETTING_SORT_TYPE = 'setting_delete_sort_type';
105
+ static FIELD_STOCK = 'stock';
106
+ static FIELD_TAG = 'tag';
107
+ static FIELD_TIME = 'time';
108
+ static FIELD_TITLE='title';
285
109
  static FIELD_TITLE_URL='title_url';
286
- static FIELD_TYPE = 'type';
287
- static FIELD_URL = 'url';
288
- static FIELD_USER_CITY = 'city';
289
- static FIELD_USER_COUNTRY = 'country';
290
- static FIELD_USER_EMAIL = 'email';
291
- static FIELD_USER_FIRST_NAME = 'first_name';
292
- static FIELD_USER_GENDER = 'gender';
110
+ static FIELD_TYPE = 'type';
111
+ static FIELD_URL = 'url';
112
+ static FIELD_USER_CITY = 'city';
113
+ static FIELD_USER_COUNTRY = 'country';
114
+ static FIELD_USER_EMAIL = 'email';
115
+ static FIELD_USER_FIRST_NAME = 'first_name';
116
+ static FIELD_USER_GENDER = 'gender';
293
117
  static FIELD_USER_ID='user_id';
294
- static FIELD_USER_LAST_NAME = 'last_name';
295
- static FIELD_USER_USERNAME = 'username';
296
- static FIELD_USER_PASSWORD = 'password';
297
- static FIELD_USER_STATE = 'state';
298
- static FIELD_VALUE = 'value';
299
- static FIELD_WEBSITE = 'website';
118
+ static FIELD_USER_LAST_NAME = 'last_name';
119
+ static FIELD_USER_USERNAME = 'username';
120
+ static FIELD_USER_PASSWORD = 'password';
121
+ static FIELD_USER_STATE = 'state';
122
+ static FIELD_VALUE = 'value';
123
+ static FIELD_WEBSITE = 'website';
124
+ static FIELD_RESULT_OK = 'resultOK';
125
+ static FIELD_RESULT_OK_DELETE = 'delete_resultOK';
126
+ static FIELD_RESULT_OK_DELETE_CACHE = 'delete_cache_resultOK';
127
+ static FIELD_RESULT_OK_DELETE_DATABASE = 'delete_database_resultOK';
128
+ static FIELD_RESULT_OK_EMAIL = 'email_resultOK';
129
+ static FIELD_RESULT_OK_USER = 'user_resultOK';
130
+ static FIELD_RESULT_OK_UNIQUE = 'unique_resultOK';
131
+ static FIELD_RESULT_OK_FAVORITE_ADD = 'favorite_resultOK';
132
+ static FIELD_RESULT_OK_GROUP_DELETE = 'group_delete_resultOK';
133
+ static FIELD_RESULT_OK_IMAGE_DELETE = 'image_delete_resultOK';
300
134
  //title
301
- static TITLE_BLANK='blank';
302
- static TITLE_CART_ITEMS='cart_items';
303
- static TITLE_CART_SUB_ITEMS='cart_sub_items';
304
- static TITLE_CART_ITEMS='cart_items';
305
- static TITLE_CART_SUB_ITEMS='cart_sub_items';
306
- static TITLE_COUNT='count';
307
- static TITLE_GROUP='group';
308
- static TITLE_N_A='n/a';
309
- static TITLE_IMAGES='images';
310
- static TITLE_ITEMS='items';
311
- static TITLE_OBJ='obj';
312
- static TITLE_ORDER_ITEMS='order_items';
313
- static TITLE_ORDER_SUB_ITEMS='order_sub_items';
314
- static TITLE_PARENT_ITEM='parent_item';
315
- static TITLE_USER='user';
316
- static TITLE_SORT_BY_ASC='asc';
317
- static TITLE_SORT_BY_DESC='desc';
318
- static TITLE_STAT_ITEMS='stat_items';
319
- static TITLE_STAT_SUB_ITEMS='stat_items';
135
+ static TITLE_DATA_BLOG_POST = 'Blog Post';
136
+ static TITLE_DATA_CATEGORY = 'Category';
137
+ static TITLE_DATA_CONTENT = 'Content';
138
+ static TITLE_DATA_EVENT = 'Event';
139
+ static TITLE_DATA_FAQ = 'Faq';
140
+ static TITLE_DATA_GALLERY = 'Gallery';
141
+ static TITLE_DATA_USER = 'User';
142
+ static TITLE_DATA_PAGE = 'Page';
143
+ static TITLE_DATA_PRODUCT = 'Product';
144
+ static TITLE_DATA_SERVICE = 'Service';
145
+ //
146
+ static TITLE_APP_ENV_TEST='Test';
147
+ static TITLE_APP_ENV_STAGE='Stage';
148
+ static TITLE_APP_ENV_PROD='Production';
149
+ static TITLE_APP_LINK_TYPE_WEBSITE='Website';
150
+ static TITLE_APP_LINK_TYPE_GOOGLE_PLAY='Google Play';
151
+ static TITLE_APP_LINK_TYPE_APPLE_STORE='Apple Store';
152
+ static TITLE_APP_LINK_TYPE_CMS='CMS';
153
+ //
154
+ static TITLE_BLANK='Blank';
155
+ static TITLE_CART_ITEMS='Cart Items';
156
+ static TITLE_CART_SUB_ITEMS='Cart Sub Items';
157
+ static TITLE_CART_ITEMS='Cart Items';
158
+ static TITLE_CART_SUB_ITEMS='Cart Sub Items';
159
+ static TITLE_COUNT='Count';
160
+ static TITLE_GROUP='Group';
161
+ static TITLE_N_A='N/A';
162
+ static TITLE_IMAGES='Images';
163
+ static TITLE_ITEMS='Items';
164
+ static TITLE_ONE='One';
165
+ static TITLE_ORDER_ITEMS='Order Items';
166
+ static TITLE_ORDER_SUB_ITEMS='order Sub Items';
167
+ static TITLE_PARENT_ITEM='Parent Item';
168
+ static TITLE_USER='User';
169
+ static TITLE_SORT_BY_ASC='ASC';
170
+ static TITLE_SORT_BY_DESC='DESC';
171
+ static TITLE_STAT_ITEMS='Stat Items';
172
+ static TITLE_STAT_SUB_ITEMS='Stat Sub Items';
173
+ static TITLE_ORDER_STATUS_NEW="New";
174
+ static TITLE_ORDER_STATUS_OPEN="Open";
175
+ static TITLE_ORDER_STATUS_COMPLETE="Complete";
176
+ static TITLE_ORDER_STATUS_RETURNED="Returned";
177
+ static TITLE_ORDER_STATUS_ON_HOLD="On Hold";
178
+ static TITLE_ORDER_STATUS_CANCELLED="Cancelled";
179
+ static TITLE_USER_ROLE_SUPER_ADMIN='Super Admin';
180
+ static TITLE_USER_ROLE_ADMIN='Admin';
181
+ static TITLE_USER_ROLE_MANAGER='Manager';
182
+ static TITLE_USER_ROLE_USER='User';
183
+ static TITLE_USER_ROLE_GUEST='Guest';
184
+ static TITLE_PAGE_ABOUT='About';
185
+ static TITLE_PAGE_CONTACT='Contact';
186
+ static TITLE_PAGE_HOME='Home';
187
+ static TITLE_PAGE_FAQ='Faq';
188
+ static TITLE_PAGE_BLOG_POST='Blog Post';
189
+ static TITLE_PAGE_BLOG_POST_HOME='Blog Post Home';
190
+ static TITLE_PAGE_BLOG_POST_SEARCH='Blog Post Search';
191
+ static TITLE_PAGE_EVENT='Event';
192
+ static TITLE_PAGE_EVENT_HOME='Event Home';
193
+ static TITLE_PAGE_EVENT_SEARCH='Event Search';
194
+ static TITLE_PAGE_GALLERY='Gallery';
195
+ static TITLE_PAGE_GALLERY_HOME='Gallery Home';
196
+ static TITLE_PAGE_GALLERY_SEARCH='Gallery Search';
197
+ static TITLE_PAGE_LOGIN='Login';
198
+ static TITLE_PAGE_PRODUCT='Product';
199
+ static TITLE_PAGE_PRODUCT_HOME='Product Home';
200
+ static TITLE_PAGE_PRODUCT_SEARCH='Product Search';
201
+ static TITLE_PAGE_REGISTER='Register';
202
+ static TITLE_PAGE_REVIEW_HOME='Review Home';
203
+ static TITLE_PAGE_SERVICE='Service';
204
+ static TITLE_PAGE_SERVICE_HOME='Service Home';
205
+ static TITLE_PAGE_SERVICE_SEARCH='Service Search';
206
+ static TITLE_SOURCE_DATABASE='Database';
207
+ static TITLE_SOURCE_CACHE='Cache';
208
+ static TITLE_SOURCE_NOT_FOUND='Not-Found';
209
+
320
210
  //page
321
211
  static PAGE_ABOUT='about';
322
212
  static PAGE_CONTACT='contact';
@@ -401,215 +291,95 @@ class Type {
401
291
  static ORDER_STATUS_RETURNED="returned";
402
292
  static ORDER_STATUS_ON_HOLD="on_hold";
403
293
  static ORDER_STATUS_CANCELLED="cancelled";
294
+ //app
295
+ static APP_MOBILE="Mobile";
296
+ static APP_WEBSITE="Website";
297
+ static APP_LANDING="Landing";
298
+ //social
299
+ static SOCIAL_URL_FACEBOOK="https://facebook.com/";
300
+ static SOCIAL_URL_TWITTER="https://twitter.com/";
301
+ static SOCIAL_URL_INSTAGRAM="https://instagram.com/";
302
+ static SOCIAL_URL_YOUTUBE="https://youtube.com/";
303
+ static SOCIAL_URL_LINKEDIN="https://linkedin.com/";
304
+ //str
305
+ static CATEGORY='Category';
306
+ static DESCRIPTION='Description';
307
+ static TYPE='Type';
404
308
  static get_order_statuses(){
405
309
  return [
406
- {value:Type.ORDER_STATUS_NEW,label:Title.ORDER_STATUS_NEW},
407
- {value:Type.ORDER_STATUS_OPEN,label:Title.ORDER_STATUS_OPEN},
408
- {value:Type.ORDER_STATUS_COMPLETE,label:Title.ORDER_STATUS_COMPLETE},
409
- {value:Type.ORDER_STATUS_RETURNED,label:Title.ORDER_STATUS_RETURNED},
410
- {value:Type.ORDER_STATUS_ON_HOLD,label:Title.ORDER_STATUS_ON_HOLD},
411
- {value:Type.ORDER_STATUS_CANCELLED,label:Title.ORDER_STATUS_CANCELLED},
310
+ {value:Type.ORDER_STATUS_NEW,label:Type.TITLE_ORDER_STATUS_NEW,title:Type.TITLE_ORDER_STATUS_NEW},
311
+ {value:Type.ORDER_STATUS_OPEN,label:Type.TITLE_ORDER_STATUS_OPEN,title:Type.TITLE_ORDER_STATUS_OPEN},
312
+ {value:Type.ORDER_STATUS_COMPLETE,label:Type.TITLE_ORDER_STATUS_COMPLETE,title:Type.TITLE_ORDER_STATUS_COMPLETE},
313
+ {value:Type.ORDER_STATUS_RETURNED,label:Type.TITLE_ORDER_STATUS_RETURNED,title:Type.TITLE_ORDER_STATUS_RETURNED},
314
+ {value:Type.ORDER_STATUS_ON_HOLD,label:Type.TITLE_ORDER_STATUS_ON_HOLD,title:Type.TITLE_ORDER_STATUS_ON_HOLD},
315
+ {value:Type.ORDER_STATUS_CANCELLED,label:Type.TITLE_ORDER_STATUS_CANCELLED,title:Type.TITLE_ORDER_STATUS_CANCELLED},
412
316
  ];
413
317
  };
414
318
  static get_user_roles(){
415
319
  return [
416
- {value:Type.USER_ROLE_ADMIN,label:Title.USER_ROLE_ADMIN},
417
- {value:Type.USER_ROLE_MANAGER,label:Title.USER_ROLE_MANAGER},
418
- {value:Type.USER_ROLE_USER,label:Title.USER_ROLE_USER},
419
- {value:Type.USER_ROLE_GUEST,label:Title.USER_ROLE_GUEST},
320
+ {value:Type.USER_ROLE_ADMIN,label:Type.TITLE_USER_ROLE_ADMIN,title:Type.TITLE_USER_ROLE_ADMIN},
321
+ {value:Type.USER_ROLE_MANAGER,label:Type.TITLE_USER_ROLE_MANAGER,title:Type.TITLE_USER_ROLE_MANAGER},
322
+ {value:Type.USER_ROLE_USER,label:Type.TITLE_USER_ROLE_USER,title:Type.TITLE_USER_ROLE_USER},
323
+ {value:Type.USER_ROLE_GUEST,label:Type.TITLE_USER_ROLE_GUEST,title:Type.TITLE_USER_ROLE_GUEST},
420
324
  ];
421
325
  };
422
326
  static get_pages(){
423
327
  return [
424
- {value:Type.PAGE_ABOUT,label:Title.PAGE_ABOUT,url:Url.PAGE_ABOUT},
425
- {value:Type.PAGE_BLOG_POST,label:Title.PAGE_BLOG_POST,url:Url.PAGE_BLOG_POST},
426
- {value:Type.PAGE_BLOG_POST_HOME,label:Title.PAGE_BLOG_POST_HOME,url:Url.PAGE_BLOG_POST_HOME},
427
- {value:Type.PAGE_CONTACT,label:Title.PAGE_CONTACT,label:Title.PAGE_CONTACT,url:Url.PAGE_CONTACT},
428
- {value:Type.PAGE_EVENT,label:Title.PAGE_EVENT,url:Url.PAGE_EVENT},
429
- {value:Type.PAGE_EVENT_HOME,label:Title.PAGE_EVENT_HOME,url:Url.PAGE_EVENT_HOME},
430
- {value:Type.PAGE_FAQ,label:Title.PAGE_FAQ,url:Url.PAGE_FAQ},
431
- {value:Type.PAGE_HOME,label:Title.PAGE_HOME,url:Url.PAGE_HOME},
432
- {value:Type.PAGE_GALLERY,label:Title.PAGE_GALLERY,url:Url.PAGE_GALLERY},
433
- {value:Type.PAGE_GALLERY_HOME,label:Title.PAGE_GALLERY_HOME,url:Url.PAGE_GALLERY_HOME},
434
- {value:Type.PAGE_LOGIN,label:Title.PAGE_LOGIN,url:Url.PAGE_LOGIN},
435
- {value:Type.PAGE_PRODUCT,label:Title.PAGE_PRODUCT,url:Url.PAGE_PRODUCT},
436
- {value:Type.PAGE_PRODUCT_HOME,label:Title.PAGE_PRODUCT_HOME,url:Url.PAGE_PRODUCT_HOME},
437
- {value:Type.PAGE_REGISTER,label:Title.PAGE_REGISTER,url:Url.PAGE_REGISTER},
438
- {value:Type.PAGE_REVIEW_HOME,label:Title.PAGE_REVIEW_HOME,url:Url.PAGE_REVIEW_HOME},
439
- {value:Type.PAGE_SERVICE,label:Title.PAGE_SERVICE,url:Url.PAGE_SERVICE},
440
- {value:Type.PAGE_SERVICE_HOME,label:Title.PAGE_SERVICE_HOME,url:Url.PAGE_SERVICE_HOME},
328
+ {value:Type.PAGE_ABOUT,title:Type.TITLE_PAGE_ABOUT,label:Type.TITLE_PAGE_ABOUT,url:Url.PAGE_ABOUT},
329
+ {value:Type.PAGE_BLOG_POST,title:Type.TITLE_PAGE_BLOG_POST,label:Type.TITLE_PAGE_BLOG_POST,url:Url.PAGE_BLOG_POST},
330
+ {value:Type.PAGE_BLOG_POST_HOME,title:Type.TITLE_PAGE_BLOG_POST_HOME,label:Type.TITLE_PAGE_BLOG_POST_HOME,url:Url.PAGE_BLOG_POST_HOME},
331
+ {value:Type.PAGE_CONTACT,title:Type.TITLE_PAGE_CONTACT,label:Type.TITLE_PAGE_CONTACT,url:Url.PAGE_CONTACT},
332
+ {value:Type.PAGE_EVENT,title:Type.TITLE_PAGE_EVENT,label:Type.TITLE_PAGE_EVENT,url:Url.PAGE_EVENT},
333
+ {value:Type.PAGE_EVENT_HOME,title:Type.TITLE_PAGE_EVENT_HOME,label:Type.TITLE_PAGE_EVENT_HOME,url:Url.PAGE_EVENT_HOME},
334
+ {value:Type.PAGE_FAQ,title:Type.TITLE_PAGE_FAQ,label:Type.TITLE_PAGE_FAQ,url:Url.PAGE_FAQ},
335
+ {value:Type.PAGE_HOME,title:Type.TITLE_PAGE_HOME,label:Type.TITLE_PAGE_HOME,url:Url.PAGE_HOME},
336
+ {value:Type.PAGE_GALLERY,title:Type.TITLE_PAGE_GALLERY,label:Type.TITLE_PAGE_GALLERY,url:Url.PAGE_GALLERY},
337
+ {value:Type.PAGE_GALLERY_HOME,title:Type.TITLE_PAGE_GALLERY_HOME,label:Type.TITLE_PAGE_GALLERY_HOME,url:Url.PAGE_GALLERY_HOME},
338
+ {value:Type.PAGE_LOGIN,title:Type.TITLE_PAGE_LOGIN,label:Type.TITLE_PAGE_LOGIN,url:Url.PAGE_LOGIN},
339
+ {value:Type.PAGE_PRODUCT,title:Type.TITLE_PAGE_PRODUCT,label:Type.TITLE_PAGE_PRODUCT,url:Url.PAGE_PRODUCT},
340
+ {value:Type.PAGE_PRODUCT_HOME,title:Type.TITLE_PAGE_PRODUCT_HOME,label:Type.TITLE_PAGE_PRODUCT_HOME,url:Url.PAGE_PRODUCT_HOME},
341
+ {value:Type.PAGE_REGISTER,title:Type.TITLE_PAGE_REGISTER,label:Type.TITLE_PAGE_REGISTER,url:Url.REGISTER},
342
+ {value:Type.PAGE_REVIEW_HOME,title:Type.TITLE_PAGE_REVIEW_HOME,label:Type.TITLE_PAGE_REVIEW_HOME,url:Url.PAGE_REVIEW_HOME},
343
+ {value:Type.PAGE_SERVICE,title:Type.TITLE_PAGE_SERVICE,label:Type.TITLE_PAGE_SERVICE,url:Url.PAGE_SERVICE},
344
+ {value:Type.PAGE_SERVICE_HOME,title:Type.TITLE_PAGE_SERVICE_HOME,label:Type.TITLE_PAGE_SERVICE_HOME,url:Url.PAGE_SERVICE_HOME},
441
345
  ];
442
346
  };
443
347
  static get_stat_types = () =>{
444
348
  return [
445
- {title:Type.get_title(Type.STAT_CART),type:Type.STAT_CART,label:Type.get_title(Type.STAT_CART),value:Type.STAT_CART},
446
- {title:Type.get_title(Type.STAT_CART_ITEM),type:Type.STAT_CART_ITEM,label:Type.get_title(Type.STAT_CART_ITEM),value:Type.STAT_CART_ITEM},
447
- {title:Type.get_title(Type.STAT_CART_SUB_ITEM),type:Type.STAT_CART_SUB_ITEM,label:Type.get_title(Type.STAT_CART_SUB_ITEM),value:Type.STAT_CART_SUB_ITEM},
448
- {title:Type.get_title(Type.STAT_FAVORITE),type:Type.STAT_FAVORITE,label:Type.get_title(Type.STAT_FAVORITE),value:Type.STAT_FAVORITE},
449
- {title:Type.get_title(Type.STAT_LIKE),type:Type.STAT_LIKE,label:Type.get_title(Type.STAT_LIKE),value:Type.STAT_LIKE},
450
- {title:Type.get_title(Type.STAT_LOGIN),type:Type.STAT_LOGIN,label:Type.get_title(Type.STAT_LOGIN),value:Type.STAT_LOGIN},
451
- {title:Type.get_title(Type.STAT_ORDER),type:Type.STAT_ORDER,label:Type.get_title(Type.STAT_ORDER),value:Type.STAT_ORDER},
452
- {title:Type.get_title(Type.STAT_ORDER_ITEM),type:Type.STAT_ORDER_ITEM,label:Type.get_title(Type.STAT_ORDER_ITEM),value:Type.STAT_ORDER_ITEM},
453
- {title:Type.get_title(Type.STAT_ORDER_SUB_ITEM),type:Type.STAT_ORDER_SUB_ITEM,label:Type.get_title(Type.STAT_ORDER_SUB_ITEM),value:Type.STAT_ORDER_ITEM},
454
- {title:Type.get_title(Type.STAT_ORDER_PAYMENT),type:Type.STAT_ORDER_PAYMENT,label:Type.get_title(Type.STAT_ORDER_PAYMENT),value:Type.STAT_ORDER_PAYMENT},
455
- {title:Type.get_title(Type.STAT_REGISTER),type:Type.STAT_REGISTER,label:Type.get_title(Type.STAT_REGISTER),value:Type.STAT_REGISTER},
456
- {title:Type.get_title(Type.STAT_REVIEW),type:Type.STAT_REVIEW,label:Type.get_title(Type.STAT_REVIEW),value:Type.STAT_REVIEW},
457
- {title:Type.get_title(Type.STAT_VIEW),type:Type.STAT_VIEW,label:Type.get_title(Type.STAT_VIEW),value:Type.STAT_VIEW},
349
+ {title:Type.get_data_type_by_type(Type.STAT_CART),type:Type.STAT_CART,label:Type.get_data_type_by_type(Type.STAT_CART),value:Type.STAT_CART},
350
+ {title:Type.get_data_type_by_type(Type.STAT_CART_ITEM),type:Type.STAT_CART_ITEM,label:Type.get_data_type_by_type(Type.STAT_CART_ITEM),value:Type.STAT_CART_ITEM},
351
+ {title:Type.get_data_type_by_type(Type.STAT_CART_SUB_ITEM),type:Type.STAT_CART_SUB_ITEM,label:Type.get_data_type_by_type(Type.STAT_CART_SUB_ITEM),value:Type.STAT_CART_SUB_ITEM},
352
+ {title:Type.get_data_type_by_type(Type.STAT_FAVORITE),type:Type.STAT_FAVORITE,label:Type.get_data_type_by_type(Type.STAT_FAVORITE),value:Type.STAT_FAVORITE},
353
+ {title:Type.get_data_type_by_type(Type.STAT_LIKE),type:Type.STAT_LIKE,label:Type.get_data_type_by_type(Type.STAT_LIKE),value:Type.STAT_LIKE},
354
+ {title:Type.get_data_type_by_type(Type.STAT_LOGIN),type:Type.STAT_LOGIN,label:Type.get_data_type_by_type(Type.STAT_LOGIN),value:Type.STAT_LOGIN},
355
+ {title:Type.get_data_type_by_type(Type.STAT_ORDER),type:Type.STAT_ORDER,label:Type.get_data_type_by_type(Type.STAT_ORDER),value:Type.STAT_ORDER},
356
+ {title:Type.get_data_type_by_type(Type.STAT_ORDER_ITEM),type:Type.STAT_ORDER_ITEM,label:Type.get_data_type_by_type(Type.STAT_ORDER_ITEM),value:Type.STAT_ORDER_ITEM},
357
+ {title:Type.get_data_type_by_type(Type.STAT_ORDER_SUB_ITEM),type:Type.STAT_ORDER_SUB_ITEM,label:Type.get_data_type_by_type(Type.STAT_ORDER_SUB_ITEM),value:Type.STAT_ORDER_ITEM},
358
+ {title:Type.get_data_type_by_type(Type.STAT_ORDER_PAYMENT),type:Type.STAT_ORDER_PAYMENT,label:Type.get_data_type_by_type(Type.STAT_ORDER_PAYMENT),value:Type.STAT_ORDER_PAYMENT},
359
+ {title:Type.get_data_type_by_type(Type.STAT_REGISTER),type:Type.STAT_REGISTER,label:Type.get_data_type_by_type(Type.STAT_REGISTER),value:Type.STAT_REGISTER},
360
+ {title:Type.get_data_type_by_type(Type.STAT_REVIEW),type:Type.STAT_REVIEW,label:Type.get_data_type_by_type(Type.STAT_REVIEW),value:Type.STAT_REVIEW},
361
+ {title:Type.get_data_type_by_type(Type.STAT_VIEW),type:Type.STAT_VIEW,label:Type.get_data_type_by_type(Type.STAT_VIEW),value:Type.STAT_VIEW},
458
362
  ]
459
363
  };
460
364
  static get_data_types = () =>{
461
365
  return [
462
- {title:Type.get_title(Type.DATA_BLOG_POST),type:Type.DATA_BLOG_POST,label:Type.get_title(Type.DATA_BLOG_POST),value:Type.DATA_BLOG_POST},
463
- {title:Type.get_title(Type.DATA_CATEGORY),type:Type.DATA_CATEGORY,label:Type.get_title(Type.DATA_CATEGORY),value:Type.DATA_CATEGORY},
464
- {title:Type.get_title(Type.DATA_CONTENT),type:Type.DATA_CONTENT,label:Type.get_title(Type.DATA_CONTENT),value:Type.DATA_CONTENT},
465
- {title:Type.get_title(Type.DATA_EVENT),type:Type.DATA_EVENT,label:Type.get_title(Type.DATA_EVENT),value:Type.DATA_EVENT},
466
- {title:Type.get_title(Type.DATA_FAQ),type:Type.DATA_FAQ,label:Type.get_title(Type.DATA_FAQ),value:Type.DATA_FAQ},
467
- {title:Type.get_title(Type.DATA_GALLERY),type:Type.DATA_GALLERY,label:Type.get_title(Type.DATA_GALLERY),value:Type.DATA_GALLERY},
468
- {title:Type.get_title(Type.DATA_USER),type:Type.DATA_USER,label:Type.get_title(Type.DATA_USER),value:Type.DATA_USER},
469
- {title:Type.get_title(Type.DATA_PAGE),type:Type.DATA_PAGE,label:Type.get_title(Type.DATA_PAGE),value:Type.DATA_PAGE},
470
- {title:Type.get_title(Type.DATA_PRODUCT),type:Type.DATA_PRODUCT,label:Type.get_title(Type.DATA_PRODUCT),value:Type.DATA_PRODUCT},
471
- {title:Type.get_title(Type.DATA_SERVICE),type:Type.DATA_SERVICE,label:Type.get_title(Type.DATA_SERVICE),value:Type.DATA_SERVICE}
472
- ]
473
- };
474
- static get_types = () =>{
475
- return [
476
- {title:Type.get_title(Type.DATA_BLOG_POST),type:Type.DATA_BLOG_POST,label:Type.get_title(Type.DATA_BLOG_POST),value:Type.DATA_BLOG_POST},
477
- {title:Type.get_title(Type.DATA_CATEGORY),type:Type.DATA_CATEGORY,label:Type.get_title(Type.DATA_CATEGORY),value:Type.DATA_CATEGORY},
478
- {title:Type.get_title(Type.DATA_CONTENT),type:Type.DATA_CONTENT,label:Type.get_title(Type.DATA_CONTENT),value:Type.DATA_CONTENT},
479
- {title:Type.get_title(Type.DATA_EVENT),type:Type.DATA_EVENT,label:Type.get_title(Type.DATA_EVENT),value:Type.DATA_EVENT},
480
- {title:Type.get_title(Type.DATA_GALLERY),type:Type.DATA_GALLERY,label:Type.get_title(Type.DATA_GALLERY),value:Type.DATA_GALLERY},
481
- {title:Type.get_title(Type.DATA_USER),type:Type.DATA_USER,label:Type.get_title(Type.DATA_USER),value:Type.DATA_USER},
482
- {title:Type.get_title(Type.DATA_PAGE),type:Type.DATA_PAGE,label:Type.get_title(Type.DATA_PAGE),value:Type.DATA_PAGE},
483
- {title:Type.get_title(Type.DATA_PRODUCT),type:Type.DATA_PRODUCT,label:Type.get_title(Type.DATA_PRODUCT),value:Type.DATA_PRODUCT},
484
- {title:Type.get_title(Type.DATA_SERVICE),type:Type.DATA_SERVICE,label:Type.get_title(Type.DATA_SERVICE),value:Type.DATA_SERVICE},
485
- {title:Type.get_title(Type.DATA_TYPE),type:Type.DATA_TYPE,label:Type.get_title(Type.DATA_TYPE),value:Type.DATA_TYPE}
486
- ]
487
- };
488
- static get_app_environments = () =>{
489
- return [
490
- {title:Type.get_title(Type.APP_ENV_TEST),type:Type.APP_ENV_TEST,label:Type.get_title(Type.APP_ENV_TEST),value:Type.APP_ENV_TEST},
491
- {title:Type.get_title(Type.APP_ENV_STAGE),type:Type.APP_ENV_STAGE,label:Type.get_title(Type.APP_ENV_STAGE),value:Type.APP_ENV_STAGE},
492
- {title:Type.get_title(Type.APP_ENV_PROD),type:Type.APP_ENV_PROD,label:Type.get_title(Type.APP_ENV_PROD),value:Type.APP_ENV_PROD},
366
+ {title:Type.TITLE_DATA_BLOG_POST,label:Type.TITLE_DATA_BLOG_POST,type:Type.DATA_BLOG_POST,value:Type.DATA_BLOG_POST},
367
+ {title:Type.TITLE_DATA_CATEGORY,label:Type.TITLE_DATA_CATEGORY,type:Type.DATA_CATEGORY,value:Type.DATA_CATEGORY},
368
+ {title:Type.TITLE_DATA_CONTENT,label:Type.TITLE_DATA_CONTENT,type:Type.DATA_CONTENT,value:Type.DATA_CONTENT},
369
+ {title:Type.TITLE_DATA_EVENT,type:Type.DATA_EVENT,value:Type.DATA_EVENT},
370
+ {title:Type.TITLE_DATA_FAQ,label:Type.TITLE_DATA_EVENT,type:Type.DATA_FAQ,value:Type.DATA_FAQ},
371
+ {title:Type.TITLE_DATA_GALLERY,label:Type.TITLE_DATA_GALLERY,type:Type.DATA_GALLERY,label:Type.get_data_type_by_type(Type.DATA_GALLERY),value:Type.DATA_GALLERY},
372
+ {title:Type.TITLE_DATA_USER,label:Type.TITLE_DATA_USER,type:Type.DATA_USER,value:Type.DATA_USER},
373
+ {title:Type.TITLE_DATA_PAGE,label:Type.TITLE_DATA_PAGE,type:Type.DATA_PAGE,value:Type.DATA_PAGE},
374
+ {title:Type.TITLE_DATA_PRODUCT,label:Type.TITLE_DATA_PAGE,type:Type.DATA_PRODUCT,value:Type.DATA_PRODUCT},
375
+ {title:Type.TITLE_DATA_SERVICE,label:Type.TITLE_DATA_PRODUCT,type:Type.DATA_SERVICE,value:Type.DATA_SERVICE}
493
376
  ]
494
377
  };
495
- static get_app_links = () =>{
496
- return [
497
- {title:Type.get_title(Type.APP_LINK_TYPE_WEBSITE),type:Type.APP_LINK_TYPE_WEBSITE,label:Type.get_title(Type.APP_LINK_TYPE_WEBSITE),value:Type.APP_LINK_TYPE_WEBSITE},
498
- {title:Type.get_title(Type.APP_LINK_TYPE_GOOGLE_PLAY),type:Type.APP_LINK_TYPE_GOOGLE_PLAY,label:Type.get_title(Type.APP_LINK_TYPE_GOOGLE_PLAY),value:Type.APP_LINK_TYPE_GOOGLE_PLAY},
499
- {title:Type.get_title(Type.APP_LINK_TYPE_APPLE_STORE),type:Type.APP_LINK_TYPE_APPLE_STORE,label:Type.get_title(Type.APP_LINK_TYPE_APPLE_STORE),value:Type.APP_LINK_TYPE_APPLE_STORE},
500
- ]
501
- };
502
- //9_get_title
503
- static get_title = (type,option)=>{
504
- /* option
505
- * get_lowercase = ex. true,false / def. false
506
- * get_plural = ex. true,false / def. false
507
- * get_url = ex. true,false / def. false
508
- */
509
- type = type?type:"";
510
- let r_type = "";
511
- option = option ? option : {get_lowercase:false,get_plural:false,get_url:false};
512
- switch(type){
513
- case Type.STAT_CART:
514
- r_type = "Cart";
515
- break;
516
- case Type.STAT_CART_ITEM:
517
- r_type = "Cart Item";
518
- break;
519
- case Type.STAT_CART_SUB_ITEM:
520
- r_type = "Cart Sub Item";
521
- break;
522
- case Type.STAT_FAVORITE:
523
- r_type = "Favorite";
524
- break;
525
- case Type.STAT_LIKE:
526
- r_type = "Like";
527
- break;
528
- case Type.STAT_LOGIN:
529
- r_type = "Login";
530
- break;
531
- case Type.STAT_ORDER:
532
- r_type = "Order";
533
- break;
534
- case Type.STAT_ORDER_ITEM:
535
- r_type = "Order Item";
536
- break;
537
- case Type.STAT_ORDER_SUB_ITEM:
538
- r_type = "Order Sub Item";
539
- break;
540
- case Type.STAT_ORDER_PAYMENT:
541
- r_type = "Order Payment";
542
- break;
543
- case Type.STAT_REGISTER:
544
- r_type = "Register";
545
- break;
546
- case Type.STAT_REVIEW:
547
- r_type = "Review";
548
- break;
549
- case Type.STAT_VIEW:
550
- r_type = "View";
551
- break;
552
- case Type.APP_ENV_TEST:
553
- r_type = "Testing";
554
- break;
555
- case Type.APP_ENV_STAGE:
556
- r_type = "Staging";
557
- break;
558
- case Type.APP_ENV_PROD:
559
- r_type = "Production";
560
- break;
561
- case Type.APP_LINK_TYPE_WEBSITE:
562
- r_type = "Website";
563
- break;
564
- case Type.APP_LINK_TYPE_GOOGLE_PLAY:
565
- r_type = "Google Play";
566
- break;
567
- case Type.APP_LINK_TYPE_APPLE_STORE:
568
- r_type = "Apple Store";
569
- break;
570
- case Type.APP_LINK_TYPE_CMS:
571
- r_type = "Content Management System";
572
- break;
573
- case Type.ID:
574
- r_type = "ID";
575
- case Type.N_A:
576
- r_type = "N/A";
577
- case Type.PAGE_ABOUT:
578
- case Type.PAGE_BLOG_POST:
579
- case Type.PAGE_BLOG_POST_HOME:
580
- case Type.PAGE_CONTACT:
581
- case Type.PAGE_EVENT:
582
- case Type.PAGE_EVENT_HOME:
583
- case Type.PAGE_FAQ:
584
- case Type.PAGE_GALLERY:
585
- case Type.PAGE_GALLERY_HOME:
586
- case Type.PAGE_HOME:
587
- case Type.PAGE_LOGIN:
588
- case Type.PAGE_PRODUCT:
589
- case Type.PAGE_PRODUCT_HOME:
590
- case Type.PAGE_SERVICE:
591
- case Type.PAGE_SERVICE_HOME:
592
- case Type.PAGE_REVIEW_HOME:
593
- case Type.USER_ROLE_SUPER_ADMIN:
594
- case Type.USER_ROLE_ADMIN:
595
- case Type.USER_ROLE_MANAGER:
596
- case Type.USER_ROLE_USER:
597
- case Type.USER_ROLE_GUEST:
598
- case Type.ORDER_STATUS_NEW:
599
- case Type.ORDER_STATUS_OPEN:
600
- case Type.ORDER_STATUS_COMPLETE:
601
- case Type.ORDER_STATUS_RETURNED:
602
- case Type.ORDER_STATUS_ON_HOLD:
603
- case Type.ORDER_STATUS_CANCELLED:
604
- case Type.ORDER_PAYMENT_PLAN_NEW:
605
- case Type.ORDER_PAYMENT_PLAN_1:
606
- case Type.ORDER_PAYMENT_PLAN_2:
607
- case Type.ORDER_PAYMENT_PLAN_3:
608
- case Type.ORDER_PAYMENT_PLAN_4:
609
- case Type.ORDER_PAYMENT_METHOD_STRIPE:
610
- case Type.ORDER_PAYMENT_METHOD_CASH:
611
- case Type.ORDER_PAYMENT_METHOD_OTHER:
612
- case Type.ORDER_PAYMENT_METHOD_TEST:
378
+ static get_data_type_by_type = (data_type,option) =>{
379
+ data_type = data_type?data_type:"";
380
+ let r_type = "";
381
+ option = option ? option : {lowercase:false,plural:false,url:false};
382
+ switch(data_type){
613
383
  case Type.DATA_APP:
614
384
  case Type.DATA_BLANK:
615
385
  case Type.DATA_BLOG_POST:
@@ -625,8 +395,6 @@ class Type {
625
395
  case Type.DATA_FILE:
626
396
  case Type.DATA_GALLERY:
627
397
  case Type.DATA_GROUP:
628
- case Type.DATA_ITEM_MAP:
629
- case Type.DATA_ITEM:
630
398
  case Type.DATA_LINK:
631
399
  case Type.DATA_ORDER:
632
400
  case Type.DATA_ORDER_ITEM:
@@ -643,36 +411,60 @@ class Type {
643
411
  case Type.DATA_TYPE:
644
412
  case Type.DATA_USER:
645
413
  case Type.DATA_VIDEO:
646
- r_type = String(Str.get_title(type.replaceAll('_',' ').replaceAll('dt','').replace('biz',''))).trim();
414
+ r_type = String(Str.get_title(data_type.replaceAll('_',' ').replaceAll('dt','').replace('biz',''))).trim();
647
415
  break;
648
- default:
649
- r_type = "N/A";
650
- break;
416
+ };
417
+ if(option.plural){
418
+ r_type = r_type + 's';
651
419
  }
652
- if(option.get_plural){
653
- r_type = r_type + 's';
654
- }
655
- if(option.get_lowercase){
656
- r_type = r_type.toLowerCase();
657
- }
658
- if(option.get_url){
659
- r_type = r_type.replace(" ","_").toLowerCase();
660
- }
661
- return r_type;
420
+ if(option.lowercase){
421
+ r_type = r_type.toLowerCase();
422
+ }
423
+ if(option.url){
424
+ r_type = r_type.replace(" ","_").toLowerCase();
425
+ }
426
+ return r_type;
662
427
  };
663
- static get_type_title = (data_type) => {
664
- return String(data_type.replaceAll('_',' ').replaceAll('dt','').replace('biz','')).trim();
428
+
429
+ static get_data_types = () =>{
430
+ return [
431
+ {title:Type.get_data_type_by_type(Type.DATA_BLOG_POST),type:Type.DATA_BLOG_POST,label:Type.get_data_type_by_type(Type.DATA_BLOG_POST),value:Type.DATA_BLOG_POST},
432
+ {title:Type.get_data_type_by_type(Type.DATA_CATEGORY),type:Type.DATA_CATEGORY,label:Type.get_data_type_by_type(Type.DATA_CATEGORY),value:Type.DATA_CATEGORY},
433
+ {title:Type.get_data_type_by_type(Type.DATA_CONTENT),type:Type.DATA_CONTENT,label:Type.get_data_type_by_type(Type.DATA_CONTENT),value:Type.DATA_CONTENT},
434
+ {title:Type.get_data_type_by_type(Type.DATA_EVENT),type:Type.DATA_EVENT,label:Type.get_data_type_by_type(Type.DATA_EVENT),value:Type.DATA_EVENT},
435
+ {title:Type.get_data_type_by_type(Type.DATA_GALLERY),type:Type.DATA_GALLERY,label:Type.get_data_type_by_type(Type.DATA_GALLERY),value:Type.DATA_GALLERY},
436
+ {title:Type.get_data_type_by_type(Type.DATA_USER),type:Type.DATA_USER,label:Type.get_data_type_by_type(Type.DATA_USER),value:Type.DATA_USER},
437
+ {title:Type.get_data_type_by_type(Type.DATA_PAGE),type:Type.DATA_PAGE,label:Type.get_data_type_by_type(Type.DATA_PAGE),value:Type.DATA_PAGE},
438
+ {title:Type.get_data_type_by_type(Type.DATA_PRODUCT),type:Type.DATA_PRODUCT,label:Type.get_data_type_by_type(Type.DATA_PRODUCT),value:Type.DATA_PRODUCT},
439
+ {title:Type.get_data_type_by_type(Type.DATA_SERVICE),type:Type.DATA_SERVICE,label:Type.get_data_type_by_type(Type.DATA_SERVICE),value:Type.DATA_SERVICE},
440
+ {title:Type.get_data_type_by_type(Type.DATA_TYPE),type:Type.DATA_TYPE,label:Type.get_data_type_by_type(Type.DATA_TYPE),value:Type.DATA_TYPE}
441
+ ]
442
+ };
443
+ static get_app_environments = () =>{
444
+ return [
445
+ {label:Type.TITLE_APP_ENV_STAGE,title:Type.TITLE_APP_ENV_TEST,type:Type.APP_ENV_TEST,value:Type.APP_ENV_TEST},
446
+ {label:Type.TITLE_APP_ENV_STAGE,title:Type.TITLE_APP_ENV_STAGE,type:Type.APP_ENV_STAGE,value:Type.APP_ENV_STAGE},
447
+ {label:Type.TITLE_APP_ENV_PROD,title:Type.TITLE_APP_ENV_PROD,type:Type.APP_ENV_PROD,value:Type.APP_ENV_PROD},
448
+ ]
449
+ };
450
+ static get_app_links = () =>{
451
+ return [
452
+ {title:Type.TITLE_APP_LINK_TYPE_WEBSITE,label:Type.TITLE_APP_LINK_TYPE_WEBSITE,type:Type.APP_LINK_TYPE_WEBSITE,value:Type.APP_LINK_TYPE_WEBSITE},
453
+ {title:Type.TITLE_APP_LINK_TYPE_GOOGLE_PLAY,label:Type.TITLE_APP_LINK_TYPE_GOOGLE_PLAY,type:Type.APP_LINK_TYPE_GOOGLE_PLAY,value:Type.APP_LINK_TYPE_GOOGLE_PLAY},
454
+ {title:Type.TITLE_APP_LINK_TYPE_APPLE_STORE,label:Type.TITLE_APP_LINK_TYPE_APPLE_STORE,type:Type.APP_LINK_TYPE_APPLE_STORE,value:Type.APP_LINK_TYPE_APPLE_STORE},
455
+ {title:Type.TITLE_APP_LINK_TYPE_CMS,label:Type.TITLE_APP_LINK_TYPE_CMS,type:Type.APP_LINK_TYPE_CMS,value:Type.APP_LINK_TYPE_CMS},
456
+ ]
665
457
  };
666
458
  }
667
459
  class Stat_Logic {
668
- static get_new = (parent_data_type,parent_id,type,user_id,post_data) => {
669
- let new_stat = DataItem.get_new(Type.DATA_STAT,0,
460
+ static get = (parent_data_type,parent_id,type,user_id,post_data) => {
461
+ let new_stat = Data_Logic.get_new(Type.DATA_STAT,0,{option:
670
462
  {
671
463
  user_id:user_id,
672
464
  type:type,
673
465
  parent_data_type:parent_data_type,
674
466
  parent_id:parent_id
675
- });
467
+ }});
676
468
  if(!Obj.check_is_empty(post_data)){
677
469
  new_stat = Obj.merge(new_stat,Stat_Logic.filter_stat(post_data));
678
470
  }
@@ -681,49 +473,29 @@ class Stat_Logic {
681
473
  static filter_stat = (post_data) =>{
682
474
  let filter_stat = {};
683
475
  for(const prop in post_data) {
684
- const value = post_data[prop];
476
+ const value = post_data[prop];
685
477
  if (!Array.isArray(value)
686
478
  && prop != Type.FIELD_SOURCE
687
479
  && prop != Type.FIELD_DATE_CREATE
688
480
  && prop != Type.FIELD_DATE_SAVE
689
481
  && prop != Type.FIELD_DATA_TYPE
690
- && prop != Type.TITLE_CART_ITEMS
482
+ && prop != Type.TITLE_CART_ITEMS
691
483
  && prop != Type.TITLE_CART_SUB_ITEMS
692
- && prop != Type.TITLE_ORDER_ITEMS
484
+ && prop != Type.TITLE_ORDER_ITEMS
693
485
  && prop != Type.TITLE_ORDER_SUB_ITEMS
694
- && prop != Type.FIELD_SOURCE
486
+ && prop != Type.FIELD_SOURCE
695
487
  && prop != Type.FIELD_SOURCE_ID
696
488
  && prop != Type.FIELD_ID) {
697
- filter_stat[prop] = post_data[prop];
698
- }
699
- }
489
+ filter_stat[prop] = post_data[prop];
490
+ }
491
+ }
700
492
  return filter_stat;
701
493
  }
702
494
  }
703
- class Page_Logic {
704
- static get_test = (title,option) =>{
705
- [title,option] = Field_Logic.get_option_title(title,option);
706
- option = Field_Logic.get_option(Type.DATA_PAGE,option?option:{});
707
- let page = DataItem.get_new(Type.DATA_PAGE,0,Field_Logic.get_test(title,option));
708
- if(option.get_section){
709
- page.items = Sub_Item_Logic.get_test_sections(page,page,option);
710
- page = Sub_Item_Logic.bind_parent_child_items(page,page.items);
711
- }
712
- return page;
713
- };
714
- static get_test_items = (option) =>{
715
- option = Field_Logic.get_option(Type.DATA_PAGE,option?option:{});
716
- let items = [];
717
- for(let a=0;a<parseInt(option.page_count)+1;a++){
718
- items.push(Page_Logic.get_test( "Page " +parseInt(a+1)? !option.get_blank : "",option));
719
- }
720
- return items;
721
- };
722
- }
723
495
  class Order_Logic {
724
- static get_new = (cart,option) => {
496
+ static get = (cart,option) => {
725
497
  option = option?option:{get_payment_plan:false,payment_plan:Title.ORDER_PAYMENT_PLAN_1};
726
- let order = DataItem.get_new(Type.DATA_ORDER,0,{
498
+ let order = Data_Logic.get_new(Type.DATA_ORDER,0,{data:{
727
499
  order_number:Title.ORDER_NUMBER + Num.get_id(99999),
728
500
  parent_data_type:cart.parent_data_type,
729
501
  user_id:cart.user_id,
@@ -731,23 +503,24 @@ class Order_Logic {
731
503
  grand_total:cart.grand_total,
732
504
  status:Type.ORDER_STATUS_NEW,
733
505
  order_items:[]
734
- });
506
+ }});
735
507
  for(const key in cart) {
736
508
  if(!Str.check_is_null(cart[key])
737
509
  && key != Type.FIELD_ID && key != Type.FIELD_DATA_TYPE
738
510
  && key != Type.TITLE_PARENT_ITEM && key != Type.TITLE_USER
739
- && key != Type.TITLE_CART_ITEMS && key != Type.TITLE_CART_SUB_ITEMS
740
- && key != Type.TITLE_ORDER_ITEMS && key != Type.TITLE_ORDER_SUB_ITEMS
741
- && key != Type.FIELD_SOURCE && key != Type.FIELD_SOURCE_ID
742
- && key != Type.FIELD_DATE_CREATE && key != Type.FIELD_DATE_SAVE){
511
+ && key != Type.TITLE_CART_ITEMS && key != Type.TITLE_CART_SUB_ITEMS
512
+ && key != Type.TITLE_ORDER_ITEMS && key != Type.TITLE_ORDER_SUB_ITEMS
513
+ && key != Type.FIELD_SOURCE && key != Type.FIELD_SOURCE_ID
514
+ && key != Type.FIELD_DATE_CREATE && key != Type.FIELD_DATE_SAVE){
743
515
  order[key] = cart[key];
744
- }
745
- }
516
+ }
517
+ }
746
518
  if(option.get_payment_plan){
747
519
  order.payment_plan = option.payment_plan;
748
520
  }
521
+ /*
749
522
  cart.cart_items.forEach(cart_item => {
750
- let order_item = DataItem.get_new(Type.DATA_ORDER_ITEM,0,{
523
+ let order_item = Data_Logic.get_new(Type.DATA_ORDER_ITEM,0,{data:{
751
524
  order_number:order.order_number,
752
525
  parent_data_type:cart_item.parent_data_type,
753
526
  parent_id:cart_item.parent_id,
@@ -755,111 +528,102 @@ class Order_Logic {
755
528
  quanity:cart_item.quanity?cart_item.quanity:0,
756
529
  cost:cart_item.cost?cart_item.cost:0,
757
530
  order_sub_items:[]
758
- });
759
- for(const key in cart_item){
760
- if(!Str.check_is_null(cart_item[key])
761
- && key != Type.FIELD_ID && key != Type.FIELD_DATA_TYPE
762
- && key != Type.TITLE_PARENT_ITEM && key != Type.TITLE_USER
763
- && key != Type.TITLE_CART_ITEMS && key != Type.TITLE_CART_SUB_ITEMS
764
- && key != Type.TITLE_ORDER_ITEMS && key != Type.TITLE_ORDER_SUB_ITEMS
765
- && key != Type.FIELD_SOURCE && key != Type.FIELD_SOURCE_ID
766
- && key != Type.FIELD_DATE_CREATE && key != Type.FIELD_DATE_SAVE){
767
- order_item[key] = cart_item[key];
768
- }
769
- }
531
+ }});
532
+ });
533
+ for(const key in cart_item){
534
+ if(!Str.check_is_null(cart_item[key]){
535
+ && key != Type.FIELD_ID && key != Type.FIELD_DATA_TYPE
536
+ && key != Type.TITLE_PARENT_ITEM && key != Type.TITLE_USER
537
+ && key != Type.TITLE_CART_ITEMS && key != Type.TITLE_CART_SUB_ITEMS
538
+ && key != Type.TITLE_ORDER_ITEMS && key != Type.TITLE_ORDER_SUB_ITEMS
539
+ && key != Type.FIELD_SOURCE && key != Type.FIELD_SOURCE_ID
540
+ && key != Type.FIELD_DATE_CREATE && key != Type.FIELD_DATE_SAVE
541
+ order_item[key] = cart_item[key]
542
+ }
543
+ }
770
544
  cart_item.cart_sub_items.forEach(cart_sub_item => {
771
- let order_sub_item = DataItem.get_new(Type.DATA_ORDER_SUB_ITEM,0,{
772
- order_number:order.order_number,
773
- parent_data_type:cart_sub_item.parent_data_type,
774
- parent_id:cart_sub_item.parent_id,
775
- user_id:order.user_id,
776
- quanity:cart_sub_item.quanity?cart_sub_item.quanity:0,
777
- cost:cart_sub_item.cost?cart_sub_item.cost:0
778
- })
545
+ let order_sub_item = Data_Logic.get_new(Type.DATA_ORDER_SUB_ITEM,0,
546
+ {data:{order_number:order.order_number,parent_data_type:cart_sub_item.parent_data_type,parent_id:cart_sub_item.parent_id,user_id:order.user_id,quanity:cart_sub_item.quanity?cart_sub_item.quanity:0,cost:cart_sub_item.cost?cart_sub_item.cost:0}};
779
547
  for(const key in cart_sub_item){
780
- if(!Str.check_is_null(cart_sub_item[key])
548
+ if(!Str.check_is_null(cart_sub_item[key])){
781
549
  && key != Type.FIELD_ID && key != Type.DATA_TYPE
782
550
  && key != Type.TITLE_PARENT_ITEM && key != Type.TITLE_USER
783
- && key != Type.TITLE_CART_ITEMS && key != Type.TITLE_CART_SUB_ITEMS
784
- && key != Type.TITLE_ORDER_ITEMS && key != Type.TITLE_ORDER_SUB_ITEMS
785
- && key != Type.FIELD_SOURCE && key != Type.FIELD_SOURCE_ID
786
- && key != Type.FIELD_DATE_CREATE && key != Type.FIELD_DATE_SAVE){
787
- order_sub_item[key] = cart_sub_item[key];
788
- }
789
- }
551
+ && key != Type.TITLE_CART_ITEMS && key != Type.TITLE_CART_SUB_ITEMS
552
+ && key != Type.TITLE_ORDER_ITEMS && key != Type.TITLE_ORDER_SUB_ITEMS
553
+ && key != Type.FIELD_SOURCE && key != Type.FIELD_SOURCE_ID
554
+ && key != Type.FIELD_DATE_CREATE && key != Type.FIELD_DATE_SAVE{
555
+ order_sub_item[key] = cart_sub_item[key]{
556
+ }
557
+ }
790
558
  order_item.order_sub_items.push(order_sub_item);
791
559
  });
792
560
  order.order_items.push(order_item);
793
561
  });
794
562
  return order;
563
+ */
795
564
  };
796
- static get_new_order_payment = (order_number,payment_method_type,payment_amount) => {
797
- return DataItem.get_new(Type.DATA_ORDER_PAYMENT,0,
565
+ /*
566
+ static get_order_payment = (order_number,payment_method_type,payment_amount) => {
567
+ return Data_Logic.get_new(Type.DATA_ORDER_PAYMENT,0,{data:
798
568
  {
799
569
  order_number:order_number,
800
570
  payment_method_type:payment_method_type,
801
571
  payment_amount:payment_amount,
802
572
  transaction_id:Title.ORDER_TRANSACTION_ID + Num.get_id(99999)
573
+ }});
574
+ };
575
+ static get_total = (order) => {
576
+ let grand_total = 0;
577
+ order.order_items.forEach(order_item => {
578
+ order_item.sub_total = 0;
579
+ if(!isNaN(order_item.cost)){
580
+ order_item.sub_total = (order_item.sub_total + order_item.cost) * order_item.quanity;
581
+ grand_total = grand_total + order_item.sub_total;
582
+ }
583
+ order_item.order_sub_items.forEach(order_sub_item => {
584
+ order_sub_item.sub_total = 0;
585
+ if(!isNaN(order_sub_item.cost)){
586
+ order_sub_item.sub_total = (order_sub_item.sub_total + order_sub_item.cost) * order_sub_item.quanity;
587
+ grand_total = grand_total + order_sub_item.sub_total;
588
+ }
803
589
  });
804
- };
805
- static get_total = (order) => {
806
- let grand_total = 0;
807
- order.order_items.forEach(order_item => {
808
- order_item.sub_total = 0;
809
- if(!isNaN(order_item.cost)){
810
- order_item.sub_total = (order_item.sub_total + order_item.cost) * order_item.quanity;
811
- grand_total = grand_total + order_item.sub_total;
812
- }
813
- order_item.order_sub_items.forEach(order_sub_item => {
814
- order_sub_item.sub_total = 0;
815
- if(!isNaN(order_sub_item.cost)){
816
- order_sub_item.sub_total = (order_sub_item.sub_total + order_sub_item.cost) * order_sub_item.quanity;
817
- grand_total = grand_total + order_sub_item.sub_total;
818
- }
819
- });
820
- });
590
+ });
821
591
  order.grand_total = grand_total;
822
- return order;
823
- };
592
+ return order;
593
+ };
594
+ */
824
595
  }
825
596
  class Cart_Logic {
826
- static get_new = (parent_data_type,user_id) => {
827
- return DataItem.get_new(Type.DATA_CART,0,{user_id:user_id,cart_number:Title.CART_NUMBER + Num.get_id(99999),parent_data_type:parent_data_type,grand_total:0,cart_items:[]});
597
+ static get = (parent_data_type,user_id) => {
598
+ return Data_Logic.get_new(Type.DATA_CART,0,{data:{user_id:user_id,cart_number:Title.CART_NUMBER + Num.get_id(99999),parent_data_type:parent_data_type,grand_total:0,cart_items:[]}});
828
599
  };
829
- static get_new_cart_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
830
- return DataItem.get_new(Type.DATA_CART_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,quanity:quanity?quanity:0,cost:cost?cost:0,cart_sub_items:[]});
600
+ static get_cart_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
601
+ return Data_Logic.get_new(Type.DATA_CART_ITEM,0,{data:{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,quanity:quanity?quanity:0,cost:cost?cost:0,cart_sub_items:[]}});
831
602
  };
832
- static get_new_cart_sub_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
833
- return DataItem.get_new(Type.DATA_CART_SUB_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,quanity:quanity?quanity:0,cost:cost?cost:0});
603
+ static get_cart_sub_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
604
+ return Data_Logic.get_new(Type.DATA_CART_SUB_ITEM,0,{data:{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,quanity:quanity?quanity:0,cost:cost?cost:0}});
834
605
  };
835
- static get_total = (cart) => {
836
- let grand_total = 0;
837
- cart.cart_items.forEach(cart_item => {
838
- cart_item.sub_total = 0;
839
- if(!isNaN(cart_item.cost)){
840
- cart_item.sub_total = (cart_item.sub_total + cart_item.cost) * cart_item.quanity;
841
- grand_total = grand_total + cart_item.sub_total;
842
- }
843
- cart_item.cart_sub_items.forEach(cart_sub_item => {
844
- cart_sub_item.sub_total = 0;
845
- if(!isNaN(cart_sub_item.cost)){
846
- cart_sub_item.sub_total = (cart_sub_item.sub_total + cart_sub_item.cost) * cart_sub_item.quanity;
847
- grand_total = grand_total + cart_sub_item.sub_total;
848
- }
849
- });
850
- });
606
+ static get_total = (cart) => {
607
+ let grand_total = 0;
608
+ cart.cart_items.forEach(cart_item => {
609
+ cart_item.sub_total = 0;
610
+ if(!isNaN(cart_item.cost)){
611
+ cart_item.sub_total = (cart_item.sub_total + cart_item.cost) * cart_item.quanity;
612
+ grand_total = grand_total + cart_item.sub_total;
613
+ }
614
+ cart_item.cart_sub_items.forEach(cart_sub_item => {
615
+ cart_sub_item.sub_total = 0;
616
+ if(!isNaN(cart_sub_item.cost)){
617
+ cart_sub_item.sub_total = (cart_sub_item.sub_total + cart_sub_item.cost) * cart_sub_item.quanity;
618
+ grand_total = grand_total + cart_sub_item.sub_total;
619
+ }
620
+ });
621
+ });
851
622
  cart.grand_total = grand_total;
852
- return cart;
853
- };
623
+ return cart;
624
+ };
854
625
  }
855
626
  class Product_Logic {
856
- static get_new = (title,type,category,option) => {
857
- option = option ? option : {};
858
- const item = Item_Logic.get_new(title,Type.DATA_PRODUCT);
859
- item.type = type;
860
- item.category = category = category?category:"";
861
- return item;
862
- };
863
627
  static get_stocks = () => {
864
628
  const stocks=
865
629
  [
@@ -890,72 +654,16 @@ static get_new = (title,type,category,option) => {
890
654
  break;
891
655
  }
892
656
  };
893
- static get_test = (title,option) =>{
894
- [title,option] = Field_Logic.get_option_title(title,option);
895
- option = Field_Logic.get_option(Type.DATA_PRODUCT,option?option:{});
896
- let product = DataItem.get_new(Type.DATA_PRODUCT,0,Field_Logic.get_test(title,option));
897
- if(option.get_blank ==false){
898
- product.cost = Field_Logic.get_test_cost();
899
- product.old_cost = Field_Logic.get_test_cost();
900
- product.cart_count = 0;
901
- product.order_count = 0;
902
- product.type = "Type "+String(Num.get_id());
903
- product.sub_type = "Sub Type "+String(Num.get_id());
904
- product.stock = String(Num.get_id(3-1));
905
- product.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
906
- }else{
907
- product.cost = "";
908
- product.old_cost = "";
909
- product.type = "";
910
- product.sub_type = "";
911
- product.stock = "";
912
- product.tag = "";
913
- }
914
- if(option.get_item){
915
- product.items = Sub_Item_Logic.get_test_items(product,product,option);
916
- }
917
- return product;
918
- };
919
- static get_test_cart = (cart_number,user_id,option) =>{
920
- [cart_number,option] = ield_Logic.get_option_title(cart_number,option);
921
- option = Field_Logic.get_option(Type.DATA_CART,option?option:{});
922
- let cart = DataItem.get_new(Type.DATA_CART,Num.get_guid(),Field_Logic.get_test(cart_number,option));
923
- cart.user_id = user_id;
924
- cart.cart_number = cart_number;
925
- if(option.get_cart_item){
926
- let product_option = {product_count:option.cart_item_count,generate_id:true};
927
- let products = Product_Logic.get_test_items(product_option);
928
- cart.cart_items = [];
929
- for(let a = 0;a<products.length;a++){
930
- let product_cart_item =Cart_Logic.get_test_item(cart_number,cart.id,user_id,products[a].data_type,products[a].id,{get_value:false,get_cart_sub_item:option.get_cart_sub_item,cart_sub_item_count:option.cart_sub_item_count,generate_id:true});
931
- product_cart_item.item_item = products[a];
932
- cart.cart_items.push(product_cart_item);
933
- }
934
- }
935
- return cart;
936
- };
937
- static get_test_items = (option) =>{
938
- option = Field_Logic.get_option(Type.DATA_PRODUCT,option?option:{});
939
- let items = [];
940
- for(let a=0;a<option.product_count+1;a++){
941
- items.push(Product_Logic.get_test("Product "+String(parseInt(a+1)),option));
942
- }
943
- return items;
944
- }
945
- static get_test_items_by_category = (option) =>{
946
- option = Field_Logic.get_option(Type.DATA_PRODUCT,option?option:{});
947
- let products = [];
948
- let categorys = Category_Logic.get_type_categorys(Type.DATA_PRODUCT,option.category_count);
949
- let item_count = 0;
950
- for(let a=0;a<categorys.length;a++){
951
- for(let b=0;b<option.product_count;b++){
952
- item_count++;
953
- let product = Product_Logic.get_test("Product "+String(parseInt(b+1)),option);
954
- product.category = categorys[Num.get_id(categorys.length+1)].title;
955
- products.push(product);
956
- }
957
- }
958
- return [categorys,products]
657
+ static get_test = (option) =>{
658
+ let data = {};
659
+ data.cost = Field_Logic.get_test_cost();
660
+ data.old_cost = Field_Logic.get_test_cost();
661
+ data.category = "Category "+String(Num.get_id());
662
+ data.type = "Type "+String(Num.get_id());
663
+ data.sub_type = "Sub Type "+String(Num.get_id());
664
+ data.stock = String(Num.get_id(3-1));
665
+ data.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
666
+ return data;
959
667
  };
960
668
  }
961
669
  class Service_Logic {
@@ -982,147 +690,44 @@ class Service_Logic {
982
690
  break;
983
691
  }
984
692
  };
985
- static get_test = (title,option) =>{
986
- [title,option] = Field_Logic.get_option_title(title,option);
987
- option = Field_Logic.get_option(Type.DATA_SERVICE,option?option:{});
988
- let service = DataItem.get_new(Type.DATA_SERVICE,0,Field_Logic.get_test(title,option));
989
- service.cost = Field_Logic.get_test_cost();
990
- service.old_cost = Field_Logic.get_test_cost();
991
- service.type = "Type "+String(Num.get_id());
992
- service.sub_type = "Sub Type "+String(Num.get_id());
993
- service.stock = String(Num.get_id(3-1));
994
- service.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
995
- if(option.get_item){
996
- service.items = Sub_Item_Logic.get_test_items(service,service,option);
997
- }
998
- return service;
999
- };
1000
- static get_test_items = (option) =>{
1001
- option = Field_Logic.get_option(Type.DATA_SERVICE,option?option:{});
1002
- let items = [];
1003
- for(let a=0;a<parseInt(option.service_count)+1;a++){
1004
- items.push(Service_Logic.get_test("Service "+String(parseInt(a+1)),option));
1005
- }
1006
- return items;
1007
- }
1008
- static get_test_items_by_category = (option) =>{
1009
- option = Field_Logic.get_option(Type.DATA_SERVICE,option?option:{});
1010
- let services = [];
1011
- let categorys = Category_Logic.get_type_categorys(Type.DATA_SERVICE,option.category_count);
1012
- let item_count = 0;
1013
- for(let a=0;a<categorys.length;a++){
1014
- for(let b=0;b<parseInt(option.service_count);b++){
1015
- item_count++;
1016
- let service = Service_Logic.get_test("Service "+String(parseInt(b+1)),option);
1017
- service.category = categorys[Num.get_id(categorys.length+1)].title;
1018
- services.push(service);
1019
- }
1020
- }
1021
- return [categorys,services]
1022
- };
1023
- }
1024
- class Content_Logic {
1025
- static get_test = (title,option) =>{
1026
- [title,option] = Field_Logic.get_option_title(title,option);
1027
- option = Field_Logic.get_option(Type.DATA_CONTENT,option?option:{});
1028
- let content = DataItem.get_new(Type.DATA_CONTENT,0,Field_Logic.get_test(title,option));
1029
- if(option.get_item){
1030
- content.items = Sub_Item_Logic.get_test_sections(content,content,option);
1031
- if(option.get_item_bind){
1032
- content = Sub_Item_Logic.bind_parent_child_items(content,content.items);
1033
- }
1034
- }
1035
- return content;
1036
- };
1037
- static get_test_items = (option) =>{
1038
- option = Field_Logic.get_option(Type.DATA_CONTENT,option?option:{});
1039
- let items = [];
1040
- for(let a=0;a<parseInt(option.content_count)+1;a++){
1041
- items.push(Content_Logic.get_test("Content " +String(parseInt(a+1)),option));
1042
- }
1043
- return items;
1044
- }
1045
- static get_test_items_by_category = (option) =>{
1046
- option = Field_Logic.get_option(Type.DATA_CONTENT,option?option:{});
1047
- let contents = [];
1048
- let categorys = Category_Logic.get_type_categorys(Type.DATA_CONTENT,option.category_count);
1049
- let item_count = 0;
1050
- for(let a=0;a<categorys.length;a++){
1051
- for(let b=0;b<parseInt(option.content_count);b++){
1052
- item_count++;
1053
- let content = Content_Logic.get_test("Content "+String(parseInt(b+1)),option);
1054
- content.category = categorys[Num.get_id(categorys.length+1)].title;
1055
- contents.push(content);
1056
- }
1057
- }
1058
- return [categorys,contents]
693
+ static get_test = () =>{
694
+ let data = {};
695
+ data.cost = Field_Logic.get_test_cost();
696
+ data.old_cost = Field_Logic.get_test_cost();
697
+ data.type = "Type "+String(Num.get_id());
698
+ data.sub_type = "Sub Type "+String(Num.get_id());
699
+ data.stock = String(Num.get_id(3-1));
700
+ data.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
701
+ return data;
1059
702
  };
1060
703
  }
1061
- class Template_Logic {
1062
- static get_test = (title,option) =>{
1063
- [title,option] = Field_Logic.get_option_title(title,option);
1064
- option = Field_Logic.get_option(Type.DATA_TEMPLATE,option?option:{});
1065
- let template = DataItem.get_new(Type.DATA_TEMPLATE,0,Field_Logic.get_test(title,option));
1066
- return template;
704
+ class Blank_Logic {
705
+ static get_test = (option) =>{
706
+ let data = {};
707
+ data.field_1="Field 1 "+ Num.get_id();
708
+ data.field_2="Field 2 "+ Num.get_id();
709
+ return data;
1067
710
  };
1068
- }
711
+ };
1069
712
  class Blog_Post_Logic {
1070
- static get_test = (title,option) =>{
1071
- [title,option] = Field_Logic.get_option_title(title,option);
1072
- option = Field_Logic.get_option(Type.DATA_BLOG_POST,option?option:{});
1073
- let blog_post = DataItem.get_new(Type.DATA_BLOG_POST,0,Field_Logic.get_test(title,option));
1074
- if(!option.get_blank){
1075
- blog_post.author="First Name "+ Num.get_id();
1076
- blog_post.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id(), " Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
1077
- }else{
1078
- blog_post.author="";
1079
- blog_post.tag = "";
1080
- }
1081
- if(option.get_item){
1082
- blog_post.items = Sub_Item_Logic.get_test_items(blog_post,blog_post,option);
1083
- }
1084
- return blog_post;
1085
- };
1086
- static get_test_items = (option) =>{
1087
- option = Field_Logic.get_option(Type.DATA_BLOG_POST,option?option:{});
1088
- let items = [];
1089
- for(let a=0;a<parseInt(option.blog_post_count)+1;a++){
1090
- items.push(Blog_Post_Logic.get_test("Blog Post " +String(parseInt(a+1)),option));
1091
- }
1092
- return items;
1093
- }
1094
- static get_test_items_by_category = (option) =>{
1095
- option = Field_Logic.get_option(Type.DATA_BLOG_POST,option?option:{});
1096
- let blog_posts = [];
1097
- let categorys = Category_Logic.get_type_categorys(Type.DATA_BLOG_POST,option.category_count);
1098
- let item_count = 0;
1099
- for(let a=0;a<categorys.length;a++){
1100
- for(let b=0;b<parseInt(option.blog_post_count);b++){
1101
- item_count++;
1102
- let blog_post = Blog_Post_Logic.get_test("Blog Post "+String(parseInt(b+1)),option);
1103
- blog_post.category = categorys[Num.get_id(categorys.length+1)].title;
1104
- blog_posts.push(blog_post);
1105
- }
1106
- }
1107
- return [categorys,blog_posts]
713
+ static get_test = (option) =>{
714
+ let data = {};
715
+ data.author="First Name "+ Num.get_id();
716
+ data.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id(), " Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
717
+ data.category = "Category "+String(Num.get_id());
718
+ data.type = "Type "+String(Num.get_id());
719
+ data.sub_type = "Sub Type "+String(Num.get_id());
720
+
721
+ return data;
1108
722
  };
1109
723
  }
1110
724
  class Gallery_Logic {
1111
- static get_test = (title,option) =>{
1112
- [title,option] = Field_Logic.get_option_title(title,option);
1113
- option = Field_Logic.get_option(Type.DATA_GALLERY,option?option:{});
1114
- let gallery = DataItem.get_new(Type.DATA_GALLERY,0,Field_Logic.get_test(title,option));
1115
- if(!option.get_blank){
1116
- gallery.date = String(String(Num.get_id(2030)) + "-" + String(Num.get_id(13)) + "-" + String(Num.get_id(30))).trim();
1117
- gallery.time = String(Num.get_id(24)) + ":" + String(Num.get_id(59));
1118
- gallery.website = "Website "+String(Num.get_id());
1119
- }else{
1120
- gallery.website = "";
1121
- }
1122
- if(option.get_item){
1123
- gallery.items = Sub_Item_Logic.get_test_items(gallery,gallery,option);
1124
- }
1125
- return gallery;
725
+ static get_test = () =>{
726
+ let data = {};
727
+ data.date = String(String(Num.get_id(2030)) + "-" + String(Num.get_id(13)) + "-" + String(Num.get_id(30))).trim();
728
+ data.time = String(Num.get_id(24)) + ":" + String(Num.get_id(59));
729
+ data.website = "Website "+String(Num.get_id());
730
+ return data;
1126
731
  };
1127
732
  };
1128
733
  class Event_Logic {
@@ -1153,63 +758,44 @@ class Event_Logic {
1153
758
  break;
1154
759
  }
1155
760
  };
1156
- static get_test = (title,option) =>{
1157
- [title,option] = Field_Logic.get_option_title(title,option);
1158
- option = Field_Logic.get_option(Type.DATA_EVENT,option?option:{});
1159
- let event = DataItem.get_new(Type.DATA_EVENT,0,Field_Logic.get_test(title,option));
1160
- if(!option.get_blank){
1161
- event.cost = Field_Logic.get_test_cost();
1162
- event.old_cost = Field_Logic.get_test_cost();
1163
- event.date = String(String(Num.get_id(2030)) + "-" + String(Num.get_id(13)) + "-" + String(Num.get_id(30))).trim();
1164
- event.time = String(Num.get_id(24)) + ":" + String(Num.get_id(59));
1165
- event.website = "Website "+String(Num.get_id());
1166
- event.location = "Location "+String(Num.get_id());
1167
- event.meeting_link = "Meeting Link "+String(Num.get_id());
1168
- event.stock = String(Num.get_id(3-1));
1169
- event.category ="Category " + String(Num.get_id());
1170
- event.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
1171
- }else{
1172
- event.cost = "";
1173
- event.old_cost = "";
1174
- event.date = "";
1175
- event.time = "";
1176
- event.website = "";
1177
- event.location = "";
1178
- event.meeting_link = "";
1179
- event.stock = "";
1180
- event.category ="";
1181
- event.tag = "";
761
+ static get_test = () =>{
762
+ let data = {};
763
+ data.cost = Field_Logic.get_test_cost();
764
+ data.old_cost = Field_Logic.get_test_cost();
765
+ data.date = String(String(Num.get_id(2030)) + "-" + String(Num.get_id(13)) + "-" + String(Num.get_id(30))).trim();
766
+ data.time = String(Num.get_id(24)) + ":" + String(Num.get_id(59));
767
+ data.website = "Website "+String(Num.get_id());
768
+ data.location = "Location "+String(Num.get_id());
769
+ data.meeting_link = "Meeting Link "+String(Num.get_id());
770
+ data.stock = String(Num.get_id(3-1));
771
+ data.category ="Category " + String(Num.get_id());
772
+ data.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
773
+ return data;
774
+ };
775
+ }
776
+ class Field_Logic {
777
+ static get_base_option = (data,option) => {
778
+ if(option.title){
779
+ data[Type.FIELD_TITLE] = option.title;
780
+ data[Type.FIELD_TITLE_URL] = Str.get_title_url(option.title);
1182
781
  }
1183
- if(option.get_item){
1184
- event.items = Sub_Item_Logic.get_test_items(event,event,option);
782
+ if(option.title){
783
+ data[Type.FIELD_TITLE] = Type.get_data_type_by_type(data.data_type);
784
+ data[Type.FIELD_TITLE_URL] = Str.get_title_url(data[Type.FIELD_TITLE]);
1185
785
  }
1186
- return event;
1187
- };
1188
- static get_test_items = (option) =>{
1189
- option = Field_Logic.get_option(Type.DATA_EVENT,option?option:{});
1190
- let items = [];
1191
- for(let a=0;a<parseInt(option.event_count)+1;a++){
1192
- items.push(Event_Logic.get_test("Event "+String(parseInt(a+1)),option));
786
+ if(option.generate_title || option.test){
787
+ data[Type.FIELD_TITLE] = Type.get_data_type_by_type(data.data_type) + " " +Num.get_id(999);
788
+ data[Type.FIELD_TITLE_URL] = Str.get_title_url(data[Type.FIELD_TITLE]);
1193
789
  }
1194
- return items;
1195
- }
1196
- static get_test_items_by_category = (option) =>{
1197
- option = Field_Logic.get_option(Type.DATA_EVENT,option?option:{});
1198
- let events = [];
1199
- let categorys = Category_Logic.get_type_categorys(Type.DATA_EVENT,option.category_count);
1200
- let item_count = 0;
1201
- for(let a=0;a<categorys.length;a++){
1202
- for(let b=0;b<parseInt(option.event_count);b++){
1203
- item_count++;
1204
- let event = Event_Logic.get_test("Event "+String(parseInt(b+1)),option);
1205
- event.category = categorys[Num.get_id(categorys.length+1)].title;
1206
- events.push(event);
1207
- }
790
+ if(option.parent){
791
+ data[Type.FIELD_PARENT_DATA_TYPE] = option.parent[Type.FIELD_DATA_TYPE] ? option.parent[Type.FIELD_DATA_TYPE] : Type.DATA_BLANK;
792
+ data[Type.FIELD_PARENT_ID] = option.parent[Type.FIELD_ID] ? option.parent[Type.FIELD_ID] : 0;
1208
793
  }
1209
- return [categorys,events]
794
+ if(option.data){
795
+ data = Obj.merge(data,option.data);
796
+ }
797
+ return data;
1210
798
  };
1211
- }
1212
- class Field_Logic {
1213
799
  static get_item_max_group_id = (value_id,item) => {
1214
800
  let max_group_id = 0;
1215
801
  let full_prop_str = "";
@@ -1234,7 +820,7 @@ class Field_Logic {
1234
820
  full_prop_str = String(prop + " "+full_prop_str);
1235
821
  }
1236
822
  for(let a = 1; a < 75; a++){
1237
- const exists = Str.check_if_str_exist(full_prop_str,"items_value_"+a);
823
+ const exists = Str.check_if_str_exist(full_prop_str,"items_value_"+a);
1238
824
  if(exists){
1239
825
  if(a>max_value_id){
1240
826
  max_value_id = a;
@@ -1311,12 +897,12 @@ class Field_Logic {
1311
897
  return String(Num.get_id(999)) + "." + String(Num.get_id(99));
1312
898
  }
1313
899
  static get_test_note = () => {
1314
- return "Note "+String(Num.get_id()) + " Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
900
+ return "Note "+String(Num.get_id()) + " Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
1315
901
  }
1316
902
  static get_test = (title,option) =>{
1317
903
  option = !Obj.check_is_empty(option) ? option : {};
1318
904
  let item = {};
1319
- if(option.get_blank == true){
905
+ if(option.blank == true){
1320
906
  option.category_title = "";
1321
907
  item = {
1322
908
  title:title,
@@ -1348,7 +934,7 @@ class Field_Logic {
1348
934
  if(option.fields){
1349
935
  let field_items = String(option.fields).split(',');
1350
936
  for(let a = 0; a<field_items.length;a++){
1351
- if(option.get_blank == true){
937
+ if(option.blank == true){
1352
938
  if(item[field_items[a]]){
1353
939
  item[field_items[a]] = "";
1354
940
  }
@@ -1367,7 +953,6 @@ class Field_Logic {
1367
953
  static get_value_items_group(item,value_id,group_id){
1368
954
  let full_str = 'items_value_'+value_id+"_group_"+group_id;
1369
955
  let items = [];
1370
- Log.w(full_str,full_str);
1371
956
  let count = 0;
1372
957
  for(const prop in item){
1373
958
  let new_item = {};
@@ -1381,7 +966,7 @@ class Field_Logic {
1381
966
  }
1382
967
  static get_values(item,option){
1383
968
  for(let b=0;b<parseInt(option.value_count);b++){
1384
- if(option.get_blank == false){
969
+ if(option.blank == false){
1385
970
  item['value_'+String(b+1)] = 'value ' + String(b+1);
1386
971
  item['field_'+String(b+1)] = Str.get_title_url(item['value_'+String(b+1)]);
1387
972
  item[Str.get_title_url('value ' + String(b+1))] = item.title + ' value ' + String(b+1);
@@ -1393,192 +978,14 @@ class Field_Logic {
1393
978
  }
1394
979
  return item;
1395
980
  };
1396
- static get_option(data_type,option){
1397
- data_type = data_type ? data_type : Type.DATA_BLANK;
1398
- option = !Obj.check_is_empty(option) ? option : {get_value:false,get_item:false,get_image:false,item_count:9,value_count:9};
1399
- option.generate_id = option.generate_id ? option.generate_id : false;
1400
- option.get_image = option.get_image ? true : false;
1401
- option.get_value = option.get_value ? true : false;
1402
- option.get_item = option.get_item ? true : false;
1403
- option.get_blank = option.get_blank ? true : false;
1404
- option.get_item_bind = option.get_item_bind ? true : true;
1405
- option.value_count = option.value_count ? option.value_count : 9;
1406
- option.section_count = option.section_count ? option.section_count : 9;
1407
- option.item_count = option.item_count ? option.item_count : 9;
1408
- option.category_count = option.category_count ? option.category_count : 9;
1409
- option.category_title = option.category_title ? option.category_title : "";
1410
- option.fields = option.fields ? option.fields : [];
1411
- if(option.data_type==Type.DATA_PAGE){
1412
- option.page_count = option.page_count ? option.page_count : 9;
1413
- option.section_count = option.section_count ? option.section_count : 9;
1414
- option.get_section = option.get_section ? true : false;
1415
- }
1416
- if(data_type==Type.DATA_PRODUCT){
1417
- option.product_count = option.product_count ? option.product_count : 9;
1418
- }
1419
- if(data_type==Type.DATA_SERVICE){
1420
- option.service_count = option.service_count ? option.service_count : 9;
1421
- }
1422
- if(data_type==Type.DATA_BLOG_POST){
1423
- option.blog_post_count = option.blog_post_count ? option.blog_post_count : 9;
1424
- }
1425
- if(data_type==Type.DATA_EVENT){
1426
- option.event_count = option.event_count ? option.event_count : 9;
1427
- }
1428
- if(data_type==Type.DATA_FAQ){
1429
- option.question_count = option.question_count ? option.question_count : 9;
1430
- }
1431
- if(data_type==Type.DATA_CONTENT){
1432
- option.content_count = option.content_count ? option.content_count : 9;
1433
- }
1434
- if(data_type==Type.DATA_SUB_ITEM){
1435
- option.item_count = option.item_count ? option.item_count : 9;
1436
- }
1437
- if(data_type==Type.DATA_USER){
1438
- option.user_count = option.user_count ? option.user_count : 9;
1439
- }
1440
- if(data_type==Type.DATA_CART){
1441
- option.category_title = option.category_title ? option.category_title : "";
1442
- option.value_count = option.value_count ? option.value_count : 9;
1443
- option.get_cart_item = option.get_cart_item ? option.get_cart_item : false;
1444
- option.cart_item_count = option.cart_item_count ? option.cart_item_count : 5;
1445
- option.get_cart_sub_item = option.get_cart_sub_item ? option.get_cart_sub_item : false;
1446
- option.cart_sub_item_count = option.cart_sub_item_count ? option.cart_sub_item_count : 3;
1447
- }
1448
- if(data_type==Type.DATA_CART_ITEM){
1449
- option.category_title = option.category_title ? option.category_title : "";
1450
- option.value_count = option.value_count ? option.value_count : 9;
1451
- option.get_cart_sub_item = option.get_cart_sub_item ? option.get_cart_sub_item : false;
1452
- option.cart_sub_item_count = option.cart_sub_item_count ? option.cart_sub_item_count : 1;
1453
- }
1454
- if(data_type==Type.DATA_ORDER){
1455
- option.category_title = option.category_title ? option.category_title : "";
1456
- option.value_count = option.value_count ? option.value_count : 9;
1457
- option.get_order_item = option.get_order_item ? option.get_order_item : false;
1458
- option.order_item_count = option.order_item_count ? option.order_item_count : 5;
1459
- option.get_order_sub_item = option.get_order_sub_item ? option.get_order_sub_item : false;
1460
- option.order_sub_item_count = option.order_sub_item_count ? option.order_sub_item_count : 3;
1461
- }
1462
- if(data_type==Type.DATA_ORDER_ITEM){
1463
- option.category_title = option.category_title ? option.category_title : "";
1464
- option.value_count = option.value_count ? option.value_count : 9;
1465
- option.get_order_sub_item = option.get_order_sub_item ? option.get_order_sub_item : false;
1466
- option.order_sub_item_count = option.order_sub_item_count ? option.order_sub_item_count : 1;
1467
- }
1468
- return option;
1469
- }
1470
- static get_option_title = (title,option) =>{
1471
- if(!title){
1472
- let title = '';
1473
- }
1474
- if(!option){
1475
- let option = {};
1476
- }
1477
- if(!Str.check_is_null(title) && Obj.check_is_empty(option)){
1478
- if(Obj.check_is_empty(option)){
1479
- if(!Str.check_is_null(title) && Obj.check_is_empty(option)){
1480
- if(typeof title === 'string'){
1481
- option = {};
1482
- }else{
1483
- option = title;
1484
- title = "Test " + Num.get_id();
1485
- }
1486
- }
1487
- }
1488
- }else{
1489
- if(Str.check_is_null(title) && Obj.check_is_empty(option)){
1490
- title = "Test " + Num.get_id();
1491
- option = {};
1492
- }
1493
- }
1494
- return [title,option];
1495
- }
1496
- static get_option_admin(req){
1497
- let option = {};
1498
- option.value_count = req.query.value_count ? req.query.value_count : 9;
1499
- option.section_count = req.query.section_count ? req.query.section_count : 9;
1500
-
1501
- option.get_faq = req.query.get_faq ? req.query.get_faq : false;
1502
- option.question_count = req.query.question_count ? req.query.question_count : 9;
1503
-
1504
- option.get_blog_post = req.query.get_blog_post ? req.query.get_blog_post : false;
1505
- option.get_category_blog_post = req.query.get_category_blog_post ? req.query.get_category_blog_post : false;
1506
- option.category_blog_post_count = req.query.category_blog_post_count ? req.query.category_blog_post_count : 9;
1507
- option.blog_post_count = req.query.blog_post_count ? req.query.blog_post_count : 9;
1508
-
1509
- option.get_product = req.query.get_product ? req.query.get_product : false;
1510
- option.get_category_product = req.query.get_category_product ? req.query.get_category_product : false;
1511
- option.category_product_count = req.query.category_product_count ? req.query.category_product_count : 9;
1512
- option.product_count = req.query.product_count ? req.query.product_count : 9;
1513
-
1514
- option.get_service = req.query.get_service ? req.query.get_service : false;
1515
- option.get_category_service = req.query.get_category_service ? req.query.get_category_service : false;
1516
- option.category_service_count = req.query.category_service_count ? req.query.category_service_count : 9;
1517
- option.service_count = req.query.service_count ? req.query.service_count : 9;
1518
-
1519
- option.get_event = req.query.get_event ? req.query.get_event : false;
1520
- option.get_category_event = req.query.get_category_event ? req.query.get_category_event : false;
1521
- option.category_event_count = req.query.category_event_count ? req.query.category_event_count : 9;
1522
- option.event_count = req.query.event_count ? req.query.event_count : 9;
1523
-
1524
- option.get_product_review = req.query.get_product_review ? req.query.get_product_review : false;
1525
- option.product_review_count = req.query.product_review_count ? req.query.product_review_count : 19;
1526
-
1527
- option.get_business_review = req.query.get_business_review ? req.query.get_business_review : false;
1528
- option.business_review_count = req.query.business_review_count ? req.query.business_review_count : 19;
1529
-
1530
- option.user_count = req.query.user_count ? req.query.user_count : 9;
1531
- option.get_admin = req.query.get_admin ? req.query.get_admin : false;
1532
- option.get_template = req.query.get_template ? req.query.get_template : false;
1533
- option.get_page = req.query.get_page ? req.query.get_page : false;
1534
-
1535
- return option;
1536
- }
1537
981
  }
1538
- /*
1539
- class Type.DATA_{
1540
- static APP='app_biz';
1541
- static BLANK='blank_biz';
1542
- static BLOG_POST='blog_post_biz';
1543
- static CART_ITEM="cart_item_biz";
1544
- static CART="cart_biz";
1545
- static CART_ITEM="cart_item_biz";
1546
- static CART_SUB_ITEM="cart_sub_item_biz";
1547
- static CATEGORY='category_biz';
1548
- static CUSTOM_FIELD='custom_field_biz';
1549
- static CONTENT='content_biz';
1550
- static EVENT='event_biz';
1551
- static GROUP='group_biz';
1552
- static FAQ='faq_biz';
1553
- static FAVORITE='favorite_biz';
1554
- static FILE='file_biz';
1555
- static GALLERY='gallery_biz';
1556
- static IMAGE='image_biz';
1557
- static ITEM='item_biz';
1558
- static LINK='link_biz';
1559
- static ORDER="order_biz";
1560
- static ORDER_ITEM="order_item_biz";
1561
- static ORDER_SUB_ITEM="order_sub_item_biz";
1562
- static ORDER_PAYMENT="order_payment_biz";
1563
- static PRODUCT='product_biz';
1564
- static PAGE='page_biz';
1565
- static REVIEW='review_biz';
1566
- static SERVICE='service_biz';
1567
- static SECURITY='security_biz';
1568
- static STAT='stat_biz';
1569
- static TEMPLATE='template_biz';
1570
- static TYPE='type_biz';
1571
- static USER='user_biz';
1572
- static VIDEO='video_biz';
1573
- }
1574
- */
1575
982
  class Favorite_Logic {
1576
- static get_new = (parent_data_type,parent_id,user_id) =>{
1577
- return DataItem.get_new(Type.DATA_FAVORITE,0,{
983
+ static get = (parent_data_type,parent_id,user_id) =>{
984
+ return Data_Logic.get_new(Type.DATA_FAVORITE,0,{data:{
1578
985
  parent_data_type:parent_data_type,
1579
986
  parent_id:parent_id,
1580
987
  user_id:user_id
1581
- });
988
+ }});
1582
989
  }
1583
990
  static get_user_search_filter = (item_data_type,user_id) =>{
1584
991
  return {
@@ -1597,15 +1004,15 @@ class Favorite_Logic {
1597
1004
  }
1598
1005
  }
1599
1006
  class Review_Logic {
1600
- static get_new = (parent_data_type,parent_id,user_id,title,comment,rating) =>{
1601
- return DataItem.get_new(Type.DATA_REVIEW,0,{
1007
+ static get = (parent_data_type,parent_id,user_id,title,comment,rating) =>{
1008
+ return Data_Logic.get_new(Type.DATA_REVIEW,0,{data:{
1602
1009
  parent_data_type:parent_data_type,
1603
1010
  parent_id:parent_id,
1604
1011
  user_id:user_id,
1605
1012
  title:title ? title : "",
1606
1013
  comment:comment ? comment : "",
1607
1014
  rating:rating ? rating : 5
1608
- });
1015
+ }});
1609
1016
  }
1610
1017
  static get_user_search_filter = (item_data_type,user_id) =>{
1611
1018
  return {
@@ -1621,112 +1028,17 @@ class Review_Logic {
1621
1028
  { parent_id: { $regex:String(parent_id), $options: "i" } },
1622
1029
  ] };
1623
1030
  }
1624
- static get_test = (item_data_type,item_id,user_id,option) =>{
1625
- option = Field_Logic.get_option(Type.DATA_REVIEW,option?option:{});
1626
- let review = DataItem.get_new(Type.DATA_REVIEW,0);
1627
- if(!option.get_blank){
1628
- review.title = 'Title ' + Num.get_id();
1629
- review.item_data_type = item_data_type;
1630
- review.item_id = item_id;
1631
- review.rating = Num.get_id(6);
1632
- review.user_id = user_id;
1633
- review.comment = "My comment "+ Field_Logic.get_test_note();
1634
- }else{
1635
- review.title = '';
1636
- review.item_data_type = item_data_type;
1637
- review.item_id = item_id;
1638
- review.rating = 0;
1639
- review.user_id = user_id;
1640
- review.comment = "";
1641
- }
1642
- return review;
1643
- };
1644
- static get_test_items=(option)=>{
1645
- option = !Obj.check_is_empty(option) ? option : {review_count:19};
1646
- let items = [];
1647
- for(let a=0;a<option.review_count;a++){
1648
- items.push(Review_Logic.get_test(option));
1649
- }
1650
- return items;
1651
- };
1652
- }
1653
- class Admin_Logic {
1654
- static get_new = (title,option) =>{
1655
- [title,option] = Field_Logic.get_option_title(title,option);
1656
- return DataItem.get_new_full_item(
1657
- DataItem.get_new(Type.DATA_ADMIN,0),
1658
- DataItem.get_new(Type.DATA_ADMIN,0),
1659
- DataItem.get_new(Type.DATA_ADMIN,0),{
1660
- title:title,
1661
- email:"",
1662
- });
1663
- };
1664
- static get_test = (title,option) =>{
1665
- [title,option] = Field_Logic.get_option_title(title,option);
1666
- option = Field_Logic.get_option(Type.DATA_ADMIN,option?option:{});
1667
- let item = DataItem.get_new(Type.DATA_ADMIN,0);
1668
- let admin = DataItem.get_new(Type.DATA_ADMIN,0,Field_Logic.get_test(title,option));
1669
- if(!option.get_blank){
1670
- admin.email="ceo@admin"+Num.get_id()+".com";
1671
- admin.password="1234567";
1672
- }else{
1673
- admin.email="";
1674
- admin.password="";
1675
- }
1676
- return admin;
1677
- };
1678
- static get_full_address(admin){
1679
- admin.address_1 = (admin.address_1) ? admin.address_1 : "";
1680
- admin.address_2 = (admin.address_2) ? admin.address_2 : "";
1681
- admin.city = (admin.city) ? admin.city : "";
1682
- admin.state = (admin.state) ? admin.state : "";
1683
- admin.zip = (admin.zip) ? admin.zip : "";
1684
- return admin.address_1 + " "+ admin.address_2 + " " + admin.city + " " + admin.state + " " + admin.zip;
1685
- }
1686
- }
1687
- class DataItem {
1688
- static get_new = (data_type,id,option) => {
1689
- return get_new_item_main(data_type,id,option?option:{});
1690
- };
1691
- static get_new_full_item = (item,parent_item,top_item,option) => {
1692
- return get_new_full_item_main(item,parent_item,top_item,option?option:{});
1031
+ static get_test = () =>{
1032
+ let data = {};
1033
+ data.item_data_type = item_data_type;
1034
+ data.item_id = item_id;
1035
+ data.rating = Num.get_id(6);
1036
+ data.user_id = user_id;
1037
+ data.comment = "My comment "+ Field_Logic.get_test_note();
1038
+ return data;
1693
1039
  };
1694
1040
  }
1695
1041
  class Category_Logic {
1696
- static get_new = (title,type,category,option) => {
1697
- option = option ? option : {};
1698
- const item = Item_Logic.get_new(title,Type.DATA_CATEGORY);
1699
- item.type = type;
1700
- item.category = category = category?category:"";
1701
- return item;
1702
- };
1703
- static get_test = (title,option) =>{
1704
- title = (title) ? title : "Category 1";
1705
- option = Field_Logic.get_option(Type.DATA_CATEGORY,option?option:{});
1706
- let category = DataItem.get_new(Type.DATA_CATEGORY,0,Field_Logic.get_test(title,option));
1707
- if(option.get_item){
1708
- category.items = Sub_Item_Logic.get_test_items(category,category,option);
1709
- }
1710
- return category;
1711
- };
1712
- static get_test_items = (option) =>{
1713
- option = Field_Logic.get_option(Type.DATA_CATEGORY,option);
1714
- let items = [];
1715
- for(let a=0;a<option.category_count;a++){
1716
- items.push(Category_Logic.get_test("Category " +String(parseInt(a+1)),option));
1717
- }
1718
- return items;
1719
- }
1720
- static get_test_items_by_type = (type,option) =>{
1721
- option = Field_Logic.get_option(Type.DATA_CATEGORY,option);
1722
- let categorys = [];
1723
- for(let a=0;a<option.category_count;a++){
1724
- let category = DataItem.get_new(Type.DATA_CATEGORY,0,Field_Logic.get_test("Category " +String(parseInt(a+1)),option));
1725
- category.type = type;
1726
- categorys.push(category);
1727
- }
1728
- return categorys;
1729
- };
1730
1042
  static get_category_drop_down_by_items = (items) => {
1731
1043
  let categorys = [];
1732
1044
  for(let a=0;a<items.length;a++){
@@ -1770,18 +1082,6 @@ class Storage {
1770
1082
  }
1771
1083
  }
1772
1084
  class User_Logic {
1773
- static url_register = (app_id,url,param) => {
1774
- let action_url="user/register";
1775
- return get_cloud_url_main(app_id,url,action_url,param);
1776
- };
1777
- static url_login = (app_id,url,param) => {
1778
- let action_url="user/login";
1779
- return get_cloud_url_main(app_id,url,action_url,param);
1780
- };
1781
- static url_logout = (app_id,url,param) => {
1782
- let action_url="user/logout";
1783
- return get_cloud_url_main(app_id,url,action_url,param);
1784
- };
1785
1085
  static get_country_state_city(item){
1786
1086
  let country_state_city = "";
1787
1087
  if(item.country == "United States"){
@@ -1810,14 +1110,13 @@ class User_Logic {
1810
1110
  let str_first_name = !Str.check_is_null(first_name) ? first_name : "";
1811
1111
  let str_last_name = !Str.check_is_null(last_name) ? last_name : "";
1812
1112
  return !Str.check_is_null(String(str_first_name + " " + str_last_name)) ? String(str_first_name + " " + str_last_name).trim() : "N/A";
1813
-
1814
1113
  }
1815
1114
  static get_guest(){
1816
- return DataItem.get_new(Type.DATA_USER,0,{is_guest:true,title_url:'guest',first_name:'Guest',last_name:'User',email:'guest@email.com',title:"Guest",country:"United States"});
1115
+ return Data_Logic.get_new(Type.DATA_USER,0,{data:{guest:{is_guest:true,title_url:'guest',first_name:'Guest',last_name:'User',email:'guest@email.com',title:"Guest",country:"United States"}}});
1817
1116
  }
1818
1117
  static get_request_user(req){
1819
1118
  if(!req || !req.session.user){
1820
- let user=DataItem.get_new(Type.DATA_USER,Num.get_id(9999999),{is_guest:true});
1119
+ let user=Data_Logic.get_new(Type.DATA_USER,Num.get_id(9999999),{is_guest:true});
1821
1120
  req.session.user=user;
1822
1121
  }
1823
1122
  return req.session.user;
@@ -1829,182 +1128,167 @@ class User_Logic {
1829
1128
  req.session.user=null;
1830
1129
  delete req.session.user;
1831
1130
  }
1832
- static get_test = (title,option) =>{
1833
- [title,option] = Field_Logic.get_option_title(title,option);
1834
- option = Field_Logic.get_option(Type.DATA_USER,option?option:{});
1835
- let user = DataItem.get_new(Type.DATA_USER,0,
1836
- Field_Logic.get_test(title,option));
1837
- if(option.get_blank){
1838
- user.first_name="";
1839
- user.last_name="";
1840
- user.email="";
1841
- user.city="";
1842
- user.state="";
1843
- user.password="";
1844
- user.country="";
1845
- }else{
1846
- user.first_name="First Name "+ Num.get_id();
1847
- user.last_name="First Name "+ Num.get_id();
1848
- user.email="email"+ Num.get_id() + "@email.com";
1849
- user.city="City"+ Num.get_id();
1850
- user.state="State"+ Num.get_id();
1851
- user.password="1234567";
1852
- user.country="United States";
1853
- }
1854
- return user;
1131
+ static get_test = () =>{
1132
+ let data = {};
1133
+ data.first_name="First Name "+ Num.get_id();
1134
+ data.last_name="First Name "+ Num.get_id();
1135
+ data.email="email"+ Num.get_id() + "@email.com";
1136
+ data.city="City"+ Num.get_id();
1137
+ data.state="State"+ Num.get_id();
1138
+ data.password="1234567";
1139
+ data.country="United States";
1140
+ return data;
1855
1141
  };
1856
- static get_test_items = (option) =>{
1857
- option = Field_Logic.get_option(Type.DATA_USER,option?option:{});
1858
- let items = [];
1859
- for(let a=0;a<option.user_count+1;a++){
1860
- items.push(User_Logic.get_test("User " +String(parseInt(a+1)),option));
1861
- }
1862
- return items;
1863
- }
1864
- }
1865
- class Sub_Item_Logic {
1866
- static get_test(title,parent_item,top_item,option){
1867
- option = Field_Logic.get_option(Type.DATA_ITEM,option?option:{});
1868
- let item_title =title;
1869
- let item = DataItem.get_new(
1870
- Type.DATA_ITEM,0, {
1871
- top_id:top_item.id?top_item.id:0,
1872
- top_data_type:top_item.data_type?top_item.data_type:Type.DATA_BLANK,
1873
- parent_id:parent_item.id?parent_item.id:0,
1874
- parent_data_type:parent_item.data_type?parent_item.data_type:Type.DATA_BLANK,
1875
- title:item_title,
1876
- title_url:Str.get_title_url(item_title),
1877
- description:"Description "+String(Num.get_id()),
1878
- note:Field_Logic.get_test_note()
1879
- }
1880
- );
1881
- if(option.get_value){
1882
- item = Field_Logic.get_values(item,option);
1883
- }
1884
- return item;
1885
- }
1886
- static get_test_items(parent_item,top_item,option){
1887
- option = Field_Logic.get_option(Type.DATA_SUB_ITEM,option?option:{});
1888
- let items = [];
1889
- for(let a=0;a<option.item_count;a++){
1890
- let item_title ="Item " + String(parseInt(a+1));
1891
- items.push(Sub_Item_Logic.get_test(item_title,parent_item,top_item,option));
1892
- }
1893
- return items;
1894
- }
1895
- static get_test_sections(parent_item,top_item,option){
1896
- let items = [];
1897
- for(let a=0;a<option.section_count;a++){
1898
- let item_title ="Section " + String(parseInt(a+1));
1899
- let item = Sub_Item_Logic.get_test(item_title,parent_item,top_item,option);
1900
- items.push(item);
1901
- }
1902
- return items;
1903
- }
1904
- static bind_parent_child_items(item,items){
1905
- for(let a=0;a<items.length;a++){
1906
- item[Str.get_title_url(items[a].title)] = items[a];
1907
- }
1908
- return item;
1909
- }
1910
1142
  }
1911
- class App_Logic {
1912
- static get_url = (app_id,host,url,param) => {
1913
- return get_cloud_url_main(app_id,host,url,param);
1914
- };
1915
- static bind_item_parent_users = (item,parent_item,user)=>{
1916
- for(const prop in parent_item) {
1917
- item['parent_'+prop] = parent_item[prop];
1918
- }
1919
- for(const prop in user) {
1920
- item['user_'+prop] = user[prop];
1921
- }
1922
- return item;
1923
- };
1924
- static bind_item_parent_users = (items)=>{
1925
- for(let item of items) {
1926
- item = App_Logic.bind_item_parent_user_obj(item);
1927
- }
1928
- return items;
1143
+ class Data_Logic {
1144
+ static get = (data_type,id,option) => {
1145
+ return Data_Logic.get_new(data_type,id,option);
1929
1146
  };
1930
- static bind_item_parent_user_obj = (item)=>{
1931
- if(!item.user){
1932
- item.user = {};
1933
- }
1934
- if(!item.parent_item){
1935
- item.parent_item = {};
1936
- }
1937
- for(const prop in item.parent_item) {
1938
- item['parent_'+prop] = item.parent_item[prop];
1147
+ static get_new = (data_type,id,option) => {
1148
+ let data = {data_type:data_type,id:id};
1149
+ option = option ? option : {};
1150
+ data = Field_Logic.get_base_option(data,option);
1151
+ if(option.test){
1152
+ switch(data_type)
1153
+ {
1154
+ case Type.DATA_BLOG_POST:
1155
+ data = Obj.merge(Blog_Post_Logic.get_test(),data);
1156
+ break;
1157
+ case Type.DATA_SERVICE:
1158
+ data = Obj.merge(Service_Logic.get_test(),data);
1159
+ break;
1160
+ case Type.DATA_EVENT:
1161
+ data = Obj.merge(Event_Logic.get_test(),data);
1162
+ break;
1163
+ case Type.DATA_PRODUCT:
1164
+ data = Obj.merge(Product_Logic.get_test(),data);
1165
+ break;
1166
+ case Type.DATA_CONTENT:
1167
+ case Type.DATA_CATEGORY:
1168
+ case Type.DATA_BLANK:
1169
+ data = Obj.merge(Blank_Logic.get_test(),data);
1170
+ break;
1171
+ case Type.DATA_USER:
1172
+ data = Obj.merge(User_Logic.get_test(),data);
1173
+ break;
1174
+ default:
1175
+ data = Obj.merge(Blank_Logic.get_test(),data);
1176
+ data.data_type = data_type;
1177
+ break;
1178
+ }
1939
1179
  }
1940
- for(const prop in item.user) {
1941
- item['user_'+prop] = item.user[prop];
1180
+ if(option.test_blank){
1181
+ for(const field in data){
1182
+ if(field != Type.FIELD_ID && field != Type.FIELD_DATA_TYPE){
1183
+ data[field] = '';
1184
+ }
1185
+ }
1942
1186
  }
1943
- return item;
1944
- };
1945
- static url_dashboard_user_home = (app_id,url,param) => {
1946
- let action_url="dashboard/user_home";
1947
- return get_cloud_url_main(app_id,url,action_url,param);
1948
- };
1949
- static url_dashboard_app_home = (app_id,url,param) => {
1950
- let action_url="dashboard/app_home";
1951
- return get_cloud_url_main(app_id,url,action_url,param);
1187
+ return data;
1952
1188
  };
1953
- static get_new = (title,user_id,type,option) =>{
1954
- option = Field_Logic.get_option(Type.DATA_APP,option?option:{});
1955
- let app = DataItem.get_new(Type.DATA_APP,0);
1956
- app.title = title;
1957
- app.user_id = user_id;
1958
- app.type = type;
1959
- return app;
1960
- }
1961
1189
  static get_search = (data_type,filter,sort_by,page_current,page_size) => {
1962
1190
  return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
1963
1191
  }
1964
- static get_join = (type,search,field,image,title) => {
1965
- type = type ? type : Type.TITLE_ITEMS;
1966
- search = search ? search : App_Logic.get_search(Type.DATA_BLANK,{},{},1,0);
1967
- field = field ? field : {};
1968
- image = image ? image : {};
1969
- title = title ? title : '';
1970
- return {type:type,search:search,field:field,image:image,title:title};
1192
+ static get_search_group = (option) => {
1193
+ option = option ? option : {};
1194
+ let type = option.type ? option.type : Type.TITLE_ITEMS;
1195
+ let field = option.field ? option.field : {};
1196
+ let title = option.title ? option.title : {};
1197
+ let image = option.image ? option.image : {count:0,sort_by:Type.TITLE_SORT_BY_ASC};
1198
+ let page_current = option.page_current ? option.page_current : 0;
1199
+ let page_size = option.page_size ? option.page_size : 0;
1200
+ return {type:type,field:field,title:title,image:image,page_current:page_current,page_size:page_size};
1971
1201
  }
1972
- static get_foreign = (type,foreign_data_type,foreign_field,parent_field,field,image,title) => {
1202
+ static get_search_foreign = (type,foreign_data_type,foreign_field,parent_field,option) => {
1203
+ option = option ? option : {};
1973
1204
  type = type ? type : Type.TITLE_ITEMS;
1974
- foreign_data_type = foreign_data_type ? foreign_data_type : DataType.BLANK;
1205
+ foreign_data_type = foreign_data_type ? foreign_data_type : Str.get_title_url(Type.get_data_type_by_type(foreign_data_type,{plural:true}));
1975
1206
  foreign_field = foreign_field ? foreign_field : Type.FIELD_PARENT_ID;
1976
1207
  parent_field = parent_field ? parent_field : parent_field;
1977
- field = field ? field : {};
1978
- image = image ? image : {};
1979
- title = title ? title : '';
1980
- return {type:type,foreign_data_type:foreign_data_type,parent_field:parent_field,field:field,image:image,title:title};
1208
+ let field = option.field ? option.field : {};
1209
+ let title = option.title ? option.title : Str.get_title_url(Type.get_data_type_by_type(foreign_data_type,{plural:true}));
1210
+ let page_current = option.page_current ? option.page_current : 0;
1211
+ let page_size = option.page_size ? option.page_size : 0;
1212
+ return {type:type,foreign_data_type:foreign_data_type,foreign_field:foreign_field,parent_field:parent_field,type:type,field:field,title:title,page_current:page_current,page_size:page_size};
1213
+ }
1214
+ static get_search_join = (type,search,option) => {
1215
+ option = option ? option : {};
1216
+ type = type ? type : Type.TITLE_ITEMS;
1217
+ search = search ? search : Data_Logic.get_search(Type.DATA_BLANK,{},{},1,0);
1218
+ let field = option.field ? option.field : {};
1219
+ let title = option.title ? option.title : Str.get_title_url(Type.get_data_type_by_type(search.data_type,{plural:true}));
1220
+ let page_current = option.page_current ? option.page_current : 1;
1221
+ let page_size = option.page_size ? option.page_size : 0;
1222
+ return {type:type,search:search,field:field,title:title,page_current:page_current,page_size:page_size};
1981
1223
  }
1224
+ static get_copy = (data_type,item)=>{
1225
+ let copy_item = Data_Logic.get_new(data_type,0);
1226
+ const keys = Object.keys(item);
1227
+ keys.forEach(key => {
1228
+ if(
1229
+ key!=Type.FIELD_ID&&
1230
+ key!=Type.FIELD_SOURCE&&
1231
+ key!=Type.FIELD_TITLE&&
1232
+ key!=Type.FIELD_TITLE_URL&&
1233
+ key!=Type.FIELD_DATE_CREATE&&
1234
+ key!=Type.FIELD_DATE_SAVE&&
1235
+ key!=Type.TITLE_OBJ&&
1236
+ key!=Type.TITLE_USER&&
1237
+ key!=Type.TITLE_GROUP&&
1238
+ key!=Type.TITLE_ITEM&&
1239
+ !Obj.check_is_array(item[key])&&
1240
+ Obj.check_is_value(item[key])
1241
+ ){
1242
+ copy_item[key]=item[key];
1243
+ }
1244
+ });
1245
+ return copy_item;
1246
+ };
1982
1247
  static get_not_found = (data_type,id,option) =>{
1983
1248
  option=option?option:{};
1984
- if(data_type != Type.DATA_USER){
1249
+ if(!data_type){
1250
+ data_type = Type.DATA_BLANK;
1251
+ }
1985
1252
  if(!id){
1986
- id=0;
1253
+ id = 0;
1987
1254
  }
1988
- let item = Item_Logic.get_test("",data_type,id,{get_blank:true})
1989
- item.id = 0;
1990
- item.id_key = id;
1991
- item.title = "Item Not Found";
1992
- item.title_url = Str.get_title_url(item.title);
1993
- item.images = [];
1994
- item.items = [];
1995
- return item;
1255
+ if(data_type != Type.DATA_USER){
1256
+ if(!id){
1257
+ id=0;
1258
+ }
1259
+ let item = Data_Logic.get(data_type,id);
1260
+ item.id = 0;
1261
+ item.id_key = id;
1262
+ item.title = "Item Not Found";
1263
+ item.title_url = Str.get_title_url(item.title);
1264
+ item.source = Type.TITLE_SOURCE_NOT_FOUND;
1265
+ return item;
1996
1266
  }else{
1997
- let user = User_Logic.get_test("",{get_blank:true})
1998
- user.id = 0;
1999
- user.id_key = id;
2000
- user.title = "User Not Found";
2001
- user.first_name = "User Not Found";
2002
- user.title_url = Str.get_title_url(user.title);
2003
- user.images = [];
2004
- user.items = [];
2005
- return user;
1267
+ let user = Data_Logic.get(data_type,id);
1268
+ user.id = 0;
1269
+ user.id_key = id;
1270
+ user.title = "User Not Found";
1271
+ user.first_name = "User Not Found";
1272
+ user.title_url = Str.get_title_url(user.title);
1273
+ user.source = Type.TITLE_SOURCE_NOT_FOUND;
1274
+ return user;
2006
1275
  }
2007
-
1276
+ };
1277
+ }
1278
+ class App_Logic {
1279
+ static get = (title,user_id,type) =>{
1280
+ let app = Data_Logic.get_new(Type.DATA_APP,0);
1281
+ app.title = title;
1282
+ app.user_id = user_id;
1283
+ app.type = type;
1284
+ return app;
1285
+ }
1286
+ static get_url = (app_id,host,url,param) => {
1287
+ if(!param){
1288
+ param='';
1289
+ }
1290
+ var app_id_url='?app_id='+app_id;
1291
+ return host+"/"+url+app_id_url + param;
2008
1292
  };
2009
1293
  static get_search_query(search){
2010
1294
  let url = "";
@@ -2052,28 +1336,10 @@ class App_Logic {
2052
1336
  filter[query['filter_key_'+a]] = query['filter_value_'+a]
2053
1337
  }
2054
1338
  }
2055
- return App_Logic.get_search(query.data_type,filter,sort_by,query.page_current,query.page_size);
2056
- }
2057
- static get_data_search_result = (app_id,data_type,item_count,page_count,filter,items,option) =>{
2058
- return{
2059
- option:option?option:{},
2060
- data_type:data_type?data_type:Type.DATA_BLANK,
2061
- item_count:item_count?item_count:0,
2062
- page_count:page_count?page_count:1,
2063
- filter:filter?filter:{},
2064
- items:items?items:[]
2065
- }
1339
+ return Data_Logic.get_search(query.data_type,filter,sort_by,query.page_current,query.page_size);
2066
1340
  }
2067
1341
  }
2068
1342
  class File_Logic {
2069
- static url_post = (app_id,url,param) => {
2070
- let action_url="main/file/post";
2071
- return get_cloud_url_main(app_id,url,action_url,param);
2072
- };
2073
- static url_post_cdn = (app_id,url,param) => {
2074
- let action_url="main/file/post_cdn";
2075
- return get_cloud_url_main(app_id,url,action_url,param);
2076
- };
2077
1343
  static url = (host,file_filename,size,param) =>{
2078
1344
  host = host ? host : "";
2079
1345
  file_filename = file_filename ? file_filename : "";
@@ -2081,23 +1347,15 @@ class File_Logic {
2081
1347
  param = param ? param : "";
2082
1348
  return host+"/"+size + "_"+file_filename+param;
2083
1349
  }
2084
- static get_new_by_base64 = (item_file) =>{
2085
- let item = DataItem.get_new(Type.DATA_FILE,0,item_file);
2086
- item.extension = !Str.check_is_null(Str.get_file_type_from_base64(item.file_data)) ? Str.get_file_type_from_base64(item.file_data).extension : 'txt';
2087
- item.file_filename = !Str.check_is_null(Str.get_file_type_from_base64(item.file_data)) ? Str.get_guid()+ "." + item.extension : 'not_found.txt';
2088
- item.buffer = !Str.check_is_null(Str.get_file_type_from_base64(item_file.file_data)) ? Buffer.from(item_file.file_data.split(';base64,').pop(), 'base64') : null;
2089
- return item;
2090
- };
1350
+ static get_by_base64 = (item_file) =>{
1351
+ let item = Data_Logic.get_new(Type.DATA_FILE,0,{data:item_file});
1352
+ item.extension = !Str.check_is_null(Str.get_file_type_from_base64(item.file_data)) ? Str.get_file_type_from_base64(item.file_data).extension : 'txt';
1353
+ item.file_filename = !Str.check_is_null(Str.get_file_type_from_base64(item.file_data)) ? Str.get_guid()+ "." + item.extension : 'not_found.txt';
1354
+ item.buffer = !Str.check_is_null(Str.get_file_type_from_base64(item_file.file_data)) ? Buffer.from(item_file.file_data.split(';base64,').pop(), 'base64') : null;
1355
+ return item;
1356
+ };
2091
1357
  };
2092
1358
  class Image_Logic {
2093
- static url_post = (app_id,url,param) => {
2094
- let action_url="main/image/post";
2095
- return get_cloud_url_main(app_id,url,action_url,param);
2096
- };
2097
- static url_post_cdn = (app_id,url,param) => {
2098
- let action_url="main/image/post_cdn";
2099
- return get_cloud_url_main(app_id,url,action_url,param);
2100
- };
2101
1359
  static url = (host,image_filename,size,param) =>{
2102
1360
  host = host ? host : "";
2103
1361
  image_filename = image_filename ? image_filename : "";
@@ -2105,13 +1363,13 @@ class Image_Logic {
2105
1363
  param = param ? param : "";
2106
1364
  return host+"/"+size + "_"+image_filename+param;
2107
1365
  }
2108
- static get_new_by_base64 = (item_image) =>{
2109
- let item = DataItem.get_new(Type.DATA_IMAGE,0,item_image);
2110
- item.extension = !Str.check_is_null(Str.get_file_type_from_base64(item.image_data)) ? Str.get_file_type_from_base64(item.image_data).extension : 'jpeg';
2111
- item.image_filename = !Str.check_is_null(Str.get_file_type_from_base64(item.image_data)) ? Str.get_guid()+ "." + item.extension : 'not_found.jpeg';
2112
- item.buffer = !Str.check_is_null(Str.get_file_type_from_base64(item_image.image_data)) ? Buffer.from(item_image.image_data.split(';base64,').pop(), 'base64') : null;
2113
- return item;
2114
- };
1366
+ static get_by_base64 = (item_image) =>{
1367
+ let item = Data_Logic.get_new(Type.DATA_IMAGE,0,{data:item_image});
1368
+ item.extension = !Str.check_is_null(Str.get_file_type_from_base64(item.image_data)) ? Str.get_file_type_from_base64(item.image_data).extension : 'jpeg';
1369
+ item.image_filename = !Str.check_is_null(Str.get_file_type_from_base64(item.image_data)) ? Str.get_guid()+ "." + item.extension : 'not_found.jpeg';
1370
+ item.buffer = !Str.check_is_null(Str.get_file_type_from_base64(item_image.image_data)) ? Buffer.from(item_image.image_data.split(';base64,').pop(), 'base64') : null;
1371
+ return item;
1372
+ };
2115
1373
  static get_process_items = (upload_dir,image_filename) =>{
2116
1374
  upload_dir = upload_dir ? upload_dir : "";
2117
1375
  image_filename = image_filename ? image_filename : "";
@@ -2245,32 +1503,25 @@ class Url {
2245
1503
  }
2246
1504
  module.exports = {
2247
1505
  App_Logic,
2248
- Admin_Logic,
1506
+ Blank_Logic,
2249
1507
  Blog_Post_Logic,
2250
1508
  Cart_Logic,
2251
1509
  Category_Logic,
2252
- Content_Logic,
2253
- DataItem,
2254
- Demo_Logic,
1510
+ Data_Logic,
2255
1511
  Event_Logic,
2256
1512
  File_Logic,
2257
1513
  Field_Logic,
2258
1514
  Favorite_Logic,
2259
1515
  Gallery_Logic,
2260
- Item_Logic,
2261
1516
  Image_Logic,
2262
1517
  Message,
2263
1518
  Order_Logic,
2264
- Page_Logic,
2265
1519
  Product_Logic,
2266
1520
  Review_Logic,
2267
1521
  Service_Logic,
2268
- Sub_Item_Logic,
2269
1522
  Stat_Logic,
2270
1523
  Storage,
2271
- Template_Logic,
2272
1524
  Type,
2273
- Title,
2274
1525
  User_Logic,
2275
1526
  Url
2276
1527
  };