
<style>
    body {
        font-family: "Times New Roman", serif;
        font-size: 14px;
    }

    table {
        width: 100%;
        border-collapse: collapse;
        page-break-inside: auto;
    }

    td,
    th {
        border: 1px solid #000;
        padding: 6px;
        vertical-align: top;
        page-break-inside: avoid;
    }

    .info-table {
        width: 100%;
        /* Light grey background */
        border-collapse: collapse;
        font-family: "Times New Roman", serif;
        font-size: 14px;
    }
    .inactive-class {
    width: 100%;
    /* Light grey background */
    border-collapse: collapse;
    font-family: "Times New Roman", serif;
    font-size: 14px;
    } 
    .inactive-class tr td{ 
    /* No borders */
        border: 1px solid #000;
    }
    .info-table td {
        padding: 6px 12px;
        border: none;
        /* No borders */
         vertical-align: middle;;
    }

    .label {
        font-weight: bold;
        white-space: nowrap;
    }

    .value {
        padding-left: 10px;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    thead {
        display: table-header-group;
    }

    tfoot {
        display: table-footer-group;
    }

    table,
    tr,
    td,
    th {
        -webkit-region-break-inside: avoid;
        break-inside: avoid;
    }
</style>

<div style="padding-left: 30px; padding-right: 30px;">
   <%- include('calibRptHeader') %>
    <% balCalData.forEach((section, sectionIndex) => { %>
    <% if(sectionIndex !== 0) { %>
        <div style="page-break-after: always;"></div>
    <% } %>
    <% if(section.type === 'Periodic') { %>
         <%- include('PeriodicCalibration', {section, sectionIndex}) %>
    <% } %>
    <% if(sectionIndex == 0) { %> 
        <% if(confi_tbl.CalibrationReport == 2) { %>
            <br>
            <table>
            <tr>
                <td class="label">Spirit Level<br>(OK/NOT OK)</td>
                <td class="value"><%- master[`${type}_SpritLevel`] == 0 ? 'Ok' : '' %></td>

                <td class="label">Zero Error</td>
                <td class="value"><%- master[`${type}_ZeroError`] == 0 ? 'Nil' : '' %> </td>
                <td class="label">External Parts</td>
                <td class="value"><%- master[`${type}_GeneralCare`] == 0 ? 'Yes' : '' %> </td>
            </tr> 
            </table>     
            <p><b>Note:</b></p>
            <ol>
                <li>Adjust zero error before commencing the weighing operation.</li>
                <li>Check against standard weights on every month.</li>
            </ol>
        <% } %>
    <% } %>
    <% if(section.type === 'Uncertinity') { %>
        <%- include('UncertinityCalibration', {section, sectionIndex}) %>
    <% } %>
    <% if(section.type === 'Sensitivity') { %>
         <%- include('SensitivityCalibration', {section, sectionIndex}) %>
    <% } %>
    <% if(section.type === 'Accuracy') { %>
    <%- include('AccuracyCalibration', {section, sectionIndex}) %>
    <% } %>
     <% if(section.type === 'Repet') { %>
        <%- include('RepeatabilityCalibration', {section, sectionIndex}) %>
    <% } %>
    <% if(section.type === 'Eccent') { %>
         <%- include('EccentricityCalibration', {section, sectionIndex}) %>
    <% } %>
    <% if(section.type === 'Linear') { %>
         <%- include('LinearityCalibration', {section, sectionIndex}) %>
    <% } %>
    <% if(balCalData.length - 1 === sectionIndex) { %>  
    <p><b>Comment:</b> ________________________________________________</p>
    <br><br>
    <table style="border:none;" class="info-table">
        <tr>
            <td style="font-size: 16px;">
                <b>Calibration performed by :</b>
                <%- master[`${type}_UserName`] %>
                (<%- master[`${type}_UserID`] %>)
            </td>

            <td style="font-size: 16px;">
                <b>Checked by :</b>
                <%- master[`${type}_VerifyName`] !="NULL" ? master[`${type}_VerifyName`] : '' %>
                <%- master[`${type}_VerifyName`] !="NULL" && master[`${type}_VerifyID`] !="NULL" ? `(${master[`${type}_VerifyID`]})` : '' %>
            </td>
        </tr>
        <tr>
            <td style=" padding-top:20px; font-size: 16px;">
                <b>Date:</b> <%- master[`${type}_CalbDate`]
            ? ` ${moment(master[`${type}_CalbDate`]).format(confi_tbl.DateFormat)}`
            : '' %>
            </td>
            <td style="padding-top:20px; font-size: 16px;">
                <b>Date:</b><%- master[`${type}_VerifyDate`]
            ? ` ${moment(master[`${type}_VerifyDate`]).format(confi_tbl.DateFormat)}`
            : '' %>
            </td>
        </tr>
    </table>
    <% } %> 
    <% }) %>
</div>
    