Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Remove useless slot-scope data & fix PopupMixin type
Browse files Browse the repository at this point in the history
  • Loading branch information
sawakisei committed May 18, 2019
1 parent 2308bc9 commit 679340b
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<context- ref="context" :refs="refs">
<template slot-scope="{ data: { bill, bills }, refs }">
<template slot-scope="{ data: { bill }, refs }">
<b-nav-item-icon-
v-if="moment(bill.time).year() === 1"
icon="dollar-sign"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<popup- ref="popup" title="Đặt phòng và nhận ngay">
<form-mutate-
v-if="input"
slot-scope="{ data: { bill }, close }"
slot-scope="{ close }"
:mutation="bookAndCheckIn"
:variables="getInput"
:variables="variables"
success="Thêm phòng cho hóa đơn có sẵn"
@success="close"
>
Expand Down Expand Up @@ -197,7 +197,7 @@ export default class extends mixins<PopupMixinType>(
};
}
get getInput(): BookAndCheckIn.Variables {
get variables(): BookAndCheckIn.Variables {
const { input, bookCheckOutTime } = this;
const { bill, bookings } = input;
return {
Expand Down
6 changes: 3 additions & 3 deletions uit.hotel.client/components/popup-context/bill/popup-book.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<popup- ref="popup" title="Đặt phòng">
<form-mutate-
v-if="input"
slot-scope="{ data: { bill }, close }"
slot-scope="{ close }"
:mutation="createBill"
:variables="getInput"
:variables="variables"
success="Thêm phòng cho hóa đơn có sẵn"
@success="close"
>
Expand Down Expand Up @@ -197,7 +197,7 @@ export default class extends mixins<PopupMixinType>(
};
}
get getInput(): CreateBill.Variables {
get variables(): CreateBill.Variables {
const { input, bookCheckOutTime, bookCheckInTime } = this;
const { bill, bookings } = input;
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
<template>
<context- ref="context" :refs="refs">
<template slot-scope="{ data: { booking } }">
<template
slot-scope="{
data: {
booking,
booking: { id },
},
}"
>
<b-nav-item-icon-mutate-
v-if="booking.status === statusEnum.Booked"
:mutation="cancel"
:variables="{ id: booking.id }"
:variables="{ id }"
icon="trash-2"
text="Hủy đặt phòng"
/>
<b-nav-item-icon-mutate-
v-if="booking.status === statusEnum.Booked"
:mutation="checkIn"
:variables="{ id: booking.id }"
:variables="{ id }"
icon="trash-2"
text="Nhận phòng"
/>
<b-nav-item-icon-mutate-
v-else-if="booking.status === statusEnum.CheckedIn"
:mutation="requestCheckOut"
:variables="{ id: booking.id }"
:variables="{ id }"
icon="trash-2"
text="Yêu cầu trả phòng"
/>
<b-nav-item-icon-mutate-
v-else-if="booking.status === statusEnum.RequestedCheckOut"
:mutation="checkOut"
:variables="{ id: booking.id }"
:variables="{ id }"
icon="trash-2"
text="Trả phòng"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<popup- ref="popup" title="Cập nhật vị trí">
<form-mutate-
v-if="input"
slot-scope="{ data: { employee }, close }"
slot-scope="{ close }"
:mutation="updateEmployee"
:variables="{ input }"
success="Cập nhật vị trí mới thành công"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<popup- ref="popup" title="Sửa tầng">
<form-mutate-
v-if="input"
slot-scope="{ data: { floor }, close }"
slot-scope="{ close }"
:mutation="updateFloor"
:variables="{ input }"
success="Cập nhật thông tin tầng thành công"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<popup- ref="popup" title="Cập nhật loại khách hàng">
<form-mutate-
v-if="input"
slot-scope="{ data: { patron }, close }"
slot-scope="{ close }"
:mutation="updatePatronKind"
:variables="{ input }"
success="Cập nhật loại khách hàng thành công"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ import { required, alphaNum, minLength } from 'vuelidate/lib/validators';
export default class extends mixins<
PopupMixin<
{ callback(id: number, patron: GetPatrons.Patrons) },
PatronCreateInput | null
PatronCreateInput
>
>(PopupMixin, DataMixin({ createPatron, getPatronKinds, getPatrons })) {
phoneNumbers: string = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<popup- ref="popup" title="Cập nhật khách hàng">
<form-mutate-
v-if="input"
slot-scope="{ data: { patron }, close }"
slot-scope="{ close }"
:mutation="updatePatron"
:variables="{ input }"
success="Cập nhật khách hàng thành công"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<popup- ref="popup" title="Cập nhật vị trí">
<form-mutate-
v-if="input"
slot-scope="{ data: { position }, close }"
slot-scope="{ close }"
:mutation="updatePosition"
:variables="{ input: getInput }"
success="Cập nhật vị trí mới thành công"
Expand Down Expand Up @@ -80,24 +80,26 @@ type PopupMixinType = PopupMixin<{ position: GetPositions.Positions }, any>;
},
},
})
export default class extends mixins<PopupMixinType>(
export default class extends mixins<
PopupMixinType,
{
positionOptionsAdministrative: CheckboxOption[];
positionOptionsBusiness: CheckboxOption[];
positionOptionsReceptionist: CheckboxOption[];
positionOptionsHouseKeeping: CheckboxOption[];
}
>(
PopupMixin,
DataMixin({ updatePosition }),
DataMixin({
updatePosition,
positionOptionsAdministrative,
positionOptionsBusiness,
positionOptionsReceptionist,
positionOptionsHouseKeeping,
}),
) {
selected: string[] = [];
positionOptionsAdministrative: CheckboxOption[] = [];
positionOptionsBusiness: CheckboxOption[] = [];
positionOptionsReceptionist: CheckboxOption[] = [];
positionOptionsHouseKeeping: CheckboxOption[] = [];
mounted() {
this.positionOptionsAdministrative = positionOptionsAdministrative;
this.positionOptionsBusiness = positionOptionsBusiness;
this.positionOptionsReceptionist = positionOptionsReceptionist;
this.positionOptionsHouseKeeping = positionOptionsHouseKeeping;
}
get positionOptions() {
const options = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<popup- ref="popup" title="Cập nhật loại phòng">
<form-mutate-
v-if="input"
slot-scope="{ data: { roomKind }, close }"
slot-scope="{ close }"
:mutation="updateRoomKind"
:variables="{ input }"
success="Cập nhật loại phòng mới thành công"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<popup- ref="popup" title="Thêm phòng">
<form-mutate-
v-if="input"
slot-scope="{ data: { floor }, close }"
slot-scope="{ close }"
:mutation="createRoom"
:variables="{ input }"
success="Thêm phòng mới thành công"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<popup- ref="popup" title="Cập nhật phòng">
<form-mutate-
v-if="input"
slot-scope="{ data: { room }, close }"
slot-scope="{ close }"
:mutation="updateRoom"
:variables="{ input }"
success="Cập nhật phòng mới thành công"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<popup- ref="popup" title="Sửa dịch vụ">
<form-mutate-
v-if="input"
slot-scope="{ data: { service }, close }"
slot-scope="{ close }"
:mutation="updateService"
:variables="{ input }"
success="Cập nhật thông tin dịch vụ thành công"
Expand Down

0 comments on commit 679340b

Please sign in to comment.