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.143.239.63


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

var $g_user_subjIdentfy_details = ''

function CallUserSubjIdentification() {
    $('#page_main_div').load(
        '../html_modules/user_subjIdentification.html',
        function () {
            window.location.g_FeePopUpExamNo = ''
            document.getElementById('display_module_name').innerHTML =
                'User Wise Subject Identification'
            document.getElementById('module_name_for_save').value =
                'saveUserSubjIdentfy'

            getDefaultHeadFooterLinks('User Wise Subject Identification')
            ClearUserSubjIdentify()
            $.ajax({
                type: 'POST',
                url: $host_url + 'getUserRightsDetails.demo',
                success: populateUserSubjDetailsResponse,
            })
        }
    )
}
function populateUserSubjDetailsResponse($responce) {
    $responce = eval('(' + $responce + ')')

    document.getElementById('user_rights_user').options.length = 0

    $op = new Option('--Select--', '0')
    $op.id = '0'
    document.getElementById('user_rights_user').options.add($op)

    for ($i = 0; $i < $responce.data['user_rights_user'].length; $i++) {
        $op = new Option(
            $responce.data['user_rights_user'][$i]['value'],
            $responce.data['user_rights_user'][$i]['internal_code']
        )
        $op.id = $responce.data['user_rights_user'][$i]['internal_code'] //specifying the id  for options
        document.getElementById('user_rights_user').options.add($op)
    }

    document.getElementById('user_subject_table_data_div').innerHTML = ''
    //getUserRightModuleNames(0,'');
}

function ClearUserSubjIdentify() {
    $('#user_rights_user').val('')
    $('#user_subj_degree_code').val('')
    $('#user_subj_degree_name').val('')
    $('#user_subject_table_data_div').html('')
    document.getElementById('user_rights_user').disabled = false
    document.getElementById('user_subj_degree_code').disabled = false
    document.getElementById('user_rights_user').focus()
}

function PopulateUserSubjectList() {
    var userType = $('#user_rights_user').val()
    var degree = $('#user_subj_degree_code').val()
    var module = $('#iapr').val()
    if (empty(userType)) {
        alert('Select User')
        return
    }
    if (empty(degree)) {
        alert('Select Degree')
        return
    }
    if (empty(module)) {
        alert('Select Module')
        return
    }

    $.ajax({
        type: 'POST',
        data:
            'degree=' + degree + '&userType=' + userType + '&module=' + module,
        url: $host_url + 'PopulateUserSubjectList',
        success: PopulateUserSubjectListResponce,
    })
}

function PopulateUserSubjectListResponce($responce) {
    $responce = eval('(' + $responce + ')')
    if ($responce.error_code == 0) {
        $g_user_subjIdentfy_details = $responce
        $('#user_subject_table_data_div').html($responce.data['html_data'])
        document.getElementById('user_rights_user').disabled = true
        document.getElementById('user_subj_degree_code').disabled = true
    }
}
function selectAllUserSubject() {
    if (document.getElementById('check_Allrow').checked == true) {
        for (
            $i = 0;
            $i < $g_user_subjIdentfy_details.data['module_id_details'].length;
            $i++
        ) {
            $id =
                $g_user_subjIdentfy_details.data['module_id_details'][$i]
                    .fsubcode
            document.getElementById('check_row_' + $id).checked = true
        }
    } else {
        for (
            $i = 0;
            $i < $g_user_subjIdentfy_details.data['module_id_details'].length;
            $i++
        ) {
            $id =
                $g_user_subjIdentfy_details.data['module_id_details'][$i]
                    .fsubcode
            document.getElementById('check_row_' + $id).checked = false
        }
    }
}

function SaveUserSubjIdentify() {
    var userType = $('#user_rights_user').val()
    var degree = $('#user_subj_degree_code').val()
    var module = $('#iapr').val()

    var subjSelected = ''
    for (
        $i = 0;
        $i < $g_user_subjIdentfy_details.data['module_id_details'].length;
        $i++
    ) {
        $id = $g_user_subjIdentfy_details.data['module_id_details'][$i].fsubcode
        if (document.getElementById('check_row_' + $id).checked == true) {
            subjSelected +=
                document.getElementById('check_row_' + $id).value + '*'
        }
    }
    $.ajax({
        type: 'POST',
        data:
            'degree=' +
            degree +
            '&userType=' +
            userType +
            '&subjSelected=' +
            subjSelected +
            '&module=' +
            module,
        url: $host_url + 'saveUserSelectedSubjectList',
        success: saveUserSelectedSubjectListResponce,
    })
}

function saveUserSelectedSubjectListResponce($responce) {
    $responce = eval('(' + $responce + ')')
    alert($responce.data)
}