<?php
/***
 * Auth: Vastvikta Nishad
 * Date:  19 Feb 2024
 * Description: To Update and Insert Disposition
 * 
*/
$msg = '';
$id = isset($_GET['id']) ? base64_decode($_GET['id']) : '';

// Fetch data based on the ID
$res = getDispositionID($id);
$disposition = $res['V_DISPO'] ?? ''; 

?>
<div id="success"><?php echo $msg; ?></div>
<form id="mastersrcat" method="post" action="">
    <input type="hidden" name="id" id="id" value="<?php echo $id; ?>" />
    <span class="breadcrumb_head" style="height:37px;padding:9px 16px">
        <?php echo (!empty($id) ? "Edit" : "New"); ?> Disposition
    </span>
    <div class="style2-table">
        <div class="table">
            <table class="tableview tableview-2 main-form">
                <tbody>
                    <?php if ($msg != '') { ?>
                        <tr>
                            <td colspan="2" style="color:#ffffff; width:100%; background:#00CC66; padding:5px; border:1px solid #02944b; text-align:center;">
                                <?php echo $msg ?>
                            </td>
                        </tr>
                    <?php } ?>
                    <tr>
                        <td colspan="2" class="left">
                            <label>Disposition<em>*</em></label>
                            <div class="log-case">
                                <input name="disposition" id="disposition" type="text" value="<?= $disposition ?>" class="input-style1" />
                            </div>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <center>
                                <?php if ($id != '') { ?>
                                    <input name="Update" type="submit" value="Update" class="button-orange1"  id="submitclkdisposition" style="float: inherit;" />
                                <?php } else { ?>
                                    <input name="Submit" type="submit" value="Create" class="button-orange1"  id="submitclkdisposition" style="float: inherit;" />
                                <?php } ?>
                            </center>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</form>
