| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/apache/htdocs/app/resources/js/views/LockerBoxTypes/ |
Upload File : |
<template>
<v-container>
<!-- introduction -->
<v-row align="end">
<v-col>
<div class="headline font-weight-bold">Locker Box Type</div>
<div class="subtitle-2 grey--text">Locker Box Types that registered in this system.</div>
</v-col>
</v-row>
<v-row align="center" class="mt-3" justify="end">
<v-col cols="12" md="auto">
<v-btn
class="text-capitalize"
color="primary" small
@click="newItem_({booking_fees : 0, overtime_fees: 0 })"
>
<v-icon left>mdi-plus</v-icon>New
</v-btn>
</v-col>
<v-spacer></v-spacer>
<v-col cols="auto">
<w-action-btn-group
:items="action_btn_group_items()"
></w-action-btn-group>
</v-col>
</v-row>
<v-card class="mt-4" color="transparent" flat>
<v-data-table
ref="dataTable"
:headers="table_headers"
:items="resourceDataSet_"
:options.sync="settings_"
:server-items-length="totalData_"
:footer-props="{
'items-per-page-options': [5, 10, 25, 50]
}"
:loading="model_loading_"
disable-sort
:hide-default-header="view_module"
:item-class="row_classes_"
:class="view_module ? 'row-gap' : '' "
>
<template v-if="view_module" #body="{ items, headers }">
<td :colspan="headers.length">
<v-row dense class="ma-0">
<v-col
v-for="item in items" :key="item.id"
cols="12" sm="6" md="4"
lg="3"
>
<!-- <LockerBoxTypeCard
:item="item"
:menu="menu_items(item)"
class="glowable-small"
></LockerBoxTypeCard> -->
</v-col>
</v-row>
</td>
</template>
<template #[`item.name`]="{ item }">
<v-row dense class="flex-nowrap ma-0">
<v-col cols="auto">
<v-icon size="40">mdi-account-circle</v-icon>
</v-col>
<v-col class="overflow-hidden">
<div class="primary--text no-word-wrap" :title="item.full_name">{{ item.full_name }}<sup>#{{ item.id }}</sup></div>
<div class="caption grey--text">{{ item.email }}</div>
</v-col>
</v-row>
</template>
<template #[`item.created_at`]="{ item }">
{{ $dayjs(item.created_at).format('YYYY-MM-DD hh:mma') }}
</template>
<template #[`item.action`]="{ item }">
<w-dropdown-menu
left bottom
:items="menu_items(item)"
></w-dropdown-menu>
</template>
</v-data-table>
</v-card>
<!-- form dialog -->
<v-dialog v-model="form_dialog_" max-width="550px" persistent>
<LockerBoxTypeForm
:item="form_item_" :action="form_action_" :visible.sync="form_dialog_"
:role-types="options_.user_type"
@initialize="initialize_()"
></LockerBoxTypeForm>
</v-dialog>
<!-- filter dialog -->
<w-side-dialog
v-model="filter_dialog"
title="Filters"
clearable
@clear="initFilters()"
>
<template #default>
<v-row dense>
<template v-for="(filter,i) in filter_options">
<v-col :key="i" cols="12">
<v-select
v-model="filters_[filter.model]"
:label="filter.label"
:items="filter.items"
class="caption"
outlined
dense hide-details
></v-select>
</v-col>
</template>
</v-row>
</template>
<template #actions>
<div class="text-right">
<v-btn
rounded block color="primary"
@click="searchData_()"
>
Apply
</v-btn>
</div>
</template>
</w-side-dialog>
<!-- Sort dialog -->
<w-side-dialog
v-model="sort_dialog"
title="Sort"
>
<template #default>
<v-radio-group
v-model="sort_"
dense hide-details
mandatory
class="mt-0"
>
<template v-for="(sort,i) in sort_options">
<v-radio :key="i" :label="sort.label" :value="sort.value"></v-radio>
</template>
</v-radio-group>
</template>
<template #actions>
<div class="text-right">
<v-btn
rounded block color="primary"
@click="searchData_()"
>
Apply
</v-btn>
</div>
</template>
</w-side-dialog>
<!-- model info dialog -->
<v-navigation-drawer
v-model="view_dialog_"
floating
app
right
temporary
:style="$vuetify.breakpoint.mdAndUp ? 'min-width: 350px;' : '' "
>
<v-card height="100%">
<!-- <LockerBoxTypeCard :item="view_item_" class="v-card--flat"></LockerBoxTypeCard> -->
</v-card>
</v-navigation-drawer>
</v-container>
</template>
<script>
// import LockerBoxTypeCard from "./LockerBoxTypeCard"
import LockerBoxTypeForm from "./LockerBoxTypeForm"
import WActionBtnGroup from "@components/WActionBtnGroup"
import WDropdownMenu from "@components/WDropdownMenu"
import WSideDialog from "@components/WSideDialog"
import { resourceMixin } from "@/js/mixins/ResourceMixin"
import { formActionMixin } from "@/js/mixins/FormActionMixin"
import { errorHandlerMixin } from "@/js/mixins/ErrorHandlerMixin"
export default{
components:{
// LockerBoxTypeCard,
LockerBoxTypeForm,
WActionBtnGroup,
WDropdownMenu,
WSideDialog,
},
mixins: [
resourceMixin,
formActionMixin,
errorHandlerMixin
],
data(){
return {
table_headers: [
{ text: '#', value: 'id' },
{ text: 'Title', value: 'title' },
{ text: 'Box Dimension', value: 'dimension_text' },
{ text: 'Booking Fees (RM)', value: 'booking_fees' },
{ text: 'Overtime Fees (RM)', value: 'overtime_fees' },
{ text: 'Created at', value: 'created_at' },
{ text: 'Actions', value: 'action', class: 'text-center' },
],
show_statistics: false,
view_module: false,
filter_dialog: false,
sort_dialog: false,
view_more_dialog: false,
filter_options:[],
sort_options:[],
searchBy_options: [
{ value: 'id', text: 'ID' },
{ value: 'full_name', text: 'Name' },
]
}
},
created(){
this.search_.searchBy = 'full_name'
this.options_.activity = this.getActivityRefs_()
this.getAllRefs_([
]).then(()=>{
this.setupFilterBar()
this.initFilters()
this.setupSortOptions()
}).then(()=>{
this.initialize_()
})
},
methods:{
initFilters(){
this.filters_ = {
activity : 2,
role_id : null,
}
},
getResourceData_(){
let payload = {
...this.setPagination_(),
...this.search_,
...this.filters_,
...this.sort_,
}
this.model_loading_ = true
this.$api.getLockerBoxTypeList(payload).then((res)=>{
let { data, total } = res.data.result
this.resourceDataSet_ = data
this.totalData_ = total
}).catch((err)=>{
this.errorHandler_(err)
}).finally(()=>{
this.model_loading_ = false
})
},
archiveModel_(item){
let payload = {
id : item.id
}
this.$api.archiveLockerBoxType(payload).then((res) => {
this.initialize_();
this.$toast.success(res.data.message)
}).catch((err) => {
this.errorHandler_(err)
})
},
setupFilterBar(){
this.filter_options = [
{
cols: 12,
model: "activity",
label: "Activity",
items: this.options_.activity,
},
]
},
setupSortOptions(){
this.sort_options = [
{ label: "id (ASC)", value: {sortBy: "id", sortDesc : 0 } },
{ label: "id (DESC)", value: {sortBy: "id", sortDesc : 1 } }
]
},
menu_items(item){
return [
// {
// icon: "mdi-eye", title: "View More",
// action: ()=>{ this.viewMore_(item) }
// },
{
icon: "mdi-content-duplicate", title: "Duplicate",
action: () => { this.duplicateItem_(item) }
},
{
icon: "mdi-square-edit-outline", title: "Edit",
action: () => { this.editItem_(item) }
},
{
icon: (item.deleted_at ? "mdi-delete-off" : "mdi-delete"),
title: (item.deleted_at ? "Activate" : "Archive"),
icon_class: "red--text",
title_class: "red--text",
action: () => { this.archiveModel_(item) }
},
]
},
action_btn_group_items(){
return [
{
icon: "mdi-refresh",
disabled: this.model_loading_,
action: () => { this.searchData_() }
},
{
icon: "mdi-filter-outline",
action: () => { this.filter_dialog = true }
},
{
icon: "mdi-sort",
action: () => { this.sort_dialog = true }
},
]
},
}
}
</script>