');\n }\n }).fail(data => {\n formModal.modal('hide');\n });\n });\n const resetUiButtonState = () => {\n adminEditButton.prop('disabled', true);\n adminDeleteButon.prop('disabled', true);\n };\n bsTable.on('load-success.bs.table', () => {\n resetUiButtonState();\n });\n bsTable.on('load-error.bs.table', (e, status, res) => {\n showFailDialog(res);\n resetUiButtonState();\n });\n bsTable.on('check.bs.table', () => {\n const selections = bsTable.bootstrapTable('getSelections');\n uiButtons(selections);\n });\n bsTable.on('uncheck.bs.table', () => {\n const selections = bsTable.bootstrapTable('getSelections');\n uiButtons(selections);\n });\n bsTable.on('check-all.bs.table', () => {\n const selections = bsTable.bootstrapTable('getSelections');\n uiButtons(selections);\n });\n bsTable.on('uncheck-all.bs.table', () => {\n const selections = bsTable.bootstrapTable('getSelections');\n uiButtons(selections);\n });\n const identifier = bsTable.data('identifier');\n if (!identifier) {\n return;\n }\n const request = (method, url, data) => {\n return fetch(url, {\n method: method.toUpperCase(),\n body: JSON.stringify(data),\n headers: {\n 'Content-Type': 'application/json'\n }\n }).then(response => {\n if (!response.ok) {\n throw new Error('HTTP error ' + response.status);\n }\n return response.json();\n });\n };\n bsTable.on('column-switch.bs.table', () => {\n const visibleColumns = bsTable.bootstrapTable('getVisibleColumns').map(it => {\n return it.field;\n });\n request('POST', `/setting/store-setting/${identifier}`, {\n value: visibleColumns\n }).catch(error => console.error('Error:', error));\n });\n request('GET', `/setting/get-setting/${identifier}`).then(data => {\n bsTable.bootstrapTable('hideAllColumns');\n data?.data?.value?.forEach(column => {\n bsTable.bootstrapTable('showColumn', column);\n });\n }).catch(error => console.error('Error:', error));\n});\n\n//# sourceURL=webpack:///./App/assets/js/components/_bsTable.js?");
+eval("$(document).ready(function () {\n const TYPE_ERROR = 'error';\n const ERROR_TITLE_AUTHORIZATION = 'Authorization error';\n const ERROR_UNEXCEPTED_SERVER = 'Unexpected server error';\n const adminEditButton = $(\"#adminEditButton\");\n const adminDeleteButon = $(\"#adminDeleteButton\");\n const bsTable = $(\"#bsTable\");\n const showFailDialog = data => {\n if (data.status == 0 && data.statusText == 'abort') {\n return;\n }\n if (data.status == 401) {\n $(\"#modalCloseButton\").click(function () {\n window.location.reload();\n });\n showAlertDialog(ERROR_TITLE_AUTHORIZATION, 'You session has expired. The page will be reloaded in order to re-authenticate', TYPE_ERROR);\n } else if (data.status == 403) {\n showAlertDialog(ERROR_TITLE_AUTHORIZATION, 'You are not authorized to run this operation', TYPE_ERROR);\n } else {\n showAlertDialog(ERROR_UNEXCEPTED_SERVER, 'Could not load form due to a server error. Please try again', TYPE_ERROR);\n }\n };\n const uiButtons = selections => {\n const count = selections.length;\n if (count === 0) {\n adminEditButton.prop('disabled', true);\n adminDeleteButon.prop('disabled', true);\n } else if (count === 1) {\n adminEditButton.prop('disabled', false);\n adminDeleteButon.prop('disabled', false);\n } else {\n adminEditButton.prop('disabled', true);\n adminDeleteButon.prop('disabled', false);\n }\n };\n $(\"#formModalSubmit\").click(function () {\n const formModal = $('#formModal');\n formModal.modal('handleUpdate');\n let form = $(\"#ajaxForm\");\n let formData = new FormData(document.querySelector(\"#ajaxForm\"));\n $.ajax({\n url: form.attr('action'),\n data: formData,\n processData: false,\n contentType: false,\n type: form.attr('method')\n }).done(data => {\n const formMessages = $(\"#formMessages\");\n if (data.success === 'success') {\n formMessages.html('
' + data.message + '
' + '
');\n bsTable.bootstrapTable('refresh');\n setTimeout(function () {\n formModal.modal('hide');\n }, 1500);\n } else {\n formMessages.html('
' + data.message + '
' + '
');\n }\n }).fail(data => {\n formModal.modal('hide');\n });\n });\n const resetUiButtonState = () => {\n adminEditButton.prop('disabled', true);\n adminDeleteButon.prop('disabled', true);\n };\n bsTable.on('load-success.bs.table', () => {\n resetUiButtonState();\n });\n bsTable.on('load-error.bs.table', (e, status, res) => {\n showFailDialog(res);\n resetUiButtonState();\n });\n bsTable.on('check.bs.table', () => {\n const selections = bsTable.bootstrapTable('getSelections');\n uiButtons(selections);\n });\n bsTable.on('uncheck.bs.table', () => {\n const selections = bsTable.bootstrapTable('getSelections');\n uiButtons(selections);\n });\n bsTable.on('check-all.bs.table', () => {\n const selections = bsTable.bootstrapTable('getSelections');\n uiButtons(selections);\n });\n bsTable.on('uncheck-all.bs.table', () => {\n const selections = bsTable.bootstrapTable('getSelections');\n uiButtons(selections);\n });\n const identifier = bsTable.data('identifier');\n if (!identifier) {\n return;\n }\n const request = (method, url, data) => {\n return fetch(url, {\n method: method.toUpperCase(),\n body: JSON.stringify(data),\n headers: {\n 'Content-Type': 'application/json'\n }\n }).then(response => {\n if (!response.ok) {\n throw new Error('HTTP error ' + response.status);\n }\n return response.json();\n });\n };\n bsTable.on('column-switch.bs.table', () => {\n const visibleColumns = bsTable.bootstrapTable('getVisibleColumns').map(it => {\n return it.field;\n });\n request('POST', `/setting/store-setting/${identifier}`, {\n value: visibleColumns\n }).catch(error => console.error('Error:', error));\n });\n request('GET', `/setting/get-setting/${identifier}`).then(data => {\n const visibleColumns = bsTable.bootstrapTable('getVisibleColumns');\n visibleColumns.forEach(column => {\n bsTable.bootstrapTable('hideColumn', column.field);\n });\n data?.data?.value?.forEach(column => {\n bsTable.bootstrapTable('showColumn', column);\n });\n }).catch(error => console.error('Error:', error));\n});\n\n//# sourceURL=webpack:///./App/assets/js/components/_bsTable.js?");
/***/ }),
diff --git a/src/App/assets/js/components/_bsTable.js b/src/App/assets/js/components/_bsTable.js
index bd20d41..b338894 100644
--- a/src/App/assets/js/components/_bsTable.js
+++ b/src/App/assets/js/components/_bsTable.js
@@ -153,10 +153,13 @@ $( document ).ready(function(){
request('GET', `/setting/get-setting/${identifier}`)
.then(data => {
- bsTable.bootstrapTable('hideAllColumns');
+ const visibleColumns = bsTable.bootstrapTable('getVisibleColumns');
+ visibleColumns.forEach(column => {
+ bsTable.bootstrapTable('hideColumn', column.field);
+ });
data?.data?.value?.forEach(column => {
bsTable.bootstrapTable('showColumn', column);
});
- }).catch(error => console.error('Error:', error));
+ }).catch(error => console.error('Error:', error));
});
\ No newline at end of file