ppeasy/public/typeofcertificate2.php

883 lines
28 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']; }
?>
<?php //pickup variable post
if (isset($_POST["idtrf"])) {
$idtrf=$_POST["idtrf"]; }
if (isset($_GET["idtrf"])) {
$idtrf=$_GET["idtrf"]; }
if (isset($_POST["formname"])) {
$formname=$_POST["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"]; }
?>
<?php
if (isset($formname)) {
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "contacts";
$InsertQuery->bindColumn("kindofcontacts", "s", "$kindofcontacts", "WA_DEFAULT");
$InsertQuery->bindColumn("companyname", "s", "$companyname", "WA_DEFAULT");
$InsertQuery->bindColumn("piva", "s", "$piva", "WA_DEFAULT");
$InsertQuery->bindColumn("address", "s", "$companyaddress", "WA_DEFAULT");
$InsertQuery->bindColumn("city", "s", "$city", "WA_DEFAULT");
$InsertQuery->bindColumn("cap", "s", "$cap", "WA_DEFAULT");
$InsertQuery->bindColumn("country", "s", "$country", "WA_DEFAULT");
$InsertQuery->bindColumn("telephone", "s", "$telephone", "WA_DEFAULT");
$InsertQuery->bindColumn("email", "s", "$email", "WA_DEFAULT");
$InsertQuery->bindColumn("contactname", "s", "$contactname", "WA_DEFAULT");
$InsertQuery->bindColumn("contactsurname", "s", "$contactsurname", "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 (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
$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");
?>
<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" />
<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>
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>
<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 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 } ?>
<!-- section confirm certificate -->
<!-- confirm certificate M15C -->
<?php if ($idcertificate=="2") { ?>
<?php
$certtype = new WA_MySQLi_RS("certtype",$cmctrfdb,1);
$certtype->setQuery("SELECT * FROM certificationtype WHERE certificationtype.idcertificationtype='$idcertificate'");
$certtype->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 class="card">
<div class="card-body">
<h4 class="mt-0"><?php echo $selectfilecertificate; ?>
<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($documenthelp); ?>
</p>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal --></h4>
<div class="upload-div">
<!-- File upload form -->
<form id="uploadForm" enctype="multipart/form-data">
<div class="form-group row">
<label for="validationTooltip01" class="col-sm-2 col-form-label"><?php echo $filedescription; ?></label>
<div class="col-sm-8">
<input type="text" class="form-control" id="validationTooltip01" name="filedescription" placeholder="<?php echo $filedescription; ?>" required="">
</div>
</div>
<label><?php echo $selectfileonyourpc; ?></label>
<input type="file" name="doc[]" id="fileInput" >
<input type="hidden" name="idtrf" id="idtrf" value="<?php echo($trfnumberfinal->getColumnVal("idtrfdetails")); ?>">
<input type="submit" name="submit" value="UPLOAD"/>
</form>
<!-- Display upload status -->
<div id="uploadStatus"></div>
</div>
<br>
</div><!--end card-body-->
</div><!--end card-->
<div class="card" id="provacla">
<?php
$filenamelist = new WA_MySQLi_RS("filenamelist",$cmctrfdb,0);
$filenamelist->setQuery("SELECT * FROM fileattached WHERE fileattached.idtrfdetails='$idtrf'");
$filenamelist->execute();
?>
<div class="card-body">
<h4 class="mt-0 header-title"><?php echo $addeddoctitle; ?></h4>
<p class="text-muted mb-3"><?php echo $addeddoctitle_help; ?></p>
<div class="upload-div">
<!-- File upload form -->
<div class="card-body">
<div class="table-responsive" id="docadded">
<table class="table table-striped mb-0">
<thead>
<tr>
<th><?php echo $filenametitle; ?></th>
<th><?php echo $filenamedesc; ?></th>
<th><?php echo $actiondel; ?></th>
</tr>
</thead>
<tbody id="cont_file">
<?php
$wa_startindex = 0;
while(!$filenamelist->atEnd()) {
$wa_startindex = $filenamelist->Index;
?>
<tr>
<td>
<a href="uploaddocuments/<?php echo($filenamelist->getColumnVal("filename_fileattached")); ?>" target="_blank"><?php echo $filesent; ?></a>
</td>
<td><?php echo($filenamelist->getColumnVal("description_fileattached")); ?></td>
<td>
<a href="deleteaddedoc.php?idtrf=<?php echo $idtrf; ?>&idadddoc=<?php echo($filenamelist->getColumnVal("idfileattached")); ?>"><i class="fas fa-trash-alt text-danger font-16"></i></a>
</td>
</tr>
<?php
$filenamelist->moveNext();
}
$filenamelist->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
</tbody>
</table><br>
<!--end /table-->
</div><!--end /tableresponsive-->
</div>
<div name="1stquestion" class="alert alert-light text-muted mb-0" role="alert">
<h4 class="alert-heading font-18 text-dark"><?php echo $certificatem15c; ?></h4>
<p><?php echo $certificatem15c_help; ?></p>
<form action="trfdetails.php" method="get" name="myForm" enctype="multipart/form-data">
<input name="certtype" type="hidden" id="certtype" value="<?php echo($certtype->getColumnVal("idcertificationtype")); ?>">
<input name="tempcode" type="hidden" id="tempcode" value="<?php echo $tempcode; ?>">
<br>
<div class="form-group row">
<label for="example-text-input" class="col-sm-4 col-form-label text-right"><?php echo $previosurepnumbertitlem15c; ?></label>
<div class="col-sm-3">
<input class="form-control" type="text" id="previousrepnumber" name="previousrepnumber">
</div>
</div>
<div class="form-group row">
<label for="example-text-input" class="col-sm-4 col-form-label text-right"><?php echo $notificatedorganismtitle; ?></label>
<div class="col-sm-3">
<input class="form-control" type="text" id="notificatedorganismname" name="notificatedorganismname" value="CIMAC"><br>
</div>
</div>
<input type="hidden" name="certtwoupd" id="certtwoupd" value="Y">
<input type="hidden" name="idtrf" id="idtrf" value="<?php echo $idtrf; ?>">
<input type="button" onclick="formSubmit()" class="btn btn-gradient-success waves-effect waves-light" value="<?php echo $nextsteptitle; ?>">
</form>
</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>
var match= ["application/pdf","application/msword","image/jpg","image/jpeg","image/gif","application/xls","application/xlsx", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "image/png", "image/bmp"];
$(document).ready(function(){
// File upload via Ajax
$("#uploadForm").on('submit', function(e){
e.preventDefault();
$.ajax({
type: 'POST',
url: 'uploadfile.php',
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
beforeSend: function(){
$('#uploadStatus').html('<img src="../images/uploading.gif"/>');
},
error:function(){
$('#uploadStatus').html('<span style="color:#EA4335;">File upload failed, please try again.<span>');
},
success: function(data){
$('#uploadForm')[0].reset();
$('#uploadStatus').html('<span style="color:#28A74B;">File uploaded successfully.<span>');
// $('.gallery').html(data);
// $("#docadded").load(location.href + " #docadded");
// SHOW UPLOADED FILE
$('#cont_file').html(data);
}
});
});
// File type validation
$("#fileInput").change(function(){
var fileLength = this.files.length;
// var match= ["application/pdf","application/msword","image/jpg","image/gif","application/xls","application/xlsx", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"];
var i;
for(i = 0; i < fileLength; i++){
var file = this.files[i];
var imagefile = file.type;
// if(!((imagefile==match[0]) || (imagefile==match[1]) || (imagefile==match[5]) || (imagefile==match[6]) || (imagefile==match[7]) || (imagefile==match[8]))){
// alert('Please select a valid file (PDF, word, excel).');
// $("#fileInput").val('');
// return false;
// }
if(!match.includes(imagefile)){
alert('Please select a valid file (PDF, word, excel).');
$("#fileInput").val('');
return false;
}
}
});
});
</script>
<script>
$(document).ready(function(){
// File upload via Ajax
$("#uploadFormphoto").on('submit', function(e){
e.preventDefault();
$.ajax({
type: 'POST',
url: 'uploadphotofile.php',
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
beforeSend: function(){
$('#uploadStatus1').html('<img src="../images/uploading.gif"/>');
},
error:function(){
$('#uploadStatus1').html('<span style="color:#EA4335;">File upload failed, please try again.<span>');
},
success: function(data){
$('#uploadFormphoto')[0].reset();
$('#uploadStatus1').html('<span style="color:#28A74B;">File uploaded successfully.<span>');
// $('.gallery').html(data);
// $("#photoaded").load(location.href + " #photoaded");
// SHOW PHOTO 1
$('#cont_photoone').html(data);
}
});
});
// File type validation
$("#fileInput1").change(function(){
var fileLength = this.files.length;
// var match= ["application/pdf","application/msword","image/jpg","image/gif","application/xls","application/xlsx", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"];
var i;
for(i = 0; i < fileLength; i++){
var file = this.files[i];
var imagefile = file.type;
if(!((imagefile==match[2]) || (imagefile==match[3]) || (imagefile==match[4]) || (imagefile==match[9]) || (imagefile==match[10]))){
alert('Please select a valid file (jpg, jpeg, png, bmp).');
$("#fileInput1").val('');
return false;
}
}
});
});
</script>
<script>
$(document).ready(function(){
// File upload via Ajax
$("#uploadFormphototwo").on('submit', function(e){
e.preventDefault();
$.ajax({
type: 'POST',
url: 'uploadphotofile2.php',
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
beforeSend: function(){
$('#uploadStatus2').html('<img src="../images/uploading.gif"/>');
},
error:function(){
$('#uploadStatus2').html('<span style="color:#EA4335;">File upload failed, please try again.<span>');
},
success: function(data){
$('#uploadFormphototwo')[0].reset();
$('#uploadStatus2').html('<span style="color:#28A74B;">File uploaded successfully.<span>');
// $('.gallery').html(data);
// $("#photoaded").load(location.href + " #photoaded");
// SHOW PHOTO 2
$('#cont_phototwo').html(data);
}
});
});
// File type validation
$("#fileInput2").change(function(){
var fileLength = this.files.length;
// var match= ["application/pdf","application/msword","image/jpg","image/gif","application/xls","application/xlsx", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"];
var i;
for(i = 0; i < fileLength; i++){
var file = this.files[i];
var imagefile = file.type;
if(!((imagefile==match[2]) || (imagefile==match[3]) || (imagefile==match[4]) || (imagefile==match[9]) || (imagefile==match[10]))){
alert('Please select a valid file (jpg, jpeg, png, bmp).');
$("#fileInput2").val('');
return false;
}
}
});
});
</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>