<?php

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

<?php

// Controlla se è necessario aggiungere un nuovo contatto

if (isset($_GET['add_new_contact'])) {

    $InsertQuery = new WA_MySQLi_Query($cmctrfdb);

    $InsertQuery->Action = "insert";

    $InsertQuery->Table = "contacts";

    $InsertQuery->bindColumn("idtrf", "i", $_GET['idtrf'], "WA_DEFAULT");

    $InsertQuery->bindColumn("kindofcontacts", "s", "audit", "WA_DEFAULT");

    $InsertQuery->bindColumn("companyid", "i", $idcompany, "WA_DEFAULT");

    // Inserisci il nuovo record vuoto

    $InsertQuery->saveInSession("");

    $InsertQuery->execute();



    // Ottieni l'ultimo ID inserito usando l'oggetto di connessione

    $new_contact_id = $cmctrfdb->insert_id;



    // Reindirizza al popup per modificare il nuovo contatto

    header("Location: contactpopaudit.php?kindcontacts=audit&idtrf=" . $_GET['idtrf'] . "&idcontacts=" . $new_contact_id);

    exit;

}

?>





<?php

// pickup the get variable

$formname = "nocontact";

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

    $idtrf = $_POST["idtrf"];

}

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

    $idtrf = $_GET["idtrf"];

}

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

    $formname = $_GET["formname"];

}

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

    $formname = $_POST["formname"];

}

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

    $kindcontacts = $_GET["kindcontacts"];

}

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

    $kindcontacts = $_POST["kindcontacts"];

}

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

    $idauditdpi = $_GET["idauditdpi"];

}

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

    $idauditdpi = $_POST["idauditdpi"];

}

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

    $idcontacts = $_GET["idcontacts"];

}

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

    $idcontacts = $_POST["idcontacts"];

}

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

    $kindcontactscopy = $_GET["kindcontactscopy"];

}

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

    $kindcontactscopy = $_POST["kindcontactscopy"];

}



// Aggiungere un nuovo contatto quando si clicca su "Aggiungi"

if (isset($_POST['add_new_contact'])) {

    $InsertQuery = new WA_MySQLi_Query($cmctrfdb);

    $InsertQuery->Action = "insert";

    $InsertQuery->Table = "contacts";

    $InsertQuery->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");

    $InsertQuery->bindColumn("kindofcontacts", "s", "audit", "WA_DEFAULT");

    // Inserisci un nuovo record vuoto con i campi necessari

    $InsertQuery->saveInSession("");

    $InsertQuery->execute();



    // Ottieni l'id del nuovo contatto

    $new_contact_id = $InsertQuery->getLastInsertID();



    // Reindirizza al popup di modifica per il nuovo contatto

    header("Location: contactpopaudit.php?kindcontacts=audit&idtrf=$idtrf&idcontacts=$new_contact_id");

    exit;

}



?>

<?php

$countrylist = new WA_MySQLi_RS("countrylist", $cmctrfdb, 0);

$countrylist->setQuery("SELECT * FROM countries ORDER BY countries.namecountry");

$countrylist->execute();

?>

<?php

// edit contact search engine

