refactor: domain name config
parent
4e4a838045
commit
0d7f53c937
|
|
@ -0,0 +1,16 @@
|
||||||
|
var config = {
|
||||||
|
dev: {
|
||||||
|
apiBaseURL: 'http://localhost:8080/hdpos/api'
|
||||||
|
},
|
||||||
|
prod: {
|
||||||
|
apiBaseURL: 'http://V-XSTO-A01-IIDC.adic.lan/hdpos/api'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Now we check the hostname where the script is running
|
||||||
|
var env = window.location.hostname.includes('localhost') ? 'dev' : 'prod';
|
||||||
|
|
||||||
|
var selectedConfig = config[env];
|
||||||
|
|
||||||
|
// Make the selected configuration available for other scripts
|
||||||
|
window.config = selectedConfig;
|
||||||
|
|
@ -369,6 +369,7 @@ Contact: frederik.benoist@inetum.com
|
||||||
<script src="assets/plugins/custom/datatables/datatables.bundle.js"></script>
|
<script src="assets/plugins/custom/datatables/datatables.bundle.js"></script>
|
||||||
<!--end::Vendors Javascript-->
|
<!--end::Vendors Javascript-->
|
||||||
<!--begin::Custom Javascript(used for this page only)-->
|
<!--begin::Custom Javascript(used for this page only)-->
|
||||||
|
<script src="config/config.js"></script>
|
||||||
<script src="store/list/table.js"></script>
|
<script src="store/list/table.js"></script>
|
||||||
<!--end::Custom Javascript-->
|
<!--end::Custom Javascript-->
|
||||||
<!--end::Javascript-->
|
<!--end::Javascript-->
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ var KTUsersList = function () {
|
||||||
{ data: 'telephone', name: "telephone"}
|
{ data: 'telephone', name: "telephone"}
|
||||||
],
|
],
|
||||||
ajax: {
|
ajax: {
|
||||||
"url": "http://localhost:8080/hdpos/api/stores/getAll",
|
"url": config.apiBaseURL + "/stores/getAll",
|
||||||
"dataSrc": ""
|
"dataSrc": ""
|
||||||
},
|
},
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
|
|
|
||||||
|
|
@ -807,6 +807,7 @@ Contact: frederik.benoist@inetum.com
|
||||||
<script src="assets/plugins/custom/datatables/datatables.bundle.js"></script>
|
<script src="assets/plugins/custom/datatables/datatables.bundle.js"></script>
|
||||||
<script src="assets/js/widgets.bundle.js"></script>
|
<script src="assets/js/widgets.bundle.js"></script>
|
||||||
<script src="assets/js/custom/widgets.js"></script>
|
<script src="assets/js/custom/widgets.js"></script>
|
||||||
|
<script src="config/config.js"></script>
|
||||||
<script src="store/view/view-store.js"></script>
|
<script src="store/view/view-store.js"></script>
|
||||||
<!--end::Custom Javascript-->
|
<!--end::Custom Javascript-->
|
||||||
<!--end::Javascript-->
|
<!--end::Javascript-->
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ var KTStoreView = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// call StoreDetails API
|
// call StoreDetails API
|
||||||
fetch('http://localhost:8080/hdpos/api/stores/getStoreDetails?dbHost='+ipAddress+'&storeId='+storeId)
|
fetch(config.apiBaseURL + "/stores/getStoreDetails?dbHost="+ipAddress+"&storeId="+storeId)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
debugger;
|
debugger;
|
||||||
|
|
@ -118,7 +118,7 @@ var KTStoreView = function () {
|
||||||
left: 1
|
left: 1
|
||||||
},
|
},
|
||||||
ajax: {
|
ajax: {
|
||||||
"url": "http://localhost:8080/hdpos/api/items/" + itemId,
|
"url": config.apiBaseURL + "/items/" + itemId,
|
||||||
"dataSrc": "",
|
"dataSrc": "",
|
||||||
"data": {
|
"data": {
|
||||||
"dbHost": ipAddress
|
"dbHost": ipAddress
|
||||||
|
|
@ -143,7 +143,7 @@ var KTStoreView = function () {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
statusItem.innerHTML = 'Loading...';
|
statusItem.innerHTML = 'Loading...';
|
||||||
datatableItem.ajax.url("http://localhost:8080/hdpos/api/items/" + itemId);
|
datatableItem.ajax.url(config.apiBaseURL + "/items/" + itemId);
|
||||||
datatableItem.ajax.reload(function() {
|
datatableItem.ajax.reload(function() {
|
||||||
dtUpdateStatus(statusItem, "Last refresh", "", false)
|
dtUpdateStatus(statusItem, "Last refresh", "", false)
|
||||||
}, true);
|
}, true);
|
||||||
|
|
@ -168,7 +168,7 @@ var KTStoreView = function () {
|
||||||
left: 1
|
left: 1
|
||||||
},
|
},
|
||||||
ajax: {
|
ajax: {
|
||||||
"url": "http://localhost:8080/hdpos/api/items/" + itemId + "/options",
|
"url": config.apiBaseURL + "/items/" + itemId + "/options",
|
||||||
"dataSrc": "",
|
"dataSrc": "",
|
||||||
"data": {
|
"data": {
|
||||||
"dbHost": ipAddress
|
"dbHost": ipAddress
|
||||||
|
|
@ -199,7 +199,7 @@ var KTStoreView = function () {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
statusItemOptions.innerHTML = 'Loading...';
|
statusItemOptions.innerHTML = 'Loading...';
|
||||||
datatableItemOptions.ajax.url("http://localhost:8080/hdpos/api/items/" + itemId + "/options");
|
datatableItemOptions.ajax.url(config.apiBaseURL + "/items/" + itemId + "/options");
|
||||||
datatableItemOptions.ajax.reload(function() {
|
datatableItemOptions.ajax.reload(function() {
|
||||||
dtUpdateStatus(statusItemOptions, "Last refresh", "", false)
|
dtUpdateStatus(statusItemOptions, "Last refresh", "", false)
|
||||||
}, true);
|
}, true);
|
||||||
|
|
@ -224,7 +224,7 @@ var KTStoreView = function () {
|
||||||
left: 1
|
left: 1
|
||||||
},
|
},
|
||||||
ajax: {
|
ajax: {
|
||||||
"url": "http://localhost:8080/hdpos/api/items/" + itemId + "/price",
|
"url": config.apiBaseURL + "/items/" + itemId + "/price",
|
||||||
"dataSrc": "",
|
"dataSrc": "",
|
||||||
"data": {
|
"data": {
|
||||||
"dbHost": ipAddress
|
"dbHost": ipAddress
|
||||||
|
|
@ -256,7 +256,7 @@ var KTStoreView = function () {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
statusItemPrice.innerHTML = 'Loading...';
|
statusItemPrice.innerHTML = 'Loading...';
|
||||||
datatableItemPrice.ajax.url("http://localhost:8080/hdpos/api/items/" + itemId + "/price");
|
datatableItemPrice.ajax.url(config.apiBaseURL + "/items/" + itemId + "/price");
|
||||||
datatableItemPrice.ajax.reload(function() {
|
datatableItemPrice.ajax.reload(function() {
|
||||||
dtUpdateStatus(statusItemPrice, "Last refresh", "", false)
|
dtUpdateStatus(statusItemPrice, "Last refresh", "", false)
|
||||||
}, true);
|
}, true);
|
||||||
|
|
@ -281,7 +281,7 @@ var KTStoreView = function () {
|
||||||
left: 1
|
left: 1
|
||||||
},
|
},
|
||||||
ajax: {
|
ajax: {
|
||||||
"url": "http://localhost:8080/hdpos/api/items/" + itemId + "/stock",
|
"url": config.apiBaseURL + "/items/" + itemId + "/stock",
|
||||||
"dataSrc": "",
|
"dataSrc": "",
|
||||||
"data": {
|
"data": {
|
||||||
"dbHost": ipAddress
|
"dbHost": ipAddress
|
||||||
|
|
@ -307,7 +307,7 @@ var KTStoreView = function () {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
statusItemStock.innerHTML = 'Loading...';
|
statusItemStock.innerHTML = 'Loading...';
|
||||||
datatableItemStock.ajax.url("http://localhost:8080/hdpos/api/items/" + itemId + "/stock");
|
datatableItemStock.ajax.url(config.apiBaseURL + "/items/" + itemId + "/stock");
|
||||||
datatableItemStock.ajax.reload(function() {
|
datatableItemStock.ajax.reload(function() {
|
||||||
dtUpdateStatus(statusItemStock, "Last refresh", "", false)
|
dtUpdateStatus(statusItemStock, "Last refresh", "", false)
|
||||||
}, true);
|
}, true);
|
||||||
|
|
@ -329,7 +329,7 @@ var KTStoreView = function () {
|
||||||
paging: false,
|
paging: false,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
ajax: {
|
ajax: {
|
||||||
"url": "http://localhost:8080/hdpos/api/stores/version",
|
"url": config.apiBaseURL + "/stores/version",
|
||||||
"dataSrc": "",
|
"dataSrc": "",
|
||||||
"data": {
|
"data": {
|
||||||
"dbHost": ipAddress
|
"dbHost": ipAddress
|
||||||
|
|
@ -372,7 +372,7 @@ var KTStoreView = function () {
|
||||||
paging: true,
|
paging: true,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
ajax: {
|
ajax: {
|
||||||
"url": "http://localhost:8080/hdpos/api/stores/sequence",
|
"url": config.apiBaseURL + "/stores/sequence",
|
||||||
"dataSrc": "",
|
"dataSrc": "",
|
||||||
"data": {
|
"data": {
|
||||||
"dbHost": ipAddress
|
"dbHost": ipAddress
|
||||||
|
|
@ -448,7 +448,7 @@ var KTStoreView = function () {
|
||||||
left: 2
|
left: 2
|
||||||
},
|
},
|
||||||
ajax: {
|
ajax: {
|
||||||
"url": "http://localhost:8080/hdpos/api/stores/signature",
|
"url": config.apiBaseURL + "/stores/signature",
|
||||||
"dataSrc": "",
|
"dataSrc": "",
|
||||||
"data": {
|
"data": {
|
||||||
"dbHost": ipAddress
|
"dbHost": ipAddress
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue