geer-builder 1.2.607 → 1.2.608

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
@@ -154,10 +154,14 @@
154
154
  </tr>
155
155
  <tr v-for="(payment, index) in payment_list" :key="index">
156
156
  <td>{{payment.payment_type.method_name}}</td>
157
- <td>
157
+ <td v-if="!up_coin_pay">
158
158
  {{payment.payment_amount}} {{public_settings.cashier_currency ? public_settings.cashier_currency : ''}}
159
159
  <q-icon name="fa fa-times" size="14px" class="q-mr-sm" style="color:red" @click="removePayment(index)"></q-icon>
160
160
  </td>
161
+ <td v-else>
162
+ {{payment.payment_amount}}
163
+ <q-icon name="fa fa-times" size="14px" class="q-mr-sm" style="color:red" @click="removePayment(index)"></q-icon>
164
+ </td>
161
165
  </tr>
162
166
  <tr style="border-top:solid 1.5px black">
163
167
  <td class="subheader">Balance</td>
@@ -168,6 +172,10 @@
168
172
  </div>
169
173
 
170
174
  <div class="buttons text-right">
175
+ <q-btn v-if="up_coin_button" color="primary" @click="upcoinPay()" unelevated style="margin-right:5px">
176
+ <q-icon name="fas fa-coins" size="14px" class="q-mr-sm"></q-icon>
177
+ UPCoin Pay
178
+ </q-btn>
171
179
  <q-btn color="primary" v-if="!hide_manage_discount" @click=openDiscount unelevated style="margin-right:5px">
172
180
  <q-icon name="fa fa-percent" size="14px" class="q-mr-sm"></q-icon>
173
181
  Add Discount
@@ -176,7 +184,7 @@
176
184
  <q-icon name="fas fa-paper-plane" size="14px" class="q-mr-sm"></q-icon>
177
185
  Add Batch/Lot
178
186
  </q-btn>
179
- <q-btn color="primary" @click=addPayment unelevated style="margin-right:5px">
187
+ <q-btn v-if="!hide_receive_payment_button" color="primary" @click=addPayment unelevated style="margin-right:5px">
180
188
  <q-icon name="fa fa-credit-card" size="14px" class="q-mr-sm"></q-icon>
181
189
  Receive Payment
182
190
  </q-btn>
@@ -207,6 +215,11 @@
207
215
  <discount-dialog @closePopup="is_discount_dialog_open = false; sample($event)"></discount-dialog>
208
216
  </q-dialog>
209
217
 
218
+ <q-dialog v-model="is_change_payment_dialog_open">
219
+ <change-payment-method @closePopup="is_discount_dialog_open = false; sample($event)"></change-payment-method>
220
+ </q-dialog>
221
+
222
+
210
223
  <q-dialog v-model="is_sale_choose_slot_dialog_open">
211
224
  <sale-choose-slot-dialog :customer_email="field.email" @closePopup="is_sale_choose_slot_dialog_open = false; $emit('closePopup')" @slotSelect="getSelectedSlot"></sale-choose-slot-dialog>
212
225
  </q-dialog>
@@ -231,6 +244,7 @@ import DB_INVENTORY from "./models/DB_INVENTORY";
231
244
  import DB_COUNTER from "./models/DB_COUNTER";
232
245
  import ProcessSaleConfirmDialog from "./components/ProcessSaleConfirmDialog";
233
246
  import AddPaymentDialog from "./dialogs/AddPaymentDialog";
247
+ import ChangePaymentMethod from "./dialogs/ChangePaymentMethod";
234
248
  import ManagerOverrideDialog from "./dialogs/ManagerOverrideDialog";
235
249
  import DiscountDialog from "./components/DiscountDialog";
236
250
  import AddBatchDialog from "./components/AddBatchDialog";
@@ -246,6 +260,10 @@ export default
246
260
  mixins: [GlobalMixins],
247
261
  data: () =>
248
262
  ({
263
+ hide_receive_payment_button:false,
264
+ is_change_payment_dialog_open:false,
265
+ up_coin_pay:false,
266
+ up_coin_button:false,
249
267
  hide_manage_discount:true,
250
268
  show_batch:false,
251
269
  is_batch_number_dialog_open:false,
@@ -292,13 +310,14 @@ export default
292
310
  auto_fill_address:'',
293
311
  auto_fill_contact:'',
294
312
  all_address:[],
313
+ check_up_coin:false,
295
314
  }),
296
315
  props: ['stockist'],
