@extends('layouts.print')
 
@section('content')
<div class="main-content-wrapper">
	<div class="main-box">
		<div class="main-content">
			<div class="container">
				<div class="page">
					<div class="row">
						<div class="report-capital layout-print">
							<div class="header">
								<div class="logo">
									<img src="{{asset('assets/images/logo.png')}}" alt="" width="200px">
								</div>
								<div class="title">
									<h2>អឹមអិល មង្គល រៀលធី ឯ.ក</h2>
									<h2>ML MONGKUL CO., LTD.</h2>
									<h3>Report Wallet</h3>
								</div>
								<div class="clear"></div>
								<div class="border-bottom"></div>
								<div class="table">
									<table>
										<thead>
						                    <tr>
												<th>No</th>
												<th>Requested Date</th>
												<th>Transaction</th>
												<th>Account Name</th>
												<th>Contact Person</th>
												<th width="8%">Amount</th>
												<th>Remark</th>
												<th>Bank Info</th>
												<th>Aproved / Reject Date</th>
												<th>Status</th>
						                    </tr>
										</thead>
										<tbody>
											<?php
												$status = '';
												$bank_info = '';
												$app_rej_dates = '';
                                            	$app_rej_datess = '';
											?>
											@foreach($history as $key => $value)
												<?php

													if($value->bank_account_name == '' || $value->bank_account_name == null){
														$bank_info = 'N/A';
													}else{
														$bank_info = $value->bank_name.' / '.$value->bank_account_name .'('.$value->bank_account_number.')';
													}
													if($value->app_rej_date == '' || $value->app_rej_date == null){
														$app_rej_dates = 'N/A';
													}else{
														$app_rej_dates = $value->app_rej_date;
													}
													if($value->app_rej_date == '' || $value->app_rej_date == null){
														$app_rej_datess = '';
													}else{
														$app_rej_datess = $value->app_rej_date;
													}
													$transation = '';
													if ($value->operation_type == 1) {
														$transation = 'Add Funds';
													} else if ($value->operation_type == 2) {
														$transation = 'Payment';
													} else if ($value->operation_type == 3) {
														$transation = 'Revenue';
													} else if ($value->operation_type == 4) {
														$transation = 'Send Funds';
													} else if ($value->operation_type == 5) {
														$transation = 'Received Funds';
													} else if ($value->operation_type == 6) {
														$transation = 'Withdraw Funds';
													} else if ($value->operation_type == 7) {
														$transation = 'Refund';
													}
													$status = '';
													if ($value->status == 0) {
														$status = '<strong class="text-warning"><span class="fa fa-check"></span> Pedding</strong>';
													} elseif ($value->status == 2) {
														$status = '<strong class="text-danger"><span class="fa fa-check"></span> Reject / ' . $value->app_rej_date . '</strong>';
													} elseif ($value->status == 3) {
														$status = '<strong class="text-info"><span class="fa fa-spinner"></span> Proccessing</strong>';
													} else {
														if ($value->operation_type == 7) {
															$status = '<strong class="text-dank"><span class="fa fa-check"></span> Refund / ' . $value->app_rej_date . '</strong>';
														} else {
															$status = '<strong class="text-success"><span class="fa fa-check"></span> Done​ / ' . $value->app_rej_date . '</strong>';
														}
														if ($value->operation_type == 6) {
															$status = '<strong class="text-success"><span class="fa fa-check"></span> Done​ / ' . $value->done_date . '</strong>';
														} else {
															$status = '<strong class="text-success"><span class="fa fa-check"></span> Done​ / ' . $value->app_rej_date . '</strong>';
														}
													}

												?>
											<tr>
												<td>{{$key+1}}</td>
												<td>{{$value->request_date}}</td>
												<td>{{$transation}}</td>
												<td>{{$value->account_name}} ({{$value->account_number}})</td>
												<td><a href="tel:${val.phone}">{{$value->phone}}</a></td>
												<td>$ {{number_format($value->amount, 2)}}</td>
												<td>{{$value->remark}}</td>
												<td>{{$bank_info}}</td>
												<td>{{$app_rej_dates}}</td>
												<td><?php echo $status?></td>
											</tr>
											@endforeach()

										</tbody>
										<tfoot>
											<tr>
												<th colspan="5">Total</th>
												<th>$ {{number_format($total,2)}}</th>
												<th></th>
												<th></th>
												<th></th>
												<th></th>
											</tr>
										</tfoot>
									</table>
									<div class="make-date">
										<p>ធ្វើនៅ​ <strong>ភ្នំពេញ</strong> ថ្ងៃទី <strong>{{\Globals::date_khmers(date('Y-m-d'))}}</strong></p>
									</div>
									<div class="sign">
										<h3>ហត្ថលេខា</h3>
										<p>_________________</p>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<style>
	.container{
		width: 360mm !important;
		margin-top: 10px;
	}
	@media print {
		html, body {
			width: 390mm !important;
			margin: 0mm 0 0 0 !important;
			background-color:#FFFFFF;
		}

	}
</style>
@endsection


