0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.147.103.33


Current Path : /var/www/oasis/js/
Upload File :
Current File : /var/www/oasis/js/attendenceshort.js

function callAttendenceShortage() {
    $('#page_main_div').load('../html_modules/attendemceshort.html?v=1001', {
        function() {
            document.getElementById('display_module_name').innerHTML =
                'Shortage List'
            document.getElementById('module_name_for_save').value =
                'Shortage List'
            getDefaultHeadFooterLinks('Attendence Shortage')
            getShortDegee()
        },
    })
}

var iaattarray = []

function getShortDegee() {
    $.ajax({
        url: $host_url + 'attendenceshort',
        success: function (res) {
            var response = JSON.parse(res)
            console.log(response, 'degree')
            if (response.status == 'success') {
                var option = `<option value=''>--Select--</option>`

                for (i = 0; i < response.data.data.length; i++) {
                    option += `<option value='${response.data.data[i].FDEGREE}'>${response.data.data[i].FDEGREE}-${response.data.data[i].FDESCPN}</option>`
                }

                document.getElementById('deg').innerHTML = option
            }
        },
    })
}

function getShortPer() {
    var degree = document.getElementById('deg').value
    var sem = document.getElementById('sem').value

    $.ajax({
        url: $host_url + 'getShortPer',
        data: 'deg=' + degree + '&sem=' + sem,
        success: function (res) {
            var response = JSON.parse(res)

            if (response.status == 'success') {
                $('#iaper').val(response.data.fshortiaper)
                $('#attper').val(response.data.fshortattper)
            }
        },
    })
}

function showShortData() {
    var degree = document.getElementById('deg').value
    var sem = document.getElementById('sem').value

    $.ajax({
        url: $host_url + 'attendenceshortagedata',
        data: 'deg=' + degree + '&sem=' + sem,
        success: function (res) {
            var response = JSON.parse(res)
            console.log(response, 'tabledata')
            if (response.error_code == -1) {
                let table = ''
                table += `<h5>No Data Found</h5>`
                document.getElementById('attdatatable').innerHTML = table
            } else {
                let table = ''
                table += `<table style='width: 100%;' cellspacing='0'>`
                table += `<thead style='position:sticky; top:0'><tr>
                  <th colspan='7' style='padding:5px;' align='left' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper'>Attendence Shortage</th></tr>
                 <tr align="center" class='ui-state-default ui-jqgrid-hdiv'>
                 <th class='column'>Sl. No.</th>
                 <th class='column'>Reg.No</th>
                 <th class='column'>Name</th>
                 <th class='column'>Subject Name</th>
                 <th class='column'>Remarks</th>
                 <th class='column'>Attendence Shortage</th>
                 <th class='column'>IA Shortage</th>
                 </tr>
              </thead>`
                for (let i = 0; i < response.data.data.length; i++) {
                    iaattarray.push(response.data.data[i])
                    table += `<tr align='center'>
                  <td class='column'>${i + 1}</td>
                  <td class='column'>${response.data.data[i].regno}</td>
                  <td class='column' style='padding:5px;' align='left'>${
                      response.data.data[i].fname
                  }</td>
                  <td class='column' style='padding:5px;' align='left'>${
                      response.data.data[i].subjectcode
                  }</td>
                  <td class='column' >${response.data.data[i].FREMARKS}</td>`

                    if (response.data.data[i].FREMARKS == 'IA Shortage') {
                        table += `<td class='column'>-</td>
                    <td class='column'>${response.data.data[i].iaper}</td>`
                    } else {
                        table += `<td class='column'>${response.data.data[i].attper}</td>
                    <td class='column'>-</td>`
                    }
                    table += `</tr>`
                }
                table += `</table>`
                document.getElementById('attdatatable').innerHTML = table
            }
        },
    })
}

function checkalliaatt() {
    let checkAll = document.getElementById('checkall').checked
    for (let index = 0; index < iaattarray.length; index++) {
        document.getElementById('checkonebyone_' + index).checked = checkAll
        iaattarray[index]['fstatus'] = checkAll
    }
}

function checkIaAttData(index) {
    var checkitem = document.getElementById('checkonebyone_' + index).checked
    if (checkitem) {
        iaattarray[index]['fstatus'] = checkitem
    } else {
        iaattarray[index]['fstatus'] = checkitem
    }
}

function attendenceshort() {
    let formdata = new FormData()
    formdata.append('data', JSON.stringify(iaattarray))

    $.ajax({
        type: 'POST',
        url: $host_url + 'attshorttable',
        data: formdata,
        contentType: false,
        processData: false,
        cache: false,
        success: function (res) {
            let response = JSON.parse(res)
            console.log(response, 'anita')
            if (response.error_code == 0) {
                console.log('data saved')
                alert('Data Saved')
            }
        },
    })
}

function GenattendIAshort() {}