summaryrefslogtreecommitdiff
path: root/src/sections/1_customer.php
blob: ca20d08fb84df7f251f5f127ea5149553575acae (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
49
50
51
52
53
54
55
<?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);
    
    // -- partie 1: client ou prospect? --
    $Client = new Clients;
    $choix_niv2 = exec($TypeDeClient->get());
    if($choix_niv2 === ZenitySetup::$type_client_entrees[0])
    {
        echo "choix: " . $choix_niv2 . "\n";
        $Client->setType('client');
    }
    elseif($choix_niv2 === ZenitySetup::$type_client_entrees[1])
    {
        echo "choix: " . $choix_niv2 . "\n";
        $Client->setType('prospect');
    }
    else
    {
        return [0, null]; // menu principal
    }
    
    // -- partie 2: saisie des infos --
    if(enterCustomer($Client))
    {
        // -- partie 3: on fait quoi maintenant --
        $choix_niv3 = exec($FinSection1->get());
        if($choix_niv3 === ZenitySetup::$fin_section_1_entrees[0])
        {
            return [2, $Client]; // section 2: newService()
        }
        elseif($choix_niv3 === ZenitySetup::$fin_section_1_entrees[1])
        {
            return [3, $Client]; // 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
        }
    }
    
    return [0, null]; // menu principal
}