issue #11 Done amenity quantity control pop ui.
This commit is contained in:
@@ -82,13 +82,12 @@ HotelTV.api = (function() {
|
||||
*/
|
||||
function __apifxn_get_api_url(api_type) {
|
||||
var dic_api_url = {
|
||||
/* Setting & Contents */
|
||||
"get_translation": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/translation",
|
||||
"get_device_settings": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/setting",
|
||||
"get_site_info": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/info",
|
||||
"get_guest_info": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/guest",
|
||||
"get_opening_ctz": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/opening",
|
||||
"get_amenity_ctz": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amentity",
|
||||
"get_roomservice_ctz": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService",
|
||||
"get_widget_ctz": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/widget",
|
||||
"get_program_ctz": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/program",
|
||||
"get_epg_info": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/epg",
|
||||
@@ -97,13 +96,18 @@ HotelTV.api = (function() {
|
||||
"get_services": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/services",
|
||||
"get_news": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/news",
|
||||
"get_message": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/messages",
|
||||
/* Requests */
|
||||
/* Amenity&Room Service: get/request/sotck */
|
||||
"get_ctz_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amentity",
|
||||
"get_stock_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/stock",
|
||||
"get_carts_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/carts",
|
||||
"put_carts_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/carts",
|
||||
"update_carts_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/carts",
|
||||
"delete_carts_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/carts",
|
||||
"get_order_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/orders",
|
||||
"put_order_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/orders",
|
||||
|
||||
"get_ctz_roomservice": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService",
|
||||
"get_stock_roomservice": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService/stock",
|
||||
"get_carts_roomservice": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService/carts",
|
||||
"put_carts_roomservice": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService/carts",
|
||||
"update_carts_roomservice": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService/carts",
|
||||
@@ -117,7 +121,6 @@ HotelTV.api = (function() {
|
||||
/*
|
||||
"get_emergency": __apifxn_get_base_url() + "/api/" + _api_ver + "/settops/" + _serial_num + "/emergency",
|
||||
"set_message_status": __apifxn_get_base_url() + "/api/" + _api_ver + "/settops/" + _serial_num + "/messages",
|
||||
|
||||
"set_device_opmode": __apifxn_get_base_url() + "/api/" + _api_ver + "/settops/" + _serial_num + "/bbdoors/opmode",
|
||||
*/
|
||||
}
|
||||
@@ -334,7 +337,7 @@ HotelTV.api = (function() {
|
||||
|
||||
GetAmenityCtz: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_amenity_ctz");
|
||||
let sz_api_url = __apifxn_get_api_url("get_ctz_amenity");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetAmenityCtz", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
@@ -347,7 +350,7 @@ HotelTV.api = (function() {
|
||||
|
||||
GetRoomServiceCtz: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_roomservice_ctz");
|
||||
let sz_api_url = __apifxn_get_api_url("get_ctz_roomservice");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetRoomServiceCtz", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
@@ -466,9 +469,33 @@ HotelTV.api = (function() {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> get amenity stock info
|
||||
* @param {string} _item_id
|
||||
* @param {number} _quantity
|
||||
* @returns
|
||||
* null: if _item_id isn't null it will return specified info with _item_id
|
||||
* {dictionary}
|
||||
*/
|
||||
GetAmenityStocks: function(_item_id, _quantity) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_stock_amenity")+ "/" + _item_id + "?quantity=" + _quantity;
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetAmenityStocks", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.error(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> get amenity carts info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _item_id
|
||||
* @returns
|
||||
* null: if _item_id isn't null it will return specified info with _item_id
|
||||
* {dictionary}
|
||||
*/
|
||||
GetAmenityCarts: function(_item_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -485,7 +512,11 @@ HotelTV.api = (function() {
|
||||
|
||||
/**
|
||||
* HotelTV API ::> put amenity carts info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _item_id
|
||||
* @param {number} _quantity
|
||||
* @returns
|
||||
* null: if _item_id isn't null it will return specified info with _item_id
|
||||
* {dictionary}
|
||||
*/
|
||||
PutAmenityCarts: function(_item_id, _quantity) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -502,7 +533,11 @@ HotelTV.api = (function() {
|
||||
|
||||
/**
|
||||
* HotelTV API ::> update amenity carts info
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _cart_id
|
||||
* @param {number} _quantity
|
||||
* @returns
|
||||
* null: if _item_id isn't null it will return specified info with _item_id
|
||||
* {dictionary}
|
||||
*/
|
||||
UpdateAmenityCarts: function(_cart_id, _quantity) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -519,7 +554,10 @@ HotelTV.api = (function() {
|
||||
|
||||
/**
|
||||
* HotelTV API ::> delete amenity carts info
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _cart_id
|
||||
* @returns
|
||||
* null: if _item_id isn't null it will return specified info with _item_id
|
||||
* {dictionary}
|
||||
*/
|
||||
DeleteAmenityCarts: function(_cart_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -536,7 +574,10 @@ HotelTV.api = (function() {
|
||||
|
||||
/**
|
||||
* HotelTV API ::> get amenity order info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _cart_id
|
||||
* @returns
|
||||
* null: if _item_id isn't null it will return specified info with _item_id
|
||||
* {dictionary}
|
||||
*/
|
||||
GetAmenityOrders: function(_item_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -552,12 +593,36 @@ HotelTV.api = (function() {
|
||||
|
||||
/**
|
||||
* HotelTV API ::> order amenity
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _cart_id
|
||||
* @returns
|
||||
* null: if _cart_id isn't null it will return specified info with _cart_id
|
||||
* {dictionary}
|
||||
*/
|
||||
PutAmenityOrders: function(_cart_item) {
|
||||
PutAmenityOrders: function(_cart_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("put_order_amenity");
|
||||
__apifxn_CallCmsApi("POST", `${sz_api_url}`, "PutAmenityOrders", _cart_item).then(_result => {
|
||||
__apifxn_CallCmsApi("POST", `${sz_api_url}`, "PutAmenityOrders", _cart_id).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.error(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> get roomservice stock info
|
||||
* @param {string} _item_id
|
||||
* @param {number} _quantity
|
||||
* @returns
|
||||
* null: if _item_id isn't null it will return specified info with _item_id
|
||||
* {dictionary}
|
||||
*/
|
||||
GetRoomserviceStocks: function(_item_id, _quantity) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_stock_roomservice")+ "/" + _item_id + "?quantity=" + _quantity;
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetRoomserviceStocks", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
@@ -569,7 +634,10 @@ HotelTV.api = (function() {
|
||||
|
||||
/**
|
||||
* HotelTV API ::> get room service carts info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _item_id
|
||||
* @returns
|
||||
* null: if _item_id isn't null it will return specified info with _item_id
|
||||
* {dictionary}
|
||||
*/
|
||||
GetRoomserviceCarts: function(_item_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -586,7 +654,11 @@ HotelTV.api = (function() {
|
||||
|
||||
/**
|
||||
* HotelTV API ::> put room service carts info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _item_id
|
||||
* @param {number} _quantity
|
||||
* @returns
|
||||
* null: if _item_id isn't null it will return specified info with _item_id
|
||||
* {dictionary}
|
||||
*/
|
||||
PutRoomserviceCarts: function(_item_id, _quantity) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -603,7 +675,11 @@ HotelTV.api = (function() {
|
||||
|
||||
/**
|
||||
* HotelTV API ::> update room service carts info
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _item_id
|
||||
* @param {number} _quantity
|
||||
* @returns
|
||||
* null: if _item_id isn't null it will return specified info with _item_id
|
||||
* {dictionary}
|
||||
*/
|
||||
UpdateRoomserviceCarts: function(_cart_id, _quantity) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -620,7 +696,10 @@ HotelTV.api = (function() {
|
||||
|
||||
/**
|
||||
* HotelTV API ::> delete room service carts info
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _cart_id
|
||||
* @returns
|
||||
* null: if _cart_id isn't null it will return specified info with _cart_id
|
||||
* {dictionary}
|
||||
*/
|
||||
DeleteRoomserviceCarts: function(_cart_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -637,7 +716,10 @@ HotelTV.api = (function() {
|
||||
|
||||
/**
|
||||
* HotelTV API ::> get room service order info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _item_id
|
||||
* @returns
|
||||
* null: if _item_id isn't null it will return specified info with _item_id
|
||||
* {dictionary}
|
||||
*/
|
||||
GetRoomserviceOrders: function(_item_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -653,12 +735,15 @@ HotelTV.api = (function() {
|
||||
|
||||
/**
|
||||
* HotelTV API ::> order room service
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
* @param {string} _cart_id
|
||||
* @returns
|
||||
* null: if _cart_id isn't null it will return specified info with _cart_id
|
||||
* {dictionary}
|
||||
*/
|
||||
PutRoomserviceOrders: function(_cart_item) {
|
||||
PutRoomserviceOrders: function(_cart_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("put_order_roomservice");
|
||||
__apifxn_CallCmsApi("POST", `${sz_api_url}`, "PutRoomserviceOrders", _cart_item).then(_result => {
|
||||
__apifxn_CallCmsApi("POST", `${sz_api_url}`, "PutRoomserviceOrders", _cart_id).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
@@ -668,7 +753,7 @@ HotelTV.api = (function() {
|
||||
});
|
||||
},
|
||||
|
||||
ReportEvent: function(_arrary_event) {
|
||||
ReportEvent: function(_arrary_event, _type=null) {
|
||||
let _json_event = {
|
||||
"events": [],
|
||||
};
|
||||
@@ -677,6 +762,7 @@ HotelTV.api = (function() {
|
||||
_json_event.events.push({
|
||||
"power": _arrary_event[_evtidx].power,
|
||||
"location": _arrary_event[_evtidx].location,
|
||||
'type': _type,
|
||||
"timestamp": Date.now()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user