geer-builder 1.2.911 → 1.2.913

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.
@@ -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
  ({
@@ -52,6 +52,10 @@
52
52
  <div class="lab" v-if="is_company_success">Type of Enrollment</div>
53
53
  <div class="lab" v-else>Membership</div>
54
54
  </div>
55
+ <div class="group" v-if="expiration_date_display">
56
+ <div class="val">{{ expiration_date_display }}</div>
57
+ <div class="lab">Activated Till</div>
58
+ </div>
55
59
  </div>
56
60
 
57
61
  <div class="actions" :style="create_slot ? `grid-template-columns: 1fr 1fr 1fr;` : ``" v-if="prop_user_info.uid !== user_info.uid">
@@ -161,7 +165,18 @@ export default
161
165
  this.$q.loading.hide();
162
166
  }
163
167
  },
164
- computed: { }
168
+ computed: {
169
+ expiration_date_display()
170
+ {
171
+ if (this.slot_info && this.slot_info.length > 0 && this.slot_info[0].expiration_date)
172
+ {
173
+ let ed = this.slot_info[0].expiration_date;
174
+ let date = new Date(ed.seconds ? ed.seconds * 1000 : ed);
175
+ return this.$_formatDate(date);
176
+ }
177
+ return null;
178
+ }
179
+ }
165
180
  }
166
181
  </script>
167
182
 
@@ -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.911",
3
+ "version": "1.2.913",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {