ppeasy/public/standardstepvecchia.php

507 lines
21 KiB
PHP

<?php
include('include/headscript.php');
include('db-connect.php');
?>
<?php
// pickup the get variable
// pickup the get variable
if (isset($_POST["idtrf"])) {
$idtrf=$_POST["idtrf"]; }
if (isset($_GET["idtrf"])) {
$idtrf=$_GET["idtrf"]; }
if (isset($_POST["photoname"])) {
$photoname=$_POST["photoname"]; }
if (isset($_POST["description"])) {
$description=$_POST["description"]; }
if (isset($_POST["model"])) {
$model=$_POST["model"]; }
if (isset($_POST["rangemeasuremin"])) {
$rangemeasuremin=$_POST["rangemeasuremin"]; }
if (isset($_POST["rangemeasuremax"])) {
$rangemeasuremax=$_POST["rangemeasuremax"]; }
if (isset($_POST["registeredmark"])) {
$registeredmark=$_POST["registeredmark"]; }
if (isset($_POST["articletype"])) {
$articletype=$_POST["articletype"]; }
if (isset($_POST["articlecharacteristic"])) {
$articlecharacteristic=$_POST["articlecharacteristic"]; }
if (isset($_POST["formupdtrfdetails"])) {
$formupdtrfdetails=$_POST["formupdtrfdetails"]; }
if (isset($_POST['stdselected']))
{
$stds = $_POST['stdselected'];
}
if (isset($_POST["updstdform"])) {
$updstdform=$_POST["updstdform"]; }
?>
<?php
include('include/trfqueryscript.php'); ?>
<?php if (isset($stds)) {
foreach ($stds as $hobys=>$value) {
$stdcheckpresent = new WA_MySQLi_RS("stdcheckpresent",$cmctrfdb,1);
$stdcheckpresent->setQuery("SELECT * FROM trfstandards WHERE trfstandards.idtrfdetails='$idtrf' AND trfstandards.idstandards='$value'");
$stdcheckpresent->execute();
if (empty($stdcheckpresent->getColumnVal("idtrfstandards"))) {
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "trfstandards";
$InsertQuery->bindColumn("idtrfdetails", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery->bindColumn("idstandards", "i", "$value", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
$InsertQuery->redirect($InsertGoTo);
}}}
?>
<?php
if (isset($formupdtrfdetails)) {
$UpdateQuery = new WA_MySQLi_Query($cmctrfdb);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "`trf-details`";
$UpdateQuery->bindColumn("sample_description", "s", "$description", "WA_DEFAULT");
$UpdateQuery->bindColumn("measurefrom", "s", "$rangemeasuremin", "WA_DEFAULT");
$UpdateQuery->bindColumn("measureto", "s", "$rangemeasuremax", "WA_DEFAULT");
$UpdateQuery->bindColumn("model", "s", "$model", "WA_DEFAULT");
$UpdateQuery->bindColumn("idarticletype", "i", "$articletype", "WA_DEFAULT");
$UpdateQuery->bindColumn("idarticle_characteristics", "i", "$articlecharacteristic", "WA_DEFAULT");
$UpdateQuery->bindColumn("registeredmark", "s", "$registeredmark", "WA_DEFAULT");
$UpdateQuery->addFilter("idtrfdetails", "=", "i", "".($idtrf) ."");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
$code="3";
$InsertQuery2 = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery2->Action = "insert";
$InsertQuery2->Table = "wheretrfstep";
$InsertQuery2->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery2->bindColumn("code", "s", "$code", "WA_DEFAULT");
$InsertQuery2->saveInSession("");
$InsertQuery2->execute();
$InsertGoTo = "";
$InsertQuery2->redirect($InsertGoTo);
}
?>
<?php
include('include/trfqueryscript.php'); ?>
<?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");
$articletype=$trfnumberfinal->getColumnVal("idarticletype");
$articlecharact=$trfnumberfinal->getColumnVal("idarticle_characteristics");
?>
<?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 all the standards of articletype
// $stdcheck = new WA_MySQLi_RS("stdcheck",$cmctrfdb,0);
// $stdcheck->setQuery("SELECT * FROM standards WHERE standards.idarticletype='$articletype'");
// $stdcheck->execute(); ?>
<?php // preselection based on article characteristic
$stdcheck = new WA_MySQLi_RS("stdcheck",$cmctrfdb,0);
$stdcheck->setQuery("SELECT * FROM standards WHERE standards.idarticlecharacteristic='$articlecharact' ");
$stdcheck->execute();
$idstselect=$stdcheck->getColumnVal("idstandards");
?>
<?php // inline edit query
$idtrfdetails=$idtrf;
$row1 = mysqli_query($con,"SELECT *,trfstandards.iddpicategory as iddpicategoryid,trfstandards.idprotectioncategory as idprotectioncategoryid,trfstandards.idstandards as idstandardsid FROM trfstandards LEFT JOIN standards ON trfstandards.idstandards=standards.idstandards LEFT JOIN dpicategory ON trfstandards.iddpicategory=dpicategory.iddpicategory LEFT JOIN protectioncategory ON trfstandards.idprotectioncategory=protectioncategory.idprotectioncategory WHERE trfstandards.idtrfdetails='$idtrf'");
$idstandards=mysqli_query($con,"SELECT idstandards ,standardname FROM standards");
//query list protectioncategory
$proteccategorylist=mysqli_query($con,"SELECT idprotectioncategory ,name_protectioncategory FROM protectioncategory");
$idproteccategorylistRecord=array();
while($idprotectioncategoryrow = mysqli_fetch_assoc($proteccategorylist)) {
$idproteccategorylistRecord[$idprotectioncategoryrow['idprotectioncategory']]=$idprotectioncategoryrow['name_protectioncategory'];
}
$idprotectioncategoryJson=json_encode($idproteccategorylistRecord);
//query list protectioncategory
$dpicategroylist=mysqli_query($con,"SELECT iddpicategory ,value_dpicategory FROM dpicategory");
$iddpicategorylistRecord=array();
while($iddpicategoryrow = mysqli_fetch_assoc($dpicategroylist)) {
$iddpicategorylistRecord[$iddpicategoryrow['iddpicategory']]=$iddpicategoryrow['value_dpicategory'];
}
$iddpicategoryJson=json_encode($iddpicategorylistRecord);
?>
<!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" />
<!-- inline edit -->
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://kit.fontawesome.com/f13e61f9bf.js" crossorigin="anonymous"></script>
<script src="jquery.tabledit.js"></script>
<!-- submit form with button -->
<script>
function formSubmit() {
document.forms["myForm"].submit();
}
</script>
<script type="text/javascript">
$(document).ready(function(){
$("#add").click(function(e){
var table = $(this).attr('for-table'); //get the target table selector
var $tr = $(table + ">tbody>tr:last-child").clone(true, true); //clone the last row
var nextID = parseInt($tr.find("input.tabledit-identifier").val()) + 1; //get the ID and add one.
$tr.find("input.tabledit-identifier").val(nextID); //set the row identifier
$tr.find("span.tabledit-identifier").text(nextID); //set the row identifier
$(table + ">tbody").append($tr); //add the row to the table
$tr.find(".tabledit-edit-button").click(); //pretend to click the edit button
$tr.find("input:not([type=hidden]), select").val(""); //wipe out the inputs.
$(this).prop('disabled', true);
$('select[name=idprotectioncategoryid]').prepend("<option value='' selected='selected'>Please Select</option>");
$('select[name=iddpicategoryid]').prepend("<option value='' selected='selected'>Please Select</option>");
});
$('#example1').Tabledit({
url: 'logic-edit-delete.php',
columns: {
identifier: [0, 'id'],
editable: [[2, 'idprotectioncategory','<?php echo $idprotectioncategoryJson; ?>'], [3, 'iddpicategory','<?php echo $iddpicategoryJson; ?>']]
},
onDraw: function() {
console.log('onDraw()');
},
onSuccess: function(data, textStatus, jqXHR) {
console.log('onSuccess(data, textStatus, jqXHR)');
console.log(data);
console.log(textStatus);
console.log(jqXHR);
$("#add").prop('disabled', false);
},
onFail: function(jqXHR, textStatus, errorThrown) {
console.log('onFail(jqXHR, textStatus, errorThrown)');
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
},
onAlways: function() {
console.log('onAlways()');
},
onAjax: function(action, serialize) {
console.log('onAjax(action, serialize)');
console.log(action);
console.log(serialize);
}
});
});
</script>
<style>
.table.user-select-none {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
</style>
</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);">CIMAC 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 id="accordion">
<div class="card">
<div class="card-2" id="headingThree">
<h5 class="mb-0">
<button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
<?php echo $descriptionstep; ?>
</button>
</h5>
</div>
<div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordion">
<div class="card-body">
<div class="table-responsive">
<table class="table table-success mb-0">
<thead>
<tr>
<th></th>
<th><?php echo $typearticletitle; ?></th>
<th><?php echo $descriptiontitle; ?></th>
<th><?php echo $modeltitle; ?></th>
<th><?php echo $rangemeasuremintitle; ?></th>
<th><?php echo $rangemeasuremaxtitle; ?></th>
<th><?php echo $articlecharacteristictitle; ?></th>
<th><?php echo $registeredmarktitle; ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><img src="uploadimages/<?php echo $sphotofilename; ?>" height="100" alt=""/></td>
<td><span class="badge badge-soft-primary"><?php echo $sname_articletype; ?></span></td>
<td><?php echo $sdescription; ?></td>
<td><?php echo $smodel; ?></td>
<td><?php echo $smeasuremin; ?></td>
<td><?php echo $smeasuremax; ?></td>
<td><span class="badge badge-soft-primary"><?php echo $sname_articlecharacteristic; ?></span></td>
<td><?php echo $sregisteredmark; ?></td>
</tr>
</tbody>
</table><!--end /table-->
<br>
<a href="trfdetails.php?idtrf=<?php echo $idtrf; ?>"><button type="button" class="btn btn-success waves-effect waves-light"><?php echo $edittitle; ?></button> </a>
</div><!--end /tableresponsive-->
</div>
</div>
</div>
</div>
<div class="progress mb-4">
<div class="progress-bar" role="progressbar" style="width: 50%;" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">50%</div>
</div>
<div class="card">
<div class="card-body">
<?php include('include/alertcheck.php'); ?>
<h5><?php echo $standardlink; ?></h5>
<p class="text-muted mb-3"><?php echo $standardlink_help; ?></p>
<form class="was-validated" action="standardstep.php" method="post" name="myForm">
<?php
$wa_startindex = 0;
while(!$stdcheck->atEnd()) {
$wa_startindex = $stdcheck->Index;
?>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="<?php echo($stdcheck->getColumnVal("idstandards")); ?>" name="stdselected[]" data-parsley-multiple="groups" data-parsley-mincheck="2" value="<?php echo($stdcheck->getColumnVal("idstandards")); ?>">
<label class="custom-control-label" for="<?php echo($stdcheck->getColumnVal("idstandards")); ?>"><?php echo($stdcheck->getColumnVal("standardcode")); ?>-<?php echo($stdcheck->getColumnVal("standardname")); ?></label>
</div>
<?php
$stdcheck->moveNext();
}
$stdcheck->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
<input type="hidden" name="articletype" id="articletype" value="<?php echo $articletype; ?>">
<input type="hidden" name="updstdform" id="articletype" value="Y">
<input type="hidden" name="idtrf" id="idtrf" value="<?php echo $idtrf; ?>">
<br><br>
<input type="button" onclick="formSubmit()" class="btn btn-gradient-success waves-effect waves-light" value="<?php echo $addstandardtitle; ?>">
</div><!--end card-body-->
</form>
</div><!--end card-->
</div><!--end col-->
<?php
$standardselectedlist = new WA_MySQLi_RS("standardselectedlist",$cmctrfdb,0);
$standardselectedlist->setQuery("SELECT * FROM trfstandards LEFT JOIN standards ON trfstandards.idstandards=standards.idstandards WHERE trfstandards.idtrfdetails='$idtrf'");
$standardselectedlist->execute();?>
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h5><?php echo $assignedstd; ?></h4>
<p class="text-muted mb-3">
<?php echo $assignedstd_help; ?>.
</p>
<div class="table-responsive">
<?php include('include/alertcheck.php'); ?>
<table class="table table-striped mb-0" id="" style="border:1px solide red">
<tr><th style="display:none;">id</th><th>Standard Code</th><th>Protection Category</th><th>DPI Category</th></tr>
<?php while($rowquery = mysqli_fetch_assoc($row1)) {?>
<tr>
<td style="display:none;"><?php echo $rowquery['idtrfstandards'];?></td>
<?php
$idstd=$standardselectedlist->getColumnVal("idstandards");?>
<?php
$protcatlist = new WA_MySQLi_RS("protcatlist",$cmctrfdb,0);
$protcatlist->setQuery("SELECT protectioncategory.name_protectioncategory,stdprotectioncat.idstandards,protectioncategory.idprotectioncategory AS idprot FROM stdprotectioncat LEFT JOIN protectioncategory ON stdprotectioncat.idprotectioncategory=protectioncategory.idprotectioncategory WHERE stdprotectioncat.idstandards='$idstd'");
$protcatlist->execute();
?>
<?php
$dpicatlist = new WA_MySQLi_RS("dpicatlist",$cmctrfdb,0);
$dpicatlist->setQuery("SELECT stddpicategory.idstandards,dpicategory.value_dpicategory,dpicategory.iddpicategory AS dpicode FROM stddpicategory LEFT JOIN dpicategory ON dpicategory.iddpicategory=stddpicategory.iddpicategory WHERE stddpicategory.idstandards='$idstd'");
$dpicatlist->execute();
?>
<td><?php echo $rowquery['standardcode']; ?></td>
<td><select>
<?php
while(!$protcatlist->atEnd()) { //dyn select
?>
<option value="<?php echo($protcatlist->getColumnVal("idprot")); ?>"><?php echo($protcatlist->getColumnVal("name_protectioncategory")); ?></option>
<?php
$protcatlist->moveNext();
} //dyn select
$protcatlist->moveFirst();
?>
</select></td>
<td><select>
<?php
while(!$dpicatlist->atEnd()) { //dyn select
?>
<option value="<?php echo($dpicatlist->getColumnVal("dpicode")); ?>"><?php echo($dpicatlist->getColumnVal("value_dpicategory")); ?></option>
<?php
$dpicatlist->moveNext();
} //dyn select
$dpicatlist->moveFirst();
?>
</select></td>
</tr>
<?php } ?>
</table>
<?php include('include/virusquerycheck.php'); ?><br>
<?php if (($articletype==1) || (!empty($virusstep))) { ?>
<a href="additionalinfo.php?idtrf=<?php echo $idtrf; ?>&codestep=<?php echo '3'; ?>"><button type="button" class="btn btn-success waves-effect waves-light"><?php echo $nextsteptitle; ?></button> </a>
<?php } else { ?>
<a href="addrequirements.php?idtrf=<?php echo $idtrf; ?>&codestep=<?php echo '3'; ?>"><button type="button" class="btn btn-success waves-effect waves-light"><?php echo $nextsteptitle; ?></button> </a>
<?php } ?>
<button type="button" class="btn btn-dark waves-effect waves-light" onclick="history.back()"><?php echo $backstep; ?></button>
<!--end /table-->
</div><!--end /tableresponsive-->
</div><!--end card-body-->
</div><!--end card-->
</div>
</div>
<!-- end page title end breadcrumb -->
</div><!-- container -->
<!-- footer start -->
<?php include('include/footer.php'); ?>
</footer><!--end footer-->
</div>
<!-- end page content -->
</div>
<!-- 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>
<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>