if ($formname == "searchnamedet") {



    // Recupera i dati da GET o POST

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

        $compname = $_GET["companynamevalue"];

    } elseif (isset($_POST["companynamevalue"])) {

        $compname = $_POST["companynamevalue"];

    }



    $companyid = 0;



    // Esegui la query per ottenere i dettagli del contatto

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

    $searchctdetail->setQuery("SELECT * FROM contacts WHERE contacts.companyname='$compname'");

    $searchctdetail->execute();



    // Popola i valori del contatto dai risultati della query

    $companynamet = !empty($searchctdetail->getColumnVal("companyname")) ? $searchctdetail->getColumnVal("companyname") : "";

    $piva = !empty($searchctdetail->getColumnVal("piva")) ? $searchctdetail->getColumnVal("piva") : "";

    $address = !empty($searchctdetail->getColumnVal("address")) ? $searchctdetail->getColumnVal("address") : "";

    $city = !empty($searchctdetail->getColumnVal("city")) ? $searchctdetail->getColumnVal("city") : "";

    $cap = !empty($searchctdetail->getColumnVal("cap")) ? $searchctdetail->getColumnVal("cap") : "";

    $country = !empty($searchctdetail->getColumnVal("country")) ? $searchctdetail->getColumnVal("country") : "";

    $telephone = !empty($searchctdetail->getColumnVal("telephone")) ? $searchctdetail->getColumnVal("telephone") : "";

    $email = !empty($searchctdetail->getColumnVal("email")) ? $searchctdetail->getColumnVal("email") : "";

    $contactname = !empty($searchctdetail->getColumnVal("contactname")) ? $searchctdetail->getColumnVal("contactname") : "";

    $contactsurname = !empty($searchctdetail->getColumnVal("contactsurname")) ? $searchctdetail->getColumnVal("contactsurname") : "";



    // Recupera i nuovi campi da GET o POST (se presenti)

    $projectperson = !empty($searchctdetail->getColumnVal("projectperson")) ? $searchctdetail->getColumnVal("projectperson") : "";

    $salesperson = !empty($searchctdetail->getColumnVal("salesperson")) ? $searchctdetail->getColumnVal("salesperson") : "";

    $productionperson = !empty($searchctdetail->getColumnVal("productionperson")) ? $searchctdetail->getColumnVal("productionperson") : "";

    $csperson = !empty($searchctdetail->getColumnVal("csperson")) ? $searchctdetail->getColumnVal("csperson") : "";

    $qualityperson = !empty($searchctdetail->getColumnVal("qualityperson")) ? $searchctdetail->getColumnVal("qualityperson") : "";

    $purchaseperson = !empty($searchctdetail->getColumnVal("purchaseperson")) ? $searchctdetail->getColumnVal("purchaseperson") : "";

    $activities = !empty($searchctdetail->getColumnVal("activities")) ? $searchctdetail->getColumnVal("activities") : "";

    $otheractivities = !empty($searchctdetail->getColumnVal("otheractivities")) ? $searchctdetail->getColumnVal("otheractivities") : "";

    $otheractivitiesperson = !empty($searchctdetail->getColumnVal("otheractivitiesperson")) ? $searchctdetail->getColumnVal("otheractivitiesperson") : "";

    $languageforaudit = !empty($searchctdetail->getColumnVal("languageforaudit")) ? $searchctdetail->getColumnVal("languageforaudit") : "";

    $outsourcing_process = !empty($searchctdetail->getColumnVal("outsourcing_process")) ? $searchctdetail->getColumnVal("outsourcing_process") : "";





    // Aggiornamento del database

    $UpdateQuery = new WA_MySQLi_Query($cmctrfdb);

    $UpdateQuery->Action = "update";

    $UpdateQuery->Table = "contacts";



    // Colonne per l'aggiornamento

    $UpdateQuery->bindColumn("companyname", "s", $companynamet, "WA_DEFAULT");

    $UpdateQuery->bindColumn("piva", "s", $piva, "WA_DEFAULT");

    $UpdateQuery->bindColumn("address", "s", $address, "WA_DEFAULT");

    $UpdateQuery->bindColumn("city", "s", $city, "WA_DEFAULT");

    $UpdateQuery->bindColumn("cap", "s", $cap, "WA_DEFAULT");

    $UpdateQuery->bindColumn("country", "s", $country, "WA_DEFAULT");

    $UpdateQuery->bindColumn("telephone", "s", $telephone, "WA_DEFAULT");

    $UpdateQuery->bindColumn("email", "s", $email, "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactname", "s", $contactname, "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactsurname", "s", $contactsurname, "WA_DEFAULT");



    // Nuovi campi

    $UpdateQuery->bindColumn("projectperson", "s", $projectperson, "WA_DEFAULT");

    $UpdateQuery->bindColumn("salesperson", "s", $salesperson, "WA_DEFAULT");

    $UpdateQuery->bindColumn("productionperson", "s", $productionperson, "WA_DEFAULT");

    $UpdateQuery->bindColumn("csperson", "s", $csperson, "WA_DEFAULT");

    $UpdateQuery->bindColumn("qualityperson", "s", $qualityperson, "WA_DEFAULT");

    $UpdateQuery->bindColumn("purchaseperson", "s", $purchaseperson, "WA_DEFAULT");

    $UpdateQuery->bindColumn("activities", "s", $activities, "WA_DEFAULT");

    $UpdateQuery->bindColumn("otheractivities", "s", $otheractivities, "WA_DEFAULT");

    $UpdateQuery->bindColumn("otheractivitiesperson", "s", $otheractivitiesperson, "WA_DEFAULT");

    $UpdateQuery->bindColumn("languageforaudit", "s", $languageforaudit, "WA_DEFAULT");

    $UpdateQuery->bindColumn("outsourcing_process", "s", $outsourcing_process, "WA_DEFAULT");



    // Filtro per ID del contatto

    $UpdateQuery->addFilter("idcontacts", "=", "i", $idcontacts);

    $UpdateQuery->execute();



    // Reindirizzamento

    $UpdateGoTo = "";

    if (function_exists("rel2abs")) {

        $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";

    }

    $UpdateQuery->redirect($UpdateGoTo);

}

