<?php

   include('include/headscript.php'); ?>

<?php

$codeposition='7';

   // pickup the get variable

   if (isset($_GET["idtrf"])) {

       $idtrf=$_GET["idtrf"];

   }

   if (isset($_POST["idtrf"])) {

       $idtrf=$_POST["idtrf"];

   }

   if (isset($_POST["descriptionpartvalue"])) {

       $descriptionpartvalue=$_POST["descriptionpartvalue"];

   } else {

       $descriptionpartvalue="";

   }

   if (isset($_POST["articlepartvalue"])) {

       $articlepartvalue=$_POST["articlepartvalue"];

   } else {

       $articlepartvalue="";

   }

   if (isset($_POST["colorvalue"])) {

       $colorvalue=$_POST["colorvalue"];

   } else {

       $colorvalue="";

   }

   if (isset($_POST["cmcreportnumber"])) {

       $cmcreportnumber=$_POST["cmcreportnumber"];

   } else {

       $cmcreportnumber="";

   }

   if (isset($_POST["cmcdatereport"])) {

       $cmcdatereport=$_POST["cmcdatereport"];

   } else {

       $cmcdatereport="";

   }

   if (isset($_POST["trdreportnumber"])) {

       $trdreportnumber=$_POST["trdreportnumber"];

   } else {

       $trdreportnumber="";

   }

   if (isset($_POST["trddatereport"])) {

       $trddatereport=$_POST["trddatereport"];

   } else {

       $trddatereport="";

   }

   if (isset($_POST["kindoftest"])) {

       $kindoftest=$_POST["kindoftest"];

   } else {

       $kindoftest="";

   }

   if (isset($_POST["addpart"])) {

       $addpart=$_POST["addpart"];

   } else {

       $addpart="";

   }





   $todaydate=date("Y-m-d");



if (isset($_GET["codestep"])) {

	$code="7"; 



  $InsertQuery = new WA_MySQLi_Query($cmctrfdb);

  $InsertQuery->Action = "insert";

  $InsertQuery->Table = "wheretrfstep";

  $InsertQuery->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");

  $InsertQuery->bindColumn("code", "i", "$code", "WA_DEFAULT");

  $InsertQuery->saveInSession("");

  $InsertQuery->execute();

  $InsertGoTo = "";



  $InsertQuery->redirect($InsertGoTo);

	}

   ?>

<?php

   $trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal", $cmctrfdb, 1);

   $trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrf'");

   $trfnumberfinal->execute();

$idcertn=$trfnumberfinal->getColumnVal("idcertification");

   $idarticletype=$trfnumberfinal->getColumnVal("idarticletype");

   ?>

<?php $idcert=$trfnumberfinal->getColumnVal("idcertification") ?>

<?php

   $certname = new WA_MySQLi_RS("certname", $cmctrfdb, 1);

   $certname->setQuery("SELECT * FROM certificationtype WHERE certificationtype.idcertificationtype='$idcert'");

   $certname->execute();?>

<?php

   if ($addpart=="Y") {

       $InsertQuery = new WA_MySQLi_Query($cmctrfdb);

       $InsertQuery->Action = "insert";

       $InsertQuery->Table = "identificationparts";

       $InsertQuery->bindColumn("description_identificationparts", "s", "$descriptionpartvalue", "WA_DEFAULT");

       $InsertQuery->bindColumn("article_identificationparts", "s", "$articlepartvalue", "WA_DEFAULT");

       $InsertQuery->bindColumn("color_identificationparts", "s", "$colorvalue", "WA_DEFAULT");

       $InsertQuery->bindColumn("cmcreportnumber_identificationparts", "s", "$cmcreportnumber", "WA_DEFAULT");

       $InsertQuery->bindColumn("cmcreportdate_identificationparts", "t", "$cmcdatereport", "WA_DEFAULT");

       $InsertQuery->bindColumn("thirdlabreportnumber_identificationparts", "s", "$trdreportnumber", "WA_DEFAULT");

       $InsertQuery->bindColumn("thirdlabreportdate_identificationparts", "t", "$trddatereport", "WA_DEFAULT");

       $InsertQuery->bindColumn("idtrfdetails", "i", "$idtrf", "WA_DEFAULT");

       $InsertQuery->bindColumn("kindoftest", "s", "$kindoftest", "WA_DEFAULT");

       $InsertQuery->saveInSession("");

       $InsertQuery->execute();

       $InsertGoTo = "";



       $InsertQuery->redirect($InsertGoTo);

   }

   ?>

<?php

   $listinsertedpart = new WA_MySQLi_RS("listinsertedpart", $cmctrfdb, 0);

   $listinsertedpart->setQuery("SELECT * FROM identificationparts WHERE identificationparts.idtrfdetails='$idtrf'");

   $listinsertedpart->execute();

   ?>



<?php if ($idcertn=='2') {

    header("Location: adddocument.php?idtrf=$idtrf");

    } elseif ($idcertn=='4' ) {

	header("Location: adddocument.php?idtrf=$idtrf");

} 

?>





<!DOCTYPE html>

<html lang="en">

   <head>

      <meta charset="utf-8" />

      <title>TRF CIMAC </title>

      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

      <meta content="CIMAC TRF Portal" name="description" />

      <meta content="" name="author" />

      <meta http-equiv="X-UA-Compatible" content="IE=edge" />

      <!-- App favicon -->

      <link rel="shortcut icon" href="../images/favicon.ico">

      <!--Form Wizard-->

      <link href="../plugins/jquery-steps/jquery.steps.css" rel="stylesheet" type="text/css">

      <!-- App css -->

      <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />

      <link href="assets/css/jquery-ui.min.css" rel="stylesheet">

      <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />

      <link href="assets/css/metisMenu.min.css" rel="stylesheet" type="text/css" />

      <link href="assets/css/app.min.css" rel="stylesheet" type="text/css" />

      <!-- Sweet Alert -->

      <link href="../plugins/sweet-alert2/sweetalert2.min.css" rel="stylesheet" type="text/css">

      <link href="../plugins/animate/animate.css" rel="stylesheet" type="text/css">

      <link href="../plugins/spectrum/spectrum.min.css" rel="stylesheet" type="text/css">

      <!-- Plugins css -->

      <link href="../plugins/daterangepicker/daterangepicker.css" rel="stylesheet" />

      <link href="../plugins/select2/select2.min.css" rel="stylesheet" type="text/css" />

      <link href="../plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.css" rel="stylesheet" type="text/css" />

      <link href="../plugins/timepicker/bootstrap-material-datetimepicker.css" rel="stylesheet">

      <link href="../plugins/bootstrap-touchspin/css/jquery.bootstrap-touchspin.min.css" rel="stylesheet" />

      <!-- search on article -->

	   <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

	      <script type="text/javascript" src="searchengine/scriptsearch.js"></script>

	   <!-- submit form with button -->

      <script>

         function formSubmit() {

             document.forms["myFormone"].submit();

         }

         function setInputVal(id, value) {

             let input = document.getElementById(id);

             input.value = value;

         }

      </script>



	   <script

    type="text/javascript"

    src="//code.jquery.com/jquery-2.1.3.js">

	</script>

   </head>

   <body>

      <!-- Top Bar Start -->

      <?php include('include/topbar.php'); ?>

      <!-- Top Bar End -->

      <!-- Left Sidenav -->

      <?php include('include/leftsidenav.php'); ?>

      <!-- end left-sidenav-->

      <div class="page-wrapper">

      <!-- Page Content-->

      <div class="page-content">

      <div class="container-fluid">

         <!-- Page-Title -->

         <div class="row">

            <div class="col-sm-12">

               <div class="page-title-box">

                  <div class="float-right">

                     <ol class="breadcrumb">

                        <li class="breadcrumb-item"><a href="javascript:void(0);">TRF</a></li>

                        <li class="breadcrumb-item active">Starter</li>

                     </ol>

                  </div>

                  <h4 class="page-title"><?php echo $titlewb; ?></h4>

               </div>

               <!--end page-title-box-->

            </div>

            <!--end col-->

         </div>

         <div class="row">

            <div class="col-sm-12">

               <div class="card">

                  <div class="card-body">

                     <div class="media">

                        <?php include('include/appform.php'); ?>

                     </div>

                     <!--end media-->

                  </div>

                  <!--end card-body-->

               </div>

               <!--end card-->

               <div class="progress mb-4">

                  <div class="progress-bar" role="progressbar" style="width: 90%;" aria-valuenow="90" aria-valuemin="0" aria-valuemax="100">90%</div>

               </div>

               <!-- card for additional info gloves -->

               <!-- card for show requirements -->

               

                     

                    

                   

							   



                     <!-- div CMC parts -->

                    

                        <div class="card">

                           <div class="card-body">

                              <h4 class="mt-0 header-title"><?php echo $cmctesttitle; ?> <i class="fas fa-info-circle" data-toggle="modal" data-animation="bounce" data-target=".bs-example-modal-center9"></i></h4>

							   

							   <div class="modal fade bs-example-modal-center9" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">

                                                        <div class="modal-dialog modal-dialog-centered">

                                                            <div class="modal-content">

                                                                <div class="modal-header">

                                                                    <h5 class="modal-title mt-0" id="exampleModalLabel"><?php echo $m18btitle; ?></h5>

                                                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">

                                                                        <span aria-hidden="true">&times;</span>

                                                                    </button>

                                                                </div>

                                                                <div class="modal-body">

                                                                    <p><?php echo nl2br($newtestparthelp); ?>

                                                                    </p>

                                                                </div>

                                                            </div><!-- /.modal-content -->

                                                        </div><!-- /.modal-dialog -->

                                                    </div><!-- /.modal -->

                              <p class="text-muted mb-3"><?php echo $cmctesttitle_help; ?>

                              </p>

                              <form class="was-validated" action="" method="POST" name="myFormone">

								  <?php include('include/maparticle2.php'); ?>

                                 <!-- div new parts -->



								  <div class="form-row">

                                    <div class="col-md-4 mb-3">

                                       <label for="validationServer01"><?php echo $whichkindofpart; ?></label>

								      <select class="form-control" name="kindoftest" id ="combo">

        <option  value="new"><?php echo $newpartlist; ?></option>

        <option  value="cmc"><?php echo $cmctesttitle; ?></option>

        <option  value="trd" ><?php echo $trdpartlist; ?></option>

      </select>

										</div></div>

                                 <div class="form-row">

                                    <div class="col-md-4 mb-3">

                                       <label for="validationServer01"><?php echo $descriptionpart; ?></label>

                                       <input type="text" class="form-control is-valid" id="descriptionpartvalue2" name="descriptionpartvalue" placeholder="<?php echo $descriptionpart; ?>" required="">

                                    </div>

                                    <div class="col-md-4 mb-3">

                                       <label for="validationServer02"><?php echo $articlepart; ?></label>

                                       <input type="text" class="form-control is-valid" id="articlepartvalue" name="articlepartvalue"  placeholder="<?php echo $articlepart; ?>" required="">

                                    </div>

                                    <div class="col-md-4 mb-3">

                                       <label for="validationServerUsername"><?php echo $colorpart; ?></label>

                                       <div class="input-group">

                                          <div class="input-group-prepend">

                                          </div>

                                          <input type="text" class="form-control" id="colorvalue" name="colorvalue" placeholder="<?php echo $colorpart; ?>" aria-describedby="inputGroupPrepend3" required="">

                                       </div>

                                    </div>

                                 </div>

                                 <div class="form-row">

                                    <div class="col-md-4 mb-3">

                                       <label for="validationServer01"><?php echo $reportnumbercmctitle; ?></label>

                                       <input type="text" class="form-control is-valid" id="cmcreportnumber" name="cmcreportnumber" placeholder="<?php echo $reportnumbercmctitle; ?>"disabled >

                                    </div>

                                    <div class="col-md-4 mb-3">

                                       <label for="validationServerUsername"><?php echo $datereporttitle; ?></label>

                                       <div class="input-group">

                                          <div class="input-group-prepend">

                                          </div>

                                          <input type="date" required="" class="form-control" id="cmcdatereport" name="cmcdatereport" onchange="validateDate(this.value)" min="2000-01-01" max="<?php echo $todaydate; ?>" disabled value="">

                                       </div>

                                    </div>

									<div class="col-md-4 mb-3">

                                       <label for="validationServer01"><?php echo $reportoftitle; ?></label>

                                       <input type="text" class="form-control is-valid" id="reportof" name="reportof" placeholder="<?php echo $reportoftitle; ?>"  disabled>

                                    </div>

                                 </div>

                                 <input type="hidden" name="idtrf" id="idtrf" value="<?php echo($trfnumberfinal->getColumnVal("idtrfdetails")); ?>">

                                 

                                 <input type="hidden" name="addpart" id="addpart" value="Y">

                                 <input type="button" onclick="formSubmit()" class="btn btn-gradient-success waves-effect waves-light" value="<?php echo $addpartbutton; ?>">

                              </form>

							       <script type="text/javascript">//<![CDATA[





