-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature working, facilities show up well in tables and sort
- Loading branch information
1 parent
b2bc9b1
commit 00aec6a
Showing
4 changed files
with
118 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
frontend/src/components/account-mgmt/ManageFacilityTable.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<template> | ||
<FacilityFilter class="mb-8" :default-show-input="true" justify="end" @facility-filter-changed="facilityFilterChanged" /> | ||
<v-data-table :headers="headers" :items="filteredFacilities" item-key="facilityId" :items-per-page="10" density="compact" :mobile="null" mobile-breakpoint="md" class="soft-outline"> | ||
<template v-if="showAction" #[`item.contactId`]="{ item }"> | ||
<v-row no-gutters class="my-2 align-center justify-end justify-md-start"> | ||
<AppButton :primary="false" size="small" @click="navigateToFacility(item.facilityId)">Open</AppButton> | ||
</v-row> | ||
</template> | ||
<template #[`item.primaryContactName`]="{ item }"> | ||
<v-row no-gutters class="my-2 align-center justify-end justify-md-start"> | ||
<v-icon v-if="!item.primaryContactName" color="warning" class="mr-2">mdi-alert</v-icon> | ||
<p v-else>{{ item.primaryContactName }}</p> | ||
</v-row> | ||
</template> | ||
<template #[`item.expenseAuthorityName`]="{ item }"> | ||
<v-row no-gutters class="my-2 align-center justify-end justify-md-start"> | ||
<v-icon v-if="!item.expenseAuthorityName" color="warning" class="mr-2">mdi-alert</v-icon> | ||
<p v-else>{{ item.expenseAuthorityName }}</p> | ||
</v-row> | ||
</template> | ||
</v-data-table> | ||
</template> | ||
|
||
<script> | ||
import { isEmpty } from 'lodash' | ||
import AppButton from '@/components/ui/AppButton.vue' | ||
import FacilityFilter from '@/components/facilities/FacilityFilter.vue' | ||
export default { | ||
name: 'ManageFacilityTable', | ||
components: { AppButton, FacilityFilter }, | ||
inheritAttrs: true, | ||
props: { | ||
facilities: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
showAction: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
}, | ||
emits: ['update:modelValue'], | ||
data() { | ||
return { | ||
headers: [ | ||
{ title: 'Facility Name', key: 'facilityName' }, | ||
{ title: 'Facility Address', key: 'address1' }, | ||
{ title: 'Primary Contact', key: 'primaryContactName' }, | ||
{ title: 'Expense Authority', key: 'expenseAuthorityName' }, | ||
{ title: 'Actions', key: 'contactId', sortable: false }, | ||
], | ||
updatedValue: null, | ||
facilityNameFilter: undefined, | ||
} | ||
}, | ||
computed: { | ||
filteredFacilities() { | ||
return isEmpty(this.facilityNameFilter) ? this.facilities : this.facilities?.filter((facility) => facility.facilityName?.toLowerCase().includes(this.facilityNameFilter?.toLowerCase())) | ||
}, | ||
}, | ||
methods: { | ||
/** | ||
* Facility filter component value changed. | ||
*/ | ||
facilityFilterChanged(newVal) { | ||
this.facilityNameFilter = newVal | ||
}, | ||
/** | ||
* Navigates to the Manage Facility page | ||
*/ | ||
navigateToFacility(facilityId) { | ||
this.$router.push({ name: 'manage-facility', params: { facilityId } }) | ||
}, | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters