mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-09-13 22:08:16 -04:00
* refactor: Replace var with let/const in JavaScript files - Replace var with let for variables that are reassigned - Replace var with const for variables that are never reassigned - Modernize manage_tables.js and nominatim.autocomplete.js - Skip third-party libraries (imgpreview.full.jquery.js, clipboard.min.js) Closes #4491 * refactor: Replace var with let/const in inline JavaScript - Fixed CodeRabbit review: changed enable_actions and load_success from const to let in manage_tables.js (they are reassigned in init) - Replaced all var declarations in inline JavaScript in Views with let (for reassigned) or const (for never reassigned) - Modernized 48 additional files with inline JavaScript * refactor: Replace var with let/const in remaining JS files - Modernized gulpfile.js: 3 var declarations replaced - Modernized app/Views/errors/html/debug.js: all var declarations replaced - Used const for never-reassigned, let for reassigned variables * fix: Replace remaining var declarations in Views - Changed var to const in sales/register.php - Changed var to const in configs/receipt_config.php These were missed in the initial pass. * fix: Replace remaining var declarations in gulpfile.js - Converted 12 remaining var declarations to const - All variables are function-scoped and never reassigned - Complete coverage for this file now * fix: Address CodeRabbit review comments - items/manage.php: Remove duplicate let declaration for start_date (partial/daterangepicker already declares it) - header_js.php: Escape CSRF hash in JavaScript context - tax_jurisdictions.php: Fix mismatched selector (remove_tax_jurisdictions -> remove_tax_jurisdiction) * style(views): Replace var with let/const and fix comment casing - Convert var to let in items/manage.php for JS modernization - Capitalize \"Submit\" in validation comments across tax view files Signed-off-by: Travis Garrison <travis@chiraqbookstore.com> --------- Signed-off-by: Travis Garrison <travis@chiraqbookstore.com> Co-authored-by: Ollama <ollama@steganos.dev> Co-authored-by: objecttothis <17935339+objecttothis@users.noreply.github.com> Co-authored-by: Travis Garrison <travis@chiraqbookstore.com>
96 lines
3.1 KiB
PHP
96 lines
3.1 KiB
PHP
<?php
|
|
use Config\OSPOS;
|
|
|
|
$config = config(OSPOS::class)->settings; ?>
|
|
|
|
const pickerconfig = function(config) {
|
|
return $.extend({
|
|
format: "<?= $this->data["format"] ?? dateformat_bootstrap($config['dateformat']) . ' ' . dateformat_bootstrap($config['timeformat'])?>",
|
|
<?php
|
|
$t = $config['timeformat'];
|
|
$m = $t[strlen($t) - 1];
|
|
if (str_contains($config['timeformat'], 'a') || str_contains($config['timeformat'], 'A')) {
|
|
?>
|
|
showMeridian: true,
|
|
<?php } else { ?>
|
|
showMeridian: false,
|
|
<?php } ?>
|
|
minView: 2,
|
|
minuteStep: 1,
|
|
autoclose: true,
|
|
todayBtn: true,
|
|
todayHighlight: true,
|
|
bootcssVer: 3,
|
|
language: "<?= current_language_code() ?>"
|
|
}, <?php echo isset($config) ?>);
|
|
};
|
|
|
|
$.fn.datetimepicker.dates['<?= $config['language'] ?>'] = {
|
|
days: [
|
|
"<?= lang('Calendar.sunday') ?>",
|
|
"<?= lang('Calendar.monday') ?>",
|
|
"<?= lang('Calendar.tuesday') ?>",
|
|
"<?= lang('Calendar.wednesday') ?>",
|
|
"<?= lang('Calendar.thursday') ?>",
|
|
"<?= lang('Calendar.friday') ?>",
|
|
"<?= lang('Calendar.saturday') ?>"
|
|
],
|
|
daysShort: [
|
|
"<?= lang('Calendar.sun') ?>",
|
|
"<?= lang('Calendar.mon') ?>",
|
|
"<?= lang('Calendar.tue') ?>",
|
|
"<?= lang('Calendar.wed') ?>",
|
|
"<?= lang('Calendar.thu') ?>",
|
|
"<?= lang('Calendar.fri') ?>",
|
|
"<?= lang('Calendar.sat') ?>"
|
|
],
|
|
daysMin: [
|
|
"<?= lang('Calendar.su') ?>",
|
|
"<?= lang('Calendar.mo') ?>",
|
|
"<?= lang('Calendar.tu') ?>",
|
|
"<?= lang('Calendar.we') ?>",
|
|
"<?= lang('Calendar.th') ?>",
|
|
"<?= lang('Calendar.fr') ?>",
|
|
"<?= lang('Calendar.sa') ?>"
|
|
],
|
|
months: [
|
|
"<?= lang('Calendar.january') ?>",
|
|
"<?= lang('Calendar.february') ?>",
|
|
"<?= lang('Calendar.march') ?>",
|
|
"<?= lang('Calendar.april') ?>",
|
|
"<?= lang('Calendar.may') ?>",
|
|
"<?= lang('Calendar.june') ?>",
|
|
"<?= lang('Calendar.july') ?>",
|
|
"<?= lang('Calendar.august') ?>",
|
|
"<?= lang('Calendar.september') ?>",
|
|
"<?= lang('Calendar.october') ?>",
|
|
"<?= lang('Calendar.november') ?>",
|
|
"<?= lang('Calendar.december') ?>"
|
|
],
|
|
monthsShort: [
|
|
"<?= lang('Calendar.jan') ?>",
|
|
"<?= lang('Calendar.feb') ?>",
|
|
"<?= lang('Calendar.mar') ?>",
|
|
"<?= lang('Calendar.apr') ?>",
|
|
"<?= lang('Calendar.may') ?>",
|
|
"<?= lang('Calendar.jun') ?>",
|
|
"<?= lang('Calendar.jul') ?>",
|
|
"<?= lang('Calendar.aug') ?>",
|
|
"<?= lang('Calendar.sep') ?>",
|
|
"<?= lang('Calendar.oct') ?>",
|
|
"<?= lang('Calendar.nov') ?>",
|
|
"<?= lang('Calendar.dec') ?>"
|
|
],
|
|
today: "<?= lang('Datepicker.today') ?>",
|
|
<?php if (str_contains($config['timeformat'], 'a')) { ?>
|
|
meridiem: ["am", "pm"],
|
|
<?php } elseif (str_contains($config['timeformat'], 'A')) { ?>
|
|
meridiem: ["AM", "PM"],
|
|
<?php } else { ?>
|
|
meridiem: [],
|
|
<?php } ?>
|
|
weekStart: <?= lang('Datepicker.weekstart') ?>
|
|
};
|
|
|
|
$(".datetime").datetimepicker(pickerconfig());
|