<?php

function modal_kundensuche($k = null) {
    if (!$k) {
        $k = array(
            "firma" => "",
            "vorname" => "",
            "nachname" => "",
            "adresse" => "",
            "plz" => "",
            "ort" => "",
            "telefon" => ""
            );
    }

    $ret = '
        <div class="modal fade" id="kundensuche-dialog" tabindex="-1" role="dialog" aria-labelledby="Kunde suchen" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">Angaben des Kunden: <strong><span class="clickable_text">'.$k['firma'].'</span> <span class="clickable_text">'.$k['vorname'].'</span> <span class="clickable_text">'.$k['nachname'].'</span> <span class="clickable_text">'.$k['telefon'].'</span></strong></h4>
                </div>

                <div class="modal-body">
                    <p><input id="kundensuche_suchfeld" type="text" name="kundensuche_suchfeld" value="'.$k['nachname'].'"></p>
                </div>

                <div class="modal-body" id="kundensuche_ergebnisse">
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-outline-primary" id="kundensuche_neuerkunde">Neuen Kunden anlegen</button>
                    <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Abbrechen</button>
                </div>
            </div>
        </div>
    </div>
        <div class="modal fade" id="kundeerstellen-dialog" tabindex="-1" role="dialog" aria-labelledby="Kunde anlegen" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">Neuer Kunde</h4>
                </div>

                <div class="modal-body">
                    <table>
                    <tr><td>Firmenname:</td><td><input type="text" name="kundeerstellen_firma" id="kundeerstellen_firma" value="'.$k['firma'].'"</td></tr>
                    <tr><td>Vorname:</td><td><input type="text" name="kundeerstellen_vorname" id="kundeerstellen_vorname" value="'.$k['vorname'].'"</td></tr>
                    <tr><td>Nachname:</td><td><input type="text" name="kundeerstellen_nachname" id="kundeerstellen_nachname" value="'.$k['nachname'].'"</td></tr>
                    <tr><td>Adresse:</td><td><input type="text" name="kundeerstellen_adresse" id="kundeerstellen_adresse" value="'.$k['adresse'].'"</td></tr>
                    <tr><td>PLZ:</td><td><input type="text" name="kundeerstellen_plz" id="kundeerstellen_plz" value="'.$k['plz'].'"</td></tr>
                    <tr><td>Ort:</td><td><input type="text" name="kundeerstellen_ort" id="kundeerstellen_ort" value="'.$k['ort'].'"</td></tr>
                    <tr><td>Telefon:</td><td><input type="text" name="kundeerstellen_telefon" id="kundeerstellen_telefon" value="'.$k['telefon'].'"</td></tr>
                    </table>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="kundeerstellen_submit">Kunde anlegen</button>
                    <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Abbrechen</button>
                </div>
            </div>
        </div>
    </div>
';
    return $ret;
}


function modal_kunde_aendern() {
    $ret = '
        <div class="modal fade" id="kundeaendern-dialog" tabindex="-1" role="dialog" aria-labelledby="Kundendaten ändern" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">Kundendaten ändern</h4>
                </div>

                <div class="modal-body">
                    <input type="hidden" name="kundennr" id="kundeaendern_kundennr" value="">
                    <table>
                    <tr><td>Firmenname:</td><td><input type="text" name="kundeaendern_firma" id="kundeaendern_firma" value=""</td></tr>
                    <tr><td>Vorname:</td><td><input type="text" name="kundeaendern_vorname" id="kundeaendern_vorname" value=""</td></tr>
                    <tr><td>Nachname:</td><td><input type="text" name="kundeaendern_nachname" id="kundeaendern_nachname" value=""</td></tr>
                    <tr><td>Adresse:</td><td><input type="text" name="kundeaendern_adresse" id="kundeaendern_adresse" value=""</td></tr>
                    <tr><td>PLZ:</td><td><input type="text" name="kundeaendern_plz" id="kundeaendern_plz" value=""</td></tr>
                    <tr><td>Ort:</td><td><input type="text" name="kundeaendern_ort" id="kundeaendern_ort" value=""</td></tr>
                    <tr><td>Telefon:</td><td><input type="text" name="kundeaendern_telefon" id="kundeaendern_telefon" value=""</td></tr>
                    </table>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="kundeaendern_submit">Daten ändern</button>
                    <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Abbrechen</button>
                </div>
            </div>
        </div>
    </div>
';
    return $ret;
}

function modal_confirmation() {
    $ret = '
        <div class="modal fade" id="confirmation-dialog" tabindex="-1" role="dialog" aria-labelledby="Sicher?" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">Sicher?</h4>
                </div>

                <div class="modal-body">
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-danger" id="confirmation-ok">Löschen</button>
                    <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Abbrechen</button>
                </div>
            </div>
        </div>
    </div>
';
    return $ret;
}