@freteclick/quasar-financial-ui 1.0.113 → 1.0.115

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.
@@ -1,125 +1,134 @@
1
1
  <template>
2
- <q-card style="min-height: 90vh;">
2
+ <div class="pay-invoice-detail">
3
3
  <q-inner-loading :showing="isLoading">
4
4
  <q-spinner-gears size="50px" color="primary" />
5
5
  </q-inner-loading>
6
6
 
7
- <transition-group appear
8
- enter-active-class="animated fadeIn"
9
- leave-active-class="animated fadeOut"
10
- >
11
-
12
- <div v-if="invoice !== null"
13
- class="row q-pa-sm q-col-gutter-sm"
14
- key ="status"
15
- >
16
- <div class="col-xs-12">
17
- <div class="text-h5 q-pt-sm q-pb-sm">{{ this.provider.name }}</div>
18
- </div>
19
- <div class="col-xs-12 col-sm-4">
20
- <q-markup-table flat dense
21
- separator="none"
22
- class ="bg-grey-4 full-height"
23
- >
24
- <tbody>
25
- <tr>
26
- <td class="text-left text-bold">Número da fatura</td>
27
- <td class="text-left">
28
- {{ `#${this.invoice['@id'].match(/^\/finance\/pay\/([a-z0-9-]*)$/)[1]}` }}
29
- </td>
30
- </tr>
31
- <tr>
32
- <td class="text-left text-bold">Valor da fatura</td>
33
- <td class="text-left">
34
- {{ formatMoney(this.invoice.price) }}
35
- </td>
36
- </tr>
37
- <tr>
38
- <td class="text-left text-bold">Vencimento</td>
39
- <td class="text-left">
40
- {{ this.invoice.dueDate }}
41
- </td>
42
- </tr>
43
- </tbody>
44
- </q-markup-table>
45
- </div>
46
- <div class ="col-xs-12 col-sm-8">
47
- <div
48
- class ="row items-center justify-center full-height rounded-borders"
49
- :style="`background-color: ${this.invoice.status.color}`"
50
- >
51
- <div class="text-white text-h6">
52
- {{ $t(`invoice.statuses.${invoice.status.status}`) }}
7
+ <template v-if="invoice !== null">
8
+ <PageHeader
9
+ eyebrow="CONTAS A PAGAR"
10
+ icon="receipt_long"
11
+ :title="`Fatura #${invoiceNumber}`"
12
+ :description="provider.name || 'Detalhes e pedidos vinculados a esta despesa.'"
13
+ >
14
+ <template #actions>
15
+ <q-btn
16
+ outline
17
+ no-caps
18
+ rounded
19
+ color="white"
20
+ icon="arrow_back"
21
+ label="Voltar às contas a pagar"
22
+ :to="{ name: 'FinancePayIndex' }"
23
+ />
24
+ </template>
25
+ </PageHeader>
26
+
27
+ <section class="pay-invoice-detail__summary">
28
+ <q-card flat class="pay-invoice-summary-card pay-invoice-summary-card--amount">
29
+ <div class="pay-invoice-summary-card__icon">
30
+ <q-icon name="payments" />
53
31
  </div>
54
- </div>
55
- </div>
56
- </div>
32
+ <div class="pay-invoice-summary-card__copy">
33
+ <span>Valor da fatura</span>
34
+ <strong>{{ formatMoney(invoice.price) }}</strong>
35
+ </div>
36
+ </q-card>
57
37
 
