info:
  name: Tabella HTML ripartizioni FOR ADVANCED
  type: http
  seq: 24

http:
  method: POST
  url: "{{elixFormsApiUrl}}/eftl/process/v1"
  headers:
    - name: x-requested-with
      value: XMLHttpRequest
    - name: x-api-key
      value: "{{elixFormsWsAuthenticationToken}}"
    - name: x-ef-request-id
      value: "31499"
      disabled: true
    - name: x-ef-request-id
      value: "24068"
  body:
    type: json
    data: |-
      {
        "userDocument": "{{elixBase64EftlDocument}}", // see the pre-request script
        "userContext": {
          "lang": "IT",
          "crlf": "\r\n"
        }
      }
  auth: inherit

runtime:
  scripts:
    - type: before-request
      code: |-
        const { prepareEftlDocument } = require("./elixFormsJs.js")
        // Copy-pasta your EFTL document below inside the template literals (`)
        prepareEftlDocument(String.raw`
        [EFTL]
        [VAR name="datiRipartizioneIterable" type="iterable"][SPLIT regex="##" emptyIfBlank="true"][TAG]GETVALUEBYTAG,RIPARTIZIONE_DATI_COMPLETI,REQUEST,IUQOID,CONCAT,##[/TAG][/SPLIT][/VAR]

        [VAR name="item1" type="number"][% item1 = 0; %][/VAR]
        [VAR name="item2" type="number"][% item2 = 1; %][/VAR]
        [VAR name="item3" type="number"][% item3 = 2; %][/VAR]
        [VAR name="item4" type="number"][% item4 = 3; %][/VAR]
        [VAR name="item5" type="number"][% item5 = 4; %][/VAR]

        <table>
          <tr>
            <th>Nominativo</th>
            <th>Codice fiscale</th>
            <th>Qualifica</th>
            <th>Struttura</th>
            <th>Importo (&euro;)</th>
          </tr>
        [FOR varName="ripartizione" iterable="datiRipartizioneIterable"][VAR name="datiIterable" type="iterable"][SPLIT regex=";;" emptyIfBlank="true"][VALUE_OF varname="ripartizione" /][/SPLIT][/VAR]
          <tr>
            <td>[VALUE_OF varname="datiIterable" index="item1" /]</td>
            <td>[VALUE_OF varname="datiIterable" index="item2" /]</td>
            <td>[VALUE_OF varname="datiIterable" index="item3" /]</td>
            <td>[VALUE_OF varname="datiIterable" index="item4" /]</td>
            <td style="text-align: right;">[FORMAT type="number" pattern="#,##0.00"][VALUE_OF varname="datiIterable" index="item5" /][/FORMAT]</td>
          </tr>[/FOR]
        </table>
        [/EFTL]
        `);

settings:
  encodeUrl: true
  timeout: 0
  followRedirects: true
  maxRedirects: 5
  forwardAuthorizationHeader: true
