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,289 @@
1
+ <template>
2
+ <div class="g-gcash-collector-page" v-if="user_info.hasOwnProperty('collector') && user_info.collector === true">
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_request" :options="['All', 'Wallet Request', 'Gcash Request']" label="Request" />
6
+ <q-select outlined style="min-width: 200px; width: fit-content" v-model="filter" :options="['All', 'For Collection', 'For Processing', 'Collected', 'Processed']" label="Filter" />
7
+ </div>
8
+
9
+ <q-table
10
+ :title="table_title"
11
+ :loading="table_loading"
12
+ @row-click= "viewRequest"
13
+ separator="cell"
14
+ bordered
15
+ flat
16
+ :data="!table_loading ? gcash_data : []"
17
+ :columns="table_column"
18
+ :pagination.sync="pagination"
19
+ :filter="filterr" >
20
+ </q-table>
21
+
22
+ <q-dialog v-model="dialog_gcash_request_data">
23
+ <q-card style="max-width: 350px: width: 100%;">
24
+ <q-card-section>
25
+ <q-card-section>
26
+ <div class="text-h6 text-bold text-primary">Request Information</div>
27
+ </q-card-section>
28
+ <q-card-section class="row-details">
29
+ <table>
30
+ <tbody>
31
+ <tr>
32
+ <td class="label text-bold">Load Amount</td>
33
+ <td> : </td>
34
+ <td>{{gcash_request_data.requested_amount}}</td>
35
+ </tr>
36
+ <tr>
37
+ <td class="label text-bold">Full Name</td>
38
+ <td> : </td>
39
+ <td>{{gcash_request_data.full_name}}</td>
40
+ </tr>
41
+ <tr>
42
+ <td class="label text-bold">Address</td>
43
+ <td> : </td>
44
+ <td>{{gcash_request_data._address_combined}}</td>
45
+ </tr>
46
+ <tr>
47
+ <td class="label text-bold">Contact Number</td>
48
+ <td> : </td>
49
+ <td>{{gcash_request_data.contact_number}}</td>
50
+ </tr>
51
+ <tr>
52
+ <td class="label text-bold">Status</td>
53
+ <td> : </td>
54
+ <td>{{gcash_request_data.status}}</td>
55
+ </tr>
56
+ </tbody>
57
+ </table>
58
+ </q-card-section>
59
+ <q-card-actions align="right" class="bg-white" v-if="!(gcash_request_data && gcash_request_data.hasOwnProperty('status') && (gcash_request_data.status === 'rejected' || gcash_request_data.status === 'for_processing' || gcash_request_data.status === 'processed'))">
60
+ <q-btn v-if="gcash_request_data.status =='for_collection'" color="primary" label="Collect" @click="collectPayment(gcash_request_data)" v-close-popup />
61
+ </q-card-actions>
62
+ </q-card-section>
63
+ </q-card>
64
+ </q-dialog>
65
+ </div>
66
+ </template>
67
+ <script>
68
+ import GlobalMixins from '../../mixins/global_mixins.js';
69
+ import DB_USER_SHIPPING_ADDRESS from '../../models/DB_USER_SHIPPING_ADDRESS';
70
+ import GUserVerification from '../../GUserVerification';
71
+ import DB_USER from '../../models/DB_USER';
72
+ import DB_GCASH_REQUEST from '../../models/DB_GCASH_REQUEST';
73
+ import {formatDate} from '../../utilities/DateUtils';
74
+ import {formatNumber} from '../../utilities/NumberUtils';
75
+
76
+
77
+ export default {
78
+
79
+ props:
80
+ {
81
+ },
82
+ components: { GUserVerification },
83
+ data: () =>
84
+ ({
85
+ pending_request: [],
86
+ accepted_request: [],
87
+ collected_request: [],
88
+ filter_request: "All",
89
+ gcash_data: [],
90
+ filterr: '',
91
+ filter: "For Collection",
92
+ table_title: 'All Request',
93
+ pagination : { rowsPerPage: 5},
94
+ table_loading: false,
95
+ dialog_gcash_request_data: false,
96
+ gcash_request_data: {},
97
+ table_column:
98
+ [
99
+ {
100
+ name : 'status',
101
+ label : 'STATUS',
102
+ field : "status",
103
+ align : 'left',
104
+ },
105
+ {
106
+ name : 'full_name',
107
+ label : 'FULL NAME',
108
+ field : "full_name",
109
+ align : 'left',
110
+ sortable: true,
111
+ },
112
+ {
113
+ name : 'address',
114
+ label : 'ADDRESS',
115
+ field : "_address_combined",
116
+ align : 'center',
117
+ sortable: true,
118
+ },
119
+ {
120
+ name : 'contact_number',
121
+ label : 'CONTACT NUMBER',
122
+ field : "contact_number",
123
+ align : 'left',
124
+ },
125
+ {
126
+ name : 'requested_amount',
127
+ label : 'AMOUNT',
128
+ field : row => `Php${formatNumber(row.requested_amount, { decimal: 2 })}`,
129
+ format: val => `${val}`,
130
+ align : 'left',
131
+ },
132
+ {
133
+ name : 'request',
134
+ label : 'REQUEST',
135
+ field : "request",
136
+ align : 'left',
137
+ },
138
+ {
139
+ name : 'created_date',
140
+ label : 'Time & Date',
141
+ field : row => formatDate(row.created_date, 'MM/DD/YY (hh:mm A)'),
142
+ format: val => `${val}`,
143
+ align : 'left',
144
+ },
145
+ ],
146
+ decline_message_dialog: false,
147
+ reject_message: '',
148
+ to_be_reject: null,
149
+ }),
150
+ watch:
151
+ {
152
+ filter()
153
+ {
154
+ this.getAllGcashRequest();
155
+ },
156
+ filter_request()
157
+ {
158
+ this.getAllGcashRequest();
159
+ }
160
+ },
161
+ async mounted()
162
+ {
163
+ await this.getAllGcashRequest();
164
+ },
165
+ methods:
166
+ {
167
+ async getAllGcashRequest()
168
+ {
169
+ this.$q.loading.show();
170
+ this.table_loading = true;
171
+ this.table_title = `${this.filter} Request`;
172
+
173
+ let filter = ''
174
+ if(this.filter == 'For Collection') filter = 'for_collection';
175
+ else if(this.filter == 'For Processing') filter = 'for_processing';
176
+ else filter = this.filter.toLowerCase();
177
+
178
+ if (filter === 'all' && this.filter_request === 'All') await this.$bind('gcash_data', new DB_GCASH_REQUEST().collection()
179
+ .where('assigned_collector', '==', `${this.user_info.uid}`).where("status", "in", ['for_collection', 'for_processing', 'processed']).orderBy('created_date', 'desc'));
180
+ else if (filter === 'all' && this.filter_request != 'All') await this.$bind('gcash_data', new DB_GCASH_REQUEST().collection()
181
+ .where('assigned_collector', '==', `${this.user_info.uid}`).where('request', '==', `${this.filter_request}`).orderBy('created_date', 'desc'));
182
+ else if (filter != 'all' && filter != "collected" && this.filter_request === 'All') await this.$bind('gcash_data', new DB_GCASH_REQUEST().collection()
183
+ .where('assigned_collector', '==', `${this.user_info.uid}`).where('status', '==', `${filter}`).orderBy('created_date', 'desc'));
184
+ else if (filter == "collected" && this.filter_request === 'All') await this.$bind('gcash_data', new DB_GCASH_REQUEST().collection()
185
+ .where('assigned_collector', '==', `${this.user_info.uid}`).where('collected', '==', true).orderBy('created_date', 'desc'));
186
+ else if (filter == "collected" && this.filter_request != 'All') await this.$bind('gcash_data', new DB_GCASH_REQUEST().collection()
187
+ .where('assigned_collector', '==', `${this.user_info.uid}`).where('request', '==', `${this.filter_request}`).where('collected', '==', true).orderBy('created_date', 'desc'));
188
+ else await this.$bind('gcash_data', new DB_GCASH_REQUEST().collection()
189
+ .where('assigned_collector', '==', `${this.user_info.uid}`).where('status', '==', `${filter}`).where('request', '==', `${this.filter_request}`).orderBy('created_date', 'desc'));
190
+
191
+ if(filter == 'collected')
192
+ {
193
+ let new_data = [];
194
+ this.gcash_data.forEach(element => {
195
+ if (element.collected === true)
196
+ {
197
+ element.status = 'collected';
198
+ }
199
+ new_data.push(element)
200
+ });
201
+
202
+ this.gcash_data = new_data;
203
+ }
204
+ this.table_loading = false;
205
+ this.$q.loading.hide();
206
+ },
207
+ viewRequest(evt, row)
208
+ {
209
+ this.dialog_gcash_request_data = true;
210
+ this.gcash_request_data = row;
211
+ },
212
+ async collectPayment(request_data)
213
+ {
214
+ this.$q.loading.show();
215
+ if (this.user_info)
216
+ {
217
+ let collector_response = {};
218
+ collector_response.collectors_response = 'collected';
219
+ collector_response.req_id = request_data.id;
220
+ collector_response.request_data = request_data;
221
+ try
222
+ {
223
+ await this.$_fbCall('collectGcashRequestResponse', collector_response);
224
+ this.$q.dialog({ title: `Success`, message: `You've collected a payment.`, html: true });
225
+ }
226
+ catch (error)
227
+ {
228
+ this.$q.dialog({ title: `Something's not quite right`, message: error.message });
229
+ }
230
+ }
231
+ await this.getAllGcashRequest();
232
+ this.dialog_gcash_request_data = false;
233
+ this.$q.loading.hide();
234
+ },
235
+ }
236
+ }
237
+ </script>
238
+
239
+ <style lang="scss">
240
+ .g-gcash-collector-page
241
+ {
242
+ .filters
243
+ {
244
+ display: flex;
245
+ grid-gap: 10px;
246
+ width: 100%;
247
+ justify-content: flex-end;
248
+ }
249
+ }
250
+ .q-dialog
251
+ {
252
+ .reject-message-dialog
253
+ {
254
+ max-width: 400px;
255
+ width: 100%;
256
+ }
257
+ .user-verification-dialog-holder
258
+ {
259
+ display: grid;
260
+ place-items: center;
261
+ justify-content: center;
262
+ .full-width
263
+ {
264
+ max-width: 95vw;
265
+ width: 100% ;
266
+ // overflow: scroll;
267
+ }
268
+ }
269
+ .row-details
270
+ {
271
+ .label
272
+ {
273
+ min-width: 150px;
274
+ }
275
+ table
276
+ {
277
+ max-width: 400px;
278
+ tbody
279
+ {
280
+ tr
281
+ {
282
+ display: flex;
283
+ align-items: flex-start;
284
+ }
285
+ }
286
+ }
287
+ }
288
+ }
289
+ </style>
@@ -0,0 +1,282 @@
1
+ <template>
2
+ <q-card class="add-collector-form">
3
+ <q-form v-if="form && (form.address && form.tag_location)" @submit="submit">
4
+ <q-card-section>
5
+ <div class="main-title text-h5 text-bold"> Create Collector Account</div>
6
+ </q-card-section>
7
+ <q-card-section class="form-wrapper">
8
+ <div class="section-title text-bold">Collector Information <span class="text-red text-italic">(Required *)</span> </div>
9
+ <div class="form-wrapper-content-1">
10
+ <q-input dense required v-model="form.first_name" filled class="form-item" label="First Name" />
11
+ <q-input dense required v-model="form.middle_name" filled class="form-item" label="Middle Name" />
12
+ <q-input dense required v-model="form.last_name" filled class="form-item" label="Last Name" />
13
+ <q-input dense required v-model="form.email" type="email" filled class="form-item" label="Email" />
14
+ <q-input dense required v-model="form.password" type="password" filled class="form-item" label="Password" />
15
+ <q-select dense required v-model="form.gender" :options="['Male', 'Female']" filled class="form-item" label="Gender" />
16
+ <q-input dense required v-model="form.contact_number" filled lazy-rules :rules="[ val => val && val.length == 11 && val[0] == 0 && val[1] == 9 || 'Number must be 11 digits and starts w/ (09)']" class="form-item" label="Phone Number" />
17
+ </div>
18
+ </q-card-section>
19
+ <q-card-section class="form-wrapper">
20
+ <div class="section-title text-bold">*Address<span class="text-red text-italic">(Required *)</span> </div>
21
+ <div class="form-wrapper-content-2">
22
+ <q-select v-model="form.address.country" option-label="name" option-value="code" lazy-rules :rules="[ val => val != null || 'Please choose country' ]" :options="[{code: 'PH', name: 'Philippines'}]" dense class="input" filled stack-label/>
23
+ <q-input disable dense required v-model="form.address.postal_code" lazy-rules :rules="[ val => val != null || 'Please choose Postal Code' ]" filled class="form-item" label="Postal Code" />
24
+ <q-select disable class="form-item" label="Region" filled map-options option-label="name" @input="form.address.province='';form.address.city='';form.address.barangay=''" v-model="form.address.region" :options="region_list" dense options-dense lazy-rules :rules="[ val => val != null || 'Please choose region' ]"></q-select>
25
+ <q-select disable class="form-item" label="Province *" option-label="name" filled :options="province_options" @input="form.address.city='';form.address.barangay=''" v-model="form.address.province" dense options-dense lazy-rules :rules="[ val => val != '' || 'Please choose province' ]"></q-select>
26
+ <q-select disable class="form-item" label="City *" option-label="name" filled :options="city_options" @input="form.address.barangay=''" v-model="form.address.city" dense options-dense lazy-rules :rules="[ val => val != '' || 'Please choose province' ]"></q-select>
27
+ <q-select class="form-item" label="Barangay *" option-label="name" filled :options="barangay_options" v-model="form.address.barangay" dense options-dense lazy-rules :rules="[ val => val != '' || 'Please choose province' ]"></q-select>
28
+ </div>
29
+ <q-input class="form-item" label="Building, House no., Street, and etc... " filled v-model="form.address.street" :options="province_list" dense options-dense lazy-rules :rules="[ val => val && val.length > 0 || 'Street is required']"></q-input>
30
+ </q-card-section>
31
+ <q-card-section >
32
+ <div class="section-title text-bold">* Tag Location</div>
33
+ <div class="location-tagged-main">
34
+ <div class="holder-title">Tagged</div>
35
+ <div class="tag-location-holder" v-if="tag_location.length > 0">
36
+ <div class="location-tagged" v-for="(barangay, index) in tag_location" :key="index">
37
+ <div>{{barangay.name}}</div>
38
+ </div>
39
+ </div>
40
+ <div v-else class="undefined-tags">
41
+ No tags yet.
42
+ </div>
43
+ </div>
44
+ <div class="location-choices">
45
+ <div class="holder-title">Available Locations</div>
46
+ <div class="tag-location-holder" v-if="barangay_options" >
47
+ <div class="location-item" v-for="(barangay, index) in barangay_options" :key="index" @click="setAsTagLocation(barangay, index)" :class="barangay.class_name">
48
+ <div>{{barangay.name}}</div>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ <!-- <q-checkbox disable v-model="form.tag_location.barangay" label="Barangay" color="cyan" /> -->
53
+ </q-card-section>
54
+ <q-card-section align="right">
55
+ <q-btn flat label="close" color="gray" class="q-mr-md" v-close-popup/>
56
+ <q-btn type="submit" label="create" color="primary"/>
57
+ </q-card-section>
58
+ </q-form>
59
+ <div v-else class="spinner-wrapper">
60
+ <q-spinner color="primary" size="3em" />
61
+ </div>
62
+ </q-card>
63
+ </template>
64
+
65
+ <script>
66
+ import phil from 'philippine-location-json-for-geer';
67
+ export default
68
+ {
69
+ filters: { },
70
+ data:() =>(
71
+ {
72
+ country_list: [],
73
+ region_list: [{region_name:"Metro Manila", region_id: "metro_manila"}, {region_name:"Mindanao", region_id: "mindanao"}, {region_name:"North Luzon", region_id: "north_luzon"}, {region_name:"South Luzon", region_id: "south_luzon"}, {region_name:"Visayas", region_id: "visayas"}],
74
+ province_list: [],
75
+ tag_location: [],
76
+ form: {
77
+ collector: true,
78
+ first_name: null,
79
+ middle_name: null,
80
+ last_name: null,
81
+ contact_number: null,
82
+ email: null,
83
+ password: null,
84
+ gender: null,
85
+ address: {
86
+ postal_code: null,
87
+ region: null,
88
+ province: null,
89
+ city: null,
90
+ barangay: null,
91
+ street: null,
92
+ country: { name: 'Philippines', code: 'PH' },
93
+ },
94
+ tag_location: []
95
+ },
96
+ }),
97
+ computed:
98
+ {
99
+ province_options()
100
+ {
101
+ if (this.form.address.region)
102
+ {
103
+ return phil.getProvincesByRegion(this.form.address.region.reg_code);
104
+ }
105
+ else
106
+ {
107
+ return null;
108
+ }
109
+
110
+ },
111
+ city_options()
112
+ {
113
+ if (this.form.address.province)
114
+ {
115
+ return phil.getCityMunByProvince(this.form.address.province.prov_code);
116
+ }
117
+ else
118
+ {
119
+ return null;
120
+ }
121
+ },
122
+ barangay_options()
123
+ {
124
+ if (this.form.address.city)
125
+ {
126
+ return phil.getBarangayByMun(this.form.address.city.mun_code);
127
+ }
128
+ else
129
+ {
130
+ return null;
131
+ }
132
+ },
133
+ },
134
+ async mounted()
135
+ {
136
+ this.region_list = phil.regions;
137
+ await this.$_getSlotInfo();
138
+ await this.assignCityAddress();
139
+ },
140
+ watch:
141
+ {
142
+ barangay_options()
143
+ {
144
+
145
+ }
146
+ },
147
+ methods:
148
+ {
149
+ async submit()
150
+ {
151
+ this.$q.loading.show();
152
+ if(!(this.current_slot_info && this.current_slot_info.hasOwnProperty('slot_code')))
153
+ {
154
+ this.$q.loading.hide();
155
+ return this.$q.dialog({title:'No Slot', message:`Sorry! Slot code can't be found.`})
156
+ }
157
+ if(this.tag_location.length < 0)
158
+ {
159
+ this.$q.loading.hide();
160
+ return this.$q.dialog({title:'Undefined Tag Location', message: 'Tag location is required.'});
161
+ }
162
+ this.form.full_name = `${this.form.first_name} ${this.form.middle_name} ${this.form.last_name}`;
163
+ this.form.location = `${this.form.address.street}, ${this.form.address.barangay.name}, ${this.form.address.city.name}, ${this.form.address.province.name}, ${this.form.address.region.name}, ${this.form.address.country.name}, ${this.form.address.postal_code},`
164
+ this.form.location_code = this.form.address.city.mun_code;
165
+ this.form.location_brgy_code = this.form.address.barangay.brgy_code;
166
+ this.form.country = this.form.address.country;
167
+ this.form.hubs_slot = this.current_slot_info.slot_code;
168
+ this.form.tag_location = this.tag_location;
169
+ try
170
+ {
171
+ let callbackCreateAccount = await this.$_fbCall('hubCreateCollectorsAccount', this.form);
172
+ this.$q.loading.hide();
173
+ this.$emit('done');
174
+ }
175
+ catch (error)
176
+ {
177
+ this.$q.loading.hide();
178
+ this.$q.dialog(
179
+ {
180
+ title: 'Ann Error Has Occured',
181
+ message: error.message
182
+ });
183
+ }
184
+ },
185
+ assignCityAddress()
186
+ {
187
+ this.form.address.postal_code = this.user_info.address.postal_code
188
+ this.form.address.region = this.user_info.address.region
189
+ this.form.address.province = this.user_info.address.province
190
+ this.form.address.city = this.user_info.address.city
191
+ },
192
+ setAsTagLocation(barangay, index)
193
+ {
194
+ let check = null;
195
+ for (let i = 0; i < this.tag_location.length; i++)
196
+ {
197
+ const element = this.tag_location[i];
198
+ if (element.brgy_code === barangay.brgy_code) check = true;
199
+ }
200
+ if (!check) this.tag_location.push(barangay);
201
+ else this.$q.dialog({title: 'Data Duplication', message: 'Location has been tagged.'})
202
+ }
203
+ }
204
+ }
205
+ </script>
206
+ <style lang="scss">
207
+ .add-collector-form
208
+ {
209
+ max-width: 1000px;
210
+ width: 100%;
211
+ }
212
+ .form-wrapper
213
+ {
214
+ display: grid;
215
+ grid-gap: 10px;
216
+ &-content-1
217
+ {
218
+ display: grid;
219
+ grid-template-columns: repeat(2, 1fr);
220
+ grid-gap: 20px;
221
+ }
222
+ &-content-2
223
+ {
224
+ display: grid;
225
+ grid-template-columns: repeat(2, 1fr);
226
+ column-gap: 20px;
227
+ row-gap: 5px;
228
+ }
229
+ }
230
+ .location-tagged-main
231
+ {
232
+ padding: 10px;
233
+ border: 1px solid $primary;
234
+ border-radius: 5px;
235
+ color: $primary;
236
+ min-height: 100px;
237
+ display: grid;
238
+ align-items: center;
239
+ .undefined-tags
240
+ {
241
+ color: gray;
242
+ margin: auto;
243
+ }
244
+ }
245
+ .location-choices
246
+ {
247
+ padding: 10px;
248
+ min-height: 100px;
249
+ border: 1px solid gray;
250
+ border-radius: 5px;
251
+ color: gray;
252
+ margin-top: 20px;
253
+ }
254
+ .tag-location-holder
255
+ {
256
+ margin-top: 20px;
257
+ display: flex;
258
+ flex-wrap: wrap;
259
+ grid-gap: 10px;
260
+ .location-tagged
261
+ {
262
+ border: 1px solid $primary;
263
+ color: $primary;
264
+ padding: 5px 10px;
265
+ border-radius: 5px;
266
+ cursor: pointer;
267
+ }
268
+ .location-item
269
+ {
270
+ border: 1px solid gray;
271
+ padding: 5px 10px;
272
+ border-radius: 5px;
273
+ cursor: pointer;
274
+ transition: 5ms all ease ;
275
+ &:hover
276
+ {
277
+ border: 1px solid $primary;
278
+ color: $primary;
279
+ }
280
+ }
281
+ }
282
+ </style>