summaryrefslogtreecommitdiff
path: root/src/sections/1_customer.php
blob: d0d49ffaa506c64b8400067312919b329c5dad32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
// src/sections/1_customer.php
//
// -- SECTION 1: Fichier clients et propects --

function newCustomer(): array
{
    // fenêtres
    //$TypeDeClient = new ZenityList(ZenitySetup::$type_client['text'], ZenitySetup::$type_client['entrees']);
    $NouveauClient = new ZenityForms(ZenitySetup::$nouveau_client['text'], ZenitySetup::$nouveau_client['entrees']);
    $FinSection1 = new ZenityList(ZenitySetup::$fin_section_1['text'], ZenitySetup::$fin_section_1['entrees']);

    $Customer = new Client;

    
    // -- partie 2: saisie des infos --
    $input = exec($NouveauClient->get());

    // annulation
    if($input == ''){
        echo "debug: annulation lors de l'enregistrement d'un nouveau client\n";
        return [0, null]; // menu principal
    }

    $input = Client::controlForm($input);

    // vide
    if(!$input){
        return [1, null]; // relancer section 1: newCustomer()
    }
    $Customer->enterCustomer($input);


    // -- partie 3: on fait quoi maintenant --
    $choix_niv3 = exec($FinSection1->get());
    if($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][0]){
        return [2, $Customer]; // section 2: newService()
    }
    elseif($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][1]){
        return [3, $Customer]; // section 3: modifyData()
    }
    elseif($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][2]){
        return [1, null]; // relancer section 1: newCustomer()
    }
    else{
        return [0, null]; // menu principal
    }
}