?>



<?php

//edit contact details

if ($formname == "editcontactsdetails") {



    // Recupera i dati dal form

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

        $companynamet = $_POST["companyname"];

    } else {

        $companynamet = "";

    }

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

        $piva = $_POST["piva"];

    } else {

        $piva = "";

    }

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

        $address = $_POST["companyaddress"];

    } else {

        $address = "";

    }

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

        $city = $_POST["city"];

    } else {

        $city = "";

    }

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

        $cap = $_POST["cap"];

    } else {

        $cap = "";

    }

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

        $country = $_POST["country"];

    } else {

        $country = "";

    }

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

        $telephone = $_POST["telephone"];

    } else {

        $telephone = "";

    }

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

        $email = $_POST["email"];

    } else {

        $email = "";

    }

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

        $contactname = $_POST["contactname"];

    } else {

        $contactname = "";

    }

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

        $contactsurname = $_POST["contactsurname"];

    } else {

        $contactsurname = "";

    }



    // Nuovi campi aggiunti

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

        $projectperson = $_POST["projectperson"];

    } else {

        $projectperson = "";

    }

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

        $salesperson = $_POST["salesperson"];

    } else {

        $salesperson = "";

    }

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

        $productionperson = $_POST["productionperson"];

    } else {

        $productionperson = "";

    }

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

        $csperson = $_POST["csperson"];

    } else {

        $csperson = "";

    }

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

        $qualityperson = $_POST["qualityperson"];

    } else {

        $qualityperson = "";

    }

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

        $purchaseperson = $_POST["purchaseperson"];

    } else {

        $purchaseperson = "";

    }

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

        $activities = $_POST["activities"];

    } else {

        $activities = "";

    }

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

        $otheractivities = $_POST["otheractivities"];

    } else {

        $otheractivities = "";

    }

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

        $otheractivitiesperson = $_POST["otheractivitiesperson"];

    } else {

        $otheractivitiesperson = "";

    }

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

        $languageforaudit = $_POST["languageforaudit"];

    } else {

        $languageforaudit = "";

    }

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

        $outsourcing_process = $_POST["outsourcing_process"];

    } else {

        $outsourcing_process = "";

    }



    // Aggiornamento del database

    $UpdateQuery = new WA_MySQLi_Query($cmctrfdb);

    $UpdateQuery->Action = "update";

    $UpdateQuery->Table = "contacts";



    // Colonne per l'aggiornamento

    $UpdateQuery->bindColumn("companyname", "s", "$companynamet", "WA_DEFAULT");

    $UpdateQuery->bindColumn("piva", "s", "$piva", "WA_DEFAULT");

    $UpdateQuery->bindColumn("address", "s", "$address", "WA_DEFAULT");

    $UpdateQuery->bindColumn("city", "s", "$city", "WA_DEFAULT");

    $UpdateQuery->bindColumn("cap", "s", "$cap", "WA_DEFAULT");

    $UpdateQuery->bindColumn("country", "s", "$country", "WA_DEFAULT");

    $UpdateQuery->bindColumn("telephone", "s", "$telephone", "WA_DEFAULT");

    $UpdateQuery->bindColumn("email", "s", "$email", "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactname", "s", "$contactname", "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactsurname", "s", "$contactsurname", "WA_DEFAULT");



    // Nuovi campi

    $UpdateQuery->bindColumn("projectperson", "s", "$projectperson", "WA_DEFAULT");

    $UpdateQuery->bindColumn("salesperson", "s", "$salesperson", "WA_DEFAULT");

    $UpdateQuery->bindColumn("productionperson", "s", "$productionperson", "WA_DEFAULT");

    $UpdateQuery->bindColumn("csperson", "s", "$csperson", "WA_DEFAULT");

    $UpdateQuery->bindColumn("qualityperson", "s", "$qualityperson", "WA_DEFAULT");

    $UpdateQuery->bindColumn("purchaseperson", "s", "$purchaseperson", "WA_DEFAULT");

    $UpdateQuery->bindColumn("activities", "s", "$activities", "WA_DEFAULT");

    $UpdateQuery->bindColumn("otheractivities", "s", "$otheractivities", "WA_DEFAULT");

    $UpdateQuery->bindColumn("otheractivitiesperson", "s", "$otheractivitiesperson", "WA_DEFAULT");

    $UpdateQuery->bindColumn("languageforaudit", "s", "$languageforaudit", "WA_DEFAULT");

    $UpdateQuery->bindColumn("outsourcing_process", "s", "$outsourcing_process", "WA_DEFAULT");



    $UpdateQuery->addFilter("idcontacts", "=", "i", "" . ($idcontacts) . "");

    $UpdateQuery->execute();



    // Reindirizzamento

    $UpdateGoTo = "";

    if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";

    $UpdateQuery->redirect($UpdateGoTo);

}

