<header>
	<div class="row">
		<div class="col-12">
			<div class="t-corp pull-left">
				<div class="t-corp-logo">
					<img src="<?php echo base_url().'assets/images/logo/salihin-logo.png'; ?>" alt="company logo" />
				</div>
				<div class="t-corp-name"><b>SPS</b> | HR SYSTEM</div>
			</div>
			<div class="report-title pull-right" style="padding-top: 30px;">
				<h5><?php echo (isset($title) ? $title : 'Report'); ?>
					<?php //if(!empty($data_complaint[0]->complaint_for)){ 
						echo ($data_complaint[0]->complaint_for == 1)? '[Ref No : '.str_pad($data_complaint[0]->ref_no, 4,'0', STR_PAD_LEFT).' - Internal Complaint]':'[Ref No : '.str_pad($data_complaint[0]->ref_no, 4,'0', STR_PAD_LEFT).' - External Complaint]';
					//} ?>
				</h5>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-12">
			<table class="company">
				<tr>
					<td class="divider">
						<span class="line">&nbsp;</span>
					</td>
					<td class="details">
						<span><b>SALIHIN (AF 1426)</b></span>
						<span>555, Jalan Samudra Utara 1, Taman Samudra, Batu Caves,</span>
						<span>68100, Batu Caves, Selangor</span>
						<span>Phone: 03-6185 9970 &nbsp;&nbsp; Fax: 03-6185 9970</span>
						<span>Website: salihin.com.my</span>
					</td>
					<td class="divider">
						<span class="line">&nbsp;</span>
					</td>
				</tr>
			</table>
		</div>
	</div>
</header>

