primarycare-binder 1.1.88 → 1.1.89

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 (2) hide show
  1. package/dist/index.cjs.js +118 -3
  2. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -8488,6 +8488,87 @@ var utcTOLocal$1 = function utcTOLocal(date, format) {
8488
8488
 
8489
8489
  var fmt = format ? format : "DD-MM-YYYY";
8490
8490
  return moment$1.utc(Ndate).local().format(fmt);
8491
+ };
8492
+
8493
+ var utcTOLocal_ = function utcTOLocal_(date, format) {
8494
+ var Ndate = new Date();
8495
+
8496
+ if (typeof date === "number") {
8497
+ Ndate = moment$1.unix(date);
8498
+ } else {
8499
+ Ndate = moment$1(date);
8500
+ }
8501
+
8502
+ var fmt = format ? format : "DD-MM-YYYY";
8503
+
8504
+ if (format) {
8505
+ return moment$1.utc(Ndate).local().format(fmt);
8506
+ } else {
8507
+ return moment$1.utc(Ndate).local();
8508
+ }
8509
+ };
8510
+ var getNumberOfDays = function getNumberOfDays(start, end) {
8511
+ var date1 = new Date(start);
8512
+ var date2 = new Date(end); // One day in milliseconds
8513
+
8514
+ var oneDay = 1000 * 60 * 60 * 24; // Calculating the time difference between two dates
8515
+
8516
+ var diffInTime = date2.getTime() - date1.getTime(); // Calculating the no. of days between two dates
8517
+
8518
+ var diffInDays = Math.round(diffInTime / oneDay);
8519
+ return diffInDays;
8520
+ };
8521
+ var weekCalculation = function weekCalculation(date_) {
8522
+ var d = new Date(date_);
8523
+ var date = d.getDate();
8524
+ var day = d.getDay();
8525
+ var weekOfMonth = Math.ceil((date - 1 - day) / 7);
8526
+ return weekOfMonth;
8527
+ };
8528
+ var timeLine_ = function timeLine_(appointmentDate) {
8529
+ //DAY CALCULATION
8530
+ var appDate = utcTOLocal_(appointmentDate, "MM/DD/YYY");
8531
+ var currentDate = utcTOLocal_(new Date(), "MM/DD/YYY"); //DAYS DIFFERENCE CALCULATION
8532
+
8533
+ var diffDays = getNumberOfDays(currentDate, appDate); //MONTH CALCULATION
8534
+
8535
+ var appointmentMonth = utcTOLocal_(appointmentDate, "MM");
8536
+ var currentMonth = utcTOLocal_(new Date(), "MM"); //WEEK CALCULATION
8537
+
8538
+ var appointmentWeek = weekCalculation(utcTOLocal_(appointmentDate));
8539
+ var currentWeek = weekCalculation(new Date());
8540
+ var type = ""; //TODAY
8541
+
8542
+ if (diffDays === 0) {
8543
+ type = "TODAY";
8544
+ } //THIS MONTH
8545
+ else if (currentMonth === appointmentMonth) {
8546
+ //debugger
8547
+ //THIS WEEK
8548
+ if (appointmentWeek === currentWeek) {
8549
+ type = "THIS_WEEK";
8550
+ } //LAST WEEK
8551
+ else if (appointmentWeek + 1 === currentWeek) {
8552
+ type = "LAST_WEEK";
8553
+ } //NEXT WEEK
8554
+ else if (appointmentWeek - 1 === currentWeek) {
8555
+ type = "NEXT_WEEK";
8556
+ } //THIS MONTH
8557
+ else {
8558
+ type = "THIS_MONTH";
8559
+ }
8560
+ } //LAST MONTH
8561
+ else if (appointmentMonth < currentMonth) {
8562
+ type = "LAST_MONTH";
8563
+ } //NEXT MONTH
8564
+ else if (appointmentMonth > currentMonth) {
8565
+ type = "NEXT_MONTH";
8566
+ } else {
8567
+ type = "TODAY";
8568
+ } // debugger
8569
+
8570
+
8571
+ return type;
8491
8572
  }; // const getUtcTime = (date) => {
8492
8573
  // let a = null
8493
8574
  // if (date) {