?>



<?php

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

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

$trfnumberfinal->execute();

?>

<?php

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

$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

$contactdatacheck = new WA_MySQLi_RS("contactdatacheck", $cmctrfdb, 0);

$contactdatacheck->setQuery("SELECT * FROM contacts WHERE contacts.idtrf='$idtrf'");

$contactdatacheck->execute();

$contactlist = array();

?>

<?php

$wa_startindex = 0;

while (!$contactdatacheck->atEnd()) {

    $wa_startindex = $contactdatacheck->Index;

?>

    <?php

    $contactlist[] = $contactdatacheck->getColumnVal("kindofcontacts");



    ?>

<?php

    $contactdatacheck->moveNext();

}

$contactdatacheck->moveFirst(); //return RS to first record

unset($wa_startindex);

unset($wa_repeatcount);



?>







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

    <!-- upload image script -->





    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

    <script type='text/javascript'>

        window.onunload = function() {

            window.opener.location.reload();

        }

    </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/scriptsearchcontactaudit.js"></script>

    <!-- submit form with button -->



    <style>

        .section-title {

            margin-top: 20px;

            margin-bottom: 20px;

            border-bottom: 2px solid #007bff;

            padding-bottom: 10px;

            font-size: 18px;

            font-weight: bold;

        }



        .form-row .col-md-4,

        .form-row .col-md-6 {

            padding-right: 15px;

            padding-left: 15px;

        }



        .form-row .col-md-12 {

            padding: 0;

        }



        .btn-submit {

            margin-top: 20px;

        }



        .form-control {

            margin-bottom: 15px;

        }

    </style>

</head>



