function printQuoteRow()

in serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-ui/src/main/resources/templates/AppResource/app.js [47:80]


function printQuoteRow(quotesResponse) {
    const quoteTableBody = $('#completedQuotes > tbody');
    if (quotesResponse.loanRequestId) {
        const queryRow = $('<tr>').appendTo(quoteTableBody);
        queryRow.append($(`<th scope="row" style="width: 30%;">$\{quotesResponse.loanRequestId}</th>`));
        queryRow.append($(`<td style="width: 30%;">$\{quotesResponse.credit.SSN}</td>`));
        queryRow.append($(`<td style="width: 30%;">$\{quotesResponse.term}</td>`));
        queryRow.append($(`<td style="width: 30%;">$\{quotesResponse.amount}</td>`));
        queryRow.append($(`<td style="width: 30%;">$\{quotesResponse.credit.score}</td>`));
        queryRow.append($(`<td style="width: 30%;">$\{quotesResponse.credit.history}</td>`));

        if (quotesResponse.eventType === "kogito.serverless.workflow.aggregated.quotes.timeout") {
            showEventsToast("No bank offered for Workflow Id: " + quotesResponse.loanRequestId + " and SSN: " + quotesResponse.credit.SSN + " :(");
            const quotesRowBody = $('<tr>').append('<td colspan="6" id="">')
            quotesRowBody.children(0).append('<span>No bank offers were received in the given time frame, maybe you can try with a different amount.</span>');
            quotesRowBody.appendTo(quoteTableBody);
        } else {
            if (quotesResponse.quotes) {
                showEventsToast(quotesResponse.quotes.length + " bank offers arrived for Workflow Id: " + quotesResponse.loanRequestId + " and SSN: " + quotesResponse.credit.SSN + "!");
                const quotesRowBody = $('<tr>').append('<td colspan="6" id="">')
                quotesRowBody.children(0).append('<table class="table mb-0">');
                quotesRowBody.children(0).children(0).append('<thead><tr><th>Bank</th><th>Rate</th></tr></thead>');
                quotesRowBody.children(0).children(0).append('<tbody id="quoteBody">');
                for (const q of quotesResponse.quotes) {
                    const quotesRow = $('<tr>');
                    quotesRow.append($(`<td>$\{q.bankId}</td>`));
                    quotesRow.append($(`<td>$\{q.rate}</td>`));
                    quotesRowBody.find('#quoteBody').append(quotesRow);
                }
                quotesRowBody.appendTo(quoteTableBody);
            }
        }
    }
}