issue#1 Apply room service button order and actions for order-detail and cancel.
This commit is contained in:
@@ -530,8 +530,8 @@ HotelTV.ui_appfull = (function() {
|
||||
__uifxn_AppFull_DrawAmenityItem();
|
||||
|
||||
_elAmBtnRoot.children('.order').text(_trTbl.ui.amenity.title.order[_state.lang]);
|
||||
_elAmBtnRoot.children('.cancel').text(_trTbl.ui.amenity.title.cancel[_state.lang]);
|
||||
_elAmBtnRoot.children('.details').text(_trTbl.ui.amenity.title.carts[_state.lang]);
|
||||
_elAmBtnRoot.children('.cancel').text(_trTbl.ui.amenity.title.cancel[_state.lang]);
|
||||
|
||||
// HOTKEY정보를 state에 기록
|
||||
if (!(_amenity.button in _state.hotkey.mm)) {
|
||||
@@ -1002,8 +1002,8 @@ HotelTV.ui_appfull = (function() {
|
||||
__uifxn_AppFull_DrawRoomserviceItem();
|
||||
|
||||
_elRsMnBtn.children('.order').text(_trTbl.ui.roomservice.title.order[_state.lang]);
|
||||
_elRsMnBtn.children('.cancel').text(_trTbl.ui.roomservice.title.cancel[_state.lang]);
|
||||
_elRsMnBtn.children('.details').text(_trTbl.ui.roomservice.title.carts[_state.lang]);
|
||||
_elRsMnBtn.children('.cancel').text(_trTbl.ui.roomservice.title.cancel[_state.lang]);
|
||||
|
||||
// HOTKEY정보를 state에 기록
|
||||
if (!(_roomservice.button in _state.hotkey.mm)) {
|
||||
@@ -1011,8 +1011,10 @@ HotelTV.ui_appfull = (function() {
|
||||
'type': "roomservice",
|
||||
"status": {
|
||||
"focus": "table",
|
||||
"last_CartTbl_ScrOfset": 0,
|
||||
"last_CartTbl_idx": 0,
|
||||
"last_CartBtn_idx": null,
|
||||
"last_OrderTbl_ScrOfset": 0,
|
||||
"last_OrderTbl_idx": 0,
|
||||
}
|
||||
};
|
||||
@@ -1081,6 +1083,7 @@ HotelTV.ui_appfull = (function() {
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartTbl_idx = activeTableRow.prop('rowIndex');
|
||||
|
||||
_scrollTopVal = activeTableRow.prop('scrollHeight') * _state.hotkey.mm[_roomservice.button].status.last_CartTbl_idx;
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartTbl_ScrOfset = _scrollTopVal;
|
||||
_elRsMnItems.animate({ scrollTop: _scrollTopVal }, 200);
|
||||
|
||||
//Activated된 테이블 레코드의 ID속성값 읽어오기
|
||||
@@ -1100,15 +1103,15 @@ HotelTV.ui_appfull = (function() {
|
||||
}
|
||||
} else if (_state.hotkey.mm[_roomservice.button].status.focus == "button") {
|
||||
_elRsMnBtn.children('div').removeClass("active");
|
||||
if (_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx == "details") {
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx = "cancel";
|
||||
_elRsMnBtn.children('div.cancel').addClass("active");
|
||||
if (_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx == "cancel") {
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx = "details";
|
||||
_elRsMnBtn.children('div.details').addClass("active");
|
||||
|
||||
if (_elRsMnRoot.css('box-shadow') != 'none') {
|
||||
_elRsMnRoot.css('box-shadow', 'none');
|
||||
_elRsRoot.animate({ backgroundColor: 'rgba(46,46,46,0.0)' }, 200, function() { _elRsMnDesc.hide() });
|
||||
}
|
||||
} else if (_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx == "cancel") {
|
||||
} else if (_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx == "details") {
|
||||
if (_checkEmptyOrder(_carts.items) == false) {
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx = "order";
|
||||
_elRsMnBtn.children('div.order').addClass("active");
|
||||
@@ -1160,6 +1163,7 @@ HotelTV.ui_appfull = (function() {
|
||||
activeTableRow.addClass('active');
|
||||
_state.hotkey.mm[_roomservice.button].status.last_OrderTbl_idx = activeTableRow.prop('rowIndex');
|
||||
_scrollTopVal = activeTableRow.prop('scrollHeight') * _state.hotkey.mm[_roomservice.button].status.last_OrderTbl_idx;
|
||||
_state.hotkey.mm[_roomservice.button].status.last_OrderTbl_ScrOfset = _scrollTopVal;
|
||||
_elRsODRoot.children('.items').animate({ scrollTop: _scrollTopVal }, 200);
|
||||
}
|
||||
|
||||
@@ -1177,6 +1181,7 @@ HotelTV.ui_appfull = (function() {
|
||||
activeTableRow.addClass('active');
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartTbl_idx = activeTableRow.prop('rowIndex');
|
||||
_scrollTopVal = activeTableRow.prop('scrollHeight') * _state.hotkey.mm[_roomservice.button].status.last_CartTbl_idx;
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartTbl_ScrOfset = _scrollTopVal;
|
||||
_elRsMnItems.animate({ scrollTop: _scrollTopVal }, 200);
|
||||
|
||||
//Activated된 테이블 레코드의 ID속성값 읽어오기
|
||||
@@ -1199,8 +1204,8 @@ HotelTV.ui_appfull = (function() {
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx = "order";
|
||||
_elRsMnBtn.children('div.order').addClass("active");
|
||||
} else {
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx = "cancel";
|
||||
_elRsMnBtn.children('div.cancel').addClass("active");
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx = "details";
|
||||
_elRsMnBtn.children('div.details').addClass("active");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1211,13 +1216,13 @@ HotelTV.ui_appfull = (function() {
|
||||
}
|
||||
} else if (_state.hotkey.mm[_roomservice.button].status.focus == "button") {
|
||||
if (_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx == "order") {
|
||||
_elRsMnBtn.children('div').removeClass("active");
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx = "cancel";
|
||||
_elRsMnBtn.children('div.cancel').addClass("active");
|
||||
} else if (_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx == "cancel") {
|
||||
_elRsMnBtn.children('div').removeClass("active");
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx = "details";
|
||||
_elRsMnBtn.children('div.details').addClass("active");
|
||||
} else if (_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx == "details") {
|
||||
_elRsMnBtn.children('div').removeClass("active");
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx = "cancel";
|
||||
_elRsMnBtn.children('div.cancel').addClass("active");
|
||||
}
|
||||
|
||||
if (_elRsMnRoot.css('box-shadow') != 'none') {
|
||||
@@ -1231,6 +1236,7 @@ HotelTV.ui_appfull = (function() {
|
||||
activeTableRow.addClass('active');
|
||||
_state.hotkey.mm[_roomservice.button].status.last_OrderTbl_idx = activeTableRow.prop('rowIndex');
|
||||
_scrollTopVal = activeTableRow.prop('scrollHeight') * _state.hotkey.mm[_roomservice.button].status.last_OrderTbl_idx;
|
||||
_state.hotkey.mm[_roomservice.button].status.last_OrderTbl_ScrOfset = _scrollTopVal;
|
||||
_elRsODRoot.children('.items').animate({ scrollTop: _scrollTopVal }, 200);
|
||||
}
|
||||
|
||||
@@ -1242,11 +1248,65 @@ HotelTV.ui_appfull = (function() {
|
||||
console.log(`STATUS::> ${JSON.stringify(_state.hotkey.mm[_roomservice.button].status)}`);
|
||||
} else if (_evt == "enter") {
|
||||
_state.hotkey.mm[_roomservice.button].status.focus = "order_details";
|
||||
} else if (_evt == "back") {
|
||||
_state.hotkey.mm[_roomservice.button].status.focus = "button";
|
||||
_elRsMnBtn.children('div').removeClass("active");
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx = "details";
|
||||
_elRsMnBtn.children('div.details').addClass("active");
|
||||
_elRsODRoot.children('.items').children('table').children('tr').removeClass("active");
|
||||
_elRsODRoot.children('.items').children('table').children('tr').first().addClass('active');
|
||||
|
||||
//_scrollTopVal = activeTableRow.prop('scrollHeight') * _state.hotkey.mm[_roomservice.button].status.last_OrderTbl_idx;
|
||||
_elRsODRoot.children('.items').animate({ scrollTop: 0 }, 200);
|
||||
|
||||
// Flush CART
|
||||
if (_isFlushCart == true && HotelTV.carts.roomservice.items) {
|
||||
let _cartsItems = HotelTV.carts.roomservice.items;
|
||||
for (_k = 1; _k <= _cartsItems.length; _k++) {
|
||||
if (_cartsItems[_k].id) {
|
||||
try {
|
||||
let _result = await HotelTV.api.DeleteRoomserviceCarts(_cartsItems[_k].id);
|
||||
if (_result) {
|
||||
console.log(`Success to flush CARTID::> ${_cartsItems[_k].id}`);
|
||||
} else {
|
||||
console.log(`Fail to flush CARTID::> ${_cartsItems[_k].id}`);
|
||||
}
|
||||
} catch (_error) {
|
||||
console.log(`Fail to call API::> ${_error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
__uifxn_AppFull_DrawRoomserviceItem();
|
||||
|
||||
_elRsMnBtn.children('div').removeClass("active");
|
||||
|
||||
_state.hotkey.mm[_roomservice.button].status.last_CartBtn_idx = null;
|
||||
_state.hotkey.mm[_roomservice.button].status.focus = "table";
|
||||
_elRsMnItems.children('table').children('tr').eq(_state.hotkey.mm[_roomservice.button].status.last_CartTbl_idx).addClass('active');
|
||||
|
||||
//Activated된 테이블 레코드의 ID속성값 읽어오기
|
||||
let _ActiveItemID = _elRsMnItems.children('table').children('tr.active').prop('id');
|
||||
//Description
|
||||
_elRsMnDesc.children('.rstitle').text(__fxn_fmvalue(_roomservice.children, "title", _ActiveItemID)[_state.lang]);
|
||||
_elRsMnDesc.children('.rscomment').text(__fxn_fmvalue(_roomservice.children, "description", _ActiveItemID)[_state.lang]);
|
||||
_elRsMnDesc.children('.image').css('background-image', 'url(' + __fxn_fmvalue(_roomservice.children, "thumbnails", _ActiveItemID).files[_state.lang][1].download + ')');
|
||||
|
||||
if (_elRsMnRoot.css('box-shadow') == 'none') {
|
||||
_elRsMnRoot.css('box-shadow', '0px 0px 30px rgba(0, 0, 0, 1)');
|
||||
_elRsRoot.animate({ backgroundColor: 'rgba(46,46,46,1.0)' }, 200, function() { _elRsMnDesc.show() });
|
||||
}
|
||||
|
||||
// _elRsMnItems.animate({ scrollTop: 0 }, 200);
|
||||
// _state.hotkey.mm[_roomservice.button].status.focus = "table";
|
||||
// _elRsMnBtn.children('div').removeClass("active");
|
||||
}
|
||||
} else if (_evt == "reset") {
|
||||
_state.hotkey.mm[_roomservice.button].status = {
|
||||
"focus": "table",
|
||||
"last_CartTbl_ScrOfset": 0,
|
||||
"last_CartTbl_idx": 0,
|
||||
"last_CartBtn_idx": null,
|
||||
"last_OrderTbl_ScrOfset": 0,
|
||||
"last_OrderTbl_idx": 0,
|
||||
};
|
||||
_elRsMnBtn.children('div').removeClass("active");
|
||||
@@ -3990,17 +4050,8 @@ HotelTV.ui_appfull = (function() {
|
||||
console.log("ENTER");
|
||||
if (_state.hotkey.mm[_opening.roomService.button].status.last_CartBtn_idx == "cancel") {
|
||||
let _elRsMnRoot = $(`.popup .roomservice`);
|
||||
_elRsMnRoot.children('.menu').animate({ scrollTop: 0 }, 0);
|
||||
_elRsMnRoot.animate({ top: 96, left: -560 }, 500, () => {
|
||||
_elRsMnRoot.children('.menu').children('.items').animate({ scrollTop: 0 }, 0, () => {
|
||||
_state.menu.stage = "main";
|
||||
_elRsMnRoot.hide(0, 'linear', () => {
|
||||
// HOTKEY STATUS 리셋
|
||||
__uifxn_AppFull_HandleRoomservice("reset", true, false);
|
||||
__uifxn_AppFull_ShowMMHotKeyBtn(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
// Move to top of item list
|
||||
__uifxn_AppFull_HandleRoomservice("back", true, false);
|
||||
} else if (_state.hotkey.mm[_opening.roomService.button].status.last_CartBtn_idx == "order") {
|
||||
let _elRsMnRoot = $(`.popup .roomservice`);
|
||||
_elRsMnRoot.children('.menu').animate({ scrollTop: 0 }, 0);
|
||||
@@ -4050,17 +4101,11 @@ HotelTV.ui_appfull = (function() {
|
||||
console.log("DOWN");
|
||||
__uifxn_AppFull_HandleRoomservice("down", false, false);
|
||||
} else if (_evt.keyCode == 461) {
|
||||
$('.popup .roomservice').animate({ top: 96, left: -560 }, 500, () => {
|
||||
$('.popup .roomservice .menu').animate({ scrollTop: 0 }, 0, () => {
|
||||
// Move to top of item list
|
||||
$('.popup .roomservice .menu>.items').animate({ scrollTop: 0 }, 0, () => {
|
||||
_state.menu.stage = "main";
|
||||
$('.popup .roomservice').hide(0, 'linear', () => {
|
||||
// HOTKEY STATUS 리셋
|
||||
__uifxn_AppFull_HandleRoomservice("reset", true, false);
|
||||
__uifxn_AppFull_ShowMMHotKeyBtn(true);
|
||||
});
|
||||
});
|
||||
$('.popup .roomservice .menu').animate({ scrollTop: 0 }, 500, () => {
|
||||
// Move to top of item list
|
||||
$('.popup .roomservice .menu>.items').animate({ scrollTop: _state.hotkey.mm[_opening.roomService.button].status.last_CartTbl_ScrOfset }, 500, () => {
|
||||
_state.menu.stage = "hotkey_mm_roomservice";
|
||||
__uifxn_AppFull_HandleRoomservice("back", false, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user