accounting modules
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
session_start();
|
||||
require '../config.php';
|
||||
require '../include_header.php';
|
||||
?>
|
||||
|
||||
<body>
|
||||
<?php require '../include_topbar.php'; ?>
|
||||
<?php require '../include_master_sidebar.php'; ?>
|
||||
|
||||
<main id="content" class="content py-15">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex align-items-center mb-5 gap-3">
|
||||
<a href="<?php echo $server_url?>accounting/departments.php" class="btn btn-light btn-sm">
|
||||
<i class="ti ti-arrow-left me-1"></i>Back
|
||||
</a>
|
||||
<h1 class="fs-3 mb-0">Manage Department</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" id="deptForm">
|
||||
<div class="col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-body p-6">
|
||||
|
||||
<input type="hidden" id="id">
|
||||
|
||||
<div class="row g-4">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Department Code <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="dept_code" placeholder="e.g. HQ" required>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<label class="form-label">Department Name <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="dept_name" placeholder="e.g. Head Office" required>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label">Description</label>
|
||||
<textarea class="form-control" id="description" rows="3" placeholder="Optional description"></textarea>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Status</label>
|
||||
<select class="form-select" id="status">
|
||||
<option value="1">Active</option>
|
||||
<option value="0">Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-2 mt-5">
|
||||
<button class="btn btn-primary" onclick="manage_department();" id="btn_submit">Create Department</button>
|
||||
<button class="btn btn-secondary" onclick="reset_input('#deptForm');" id="btn_reset">Clear</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php require '../include_ending.php'; ?>
|
||||
|
||||
<script>
|
||||
function manage_department() {
|
||||
return ajax_request({
|
||||
url: '<?php echo $server_url?>accounting/api/engine/manage_department.php',
|
||||
autoPrepare: true,
|
||||
checkRequired: 1,
|
||||
action: 'manage',
|
||||
onSuccess: function() {
|
||||
window.location.href = '<?php echo $server_url?>accounting/departments.php';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function retrieve_for_edit() {
|
||||
<?php if (empty($_GET['id'])): ?>
|
||||
return false;
|
||||
<?php endif; ?>
|
||||
|
||||
return ajax_request({
|
||||
url: '<?php echo $server_url?>accounting/api/engine/retrieve_department.php',
|
||||
autoPrepare: true,
|
||||
checkRequired: 0,
|
||||
action: 'read',
|
||||
data: { id: <?php echo (int)$_GET['id']; ?> },
|
||||
onSuccess: function(res) {
|
||||
var item = res.output;
|
||||
$('#id').val(item.id);
|
||||
$('#dept_code').val(item.dept_code);
|
||||
$('#dept_name').val(item.dept_name);
|
||||
$('#description').val(item.description);
|
||||
$('#status').val(item.status);
|
||||
$('#btn_submit').text('Update Department');
|
||||
$('#btn_reset').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(async function() {
|
||||
try { await retrieve_for_edit(); } catch(e) { console.log(e); }
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user