<body>







    <!-- section file already uploaded -->



    <div class="card">

        <div class="card-body">

            <h4 class="mt-0 header-title">CONTACT FORM</h4>

            <?php echo $copycontactfrom; ?>

            <?php



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

            $contactdata->setQuery("SELECT * FROM contacts WHERE contacts.idcontacts='$idcontacts'");

            $contactdata->execute();

            $compid = $contactdata->getColumnVal("companyid");

            ?>

            <?php if ($compid < 1) { ?>

                <a href="contactpop.php?idcontacts=<?php echo ($contactdata->getColumnVal("idcontacts")); ?>&kindcontactscopy=mycompany&idtrf=<?php echo $idtrf; ?>&formname=copymycompany&kindcontacts=<?php echo $kindcontacts; ?>"><button type="button" class="btn btn-outline-secondary waves-effect"><?php echo $anagraficamycompany; ?></button> </a> <?php } ?>

            <?php if ($kindcontacts != "audit") { ?><?php if (in_array('audit', $contactlist)) { ?><a href="contactpop.php?idcontacts=<?php echo ($contactdata->getColumnVal("idcontacts")); ?>&kindcontactscopy=audit&idtrf=<?php echo $idtrf; ?>&formname=copycontacts&kindcontacts=<?php echo $kindcontacts; ?>"><button type="button" class="btn btn-outline-secondary waves-effect"><?php echo $anagraficaaudit; ?></button></a><?php }

                                                                                                                                                                                                                                                                                                                                                                                                                                } ?>

    <?php if ($kindcontacts != "headertest") { ?><?php if (in_array('headertest', $contactlist)) { ?><a href="contactpop.php?idcontacts=<?php echo ($contactdata->getColumnVal("idcontacts")); ?>&kindcontactscopy=headertest&idtrf=<?php echo $idtrf; ?>&formname=copycontacts&kindcontacts=<?php echo $kindcontacts; ?>"><button type="button" class="btn btn-outline-secondary waves-effect"><?php echo $anagraficatest; ?></button></a><?php }

                                                                                                                                                                                                                                                                                                                                                                                                                                    } ?>

<?php if ($kindcontacts != "headercertificate") { ?><?php if (in_array('headercertificate', $contactlist)) { ?><a href="contactpop.php?idcontacts=<?php echo ($contactdata->getColumnVal("idcontacts")); ?>&kindcontactscopy=headercertificate&idtrf=<?php echo $idtrf; ?>&formname=copycontacts&kindcontacts=<?php echo $kindcontacts; ?>"><button type="button" class="btn btn-outline-secondary waves-effect"><?php echo $anagraficacertificate; ?></button></a><?php }

                                                                                                                                                                                                                                                                                                                                                                                                                                                            } ?>

<?php if ($kindcontacts != "invoice") { ?><?php if (in_array('invoice', $contactlist)) { ?><a href="contactpop.php?idcontacts=<?php echo ($contactdata->getColumnVal("idcontacts")); ?>&kindcontactscopy=invoice&idtrf=<?php echo $idtrf; ?>&formname=copycontacts&kindcontacts=<?php echo $kindcontacts; ?>"><button type="button" class="btn btn-outline-secondary waves-effect"><?php echo $anagraficainvoice; ?></button></a><?php }

                                                                                                                                                                                                                                                                                                                                                                                                                            } ?>

<br><br>