297
- components: { AddBatchDialog, GProduct, ProcessSaleConfirmDialog, DiscountDialog, AddPaymentDialog, SaleChooseSlotDialog,ManagerOverrideDialog },
298
- mounted()
316
+ components: { ChangePaymentMethod,AddBatchDialog, GProduct, ProcessSaleConfirmDialog, DiscountDialog, AddPaymentDialog, SaleChooseSlotDialog,ManagerOverrideDialog },
317
+ async mounted()
299
318
  {
300
- this.getCount();
301
- this.getDiscountData();
319
+ await this.getCount();
320
+ await this.getDiscountData();
302
321
  if(this.stockist)
303
322
  {
304
323
  this.field.stockist = this.stockist;
@@ -337,6 +356,37 @@ export default
337
356
  },
338
357
  methods:
339
358
  {
359
+ async upcoinPay()
360
+ {
361
+ this.up_coin_pay = true;
362
+ await this.updateTable();
363
+
364
+ if(!this.chosen_slot_info.points.hasOwnProperty('up_coin'))
365
+ {
366
+ this.$q.dialog({ title: "Something's not quite right", html:true , message: `${this.chosen_slot_info.slot_code} doesnt have enough UPCoin` });
367
+ }
368
+ if(this.chosen_slot_info.points.up_coin < this.grandTotal)
369
+ {
370
+ this.$q.dialog({ title: "Something's not quite right", html:true , message: `${this.chosen_slot_info.slot_code} UPCoin is not enough to continue this transaction` });
371
+ }
372
+ else
373
+ {
374
+ this.hide_receive_payment_button = true;
375
+ let payment =
376
+ {
377
+ method_key:'up_coin',
378
+ method_name:'UPCoin'
379
+ };
380
+ let field =
381
+ {
382
+ payment_amount:this.grandTotal,
383
+ remarks:"UPCoin Payment",
384
+ payment_type:payment
385
+ };
386
+ this.payment_list.push(field);
387
+ this.up_coin_button = false;
388
+ }
389
+ },
340
390
  addBatch(batch)
341
391
  {
342
392
  if(Object.keys(batch).length === 0)
@@ -350,6 +400,7 @@ export default
350
400
  },
351
401
  unsetSlot()
352
402
  {
403
+ this.payment_list = [];
353
404
  this.slot_choose = false;
354
405
  this.slot_reference = null;
355
406
  },
@@ -363,6 +414,11 @@ export default
363
414
  {
364
415
  this.show_batch = true
365
416
  }
417
+ if(this.public_settings.hasOwnProperty('up_coin') && this.public_settings.up_coin.active)
418
+ {
419
+ this.check_up_coin = true;
420
+ }
421
+ console.log(this.check_up_coin, 'check');
366
422
  },
367
423
  resetData()
368
424
  {
@@ -468,6 +524,7 @@ export default
468
524
  },
469
525
  async getPayment(field)
470
526
  {
527
+ console.log(field, 'field');
471
528
  this.payment_list.push(field)
472
529
  },
473
530
  async getCount()
@@ -478,7 +535,6 @@ export default
478
535
  {
479
536
  if(this.public_settings.hasOwnProperty('cashier_auto_fill_address') && this.public_settings.cashier_auto_fill_address)
480
537
  {
481
-
482
538
  let customer_info = await new DB_USER().collection().where("email", "==", this.field.email).get();
483
539
  await this.$bind('all_address', new DB_USER_SHIPPING_ADDRESS(customer_info.docs[0].data().uid).collection().orderBy("default","desc"));
484
540
  if(this.all_address.length > 0)
@@ -686,6 +742,25 @@ export default
686
742
  }
687
743
 
688
744
  },
745
+ async checkUpCoin(product_list)
746
+ {
747
+ console.log(this.check_up_coin);
748
+ for(let element of product_list)
749
+ {
750
+ if(!element.product.hasOwnProperty('up_coin_price'))
751
+ {
752
+ this.up_coin_button = false;
753
+ }
754
+ else if(element.product.hasOwnProperty('up_coin_price') && element.product.up_coin_price < 1)
755
+ {
756
+ this.up_coin_button = false;
757
+ }
758
+ else
759
+ {
760
+ this.up_coin_button = true;
761
+ }
762
+ }
763
+ },
689
764
  async getSelectedSlot(chosen_slot)
690
765
  {
691
766
  this.slot_reference = chosen_slot.slot_code;
@@ -693,6 +768,13 @@ export default
693
768
  {
694
769
  this.chosen_slot_info = await this.db_slot.get(chosen_slot.slot_code)
695
770
  this.updateTable();
771
+ if(this.field.product_list.length > 0)
772
+ {
773
+ if(this.check_up_coin)
774
+ {
775
+ await this.checkUpCoin(this.field.product_list);
776
+ }
777
+ }
696
778
  }
697
779
 
698
780
  },
@@ -787,6 +869,10 @@ export default
787
869
  {
788
870
  if(this.field.product_list.length > 0)
789
871
  {
872
+ if(this.check_up_coin)
873
+ {
874
+ await this.checkUpCoin(this.field.product_list);
875
+ }
790
876
  let key = 'product_id'
791
877
  let holder = [...new Map(this.field.product_list.map(item =>
792
878
  [item[key], item])).values()];
@@ -812,9 +898,23 @@ export default
812
898
  // item_discount = await this.getDiscount(element)
813
899
  item_discount = new ProductClass().getProductDiscount( this.membership_list ,this.rank_list, this.chosen_slot_info, this.stockist_list, temp_var);
814
900
  }
815
- amount_holder = amount_holder + ((Number((element.product.selling_price - ((element.product.selling_price * item_discount) / 100))) * Number(element.quantity)))
816
- discount_holder = discount_holder + ((((element.product.selling_price * item_discount) / 100))) * Number(element.quantity);
817
- srp_holder = srp_holder + ((Number((element.product.selling_price * Number(element.quantity)))));
901
+
902
+ if(this.up_coin_pay)
903
+ {
904
+ amount_holder = amount_holder + Number((element.product.up_coin_price )* Number(element.quantity))
905
+ discount_holder = discount_holder + 0;
906
+ srp_holder = srp_holder + ((Number((element.product.up_coin_price * Number(element.quantity)))));
907
+
908
+ console.log(amount_holder, 'amount_holder');
909
+ console.log(discount_holder, 'discount_holder');
910
+ console.log(srp_holder, 'srp_holder');
911
+ }
912
+ else
913
+ {
914
+ amount_holder = amount_holder + ((Number((element.product.selling_price - ((element.product.selling_price * item_discount) / 100))) * Number(element.quantity)))
915
+ discount_holder = discount_holder + ((((element.product.selling_price * item_discount) / 100))) * Number(element.quantity);
916
+ srp_holder = srp_holder + ((Number((element.product.selling_price * Number(element.quantity)))));
917
+ }
818
918
  }
819
919
  };
