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


Current Path : /var/www/html/pget/js/admin/
Upload File :
Current File : /var/www/html/pget/js/admin/rostertable.js

// var $host_url =
//   "http://" +
//   window.location.host +
//   "/" +
//   window.location.pathname.split("/")[1] +
// 	"/app.php?a=";

function loadRosterTable() {
  $.ajax({
    type: "POST",
    url: $host_url + "loadRosterTable",
    async: false,
    success: function(response) {
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data);
      var res = [];
      var arrof100 = [];
      var arrof90 = [];
      var arrof80 = [];
      var arrof70 = [];
      var arrof60 = [];
      var arrof55 = [];
      var arrof50 = [];
      var arrof45 = [];
      var arrof40 = [];
      var arrof35 = [];
      var arrof30 = [];
      var arrof25 = [];
      var arrof20 = [];
      var arrof10 = [];
      var arrof5 = [];
      if (error_code == "0") {
        for (var i = 0; i < data.length; i++) {
          if (data[i].fintake == "100") {
            arrof100.push(data[i]);
          }
          if (data[i].fintake == "90") {
            arrof90.push(data[i]);
          }
          if (data[i].fintake == "80") {
            arrof80.push(data[i]);
          }

          if (data[i].fintake == "70") {
            arrof70.push(data[i]);
          }

          if (data[i].fintake == "60") {
            arrof60.push(data[i]);
          }

          if (data[i].fintake == "55") {
            arrof55.push(data[i]);
          }

          if (data[i].fintake == "50") {
            arrof50.push(data[i]);
          }

          if (data[i].fintake == "45") {
            arrof45.push(data[i]);
          }

          if (data[i].fintake == "40") {
            arrof40.push(data[i]);
          }

          if (data[i].fintake == "35") {
            arrof35.push(data[i]);
          }

          if (data[i].fintake == "30") {
            arrof30.push(data[i]);
          }

          if (data[i].fintake == "25") {
            arrof25.push(data[i]);
          }

          if (data[i].fintake == "20") {
            arrof20.push(data[i]);
          }

          if (data[i].fintake == "10") {
            arrof10.push(data[i]);
          }

          if (data[i].fintake == "5") {
            arrof5.push(data[i]);
          }
        }
        res.push(
          arrof100,
          arrof90,
          arrof80,
          arrof70,
          arrof60,
          arrof55,
          arrof50,
          arrof45,
          arrof40,
          arrof35,
          arrof30,
          arrof25,
          arrof20,
          arrof10,
          arrof5
        );
        //  console.log(res);
        //  console.log(arrof100,arrof5,arrof20,arrof30,arrof35);

        $("#loadTab").load("rostertable.html", function() {
          var str = ` <thead style="text-align: center;">
              <tr class="bg-cyan">
                  <td class="qaltablefisrtrd" style="width: 100px;" rowspan="2">Intake</td>
                  <td class="qaltablefisrtrd" style="width: 525px;" colspan="8">HK-REGION(70%)</td>
                  <td class="qaltabletd" style="width: 525px;" colspan="8">NHK-REGION(30%)</td>  
              </tr>
              <tr class="bg-cyan">
                
                <td class="qaltablefisrtrd">GM</td>
                <td class="qaltabletd">SC</td>
                <td class="qaltabletd">ST</td>
                <td class="qaltabletd">C-1</td>
                <td class="qaltabletd">C-2A</td>
                <td class="qaltabletd">C-2B</td>
                <td class="qaltabletd">C-3A</td>
                <td class="qaltabletd">C-3B</td>
                <td class="qaltabletd">GM</td>
                <td class="qaltabletd">SC</td>
                <td class="qaltabletd">ST</td>
                <td class="qaltabletd">C-1</td>
                <td class="qaltabletd">C-2A</td>
                <td class="qaltabletd">C-2B</td>
                <td class="qaltabletd">C-3A</td>
                <td class="qaltabletd">C-3B</td>
              </tr>
            </thead>
            <tbody style="text-align: center;">`;

          var subdet = res;
          var i = 0;
          subdet.forEach(element => {
            // var subname = element.subname;

            // var value = subname.split("-");
            str += `
              <tr class="ui-widget-content jqgrow">
                <td class="tbl_row_new" style="width: 100px;"><b>${res[i][i].fintake}</b></td>  
                <td class="tbl_row_new">${res[i][1].fseats}</td>
                <td class="tbl_row_new">${res[i][6].fseats}</td>
                <td class="tbl_row_new">${res[i][7].fseats}</td>
                <td class="tbl_row_new">${res[i][0].fseats}</td>
                <td class="tbl_row_new">${res[i][2].fseats}</td>
                <td class="tbl_row_new">${res[i][3].fseats}</td>
                <td class="tbl_row_new">${res[i][4].fseats}</td>
                <td class="tbl_row_new">${res[i][5].fseats}</td>
                <td class="tbl_row_new">${res[i][9].fseats}</td>
                <td class="tbl_row_new">${res[i][14].fseats}</td>
                <td class="tbl_row_new">${res[i][15].fseats}</td>
                <td class="tbl_row_new">${res[i][8].fseats}</td>
                <td class="tbl_row_new">${res[i][10].fseats}</td>
                <td class="tbl_row_new">${res[i][11].fseats}</td>
                <td class="tbl_row_new">${res[i][12].fseats}</td>
                <td class="tbl_row_new">${res[i][13].fseats}</td>                              
              </tr>`;
            i++;
          });
          str += `</tbody>`;

          $("#colltable").html(str);
        });
      } else {
        alert("Please try after some time");
        return;
      }
    }
  });
}