<script type="text/javascript">
function validate_insurance(){
    if($("#insurance_name").val()==''){
        $("#insurance_name").addClass('error');
        $("#insurance_name").focus();
        $("#msg_insurance_name").html('Please enter name').show();
        return false;
    }else{
        $("#insurance_name").removeClass('error');
        $("#msg_insurance_name").hide();
    }
    
}

</script>

<div class="breadcrumb">
    <h1>Insurance</h1>
    <ul>
        <li><a href="<?php echo SITE_URL.ADMIN_DIR ?>">Dashboard</a></li>
        <li>Add New Insurance</li>
    </ul>
</div>
<div class="separator-breadcrumb border-top"></div>
<div class="row">
    <div class="col-md-12">
        <div class="card mb-4">
            <div class="card-body">
                <div class="card-title mb-3">Add New Insurance</div>
                <form action="" method="post" onsubmit="return validate_insurance();" enctype="multipart/form-data">
                    <?php if(isset($insuranceDetail->insurance_id) && $insuranceDetail->insurance_id!=0) { ?>
                            <input type="hidden" id="insurance_id" name="insurance_id" value="<?php echo $insuranceDetail->insurance_id ?>" />
                    <?php } ?>
                    <div class="row">
                        <div class="col-md-6 form-group mb-3">
                            <label for="insurance_name">Name <span class="asterisk">*</span></label>
                            <input type="text" class="form-control" id="insurance_name" name="insurance_name" value="<?php echo $insuranceDetail->insurance_name; ?>" placeholder="Enter insurance name">
                            <div class="invalid-tooltip" id="msg_insurance_name"></div>
                        </div>
                        <div class="col-md-6 form-group mb-3">
                            <label for="insurance_slug">Slug <span class="asterisk">*</span></label>
                            <textarea rows="8" class="form-control" id="insurance_plan" name="insurance_plan" placeholder="Enter insurance Plan"><?php echo $insuranceDetail->insurance_plan; ?></textarea>
                            <div class="invalid-tooltip" id="msg_insurance_plan"></div>
                        </div>
                        <div class="col-md-12 form-group mb-3">
                            <label class="control-label">Status</label>
                            <div class="controls">
                                <label class="switch switch-primary mr-3">
                                    <input type="checkbox" id="insurance_status" name="insurance_status" <?php echo ($insuranceDetail->insurance_status=='1') ? "checked='checked'" : "" ?>>
                                    <span class="slider"></span>
                                </label>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <button class="btn btn-primary" id="submit" name="submit">Submit</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>