implement JS password scoring, td_stock approve logicc
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
session_start();
|
||||
require '../config.php';
|
||||
require '../include_header.php';
|
||||
?>
|
||||
|
||||
<body>
|
||||
<?php require '../include_topbar.php'; ?>
|
||||
<?php require '../include_setting_sidebar.php'; ?>
|
||||
|
||||
<main id="content" class="content py-15">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- Page header -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex flex-column flex-md-row justify-content-between align-items-md-center mb-6 gap-3">
|
||||
<div>
|
||||
<h1 class="fs-3 mb-1">System Configuration</h1>
|
||||
<p class="mb-0">Per-company settings that control application behaviour</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stock Settings -->
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-7">
|
||||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-header bg-transparent border-bottom">
|
||||
<h6 class="mb-0"><i class="ti ti-package me-2"></i>Stock Settings</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-semibold">Default Stock Status</label>
|
||||
<p class="text-muted small mb-2">
|
||||
Controls whether new stock-in, stock-out, and transfer records are saved
|
||||
as <strong>Draft</strong> (requires manual approval) or
|
||||
<strong>Auto-approved</strong> (approved immediately on save).
|
||||
Only approved records appear in reports and balance calculations.
|
||||
</p>
|
||||
<div class="d-flex flex-column gap-2" id="default_stock_status_group">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="default_stock_status"
|
||||
id="status_auto" value="1">
|
||||
<label class="form-check-label" for="status_auto">
|
||||
<span class="fw-semibold">Auto-approve</span>
|
||||
<span class="text-muted ms-1 small">— records are approved immediately on save</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="default_stock_status"
|
||||
id="status_draft" value="0">
|
||||
<label class="form-check-label" for="status_draft">
|
||||
<span class="fw-semibold">Draft</span>
|
||||
<span class="text-muted ms-1 small">— records must be manually approved before affecting reports</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary" onclick="save_config();">
|
||||
<i class="ti ti-device-floppy me-1"></i>Save
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php require '../include_ending.php'; ?>
|
||||
|
||||
<script>
|
||||
|
||||
// ── Load ──────────────────────────────────────────────────────────────────
|
||||
$(function() {
|
||||
ajax_request({
|
||||
url: server_url + 'setting/api/engine/company_setting.php',
|
||||
autoPrepare: true,
|
||||
checkRequired: 0,
|
||||
action: 'read',
|
||||
onSuccess: function(res) {
|
||||
var val = res.output.default_stock_status ?? 1;
|
||||
$('input[name="default_stock_status"][value="' + val + '"]').prop('checked', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ── Save ──────────────────────────────────────────────────────────────────
|
||||
function save_config() {
|
||||
var status = $('input[name="default_stock_status"]:checked').val();
|
||||
|
||||
if (status === undefined) {
|
||||
bootbox.alert('Please select a default stock status.');
|
||||
return;
|
||||
}
|
||||
|
||||
ajax_request({
|
||||
url: server_url + 'setting/api/engine/company_setting.php',
|
||||
autoPrepare: true,
|
||||
checkRequired: 0,
|
||||
action: 'update',
|
||||
data: {
|
||||
default_stock_status: status,
|
||||
},
|
||||
onSuccess: function(res) {
|
||||
bootbox.alert('Settings saved.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user