geer-builder 1.2.643 → 1.2.644

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.
@@ -0,0 +1,345 @@
1
+ <template>
2
+ <div class="bills-payment">
3
+ <div align="right" class="q-mb-md filters">
4
+ <q-input style="width: 300px;" label="Search Here" outlined="" v-model="filterr"></q-input>
5
+ <q-select outlined style="min-width: 200px; width: fit-content" v-model="filter" :options="['All', 'Pending', 'Rejected', 'For Collection', 'Collected', 'For Processing', 'Processed']" label="Filter" />
6
+ </div>
7
+ <q-table
8
+ :title="table_title"
9
+ :loading="table_loading"
10
+ @row-click= "viewRequest"
11
+ separator="cell"
12
+ bordered
13
+ flat
14
+ :data="!table_loading ? bills_payment : []"
15
+ :columns="table_column"
16
+ :pagination.sync="pagination"
17
+ :filter="filterr" >
18
+ </q-table>
19
+ <q-dialog v-model="dialog_bills_payment_data">
20
+ <q-card style="max-width: 350px: width: 100%;" v-if="dialog_bills_payment_data">
21
+ <q-card-section>
22
+ <q-card-section>
23
+ <div class="text-h6 text-bold text-primary">Request Information</div>
24
+ </q-card-section>
25
+ <q-card-section class="row-details">
26
+ <table>
27
+ <tbody>
28
+ <tr>
29
+ <td class="label text-bold">Load Amount</td>
30
+ <td> : </td>
31
+ <td>{{bills_payment_data.amount_to_pay}}</td>
32
+ </tr>
33
+ <tr>
34
+ <td class="label text-bold">Full Name</td>
35
+ <td> : </td>
36
+ <td>{{bills_payment_data.details.full_name}}</td>
37
+ </tr>
38
+ <tr>
39
+ <td class="label text-bold">Address</td>
40
+ <td> : </td>
41
+ <td>{{bills_payment_data._address_combined}}</td>
42
+ </tr>
43
+ <tr>
44
+ <td class="label text-bold">Contact Number</td>
45
+ <td> : </td>
46
+ <td>{{bills_payment_data.details.contact_number}}</td>
47
+ </tr>
48
+ <tr>
49
+ <td class="label text-bold">Status</td>
50
+ <td> : </td>
51
+ <td>{{bills_payment_data.status}}</td>
52
+ </tr>
53
+ </tbody>
54
+ </table>
55
+ </q-card-section>
56
+ <q-card-actions align="right" class="bg-white" v-if="!(bills_payment_data && bills_payment_data.hasOwnProperty('status') && (bills_payment_data.status === 'rejected' || bills_payment_data.status === 'for_collection' || bills_payment_data.status === 'for_processing' || bills_payment_data.status === 'collected' || bills_payment_data.status === 'processed'))">
57
+ <q-btn flat class="text-grey" label="Decline" @click="declineREquest(bills_payment_data)" />
58
+ <q-btn color="primary" label="Accept" @click="acceptREquest(bills_payment_data)" v-close-popup />
59
+ </q-card-actions>
60
+ </q-card-section>
61
+ </q-card>
62
+ </q-dialog>
63
+ <q-dialog v-model="decline_message_dialog">
64
+ <q-card class="reject-message-dialog">
65
+ <q-card-section>
66
+ <div class="text-bold text-h6">Reason for Rejection</div>
67
+ </q-card-section>
68
+ <q-card-section>
69
+ <q-input type="textarea" outline v-model="reject_message" placeholder="Input your reason here" />
70
+ </q-card-section>
71
+ <q-card-section>
72
+ <div align="right">
73
+ <q-btn flat label="close" color="primary" v-close-popup />
74
+ <q-btn label="submit" color="primary" @click="declineREquest(to_be_reject)" />
75
+ </div>
76
+ </q-card-section>
77
+ </q-card>
78
+ </q-dialog>
79
+ </div>
80
+ </template>
81
+ <script>
82
+ import GlobalMixins from '../../mixins/global_mixins.js';
83
+ import DB_BILLS_PAYMENT from '../../models/DB_BILLS_PAYMENT';
84
+ import DB_USER from '../../models/DB_USER';
85
+ import {formatDate} from '../../utilities/DateUtils';
86
+ import {formatNumber} from '../../utilities/NumberUtils';
87
+
88
+ export default {
89
+
90
+ props:
91
+ {
92
+ },
93
+ components: { },
94
+ data: () =>
95
+ ({
96
+ pending_request: [],
97
+ accepted_request: [],
98
+ collected_request: [],
99
+ filter_request: "All",
100
+ bills_payment: [],
101
+ filterr: '',
102
+ filter: "Pending",
103
+ table_title: 'All Request',
104
+ pagination : { rowsPerPage: 5},
105
+ table_loading: false,
106
+ dialog_bills_payment_data: false,
107
+ bills_payment_data: {},
108
+ table_column:
109
+ [
110
+ {
111
+ name : 'status',
112
+ label : 'STATUS',
113
+ field : "status",
114
+ align : 'left',
115
+ },
116
+ {
117
+ name : 'full_name',
118
+ label : 'FULL NAME',
119
+ field : row => row.details.full_name,
120
+ align : 'left',
121
+ format: val => `${val}`,
122
+ sortable: true,
123
+ },
124
+ {
125
+ name : 'address',
126
+ label : 'ADDRESS',
127
+ field : "_address_combined",
128
+ align : 'center',
129
+ sortable: true,
130
+ },
131
+ {
132
+ name : 'contact_number',
133
+ label : 'CONTACT NUMBER',
134
+ field : row => row.details.contact_number,
135
+ align : 'left',
136
+ format: val => `${val}`,
137
+ sortable: true,
138
+ },
139
+ {
140
+ name : 'amount_to_pay',
141
+ label : 'AMOUNT REQUEST',
142
+ field : row => `Php${formatNumber(row.amount_to_pay, { decimal: 2 })}`,
143
+ format: val => `${val}`,
144
+ align : 'left',
145
+ },
146
+ {
147
+ name : 'created_date',
148
+ label : 'TIME & DATE',
149
+ field : row => formatDate(row.created_date, 'MM/DD/YY (hh:mm A)'),
150
+ format: val => `${val}`,
151
+ align : 'left',
152
+ },
153
+ {
154
+ name : 'response_message',
155
+ label : 'RESPONSE MESSAGE',
156
+ field : row => row.response_message,
157
+ format : val => `${val ? val:'-----'}`,
158
+ align : 'left',
159
+ }
160
+
161
+ ],
162
+ decline_message_dialog: false,
163
+ reject_message: '',
164
+ to_be_reject: null,
165
+ }),
166
+ watch:
167
+ {
168
+ filter()
169
+ {
170
+ this.getAllBillsPaymentRequest();
171
+ },
172
+ },
173
+ async mounted()
174
+ {
175
+ await this.getAllBillsPaymentRequest();
176
+ await this.$_getSlotInfo();
177
+ },
178
+ methods:
179
+ {
180
+ async getAllBillsPaymentRequest()
181
+ {
182
+ this.$q.loading.show();
183
+ this.table_loading = true;
184
+ this.table_title = `${this.filter} Request`;
185
+
186
+ let filter;
187
+ if(this.filter == 'For Collection') filter = 'for_collection';
188
+ else if(this.filter == 'For Processing') filter = 'for_processing';
189
+ else filter = this.filter.toLowerCase();
190
+
191
+ if (filter === 'all') await this.$bind('bills_payment', new DB_BILLS_PAYMENT().collection()
192
+ .where('selected_hub', '==', `${this.user_info.active_slot}`).orderBy('created_date', 'desc'));
193
+ else if (filter == "collected") await this.$bind('bills_payment', new DB_BILLS_PAYMENT().collection()
194
+ .where('selected_hub', '==', `${this.user_info.active_slot}`).where('collected', '==', true).orderBy('created_date', 'desc'));
195
+ else await this.$bind('bills_payment', new DB_BILLS_PAYMENT().collection()
196
+ .where('selected_hub', '==', `${this.user_info.active_slot}`).where('status', '==', `${filter}`).orderBy('created_date', 'desc'));
197
+
198
+ if(filter == 'collected')
199
+ {
200
+ let new_data = [];
201
+ this.bills_payment.forEach(element => {
202
+ if (element.collected === true)
203
+ {
204
+ element.status = 'collected';
205
+ }
206
+ new_data.push(element)
207
+ });
208
+
209
+ this.bills_payment = new_data;
210
+ }
211
+
212
+ this.table_loading = false;
213
+ this.$q.loading.hide();
214
+ },
215
+ viewRequest(evt, row)
216
+ {
217
+ if (row && row.hasOwnProperty('hubs_status'))
218
+ {
219
+ this.$q.dialog({title: `You've already responded!`})
220
+ }
221
+ else
222
+ {
223
+ this.dialog_bills_payment_data = true;
224
+ this.bills_payment_data = row;
225
+ }
226
+ },
227
+
228
+ async declineREquest(request_data)
229
+ {
230
+ this.to_be_reject = request_data;
231
+ if (this.reject_message === '') return this.decline_message_dialog = true;
232
+ else
233
+ {
234
+ this.$q.loading.show()
235
+ if (this.user_info)
236
+ {
237
+ let hub_response = {};
238
+ hub_response.hubs_response = 'rejected';
239
+ hub_response.req_id = request_data.id;
240
+ hub_response.request_data = request_data;
241
+ hub_response.message = this.reject_message;
242
+ hub_response.bills_payment = true;
243
+ hub_response.slot_code = this.current_slot_info.slot_code;
244
+ try
245
+ {
246
+ let res = await this.$_fbCall('memberhubRequestResponse', hub_response);
247
+ this.$q.dialog({ title: `Success`, message: `You've rejected the request.`, html: true });
248
+ this.reject_message = '';
249
+ this.decline_message_dialog = false;
250
+ }
251
+ catch (error)
252
+ {
253
+ this.$q.dialog({ title: `Something's not quite right`, message: error.message });
254
+ }
255
+ }
256
+ await this.getAllBillsPaymentRequest();
257
+ this.$q.loading.hide()
258
+ this.dialog_bills_payment_data = false;
259
+ }
260
+ },
261
+ async acceptREquest(request_data)
262
+ {
263
+ this.$q.loading.show();
264
+ if (this.user_info)
265
+ {
266
+ let hub_response = {};
267
+ hub_response.hubs_response = 'for_collection';
268
+ hub_response.req_id = request_data.id;
269
+ hub_response.request_data = request_data;
270
+ hub_response.bills_payment = true;
271
+ hub_response.slot_code = this.current_slot_info.slot_code;
272
+ if(this.current_slot_info.wallet < request_data.requested_amount)
273
+ {
274
+ this.$q.dialog({title: 'Insufficient Balance', message: `The requested amount doesn't match your current wallet.`})
275
+ return this.$q.loading.hide();
276
+ }
277
+ try
278
+ {
279
+ let res = await this.$_fbCall('memberhubRequestResponse', hub_response);
280
+ this.$q.dialog({ title: `Success`, message: `You've accepted the request.`, html: true });
281
+ }
282
+ catch (error)
283
+ {
284
+ this.$q.dialog({ title: `Something's not quite right`, message: error.message });
285
+ }
286
+ }
287
+ await this.getAllBillsPaymentRequest();
288
+ this.dialog_bills_payment_data = false;
289
+ this.$q.loading.hide();
290
+ },
291
+ }
292
+ }
293
+ </script>
294
+
295
+ <style lang="scss">
296
+ .bills-payment
297
+ {
298
+ .filters
299
+ {
300
+ display: flex;
301
+ grid-gap: 10px;
302
+ width: 100%;
303
+ justify-content: flex-end;
304
+ }
305
+ }
306
+ .q-dialog
307
+ {
308
+ .reject-message-dialog
309
+ {
310
+ max-width: 400px;
311
+ width: 100%;
312
+ }
313
+ .user-verification-dialog-holder
314
+ {
315
+ display: grid;
316
+ place-items: center;
317
+ justify-content: center;
318
+ .full-width
319
+ {
320
+ max-width: 95vw;
321
+ width: 100% ;
322
+ // overflow: scroll;
323
+ }
324
+ }
325
+ .row-details
326
+ {
327
+ .label
328
+ {
329
+ min-width: 150px;
330
+ }
331
+ table
332
+ {
333
+ max-width: 400px;
334
+ tbody
335
+ {
336
+ tr
337
+ {
338
+ display: flex;
339
+ align-items: flex-start;
340
+ }
341
+ }
342
+ }
343
+ }
344
+ }
345
+ </style>