<form class="needs-validation" id="editcontacts" name="editcontacts" action="#" method="POST" novalidate="">

    <div class="form-row">

        <div class="col-md-4 mb-3">

            <label for="companyname"><?php echo $companynametitle; ?></label>

            <input type="text" class="form-control" id="companyname" name="companyname" value="<?php echo ($contactdata->getColumnVal("companyname")); ?>" placeholder="<?php echo $companynametitle; ?>" required>

        </div>

        <div class="col-md-4 mb-3">

            <label for="piva"><?php echo $pivatitle; ?></label>

            <input type="text" class="form-control" id="piva" name="piva" value="<?php echo ($contactdata->getColumnVal("piva")); ?>" placeholder="<?php echo $pivatitle; ?>" required>

        </div>

        <div class="col-md-4 mb-3">

            <label for="companyaddress"><?php echo $companyaddresstitle; ?></label>

            <input type="text" class="form-control" id="companyaddress" name="companyaddress" value="<?php echo ($contactdata->getColumnVal("address")); ?>" placeholder="<?php echo $companyaddresstitle; ?>" required>

        </div>

    </div>



    <div class="form-row">

        <div class="col-md-4 mb-3">

            <label for="city"><?php echo $citytitle; ?></label>

            <input type="text" class="form-control" id="city" name="city" value="<?php echo ($contactdata->getColumnVal("city")); ?>" placeholder="<?php echo $citytitle; ?>" required>

        </div>

        <div class="col-md-4 mb-3">

            <label for="cap"><?php echo $captitle; ?></label>

            <input type="text" class="form-control" id="cap" name="cap" value="<?php echo ($contactdata->getColumnVal("cap")); ?>" placeholder="<?php echo $captitle; ?>" required>

        </div>

        <div class="col-md-4 mb-3">

            <label for="country"><?php echo $countrytitle; ?></label>

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

                <?php

                while (!$countrylist->atEnd()) {

                ?>

                    <option value="<?php echo ($countrylist->getColumnVal("idcountries")); ?>" <?php if (!(strcmp($countrylist->getColumnVal("idcountries"), ($contactdata->getColumnVal("country"))))) {

                                                                                                    echo "selected=\"selected\"";

                                                                                                } ?>><?php echo ($countrylist->getColumnVal("namecountry")); ?></option>

                <?php

                    $countrylist->moveNext();

                }

                $countrylist->moveFirst();

                ?>

            </select>

        </div>

    </div>



    <div class="form-row">

        <div class="col-md-4 mb-3">

            <label for="telephone"><?php echo $telephonetitle; ?></label>

            <input type="text" class="form-control" id="telephone" name="telephone" value="<?php echo ($contactdata->getColumnVal("telephone")); ?>" placeholder="<?php echo $telephonetitle; ?>" required>

        </div>

        <div class="col-md-4 mb-3">

            <label for="email"><?php echo $emailtitle; ?></label>

            <input type="text" class="form-control" id="email" name="email" value="<?php echo ($contactdata->getColumnVal("email")); ?>" placeholder="<?php echo $emailtitle; ?>" required>

        </div>

        <div class="col-md-4 mb-3">

            <label for="contactname"><?php echo $contactnametitle; ?></label>

            <input type="text" class="form-control" id="contactname" name="contactname" value="<?php echo ($contactdata->getColumnVal("contactname")); ?>" placeholder="<?php echo $contactnametitle; ?>" required>

        </div>

    </div>

    <input type="hidden" class="form-control" id="formname" name="formname" value="editcontactsdetails">



    <div class="form-row">

        <div class="col-md-4 mb-3">

            <label for="contactsurname"><?php echo $contactsurnametitle; ?></label>

            <input type="text" class="form-control" id="contactsurname" name="contactsurname" value="<?php echo ($contactdata->getColumnVal("contactsurname")); ?>" placeholder="<?php echo $contactsurnametitle; ?>" required>

        </div>

        <div class="col-md-8 mb-3">

            <label for="activities"><?php echo $activitiestitle; ?></label>

            <input type="text" class="form-control" id="activities" name="activities" value="<?php echo ($contactdata->getColumnVal("activities")); ?>" placeholder="<?php echo $activitiestitle; ?>">

        </div>

    </div>

    <hr>

    <h5><?php echo $personinvolvedtitle; ?></h5><br>

    <!-- New fields added for project, sales, production, etc. -->

    <div class="form-row">

        <div class="col-md-2 mb-3">

            <label for="projectperson"><?php echo $designtitle; ?></label>

            <input type="number" class="form-control" id="projectperson" name="projectperson" value="<?php echo ($contactdata->getColumnVal("projectperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">

        </div>

        <div class="col-md-2 mb-3">

            <label for="salesperson"><?php echo $salestitle; ?></label>

            <input type="number" class="form-control" id="salesperson" name="salesperson" value="<?php echo ($contactdata->getColumnVal("salesperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">

        </div>

        <div class="col-md-2 mb-3">

            <label for="productionperson"><?php echo $productiontitle; ?></label>

            <input type="number" class="form-control" id="productionperson" name="productionperson" value="<?php echo ($contactdata->getColumnVal("productionperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">

        </div>

        <div class="col-md-2 mb-3">

            <label for="csperson"><?php echo $customer_caretitle; ?></label>

            <input type="number" class="form-control" id="csperson" name="csperson" value="<?php echo ($contactdata->getColumnVal("csperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">

        </div>

        <div class="col-md-2 mb-3">

            <label for="qualityperson"><?php echo $qualitytitle; ?></label>

            <input type="number" class="form-control" id="qualityperson" name="qualityperson" value="<?php echo ($contactdata->getColumnVal("qualityperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">

        </div>

        <div class="col-md-2 mb-3">

            <label for="purchaseperson"><?php echo $buyertitle; ?></label>

            <input type="number" class="form-control" id="purchaseperson" name="purchaseperson" value="<?php echo ($contactdata->getColumnVal("purchaseperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">

        </div>

    </div>





    <div class="form-row">

        <div class="col-md-9 mb-3">

            <label for="otheractivities"><?php echo $other_activitytitle; ?></label>

            <input type="text" class="form-control" id="otheractivities" name="otheractivities" value="<?php echo ($contactdata->getColumnVal("otheractivities")); ?>">

        </div>

        <div class="col-md-3 mb-3">

            <label for="otheractivitiesperson"><?php echo $other_activitypersontitle; ?></label>

            <input type="number" class="form-control" id="otheractivitiesperson" name="otheractivitiesperson" value="<?php echo ($contactdata->getColumnVal("otheractivitiesperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">

        </div>



    </div>

    <hr>

    <div class="form-row">

        <div class="col-md-3 mb-3">

            <label for="languageforaudit"><?php echo $language_audittitle; ?></label>

            <input type="text" class="form-control" id="languageforaudit" name="languageforaudit" value="<?php echo ($contactdata->getColumnVal("languageforaudit")); ?>">

        </div>

        <div class="col-md-9 mb-3">

            <label for="outsourcing_process"><?php echo $outsourced_processestitle; ?></label>

            <input type="text" class="form-control" id="outsourcing_process" name="outsourcing_process" value="<?php echo ($contactdata->getColumnVal("outsourcing_process")); ?>">

        </div>

    </div>



    <button class="btn btn-gradient-primary" type="submit"><?php echo $edictcontacttitle; ?></button>

