mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-09-15 23:07:45 -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>
182 lines
7.5 KiB
PHP
182 lines
7.5 KiB
PHP
<?php
|
|
/**
|
|
* @var array $config
|
|
*/
|
|
?>
|
|
|
|
<?= form_open('config/saveEmail/', ['id' => 'email_config_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal']) ?>
|
|
<div id="config_wrapper">
|
|
<fieldset id="config_info">
|
|
|
|
<div id="required_fields_message"><?= lang('Common.fields_required_message') ?></div>
|
|
<ul id="email_error_message_box" class="error_message_box"></ul>
|
|
|
|
<div class="form-group form-group-sm">
|
|
<?= form_label(lang('Config.email_protocol'), 'protocol', ['class' => 'control-label col-xs-2']) ?>
|
|
<div class="col-xs-2">
|
|
<?= form_dropdown(
|
|
'protocol',
|
|
[
|
|
'mail' => 'Mail',
|
|
'sendmail' => 'Sendmail',
|
|
'smtp' => 'SMTP'
|
|
],
|
|
$config['protocol'],
|
|
'class="form-control input-sm" id="protocol"'
|
|
) ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-group-sm">
|
|
<?= form_label(lang('Config.email_mailpath'), 'mailpath', ['class' => 'control-label col-xs-2']) ?>
|
|
<div class="col-xs-4">
|
|
<?= form_input([
|
|
'name' => 'mailpath',
|
|
'id' => 'mailpath',
|
|
'class' => 'form-control input-sm',
|
|
'value' => $config['mailpath']
|
|
]) ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-group-sm">
|
|
<?= form_label(lang('Config.email_smtp_host'), 'smtp_host', ['class' => 'control-label col-xs-2']) ?>
|
|
<div class="col-xs-2">
|
|
<?= form_input([
|
|
'name' => 'smtp_host',
|
|
'id' => 'smtp_host',
|
|
'class' => 'form-control input-sm',
|
|
'value' => $config['smtp_host']
|
|
]) ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-group-sm">
|
|
<?= form_label(lang('Config.email_smtp_port'), 'smtp_port', ['class' => 'control-label col-xs-2']) ?>
|
|
<div class="col-xs-2">
|
|
<?= form_input([
|
|
'type' => 'number',
|
|
'name' => 'smtp_port',
|
|
'id' => 'smtp_port',
|
|
'class' => 'form-control input-sm',
|
|
'value' => $config['smtp_port']
|
|
]) ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-group-sm">
|
|
<?= form_label(lang('Config.email_smtp_crypto'), 'smtp_crypto', ['class' => 'control-label col-xs-2']) ?>
|
|
<div class="col-xs-2">
|
|
<?= form_dropdown(
|
|
'smtp_crypto',
|
|
[
|
|
'' => 'None',
|
|
'tls' => 'TLS',
|
|
'ssl' => 'SSL'
|
|
],
|
|
$config['smtp_crypto'],
|
|
'class="form-control input-sm" id="smtp_crypto"'
|
|
) ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-group-sm">
|
|
<?= form_label(lang('Config.email_smtp_timeout'), 'smtp_timeout', ['class' => 'control-label col-xs-2']) ?>
|
|
<div class="col-xs-2">
|
|
<?= form_input([
|
|
'type' => 'number',
|
|
'name' => 'smtp_timeout',
|
|
'id' => 'smtp_timeout',
|
|
'class' => 'form-control input-sm',
|
|
'value' => $config['smtp_timeout']
|
|
]) ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-group-sm">
|
|
<?= form_label(lang('Config.email_smtp_user'), 'smtp_user', ['class' => 'control-label col-xs-2']) ?>
|
|
<div class="col-xs-4">
|
|
<div class="input-group">
|
|
<span class="input-group-addon input-sm">
|
|
<span class="glyphicon glyphicon-user"></span>
|
|
</span>
|
|
<?= form_input([
|
|
'name' => 'smtp_user',
|
|
'id' => 'smtp_user',
|
|
'class' => 'form-control input-sm',
|
|
'value' => $config['smtp_user']
|
|
]) ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-group-sm">
|
|
<?= form_label(lang('Config.email_smtp_pass'), 'smtp_pass', ['class' => 'control-label col-xs-2']) ?>
|
|
<div class="col-xs-4">
|
|
<div class="input-group">
|
|
<span class="input-group-addon input-sm">
|
|
<span class="glyphicon glyphicon-asterisk"></span>
|
|
</span>
|
|
<?= form_password([
|
|
'name' => 'smtp_pass',
|
|
'id' => 'smtp_pass',
|
|
'class' => 'form-control input-sm',
|
|
'value' => $config['smtp_pass']
|
|
]) ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?= form_submit([
|
|
'name' => 'submit_email',
|
|
'id' => 'submit_email',
|
|
'value' => lang('Common.submit'),
|
|
'class' => 'btn btn-primary btn-sm pull-right'
|
|
]) ?>
|
|
|
|
</fieldset>
|
|
</div>
|
|
<?= form_close() ?>
|
|
|
|
<script type="text/javascript">
|
|
// Validation and submit handling
|
|
$(document).ready(function() {
|
|
const check_protocol = function() {
|
|
if ($('#protocol').val() == 'sendmail') {
|
|
$('#mailpath').prop('disabled', false);
|
|
$('#smtp_host, #smtp_user, #smtp_pass, #smtp_port, #smtp_timeout, #smtp_crypto').prop('disabled', true);
|
|
} else if ($('#protocol').val() == 'smtp') {
|
|
$('#smtp_host, #smtp_user, #smtp_pass, #smtp_port, #smtp_timeout, #smtp_crypto').prop('disabled', false);
|
|
$('#mailpath').prop('disabled', true);
|
|
} else {
|
|
$('#mailpath, #smtp_host, #smtp_user, #smtp_pass, #smtp_port, #smtp_timeout, #smtp_crypto').prop('disabled', true);
|
|
}
|
|
};
|
|
|
|
$('#protocol').change(check_protocol).ready(check_protocol);
|
|
|
|
$('#email_config_form').validate($.extend(form_support.handler, {
|
|
submitHandler: function(form) {
|
|
$(form).ajaxSubmit({
|
|
beforeSerialize: function(arr, $form, options) {
|
|
$('#mailpath, #smtp_host, #smtp_user, #smtp_pass, #smtp_port, #smtp_timeout, #smtp_crypto').prop('disabled', false);
|
|
return true;
|
|
},
|
|
success: function(response) {
|
|
$.notify({
|
|
message: response.message
|
|
}, {
|
|
type: response.success ? 'success' : 'danger'
|
|
})
|
|
// Set back disabled state
|
|
check_protocol();
|
|
},
|
|
dataType: 'json'
|
|
});
|
|
},
|
|
|
|
errorLabelContainer: '#email_error_message_box'
|
|
}));
|
|
});
|
|
</script>
|