820
920
  this.subTotal = amount_holder
package/GTransaction.vue CHANGED
@@ -148,6 +148,15 @@ export default
148
148
  format: val => `${val}`,
149
149
  sortable: true,
150
150
  },
151
+ {
152
+ name : 'customer_name',
153
+ label : 'Customer Name',
154
+ field : row => row.customer.name.toUpperCase(),
155
+ align : 'left',
156
+ required: true,
157
+ format: val => `${val}`,
158
+ sortable: true,
159
+ },
151
160
  {
152
161
  name : 'date',
153
162
  label : 'Date',
@@ -230,7 +239,7 @@ export default
230
239
  async getTransactionHistory()
231
240
  {
232
241
  await this.$bind('transaction_history', this.db_sale.collection().where("stockist", "==", this.user_info.branch_slot).where("status", "in", ["for pick up", "pending","completed","void", "transaction refill"]).orderBy('created_date', 'desc'));
233
- },
242
+ },
234
243
  open_dialog()
235
244
  {
236
245
  this.is_sale_history_dialog_open=true;
@@ -153,11 +153,11 @@
153
153
  </div>
154
154
  <div class="row">
155
155
  <div class="col-7 label">Total Payment</div>
156
- <div class="col-5 value text-bold">{{payment_method =='gc' ? "GC" : settings.cashier_currency ? settings.cashier_currency : settings.main_currency }} {{ $_formatNumber(total_payment, { decimal: 2}) }}</div>
156
+ <div class="col-5 value text-bold">{{payment_method =='up_coin' ? 'UPCoin': payment_method =='gc' ? "GC" : settings.cashier_currency ? settings.cashier_currency : settings.main_currency }} {{ $_formatNumber(total_payment, { decimal: 2}) }}</div>
157
157
  </div>
158
158
  <div class="row">
159
159
  <div class="col-7 label">Grand Total</div>
160
- <div class="col-5 value text-primary text-bold">{{payment_method =='gc' ? "GC" : settings.main_currency ? settings.cashier_currency : settings.main_currency}} {{ $_formatNumber(grand_total, { decimal: 2}) }}</div>
160
+ <div class="col-5 value text-primary text-bold">{{ payment_method =='up_coin' ? 'UPCoin': payment_method =='gc' ? "GC" : settings.main_currency ? settings.cashier_currency : settings.main_currency}} {{ $_formatNumber(grand_total, { decimal: 2}) }}</div>
161
161
  </div>
162
162
  <div v-if="balance" class="row">
163
163
  <div class="col-7 label">Outstanding Balance</div>
@@ -58,17 +58,17 @@
58
58
  <div class="bottom-grid">
59
59
  <div class="flex-discount">
60
60
  <div class="discount-title">Subtotal</div>
61
- <div class="discount-value">{{settings.cashier_currency ? settings.cashier_currency : '' }} {{ $_formatNumber(sub_total, { decimal: 2}) }}</div>
61
+ <div class="discount-value">{{payment_method =='up_coin' ? 'UPCoin': settings.cashier_currency ? settings.cashier_currency : '' }} {{ $_formatNumber(sub_total, { decimal: 2}) }}</div>
62
62
  </div>
63
63
  <div class="flex-discount" v-if="gc_discount || payment_method != 'gc' ">
64
64
  <div class="discount-title">Total Discount</div>
65
- <div class="discount-value">{{settings.cashier_currency ? settings.cashier_currency : '' }} {{ $_formatNumber(total_discount, { decimal: 2}) }}</div>
65
+ <div class="discount-value">{{ payment_method =='up_coin' ? 'UPCoin': settings.cashier_currency ? settings.cashier_currency : '' }} {{ $_formatNumber(total_discount, { decimal: 2}) }}</div>
66
66
  </div>
67
67
  <div class="flex-total">
68
68
  <div class="total-title"><b>Grand Total</b></div>
69
- <div class="total-value"><b>{{settings.cashier_currency ? settings.cashier_currency : '' }} {{ $_formatNumber(grand_total, { decimal: 2}) }}</b></div>
69
+ <div class="total-value"><b>{{ payment_method =='up_coin' ? 'UPCoin': settings.cashier_currency ? settings.cashier_currency : '' }} {{ $_formatNumber(grand_total, { decimal: 2}) }}</b></div>
70
70
  </div>
71
- <div class="flex-change" v-if="payment_method != 'gc'">
71
+ <div class="flex-change" v-if="payment_method != 'gc' && payment_method != 'up_coin'">
72
72
  <div class="change-title">Change</div>
73
73
  <div class="change-value">{{settings.cashier_currency ? settings.cashier_currency : '' }} {{this.change}}</div>
74
74
  </div>
@@ -109,7 +109,6 @@ export default {
109
109
  {
110
110
  await this.$bind('sale', this.db_sale.doc(this.sale_id));
111
111
  await this.$bind('user', this.db_user.doc(this.sale.customer.uid));
112
-
113
112
  },
114
113
  methods:
115
114
  {
@@ -1,19 +1,36 @@
1
1
  <template>
2
2
  <q-card class="discount-dialog" style="width: 500px; max-width: 500px; padding: 20px">
3
3
  <q-form @submit="receivePayment()">
4
- <div class="fields row">
5
- <div v-if="selected_slot" class="field col-6 text-center text-bold">
6
- Current Wallet:
4
+ <div class="fields payment-wallet">
5
+ <div class="slot-holder">
6
+ {{selected_slot_info.slot_code}}
7
+ </div>
8
+ <div class="wallet-holder-grid">
9
+ <div class="wallet-holder">
10
+ <div v-if="selected_slot" class="field col-6 text-center text-bold">
11
+ Current Wallet:
12
+ </div>
13
+ <div v-if="selected_slot" class="field col-6 text-center">
14
+ {{selected_slot_info.hasOwnProperty('wallet') ? selected_slot_info.wallet : 0}}
15
+ </div>
7
16
  </div>
8
- <div v-if="selected_slot" class="field col-6 text-center text-bold">
9
- Current GC:
17
+ <div class="gc-holder">
18
+ <div v-if="selected_slot" class="field col-6 text-center text-bold">
19
+ Current GC:
20
+ </div>
21
+ <div v-if="selected_slot" class="field col-6 text-center">
22
+ {{selected_slot_info.hasOwnProperty('points') ? selected_slot_info.points.gc : 0}}
23
+ </div>
10
24
  </div>
11
- <div v-if="selected_slot" class="field col-6 text-center">
12
- {{selected_slot_info.hasOwnProperty('wallet') ? selected_slot_info.wallet : 0}}
13
- </div>
14
- <div v-if="selected_slot" class="field col-6 text-center">
15
- {{selected_slot_info.hasOwnProperty('points') ? selected_slot_info.points.gc : 0}}
25
+ <div class="up-coin-holder" v-if="!hide_up_coin">
26
+ <div v-if="selected_slot" class="field col-6 text-center text-bold">
27
+ Current UPCoin:
28
+ </div>
29
+ <div v-if="selected_slot" class="field col-6 text-center">
30
+ {{selected_slot_info.hasOwnProperty('points') ? selected_slot_info.points.up_coin : 0}}
31
+ </div>
16
32
  </div>
33
+ </div>
17
34
  <div class="field col-12 q-mt-sm" style="margin-right:20px">
18
35
  <q-select :option-label="(method) => method.hasOwnProperty('method_name') ? method.method_name : `Payment Type` " label="Payment Type" option-value="method_key" :options="payment_options" v-model="field.payment_type" stack-label></q-select>
19
36
  </div>
@@ -50,10 +67,19 @@ export default
50
67
  },
51
68
  payment_options : [],
52
69
  selected_slot_info : {wallet:0,points:{gc:0}},
70
+ public_setting:null,
71
+ hide_up_coin:true
53
72
  }),
