mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-09-22 10:45:03 -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>
103 lines
3.8 KiB
PHP
103 lines
3.8 KiB
PHP
<?php
|
|
/**
|
|
* @var string $title
|
|
* @var string $subtitle
|
|
* @var array $overall_summary_data
|
|
* @var array $details_data
|
|
* @var array $headers
|
|
* @var array $summary_data
|
|
* @var array $config
|
|
*/
|
|
?>
|
|
|
|
<?= view('partial/header') ?>
|
|
|
|
<div id="page_title"><?= esc($title) ?></div>
|
|
|
|
<div id="page_subtitle"><?= esc($subtitle) ?></div>
|
|
|
|
<div id="toolbar">
|
|
<div class="pull-left form-inline" role="toolbar">
|
|
<!-- Toggle Button -->
|
|
<button id="toggleCostProfitButton" class="btn btn-default btn-sm print_hide">
|
|
<?php echo lang('Reports.toggle_cost_and_profit'); ?>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="table_holder">
|
|
<table id="table"></table>
|
|
</div>
|
|
|
|
<div id="report_summary">
|
|
<?php foreach ($overall_summary_data as $name => $value) { ?>
|
|
<div class="summary_row"><?= lang("Reports.$name") . ': ' . esc(to_currency($value)) ?></div>
|
|
<?php } ?>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function () {
|
|
<?= view('partial/bootstrap_tables_locale') ?>
|
|
|
|
const details_data = <?= json_encode(esc($details_data)) ?>;
|
|
<?php if ($config['customer_reward_enable'] && !empty($details_data_rewards)) { ?>
|
|
const details_data_rewards = <?= json_encode(esc($details_data_rewards)) ?>;
|
|
<?php } ?>
|
|
<?= view('partial/visibility_js') ?>
|
|
|
|
const init_dialog = function () {
|
|
<?php if (isset($editable)) { ?>
|
|
table_support.submit_handler('<?= esc(site_url("reports/get_detailed_$editable" . '_row')) ?>');
|
|
dialog_support.init("a.modal-dlg");
|
|
<?php } ?>
|
|
};
|
|
|
|
$('#table')
|
|
.addClass("table-striped")
|
|
.addClass("table-bordered")
|
|
.bootstrapTable({
|
|
columns: applyColumnVisibility(<?= transform_headers(esc($headers['summary']), true) ?>),
|
|
stickyHeader: true,
|
|
stickyHeaderOffsetLeft: $('#table').offset().left + 'px',
|
|
stickyHeaderOffsetRight: $('#table').offset().right + 'px',
|
|
pageSize: <?= $config['lines_per_page'] ?>,
|
|
pagination: true,
|
|
sortable: true,
|
|
showColumns: true,
|
|
uniqueId: 'id',
|
|
showExport: true,
|
|
exportDataType: 'all',
|
|
exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'xlsx', 'pdf'],
|
|
data: <?= json_encode($summary_data) ?>,
|
|
iconSize: 'sm',
|
|
paginationVAlign: 'bottom',
|
|
detailView: true,
|
|
escape: true,
|
|
search: true,
|
|
onPageChange: init_dialog,
|
|
onPostBody: function () {
|
|
dialog_support.init("a.modal-dlg");
|
|
},
|
|
onExpandRow: function (index, row, $detail) {
|
|
$detail.html('<table></table>').find("table").bootstrapTable({
|
|
columns: <?= transform_headers_readonly(esc($headers['details'])) ?>,
|
|
data: details_data[(!isNaN(row.id) && row.id) || $(row[0] || row.id).text().replace(
|
|
/(POS|RECV)\s*/g, '')]
|
|
});
|
|
|
|
<?php if ($config['customer_reward_enable'] && !empty($details_data_rewards)) { ?>
|
|
$detail.append('<table></table>').find("table").bootstrapTable({
|
|
columns: <?= transform_headers_readonly(esc($headers['details_rewards'])) ?>,
|
|
data: details_data_rewards[(!isNaN(row.id) && row.id) || $(row[0] || row.id).text().replace(
|
|
/(POS|RECV)\s*/g, '')]
|
|
});
|
|
<?php } ?>
|
|
}
|
|
});
|
|
|
|
init_dialog();
|
|
});
|
|
</script>
|
|
|
|
<?= view('partial/footer') ?>
|