<?php

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

<?php 

// pickup the get variable

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

	$idtrf=$_GET["idtrf"]; }

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

	$idtrf=$_POST["idtrf"]; }

//include('include/alertcheckquery.php');

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

	$code="4"; 

  $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 /*

	$conn = mysqli_connect($hostname_cmctrfdb, $username_cmctrfdb, $password_cmctrfdb, $database_cmctrfdb);

if (!$conn) {

    die("Connessione al database fallita: " . mysqli_connect_error());

}



// Controllo dei campi nulli



$sql = "SELECT COUNT(*) AS num_rows FROM trfstandards WHERE idtrfdetails = $idtrf AND (idprotectioncategory IS NULL OR iddpicategory IS NULL)";

$resultcat = mysqli_query($conn, $sql);

// Controllo degli errori

if (!$resultcat) {

    die("Errore nella query: " . mysqli_error($conn));

}

$row = mysqli_fetch_assoc($resultcat);

if ($row['num_rows'] > 0) {

    // Campi nulli trovati, torna alla pagina standardstep.php e mostra il messaggio di errore

    header("Location: standardstep.php?idtrf=$idtrf&error=tuttiicampidevonoesserericompilati");

    exit;

} */

?>

<?php

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

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

$trfnumberfinal->execute();

?>

<?php

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

$idtrf=$trfnumberfinal->getColumnVal("idtrfdetails");

?>

<?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();

?>

<!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"/>

						<!-- 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">

											<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: 60%;" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">60%</div>

											</div>

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

							<?php if ($trfnumberfinal->getColumnVal("idarticletype")=="2") { ?>

											<div class="card">

												<div class="card-body">

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

													</h4>

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

													</p>

													<form class="was-validated" action="addrequirements.php" method="post" name="myForm">

														<div class="checkbox my-2">

															<div class="custom-control custom-checkbox">

																<input type="checkbox" class="custom-control-input" id="virusprot" name="virusprot" data-parsley-multiple="groups" value="Y" data-parsley-mincheck="2" <?php if ($trfnumberfinal->getColumnVal("virusprotection")=='Y') { echo "checked"; } ?>>

																	<label class="custom-control-label" for="virusprot"><?php echo $virusprottitle; ?>

																	</label>

																</div>

															</div>

															<input type="hidden" name="addinfo" id="addinfo" 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 $nextsteptitle; ?>">

																				<a href="standardstep.php?idtrf=<?php echo $idtrf; ?>"

																				<button type="button" class="btn btn-dark waves-effect waves-light"><?php echo $backstep; ?>

																				</button>

																			</a>

																		</div>

																	</form>

																</div>

																<!--end card-body-->

							<?php } ?>

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

							<?php if ($trfnumberfinal->getColumnVal("idarticletype")=="1") { ?>

																<div class="card">

																	<div class="card-body">

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

																		</h4>

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

																		</p>

																		<form class="form-parsley" action="addrequirements.php" method="post" name="myForm">

																			<div class="form-group row">

																				<label class="col-sm-3 col-form-label"><?php echo $slippingtitle; ?>

																				</label>

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

																				        <select class="form-control" id="slipping" name="slipping">

																				                <option value="" <?php if (!(strcmp("", ($trfnumberfinal->getColumnVal("slipping"))))) {echo "selected=\"selected\"";} ?>>No</option>

																				                <option value="SR" <?php if (!(strcmp("SR", ($trfnumberfinal->getColumnVal("slipping"))))) {echo "selected=\"selected\"";} ?>>SR</option>

																				                <option value="SRA" <?php if (!(strcmp("SRA", ($trfnumberfinal->getColumnVal("slipping"))))) {echo "selected=\"selected\"";} ?>>SRA</option>

																				                <option value="SRB" <?php if (!(strcmp("SRB", ($trfnumberfinal->getColumnVal("slipping"))))) {echo "selected=\"selected\"";} ?>>SRB</option>

																				                <option value="SRC" <?php if (!(strcmp("SRC", ($trfnumberfinal->getColumnVal("slipping"))))) {echo "selected=\"selected\"";} ?>>SRC</option>

																					</select>

                                                                                        </select>

																				</div>

																			</div>

																			<div class="checkbox my-2">

																				<div class="custom-control custom-checkbox">

																					<input type="checkbox" class="custom-control-input" id="orthopedic" name="orthopedic" data-parsley-multiple="groups" value="Y" data-parsley-mincheck="2" <?php if ($trfnumberfinal->getColumnVal("shoesorthopedic")=='Y') { echo "checked"; } ?>>

																						<label class="custom-control-label" for="orthopedic"><?php echo $orthopedictitle; ?> (DGUV) 

																						</label>

																					</div>

																					<div class="custom-control custom-checkbox">

																						<input type="checkbox" class="custom-control-input" id="autoclavable" name="autoclavable" data-parsley-multiple="groups" value="Y" data-parsley-mincheck="2" <?php if ($trfnumberfinal->getColumnVal("autoclavable")=='Y') { echo "checked"; } ?>>

																							<label class="custom-control-label" for="autoclavable"><?php echo $autoclavabletitle; ?>

																							</label>

																						</div>

																						<div class="custom-control custom-checkbox">

																							<input type="checkbox" class="custom-control-input" id="esd" name="esd" data-parsley-multiple="groups" value="Y" data-parsley-mincheck="2" <?php if ($trfnumberfinal->getColumnVal("esd")=='Y') { echo "checked"; } ?>>

																								<label class="custom-control-label" for="esd"><?php echo $esdtitle; ?>

																								</label>

																							</div>

																							

																							</div>

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

																								<input type="hidden" name="idtrf" id="idtrf" value="<?php echo $idtrf; ?>">

																								<input type="hidden" name="codestep" id="codestep" value="4">

																									<br>

																										<br>

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

																												<a href="standardstep.php?idtrf=<?php echo $idtrf; ?>"

																												<button type="button" class="btn btn-dark waves-effect waves-light"><?php echo $backstep; ?>

																												</button>

																											</a>

																										</div>

																									</form>

																								</div>

																								<!--end card-body-->

							<?php } ?>

																							</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>