<script type="text/javascript">

function validate_cconsultation(){
	
    if($("#cconsultation_speciality_id").val()==''){
        $("#cconsultation_speciality_id").addClass('error');
        $("#cconsultation_speciality_id").focus();
        $("#msg_cconsultation_speciality_id").html('Please select speciality').show();
        return false;
    }else{
        $("#cconsultation_speciality_id").removeClass('error');
        $("#msg_cconsultation_speciality_id").hide();
    }

    if($("#cconsultation_name").val()==''){
        $("#cconsultation_name").addClass('error');
        $("#cconsultation_name").focus();
        $("#msg_cconsultation_name").html('Please enter name').show();
        return false;
    }else{
        $("#cconsultation_name").removeClass('error');
        $("#msg_cconsultation_name").hide();
    }
    if($("#cconsultation_desc").val()==''){
        $("#cconsultation_desc").addClass('error');
        $("#cconsultation_desc").focus();
        $("#msg_cconsultation_desc").html('Please enter description').show();
        return false;
    }else{
        $("#cconsultation_desc").removeClass('error');
        $("#msg_cconsultation_desc").hide();
    }
    if($("#cconsultation_duration").val()==''){
        $("#cconsultation_duration").addClass('error');
        $("#cconsultation_duration").focus();
        $("#msg_cconsultation_duration").html('Please enter duration').show();
        return false;
    }else{
        $("#cconsultation_duration").removeClass('error');
        $("#msg_cconsultation_duration").hide();
    }
    if($("#cconsultation_price").val()==''){
        $("#cconsultation_price").addClass('error');
        $("#cconsultation_price").focus();
        $("#msg_cconsultation_price").html('Please enter price').show();
        return false;
    }else{
        $("#cconsultation_price").removeClass('error');
        $("#msg_cconsultation_price").hide();
    }
}

</script>


<div class="breadcrumb">
    <h1><?php echo $clinicDetails->clinic_name ?> | Consultantion Type</h1>
    <ul>
        <li><a href="<?php echo SITE_URL.ADMIN_DIR ?>">Dashboard</a></li>
        <li>Add New Consultantion Type</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 Consultantion Type</div>
                <form action="" method="post" onsubmit="return validate_cconsultation();" enctype="multipart/form-data">

                    <?php if(isset($cconsultationDetail->cconsultation_id) && $cconsultationDetail->cconsultation_id!=0) { ?>
                            <input type="hidden" id="cconsultation_id" name="cconsultation_id" value="<?php echo $cconsultationDetail->cconsultation_id ?>" />
                    <?php } ?>

                    <div class="row">

                    	<div class="col-md-6 form-group mb-3">
                            <label for="cconsultation_speciality_id">Speciality <span class="asterisk">*</span></label>
                            <select class="form-control" id="cconsultation_speciality_id" name="cconsultation_speciality_id[]" multiple="multiple">
                                <option value="">Select Speciality</option>
                                <?php if($allspecialities && count($allspecialities) > 0){ 
                                    foreach($allspecialities as $speciality){ ?>
                                    <option value="<?php echo $speciality->speciality_id; ?>" <?php echo (isset($cconsultationDetail) && in_array($speciality->speciality_id, explode(",", $cconsultationDetail->cconsultation_speciality_id)) ) ? "selected='selected'" : ""; ?>><?php echo $speciality->speciality_name; ?></option>
                                <?php } } ?>
                            </select>    
                            <div class="invalid-tooltip" id="msg_cconsultation_speciality_id"></div>
                        </div>

                    	<div class="col-md-6 form-group mb-3">
                        </div>                        

                        <div class="col-md-6 form-group mb-3">
                            <label for="cconsultation_name">Consultantion Type Name <span class="asterisk">*</span></label>
                            <input type="text" class="form-control" id="cconsultation_name" name="cconsultation_name" value="<?php echo $cconsultationDetail->cconsultation_name; ?>" placeholder="Enter Consultantion type name">
                            <div class="invalid-tooltip" id="msg_cconsultation_name"></div>
                        </div>
                        <div class="col-md-6 form-group mb-3">
                            <label for="cconsultation_desc">Description <span class="asterisk">*</span></label>
                            <textarea class="form-control" id="cconsultation_desc" name="cconsultation_desc" placeholder="Description"><?php echo $cconsultationDetail->cconsultation_desc; ?></textarea> 
                            <div class="invalid-tooltip" id="msg_cconsultation_desc"></div>
                        </div>
                        <div class="col-md-6 form-group mb-3">
                            <label for="cconsultation_duration">Duration<span class="asterisk">*</span></label>
                            <input type="text" class="form-control" id="cconsultation_duration" name="cconsultation_duration" value="<?php echo $cconsultationDetail->cconsultation_duration; ?>" placeholder="Enter default duration in minutes">
                            <div class="invalid-tooltip" id="msg_cconsultation_duration"></div>
                        </div>
                         <div class="col-md-6 form-group mb-3">
                            <label for="cconsultation_price">Price<span class="asterisk">*</span></label>
                            <input type="text" class="form-control" id="cconsultation_price" name="cconsultation_price" value="<?php echo $cconsultationDetail->cconsultation_price; ?>" placeholder="Enter price">
                            <div class="invalid-tooltip" id="msg_cconsultation_price"></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="cconsultation_status" name="cconsultation_status" <?php echo ($cconsultationDetail->cconsultation_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>
<script src="./assets/js/jquery.multiselect.js"></script>
<link rel="stylesheet" href="./assets/styles/css/jquery.multiselect.css">
<script type="text/javascript">
    $(document).ready(function() { 
    $('#cconsultation_speciality_id').multiselect({
        columns: 1,
        placeholder: 'Select Speciality',
        search: true,
        selectAll: true
    });
    });
</script>