|
2 | 2 | <div v-if="currentHousehold"> |
3 | 3 | <v-row class="mb-4" align="center"> |
4 | 4 | <v-col> |
5 | | - <div class="text-caption text-medium-emphasis">DASHBOARD</div> |
6 | | - <h1 class="text-h4 font-weight-thin">{{ currentHousehold.name }}</h1> |
| 5 | + <h1 class="text-h4 font-weight-thin">Policies</h1> |
7 | 6 | </v-col> |
8 | 7 | <v-col cols="auto"> |
9 | 8 | <v-btn color="primary" prepend-icon="mdi-plus" size="large" @click="policyDialog = true"> |
|
12 | 11 | </v-col> |
13 | 12 | </v-row> |
14 | 13 |
|
15 | | - <PolicyList |
16 | | - :currency-code="currencyCode" |
17 | | - :loading="loading" |
18 | | - :policies="policies" |
19 | | - @edit="openEditDialog" |
20 | | - @delete="handleDelete" |
21 | | - /> |
| 14 | + <div class="mb-6"> |
| 15 | + <div class="d-flex align-center mb-2"> |
| 16 | + <v-icon color="success" class="mr-2">mdi-shield-check</v-icon> |
| 17 | + <h2 class="text-h6 font-weight-bold">Active Policies</h2> |
| 18 | + </div> |
| 19 | + |
| 20 | + <PolicyList |
| 21 | + :currency-code="currencyCode" |
| 22 | + :policies="activePolicies" |
| 23 | + :loading="loading" |
| 24 | + @edit="openEditDialog" |
| 25 | + @delete="handleDelete" |
| 26 | + @upload="handleUpload" |
| 27 | + /> |
| 28 | + </div> |
| 29 | + |
| 30 | + <div v-if="expiredPolicies.length > 0" class="mb-6"> |
| 31 | + <v-divider class="my-6" /> |
| 32 | + |
| 33 | + <div class="d-flex align-center mb-2 text-medium-emphasis"> |
| 34 | + <v-icon color="grey" class="mr-2">mdi-history</v-icon> |
| 35 | + <h2 class="text-h6 font-weight-bold">Expired Policies</h2> |
| 36 | + </div> |
| 37 | + |
| 38 | + <PolicyList |
| 39 | + :currency-code="currencyCode" |
| 40 | + :policies="expiredPolicies" |
| 41 | + :loading="loading" |
| 42 | + @edit="openEditDialog" |
| 43 | + @delete="handleDelete" |
| 44 | + @upload="handleUpload" |
| 45 | + /> |
| 46 | + </div> |
22 | 47 |
|
23 | 48 | <PolicyForm |
24 | 49 | v-model="policyDialog" |
@@ -67,6 +92,27 @@ export default { |
67 | 92 | if (!val) this.selectedPolicy = null |
68 | 93 | }, |
69 | 94 | }, |
| 95 | + computed: { |
| 96 | + activePolicies() { |
| 97 | + const today = new Date(); |
| 98 | + today.setHours(0, 0, 0, 0); |
| 99 | +
|
| 100 | + return this.policies.filter(p => { |
| 101 | + if (!p.end_date) return true; |
| 102 | + return new Date(p.end_date) >= today; |
| 103 | + }); |
| 104 | + }, |
| 105 | +
|
| 106 | + expiredPolicies() { |
| 107 | + const today = new Date(); |
| 108 | + today.setHours(0, 0, 0, 0); |
| 109 | +
|
| 110 | + return this.policies.filter(p => { |
| 111 | + if (!p.end_date) return false; |
| 112 | + return new Date(p.end_date) < today; |
| 113 | + }); |
| 114 | + } |
| 115 | + }, |
70 | 116 | methods: { |
71 | 117 | openEditDialog(policy) { |
72 | 118 | this.selectedPolicy = policy |
|
0 commit comments