<script type="text/javascript">
function validate_speciality(){
    if($("#speciality_name").val()==''){
        $("#speciality_name").addClass('error');
        $("#speciality_name").focus();
        $("#msg_speciality_name").html('Please enter name').show();
        return false;
    }else{
        $("#speciality_name").removeClass('error');
        $("#msg_speciality_name").hide();
    }
    if($("#speciality_slug").val()==''){
        $("#speciality_slug").addClass('error');
        $("#speciality_slug").focus();
        $("#msg_speciality_slug").html('Please enter Slug').show();
        return false;
    }else{
       $("#speciality_slug").removeClass('error');
       $("#msg_speciality_slug").hide();
    }
}

</script>

<div class="breadcrumb">
    <h1>Speciality</h1>
    <ul>
        <li><a href="<?php echo SITE_URL.ADMIN_DIR ?>">Dashboard</a></li>
        <li>Add New Speciality</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 Speciality</div>
                <form action="" method="post" onsubmit="return validate_speciality();" enctype="multipart/form-data">
                    <?php if(isset($specialityDetail->speciality_id) && $specialityDetail->speciality_id!=0) { ?>
                            <input type="hidden" id="speciality_id" name="speciality_id" value="<?php echo $specialityDetail->speciality_id ?>" />
                    <?php } ?>
                    <div class="row">
                        <div class="col-md-6 form-group mb-3">
                            <label for="speciality_domain_id">Domain <span class="asterisk">*</span></label>
                            <select class="form-control" id="speciality_domain_id" name="speciality_domain_id">
                                <option value="">Select Domain</option>
                                <?php if($allDomain && count($allDomain) > 0){ foreach($allDomain as $domain){ ?>
                                <option value="<?php echo $domain->domain_id; ?>" <?php echo (isset($specialityDetail) && $specialityDetail->speciality_domain_id == $domain->domain_id) ? "selected='selected'" : ""; ?>><?php echo $domain->domain_title; ?></option>
                                <?php } } ?>
                            </select>    
                            <div class="invalid-tooltip" id="msg_speciality_domain_id"></div>
                        </div>
                        <div class="col-md-6 form-group mb-3">
                            <label for="speciality_name">Name <span class="asterisk">*</span></label>
                            <input type="text" class="form-control" id="speciality_name" name="speciality_name" value="<?php echo $specialityDetail->speciality_name; ?>" placeholder="Enter speciality name">
                            <div class="invalid-tooltip" id="msg_speciality_name"></div>
                        </div>
                        <div class="col-md-6 form-group mb-3">
                            <label for="speciality_slug">Slug <span class="asterisk">*</span></label>
                            <input type="text" class="form-control" id="speciality_slug" name="speciality_slug" value="<?php echo $specialityDetail->speciality_slug; ?>" placeholder="Enter speciality code">
                            <div class="invalid-tooltip" id="msg_speciality_slug"></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="speciality_status" name="speciality_status" <?php echo ($specialityDetail->speciality_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>