ppeasy/public/typeofcertificate6.php

936 lines
47 KiB
PHP

<?php
include('include/headscript.php');
include('db-connect.php');
?>
<?php
// pickup the current time and add the userid to have a temporary code
?>
<!DOCTYPE html>
<html lang="en">
<!-- recover variables from form or link -->
<?php
$varcertificate = "";
if (isset($_GET['varcertificate'])) {
$varcertificate = $_GET['varcertificate'];
}
?>
<?php
$idcertificate = 0;
if (isset($_GET['idcertificate'])) {
$idcertificate = $_GET['idcertificate'];
$certtype = $idcertificate;
}
?>
<?php //pickup variable post
if (isset($_POST["formname"])) {
$formname = $_POST["formname"];
} else {
$formname = "";
}
if (isset($_POST["kindofcontacts"])) {
$kindofcontacts = $_POST["kindofcontacts"];
}
if (isset($_POST["companyname"])) {
$companyname = $_POST["companyname"];
}
if (isset($_POST["piva"])) {
$piva = $_POST["piva"];
}
if (isset($_POST["companyaddress"])) {
$companyaddress = $_POST["companyaddress"];
}
if (isset($_POST["city"])) {
$city = $_POST["city"];
}
if (isset($_POST["cap"])) {
$cap = $_POST["cap"];
}
if (isset($_POST["country"])) {
$country = $_POST["country"];
}
if (isset($_POST["telephone"])) {
$telephone = $_POST["telephone"];
}
if (isset($_POST["email"])) {
$email = $_POST["email"];
}
if (isset($_POST["contactname"])) {
$contactname = $_POST["contactname"];
}
if (isset($_POST["contactsurname"])) {
$contactsurname = $_POST["contactsurname"];
}
if (isset($_POST["tempcode"])) {
$tempcode = $_POST["tempcode"];
}
if (isset($_GET["formnameme"])) {
$formnameme = $_GET["formnameme"];
}
if (isset($_GET["kindofcontacts"])) {
$kindofcontacts = $_GET["kindofcontacts"];
}
if (isset($_GET["idtrf"])) {
$idtrf = $_GET["idtrf"];
}
?>
<?php
$auditcontactcheck = new WA_MySQLi_RS("auditcontactcheck", $cmctrfdb, 1);
$auditcontactcheck->setQuery("SELECT contacts.idcontacts, contacts.kindofcontacts, contacts.idtrf FROM contacts WHERE contacts.idtrf='$idtrf'");
$auditcontactcheck->execute();
if (empty($auditcontactcheck->getColumnVal("idcontacts"))) {
if (!empty($companyData["idcompany"])) {
$companyid = $companyData["idcompany"];
} else {
$companyid = "";
}
if (!empty($companyData["companyname_company"])) {
$companyname = $companyData["companyname_company"];
} else {
$companyname = "";
}
if (!empty($companyData["piva_company"])) {
$companypiva = $companyData["piva_company"];
} else {
$companypiva = "";
}
if (!empty($companyData["address_company"])) {
$companyaddress = $companyData["address_company"];
} else {
$companyaddress = "";
}
if (!empty($companyData["city_company"])) {
$companycity = $companyData["city_company"];
} else {
$companycity = "";
}
if (!empty($companyData["zip_company"])) {
$companycap = $companyData["zip_company"];
} else {
$companycap = "";
}
if (!empty($companyData["country_company"])) {
$companycountry = $companyData["country_company"];
} else {
$companycountry = "";
}
if (!empty($companyData["telephone_company"])) {
$companytelephone = $companyData["telephone_company"];
} else {
$companytelephone = "";
}
if (!empty($companyData["email_company"])) {
$companyemail = $companyData["email_company"];
} else {
$companyemail = "";
}
if (!empty($companyData["maincontactname_company"])) {
$companycontactname = $companyData["maincontactname_company"];
} else {
$companycontactname = "";
}
if (!empty($companyData["maincontactsurname_company"])) {
$companycontactsurname = $companyData["maincontactsurname_company"];
} else {
$companycontactsurname = "";
}
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "contacts";
$InsertQuery->bindColumn("kindofcontacts", "s", "audit", "WA_DEFAULT");
$InsertQuery->bindColumn("companyname", "s", "$companyname", "WA_DEFAULT");
$InsertQuery->bindColumn("piva", "s", "$companypiva", "WA_DEFAULT");
$InsertQuery->bindColumn("address", "s", "$companyaddress", "WA_DEFAULT");
$InsertQuery->bindColumn("city", "s", "$companycity", "WA_DEFAULT");
$InsertQuery->bindColumn("cap", "s", "$companycap", "WA_DEFAULT");
$InsertQuery->bindColumn("country", "s", "$companycountry", "WA_DEFAULT");
$InsertQuery->bindColumn("telephone", "s", "$companytelephone", "WA_DEFAULT");
$InsertQuery->bindColumn("email", "s", "$companyemail", "WA_DEFAULT");
$InsertQuery->bindColumn("contactname", "s", "$companycontactname", "WA_DEFAULT");
$InsertQuery->bindColumn("contactsurname", "s", "$companycontactsurname", "WA_DEFAULT");
$InsertQuery->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery->bindColumn("companyid", "i", "$companyid", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo ? rel2abs($InsertGoTo, dirname(__FILE__)) : "";
$InsertQuery->redirect($InsertGoTo);
}
?>
<?php
if (isset($formnameme)) {
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "contacts";
$InsertQuery->bindColumn("kindofcontacts", "s", "$kindofcontacts", "WA_DEFAULT");
$InsertQuery->bindColumn("companyid", "s", "$idcompany", "WA_DEFAULT");
$InsertQuery->bindColumn("tempcode", "s", "$tempcode", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo ? rel2abs($InsertGoTo, dirname(__FILE__)) : "";
$InsertQuery->redirect($InsertGoTo);
}
?>
<?php
if ($formname == "addauditdpiins") {
$ndpicode = new WA_MySQLi_RS("ndpicode", $cmctrfdb, 1);
$ndpicode->setQuery("SELECT dpicode FROM auditdpi WHERE auditdpi.idtrfdetails='$idtrf' ORDER BY dpicode DESC LIMIT 1");
$ndpicode->execute();
if (!empty($ndpicode->getColumnVal("dpicode"))) {
$lastdpicode = $ndpicode->getColumnVal("dpicode");
$lastdpicode = $lastdpicode + 1;
} else {
$lastdpicode = "1";
}
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "auditdpi";
$InsertQuery->bindColumn("idtrfdetails", "i", "" . ((isset($_POST["idtrf"])) ? $_POST["idtrf"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("idcertificate", "i", "" . ((isset($_POST["certtypen"])) ? $_POST["certtypen"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("certificatenumber", "s", "" . ((isset($_POST["certififcatenumber"])) ? $_POST["certififcatenumber"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("issuebycimac", "s", "" . ((isset($_POST["issueby"])) ? $_POST["issueby"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("moduleselection", "s", "" . ((isset($_POST["modulesel"])) ? $_POST["modulesel"] : "") . "", "WA_DEFAULT");
$InsertQuery->bindColumn("dpicode", "i", "" . $lastdpicode . "", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo ? rel2abs($InsertGoTo, dirname(__FILE__)) : "";
$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");
$idcertificate = $idcertn;
$idarticletype = $trfnumberfinal->getColumnVal("idarticletype");
?>
<?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='$idtrfdetails'");
$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 surveillance type
$auditsurveillancelist = mysqli_query($con, "SELECT idauditsurveillancetype,surveillancenameit FROM auditsurveillancetype WHERE auditsurveillancetype.module='D' ");
$idauditsurveillancetypeRecord = array();
while ($idauditsurveillancetyperow = mysqli_fetch_assoc($auditsurveillancelist)) {
$idauditsurveillancetypeRecord[$idauditsurveillancetyperow['idauditsurveillancetype']] = $idauditsurveillancetyperow['surveillancenameit'];
}
$idsurveillancelistJson = json_encode($idauditsurveillancetypeRecord);
?>
<?php
$row1 = mysqli_query($con, "SELECT * FROM auditdpi LEFT JOIN auditsurveillancetype ON auditsurveillancetype.idauditsurveillancetype=auditdpi.moduleselection WHERE auditdpi.idtrfdetails='$idtrfdetails'");
$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);
?>
<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">
<!-- 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" />
<!-- <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="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
function formSubmit() {
document.forms["myForm"].submit();
}
</script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
<script src="jquery.tabledit.js"></script>
<script>
function showshow1() {
document.getElementById('div1').style.display = 'none';
}
function show2() {
document.getElementById('div1').style.display = 'block';
}
function show3() {
document.getElementById('div3').style.display = 'none';
}
function show4() {
document.getElementById('div3').style.display = 'block';
}
function show5() {
document.getElementById('div5').style.display = 'none';
}
function show6() {
document.getElementById('div5').style.display = 'block';
}
</script>
<script>
$(document).ready(function() {
$("#alertcertification").modal('show');
});
</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;
}
.file-upload {
display: none !important;
}
.uploadfile {
cursor: pointer;
color: #fff;
background-color: #0d6efd;
border-color: #0d6efd;
padding: 0.375rem 0.75rem;
}
.table tbody .for-add:nth-child(1) {
display: none;
}
.flashing-green {
background-color: #d4edda;
/* Verde chiaro */
transition: background-color 0.5s ease;
}
</style>
<style>
body {
font-family: arial;
}
.hide {
display: none;
}
p {
font-weight: bold;
}
</style>
<link rel="stylesheet" href="../webassist/jq_validation/Serene.css" />
</head>
<body>
<!-- Alert certificate routine -->
<?php
include('include/alertcert.php'); ?>
<!-- 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 <?php //echo $tempcode;
?></a></li>
<li class="breadcrumb-item active">Starter</li>
</ol>
</div>
<h3 class="page-title"><?php echo $titlewb; ?></h3>
</div><!--end page-title-box-->
</div><!--end col-->
</div>
<div class="row">
<div class="col-sm-12">
<div class="card">
<div class="card-body">
<button type="button" class="btn btn-purple btn-square btn-outline-dashed waves-effect waves-light"><i class="mdi mdi-arrow-right-bold"></i> <?php echo $kindcertificatetitle; ?></button><br>
<br>
<h4 class="mt-0 header-title"><?php echo $typeofcertificate_question; ?></h4>
<p class="text-muted mb-3"><?php echo $typeofcertificate_help; ?></p>
<!-- certificate 1st question-->
<?php if ($varcertificate == "md") { ?>
<div class="progress mb-4">
<div class="progress-bar" role="progressbar" style="width: 5%;" aria-valuenow="5" aria-valuemin="0" aria-valuemax="100">5%</div>
</div>
<div name="1stquestion" class="alert alert-light text-muted mb-0" role="alert">
<h4 class="alert-heading font-18 text-dark"><?php echo $insertintermediatecontact; ?></h4>
<?php echo $fabbricantehelp; ?><br><br>
<form action="typeofcertificate.php?varcertificate=0" method="post" class="was-validated">
<!-- intermediate means that the certificate is request for the intermediate -->
<?php $kindofcontacts = "intermediate";
include('include/contactform.php'); ?>
</form>
</div>
<?php } ?>
<!-- certificate 1st questioon-->
<?php if ($varcertificate == "0") { ?>
<div class="progress mb-4">
<div class="progress-bar" role="progressbar" style="width: 5%;" aria-valuenow="5" aria-valuemin="0" aria-valuemax="100">5%</div>
</div>
<div name="1stquestion" class="alert alert-light text-muted mb-0" role="alert">
<h4 class="alert-heading font-18 text-dark"><?php echo $questionm16m30s; ?></h4>
<p><?php echo $questionm16m30s_help; ?></p>
<a href="typeofcertificate.php?varcertificate=1"> <button type="button" class="btn btn-success waves-effect waves-light"><?php echo $yes; ?></button></a>
<a href="typeofcertificate.php?varcertificate=m"><button type="button" class="btn btn-danger waves-effect waves-light"><?php echo $no; ?></button></a>
</div>
<?php } ?>
<!-- certificate m16 + m30s -->
<?php if ($varcertificate == "1") { ?>
<div class="progress mb-4">
<div class="progress-bar" role="progressbar" style="width: 20%;" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">20%</div>
</div>
<div name="1stquestion" class="alert alert-light text-muted mb-0" role="alert">
<h4 class="alert-heading font-18 text-dark"><?php echo $certificatem16m30svar; ?> <i class="fas fa-info-circle" data-toggle="modal" data-animation="bounce" data-target=".bs-example-modal-center5"></i></h4>
<div class="modal fade bs-example-modal-center5" 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 $variationhelp_ia; ?><br><br>
<?php echo $variationhelp_ib; ?><br><br>
<?php echo $variationhelp_ic; ?>
</p>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<p><?php echo $certificatem16m30s_help; ?></p>
<a href="typeofcertificate.php?varcertificate=1b&idcertificate=7"> <button type="button" class="btn btn-success waves-effect waves-light"><?php echo $yes; ?></button></a>
<a href="typeofcertificate.php?varcertificate=1a&idcertificate=1"><button type="button" class="btn btn-danger waves-effect waves-light"><?php echo $no; ?></button></a>
</div>
<?php } ?>
<!-- confirm certificate M18A -->
<?php if ($idcertificate == "6") { ?>
<?php
$certtype = new WA_MySQLi_RS("certtype", $cmctrfdb, 1);
$certtype->setQuery("SELECT * FROM certificationtype WHERE certificationtype.idcertificationtype='$idcertificate'");
$certtype->execute(); ?>
<?php
$auditsurvtype = new WA_MySQLi_RS("auditsurvtype", $cmctrfdb, 0);
$auditsurvtype->setQuery("SELECT * FROM auditsurveillancetype WHERE auditsurveillancetype.`module`='D'");
$auditsurvtype->execute();
?>
<div class="progress mb-4">
<div class="progress-bar" role="progressbar" style="width: 20%;" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">20%</div>
</div>
<div>
<h4 class="alert-heading font-18 text-dark"><?php echo $certificatem18a; ?></h4>
<p><?php echo $certificatem18a_help; ?></p><br>
<!-- Dropdown per il tipo di certificazione con larghezza ridotta -->
<div class="form-group" style="max-width: 300px;">
<label for="certificationtype"><strong><?php echo $certificationtypedtitle; ?></strong></label>
<select id="certificationtype" name="certificationtype" class="form-control">
<option value=""><?php echo $pleaseselect; ?></option>
<option value="1" <?php echo ($trfnumberfinal->getColumnVal("certificationtyped") == 1) ? 'selected' : ''; ?>><?php echo $certd_1; ?></option>
<option value="2" <?php echo ($trfnumberfinal->getColumnVal("certificationtyped") == 2) ? 'selected' : ''; ?>><?php echo $certd_2; ?></option>
<option value="3" <?php echo ($trfnumberfinal->getColumnVal("certificationtyped") == 3) ? 'selected' : ''; ?>><?php echo $certd_3; ?></option>
<option value="4" <?php echo ($trfnumberfinal->getColumnVal("certificationtyped") == 4) ? 'selected' : ''; ?>><?php echo $certd_4; ?></option>
</select>
</div>
<form action="trfdetails.php" method="get" class="was-validated" name="myForm">
<input name="certtype" type="hidden" id="certtype" value="<?php echo ($certtype->getColumnVal("idcertificationtype")); ?>">
<input name="tempcode" type="hidden" id="tempcode" value="<?php echo $tempcode; ?>">
<?php echo $prevcertificatehelp; ?><br>
<br>
<p><?php echo $auditcompanylocation; ?></p>
<?php
$auditcontactlist = new WA_MySQLi_RS("auditcontactlist", $cmctrfdb, 0);
$auditcontactlist->setQuery("SELECT * FROM contacts WHERE contacts.idtrf='$idtrf' AND contacts.kindofcontacts='audit'");
$auditcontactlist->execute();
?>
<table class="table mb-0">
<thead>
<tr>
<th><?php echo $anagraficacompany; ?></th>
<th><?php echo $anagraficaaddress; ?></th>
<th><?php echo $anagraficacity; ?></th>
<th><?php echo "Action"; ?></th>
</tr>
</thead>
<tbody>
<?php while (!$auditcontactlist->atEnd()) { ?>
<tr>
<td><?php echo $auditcontactlist->getColumnVal("companyname"); ?></td>
<td><?php echo $auditcontactlist->getColumnVal("address"); ?></td>
<td><?php echo $auditcontactlist->getColumnVal("city"); ?></td>
<td>
<!-- Pulsante di modifica -->
<a class="badge_btn" onclick="window.open('contactpopaudit.php?kindcontacts=audit&idtrf=<?php echo $idtrf; ?>&idcontacts=<?php echo ($auditcontactlist->getColumnVal("idcontacts")); ?>', '_blank', 'location=yes,height=950,width=1400,scrollbars=yes,status=yes');">
<button type="button" class="btn btn-primary waves-effect waves-light">MODIFICA</button>
</a>
<!-- Pulsante di eliminazione (cestino) -->
<button type="button" class="btn btn-danger waves-effect waves-light delete-contact" data-id="<?php echo $auditcontactlist->getColumnVal('idcontacts'); ?>">
<i class="fas fa-trash-alt"></i>
</button>
</td>
</tr>
<?php
$auditcontactlist->moveNext();
}
?>
</tbody>
</table> <br>
<!-- Pulsante per aggiungere un nuovo contatto -->
<a class="badge_btn" onclick="window.open('contactpopaudit.php?kindcontacts=audit&idtrf=<?php echo $idtrf; ?>&add_new_contact=1', '_blank', 'location=yes,height=950,width=1400,scrollbars=yes,status=yes');">
<button type="button" class="btn btn-success waves-effect waves-light">AGGIUNGI</button>
</a>
<br>
<!-- <div class="form-group row">
<label for="example-text-input" class="col-sm-4 col-form-label text-right"><?php echo $dpinumbersurveillance; ?></label>
<div class="col-sm-3">
<input class="form-control" type="text" id="previousrepnumber" name="previousrepnumber">
</div>
</div>
<div class="form-group mb-0 row">
<label class="col-md-3 my-1 control-label"><?php echo $issuebycimac; ?></label>
<div class="col-md-9">
<div class="form-check-inline my-1">
<div class="custom-control custom-radio">
<input type="radio" id="customRadio7" name="issuebycimac" class="custom-control-input" value="Y" checked="checked">
<label class="custom-control-label" for="customRadio7"><?php echo $yestitle; ?></label>
</div>
</div>
<div class="form-check-inline my-1">
<div class="custom-control custom-radio">
<input type="radio" id="customRadio8" name="issuebycimac" class="custom-control-input" value="N">
<label class="custom-control-label" for="customRadio8"><?php echo $notitle; ?></label>
</div>
</div>
</div>
</div><br>
<div class="form-group">
<label for="surveillanceoption"><?php echo $surveillancec2option; ?></label>
<select class="form-control col-md-6" id="surveillanceoption" name="surveillanceoption">
<option selected value="option1"><?php echo $surveillancec2option1; ?></option>
<option value="option2"><?php echo $surveillancec2option2; ?></option>
<option value="option3"><?php echo $surveillancec2option3; ?></option>
</select>
</div><br>
<div class="form-group mb-0 row">
<label class="col-md-6 my-1 control-label"><?php echo $samplestoredtitle; ?></label>
<div class="col-md-2">
<div class="form-check-inline my-1">
<div class="custom-control custom-radio">
<input type="radio" id="samplestorey" name="samplestore" class="custom-control-input" value="Y" checked="checked">
<label class="custom-control-label" for="samplestorey"><?php echo $yestitle; ?></label>
</div>
</div>
<div class="form-check-inline my-1">
<div class="custom-control custom-radio">
<input type="radio" id="samplestoren" name="samplestore" class="custom-control-input" value="N">
<label class="custom-control-label" for="samplestoren"><?php echo $notitle; ?></label>
</div>
</div>
</div>
</div><br>
-->
</form>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<h4 class="mt-0 header-title"><?php echo $auditdpilistcreate; ?></h4>
<form class="needs-validation" id="addauditdpi" name="addauditdpi" action="#" method="post" novalidate="">
<div class="form-row">
<div class="col-md-3 mb-2">
<label for="certififcatenumber"><?php echo $certificatenumbertitle; ?></label>
<input type="text" class="form-control" id="certififcatenumber" name="certififcatenumber" placeholder="" value="" required="">
</div><!--end col-->
<div class="col-md-3 mb-2">
<label for="issueby"><?php echo $issuebycimactitle; ?></label>
<div class="custom-control custom-checkbox">
<input type="checkbox" id="issueby" name="issueby" value="yes">
</div>
</div><!--end col-->
<div class="col-md-3 mb-2">
<label for="validationCustomUsername"><?php echo $moduleselectiontitle; ?></label>
<div class="input-group">
<div class="col-sm-10">
<select class="form-control" id="modulesel" name="modulesel">
<option value=""><?php echo $selecttitlepartform; ?></option>
<?php
while (!$auditsurvtype->atEnd()) { //dyn select
?>
<option value="<?php echo ($auditsurvtype->getColumnVal("idauditsurveillancetype")); ?>"><?php echo ($auditsurvtype->getColumnVal("surveillancenameit")); ?></option>
<?php
$auditsurvtype->moveNext();
} //dyn select
$auditsurvtype->moveFirst();
?>
</select>
</div>
</div>
</div><!--end col-->
</div><!--end form-row-->
<!--end form-row-->
<input type="hidden" id="idtrf" name="idtrf" value="<?php echo $idtrf; ?>">
<input type="hidden" id="certtypen" name="certtypen" value="6">
<input type="hidden" id="formname" name="formname" value="addauditdpiins">
<button class="btn btn-gradient-primary" type="submit"><?php echo $insertauditdpi; ?></button>
</form> <!--end form-->
</div><!--end card-body-->
</div>
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h5><?php echo $auditdpilistcreate; ?></h4>
<p class="text-muted mb-3">
<?php //echo $assignedstd_help;
?>.
</p>
<div class="table-responsive" id="dpiauditadd">
<form style="display:none;">
<div id="dropBox">
</div>
<input type="file" name="fileInput" id="fileInput" />
</form>
<div class="panel panel-default">
<div class="panel-body">
<br>
<table class="table" id="auditdpitable" style="border:1px solide red">
<thead>
<tr>
<th style="display:none;">id</th>
<th style="display:none;">idtrfdetails</th>
<th><?php echo $certificatenumbertitle; ?></th>
<th><?php echo $issuebycimactitle; ?></th>
<th><?php echo $moduleselectiontitle; ?></th>
<th></th>
<th><?php echo $suppliernametitle; ?></th>
<th></th>
</tr>
</thead>
<tbody>
<?php while ($row = mysqli_fetch_assoc($row1)) { ?>
<tr>
<td style="display:none;"><?php echo $row['idauditdpi']; ?></td>
<td style="display:none;"><?php echo $row['idtrfdetails']; ?></td>
<td><?php echo $row['certificatenumber']; ?></td>
<td><?php if ($row['issuebycimac'] == 'yes') { ?><?php echo $yessent; ?><?php } else { ?><?php echo $nosent; ?><?php } ?></td>
<td><?php echo $row['surveillancenameit']; ?></td>
<td></td>
<td style="display:none;"><?php echo $row['idtrfdetails']; ?></td>
<td class="tabledit-view-mode"><?php if ($row['issuebycimac'] != 'yes') { ?><a class="badge_btn" onclick="window.open('uploaddoc.php?idtrf=<?php echo $idtrf; ?>&idauditdpi=<?php echo $row['idauditdpi']; ?>', '_blank', 'location=yes,height=650,width=700,scrollbars=yes,status=yes');"><button type="button" class="btn btn-primary waves-effect waves-light"><i class="fas fa-plus-square"></i></button></a><?php } else { ?><button type="button" class="btn btn-info waves-effect waves-light"><i class="fas fa-stop-circle"></i></button><?php } ?></td>
<td><a href="deleteauditdpi6.php?idauditdpi=<?php echo $row['idauditdpi']; ?>&idtrf=<?php echo $idtrf; ?>"><i class="fas fa-trash-alt text-danger font-16"></i></a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<a href="adddocument.php?idtrf=<?php echo $idtrf; ?>&codestep=<?php echo '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>
<!--end /table-->
</div><!--end /tableresponsive-->
</div><!--end card-body-->
</div><!--end card-->
</div>
<?php } ?> <!-- close confirm -->
</div>
<!--end form-->
</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 -->
<script>
$(document).ready(function() {
// Quando si clicca sul pulsante di eliminazione
$('.delete-contact').on('click', function() {
var contactId = $(this).data('id');
var row = $(this).closest('tr'); // Memorizza la riga da rimuovere
// Utilizza SweetAlert per conferma
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
// Invia la richiesta AJAX per eliminare il contatto
$.ajax({
url: 'delete_contact.php', // Il file PHP che esegue l'eliminazione
type: 'POST',
data: {
idcontacts: contactId
},
success: function(response) {
if (response === 'success') {
// Rimuovi la riga dalla tabella
row.remove();
// Mostra messaggio di successo con SweetAlert
Swal.fire(
'Deleted!',
'The contact has been deleted.',
'success'
);
} else {
Swal.fire(
'Error!',
'Failed to delete the contact.',
'error'
);
}
},
error: function() {
Swal.fire(
'Error!',
'An error occurred while deleting the contact.',
'error'
);
}
});
}
});
});
});
</script>
<script>
// Funzione per aggiornare il dropdown e flashare in verde
function flashGreen() {
var dropdown = document.getElementById('certificationtype');
dropdown.classList.add('flashing-green');
// Rimuovi la classe dopo 2 secondi
setTimeout(function() {
dropdown.classList.remove('flashing-green');
}, 2000);
}
// Funzione per inviare l'aggiornamento tramite AJAX
function updateCertificationType() {
var certificationType = document.getElementById('certificationtype').value;
var idtrf = <?php echo $idtrf; ?>; // ID del trf (puoi usare la variabile PHP)
// Esegui la chiamata AJAX
var xhr = new XMLHttpRequest();
xhr.open("POST", "update_certificationtype.php", true); // Nome del file PHP che gestirà l'aggiornamento
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
// Funzione di callback al termine dell'aggiornamento
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
// Dopo l'aggiornamento, flash verde
flashGreen();
}
};
// Invio dei dati al server
xhr.send("certificationtype=" + certificationType + "&idtrf=" + idtrf);
}
// Ascolta il cambio del valore del dropdown
document.getElementById('certificationtype').addEventListener('change', function() {
updateCertificationType();
});
</script>
<!-- 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>
<!-- Parsley js -->
<script src="../../plugins/parsleyjs/parsley.min.js"></script>
<script src="../assets/pages/jquery.validation.init.js"></script>
</body>
</html>