geer-builder 1.2.663 → 1.2.665

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/GCheckout.vue +50 -21
  2. package/package.json +1 -1
package/GCheckout.vue CHANGED
@@ -671,15 +671,18 @@ export default {
671
671
  },
672
672
  watch:
673
673
  {
674
- async dragon_pay_choice()
674
+ async dragon_pay_choice(value)
675
675
  {
676
- this.gcash_fee = 0;
677
- this.show_gcash_fee = false;
678
- if(this.dragon_pay_choice.shortName == 'GCash' || this.dragon_pay_choice.shortName == 'GCash App')
679
- {
680
- this.show_gcash_fee = true;
681
- this.addGcashFee(this.groupedProducts);
676
+ if (value.remarks) {
677
+ this.$q.dialog({ html: true, title: `Remarks`, message: value.remarks });
682
678
  }
679
+ // this.gcash_fee = 0;
680
+ // this.show_gcash_fee = false;
681
+ // if(this.dragon_pay_choice.shortName == 'GCash' || this.dragon_pay_choice.shortName == 'GCash App')
682
+ // {
683
+ // this.show_gcash_fee = true;
684
+ // this.addGcashFee(this.groupedProducts);
685
+ // }
683
686
  },
684
687
  async payment_method()
685
688
  {
@@ -767,26 +770,52 @@ export default {
767
770
  },
768
771
  async getPaymentChannel()
769
772
  {
773
+ const checkMaskCurrentDayAvailable = (mask) => {
774
+ if (mask.length !== 7) return false;
775
+ const today = new Date();
776
+ const currentDayIndex = today.getUTCDay();
777
+ const currentDayAvailability = mask[currentDayIndex];
778
+ return currentDayAvailability === 'X';
779
+ };
780
+
781
+ const isCurrentTimeAvailable = (startTime, endTime) => {
782
+ if (startTime === endTime) return true;
783
+
784
+ const currentTime = new Date();
785
+ const currentHours = currentTime.getHours();
786
+ const currentMinutes = currentTime.getMinutes();
787
+ const currentTimeInMinutes = currentHours * 60 + currentMinutes;
788
+
789
+ const startHours = parseInt(startTime.split(':')[0], 10);
790
+ const startMinutes = parseInt(startTime.split(':')[1], 10);
791
+ const startTimeInMinutes = startHours * 60 + startMinutes;
792
+
793
+ const endHours = parseInt(endTime.split(':')[0], 10);
794
+ const endMinutes = parseInt(endTime.split(':')[1], 10);
795
+ const endTimeInMinutes = endHours * 60 + endMinutes;
796
+
797
+ if (startTimeInMinutes <= endTimeInMinutes) {
798
+ // start time and end time are in the same day
799
+ return currentTimeInMinutes >= startTimeInMinutes && currentTimeInMinutes <= endTimeInMinutes;
800
+ } else {
801
+ // start time is later than end time, so it spans across midnight
802
+ return currentTimeInMinutes >= startTimeInMinutes || currentTimeInMinutes <= endTimeInMinutes;
803
+ }
804
+ };
805
+
770
806
  if(this.public_settings.hasOwnProperty('dragonpay_details') && this.public_settings.dragonpay_details.active)
771
807
  {
772
- // this.filtered_payment_channel = this.public_settings.dragonpay_details.hasOwnProperty('active_payment') ? this.public_settings.dragonpay_details.active_payment : [];
773
808
  try
774
809
  {
775
810
  let ret = await this.$_fbCall('memberGetPaymentChannel', {amount:this.dragon_pay_amount});
776
811
  let return_payment = ret.data;
777
- // console.log(return_payment, 'All Dragonpay channel');
778
- let x = 0;
779
- // let filtered_payment = [];
780
- // for (const element of return_payment)
781
- // {
782
- // if(this.filtered_payment_channel.includes(element.shortName))
783
- // {
784
- // filtered_payment.push(element);
785
- // }
786
- // x++;
787
- // }
788
- // console.log(return_payment);
789
- this.available_payment_channel = return_payment.filter(data => data.status === 'A');
812
+
813
+ this.available_payment_channel = return_payment.filter(data => {
814
+ const isAvailable = data.status === 'A';
815
+ const isTimeAvailable = isCurrentTimeAvailable(data.startTime, data.endTime);
816
+ const isMaskAvailable = checkMaskCurrentDayAvailable(data.dayOfWeek);
817
+ return (isAvailable && isTimeAvailable && isMaskAvailable) || false;
818
+ });
790
819
  }
791
820
  catch (error)
792
821
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geer-builder",
3
- "version": "1.2.663",
3
+ "version": "1.2.665",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {