$kind: http-request
url: "{{baseUrl}}shares/accounts?fiscal_start_date=2023-01-01&fiscal_end_date=2\
  023-12-31"
method: GET
queryParams:
  fiscal_start_date: 2023-01-01
  fiscal_end_date: 2023-12-31
auth:
  type: bearer
  credentials:
    token: "{{token}}"
scripts:
  - type: afterResponse
    code: >-
      var template = `

      <style type="text/css">
          .tftable {font-size:14px;color:#333333;width:100%;border-width: 1px;border-color: #87ceeb;border-collapse: collapse;}
          .tftable th {font-size:18px;background-color:#87ceeb;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;text-align:left;}
          .tftable tr {background-color:#ffffff;}
          .tftable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;}
          .tftable tr:hover {background-color:#e0ffff;}
      </style>


      <table class="tftable" border="1">
          <tr>
              <th>ID</th>
              <th>Account Number</th>
              <th>Member ID</th>
              <th>Share Product ID</th>
              <th>Date Opened</th>
              <th>Client Type</th>
              <th>Status ID</th>
              <th>Branch ID</th>
              <th>Organisation ID</th>
              <th>Created By</th>
              <th>Created At</th>
              <th>Updated At</th>
              <th>Member Name</th>
              <th>Product ID</th>
              <th>Product Name</th>
              <th>Product Code</th>
              <th>Product Price</th>
              <th>State ID</th>
              <th>State Account ID</th>
              <th>State State ID</th>
          </tr>
          
          {{#each response}}
              <tr>
                  <td>{{id}}</td>
                  <td>{{account_no}}</td>
                  <td>{{member_id}}</td>
                  <td>{{share_product_id}}</td>
                  <td>{{date_opened}}</td>
                  <td>{{client_type}}</td>
                  <td>{{status_id}}</td>
                  <td>{{branch_id}}</td>
                  <td>{{organisation_id}}</td>
                  <td>{{created_by}}</td>
                  <td>{{created_at}}</td>
                  <td>{{updated_at}}</td>
                  <td>{{member_name}}</td>
                  <td>{{product.id}}</td>
                  <td>{{product.name}}</td>
                  <td>{{product.code}}</td>
                  <td>{{product.price}}</td>
                  <td>{{state.id}}</td>
                  <td>{{state.account_id}}</td>
                  <td>{{state.state_id}}</td>
              </tr>
          {{/each}}
      </table>

      `;


      function constructVisualizerPayload() {
          return {response: pm.response.json().data};
      }


      pm.visualizer.set(template, constructVisualizerPayload());
    language: text/javascript
order: 1000
