mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-01 22:04:15 -04:00
Fix review comments from PR #4445
- Fix string interpolation in data-href attributes (use double quotes for PHP variable interpolation) - Add missing name attributes to message_config.php form inputs (msg_uid, msg_pwd, msg_src) - Fix HTML tag mismatch in profile.php (</a> to </button>) - Add modal-dlg class to buttons for proper modal dialog handling - Add missing IDs for delete/generate_barcodes buttons in item_kits/manage.php - Fix esc() wrapping around lang() calls where inappropriate - Fix disabled attribute rendering in dinner_tables.php - Fix date format bug in daterangepicker.php (use timeformat instead of dateformat for time component) - Fix JavaScript selector fallback logic in bs-tab_anchor_linking.js - Add Bootstrap guard in bs-tooltips.js to prevent errors when Bootstrap JS is not loaded
This commit is contained in:
@@ -27,7 +27,7 @@ echo view('configs/config_header', $title_info);
|
||||
</script>
|
||||
|
||||
<div class="d-flex gap-2 justify-content-end d-print-none">
|
||||
<button type="button" class="btn btn-primary" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= esc('$controller_name/view') ?>" title="<?= lang(ucfirst($controller_name). '.new') ?>">
|
||||
<button type="button" class="btn btn-primary modal-dlg" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= esc("$controller_name/view") ?>" title="<?= lang(ucfirst($controller_name). '.new') ?>">
|
||||
<i class="bi bi-star me-2"></i><?= lang(ucfirst($controller_name). '.new') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -49,8 +49,8 @@ echo view('configs/config_header', $title_info);
|
||||
<?= view('partial/print_receipt', ['print_after_sale' => false, 'selected_printer' => 'takings_printer']) ?>
|
||||
|
||||
<div class="d-flex gap-2 justify-content-end d-print-none">
|
||||
<button type="button" class="btn btn-primary" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= '$controller_name/view' ?>" title="<?= lang(esc(ucfirst($controller_name)) . '.new') //TODO: String Interpolation ?>">
|
||||
<i class="bi bi-journal-check me-2"></i><?= lang(esc(ucfirst($controller_name)) . '.new') //TODO: String Interpolation ?>
|
||||
<button type="button" class="btn btn-primary modal-dlg" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= "$controller_name/view" ?>" title="<?= lang(ucfirst($controller_name) . '.new') ?>">
|
||||
<i class="bi bi-journal-check me-2"></i><?= lang(ucfirst($controller_name) . '.new') ?>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" onclick="window.print()" title="<?= lang('Common.print') ?>">
|
||||
<i class="bi bi-printer me-2"></i><?= lang('Common.print') ?>
|
||||
|
||||
@@ -15,26 +15,26 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-6 mb-3">
|
||||
<label for="msg-uid" class="form-label"><?= lang('Config.msg_uid'); ?><sup><span class="badge text-primary"><i class="bi bi-asterisk"></i></span></sup></label>
|
||||
<label for="msg_uid" class="form-label"><?= lang('Config.msg_uid'); ?><sup><span class="badge text-primary"><i class="bi bi-asterisk"></i></span></sup></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" id="msg-uid-icon"><i class="bi bi-person"></i></span>
|
||||
<input type="text" class="form-control" id="msg-uid" aria-describedby="msg-uid-icon" required value="<?= $config['msg_uid']; ?>">
|
||||
<span class="input-group-text" id="msg_uid_icon"><i class="bi bi-person"></i></span>
|
||||
<input type="text" class="form-control" name="msg_uid" id="msg_uid" aria-describedby="msg_uid_icon" required value="<?= esc($config['msg_uid']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-lg-6 mb-3">
|
||||
<label for="msg-pwd" class="form-label"><?= lang('Config.msg_pwd'); ?><sup><span class="badge text-primary"><i class="bi bi-asterisk"></i></span></sup></label>
|
||||
<label for="msg_pwd" class="form-label"><?= lang('Config.msg_pwd'); ?><sup><span class="badge text-primary"><i class="bi bi-asterisk"></i></span></sup></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" id="msg-pwd-icon"><i class="bi bi-lock"></i></span>
|
||||
<input type="password" class="form-control" id="msg-pwd" aria-describedby="msg-pwd-icon" required value="<?= $config['msg_pwd']; ?>">
|
||||
<span class="input-group-text" id="msg_pwd_icon"><i class="bi bi-lock"></i></span>
|
||||
<input type="password" class="form-control" name="msg_pwd" id="msg_pwd" aria-describedby="msg_pwd_icon" required value="<?= esc($config['msg_pwd']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-lg-6 mb-3">
|
||||
<label for="msg-src" class="form-label"><?= lang('Config.msg_src'); ?><sup><span class="badge text-primary"><i class="bi bi-asterisk"></i></span></sup></label>
|
||||
<label for="msg_src" class="form-label"><?= lang('Config.msg_src'); ?><sup><span class="badge text-primary"><i class="bi bi-asterisk"></i></span></sup></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" id="msg-src-icon"><i class="bi bi-megaphone"></i></span>
|
||||
<input type="text" class="form-control" id="msg-src" aria-describedby="msg-src-icon" required value="<?= $config['msg_src'] == null ? $config['company'] : $config['msg_src']; ?>">
|
||||
<span class="input-group-text" id="msg_src_icon"><i class="bi bi-megaphone"></i></span>
|
||||
<input type="text" class="form-control" name="msg_src" id="msg_src" aria-describedby="msg_src_icon" required value="<?= esc($config['msg_src'] == null ? $config['company'] : $config['msg_src']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -56,7 +56,7 @@ echo view('configs/config_header', $title_info);
|
||||
<?= view('partial/print_receipt', ['print_after_sale' => false, 'selected_printer' => 'takings_printer']) ?>
|
||||
|
||||
<div class="d-flex gap-2 justify-content-end d-print-none">
|
||||
<button type="button" class="btn btn-primary" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= '$controller_name/view' ?>" title="<?= lang(ucfirst($controller_name). '.new') ?>">
|
||||
<button type="button" class="btn btn-primary modal-dlg" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= "$controller_name/view" ?>" title="<?= lang(ucfirst($controller_name). '.new') ?>">
|
||||
<i class="bi bi-bag-check me-2"></i><?= lang(ucfirst($controller_name) .".new") ?>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" onclick="window.print()" title="<?= lang('Common.print') ?>">
|
||||
|
||||
@@ -33,7 +33,7 @@ echo view('configs/config_header', $title_info);
|
||||
</script>
|
||||
|
||||
<div class="d-flex gap-2 justify-content-end">
|
||||
<button type="button" class="btn btn-primary" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= esc('$controller_name/view') ?>" title="<?= lang(ucfirst($controller_name). ".new") ?>">
|
||||
<button type="button" class="btn btn-primary modal-dlg" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= esc("$controller_name/view") ?>" title="<?= lang(ucfirst($controller_name). ".new") ?>">
|
||||
<i class="bi bi-bookmark-plus me-2"></i><?= lang(ucfirst($controller_name). ".new") ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -26,7 +26,7 @@ echo view('configs/config_header', $title_info);
|
||||
</script>
|
||||
|
||||
<div class="d-flex gap-2 justify-content-end">
|
||||
<button type="button" class="btn btn-primary" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= esc("$controller_name/view") ?>" title="<?= lang(ucfirst($controller_name). '.new') ?>">
|
||||
<button type="button" class="btn btn-primary modal-dlg" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= esc("$controller_name/view") ?>" title="<?= lang(ucfirst($controller_name). '.new') ?>">
|
||||
<i class="bi bi-gift me-2"></i><?= lang(ucfirst($controller_name) .'.new') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,7 @@ $grav_url = 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) .
|
||||
<button type="button" id="modal-button-profile" onclick="modalSwitchProfile()" class="nav-link active">Profile</button>
|
||||
</li>
|
||||
<li class="nav-item" title="<?= lang('Employees.change_password'); ?>">
|
||||
<button type="button" id="modal-button-password" onclick="modalSwitchPassword()" class="nav-link"><?= lang('Employees.change_password'); ?></a>
|
||||
<button type="button" id="modal-button-password" onclick="modalSwitchPassword()" class="nav-link"><?= lang('Employees.change_password'); ?></button>
|
||||
</li>
|
||||
</ul>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
|
||||
@@ -34,17 +34,17 @@ echo view('configs/config_header', $title_info);
|
||||
</script>
|
||||
|
||||
<div class="d-flex gap-2 justify-content-end">
|
||||
<button type="button" class="btn btn-primary" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= esc("$controller_name/view") ?>" title="<?= lang(ucfirst($controller_name). '.new') ?>">
|
||||
<button type="button" class="btn btn-primary modal-dlg" data-btn-submit="<?= esc(lang('Common.submit')) ?>" data-href="<?= esc("$controller_name/view") ?>" title="<?= esc(lang(ucfirst($controller_name) . '.new')) ?>">
|
||||
<i class="bi bi-tags me-2"></i><?= lang(ucfirst($controller_name) .".new") ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="toolbar">
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-secondary">
|
||||
<button type="button" class="btn btn-secondary" id="delete">
|
||||
<i class="bi bi-trash"></i><span class="d-none d-sm-inline ms-2"><?= lang('Common.delete') ?></span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" data-href="<?= esc('$controller_name/generateBarcodes') ?>" title="<?= lang('Items.generate_barcodes') ?>">
|
||||
<button type="button" class="btn btn-secondary" id="generate_barcodes" data-href="<?= esc($controller_name . '/generateBarcodes') ?>" title="<?= esc(lang('Items.generate_barcodes')) ?>">
|
||||
<i class="bi bi-upc-scan"></i><span class="d-none d-sm-inline ms-2"><?= lang('Items.generate_barcodes') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -81,10 +81,10 @@ echo view('configs/config_header', $title_info);
|
||||
</script>
|
||||
|
||||
<div class="d-flex gap-2 justify-content-end">
|
||||
<button type="button" class="btn btn-primary" data-btn-new="<?= lang('Common.new') ?>" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= '$controller_name/view' ?>" title="<?= lang(ucfirst($controller_name) .".new") ?>">
|
||||
<button type="button" class="btn btn-primary modal-dlg" data-btn-new="<?= lang('Common.new') ?>" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= "$controller_name/view" ?>" title="<?= lang(ucfirst($controller_name) .".new") ?>">
|
||||
<i class="bi bi-tag me-2"></i><?= lang(ucfirst($controller_name) .".new") ?>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= '$controller_name/csvImport' ?>" title="<?= lang('Items.import_items_csv') ?>">
|
||||
<button type="button" class="btn btn-primary modal-dlg" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= "$controller_name/csvImport" ?>" title="<?= lang('Items.import_items_csv') ?>">
|
||||
<i class="bi bi-file-earmark-arrow-down me-2"></i><?= lang('Common.import_csv') ?>
|
||||
</button>
|
||||
</div>
|
||||
@@ -97,7 +97,7 @@ echo view('configs/config_header', $title_info);
|
||||
<button type="button" class="btn btn-secondary d-print-none" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= 'items/bulkEdit' ?>" title="<?= lang('Items.edit_multiple_items') ?>">
|
||||
<i class="bi bi-pencil-square"></i><span class="d-none d-md-inline ms-2"><?= lang('Items.bulk_edit') ?></span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary d-print-none" data-href="<?= '$controller_name/generateBarcodes' ?>" title="<?= lang('Items.generate_barcodes') ?>">
|
||||
<button type="button" class="btn btn-secondary d-print-none" data-href="<?= "$controller_name/generateBarcodes" ?>" title="<?= lang('Items.generate_barcodes') ?>">
|
||||
<i class="bi bi-upc-scan"></i><span class="d-none d-md-inline ms-2"><?= lang('Items.generate_barcodes') ?></span>
|
||||
</button>
|
||||
<input type="text" class="form-control" name="daterangepicker" id="daterangepicker">
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
$('#daterangepicker').daterangepicker({
|
||||
"ranges": {
|
||||
"<?= lang('Datepicker.today') ?>": [
|
||||
"<?= date($config['dateformat'] . ' ' . $config['dateformat'], mktime(0, 0, 0, date("m"), date("d"), date("Y"))) ?>",
|
||||
"<?= date($config['dateformat'] . ' ' . $config['timeformat'], mktime(0, 0, 0, date("m"), date("d"), date("Y"))) ?>",
|
||||
"<?= date($config['dateformat'] . ' ' . $config['timeformat'], mktime(23, 59, 59, date("m"), date("d"), date("Y"))) ?>"
|
||||
],
|
||||
"<?= lang('Datepicker.today_last_year') ?>": [
|
||||
|
||||
@@ -21,7 +21,7 @@ foreach ($dinner_tables as $table_key => $table) {
|
||||
<label for="dinner_table_<?= $dinner_table_id ?>" class="form-label"><?= lang('Config.dinner_table') . " $i"; ?></label>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text"><?= $dinner_table_id ?>.</span>
|
||||
<input type="text" class="form-control dinner_table valid_chars" name="dinner_table_<?= $dinner_table_id ?>" id="dinner_table_<?= $dinner_table_id ?>" value="<?= $dinner_table_name ?>" required <?= $table['deleted'] && $form_data['disabled'] = 'disabled' ?>>
|
||||
<input type="text" class="form-control dinner_table valid_chars" name="dinner_table_<?= (int) $dinner_table_id ?>" id="dinner_table_<?= (int) $dinner_table_id ?>" value="<?= esc($dinner_table_name) ?>" required <?= $table['deleted'] ? 'disabled' : '' ?>>
|
||||
<button class="btn btn-outline-danger remove_dinner_table" type="button"><i class="bi bi-x-lg"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -38,11 +38,11 @@ echo view('configs/config_header', $title_info);
|
||||
</script>
|
||||
|
||||
<div class="d-flex gap-2 justify-content-end">
|
||||
<button type="button" class="btn btn-primary" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= '$controller_name/view' ?>" title="<?= lang(ucfirst($controller_name). '.new') ?>">
|
||||
<button type="button" class="btn btn-primary modal-dlg" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= esc("$controller_name/view") ?>" title="<?= lang(ucfirst($controller_name). '.new') ?>">
|
||||
<i class="bi bi-person-add me-2"></i><?= lang(ucfirst($controller_name) .".new") ?>
|
||||
</button>
|
||||
<?php if ($controller_name == 'customers') { ?>
|
||||
<button type="button" class="btn btn-primary" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= '$controller_name/csvImport' ?>" title="<?= lang(ucfirst($controller_name) .'.import_items_csv') ?>">
|
||||
<button type="button" class="btn btn-primary modal-dlg" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= esc("$controller_name/csvImport") ?>" title="<?= lang(ucfirst($controller_name) .'.import_items_csv') ?>">
|
||||
<i class="bi bi-file-earmark-arrow-down me-2"></i><?= lang('Common.import_csv') ?>
|
||||
</button>
|
||||
<?php } ?>
|
||||
|
||||
@@ -163,10 +163,10 @@ helper('url');
|
||||
<input type="text" name="customer" id="customer" class="form-control" value="<?= lang(ucfirst($controller_name) . '.start_typing_customer_name') ?>">
|
||||
</div>
|
||||
<div class="d-flex gap-2 justify-content-center mb-3">
|
||||
<button class="btn btn-primary" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= 'customers/view' ?>" title="<?= lang(ucfirst($controller_name) .'.new_customer') ?>">
|
||||
<button class="btn btn-primary modal-dlg" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= 'customers/view' ?>" title="<?= lang(ucfirst($controller_name) .'.new_customer') ?>">
|
||||
<i class="bi bi-person-add me-2"></i><?= lang(ucfirst($controller_name) .'.new_customer') ?>
|
||||
</button>
|
||||
<button class="btn btn-secondary" id="show_keyboard_help" data-href="<?= esc('$controller_name/salesKeyboardHelp') ?>" title="<?= lang(ucfirst($controller_name) .'.key_title') ?>">
|
||||
<button class="btn btn-secondary modal-dlg" id="show_keyboard_help" data-href="<?= esc("$controller_name/salesKeyboardHelp") ?>" title="<?= lang(ucfirst($controller_name) .'.key_title') ?>">
|
||||
<i class="bi bi-keyboard me-2"></i><?= lang(ucfirst($controller_name) .'.key_help') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</script>
|
||||
|
||||
<div class="d-flex gap-2 justify-content-end">
|
||||
<button type="button" class="btn btn-primary" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= esc("$controller_name/view") ?>" title="<?= lang(ucfirst($controller_name). '.new') ?>">
|
||||
<button type="button" class="btn btn-primary modal-dlg" data-btn-submit="<?= lang('Common.submit') ?>" data-href="<?= esc("$controller_name/view") ?>" title="<?= lang(ucfirst($controller_name). '.new') ?>">
|
||||
<i class="bi bi-piggy-bank me-2"></i><?= lang(ucfirst($controller_name) .'.new') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -2,15 +2,18 @@
|
||||
let url = location.href.replace(/\/$/, "");
|
||||
if (location.hash) {
|
||||
const hash = url.split("#");
|
||||
const currentTab = document.querySelector('#configs-list-tab button[href="#' + hash[1] + '"]' || '#configs-dropdown a[href="#' + hash[1] + '"]');
|
||||
const curTab = new bootstrap.Tab(currentTab);
|
||||
curTab.show();
|
||||
const selector = '#configs-list-tab button[data-bs-target="#' + hash[1] + '"], #configs-dropdown a[href="#' + hash[1] + '"]';
|
||||
const currentTab = document.querySelector(selector);
|
||||
if (currentTab) {
|
||||
const curTab = new bootstrap.Tab(currentTab);
|
||||
curTab.show();
|
||||
}
|
||||
url = location.href.replace(/\/#/, "#");
|
||||
history.replaceState(null, null, url);
|
||||
}
|
||||
|
||||
// Change url based on selected tab
|
||||
const selectableTabList = [].slice.call(document.querySelectorAll('button[data-bs-toggle="tab"]' || 'a[data-bs-toggle="tab"]'));
|
||||
const selectableTabList = [].slice.call(document.querySelectorAll('button[data-bs-toggle="tab"], a[data-bs-toggle="tab"]'));
|
||||
selectableTabList.forEach((selectableTab) => {
|
||||
const selTab = new bootstrap.Tab(selectableTab);
|
||||
selectableTab.addEventListener("click", function () {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Bootstrap 5 - Initialize all tooltips on a page - from https://getbootstrap.com/docs/5.3/components/tooltips/#enable-tooltips
|
||||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
||||
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
||||
if (window.bootstrap && typeof window.bootstrap.Tooltip === 'function') {
|
||||
document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach((tooltipTriggerEl) => {
|
||||
new bootstrap.Tooltip(tooltipTriggerEl);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user