geer-builder 1.2.921 → 1.2.922
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/GProcessSale.vue
CHANGED
|
@@ -767,10 +767,47 @@ export default
|
|
|
767
767
|
this.$q.loading.hide();
|
|
768
768
|
return;
|
|
769
769
|
}
|
|
770
|
+
let saved_product_list = Array.isArray(this.field.product_list) ? [...this.field.product_list] : [];
|
|
771
|
+
let saved_email = this.field.email;
|
|
770
772
|
let sale = await this.$_fbCall('memberProcessSale', this.field);
|
|
771
773
|
this.sale_id = sale.data;
|
|
772
774
|
this.$q.loading.hide();
|
|
773
|
-
|
|
775
|
+
|
|
776
|
+
// Check for renewal products
|
|
777
|
+
let renewal_names = [];
|
|
778
|
+
if (saved_product_list.length > 0 && saved_email)
|
|
779
|
+
{
|
|
780
|
+
let customer_docs = await new DB_USER().collection().where('email', '==', saved_email).get();
|
|
781
|
+
if (customer_docs.docs.length > 0)
|
|
782
|
+
{
|
|
783
|
+
let customer = customer_docs.docs[0].data();
|
|
784
|
+
if (customer.slot_owned > 0 || customer.active_slot)
|
|
785
|
+
{
|
|
786
|
+
for (let p of saved_product_list)
|
|
787
|
+
{
|
|
788
|
+
if (p.product && p.product.membership_kit && p.product.membership_kit.use_for_renew === true)
|
|
789
|
+
{
|
|
790
|
+
renewal_names.push(p.product.product_name);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
if (renewal_names.length > 0)
|
|
798
|
+
{
|
|
799
|
+
this.$q.dialog({
|
|
800
|
+
title: 'Renewal Product Detected',
|
|
801
|
+
message: `${renewal_names.join(', ')} is a renewal product. No membership code will be generated — this product will renew the customer's privilege card upon claiming.`,
|
|
802
|
+
persistent: true
|
|
803
|
+
}).onDismiss(() => {
|
|
804
|
+
this.is_dialog_confirm_open = true;
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
else
|
|
808
|
+
{
|
|
809
|
+
this.is_dialog_confirm_open = true;
|
|
810
|
+
}
|
|
774
811
|
this.getCount();
|
|
775
812
|
this.field.email ="";
|
|
776
813
|
this.field.product_list = "";
|
|
@@ -108,38 +108,7 @@ export default {
|
|
|
108
108
|
|
|
109
109
|
async submit()
|
|
110
110
|
{
|
|
111
|
-
|
|
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
|
-
}
|
|
111
|
+
await this.processCompleteSale();
|
|
143
112
|
},
|
|
144
113
|
async processCompleteSale()
|
|
145
114
|
{
|