ppeasy/public/admin-standards.php
2025-01-21 10:23:49 +01:00

250 lines
11 KiB
PHP

<?php
include('include/headscript.php'); ?>
<?php
if (isset($_POST["idstandards"])) {
$idstandards = $_POST["idstandards"];
}
if (isset($_POST["formnameedit"])) {
$formnameedit = $_POST["formnameedit"];
}
if (isset($_POST["formnameadd"])) {
$formnameadd = $_POST["formnameadd"];
}
if (isset($formnameedit)) {
$UpdateQuery = new WA_MySQLi_Query($cmctrfdb);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "standards";
$UpdateQuery->bindColumn("fmidstandards", "i", "" . ((isset($_POST["fmcode"])) ? $_POST["fmcode"] : "") . "", "WA_DEFAULT");
$UpdateQuery->bindColumn("standardname", "s", "" . ((isset($_POST["itastdname"])) ? $_POST["itastdname"] : "") . "", "WA_DEFAULT");
$UpdateQuery->bindColumn("standardname_eng", "s", "" . ((isset($_POST["engstdname"])) ? $_POST["engstdname"] : "") . "", "WA_DEFAULT");
$UpdateQuery->bindColumn("standardcode", "s", "" . ((isset($_POST["standardcode"])) ? $_POST["standardcode"] : "") . "", "WA_DEFAULT");
$UpdateQuery->bindColumn("idarticletype", "i", "" . ((isset($_POST["idarticletype"])) ? $_POST["idarticletype"] : "") . "", "WA_DEFAULT");
$UpdateQuery->bindColumn("idarticlecharacteristic", "i", "" . ((isset($_POST["articlecharact"])) ? $_POST["articlecharact"] : "") . "", "WA_DEFAULT");
$UpdateQuery->bindColumn("iddpicategory", "i", "" . ((isset($_POST["categorydpi"])) ? $_POST["categorydpi"] : "") . "", "WA_DEFAULT");
$UpdateQuery->bindColumn("virusset", "s", "" . ((isset($_POST["virusprotection"])) ? $_POST["virusprotection"] : "") . "", "WA_DEFAULT");
$UpdateQuery->bindColumn("chemicalsset", "s", "" . ((isset($_POST["chemicalagent"])) ? $_POST["chemicalagent"] : "") . "", "WA_DEFAULT");
$UpdateQuery->bindColumn("active", "s", "" . ((isset($_POST["active"])) ? $_POST["active"] : "") . "", "WA_DEFAULT");
$UpdateQuery->addFilter("idstandards", "=", "i", "" . ($idstandards) . "");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";
$UpdateQuery->redirect($UpdateGoTo);
}
?>
<?php
if (isset($formnameadd)) {
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "standards";
$InsertQuery->bindColumn("fmidstandards", "i", "" . ((isset($_POST["fmcode"])) ? $_POST["fmcode"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("standardname", "s", "" . ((isset($_POST["itastdname"])) ? $_POST["itastdname"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("standardname_eng", "s", "" . ((isset($_POST["engstdname"])) ? $_POST["engstdname"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("standardcode", "s", "" . ((isset($_POST["standardcode"])) ? $_POST["standardcode"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("idarticletype", "i", "" . ((isset($_POST["idarticletype"])) ? $_POST["idarticletype"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("idarticlecharacteristic", "i", "" . ((isset($_POST["articlecharact"])) ? $_POST["articlecharact"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("virusset", "s", "" . ((isset($_POST["virusprotection"])) ? $_POST["virusprotection"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("chemicalsset", "s", "" . ((isset($_POST["chemicalagent"])) ? $_POST["chemicalagent"] : "") . "", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo ? rel2abs($InsertGoTo, dirname(__FILE__)) : "";
$InsertQuery->redirect($InsertGoTo);
}
?>
<?php
$standardlist = new WA_MySQLi_RS("standardlist", $cmctrfdb, 0);
$standardlist->setQuery("SELECT * FROM standards LEFT JOIN article_type ON article_type.idarticletype=standards.idarticletype LEFT JOIN article_characteristic ON article_characteristic.idarticlecharacteristic=standards.idarticlecharacteristic LEFT JOIN dpicategory ON dpicategory.iddpicategory=standards.iddpicategory ORDER BY standards.idarticletype, standards.standardcode");
$standardlist->execute();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?php echo $titlepage; ?> </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" />
<!-- submit form with button -->
<script>
function formSubmit() {
document.forms["myForm"].submit();
}
</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">
<!-- card for additional info gloves -->
<!--end card-body-->
<!-- card for show requirements -->
<div class="card">
<div class="card-body">
<h4 class="mt-0 header-title">Gestione Standards</h4>
<p class="text-muted mb-3">Da questa pagina puoi gestire gli standards e tutti i dati correlati</p>
<a href="add-standard.php"><button type="button" class="btn btn-primary waves-effect waves-light">ADD STANDARDS</button></a> <a href="admin-characteristic.php"><button type="button" class="btn btn-primary waves-effect waves-light">ADD CHARACTERISTIC</button></a>
<br><br>
<table class="table table-striped mb-0">
<thead>
<tr>
<th>Tipo Articolo</th>
<th>Standard</th>
<th>FM Code</th>
<th>Caratteristiche</th>
<th>Virus</th>
<th>Chemical</th>
<th>Active</th>
<th><?php echo $action; ?></th>
</tr>
</thead>
<tbody>
<?php
$wa_startindex = 0;
while (!$standardlist->atEnd()) {
$wa_startindex = $standardlist->Index;
?>
<tr>
<td><?php echo ($standardlist->getColumnVal("name_articletype")); ?></td>
<td><?php echo ($standardlist->getColumnVal("standardcode")); ?></td>
<td><?php echo ($standardlist->getColumnVal("fmidstandards")); ?></td>
<td><?php echo ($standardlist->getColumnVal("name_articlecharacteristic")); ?></td>
<td><?php
if ($standardlist->getColumnVal("virusset") == "Y") { ?>
<div class="col-sm-6 col-md-4 col-xl-3">
<i class="fas fa-check"></i>
</div>
<?php } ?>
</td>
<td><?php if ($standardlist->getColumnVal("chemicalsset") == "Y") { ?>
<div class="col-sm-6 col-md-4 col-xl-3">
<i class="fas fa-check"></i>
</div>
<?php } ?>
</td>
<td><?php echo ($standardlist->getColumnVal("active")); ?></td>
<td>
<a href="edit-standard.php?idstandards=<?php echo ($standardlist->getColumnVal("idstandards")); ?>" class="mr-2"><i class="fas fa-edit text-info font-16"></i></a>
<a href="edit-protcategory.php?idstandards=<?php echo ($standardlist->getColumnVal("idstandards")); ?>">PC</a>
<a href="edit-dpicategory.php?idstandards=<?php echo ($standardlist->getColumnVal("idstandards")); ?>">DC</a>
<a href="edit-requirements.php?idstandards=<?php echo ($standardlist->getColumnVal("idstandards")); ?>">REQ</a>
<!-- <a href="cancel-standard.php?idstd=<?php echo ($standardlist->getColumnVal("idstandards")); ?>"><i class="fas fa-trash-alt text-danger font-16"></i></a> -->
</td>
</tr>
<?php
$standardlist->moveNext();
}
$standardlist->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
</tbody>
</table>
</div><!--end card-body-->
</div><!--end card-->
</div><!--end col-->
</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>