<script type="text/javascript">

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

    if($("#service_name").val()==''){
        $("#service_name").addClass('error');
        $("#service_name").focus();
        $("#msg_service_name").html('Please enter first name').show();
        return false;
    }else{
        $("#service_name").removeClass('error');
        $("#msg_service_name").hide();
    }
}

</script>


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

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

                    <div class="row">

                    	<div class="col-md-6 form-group mb-3">
                            <label for="service_speciality_id">Speciality <span class="asterisk">*</span></label>
                            <select class="form-control" id="service_speciality_id" name="service_speciality_id">
                                <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($serviceDetail) && $serviceDetail->service_speciality_id == $speciality->speciality_id) ? "selected='selected'" : ""; ?>><?php echo $speciality->speciality_name; ?></option>
                                <?php } } ?>
                            </select>    
                            <div class="invalid-tooltip" id="msg_service_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="service_name">Service Name <span class="asterisk">*</span></label>
                            <input type="text" class="form-control" id="service_name" name="service_name" value="<?php echo $serviceDetail->service_name; ?>" placeholder="Enter service name">
                            <div class="invalid-tooltip" id="msg_service_name"></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="service_status" name="service_status" <?php echo ($serviceDetail->service_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>