<section class="container" style="padding-bottom: 2rem;">
	<div class="row">
		<div class="col-sm-12">
			<div class="tab-content" id="tabContent">
				<div class="tab-pane fade show active" id="profile" role="tabpanel" aria-labelledby="profile-tab">
					<div class="card bg-light-transparent">
						<div class="card-header bg-light">
							<h4 class="card-title float-left"><?php echo (empty($ID))?'New ':'Edit '; ?>AV/IT Service Request Form</h4>
							<h6 class="card-title float-left"><i>Instruction: This form was designed for SALIHIN staff that may require AV/IT service request. Please reserve request three (3) business days in advance by completing and submitting this form. All specified equipment is the property of SALIHIN and is setup with the standard software for use. If you should require technical assistance with the equipment, please refer to technical personnel.</h6></i>
						</div>
						<div class="card-body">
							<div class="card no-shadow">
								<div class="card-body">

                                    <?php if (!empty($ID)) { ?>
                                        <form id="itServiceForm" class="form" action="<?php echo base_url('hr/Serviceform/it_service_edit') ?>" method="POST" onsubmit="return confirm('Do you really want to submit the form?')">
                                        <?php }else { ?>
                                            <form id="itServiceForm" class="form" action="<?php echo base_url('hr/Serviceform/it_service_save') ?>" method="POST" onsubmit="return confirm('Do you really want to submit the form?')">
                                            <?php }?>

                                            <input type="text" class="form-control" name="itServiceID" id="itServiceID" value="<?php echo $ID; ?>" hidden>

                                            <div class="form-row">
                                                <div class="col-12 col-sm-6">
                                                    <div class="form-group">
                                                        <label>Name</label>
                                                        <?php if(!empty($row)) { ?>
                                                            <input type="text" class="form-control" name="name" id="name" value="<?php echo $row['requestor']; ?>" readonly>	
                                                            <input type="text" class="form-control" name="name_id" id="name_id" value="<?php echo $row['user_id']; ?>" hidden>
                                                        <?php } else{ ?>
                                                            <input type="text" class="form-control" name="name" id="name" value="<?php echo $_SESSION['user']['name']; ?>" readonly>	
                                                            <input type="text" class="form-control" name="name_id" id="name_id" value="<?php echo $_SESSION['user']['id']; ?>" hidden>
                                                        <?php }?>
                                                    </div>
                                                </div>

                                                <div class="col-12 col-sm-6">
                                                    <div class="form-group">
                                                        <label>Email</label>
                                                        <?php if(!empty($row)) { ?>
                                                            <input type="text" class="form-control" name="email" id="email" value="<?php echo $row['email']; ?>" readonly>
                                                        <?php } else{ ?>
                                                            <input type="text" class="form-control" name="email" id="email" value="<?php echo $_SESSION['user']['email']; ?>" readonly>
                                                        <?php }?>
                                                    </div>
                                                </div>

                                                <div class="col-12 col-sm-6">
                                                   <div class="form-group">
                                                      <label for="department">Department</label>
                                                      <?php if(!empty($row)){ ?>
                                                         <?php //if(!empty($rsServiceList)): foreach($rsServiceList as $row): ?>
                                                         <input type="text" class="form-control" name="department" id="department" value="<?php echo $row['dept_name']; ?>" readonly>
                                                         <input type="text" class="form-control" name="department_id" id="department_id" value="<?php echo $row['department_id']; ?>" hidden>
                                                    <?php //endforeach;endif;
                                                } else{ ?>
                                                    <input type="text" class="form-control" name="department" id="department" value="<?php echo $_SESSION['user']['department_name']; ?>" readonly>
                                                    <input type="text" class="form-control" name="department_id" id="department_id" value="<?php echo $_SESSION['user']['department_id']; ?>" hidden>
                                                <?php } ?>
                                            </div>
                                        </div>

                                        <div class="col-12 col-sm-6">
                                           <div class="form-group">
                                              <label for="datereq">Date Request</label>
                                              <?php if(!empty($ID)){ ?>
                                                 <?php if(!empty($rsServiceList)): foreach($rsServiceList as $row): ?>
                                                    <input type="" class="form-control" name="datereq" id="datereq" value="<?php echo (!empty($ID))?date('d-m-Y',strtotime($row['createdTS'])):''; ?>" readonly>
                                                <?php endforeach;endif; } else { ?>
                                                    <input type="" value="<?php echo date("d-m-Y"); ?>" class="form-control" name="datereq" id="datereq" readonly>
                                                <?php } ?>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="form-row">
                                        <div class="col-12 col-sm-4">
                                           <div class="form-group">
                                              <label for="location">Location</label>
                                              <?php if(!empty($ID)){ ?>
                                                <?php if(!empty($rsServiceList)): foreach($rsServiceList as $row): ?>
                                                    <input type="text" class="form-control" name="location" id="location" value="<?php echo (!empty($ID))?$row['location']:''; ?>">
                                                <?php endforeach;endif; } else { ?>
                                                    <input type="text" class="form-control" name="location" id="location">
                                                <?php } ?>
                                            </div>
                                        </div>

                                        <div class="col-12 col-sm-4">
                                           <div class="form-group">
                                              <label for="req">Request</label>
                                              <?php if(!empty($ID)){ ?>
                                                <?php if(!empty($rsServiceList)): foreach($rsServiceList as $row): ?>
                                                    <input type="text" class="form-control" name="request" id="request" value="<?php echo (!empty($ID))?$row['request']:''; ?>"> 
                                                <?php endforeach;endif; } else { ?>
                                                    <input type="text" class="form-control" name="request" id="request">
                                                <?php } ?>
                                            </div>
                                        </div>

                                        <div class="col-12 col-sm-4">
                                            <div class="form-group">
                                                <label for="hware">Hardware</label>
                                                <select class="form-control" name="hardware" id="hardware">
                                                    <?php if(!empty($ID)){ ?>
                                                        <?php if(!empty($rsServiceList)): foreach($rsServiceList as $row): ?>
                                                            <option value="<?php echo (!empty($ID))?$row['hardware']:''; ?>" selected><?php echo (!empty($ID))?$row['hardware']:'';?></option>
                                                            <option value="PC">PC</option>
                                                            <option value="Notebook">Notebook</option>
                                                            <option value="Projector">Projector</option>
                                                            <option value="PC">TV</option>
                                                            <option value="PA System">PA System</option>
                                                            <option value="Projector Screen">Projector Screen</option>
                                                        <?php endforeach;endif; } else { ?>
                                                            <option value="" disabled selected>--Please Select--</option>
                                                            <option value="PC">PC</option>
                                                            <option value="Notebook">Notebook</option>
                                                            <option value="Projector">Projector</option>
                                                            <option value="PC">TV</option>
                                                            <option value="PA System">PA System</option>
                                                            <option value="Projector Screen">Projector Screen</option>
                                                        <?php }?>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="form-row">
                                            <div class="col-12">
                                                <div class="form-group">
                                                  <label for="prob">Problem</label>
                                                  <?php if(!empty($ID)){ ?>
                                                    <?php if(!empty($rsServiceList)): foreach($rsServiceList as $row): ?>
                                                        <textarea rows="4" cols="50" class="form-control" name="problem" id="problem" value=""><?php echo (!empty($ID))?$row['problem']:''; ?></textarea>
                                                    <?php endforeach;endif; } else { ?>
                                                        <textarea rows="4" cols="50" class="form-control" name="problem" id="problem"></textarea>
                                                    <?php } ?>
                                                </div>
                                            </div>

                                            <div class="col-12">
                                                <div class="form-group">
                                                  <label for="complaint">Complaint</label>
                                                  <?php if(!empty($ID)){ ?>
                                                    <?php if(!empty($rsServiceList)): foreach($rsServiceList as $row): ?>
                                                        <textarea rows="4" cols="50" class="form-control" name="complaint" id="complaint" value=""><?php echo (!empty($ID))?$row['complaint']:''; ?></textarea>
                                                    <?php endforeach;endif; } else { ?>
                                                        <textarea rows="4" cols="50" class="form-control" name="complaint" id="complaint"></textarea>
                                                    <?php } ?>
                                                </div>
                                            </div>
                                        </div>

                                        <?php if($ID && $_SESSION['user']['id'] == $rsServiceList[0]['createdBY']){ ?>   
                                            <div class="form-row">
                                                <div class="col-12" style="padding-top: 2rem;">
                                                    <div class="float-left <?php echo ($ID)?'d-none':''; ?>">
                                                        <table>
                                                            <tbody>
                                                                <tr>
                                                                    <td class="text-center">
                                                                        <label class="switch" data-trigger="hover" data-tooltip="tooltip" title="" data-original-title="Send me a copy of this form">
                                                                            <input type="checkbox" name="send_email_checkbox">
                                                                            <span class="slider round"></span>
                                                                        </label>
                                                                    </td>
                                                                    <td class="p-3 py-1"><b><h6 style="">Send me a copy of this form</h6></b></td>
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                    <div class="float-right">
                                                        <a class="btn btn-light" href="<?php echo base_url('hr/serviceform/it_service_list/'); ?>">Cancel</a>
                                                        <button type="submit" class="btn btn-primary">Submit</button>
                                                    </div> 
                                                </div>
                                            </div>
                                        <?php }else{ ?>
                                            <div class="form-row">
                                                <div class="col-12" style="padding-top: 2rem;">
                                                    <div class="float-left <?php echo ($ID)?'d-none':''; ?>">
                                                        <table>
                                                            <tbody>
                                                                <tr>
                                                                    <td class="text-center">
                                                                        <label class="switch" data-trigger="hover" data-tooltip="tooltip" title="" data-original-title="Send me a copy of this form">
                                                                            <input type="checkbox" name="send_email_checkbox">
                                                                            <span class="slider round"></span>
                                                                        </label>
                                                                    </td>
                                                                    <td class="p-3 py-1"><b><h6 style="">Send me a copy of this form</h6></b></td>
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                    <div class="float-right">
                                                        <a class="btn btn-light" href="<?php echo base_url('hr/serviceform/it_service_list/'); ?>">Cancel</a>
                                                        <button type="submit" class="btn btn-primary">Submit</button>
                                                    </div> 
                                                </div>
                                            </div>
                                        <?php } ?>
                                    </form>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</section>

<?php echo (!empty($approval))?$approval:''; ?>