54
73
  props: ['selected_slot', 'gc'],
55
- mounted()
74
+ async mounted()
56
75
  {
76
+ this.public_settings = await this.$_getData('public_settings');
77
+ if(this.public_settings.hasOwnProperty('up_coin') && this.public_settings.up_coin.active == true)
78
+ {
79
+ this.hide_up_coin = false;
80
+ }
81
+ console.log(this.public_settings.up_coin);
82
+ console.log(this.hide_up_coin);
57
83
  this.getPaymentMethods()
58
84
  },
59
85
  methods:
@@ -124,8 +150,18 @@ export default
124
150
  <style lang="scss">
125
151
  .discount-dialog{
126
152
  .fields {
153
+ .slot-holder{
154
+ font-size:1rem;
155
+ font-weight: bold;
156
+ text-align: center;
157
+ color: $primary;
158
+ margin: 10px auto;
159
+ }
160
+ .wallet-holder-grid{
161
+ display: grid;
162
+ grid-template-columns: 1fr 1fr;
163
+ }
127
164
  padding: 20px;
128
-
129
165
  .label {
130
166
  font-weight: bold;
131
167
  font-size: 12px;
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <div class="payment-dialog">
3
+ <div class="payment-holder">
4
+ <div class="field col-12 q-mt-sm" style="margin-right:20px">
5
+ <q-select :option-label="(method) => method.hasOwnProperty('method_name') ? method.method_name : `Payment Type` " label="Payment Type" option-value="method_key" :options="payment_options" v-model="field.payment_type" stack-label></q-select>
6
+ </div>
7
+ <div class="buttons text-right">
8
+ <q-btn @click="applyPayment" color="primary" class="full-width" unelevated>
9
+ <q-icon name="fa fa-check" size="14px" class="q-mr-sm"></q-icon>
10
+ Appy Payment Type
11
+ </q-btn>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ export default
19
+ {
20
+ filters: { },
21
+ data:() =>(
22
+ {
23
+ payment_options : [],
24
+ field: {
25
+ payment_amount:"",
26
+ remarks:""
27
+ },
28
+ payment_options : [],
29
+ }),
30
+ async mounted()
31
+ {
32
+ await this.getPaymentMethods();
33
+ },
34
+ methods:
35
+ {
36
+ applyPayment()
37
+ {
38
+ console.log(this.field.payment_type);
39
+ },
40
+ async getPaymentMethods()
41
+ {
42
+ let value_holder = []
43
+ let option_holder = await this.$_getData('cashier_payment_methods');
44
+ option_holder.forEach( (res,index) =>
45
+ {
46
+ if(res.method_key == 'wallet' || res.method_key =='gc')
47
+ {
48
+ if(this.selected_slot)
49
+ {
50
+ value_holder.push(res)
51
+ }
52
+ }
53
+ else
54
+ {
55
+ value_holder.push(res)
56
+
57
+ }
58
+
59
+ })
60
+ this.payment_options = value_holder;
61
+
62
+ // if(this.gc == true)
63
+ // {
64
+ // this.payment_options = [{method_key: "gc", method_name:"GC"}];
65
+ // }
66
+ // let slot_code = await this.$_getSlotBySlotCode(this.selected_slot)
67
+ // this.selected_slot_info = slot_code != undefined ? slot_code : {}
68
+
69
+ },
70
+ },
71
+ computed: { }
72
+ }
73
+ </script>
74
+ <style lang="scss">
75
+ .payment-dialog{
76
+ padding: 20px;
77
+ background: #fff;
78
+ width: 500px;
79
+ height: 500px;
80
+ }
81
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geer-builder",
3
- "version": "1.2.607",
3
+ "version": "1.2.608",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {