113 lines
4.6 KiB
Plaintext
113 lines
4.6 KiB
Plaintext
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="admin_guadan_index" %>
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" Runat="Server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
|
|
<nav>
|
|
<a href="create.aspx" class="btn btn-primary" >新建掛單</a>
|
|
</nav>
|
|
</asp:Content>
|
|
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
|
|
|
<div class="mx-5">
|
|
<v-data-table
|
|
:items="items"
|
|
:headers="headers">
|
|
<template #item.actions="{item}">
|
|
<a :href="'create.aspx?orderId='+item.guaDanOrderNo" class="btn btn-secondary">編輯</a>
|
|
<a class="btn btn-outline-danger" @click="deleteGuadanOrder(item)">取消</a>
|
|
</template>
|
|
<template #item.room="{item}">
|
|
{{item.room.name}}
|
|
</template>
|
|
<template #item.bed="{item}">
|
|
{{item.bed.name}}
|
|
</template>
|
|
<template #item.status="{item}">
|
|
{{item.status}}
|
|
</template>
|
|
<template #item.start_date="{item}">
|
|
{{item.start_date | timeString('YYYY/MM/DD HH:mm')}}
|
|
</template>
|
|
<template #item.end_date="{item}">
|
|
{{item.end_date | timeString('YYYY/MM/DD HH:mm')}}
|
|
</template>
|
|
<template #item.created_at="{item}">
|
|
{{item.created_at | timeString('YYYY/MM/DD HH:mm')}}
|
|
</template>
|
|
</v-data-table>
|
|
</div>
|
|
<!-- 更新修改確認彈出視窗 -->
|
|
<message-modal ref="messageModal"></message-modal>
|
|
<!-- 刪除確認彈出視窗 -->
|
|
<confirm-modal ref="confirmModal"></confirm-modal>
|
|
</asp:Content>
|
|
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
|
|
<script>
|
|
Vue.filter('timeString', function (value, myFormat) {
|
|
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
|
|
});
|
|
new Vue({
|
|
el: '#app',
|
|
vuetify: new Vuetify(vuetify_options),
|
|
data() {
|
|
return {
|
|
items: [],
|
|
headers: [
|
|
{ text: '登记挂单莲友', value: 'bookerName'},
|
|
{ text: '起始日期', value: 'start_date', align: 'center' },
|
|
{ text: '結束日期', value: 'end_date', align: 'center' },
|
|
{ text: '掛單人數', value: 'guest_count' },
|
|
{ text: '狀態', value: 'statusName', align: 'center' },
|
|
{ text: '建立時間', value: 'created_at', align: 'center' },
|
|
{ text: '備註', value: 'notes', align: 'center' },
|
|
{ text: '操作', value: 'actions', align: 'center' }
|
|
],
|
|
|
|
}
|
|
},
|
|
methods: {
|
|
getGuadanOrder() {
|
|
axios.get('/api/guadan/list')
|
|
.then((res) => {
|
|
this.items = res.data;
|
|
}).catch((err) => {
|
|
console.log(err);
|
|
})
|
|
},
|
|
deleteGuadanOrder(order) {
|
|
this.$refs.confirmModal.open({
|
|
message: '確認取消掛單?',
|
|
onConfirm: () => {
|
|
axios.post('/api/guadan/delete', null, {
|
|
params: {
|
|
uuid: order.uuid
|
|
}
|
|
}).then((res) => {
|
|
this.items = this.items.filter(a => a.uuid != order.uuid)
|
|
this.$refs.messageModal.open({
|
|
message: '取消成功'
|
|
})
|
|
}).catch((error) => {
|
|
this.$refs.messageModal.open({
|
|
message: '取消失敗'
|
|
})
|
|
})
|
|
}
|
|
});
|
|
|
|
},
|
|
},
|
|
watch: {
|
|
|
|
},
|
|
mounted() {
|
|
this.getGuadanOrder();
|
|
},
|
|
});
|
|
</script>
|
|
</asp:Content>
|
|
|