58
- <div v-if="invoice !== null"
59
- class="row"
60
- key ="order_tabs"
61
- >
62
- <div class="col-12">
63
- <q-tabs
64
- :horizontal="$q.screen.gt.xs"
65
- align ="justify"
66
- v-model ="currentTab"
67
- class ="bg-white text-primary"
68
- >
69
- <q-tab
70
- name ="details"
71
- label="Detalhes"
72
- />
73
- <q-tab
74
- name ="orders"
75
- label="Despesa"
76
- />
77
- </q-tabs>
38
+ <q-card flat class="pay-invoice-summary-card">
39
+ <div class="pay-invoice-summary-card__icon pay-invoice-summary-card__icon--date">
40
+ <q-icon name="event" />
41
+ </div>
42
+ <div class="pay-invoice-summary-card__copy">
43
+ <span>Vencimento</span>
44
+ <strong>{{ invoice.dueDate || "—" }}</strong>
45
+ </div>
46
+ </q-card>
47
+
48
+ <q-card flat class="pay-invoice-summary-card">
49
+ <div class="pay-invoice-summary-card__icon pay-invoice-summary-card__icon--status">
50
+ <q-icon name="fact_check" />
51
+ </div>
52
+ <div class="pay-invoice-summary-card__copy">
53
+ <span>Status</span>
54
+ <q-badge
55
+ class="pay-invoice-status"
56
+ :style="invoiceStatus.color ? { backgroundColor: invoiceStatus.color } : {}"
57
+ >
58
+ {{ invoiceStatus.status ? $t(`invoice.statuses.${invoiceStatus.status}`) : "—" }}
59
+ </q-badge>
60
+ </div>
61
+ </q-card>
62
+
63
+ <q-card flat class="pay-invoice-summary-card">
64
+ <div class="pay-invoice-summary-card__icon pay-invoice-summary-card__icon--orders">
65
+ <q-icon name="local_shipping" />
66
+ </div>
67
+ <div class="pay-invoice-summary-card__copy">
68
+ <span>Pedidos vinculados</span>
69
+ <strong>{{ invoiceOrdersCount }}</strong>
70
+ </div>
71
+ </q-card>
72
+ </section>
78
73
 
79
- <q-separator />
74
+ <section class="pay-invoice-detail__workspace">
75
+ <div class="pay-invoice-detail__tabs-shell">
76
+ <q-tabs
77
+ v-model="currentTab"
78
+ align="left"
79
+ no-caps
80
+ inline-label
81
+ class="pay-invoice-detail__tabs"
82
+ >
83
+ <q-tab name="details" icon="description" label="Detalhes da despesa" />
84
+ <q-tab name="orders" icon="local_shipping" label="Pedidos" />
85
+ </q-tabs>
86
+ </div>
80
87
 
81
- <q-tab-panels
82
- v-model="currentTab"
83
- >
84
- <q-tab-panel name="details" class="q-pa-none">
88
+ <q-tab-panels v-model="currentTab" class="pay-invoice-detail__panels">
89
+ <q-tab-panel name="details" class="pay-invoice-detail__panel">
85
90
  <InvoiceInvoice
86
91
  :invoiceId="invoiceId"
87
- @updated ="requestInvoice(invoiceId)"
92
+ @updated="requestInvoice(invoiceId)"
88
93
  />
89
94
  </q-tab-panel>
90
- <q-tab-panel name="orders" class="q-pa-none">
91
- <InvoiceOrders
92
- :invoiceId="invoiceId"
93
- />
95
+ <q-tab-panel name="orders" class="pay-invoice-detail__panel">
96
+ <InvoiceOrders :invoiceId="invoiceId" />
94
97
  </q-tab-panel>
95
98
  </q-tab-panels>
96
- </div>
97
- </div>
98
-
99
- </transition-group>
99
+ </section>
100
+ </template>
100
101
 
101
- <div v-if="invoice === null && notFound"
102
- class="row items-center justify-center"
103
- style="min-height: 90vh;"
104
- >
105
- <q-banner class="text-white bg-red text-center text-h3" rounded>
106
- <template v-slot:avatar>
107
- <q-icon name="error" color="white" />
108
- </template>
109
- A fatura não foi encontrada
110
- </q-banner>
102
+ <div v-else-if="notFound" class="pay-invoice-detail__not-found">
103
+ <q-card flat class="pay-invoice-not-found-card">
104
+ <div class="pay-invoice-not-found-card__icon">
105
+ <q-icon name="receipt_long" />
106
+ </div>
107
+ <h2>Fatura não encontrada</h2>
108
+ <p>Não foi possível carregar os detalhes desta conta a pagar.</p>
109
+ <q-btn
110
+ unelevated
111
+ no-caps
112
+ color="primary"
113
+ icon="arrow_back"
114
+ label="Voltar às contas a pagar"
115
+ :to="{ name: 'FinancePayIndex' }"
116
+ />
117
+ </q-card>
111
118
  </div>
