{# Template For UG Students In SB Collage #}
<style scoped>
    .pages {
        font-family: Times New Roman, Times, serif !important;
        page-break-before: always !important;
        padding-left: 15mm;
        padding-right: 15mm;
    }
    @page {
        margin: 0;
    }
    td, th {
        border: 1px solid #000;
        text-align: center;
        vertical-align: middle;
        padding: 3px 5px !important;
        font-size: 13px;
    }
    .no-border, .no-border td, .no-border th {
        border: 0 none !important;
    }
    .b-0, .b-0 td, .b-0 th {
        border: 0 none !important;
    }
    .student-details td, .student-details th {
        border: 1px solid #000;
        text-align: left;
        font-size: 13px;
        padding: 4px 8px !important;
    }
    .removeTdBorder td, .removeTdBorder th {
        border-top: 0 none;
        border-bottom: 0 none;
    }
    .subject-table th {
        font-weight: bold;
        font-size: 12px;
        padding: 4px 3px !important;
    }
    .subject-table td {
        font-size: 12px;
        padding: 2px 3px !important;
    }
    .grade-scale td, .grade-scale th {
        font-size: 12px;
        padding: 3px 10px !important;
    }
    .notes {
        font-size: 12px;
        margin-top: 8px;
        text-align: left;
        line-height: 20px;
    }
    .footer-signatures td {
        border: 0 none !important;
        text-align: center;
        font-size: 13px;
        padding-top: 20px !important;
    }
</style>

{% for student in data.studentData %}
<div class="pages">

    {# ===== HEADER ===== #}
    <table width="100%" cellspacing="0" cellpadding="0" style= " border-collapse: collapse;">
        <tr class="no-border">
            <td class="no-border" style="text-align: center;">
                <div><b style="font-size: 20px;">GRADE CARD</b></div>
                <div><b style="font-size: 15px;">{{data.examRegistrationData.degreeName | upper}}</b></div>
                <div><b style="font-size: 15px;">{{data.examRegistrationData.name | upper}}</b></div>
            </td>
        </tr>
    </table>

    {# ===== STUDENT DETAILS ===== #}
    <table class="student-details" width="100%" cellspacing="0" cellpadding="0" style="margin-bottom: 3mm; border-collapse: collapse;">
        <tr>
            <td width="50%" ><b>Roll No</b>: {{student.rollNo}}</td>
            <td width="50%"><b>RGU Enrolment No</b>: {{student.registerNo}}</td>
        </tr>
        <tr>
            <td><b>Name</b>: {{student.name | upper}}</td>
            <td><b>Father's Name</b>: {{student.fatherName | upper}}</td>
        </tr>
        <tr>
            <td><b>ABC ID</b>: {{student.abcId}}</td>
            <td><b>Mother's Name</b>: {{student.motherName | upper}}</td>
        </tr>
        <tr>
            <td colspan="2"><b>Programme</b>: {{ data.examRegistrationData.programName | upper }}</td>
        </tr>
    </table>

    {# ===== SUBJECT TABLE ===== #}
    <div style="min-height: 210mm;">
    <table class="subject-table" width="100%" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; margin-bottom: 3mm;">
        <thead>
            <tr>
                <th rowspan="2" width="10%">Courses Code</th>
                <th rowspan="2" width="31%">Courses Title</th>
                <th rowspan="2" width="5%">CIA</th>
                <th colspan="2" width="14%">ESE</th>
                <th rowspan="2" width="9%">Marks Obtained</th>
                <th rowspan="2" width="8%">Course Credit</th>
                <th rowspan="2" width="8%">Grade Point</th>
                <th rowspan="2" width="8%">Credit Point</th>
                <th rowspan="2" width="7%">Results</th>
            </tr>
            <tr>
                <th width="7%">Practical</th>
                <th width="7%">Theory</th>
            </tr>
        </thead>
        <tbody>
            {% for courses in student.subjects %}
                <tr>
                    <td style="text-align: left;">{{courses.code}}</td>
                    <td style="text-align: left; padding-left: 4px !important;">{{courses.name | upper}}</td>
                    <td>{{courses.ciaDisplay}}</td>
                    <td>{{courses.esePracticalDisplay}}</td>
                    <td>{{courses.eseTheoryDisplay}}</td>
                    <td>{{courses.marksObtainedDisplay}}</td>
                    <td>{{courses.courseCreditDisplay}}</td>
                    <td>{{courses.gradePointDisplay}}</td>
                    <td>{{courses.creditPointDisplay}}</td>
                    <td>{{courses.resultDisplay}}</td>
                </tr>
            {% endfor %}

            {# Total row #}
            <tr class="">
                <td colspan="2" style="text-align: left; padding-left: 4px !important;">Total</td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td style="font-weight:bold">{{student.semesterCredit}}</td>
                <td></td>
                <td style="font-weight:bold">{{student.creditGradePoint}}</td>
                <td></td>
            </tr>

            {# SGPA row #}
            <tr class="">
                <td colspan="7" style="text-align: left; padding-left: 4px !important;">Semester Grade Point Average (SGPA)</td>
                <td colspan="3" style='font-weight:bold'>{{student.semesterSgpa}}</td>
            </tr>
            <tr class="">
                <td colspan="7" style="text-align: left; padding-left: 4px !important;">Semester Result</td>
                <td colspan="3" style='font-weight:bold'>{{student.failedStatus == 'FAILED' ? 'RA' : 'PASS'}}</td>
            </tr>

            {% if student.isFinalTerm %}
                <tr class="">
                    <td colspan="7" style="text-align: left; padding-left: 4px !important;">Total Credit Point</td>
                    <td colspan="3" style='font-weight:bold'>{{student.overallFailedHistory ? "0.0" : student.earnedCreditPoint}}</td>
                </tr>

                <tr class="">
                    <td colspan="7" style="text-align: left; padding-left: 4px !important;">Total Course Credit</td>
                    <td colspan="3" style='font-weight:bold'>{{student.totalCredits}}</td>
                </tr>

                <tr class="">
                    <td colspan="7" style="text-align: left; padding-left: 4px !important;">Cumulative Grade Point Average (CGPA)</td>
                    <td colspan="3" style='font-weight:bold'>{{student.overallFailedHistory ? "0.00" : student.semesterCgpa}}</td>
                </tr>

                <tr class="">
                    <td colspan="7" style="text-align: left; padding-left: 4px !important;">Final Result</td>
                    <td colspan="3" style='font-weight:bold'>{{student.overallFailedHistory ? 'RA' : 'PASS'}}</td>
                </tr>
                <tr class="">
                    <td colspan="7" style="text-align: left; padding-left: 4px !important;">Position</td>
                    <td colspan="3" style='font-weight:bold'>{{student.rank ? student.rank : '-'}}</td>
                </tr>
            {% endif %}

            {# Date row #}
           
            <tr class="">
                <td colspan="10" style="text-align: left; padding-left: 4px !important;">Date :  {% if data.examRegistrationData.publishingStartDate %}  {{ data.examRegistrationData.publishingStartDate|date("d/m/Y") }} {% endif %} </td>
            </tr>
          


        </tbody>
    </table>

    {# ===== GRADE SCALE TABLE ===== #}
    <table class="grade-scale" align="center" cellspacing="0" cellpadding="0" style="border-collapse: collapse; margin: 3mm auto;">
        <thead>
            <tr>
                <th style="padding: 4px 20px !important;">RANGE OF MARKS</th>
                <th style="padding: 4px 20px !important;">GRADE POINT</th>
                <th style="padding: 4px 35px !important;">LETTER GRADE</th>
            </tr>
        </thead>
        <tbody>
            <tr><td>90 - 100</td><td>9.0 - 10</td><td>O ( OUTSTANDING )</td></tr>
            <tr><td>80 - 89</td><td>8.0 - 8.9</td><td>A+ ( EXCELLENT )</td></tr>
            <tr><td>75 - 79</td><td>7.5 - 7.9</td><td>A ( VERY GOOD )</td></tr>
            <tr><td>70 - 74</td><td>7.0 - 7.4</td><td>B+ ( GOOD )</td></tr>
            <tr><td>60 - 69</td><td>6.0 - 6.9</td><td>B ( ABOVE AVERAGE )</td></tr>
            <tr><td>50 - 59</td><td>5.0 - 5.9</td><td>C ( AVERAGE )</td></tr>
            <tr><td>45 - 49</td><td>4.5 - 4.9</td><td>D ( SATISFACTORY )</td></tr>
            <tr><td>00 - 44</td><td>-</td><td>RA ( RE-APPEAR )</td></tr>
            <tr><td>ABSENT</td><td>-</td><td>AA ( ABSENT )</td></tr>
        </tbody>
    </table>

    {# ===== NOTES ===== #}
    <div class="notes">
        <div>1. CIA: Continuous Internal Assessment</div>
        <div>2. Computation of Semester Grade Point Average (SGPA) (Si) = ∑ (C<sub>i</sub> x G<sub>i</sub>) / ∑ C<sub>i</sub></div>
        <div style="padding-left: 18px;">Where C<sub>i</sub> is the number of Course Credits of the i<sup>th</sup> Course and G<sub>i</sub> is the grade point scored by the student in the i<sup>th</sup> Course.</div>
        <div style="padding-left: 18px;">(SGPA is obtained by Total Credit Point of current semester divided by Total Course Credit offered in the current semester)</div>
        <div>3. Computation of Cumulative Grade Point Average (CGPA) = ∑ Credit Point of all semesters / ∑ Course Credit of all semesters</div>
        <div>4. To Convert CGPA to Percentage, where necessary the following may be adopted: CGPA x 10</div>
        <div>5. Abbreviation: P - Pass, RA - Re-appear, AA - Absent</div>
    </div>
    </div>
    {# ===== SIGNATURE STRIP ===== #}
    <table width="100%" cellpadding="0" cellspacing="0" style="margin-top: 15mm; border-collapse: collapse;" class="footer-signatures">
        <tr>
            <td width="33%">
                <b>Controller of Examinations</b>
            </td>
            <td width="33%">
                <b>Verified by</b>
            </td>
            <td width="33%">
                <b>Principal</b>
            </td>
        </tr>
    </table>

</div>
{% endfor %}