$(document).on('change', '#combo', function(){

    var shouldEnable = $(this).val() === 'new' ;

    $('#cmcreportnumber').prop('disabled', shouldEnable);

	$('#reportof').prop('disabled', shouldEnable);

	$('#cmcdatereport').prop('disabled', shouldEnable);



} 

			  

			  );







  //]]></script>

                           </div>

                           <!--end card-body-->

                        </div>

                     </div>

                     <!-- end -->

                     <script>

                        function formSubmit() {

                            document.forms["myFormone"].submit();

                        }

                     </script>

                     <!-- div 3rd lab parts -->

                     

                     <!-- end -->

                  

               <!--end card-->

            

            <!--end col-->

            <!-- show the parts -->

            <div class="col-lg-12">

               <div class="card">

                  <div class="card-body">

                     <h4 class="mt-0 header-title"><?php echo $assignedparts; ?></h4>

                     <p class="text-muted mb-6"><?php echo $assignedparts_help; ?>

                     </p>

                     <style media="screen">

                        .hidden-x {

                        display: none!important;

                        }

                     </style>

                     <div id="datatable_wrapper" class="dataTables_wrapper dt-bootstrap4 no-footer">

                        <div class="row">

                           <div class="col-sm-12">

                              <table id="datatable" class="table table-bordered dt-responsive nowrap dataTable no-footer dtr-inline" style="border-collapse: collapse; border-spacing: 0px; width: 100%;" role="grid" aria-describedby="datatable_info">

                                 <thead>

                                    <tr role="row">

                                       <th class="sorting_asc" tabindex="0" aria-controls="datatable" rowspan="1" colspan="1" style="width: 149px;" aria-sort="ascending" aria-label="Name: activate to sort column descending">

                                          <?php echo $kindpart; ?>

                                       </th>

                                       <th class="sorting" tabindex="0" aria-controls="datatable" rowspan="1" colspan="1" style="width: 230px;" aria-label="Position: activate to sort column ascending">

                                          <?php echo $descriptionpartlist; ?>

                                       </th>

                                       <th class="sorting" tabindex="0" aria-controls="datatable" rowspan="1" colspan="1" style="width: 108px;" aria-label="Office: activate to sort column ascending">

                                          <?php echo $articlepartlist; ?>

                                       </th>

                                       <th class="sorting" tabindex="0" aria-controls="datatable" rowspan="1" colspan="1" style="width: 45px;" aria-label="Age: activate to sort column ascending">

                                          <?php echo $colorpartlist; ?>

                                       </th>

                                       <th class="sorting" tabindex="0" aria-controls="datatable" rowspan="1" colspan="1" style="width: 97px;" aria-label="Start date: activate to sort column ascending">

                                          <?php echo $reportlist; ?>

                                       </th>

                                       

                                       <th class="sorting" tabindex="0" aria-controls="datatable" rowspan="1" colspan="1" style="width: 75px;" aria-label="Salary: activate to sort column ascending">

                                          <?php echo $datereportlist; ?>

                                       </th>

                                       <th class="sorting" tabindex="0" aria-controls="datatable" rowspan="1" colspan="1" style="width: 75px;" aria-label="Salary: activate to sort column ascending">

                                          <?php echo $action; ?>

                                       </th>

                                    </tr>

                                 </thead>

                                 <tbody>

                                    <?php

                                       $wa_startindex = 0;

                                       while (!$listinsertedpart->atEnd()) {

                                           $wa_startindex = $listinsertedpart->Index; ?>

                                    <tr role="row" class="odd">

                                       <td tabindex="0" class="sorting_1">

                                          <span class="text-x"><?php echo($listinsertedpart->getColumnVal("kindoftest")); ?></span>

                                          <span class="input-x hidden-x">

                                          <input type="text" class="form-control" name="kindoftest" value="<?php echo($listinsertedpart->getColumnVal("kindoftest")); ?>">

                                          <input type="hidden" class="form-control" name="ididentificationparts" value="<?php echo($listinsertedpart->getColumnVal("ididentificationparts")); ?>">

                                          <input type="hidden" class="form-control" name="idtrfdetails" value="<?php echo($listinsertedpart->getColumnVal("idtrfdetails")); ?>">

                                          </span>

                                       </td>

                                       <td tabindex="0" class="sorting_1">

                                          <span class="text-x"><?php echo($listinsertedpart->getColumnVal("description_identificationparts")); ?></span>

                                          <span class="input-x hidden-x">

                                          <input type="text" class="form-control" name="description_identificationparts" value="<?php echo($listinsertedpart->getColumnVal("description_identificationparts")); ?>">

                                          </span>

                                       </td>

                                       <td tabindex="0" class="sorting_1">

                                          <span class="text-x"><?php echo($listinsertedpart->getColumnVal("article_identificationparts")); ?></span>

                                          <span class="input-x hidden-x">

                                          <input type="text" class="form-control" name="article_identificationparts" value="<?php echo($listinsertedpart->getColumnVal("article_identificationparts")); ?>">

                                          </span>

                                       </td>

                                       <td tabindex="0" class="sorting_1">

                                          <span class="text-x"><?php echo($listinsertedpart->getColumnVal("color_identificationparts")); ?></span>

                                          <span class="input-x hidden-x">

                                          <input type="text" class="form-control" name="color_identificationparts" value="<?php echo($listinsertedpart->getColumnVal("color_identificationparts")); ?>">

                                          </span>

                                       </td>

                                       <td tabindex="0" class="sorting_1">

                                          <span class="text-x"><?php echo($listinsertedpart->getColumnVal("cmcreportnumber_identificationparts")); ?></span>

                                          <span class="input-x hidden-x">

                                          <input type="text" class="form-control" name="cmcreportnumber_identificationparts" value="<?php echo($listinsertedpart->getColumnVal("cmcreportnumber_identificationparts")); ?>">

                                          </span>&nbsp;-&nbsp;

                                          <span class="text-x"><?php echo($listinsertedpart->getColumnVal("thirdlabreportnumber_identificationparts")); ?></span>

                                          <span class="input-x hidden-x">

                                          <input type="text" class="form-control" name="thirdlabreportnumber_identificationparts" value="<?php echo($listinsertedpart->getColumnVal("thirdlabreportnumber_identificationparts")); ?>">

                                          </span>

                                       </td>

                                       

                                       <td tabindex="0" class="sorting_1">

                                          <span class="text-x"><?php echo($listinsertedpart->getColumnVal("thirdlabreportdate_identificationparts")); ?></span>

                                          <span class="input-x hidden-x">

                                          <input type="date" class="form-control" name="thirdlabreportdate_identificationparts" value="<?php echo($listinsertedpart->getColumnVal("thirdlabreportdate_identificationparts")); ?>">

                                          </span>

                                       </td>

                                       <td>

                                          <span class="edit-btn-x">

                                          <button id="bEdit" type="button" class="btn btn-sm btn-soft-success btn-circle mr-2" onclick="makeEditable(this)"><i class="dripicons-pencil"></i></button>

                                          <button id="bElim" type="button" class="btn btn-sm btn-soft-danger btn-circle" onclick="deleteRow(this, <?php echo($listinsertedpart->getColumnVal("ididentificationparts")); ?>)"style=""><i class="dripicons-trash" aria-hidden="true"></i></button>

                                          </span>

                                          <span class="save-btn-x hidden-x">

                                          <button id="bAcep" type="button" class="btn btn-sm btn-soft-purple mr-2 btn-circle" style="" onclick="saveEditable(this)"><i class="dripicons-checkmark"></i></button>

                                          <button id="bCanc" type="button" class="btn btn-sm btn-soft-info btn-circle" style="" onclick="cancelEdit(this)"><i class="dripicons-cross" aria-hidden="true"></i></button>

                                          </span>

                                       </td>

                                    </tr>

                                    <?php

                                       $listinsertedpart->moveNext();

                                       }

                                       $listinsertedpart->moveFirst(); //return RS to first record

                                       unset($wa_startindex);

                                       unset($wa_repeatcount);

                                       ?>

                                 </tbody>

                              </table>

                              <br>

                              <a href="adddocument.php?idtrf=<?php echo $idtrf; ?>&codestep=7"><button type="button" class="btn btn-success waves-effect waves-light"><?php echo $nextsteptitle; ?></button> </a>

							   <button type="button" class="btn btn-dark waves-effect waves-light" onclick="history.back()"><?php echo $backstep; ?></button> 

                              <script>

                                 function makeEditable(node) {

                                     let tr = node.parentNode.parentNode.parentNode;

                                     let td = node.parentNode.parentNode;

                                     let all_text = tr.getElementsByClassName('text-x');

                                     let all_input = tr.getElementsByClassName('input-x');

                                     let edit_btn = td.getElementsByClassName('edit-btn-x')[0];

                                     let save_btn = td.getElementsByClassName('save-btn-x')[0];



                                     edit_btn.classList.add('hidden-x');

                                     save_btn.classList.remove('hidden-x');



                                     for(let i of all_text) {

                                         i.classList.add('hidden-x');

                                     }

                                     for(let i of all_input) {

                                         i.classList.remove('hidden-x');

                                     }

                                     // console.log()

                                 }



                                 function saveEditable(node) {

                                     let tr = node.parentNode.parentNode.parentNode;

                                     let td = node.parentNode.parentNode;

                                     window.all_text = tr.getElementsByClassName('text-x');

                                     window.all_input = tr.getElementsByClassName('input-x');

                                     window.edit_btn = td.getElementsByClassName('edit-btn-x')[0];

                                     window.save_btn = td.getElementsByClassName('save-btn-x')[0];

                                     let payload = {};



                                     for(let input of tr.getElementsByTagName('input')) {

                                         payload[input.name] = input.value;



                                         /*if(!input.value) {

                                             alert(`Empty value is not allowed(${input.name})!`);

                                             return;

                                         }*/

                                     }



                                     $.ajax({

                                         type : 'POST',

                                         url  : 'ajax.php',

                                         data : payload,

                                         success : function(response) {

                                             if(response.status == 'success') {

                                                 window.edit_btn.classList.remove('hidden-x');

                                                 window.save_btn.classList.add('hidden-x');



                                                 for(let i = 0; i < window.all_input.length; i++) {

                                                     window.all_input[i].classList.add('hidden-x');

                                                     window.all_text[i].innerHTML = window.all_input[i].getElementsByTagName('input')[0].value;

                                                 }

                                                 for(let i of window.all_text) {

                                                     i.classList.remove('hidden-x');

                                                 }

                                             } else {

                                                 alert(response.message);

                                             }

                                         },

                                         error : function(e){

                                             if (e.status == 200) {

                                                 window.edit_btn.classList.remove('hidden-x');

                                                 window.save_btn.classList.add('hidden-x');



                                                 for(let i = 0; i < window.all_input.length; i++) {

                                                     window.all_input[i].classList.add('hidden-x');

                                                     window.all_text[i].innerHTML = window.all_input[i].getElementsByTagName('input')[0].value;

                                                 }

                                                 for(let i of window.all_text) {

                                                     i.classList.remove('hidden-x');

                                                 }

                                             }

                                         }

                                     });

                                 }







                                 function deleteRow(node, id) {

                                     let cnf = confirm('<?php echo $confirmdeleteline; ?>');



                                     if(!cnf) {

                                         return;

                                     }



                                     window.tr = node.parentNode.parentNode.parentNode;



                                     $.ajax({

                                         type : 'POST',

                                         url  : 'delete_ajax.php',

                                         data : {id : id},

                                         success : function(response) {

                                             if(response.status == 'success') {

                                                 window.tr.remove();

                                             } else {

                                                 alert(response.message);

                                             }

                                         },

                                         error : function(e){

                                             if (e.status == 200) {

                                                window.tr.remove();

                                             }

                                         }

                                     });

                                 }



                                 function cancelEdit(node) {

                                     let tr = node.parentNode.parentNode.parentNode;

                                     let td = node.parentNode.parentNode;

                                     window.all_text = tr.getElementsByClassName('text-x');

                                     window.all_input = tr.getElementsByClassName('input-x');

                                     window.edit_btn = td.getElementsByClassName('edit-btn-x')[0];

                                     window.save_btn = td.getElementsByClassName('save-btn-x')[0];

                                     window.edit_btn.classList.remove('hidden-x');

                                     window.save_btn.classList.add('hidden-x');



                                     for(let i = 0; i < window.all_input.length; i++) {

                                         window.all_input[i].classList.add('hidden-x');

                                     }

                                     for(let i of window.all_text) {

                                         i.classList.remove('hidden-x');

                                     }

                                 }

                              </script>

                           </div>

                        </div>

                     </div>

                  </div>

               </div>

               <!-- end page title end breadcrumb -->

            </div>

            <!-- container -->

            <!-- footer start -->

            <?php include('include/footer.php'); ?>

            </footer><!--end footer-->

         </div>

         <!-- end page content -->

      </div>

      <script type="text/javascript">

         function validateDate(date) {

             var five_years_before_from_current = moment().subtract(5, 'years');

             var selected_date = moment(date);



             if (selected_date < five_years_before_from_current) {

                 alert('<?php echo $alertdate; ?>');

                 {

                     $("#newpart").addClass('show');

                     $("#cmcpart").removeClass('show');

					 $("#thirdpart").removeClass('show');

                 }

             }

         }

      </script>

      <!-- end page-wrapper -->

      <!-- jQuery  -->

      <script src="assets/js/jquery.min.js"></script>

      <script src="assets/js/bootstrap.bundle.min.js"></script>

      <script src="assets/js/metismenu.min.js"></script>

      <script src="assets/js/waves.js"></script>

      <script src="assets/js/feather.min.js"></script>

      <script src="assets/js/jquery.slimscroll.min.js"></script>

      <script src="assets/js/jquery-ui.min.js"></script>

      <!-- Plugins js -->

      <script src="../plugins/moment/moment.js"></script>

      <script src="../plugins/daterangepicker/daterangepicker.js"></script>

      <script src="../plugins/select2/select2.min.js"></script>

      <script src="../plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>

      <script src="../plugins/timepicker/bootstrap-material-datetimepicker.js"></script>

      <script src="../plugins/bootstrap-maxlength/bootstrap-maxlength.min.js"></script>

      <script src="../plugins/bootstrap-touchspin/js/jquery.bootstrap-touchspin.min.js"></script>

      <script src="../plugins/spectrum/spectrum.min.js"></script>

      <!-- Sweet-Alert  -->

      <script src="../plugins/sweet-alert2/sweetalert2.min.js"></script>

      <script src="assets/pages/jquery.sweet-alert.init.js"></script>

      <script src="assets/pages/jquery.forms-advanced.js"></script>

      <script src="../plugins/jquery-steps/jquery.steps.min.js"></script>

      <script src="assets/pages/jquery.form-wizard.init.js"></script>

      <!-- App js -->

      <script src="assets/js/app.js"></script>

   </body>

</html>