</form>

<br><br>

<button onclick="self.close()" type="button" class="btn btn-success waves-effect waves-light"><?php echo $closewindow; ?></button>





        </div><!--end card-body-->





    </div>

    <?php // contact search trial 

    ?>

    <div class="card">

        <div class="card-body">

            <div class="col-md-12 mb-4">

                <form class="needs-validation" id="searchname" name="searchname" action="#" method="GET" novalidate="">

                    <label for="validationServer02"><?php echo $anagraficacompany; ?></label>

                    <i class="fas fa-info-circle" data-toggle="modal" data-animation="bounce" data-target=".bs-example-modal-center"></i>

                    <input type="hidden" id="kindcontacts" name="kindcontacts" value="<?php echo ($contactdata->getColumnVal("kindofcontacts")); ?>">

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

                    <input type="hidden" id="formname" name="formname" value="searchnamedet">

                    <input type="hidden" id="idcontacts" name="idcontacts" value="<?php echo $contactdata->getColumnVal("idcontacts"); ?>">

                    <input type="text" class="form-control is-valid" id="companynamevalue" name="companynamevalue" placeholder="<?php echo $companyname; ?>" required="">

                    <input type="submit" value="Submit">

                    <br>

                    <b>Ex: </b><i><?php echo $searchsentence; ?></i>

                    <br />

                    <div id="display"></div>

            </div>

        </div><!--end card-body-->





    </div>





    <!-- end of page -->





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