<div class="container">
	<div class="col-12" style="margin-top:2rem;">
		<div class="row">
			<div class="col">
				<h3><b>Client Information</b></h3>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<p style="border-top: 3px solid; width: 33rem;"></p><br>
			</div>
		</div>
		<div class="row">
			<div class="col d-flex" style="padding-left: 5rem;">
				<div class="align-self-end w-100">
					<div class="row">
						<div class="col-4">
							<b>Department | Branch</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->department_name))? $data_complaint[0]->department_name.' | '.$data_complaint[0]->branch_name :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Services</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->service))? $data_complaint[0]->service :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Type of Job</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->job))? $data_complaint[0]->job :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Client Name</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->client_name))? $data_complaint[0]->client_name :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Client Address</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->client_address))? $data_complaint[0]->client_address :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Contact Name</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->contact_name))? $data_complaint[0]->contact_name :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Phone No.</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->phone_no))? $data_complaint[0]->phone_no :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Email</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->email))? $data_complaint[0]->email :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Business Impact</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->business_impact))? $data_complaint[0]->business_impact :'N/A'; ?>
							</p>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<div class="col-12" style="margin-top:2rem">
		<div class="row">
			<div class="col">
				<h3><b>Complaint Information</b></h3>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<p style="border-top: 3px solid; width: 33rem;"></p><br>
			</div>
		</div>
		<div class="row">
			<div class="col d-flex" style="padding-left: 5rem;">
				<div class="align-self-end w-100">
					<div class="row">
						<div class="col-4">
							<b>Registered by</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->reg_name))? $data_complaint[0]->reg_name :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Addressee of the Complaint</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php if(!empty($data_complaint[0]->addressee_id)){ 
									if($data_complaint[0]->addressee_id == 1){
										echo "CRM";
									}else if($data_complaint[0]->addressee_id == 2){
										echo "Person In Charge";
									}else if($data_complaint[0]->addressee_id == 3){
										echo "Department";
									}else if($data_complaint[0]->addressee_id == 4){
										echo "Management";
									}else{
										echo "N/A";
									}
								}else{ echo "N/A"; }  ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Complaint Date / Date of Problem Occurrence</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->date))? date('d-m-Y',strtotime($data_complaint[0]->date)) :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Complaint Type</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php //if(!empty($data_complaint[0]->complaint_type)){ 
									if($data_complaint[0]->complaint_type == 0){
										echo "Initial Complaint";
									}else{
										echo "Follow-up Complaint";
									}
								//}else{ echo "N/A"; } ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Method of Complaint</b>
						</div>
						<div class="col">
							<?php if($data_method){ foreach($data_method as $key => $value) { ?>
								<div class="form-check form-check-inline">
									<input class="form-check-input" type="checkbox" name="complaint_method" id="complaint_method" value="<?php echo $value['id']; ?>" 
									<?php if($data_complaint_method){
										foreach ($data_complaint_method as $key => $row) {
											if($row['method_id'] == $value['id']){
												echo 'checked';
											}
										}
									}?> disabled>
									<?php echo $value['method']; ?>
									<?php if($value['id'] == 7){
										if(!empty($row['others_details'])){
											echo ': '.$row['others_details'];
										}
									}?>
								</div>
							<?php }}?>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Complaint About</b>
						</div>
						<div class="col">
							<?php if($data_about){ foreach($data_about as $key => $value) { ?>
								<div class="form-check form-check-inline" >
									<input class="form-check-input" type="checkbox" name="complaint_about" id="complaint_about" value="<?php echo $value['id']; ?>" 
									<?php if($data_complaint_about){ //debug($data_complaint_about);
										foreach ($data_complaint_about as $key => $row) {
											if($row['about_id'] == $value['id']){
												echo 'checked';
											}
										}
									}?> disabled>
									<?php echo $value['about']; ?>
									<?php if($value['id'] == 8){
										if(!empty($row['others_details'])){
											echo ': '.$row['others_details'];
										}
									}?>
								</div>
							<?php }}?>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Case / Complaint Details</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->complaint_details))? $data_complaint[0]->complaint_details :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Case Resolution Desired by Client</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->reso_desired))? $data_complaint[0]->reso_desired :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Reaction Urgency</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php //if(!empty($data_complaint[0]->urgency)){ 
									if($data_complaint[0]->urgency == 0){
										echo "No";
									}else{
										echo "Yes";
									}
								//}else{ echo "N/A"; } ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Person In Charge</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->pic_name))? $data_complaint[0]->pic_name :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Remarks</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->remarks))? $data_complaint[0]->remarks :'N/A'; ?>
							</p>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<div class="col-12" style="margin-top:2rem">
		<div class="row">
			<div class="col">
				<h3><b>Complaint Resolution</b></h3>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<p style="border-top: 3px solid; width: 33rem;"></p><br>
			</div>
		</div>
		<div class="row">
			<div class="col d-flex" style="padding-left: 5rem;">
				<div class="align-self-end w-100">
					<div class="row">
						<div class="col-4">
							<b>Actual Resolution of the Problem</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->actual_reso))? $data_complaint[0]->actual_reso :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Promise/Commitment Made to the Client</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->promise_made))? $data_complaint[0]->promise_made :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Time Promises</b>
						</div>
						<div class="col">
							<div class="form-check form-check-inline">
								<input class="form-check-input" type="checkbox" name="complaint_time_promise" id="complaint_time_promise" value="1"
									<?php if($data_complaint_time){
										foreach ($data_complaint_time as $key => $row) {
											if($row['time_id'] == 1){
												echo 'checked';
											}
										}
									}?> 
								disabled > Immediately Resolved
							</div>
							<div class="form-check form-check-inline">
								<input class="form-check-input" type="checkbox" name="complaint_time_promise" id="complaint_time_promise" value="2" onchange="openDate()"
									<?php if($data_complaint_time){
										foreach ($data_complaint_time as $key => $row) {
											if($row['time_id'] == 2){
												echo 'checked';
											}
										}
									}?>
								disabled > Resolved Based on Agreed Date : <?php if((!empty($row['date_promise'])) && $row['date_promise'] != '0000-00-00'){ echo date('d-m-Y',strtotime($row['date_promise'])); }else{ echo '';} ?>
							</div>
							<div class="form-check form-check-inline">
								<input class="form-check-input" type="checkbox" name="complaint_time_promise" id="complaint_time_promise" value="3" onchange="openThrough()"
									<?php if($data_complaint_time){
										foreach ($data_complaint_time as $key => $row) {
											if($row['time_id'] == 3){
												echo 'checked';
											}
										}
									}?>
								disabled > Intermediate reply through : <?php echo (!empty($row['others_details']))? $row['others_details'] : ''; ?>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Open Investigation Report?</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php //if(!empty($data_complaint[0]->investigate_report)){ 
									if($data_complaint[0]->investigate_report == 0){
										echo "No";
									}else{
										echo "Yes";
									}
								//}else{ echo "N/A"; } ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Action Taken?</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php //if(!empty($data_complaint[0]->status)){ 
									if($data_complaint[0]->status >= 2){
										echo "Yes";
										if($data_complaint[0]->status == 2){
											echo " <b>(Status : Solved by PIC)</b>";
										}else if($data_complaint[0]->status == 3){
											echo " <b>(Status : Verified by HOD)</b>";
										}else if($data_complaint[0]->status == 4){
											echo " <b>(Status : Approved by CRM)</b>";
										}
									}else{
										echo "No";
									}
								//}else{ echo "N/A"; } ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Action Taken by</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->pic_name))? $data_complaint[0]->pic_name :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Action Taken Date</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->date_solved))? date('d-m-Y',strtotime($data_complaint[0]->date_solved)) :'N/A'; ?>
							</p>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<div class="col-12" style="margin-top:2rem">
		<div class="row">
			<div class="col">
				<h3><b>Complaint Investigation Report</b></h3>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<p style="border-top: 3px solid; width: 33rem;"></p><br>
			</div>
		</div>
		<div class="row">
			<div class="col d-flex" style="padding-left: 5rem;">
				<div class="align-self-end w-100">
					<div class="row">
						<div class="col-4">
							<b>Root Causes</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->root_cause))? $data_complaint[0]->root_cause :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Action Taken</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->action_taken))? $data_complaint[0]->action_taken :'N/A'; ?>
							</p>
						</div>
					</div>
					<div class="row">
						<div class="col-4">
							<b>Recommendation to Prevent Recurrence</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($data_complaint[0]->prevent_recurrence))? $data_complaint[0]->prevent_recurrence :'N/A'; ?>
							</p>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>