@@ -8508,7 +8589,6 @@ var utcTOLocal$1 = function utcTOLocal(date, format) {
8508
8589
  // }
8509
8590
  // };
8510
8591
 
8511
-
8512
8592
  var deg2rad = function deg2rad(deg) {
8513
8593
  return deg * (Math.PI / 180);
8514
8594
  };
@@ -11615,7 +11695,16 @@ var ALL_APPOINTMENTS = createAsyncThunk("appointmentReducer/allAppointments", /*
11615
11695
  data = _context6.sent;
11616
11696
  returnData = {
11617
11697
  pastAppointment: [],
11698
+ pastAppointmentThisWeek: [],
11699
+ pastAppointmentLastWeek: [],
11700
+ pastAppointmentThisMonth: [],
11701
+ pastAppointmentLastMonth: [],
11618
11702
  upcomingAppointment: [],
11703
+ upcomingAppointmentToday: [],
11704
+ upcomingAppointmentThisWeek: [],
11705
+ upcomingAppointmentNextWeek: [],
11706
+ upcomingAppointmentThisMonth: [],
11707
+ upcomingAppointmentNextMonth: [],
11619
11708
  followUpAppointment: [],
11620
11709
  currentVisist: []
11621
11710
  };
@@ -11623,14 +11712,40 @@ var ALL_APPOINTMENTS = createAsyncThunk("appointmentReducer/allAppointments", /*
11623
11712
  if (assemble && moment$1(utcTOLocal$1(v === null || v === void 0 ? void 0 : v.start) * 1000).startOf("day").diff(moment$1().startOf("day"), "days") === 0 && (v.comment === "completed_assemble" || v.comment === "onhold_nurse" || v.comment === "completed_nurse" || v.comment === "onhold_doctor")) {
11624
11713
  returnData.currentVisist.push(v);
11625
11714
  } else {
11626
- returnData.pastAppointment.push(v);
11715
+ var type_ = timeLine_(v.start); //debugger
11716
+
11717
+ if (type_ === "THIS_WEEK") {
11718
+ returnData.pastAppointmentThisWeek.push(v);
11719
+ } else if (type_ === "LAST_WEEK") {
11720
+ returnData.pastAppointmentLastWeek.push(v);
11721
+ } else if (type_ === "THIS_MONTH") {
11722
+ returnData.pastAppointmentThisMonth.push(v);
11723
+ } else if (type_ === "LAST_MONTH") {
11724
+ returnData.pastAppointmentLastMonth.push(v);
11725
+ } else {
11726
+ returnData.pastAppointment.push(v);
11727
+ }
11627
11728
  }
11628
11729
  });
11629
11730
  (_data$3 = data[0]) === null || _data$3 === void 0 ? void 0 : (_data$3$upcoming_appo = _data$3.upcoming_appointment) === null || _data$3$upcoming_appo === void 0 ? void 0 : (_data$3$upcoming_appo2 = _data$3$upcoming_appo.forEach) === null || _data$3$upcoming_appo2 === void 0 ? void 0 : _data$3$upcoming_appo2.call(_data$3$upcoming_appo, function (v) {
11630
11731
  if (assemble && moment$1(utcTOLocal$1(v === null || v === void 0 ? void 0 : v.start), "DD-MM-YYYY").startOf("day").diff(moment$1().startOf("day"), "days") === 0 && (v.comment === "completed_assemble" || v.comment === "onhold_nurse" || v.comment === "completed_nurse" || v.comment === "onhold_doctor")) {
11631
11732
  returnData.currentVisist.push(v);
11632
11733
  } else {
11633
- returnData.upcomingAppointment.push(v);
11734
+ var type_ = timeLine_(v.start); //debugger
11735
+
11736
+ if (type_ === "TODAY") {
11737
+ returnData.upcomingAppointmentToday.push(v);
11738
+ } else if (type_ === "THIS_WEEK") {
11739
+ returnData.upcomingAppointmentThisWeek.push(v);
11740
+ } else if (type_ === "NEXT_WEEK") {
11741
+ returnData.upcomingAppointmentNextWeek.push(v);
11742
+ } else if (type_ === "THIS_MONTH") {
11743
+ returnData.upcomingAppointmentThisMonth.push(v);
11744
+ } else if (type_ === "NEXT_MONTH") {
11745
+ returnData.upcomingAppointmentNextMonth.push(v);
11746
+ } else {
11747
+ returnData.upcomingAppointment.push(v);
11748
+ }
11634
11749
  }
11635
11750
  });
11636
11751
  return _context6.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.List), {}, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primarycare-binder",
3
- "version": "1.1.88",
3
+ "version": "1.1.89",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",