spl_autoload_register("classLoad");
include '../config.php';
//classes loading end
session_start();
if (isset($_SESSION['userMerlaTrav']) and $_SESSION['userMerlaTrav']->profil() == "admin") {
    //classes managers
    $clientManager = new ClientManager($pdo);
    $contratManager = new ContratManager($pdo);
    $projetManager = new ProjetManager($pdo);
    $operationManager = new OperationManager($pdo);
    $appartementManager = new AppartementManager($pdo);
    $locauxManager = new LocauxManager($pdo);
    //classes and attributes
    $bien = "";
    $idOperation = $_GET['idOperation'];
    $operation = $operationManager->getOperationById($idOperation);
    $contrat = $contratManager->getContratById($operation->idContrat());
    $client = $clientManager->getClientById($contrat->idClient());
    $projet = $projetManager->getProjetById($contrat->idProjet());
    $typeBien = "";
    $etage = "";
    $expressionOrthographe = "";
    if ($contrat->typeBien() == "appartement") {
        $bien = $appartementManager->getAppartementById($contrat->idBien());
        $typeBien = "Appartement";
        $etage = "en " . $bien->niveau();
        $expressionOrthographe = "de l'";
    } else {
        if ($contrat->typeBien() == "localCommercial") {
            $bien = $locauxManager->getLocauxById($contrat->idBien());
            $typeBien = "Local commercial";