geer-builder 1.2.910 → 1.2.912

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/GCheckout.vue CHANGED
@@ -604,7 +604,7 @@ export default {
604
604
 
605
605
  if(this.public_settings.hasOwnProperty('registration_sponsor') && this.public_settings.registration_sponsor.active)
606
606
  {
607
- if(this.user_info.slot_owned > 0 )
607
+ if(this.user_info.slot_owned > 0 && this.user_info.active_slot)
608
608
  {
609
609
  let slot = await new DB_SLOT().getSponsor(this.user_info.active_slot);
610
610
  if(slot.length>0)
@@ -1427,11 +1427,12 @@ export default {
1427
1427
  }
1428
1428
  else
1429
1429
  {
1430
- if(free_shipping_ctr >= 1 && is_merchant_free_shipping !== true && pro.product.merchant_free_shipping_applied === true)
1430
+ let has_free_shipping = pro.product.merchant_free_shipping_applied === true || pro.product.product_fee_shipping_applied === true;
1431
+ if(free_shipping_ctr >= 1 && is_merchant_free_shipping !== true && has_free_shipping)
1431
1432
  {
1432
1433
  this.is_merchant_free_shipping_conflict = true;
1433
1434
  }
1434
- else if(free_shipping_ctr >= 1 && is_merchant_free_shipping === true && pro.product.merchant_free_shipping_applied !== true)
1435
+ else if(free_shipping_ctr >= 1 && is_merchant_free_shipping === true && !has_free_shipping)
1435
1436
  {
1436
1437
  this.is_merchant_free_shipping_conflict = true;
1437
1438
  }
@@ -1447,7 +1448,7 @@ export default {
1447
1448
  }
1448
1449
 
1449
1450
  free_shipping_ctr++;
1450
- if(pro.product.merchant_free_shipping_applied === true)
1451
+ if(pro.product.merchant_free_shipping_applied === true || pro.product.product_fee_shipping_applied === true)
1451
1452
  {
1452
1453
  is_merchant_free_shipping = true;
1453
1454
  }
@@ -2425,6 +2426,14 @@ export default {
2425
2426
  }
2426
2427
  else
2427
2428
  {
2429
+ // Check for renewal products before proceeding
2430
+ let proceed = await this.checkRenewalPrompt();
2431
+ if (!proceed)
2432
+ {
2433
+ this.$q.loading.hide();
2434
+ return;
2435
+ }
2436
+
2428
2437
  if(sessionStorage.referral_slot_code && this.payment_method.payment_method_id != "gc_points")
2429
2438
  {
2430
2439
  this.checkout_info.referral_slot_code = sessionStorage.referral_slot_code;
@@ -2531,6 +2540,40 @@ export default {
2531
2540
  this.$q.dialog({ html: true, title: `Something's not quite right`, message: error.message });
2532
2541
  }
2533
2542
  },
2543
+ async checkRenewalPrompt()
2544
+ {
2545
+ // Check if any product in checkout is a renewal product and user has a slot
2546
+ if (!this.user_info || !this.user_info.active_slot) return true; // no slot, proceed normally
2547
+
2548
+ let renewal_products = [];
2549
+ if (this.checkout_info && this.checkout_info.product_list)
2550
+ {
2551
+ for (let p of this.checkout_info.product_list)
2552
+ {
2553
+ if (p.product && p.product.membership_kit && p.product.membership_kit.use_for_renew === true)
2554
+ {
2555
+ renewal_products.push(p);
2556
+ }
2557
+ }
2558
+ }
2559
+
2560
+ if (renewal_products.length === 0) return true; // no renewal products, proceed
2561
+
2562
+ let product_names = renewal_products.map(p => `"${p.product.product_name}" (x${p.quantity})`).join(', ');
2563
+
2564
+ return new Promise((resolve) => {
2565
+ this.$q.dialog({
2566
+ title: 'Renewal Confirmation',
2567
+ message: `${product_names} will be used for renewal of your privilege card because you already have an activated slot. Proceed?`,
2568
+ cancel: true,
2569
+ persistent: true
2570
+ }).onOk(() => {
2571
+ resolve(true);
2572
+ }).onCancel(() => {
2573
+ resolve(false);
2574
+ });
2575
+ });
2576
+ },
2534
2577
  showActivePayment()
2535
2578
  {
2536
2579
  if(this.product_list.length>0)
@@ -10,7 +10,7 @@
10
10
  <div class="prod_name product-list-name" :style="'max-width:'+width+';'">{{field.product_name}}</div>
11
11
  <!-- <div class="prod_description">{{field.description}}</div> -->
12
12
  <div class="prod_price price">{{main_currency}} {{$_formatNumber(field.selling_price, { decimal: 2})}}</div>
13
- <div><q-btn class="full-width" label="Buy Now" color="primary" @click="showMore(field)"></q-btn></div>
13
+ <div><q-btn class="full-width" :label="button_label" color="primary" @click="showMore(field)"></q-btn></div>
14
14
  <!-- <div style="text-decoration:underline;color:blue;cursor:pointer;" @click="showMore(field)">Show More</div> -->
15
15
  </div>
16
16
  </div>
@@ -42,6 +42,7 @@ export default {
42
42
  image_size:String,
43
43
  country_code: String,
44
44
  heading: { type: String, default: 'Be a Member to make the World better' },
45
+ button_label: { type: String, default: 'Buy Now' },
45
46
  },
46
47
  data: () =>
47
48
  ({
@@ -107,6 +107,41 @@ export default {
107
107
  },
108
108
 
109
109
  async submit()
110
+ {
111
+ // Check for renewal products before processing
112
+ let renewal_products = [];
113
+ if (this.sale && this.sale.product_list)
114
+ {
115
+ for (let p of this.sale.product_list)
116
+ {
117
+ if (p.product && p.product.membership_kit && p.product.membership_kit.use_for_renew === true
118
+ && this.user && (this.user.slot_owned > 0 || this.user.active_slot))
119
+ {
120
+ renewal_products.push(p);
121
+ }
122
+ }
123
+ }
124
+
125
+ if (renewal_products.length > 0)
126
+ {
127
+ let product_names = renewal_products.map(p => `"${p.product.product_name}" (x${p.quantity})`).join(', ');
128
+ let customer_name = this.sale.customer.full_name || this.sale.customer.email;
129
+
130
+ this.$q.dialog({
131
+ title: 'Renewal Confirmation',
132
+ message: `${product_names} will be used for renewal of ${customer_name}'s privilege card because they already have an activated slot. Proceed?`,
133
+ cancel: true,
134
+ persistent: true
135
+ }).onOk(async () => {
136
+ await this.processCompleteSale();
137
+ });
138
+ }
139
+ else
140
+ {
141
+ await this.processCompleteSale();
142
+ }
143
+ },
144
+ async processCompleteSale()
110
145
  {
111
146
  this.$q.loading.show();
112
147
 
@@ -26,6 +26,45 @@ export default
26
26
  let call_method = FUNCTIONS.httpsCallable('apiCall');
27
27
  return await call_method(data);
28
28
  },
29
+ $_checkSlotExpirationLocal(slot_info, public_settings)
30
+ {
31
+ if (!public_settings || !public_settings.slot_expiration || !public_settings.slot_expiration.enable)
32
+ {
33
+ return { expiration_enabled: false };
34
+ }
35
+ if (!slot_info || !slot_info.created_date)
36
+ {
37
+ return { expiration_enabled: true, has_slot: false };
38
+ }
39
+
40
+ let expiration_date;
41
+ if (slot_info.expiration_date)
42
+ {
43
+ let ed = slot_info.expiration_date;
44
+ expiration_date = new Date(ed.seconds ? ed.seconds * 1000 : ed);
45
+ }
46
+ else
47
+ {
48
+ // Fallback for old slots without expiration_date (only created_date needed)
49
+ let expiration_days = public_settings.slot_expiration.initial_expiration_days;
50
+ let cd = slot_info.created_date;
51
+ expiration_date = new Date(cd.seconds ? cd.seconds * 1000 : cd);
52
+ expiration_date.setDate(expiration_date.getDate() + expiration_days);
53
+ }
54
+
55
+ let now = new Date();
56
+ let is_expired = now >= expiration_date;
57
+ let days_remaining = Math.ceil((expiration_date - now) / (1000 * 60 * 60 * 24));
58
+
59
+ return {
60
+ expiration_enabled: true,
61
+ has_slot: true,
62
+ is_expired,
63
+ days_remaining: is_expired ? 0 : days_remaining,
64
+ expiration_date,
65
+ membership_id: slot_info.membership_id
66
+ };
67
+ },
29
68
  async filterMembershipByCountry(data, country)
30
69
  {
31
70
  let return_data = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geer-builder",
3
- "version": "1.2.910",
3
+ "version": "1.2.912",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {