ppeasy/public/identificationparts.php
2025-02-17 14:26:18 +01:00

902 lines
55 KiB
PHP

<?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["materialpartvalue"])) {
$materialpartvalue = $_POST["materialpartvalue"];
} else {
$materialpartvalue = "";
}
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["reportof"])) {
$reportof = $_POST["reportof"];
} else {
$reportof = "";
}
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["arttypeid"])) {
$arttypeid = $_POST["arttypeid"];
} else {
$arttypeid = "";
}
if (isset($_POST["partid"])) {
$partid = $_POST["partid"];
} else {
$partid = "";
}
if (isset($_POST["useridn"])) {
$useridn = $_POST["useridn"];
} else {
$useridn = "";
}
if (isset($_POST["companyidn"])) {
$companyidn = $_POST["companyidn"];
} else {
$companyidn = "";
}
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");
$modelidart = $trfnumberfinal->getColumnVal("model");
?>
<?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("material_identificationparts", "s", "$materialpartvalue", "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("reportof", "s", "$reportof", "WA_DEFAULT");
$InsertQuery->bindColumn("idtrfdetails", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery->bindColumn("kindoftest", "s", "$kindoftest", "WA_DEFAULT");
$InsertQuery->bindColumn("partsidnumber", "s", "$partid", "WA_DEFAULT");
$InsertQuery->bindColumn("arttypeid", "i", "$arttypeid", "WA_DEFAULT");
$InsertQuery->bindColumn("useridn", "i", "$useridn", "WA_DEFAULT");
$InsertQuery->bindColumn("companyidn", "i", "$companyidn", "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' ORDER BY identificationparts.partsidnumber ");
$listinsertedpart->execute();
?>
<?php
// Definisci la variabile $conn come connessione al database
$connpart = mysqli_connect($hostname_cmctrfdb, $username_cmctrfdb, $password_cmctrfdb, $database_cmctrfdb);
// Esegui la query SQL per selezionare i dati
$searchhighlightpart = "SELECT DISTINCT partsidnumber FROM identificationparts WHERE identificationparts.idtrfdetails='$idtrf'";
$resultpart = mysqli_query($connpart, $searchhighlightpart);
// Crea un array vuoto per contenere i dati
//$partids = array();
?>
<?php
// Scansiona i risultati della query e aggiungi i valori della colonna "partid" all'array
while ($row = mysqli_fetch_assoc($resultpart)) {
$partids[] = $row['partsidnumber'];
}
$partids[] = '0';
// Stampa l'array per verificare i valori
?>
<?php if ($idcertn == '2') {
header("Location: adddocument.php?idtrf=$idtrf");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?php echo $titlepage; ?>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" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@10.16.6/dist/sweetalert2.min.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10.16.6/dist/sweetalert2.min.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>
<style>
input[data-readonly] {
pointer-events: none;
}
img[usemap] {
border: none;
height: auto;
max-width: 90%;
width: auto;
}
</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);"><?php echo $titlepage; ?></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 class="card">
<div class="card-body">
<h4 class="mt-0 header-title"><?php echo $newtesttitle; ?> <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 nl2br($newtestparthelp); ?>
</p>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<p class="text-muted mb-3"><?php echo $newtesttitle_help; ?>
</p>
<form class="was-validated" action="" method="post" name="myFormone">
<!-- image section -->
<?php
if ($idarticletype != 4) {
include('include/maparticle.php');
} else {
include('include/maparticleinduments.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 $reportnumbercmctitle; ?></label>
<input type="text" required="" 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="" onkeydown="return false" 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; ?>" value="<?php echo $companyData["companyname_company"]; ?>" disabled>
</div>
</div>
<div class="form-row">
<div class="col-md-3 mb-2">
<label for="validationServer01"><?php echo $descriptionpart; ?> </label>
<input type="text" required data-readonly class="form-control is-valid" id="descriptionpartvalue" name="descriptionpartvalue" placeholder="<?php echo $descriptionpart; ?>">
<b>Att </b><i><?php echo $addpartphoto; ?></i>
</div>
<div class="col-md-3 mb-2">
<label for="validationServer02"><?php echo $articlepart; ?></label>
<i class="fas fa-info-circle" data-toggle="modal" data-animation="bounce" data-target=".bs-example-modal-center5"></i>
<input type="text" class="form-control is-valid" id="articlepartvalue" name="articlepartvalue" required placeholder="<?php echo $articlepart; ?>" required="">
<b>Ex: </b><i><?php echo $searchsentence; ?></i>
</div>
<input type="hidden" id="partid" name="partid">
<input type="hidden" id="arttypeid" name="arttypeid" value="<?php echo $idarticletype; ?>">
<input type="hidden" id="useridn" name="useridn" value="<?php echo $iduserlog; ?>">
<input type="hidden" id="companyidn" name="companyidn" value="<?php echo $idcompany; ?>">
<div class="col-md-3 mb-2">
<label for="validationServer01"><?php echo $descriptionitem; ?> </label>
<i class="fas fa-info-circle" data-toggle="modal" data-animation="bounce" data-target=".bs-example-modal-center5"></i>
<input type="text" class="form-control is-valid" id="materialpartvalue" name="materialpartvalue" required placeholder="<?php echo $descriptionitem; ?>" required="">
</div>
<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 $articlealert; ?><br><br>
</p>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="col-md-3 mb-2">
<label for="validationServerUsername"><?php echo $colorpart; ?></label>
<div class="input-group">
<div class="input-group-prepend">
</div>
<input id="colorvalue" name="colorvalue" required class="form-control" type="text" placeholder="<?php echo $colorpart; ?>" aria-describedby="inputGroupPrepend3" required="">
<!-- <script>
setTimeout(function(){
$("#colorvalue").spectrum({
showPalette: true,
showPaletteOnly: true,
palette: [
["Red","Cyan","Blue","DarkBlue","LightBlue","Purple"],
["Yellow","Lime","Magenta","Pink","White","Silver"],
["Gray","Black","Orange","Brown","Green"],
["Olive","Aquamarine"]
]
});
}, 1000);
</script> -->
<input type="hidden" name="idtrf" id="idtrf" value="<?php echo ($trfnumberfinal->getColumnVal("idtrfdetails")); ?>">
<input type="hidden" name="addpart" id="addpart" value="Y">
</div>
</div>
</div>
<div id="display"></div>
<!-- <input type="button" onclick="formSubmit()" class="btn btn-gradient-success waves-effect waves-light" value="<?php echo $addpartbutton; ?>"> -->
<input type="submit" class="btn btn-gradient-success waves-effect waves-light" value="<?php echo $addpartbutton; ?>">
</form>
</div>
<!--end card-body-->
</div>
<!-- end -->
<script>
function formSubmit2() {
document.forms["myFormtwo"].submit();
}
</script>
<!-- div CMC parts -->
<!--end card-->
</div>
<!--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; ?><br>
new=<?php echo $newpartlist; ?>, cmc=<?php echo $cmctesttitle; ?> trd=<?php echo $trdpartlist; ?>
</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">SN</th>
<th class="sorting_asc" tabindex="0" aria-controls="datatable" rowspan="1" colspan="1" style="width: 5%" aria-sort="ascending" aria-label="Name: activate to sort column descending">
N.
</th>
<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">
Parte
</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: 108px" aria-label="Office: activate to sort column ascending">
Descrizione
</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 text-center" 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 class="tr_<?php echo $listinsertedpart->getColumnVal("partsidnumber"); ?>">
<!-- IDENTIFIER -->
<td><?php echo $listinsertedpart->getColumnVal("partsidnumber"); ?>_<?php echo $listinsertedpart->getColumnVal("ididentificationparts"); ?></td>
<td>
<?php echo $listinsertedpart->getColumnVal("partsidnumber"); ?>
</td>
<td>
<?php
if (($listinsertedpart->getColumnVal("kindoftest")) == 'new') {
echo $newpartlist;
}
if (($listinsertedpart->getColumnVal("kindoftest")) == 'cmc') {
echo $cmcpartlist;
}
if (($listinsertedpart->getColumnVal("kindoftest")) == 'trd') {
echo $trdpartlist;
}
?>
</td>
<td><?php echo $listinsertedpart->getColumnVal("description_identificationparts"); ?></td>
<td><?php echo $listinsertedpart->getColumnVal("article_identificationparts"); ?></td>
<td><?php echo $listinsertedpart->getColumnVal("material_identificationparts"); ?></td>
<td><?php echo $listinsertedpart->getColumnVal("color_identificationparts"); ?></td>
<td><?php echo $listinsertedpart->getColumnVal("cmcreportnumber_identificationparts"); ?></td>
<td id="td_reportdate_<?php echo $listinsertedpart->getColumnVal("partsidnumber"); ?>_<?php echo $listinsertedpart->getColumnVal("ididentificationparts"); ?>" parts-id-no="<?php echo $listinsertedpart->getColumnVal("partsidnumber"); ?>" current-val="<?php echo ($listinsertedpart->getColumnVal("cmcreportdate_identificationparts") <> '') ? date("m/d/Y", strtotime($listinsertedpart->getColumnVal("cmcreportdate_identificationparts"))) : ""; ?>"><?php echo ($listinsertedpart->getColumnVal("cmcreportdate_identificationparts") <> '') ? date("m/d/Y", strtotime($listinsertedpart->getColumnVal("cmcreportdate_identificationparts"))) : ''; ?></td>
<!-- <td class="text-center">
<a style="display:none; cursor:pointer;" title="Save" id="btn_save_<?php echo $listinsertedpart->getColumnVal("partsidnumber"); ?>" onclick="highlight_row(<?php echo $listinsertedpart->getColumnVal('partsidnumber'); ?>);"><i class="fas fa-check text-success font-16"></i></a>
<a href="deleteidentparts.php?ididentpart=<?php echo ($listinsertedpart->getColumnVal("ididentificationparts")); ?>&idtrf=<?php echo $idtrf; ?>"><i class="fas fa-trash-alt text-danger font-16"></i></a>
</td> -->
</tr>
<!-- <tr role="row" class="odd">
<td tabindex="0" class="sorting_1" style="width:5%">
<span class="text-x"><?php echo ($listinsertedpart->getColumnVal("partsidnumber")); ?></span>
<span class="input-x hidden-x">
<input type="text" class="form-control" name="partsidnumber" value="<?php echo ($listinsertedpart->getColumnVal("partsidnumber")); ?>">
</span>
</td>
<td tabindex="0" class="sorting_1">
<span class="text-x"><?php if (($listinsertedpart->getColumnVal("kindoftest")) == 'new') {
echo $newpartlist;
}
if (($listinsertedpart->getColumnVal("kindoftest")) == 'cmc') {
echo $cmcpartlist;
}
if (($listinsertedpart->getColumnVal("kindoftest")) == 'trd') {
echo $trdpartlist;
} ?> </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="">
<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("material_identificationparts")); ?></span>
<span class="input-x hidden-x">
<input type="text" class="form-control" name="material_identificationparts" value="<?php echo ($listinsertedpart->getColumnVal("material_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="input-x hidden-x">
</span>
</td>
<td tabindex="0" class="sorting_1">
<span class="text-x"><?php echo ($listinsertedpart->getColumnVal("cmcreportdate_identificationparts")); ?></span>
<span class="input-x hidden-x">
<input type="date" class="form-control" name="cmcreportdate_identificationparts" value="<?php echo ($listinsertedpart->getColumnVal("cmcreportdate_identificationparts")); ?>">
</span>
</td>
<td>
<a href="deleteidentparts.php?ididentpart=<?php echo ($listinsertedpart->getColumnVal("ididentificationparts")); ?>&idtrf=<?php echo $idtrf; ?>"><i class="fas fa-trash-alt text-danger font-16"></i></a>
</td>
</tr> -->
<?php
$listinsertedpart->moveNext();
}
$listinsertedpart->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
</tbody>
</table>
<br>
<?php
// for shoes
// Define the mandatory parts
$hivis = isset($hivis) ? $hivis : 'N';
$mandatoryParts = array();
if ($idarticletype == '1') {
$mandatoryParts = array(4, 11);
$totalparthighlight = array(1, 2, 4, 5, 7, 8, 10, 11, 12, 13, 14, 15, 16, 18, 19);
} elseif ($idarticletype == '2') {
$mandatoryParts = array(2, 3);
$totalparthighlight = array(2, 3, 4);
} elseif ($idarticletype == '3') {
$totalparthighlight = array(1, 2, 3, 4, 5, 6);
} elseif ($idarticletype == '4' && $modelidart == '11') {
//camice
$mandatoryParts = array(1);
$totalparthighlight = array(1, 2, 3, 4, 5);
} elseif ($idarticletype == '4' && $modelidart == '12' && $hivis == 'N') {
// felpa
$mandatoryParts = array(1);
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7);
} elseif ($idarticletype == '4' && $modelidart == '12' && $hivis == 'Y') {
// felpa hivis
$mandatoryParts = array('FM', 'RM');
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7, 'FM', 'RM');
} elseif ($idarticletype == '4' && $modelidart == '13' && $hivis == 'N') {
// giacca
$mandatoryParts = array(1);
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7);
} elseif ($idarticletype == '4' && $modelidart == '13' && $hivis == 'Y') {
// giacca hivis
$mandatoryParts = array('FM', 'RM');
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7, 'FM', 'RM');
} elseif ($idarticletype == '4' && $modelidart == '14' && $hivis == 'N') {
// gilet
$mandatoryParts = array(1);
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7);
} elseif ($idarticletype == '4' && $modelidart == '14' && $hivis == 'Y') {
// gilet hivis
$mandatoryParts = array('FM', 'RM');
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7, 'FM', 'RM');
} elseif ($idarticletype == '4' && $modelidart == '15' && $hivis == 'N') {
// pantaloni
$mandatoryParts = array(1, 3);
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7);
} elseif ($idarticletype == '4' && $modelidart == '15' && $hivis == 'Y') {
// pantaloni hivis
$mandatoryParts = array('FM', 'RM');
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7, 'FM', 'RM');
} elseif ($idarticletype == '4' && $modelidart == '16' && $hivis == 'N') {
// salopette
$mandatoryParts = array(1, 3);
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7);
} elseif ($idarticletype == '4' && $modelidart == '16' && $hivis == 'Y') {
// salopette hivis
$mandatoryParts = array('FM', 'RM');
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7, 'FM', 'RM');
} elseif ($idarticletype == '4' && $modelidart == '17' && $hivis == 'N') {
// shirt
$mandatoryParts = array(1);
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7);
} elseif ($idarticletype == '4' && $modelidart == '17' && $hivis == 'Y') {
// shirt hivis
$mandatoryParts = array('FM', 'RM');
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7, 'FM', 'RM');
} elseif ($idarticletype == '4' && $modelidart == '18' && $hivis == 'N') {
// t-shirt
$mandatoryParts = array(1);
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7);
} elseif ($idarticletype == '4' && $modelidart == '18' && $hivis == 'Y') {
// t-shirt hivis
$mandatoryParts = array('FM', 'RM');
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7, 'FM', 'RM');
} elseif ($idarticletype == '4' && $modelidart == '18' && $hivis == 'N') {
// tuta
$mandatoryParts = array(1, 8);
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7, 8, 9);
} elseif ($idarticletype == '4' && $modelidart == '18' && $hivis == 'Y') {
// tuta hivis
$mandatoryParts = array('FM', 'RM');
$totalparthighlight = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 'FM', 'RM');
}
$diffparts = array_diff($totalparthighlight, $partids);
$missingMandatoryParts = array_intersect($mandatoryParts, $diffparts);
echo '<button onclick="checkParts()" class="btn btn-success waves-effect waves-light">' . $nextsteptitle . '</button>';
echo '<script>
function checkParts() {
var missingMandatoryParts = ' . json_encode(array_values($missingMandatoryParts)) . ';
var missingParts = ' . json_encode(array_values($diffparts)) . ';
if (missingMandatoryParts.length > 0) {
Swal.fire({
icon: "error",
title: "Parti Obbligatorie Mancanti/Missing Mandatory Parts",
text: "Le seguenti parti sono obbligatorie e devono essere inserite/The following parts are mandatory and must be included: " + missingMandatoryParts.join(", "),
confirmButtonText: "OK"
});
} else if (missingParts.length > 0) {
Swal.fire({
icon: "warning",
title: "' . $titlealertstd . '",
text: "' . $partsnotfound . ' " + missingParts.join(", "),
confirmButtonText: "' . $confirmButtonTextalertstd . '",
showCancelButton: true,
cancelButtonText: "' . $cancelButtonTextalertstd . '"
}).then((result) => {
if (result.isConfirmed) {
window.location.href = "adddocument.php?idtrf=' . $idtrf . '&codestep=7";
} else if (result.dismiss === Swal.close) {
alert("' . $cancelButtonTextalertstd . '");
}
});
} else {
window.location.href = "adddocument.php?idtrf=' . $idtrf . '&codestep=7";
}
}
</script>';
?>
<button type="button" class="btn btn-dark waves-effect waves-light" onclick="window.location.href='identificationparts.php?idtrf=<?php echo $idtrf; ?>'"><?php echo $backstep; ?></button>
</div>
</div>
</div>
</div>
</div>
<!-- end page title end breadcrumb -->
</div>
<!-- container -->
<!-- footer start -->
</div>
<!-- end page content -->
</div>
<?php include('include/footer.php'); ?>
</footer><!--end footer-->
</div>
<!-- end page content -->
</div>
<!-- end page-wrapper -->
<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; ?>');
window.location.reload();
{
$("#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="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>
<!--image map library -->
<!-- <script> src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> -->
<script src="mapsresize/jquery.rwdImageMaps.min.js"></script>
<!-- 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>
<script src="jquery.tabledit.js"></script>
<script type="text/javascript">
// Definisci l'oggetto JavaScript con le etichette da PHP
var kindOfTestLabels = {
'new': '<?php echo $newpartlist; ?>',
'cmc': '<?php echo $cmctesttitle; ?>',
'trd': '<?php echo $trdpartlist; ?>'
};
</script>
<script>
$(document).ready(function(e) {
$('img[usemap]').rwdImageMaps();
$("#alertcertification").modal('show');
/* TABLEDIT */
$('#datatable').Tabledit({
url: 'identificationparts-process.php',
// editButton: false,
// deleteButton: false,
hideIdentifier: true,
autoFocus: false,
buttons: {
edit: {
class: 'btn btn-sm',
html: '<i class="fas fa-pen text-primary font-12"></i>',
action: 'edit'
},
// save: {
// class: 'btn btn-sm',
// html: '<i class="fas fa-check text-success font-12"></i>',
// action: 'edit'
// },
delete: {
class: 'btn btn-sm',
html: '<i class="fas fa-trash-alt text-danger font-12"></i>',
action: 'delete'
}
},
columns: {
identifier: [0, 'id'],
editable: [
[2, 'kindoftest', '{"new":"<?php echo $newpartlist; ?>", "cmc":"<?php echo $cmctesttitle; ?>", "trd":"<?php echo $trdpartlist; ?>"}'],
[4, 'article_identificationparts'],
[5, 'material_identificationparts'],
[6, 'color_identificationparts'],
[7, 'cmcreportnumber_identificationparts'],
[8, 'cmcreportdate_identificationparts']
]
},
onSuccess: function(response) {
if (response['status'] == 'error') {
alert(response['message']);
/* SHOW CURRENT DATE IN TD */
$('#td_reportdate_' + response['id']).children('span').text($('#td_reportdate_' + response['id']).attr('current-val'));
/* SHOW CURRENT DATE IN INPUT */
$('#td_reportdate_' + response['id']).children('input').val($('#td_reportdate_' + response['id']).attr('current-val'));
} else {
/* SUCCESS */
highlight_row(response['id']);
}
},
onDraw: function() {
// Select all inputs of report date column and apply datepicker each of them
$('table tr td:nth-child(9) input').each(function() {
$(this).datepicker({
format: 'yy-mm-dd',
todayHighlight: true,
autoclose: true,
changeMonth: true,
changeYear: true,
// yearRange: "-5:+0",
onSelect: function(date) {
let td_cont_id = '#' + $(this).parent().attr('id');
/* SHOW SELECTED DATE IN TD */
$(td_cont_id).children('span').text($(this).val());
}
});
});
}
});
});
function highlight_row(id) {
/* HIGHLIGHT TR */
let trID = ".tr_" + id;
let defBGColor = $(trID).css("background-color");
let defTxtColor = $(trID).css("color");
setTimeout(function() {
/* REVERT TO DEFAULT BG */
$(trID).css({
'background-color': '#228B22',
'color': '#F0F8FF'
});
$(trID).fadeOut(300, function() {
$(trID).css({
'background-color': defBGColor,
'color': defTxtColor
})
}).fadeIn(100);
}, 200);
}
</script>
<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>
</body>
</html>