$kind: http-request
url: "{{baseUrl}}membership/members/create"
method: POST
body:
  type: json
  content: |-
    {
        "first_name": "Ambrose",
        "last_name": "Ogwang",
        "contact": "0700100100",
        "password": "Tester@2023",
        "email_address": "ogwang@gmail.com",
        "member_type_id": 1,
        "branch_id": 1,
        "organisation_id":1,
        "occupation": "Farmer",
        "date_registered": "2023-11-10",
        "address": "Bukoto street",
        "introduced_by": 1,
        "gender": "Male",
        "date_of_birth": "1995-10-10"
    }
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>First Name</th>
              <th>Last Name</th>
              <th>Contact</th>
              <th>Email Address</th>
              <th>Member Type ID</th>
              <th>Branch ID</th>
              <th>Organisation ID</th>
              <th>Occupation</th>
              <th>Date Registered</th>
              <th>Address</th>
              <th>Introduced By</th>
              <th>Gender</th>
              <th>Date of Birth</th>
              <th>ID</th>
              <th>Full Name</th>
          </tr>
          <tr>
              <td>{{response.data.first_name}}</td>
              <td>{{response.data.last_name}}</td>
              <td>{{response.data.contact}}</td>
              <td>{{response.data.email_address}}</td>
              <td>{{response.data.member_type_id}}</td>
              <td>{{response.data.branch_id}}</td>
              <td>{{response.data.organisation_id}}</td>
              <td>{{response.data.occupation}}</td>
              <td>{{response.data.date_registered}}</td>
              <td>{{response.data.address}}</td>
              <td>{{response.data.introduced_by}}</td>
              <td>{{response.data.gender}}</td>
              <td>{{response.data.date_of_birth}}</td>
              <td>{{response.data.id}}</td>
              <td>{{response.data.full_name}}</td>
          </tr>
      </table>

      `;


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


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