<?= $this->extend($viewDatas['layout']['layout']) ?>
<?= $this->section('content') ?>
<div id="container" class="content">
  <link href="/css/<?= $viewDatas['layout']['path'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
  <div class="action_form" style="width:700px;">
    <!-- 청구서 정보 -->
    <table class=" table table-bordered text-center">
      <tbody>
        <tr>
          <th class="p-0">메일 제목</th>
          <td colspan="3">서비스 요금 청구서 </td>
        </tr>
        <tr>
          <th class="p-0">발신자</th>
          <td class="p-0">support@prime-idc.jp</td>
          <th class="p-0">발행일</th>
          <td class="p-0"><?= date("Y-m-d") ?></td>
        </tr>
      </tbody>
    </table>
    <!-- 서비스 테이블 -->
    <?php foreach ($viewDatas['rows'] as $row): ?>
      <table class="table table-sm table-bordered text-center">
        <tr>
          <th class="p-0">고객명</th>
          <th class="p-0">총 결제 금액</th>
        </tr>
        <tr>
          <td class="p-0"><?= $row['name'] ?></td>
          <td class="p-0"><?= number_format($row['total_amount']) ?>원</td>
        </tr>
        <tr>
          <td colspan="2">
            <table class="table table-sm table-bordered">
              <?php foreach ($row['services'] as $service): ?>
                <tr>
                  <th class="p-0">서버 IP</th>
                  <th class="p-0">항목</th>
                  <th class="p-0">결제일</th>
                </tr>
                <tr>
                  <td class="p-0"><?= $service['ip'] ?></td>
                  <td class="p-0" nowrap><?= view("{$viewDatas['view_path']}/invoice_items", ['service' => $service]); ?></td>
                  <td class="p-0 text-nowrap"><?= $service['billing_at'] ?></td>
                </tr>
              <?php endforeach; ?>
            </table>
          </td>
        </tr>
      </table>
    <?php endforeach; ?>
    <?= $this->include("{$viewDatas['view_path']}/invoice_info"); ?>
    <?= $this->include("{$viewDatas['view_path']}/invoice_mobile"); ?>
  </div>
</div>
<?= $this->endSection() ?>