<?php
include_once "global.php";

$pageTitle = "Staff Salary - ";
include_once 'header.php';
?>

<!--breadcrumb-->
<div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
    <div class="breadcrumb-title pe-3">Staff Management</div>
    <div class="ps-3">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb mb-0 p-0">
                <li class="breadcrumb-item"><a href="javascript:;"></a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">Staff Salary</li>
            </ol>
        </nav>
    </div>
</div>
<!--end breadcrumb-->
<div class="card">
    <div class="card-body p-4">
        <h5 class="mb-4">Salary Slip</h5>
        <form id="staffSalaryForm" class="row g-3" method="post">
            <div class="col-md-6">
                <label for="userId" class="form-label">Employee Name <span>*</span></label>
                <select id="userId" name="userId" class="form-select getStaffSalary" required>
                    <option value="" disabled selected>Select...</option>
                    <?php
                    $users = $productClass->getStaffArray();
                    foreach ($users as $user) {
                        $userId = $functions->encode($user["acc_id"]);
                        $name = $user["acc_name"];
                        echo "<option value='$userId'>$name</option>";
                    }
                    ?>
                </select>
            </div>
            <div class="col-md-6">
                <label for="month" class="form-label">Pay Month <span>*</span></label>
                <input type="month" class="form-control" id="month" name="month" required>
            </div>
            <div class="col-md-6">
                <label for="salary" class="form-label">Salary <span>*</span></label>
                <input type="number" class="form-control" id="salary" name="salary" required>
            </div>
            <div class="col-md-6">
                <label for="incentive" class="form-label">Incentive Pay <span>*</span></label>
                <input type="number" class="form-control" id="incentive" name="incentive" value="0" required>
            </div>
            <div class="col-md-6">
                <label for="bonus" class="form-label">Bonus <span>*</span></label>
                <input type="number" class="form-control" id="bonus" name="bonus" value="0" required>
            </div>
            <div class="col-md-6">
                <label for="increment" class="form-label">Other Increment <span>*</span></label>
                <input type="number" class="form-control" id="increment" name="increment" value="0" required>
            </div>
            <div class="col-md-6">
                <label for="loan" class="form-label">Loan <span>*</span></label>
                <input type="number" class="form-control" id="loan" name="loan" value="0" required>
            </div>
            <div class="col-md-6">
                <label for="deduction" class="form-label">Other Deductions <span>*</span></label>
                <input type="number" class="form-control" id="deduction" name="deduction" value="0" required>
            </div>
            <div class="col-md-6">
                <label for="curdate" class="form-label">Current Date <span>*</span></label>
                <input type="date" class="form-control" id="curdate" name="curdate" value="<?php echo date('Y-m-d'); ?>"
                    required>
            </div>
            <div class="col-md-12">
                <label for="note" class="form-label">Note</label>
                <textarea class="form-control" id="note" name="note"
                    rows="3">Applied Deducted Any Case Of Late Or Absents</textarea>
            </div>
            <div class="col-md-12">
                <div class="d-md-flex d-grid align-items-center gap-3">
                    <button type="submit" name="action" value="generate" class="btn btn-grd-primary px-4">Generate
                        Slip</button>
                    <button type="submit" name="action" value="print" class="btn btn-grd-royal px-4">Print Slip</button>
                </div>
            </div>
        </form>
    </div>
</div>

<?php
include_once 'footer.php';
?>