{# Template For backlog certificate Default template
 #}
 <link href='https://fonts.googleapis.com/css2?family=Times New Roman:ital,wght@0,400;0,700;1,400;1,700&display=swap' rel='stylesheet'>

<style>
     td, th { padding: 5px; }
    body{
        font-family: \"Times New Roman\", Times, serif; 
    }
    .no-border {
        border-style: none !important;
        border-top:2px solid #fff !important;
        border-bottom:2px solid #fff !important;
        border-left:2px solid #fff !important;
        border-right:2px solid #fff !important;
    } 
    .border {
        border-style: solid; 
        border-width: 2px;
        border-top:2px solid #000 !important;
        border-bottom:2px solid #000 !important;
        border-left:2px solid #000 !important;
        border-right:2px solid #000 !important;
    }
    .border-l-0 {
        border-left:none !important;
    }
    .border-r-0 {
        border-right:none !important;
    }
    .subHeading{
        font-size:15pt!important; 
        border-left: 1px solid #000 !important;
        border-right: 1px solid #000 !important;
        border-bottom: 1px solid #000 !important;
        border-top: 1px solid #000 !important;
        padding:2mm;
    }
   
    .subject-details tr th{
        border-left: 1px solid #000;
        border-right: 1px solid #000;
        border-bottom: 1px solid #000;
        border-top: 1px solid #000;
        padding:2mm;
    }
    .subject-details tr td{
        border-left: 1px solid #000;
        border-right: 1px solid #000;
        border-bottom: 1px solid #000;
        border-top: 1px solid #000;
        padding:2mm;
    }

    @media print {
        .pages {
            font-family:"Times New Roman", Times, serif;
        }
     }

    .removeTdBorder 
    {
        border-top: 0px none;
        border-bottom: 0px none;
    }
    .student-details tr td, tr th { 
        font-size:15pt; 
        text-align:center;
        vertical-align: middle;
    }
    .b-0 {
        border: 0px none;
    }
    .student-details tr{
        height:7mm !important;
    }
    @page {
        margin: 0;
        /* scale : 72; */
    }
    .student-details td{
        font-size:15pt !important; 
        line-height:26px !important;
    }
    .student-details th{
        font-size:15pt !important; 
    }
    .pages{
        font-family:"Times New Roman", Times, serif;
        font-size: 15pt!important;
    }
    .student-details th,td{
        padding:5px;
    }
    .subject-details th,td{
        font-size:15pt!important; 
        line-height:24px !important;
        vertical-align: middle;
    }
    .student-details th,td {
        padding-top:5px;
        padding-bottom:5px;
    }
    .text-center{
        text-align: center!important;
    }
    .header{
        font-size:16pt!important; 
        text-align:center; 
        font-weight: bold; 
        width: 100%;
        margin-bottom:10px;
        margin-top: 40px;
    }
    p {
        text-align: justify;
        word-spacing: -0.05em; /* Adjust this value */
    }
    .bold{
        font-weight: bold!important;
    }
</style>
    <div class="pages" style=" no-border">
        {% set trcolSpan =  14 %}
        <table style = 'width: 100%;font-size:16px;line-height:19px;' cellpadding='0' cellspacing='0' border='0' class='b-0 student-details'>
            <thead>
                
                <tr class="no-border">
                    <td class="removeTdBorder college-head no-border text-center" style="text-align:center" data-f-bold='true' data-a-h='center' colspan='{{trcolSpan}}'>
                        <img style = 'width: auto; height: 115px;' src ="{{data.collegeData.collegeHeader}}">
                    </td>
                </tr>  
                <tr>
                    <td></td>
                    <td style='text-align:left;' class='b-0'>
                        <div style='float:left'>
                                No: -MIC/Coe/BL/{{ "now"|date("m") }}/{{ "now"|date("d") }} {{student.certificateNo}}
                        </div>
                        <div style='float:right'>
                                {{ "now"|date("d/m/Y") }}
                        </div>
                    </td>
                </tr>
            </thead>
        </table>
        <div style="float: left;"></div>
        <div class="header" style="text-decoration: underline;">TO WHOM IT MAY CONCERN</div>
        <div><p>
        This is to certify that <b>{{data.studentDetails.courtesyTitle}} {{data.studentDetails.name}}</b>, Candidate Code {{data.studentDetails.regNo}}, was a bonafide student of {{data.collegeData.collegeName}} (Autonomous) for {{data.studentDetails.programName}}. The period of study is {{data.studentDetails.batchStartYear}}-{{data.studentDetails.batchEndYear}}.
        </p></div>
        <div><p>His backlog summary record is under:</p></div>
        <table class='subject-details' cellspacing='0' style='border: 1px solid #000 ;width:100%!important;margin-bottom:5px; margin-top:15px; border-collapse: collapse;min-height:3cm'>
               <tr style='height: 7mm !important;'>
                    <td width='15%' style='text-align:left;padding: 5px;line-height:21px;' >Semester</td>
                    <td width='20%' style='text-align:left;line-height:21px;'>Month & Year of </br> Passing</td>
                    <td width='25%' style='text-align:center;'>No. of courses for which candidate failed in 1st attempt</td>
                    <td width='40%' style='text-align:center;'>Course Codes for which candidate failed in 1st attempt</td>
                </tr>
                {% for sem in data.subjects %}
                    <tr>
                        <td style="font-size: 13pt!important; text-align:left;">
                            {% if loop.index == 1 %}1st Semester
                            {% elseif loop.index == 2 %}2nd Semester
                            {% elseif loop.index == 3 %}3rd Semester
                            {% else %}{{ loop.index }}th Semester
                            {% endif %}
                        </td>
                        <td style="font-size: 13pt!important; text-align:left;">{{ sem.passingMonth }} {{ sem.passingYear }}{% if sem.isReappearance %} (Reappearance){% endif %}</td>
                        <td style="font-size: 13pt!important;" class="text-center">{{ sem.failedCoursesCount }}</td>
                        <td style="font-size: 13pt!important;" class="text-center">{{ sem.failedCoursesCodes }}</td>
                    </tr>
                {% endfor %}
        </table>

        <div style="font-size: 15pt; margin-top: 15px; text-align: justify;">
            <p>The candidate had passed all the courses except {{ data.totalBacklogCountInWords }} (noted above) in the first attempt, but passed all the courses except {{ data.remainingBacklogCount }} ({{ data.remainingBacklogCountInWords }}) in the course period itself ({{ data.studentDetails.batchStartYear }}-{{ data.studentDetails.batchEndYear }}). The candidate has passed the following courses in different semesters as shown in the table below:</p>
        </div>

        <table class='subject-details' cellspacing='0' style='border: 1px solid #000;width:100%!important;margin-bottom:5px;margin-top:15px;border-collapse:collapse;'>
            <tr style='height: 7mm !important;'>
                <td style='text-align:center;padding:5px;'>Course Code</td>
                <td style='text-align:center;padding:5px;'>Semester</td>
                <td style='text-align:center;padding:5px;'>Month & Year of Exam (Passed)</td>
            </tr>
            {% for sem in data.subjects %}
                {% set semIndex = loop.index %}
                {% for subjectCode, subject in sem.subjects %}
                    <tr>
                        <td style="font-size: 13pt!important; text-align:left;">{{ subjectCode }}</td>
                        <td style="font-size: 13pt!important;" class="text-center">{{ semIndex }}</td>
                        <td style="font-size: 13pt!important; text-align:left;">{{ subject.actualMonth }} {{ subject.actualYear }}</td>
                    </tr>
                {% endfor %}
            {% endfor %}
        </table>

        <div style="font-size: 15pt; margin-top: 10px;">
            {{ data.studentDetails.personalPronoun }} had {{ data.remainingBacklogCountInWords }} courses as backlog.
        </div>

        <table style="width: 100%;" cellpadding="0" cellspacing="0" border="0">
            <tbody>
                <tr style='height: 7mm;line-height: 15px;'>
                    <td style='text-align:left;padding-top:100px!important;'>Controller of Examinations</td>
                    <td style='width:100mm!important;text-align:right;padding-top:100px!important;'>Principal</td>
                </tr>
            </tbody> 
        </table>
    </div>