112
- </q-card>
119
+ </div>
113
120
  </template>
114
121
 
115
122
  <script>
116
123
  import { mapActions, mapGetters } from 'vuex';
124
+ import PageHeader from '@freteclick/quasar-common-ui/src/components/common/PageHeader.vue';
117
125
  import InvoiceOrders from './details/InvoiceOrders';
118
126
  import InvoiceInvoice from './details/InvoiceInvoice';
119
127
  import { formatMoney, formatDateYmdTodmY } from '@freteclick/quasar-common-ui/src/utils/formatter';
120
128
 
121
129
  export default {
122
130
  components: {
131
+ PageHeader,
123
132
  InvoiceInvoice,
124
133
  InvoiceOrders ,
125
134
  },
@@ -151,6 +160,23 @@ export default {
151
160
  ...mapGetters({
152
161
  myCompany: 'people/currentCompany',
153
162
  }),
163
+
164
+ invoiceNumber() {
165
+ const invoiceUri = this.invoice && this.invoice['@id'] ? this.invoice['@id'] : '';
166
+ const match = invoiceUri.match(/^\/finance\/pay\/([a-z0-9-]*)$/i);
167
+
168
+ return match ? match[1] : (this.invoiceId || '—');
169
+ },
170
+
171
+ invoiceStatus() {
172
+ return (this.invoice && this.invoice.status) || {};
173
+ },
174
+
175
+ invoiceOrdersCount() {
176
+ return this.invoice && Array.isArray(this.invoice.order)
177
+ ? this.invoice.order.length
178
+ : 0;
179
+ },
154
180
  },
155
181
 
156
182
  watch: {
@@ -208,3 +234,209 @@ export default {
208
234
  },
209
235
  };
210
236
  </script>
237
+
238
+ <style lang="scss" scoped>
239
+ .pay-invoice-detail {
240
+ position: relative;
241
+ display: grid;
242
+ width: 100%;
243
+ min-width: 0;
244
+ min-height: 72vh;
245
+ gap: 20px;
246
+ color: #1b2d43;
247
+ }
248
+
249
+ .pay-invoice-detail__summary {
250
+ display: grid;
251
+ grid-template-columns: repeat(4, minmax(0, 1fr));
252
+ gap: 14px;
253
+ }
254
+
255
+ .pay-invoice-summary-card {
256
+ display: flex;
257
+ min-width: 0;
258
+ align-items: center;
259
+ gap: 13px;
260
+ padding: 18px;
261
+ border: 1px solid #e5ebf3;
262
+ border-radius: 16px;
263
+ background: #fff;
264
+ box-shadow: 0 8px 22px rgba(26, 46, 70, 0.035);
265
+ }
266
+
267
+ .pay-invoice-summary-card__icon {
268
+ display: grid;
269
+ width: 44px;
270
+ height: 44px;
271
+ flex: 0 0 auto;
272
+ place-items: center;
273
+ border-radius: 13px;
274
+ color: #245d9c;
275
+ background: #eaf2fb;
276
+ font-size: 21px;
277
+ }
278
+
279
+ .pay-invoice-summary-card--amount .pay-invoice-summary-card__icon {
280
+ color: #27805a;
281
+ background: #e8f7ef;
282
+ }
283
+
284
+ .pay-invoice-summary-card__icon--date {
285
+ color: #9b6b17;
286
+ background: #fff5df;
287
+ }
288
+
289
+ .pay-invoice-summary-card__icon--status {
290
+ color: #7357a6;
291
+ background: #f0ebfb;
292
+ }
293
+
294
+ .pay-invoice-summary-card__icon--orders {
295
+ color: #287f91;
296
+ background: #e6f5f7;
297
+ }
298
+
299
+ .pay-invoice-summary-card__copy {
300
+ display: flex;
301
+ min-width: 0;
302
+ flex-direction: column;
303
+ gap: 5px;
304
+ }
305
+
306
+ .pay-invoice-summary-card__copy > span {
307
+ color: #7b8b9c;
308
+ font-size: 11px;
309
+ font-weight: 650;
310
+ }
311
+
312
+ .pay-invoice-summary-card__copy > strong {
313
+ overflow: hidden;
314
+ color: #1a2e45;
315
+ font-size: 18px;
316
+ font-weight: 750;
317
+ letter-spacing: -0.025em;
318
+ text-overflow: ellipsis;
319
+ white-space: nowrap;
320
+ }
321
+
322
+ .pay-invoice-status {
323
+ width: fit-content;
324
+ max-width: 100%;
325
+ padding: 6px 10px;
326
+ border-radius: 20px;
327
+ color: #fff;
328
+ font-size: 11px;
329
+ font-weight: 700;
330
+ }
331
+
332
+ .pay-invoice-detail__workspace {
333
+ min-width: 0;
334
+ overflow: hidden;
335
+ border: 1px solid #e5ebf3;
336
+ border-radius: 20px;
337
+ background: #fff;
338
+ box-shadow: 0 12px 30px rgba(25, 48, 78, 0.045);
339
+ }
340
+
341
+ .pay-invoice-detail__tabs-shell {
342
+ border-bottom: 1px solid #e9eef4;
343
+ background: #fbfcfe;
344
+ }
345
+
346
+ .pay-invoice-detail__tabs {
347
+ min-height: 58px;
348
+ padding: 0 18px;
349
+ color: #718398;
350
+ }
351
+
352
+ .pay-invoice-detail__tabs :deep(.q-tab--active) {
353
+ color: #245d9c;
354
+ font-weight: 700;
355
+ }
356
+
357
+ .pay-invoice-detail__tabs :deep(.q-tab__indicator) {
358
+ height: 3px;
359
+ border-radius: 3px 3px 0 0;
360
+ }
361
+
362
+ .pay-invoice-detail__panels {
363
+ min-width: 0;
364
+ background: transparent;
365
+ }
366
+
367
+ .pay-invoice-detail__panel {
368
+ min-width: 0;
369
+ padding: 20px;
370
+ }
371
+
372
+ .pay-invoice-detail__not-found {
373
+ display: grid;
374
+ min-height: 60vh;
375
+ place-items: center;
376
+ }
377
+
378
+ .pay-invoice-not-found-card {
379
+ display: flex;
380
+ width: min(100%, 440px);
381
+ align-items: center;
382
+ flex-direction: column;
383
+ padding: 36px 28px;
384
+ border: 1px solid #e5ebf3;
385
+ border-radius: 20px;
386
+ background: #fff;
387
+ text-align: center;
388
+ }
389
+
390
+ .pay-invoice-not-found-card__icon {
391
+ display: grid;
392
+ width: 62px;
393
+ height: 62px;
394
+ place-items: center;
395
+ border-radius: 18px;
396
+ color: #b84949;
397
+ background: #fff0f0;
398
+ font-size: 30px;
399
+ }
400
+
401
+ .pay-invoice-not-found-card h2 {
402
+ margin: 18px 0 0;
403
+ color: #1a2e45;
404
+ font-size: 22px;
405
+ font-weight: 750;
406
+ }
407
+
408
+ .pay-invoice-not-found-card p {
409
+ margin: 8px 0 20px;
410
+ color: #7b8b9c;
411
+ font-size: 13px;
412
+ }
413
+
414
+ @media (max-width: 1024px) {
415
+ .pay-invoice-detail__summary {
416
+ grid-template-columns: repeat(2, minmax(0, 1fr));
417
+ }
418
+ }
419
+
420
+ @media (max-width: 600px) {
421
+ .pay-invoice-detail {
422
+ gap: 14px;
423
+ }
424
+
425
+ .pay-invoice-detail__summary {
426
+ grid-template-columns: minmax(0, 1fr);
427
+ gap: 10px;
428
+ }
429
+
430
+ .pay-invoice-summary-card {
431
+ padding: 15px;
432
+ }
433
+
434
+ .pay-invoice-detail__tabs {
435
+ padding: 0 4px;
436
+ }
437
+
438
+ .pay-invoice-detail__panel {
439
+ padding: 12px;
440
+ }
441
+ }
442
+ </style>