@extends('layout')
@section('title', 'Point 관리리')
@section('content')
<div class="table-responsive" id="table">
  <input type="hidden" id="token">
  <table class="table table-bordered table-hover table-striped" style="text-align:center;">
    <thead>
      <tr>
        <th style="text-align:center;">No</th>
        <th style="text-align:center;">제목</th>
        <th style="text-align:center;">고객명</th>
        <th style="text-align:center;">현재금액</th>
        <th style="text-align:center;">입금액</th>
        <th style="text-align:center;">출금액</th>
        <th style="text-align:center;">작업일</th>
        <th style="text-align:center;">비고</th>
      </tr>
    </thead>
    <tbody>
      @php $i=0 @endphp
      @foreach($entities as $key=>$entity)
      <tr>
        <td>{{$total-(($curPage-1)*$perPage+$i)}}</td>
        <td>{{$entity->getTitle()}}</td>
        <td>{{$clients[$entity->getClientCode()]->getTitle()}}</td>
        <td>{{number_format($clients[$entity->getClientCode()]->getPoint())}}</td>
        <td>{{number_format($entity->getType() == 'deposit' ? $entity->getAmount() : 0)}}</td>
        <td>{{number_format($entity->getType() == 'withdrawal' ? $entity->getAmount() : 0)}}</td>
        <td>{{date('Y-m-d',strtotime($entity->getCreatedAt()))}}</td>
        <td>{{$entity->getNote()}}</td>
      </tr>
      @php $i++ @endphp
      @endforeach
    </tbody>
  </table>
  <div style="text-align:center;">{!!$pagination->render(DBMS_SITE_URL . "/IdcClientPointList.cli", ['client_code' => $client_code, 'curPage' => $curPage, 'perPage' => $perPage])!!}</div>
  @php $insert_url = DBMS_SITE_URL . "/IdcClientPointInsert.cli?client_code=" . $client_code @endphp
  <div style="text-align:center;"><button type="button" class="btn btn-primary" onclick="location.href='{{$insert_url}}'">포인트 추가</button></div>
</div>
@endsection