biz9-logic 3.5.28 → 3.5.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/biz9_config +1 -1
  2. package/index.js +59 -26
  3. package/package.json +2 -2
  4. package/test.js +26 -1
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='3.7.8'
1
+ VERSION='3.8.1'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -287,12 +287,12 @@ class CMS {
287
287
  class Stock {
288
288
  static get_event_stock_list = () => {
289
289
  const r_list=
290
- [
291
- { value: "0", label: "Sold Out" },
292
- { value: "1", label: "Less Than 25 Tickets Remaining" },
293
- { value: "2", label: "Tickets Are Availble" },
294
- { value: "3", label: "Sold Out" },
295
- ];
290
+ [
291
+ { value: "0", label: "Sold Out" },
292
+ { value: "1", label: "Less Than 25 Tickets Remaining" },
293
+ { value: "2", label: "Tickets Are Availble" },
294
+ { value: "3", label: "Sold Out" },
295
+ ];
296
296
  return r_list;
297
297
  };
298
298
  static get_event_stock_by_value = (stock_val) => {
@@ -313,12 +313,12 @@ class Stock {
313
313
  }
314
314
  };
315
315
  static get_service_stock_list = () => {
316
- const r_list=
317
- [
318
- { value: "0", label: "No Sessions Availble" },
319
- { value: "1", label: "Ready For Booking" },
320
- { value: "2", label: "No Sessions Availble" }
321
- ];
316
+ const r_list=
317
+ [
318
+ { value: "0", label: "No Sessions Availble" },
319
+ { value: "1", label: "Ready For Booking" },
320
+ { value: "2", label: "No Sessions Availble" }
321
+ ];
322
322
  return r_list;
323
323
  };
324
324
  static get_service_stock_by_value = (stock_val) => {
@@ -337,12 +337,12 @@ class Stock {
337
337
  };
338
338
  static get_product_stock_list = () => {
339
339
  const r_list=
340
- [
341
- { value: "0", label: "Out of Stock" },
342
- { value: "1", label: "Only 1 Left" },
343
- { value: "2", label: "Less Than 3 Left" },
344
- { value: "3", label: "Availble" }
345
- ];
340
+ [
341
+ { value: "0", label: "Out of Stock" },
342
+ { value: "1", label: "Only 1 Left" },
343
+ { value: "2", label: "Less Than 3 Left" },
344
+ { value: "3", label: "Availble" }
345
+ ];
346
346
  return r_list;
347
347
  };
348
348
  static get_product_stock_by_value = (stock_val) => {
@@ -368,8 +368,26 @@ class Stock {
368
368
 
369
369
  }
370
370
  class Schedule {
371
+ static get_start_date_time = (item) =>{
372
+ if(!item.date){
373
+ item.date = new Date();
374
+ }
375
+ if(!item.time){
376
+ item.time = new Date();
377
+ }
378
+ item.start_date = DateTime.get_full_date_by_date_time(item.date,item.time);
379
+ item.start_time = DateTime.get_full_time_by_date_time(item.date,item.time);
380
+ item.start_date_time = DateTime.get_full_date_time_by_date_time(item.date,item.time);
381
+ return item;
382
+ }
371
383
  static get_start_date_time_by_list = (list) =>{
372
- for(a=0;a<list.length;a++){
384
+ for(let a=0;a<list.length;a++){
385
+ if(!list[a].date){
386
+ item.date = new Date();
387
+ }
388
+ if(!list[a].time){
389
+ list[a].time = new Date();
390
+ }
373
391
  list[a].start_date = DateTime.get_full_date_by_date_time(list[a].date,list[a].time);
374
392
  list[a].start_time = DateTime.get_full_time_by_date_time(list[a].date,list[a].time);
375
393
  list[a].start_date_time = DateTime.get_full_date_time_by_date_time(list[a].date,list[a].time);
@@ -377,15 +395,30 @@ class Schedule {
377
395
  return list;
378
396
  }
379
397
  };
398
+ class Storage {
399
+ static get = (key) =>{
400
+ return localStorage.getItem(key);
401
+ }
402
+ static set = (key,value) =>{
403
+ localStorage.setItem(key,value);
404
+ }
405
+ static remove = (key) =>{
406
+ localStorage.removeItem(key);
407
+ }
408
+ static clear = () =>{
409
+ localStorage.clear();
410
+ }
411
+ }
380
412
  module.exports = {
381
- Schedule,
382
- Stock,
383
- DataType,
413
+ BiZ_Url,
414
+ Cat,
415
+ CMS,
384
416
  DataItem,
417
+ DataType,
385
418
  Message,
386
- Url,
387
- BiZ_Url,
388
419
  Obj,
389
- CMS,
390
- Cat
420
+ Storage,
421
+ Schedule,
422
+ Stock,
423
+ Url,
391
424
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "3.5.28",
3
+ "version": "3.5.31",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -10,7 +10,7 @@
10
10
  "dependencies": {
11
11
  "async-series": "^0.0.1",
12
12
  "biz9-scriptz": "^5.5.4",
13
- "biz9-utility": "^3.2.5",
13
+ "biz9-utility": "^3.5.2",
14
14
  "jest": "^29.7.0"
15
15
  },
16
16
  "repository": {
package/test.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const path = require('path');
2
2
  const series = require('async-series');
3
- const {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock} = require('./');
3
+ const {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock,Schedule,Storage} = require('./');
4
4
  const {Log,Test,Number} = require('biz9-utility');
5
5
  const {Scriptz}= require('biz9-scriptz');
6
6
 
@@ -28,6 +28,31 @@ const biz9_config ={
28
28
  describe("connect", () => {
29
29
  it("_connect", () => {
30
30
  series([
31
+ function(call) {
32
+ console.log('GET_START_STORAGE-START');
33
+ Log.w('storage-start',Storage.set(Number.get_id()));
34
+ console.log('GET_START_STORAGE-END');
35
+ //call();
36
+ },
37
+
38
+ function(call) {
39
+ console.log('GET_START_DATE_TIME-START');
40
+ Log.w('get_start_date_time',Schedule.get_start_date_time({date:new Date(),time: new Date()}));
41
+ console.log('GET_START_DATE_TIME-END');
42
+ //call();
43
+ },
44
+ function(call) {
45
+ console.log('GET_START_DATE_TIME_BY_LIST-START');
46
+ event_list = [
47
+ {date:new Date(),time: new Date()},
48
+ {date:new Date(),time: new Date()},
49
+ {date:new Date(),time: new Date()}
50
+ ];
51
+ Log.w('get_event_list',Schedule.get_start_date_time_by_list(event_list));
52
+ console.log('GET_START_DATE_TIME_BY_LIST-END');
53
+ //call();
54
+ },
55
+
31
56
  function(call) {
32
57
  console.log('GET-ALL-STOCK-LIST-START');
33
58
  Log.w('get_event_list',Stock.get_event_stock_list());