在掛單資料頁面,增加判斷掛單是否超時
This commit is contained in:
@@ -20,7 +20,12 @@ public class guadanOrderController : ApiController
|
||||
[Route("api/guadan/list")]
|
||||
public async Task<IHttpActionResult> getGuadanList([FromBody] guadan_order_search_dto search)
|
||||
{
|
||||
|
||||
var lastCheckoutTime = _db.GuadanTimeSetting.FirstOrDefault();
|
||||
string lastCheckoutTimeStr = null;
|
||||
if (lastCheckoutTime != null)
|
||||
{
|
||||
lastCheckoutTimeStr = lastCheckoutTime.LatestCheckOut;
|
||||
}
|
||||
var query = _db.GuaDanOrder
|
||||
.Where(a => a.IsCancel == false)
|
||||
.Where(a => a.IsDeleted == false);
|
||||
@@ -49,7 +54,8 @@ public class guadanOrderController : ApiController
|
||||
}
|
||||
}
|
||||
var total = query.Count();
|
||||
var data = await query
|
||||
var data1 = query.ToList();
|
||||
var data = data1
|
||||
.OrderByDescending(b => b.CreatedAt)
|
||||
.Select(a => new
|
||||
{
|
||||
@@ -60,6 +66,14 @@ public class guadanOrderController : ApiController
|
||||
created_at = a.CreatedAt,
|
||||
updated_at = a.UpdatedAt,
|
||||
notes = a.Notes,
|
||||
is_timeout = !string.IsNullOrEmpty(lastCheckoutTimeStr) &&
|
||||
_db.GuaDanOrderGuest
|
||||
.Where(g => g.GuaDanOrderNo == a.GuaDanOrderNo && !g.IsDeleted && g.StatusCode == GuaDanOrderGuest.STATUS_CHECKED_IN)
|
||||
.ToList()
|
||||
.Any(g =>
|
||||
g.CheckOutAt.HasValue &&
|
||||
DateTime.Parse(g.CheckOutAt.Value.ToString("yyyy-MM-dd") + " " + lastCheckoutTimeStr) < DateTime.Now
|
||||
),
|
||||
activity = _db.activities
|
||||
.Where(act => act.num == a.ActivityNum)
|
||||
.Select(act => new
|
||||
@@ -88,7 +102,7 @@ public class guadanOrderController : ApiController
|
||||
})
|
||||
.Skip((search.page - 1) * search.pageSize)
|
||||
.Take(search.pageSize)
|
||||
.ToListAsync();
|
||||
.ToList();
|
||||
return Ok(new
|
||||
{
|
||||
total,
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<v-data-table
|
||||
:items="items"
|
||||
:headers="headers"
|
||||
:item-class="item => item.is_timeout ? 'row-timeout' : ''"
|
||||
hide-default-footer>
|
||||
<template #item.actions="{item}">
|
||||
<a :href="'create.aspx?orderId='+item.guaDanOrderNo" class="btn btn-secondary">編輯</a>
|
||||
@@ -56,6 +57,9 @@
|
||||
<template #item.activity="{item}">
|
||||
{{item.activity?.subject}}
|
||||
</template>
|
||||
<template #item.is_timeout="{item}">
|
||||
{{item.is_timeout ? '已超時': '否'}}
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-container>
|
||||
<v-row class="align-baseline" wrap="false">
|
||||
@@ -99,7 +103,6 @@
|
||||
<confirm-modal ref="confirmModal"></confirm-modal>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
|
||||
<div>test</div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
|
||||
<script>
|
||||
@@ -121,6 +124,7 @@
|
||||
{ text: '狀態', value: 'statusName', align: 'center' },
|
||||
{ text: '建立時間', value: 'created_at', align: 'center' },
|
||||
{ text: '關聯活動', value: 'activity', align: 'center' },
|
||||
{ text: '超時退房', value: 'is_timeout', align: 'center' },
|
||||
{ text: '操作', value: 'actions', align: 'center' }
|
||||
],
|
||||
options: {
|
||||
@@ -242,4 +246,10 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.row-timeout {
|
||||
background-color: #ffdddd !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
</asp:Content>
|
||||
Reference in New Issue
Block a user