mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-09-12 21:37:23 -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>
111 lines
3.9 KiB
PHP
111 lines
3.9 KiB
PHP
<?php
|
|
/**
|
|
* @var string $specific_input_name
|
|
* @var array $specific_input_data
|
|
* @var array $sale_type_options
|
|
* @var array $config
|
|
*/
|
|
?>
|
|
|
|
<?= view('partial/header') ?>
|
|
|
|
<script type="text/javascript">
|
|
dialog_support.init("a.modal-dlg");
|
|
</script>
|
|
|
|
<div id="page_title"><?= lang('Reports.report_input') ?></div>
|
|
|
|
<?php
|
|
if (isset($error)) {
|
|
echo '<div class="alert alert-dismissible alert-danger">' . esc($error) . '</div>';
|
|
}
|
|
?>
|
|
|
|
<?= form_open('#', ['id' => 'item_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
|
|
|
|
<div class="form-group form-group-sm">
|
|
<?= form_label(lang('Reports.date_range'), 'report_date_range_label', ['class' => 'control-label col-xs-2 required']) ?>
|
|
<div class="col-xs-3">
|
|
<?= form_input(['name' => 'daterangepicker', 'class' => 'form-control input-sm', 'id' => 'daterangepicker']) ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (isset($discount_type_options)) { ?>
|
|
<div class="form-group form-group-sm">
|
|
<?= form_label(lang('Reports.discount_type'), 'reports_discount_type_label', ['class' => 'required control-label col-xs-2']) ?>
|
|
<div id="report_discount_type" class="col-xs-3">
|
|
<?= form_dropdown('discount_type', $discount_type_options, $config['default_sales_discount_type'], ['id' => 'discount_type_id', 'class' => 'form-control']) ?>
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<div class="form-group form-group-sm" id="report_specific_input_data">
|
|
<?= form_label($specific_input_name, 'specific_input_name_label', ['class' => 'required control-label col-xs-2']) ?>
|
|
<div class="col-xs-3 discount_percent">
|
|
<?= form_dropdown('specific_input_data', $specific_input_data, '', 'id="specific_input_data" class="form-control"') ?>
|
|
</div>
|
|
|
|
<?php if (isset($discount_type_options)) { ?>
|
|
<div class="col-xs-3 discount_fixed">
|
|
<?= form_input([
|
|
'name' => 'discount_fixed',
|
|
'id' => 'discount_fixed',
|
|
'class' => 'form-control input-sm required',
|
|
'type' => 'number',
|
|
'min' => 0,
|
|
'value' => $config['default_sales_discount']
|
|
]) ?>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
|
|
<div class="form-group form-group-sm">
|
|
<?= form_label(lang('Reports.sale_type'), 'reports_sale_type_label', ['class' => 'required control-label col-xs-2']) ?>
|
|
<div id="report_sale_type" class="col-xs-3">
|
|
<?= form_dropdown('sale_type', $sale_type_options, 'complete', 'id="input_type" class="form-control"') ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
echo form_button([
|
|
'name' => 'generate_report',
|
|
'id' => 'generate_report',
|
|
'content' => lang('Common.submit'),
|
|
'class' => 'btn btn-primary btn-sm'
|
|
]) ?>
|
|
|
|
<?= form_close() ?>
|
|
|
|
<?= view('partial/footer') ?>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
<?php if (isset($discount_type_options)) { ?>
|
|
$("#discount_type_id").change(check_discount_type).ready(check_discount_type);
|
|
<?php } ?>
|
|
|
|
<?= view('partial/daterangepicker') ?>
|
|
|
|
$("#generate_report").click(function() {
|
|
let specific_input_data = $('#specific_input_data').val();
|
|
if (!$(".discount_percent").is(":visible")) {
|
|
specific_input_data = $('#discount_fixed').val();
|
|
}
|
|
|
|
window.location = [window.location, start_date, end_date, specific_input_data, $("#input_type").val() || 0, $("#discount_type_id").val() || 0].join("/");
|
|
});
|
|
});
|
|
|
|
function check_discount_type() {
|
|
const discount_type = $("#discount_type_id").val();
|
|
|
|
if (discount_type == 1) {
|
|
$(".discount_percent").hide();
|
|
$(".discount_fixed").show();
|
|
} else {
|
|
$(".discount_percent").show();
|
|
$(".discount_fixed").hide();
|
|
}
|
|
}
|
|
</script>
|