<div class="row justify-content-center">
<div class="col-12">
<div class="card-box">

    <div class="card-box-header">
        <h5>
            <i class="fa-solid fa-ruler text-success"></i>
            <?php if(!empty($unitdata)) echo 'Edit Unit'; else echo 'Add New Unit'; ?>
        </h5>
        <a href="<?php echo site_url('unit'); ?>" class="btn btn-sm" style="background:#f1f5f9;color:#374151;">
            <i class="fa-solid fa-arrow-left me-1"></i> Back
        </a>
    </div>

    <form method="post" id="Form">

        <input type="hidden" name="id" id="id" value="<?php if(!empty($unitdata)) echo $unitdata[0]->id; ?>">

        <div class="row">
            <div class="col-md-4 mb-3">
                <label class="form-label">Unit Name <span class="required-star">*</span></label>
                <div class="input-group">
                    <input type="text" name="unit_name" id="unit_name" class="form-control"
                           value="<?php if(!empty($unitdata)) echo $unitdata[0]->unit_name; ?>"
                            autofocus>
                </div>
            </div>

            <div class="col-md-2 mb-4">
                <label class="form-label">Status</label>
                <select name="status" id="status" class="form-select select2 select2-no-search">
                    <!--<option value="">-- Select Status --</option>-->
                    <option value="1" <?php if(!empty($unitdata) && $unitdata[0]->status == 1) echo 'selected'; ?>>Active</option>
                    <option value="0" <?php if(!empty($unitdata) && $unitdata[0]->status == 0) echo 'selected'; ?>>Inactive</option>
                </select>
            </div>
        </div>

        <div class="d-flex gap-2">
            <button type="button" id="btn_savee" class="btn btn-primary">
                <i class="fa-solid fa-floppy-disk me-1"></i> Save
            </button>
            <a href="<?php echo site_url('unit'); ?>" class="btn" style="background:#f1f5f9;color:#374151;">Cancel</a>
        </div>

    </form>
</div>
</div>
</div>