Bernd Wurst commited on 2020-06-14 18:17:06
Zeige 13 geänderte Dateien mit 528 Einfügungen und 96 Löschungen.
... | ... |
@@ -0,0 +1,35 @@ |
1 |
+<?php |
|
2 |
+require_once 'lib/api.php'; |
|
3 |
+require_once 'lib/tools.php'; |
|
4 |
+// some sort of limit?! |
|
5 |
+session_start(); |
|
6 |
+ |
|
7 |
+$ret = ''; |
|
8 |
+$data = array("kunde" => array(), "uuid" => ''); |
|
9 |
+ |
|
10 |
+$fields = array("firma", "vorname", "nachname", "adresse", "plz", "ort"); |
|
11 |
+foreach ($fields as $key) { |
|
12 |
+ if (isset($_GET[$key])) { |
|
13 |
+ $data['kunde'][$key] = $_GET[$key]; |
|
14 |
+ } |
|
15 |
+} |
|
16 |
+if (isset($_GET['telefon'])) { |
|
17 |
+ $data['kunde']['kontakt'] = array(); |
|
18 |
+ $data['kunde']['kontakt'][] = array( |
|
19 |
+ "typ" => "telefon", |
|
20 |
+ "wert" => $_GET['telefon']); |
|
21 |
+} |
|
22 |
+$data['uuid'] = chop(sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535))); |
|
23 |
+ |
|
24 |
+$ret = api_call('kunde/neu', $data); |
|
25 |
+ |
|
26 |
+if (!isset($ret['kunde'])) { |
|
27 |
+ return; |
|
28 |
+} |
|
29 |
+$ret['kunde']['html'] = adresse($ret['kunde'], 'kundendaten'); |
|
30 |
+ |
|
31 |
+header('Content-Type: application/json'); |
|
32 |
+echo json_encode($ret['kunde']); |
|
33 |
+ |
|
34 |
+ |
|
35 |
+ |
... | ... |
@@ -0,0 +1,23 @@ |
1 |
+<?php |
|
2 |
+require_once 'lib/api.php'; |
|
3 |
+require_once 'lib/tools.php'; |
|
4 |
+// some sort of limit?! |
|
5 |
+session_start(); |
|
6 |
+ |
|
7 |
+$ret = ''; |
|
8 |
+$data = array(); |
|
9 |
+ |
|
10 |
+if (isset($_GET['kundennr'])) { |
|
11 |
+ $data['kundennr'] = htmlspecialchars($_GET['kundennr']); |
|
12 |
+} |
|
13 |
+ |
|
14 |
+if ($data) { |
|
15 |
+ $ret = api_call('kunde/laden', $data); |
|
16 |
+} |
|
17 |
+ |
|
18 |
+$ret['kunde']['html'] = adresse($ret['kunde'], 'kundendaten'); |
|
19 |
+ |
|
20 |
+header('Content-Type: application/json'); |
|
21 |
+echo json_encode($ret['kunde']); |
|
22 |
+ |
|
23 |
+ |
... | ... |
@@ -0,0 +1,20 @@ |
1 |
+<?php |
|
2 |
+require_once 'lib/api.php'; |
|
3 |
+// some sort of limit?! |
|
4 |
+session_start(); |
|
5 |
+ |
|
6 |
+$ret = ''; |
|
7 |
+$data = array(); |
|
8 |
+ |
|
9 |
+if (isset($_GET['name'])) { |
|
10 |
+ $data['name'] = htmlspecialchars($_GET['name']); |
|
11 |
+} |
|
12 |
+ |
|
13 |
+if ($data) { |
|
14 |
+ $ret = api_call('kunde/suchen', $data); |
|
15 |
+} |
|
16 |
+ |
|
17 |
+header('Content-Type: application/json'); |
|
18 |
+echo json_encode($ret['kunden']); |
|
19 |
+ |
|
20 |
+ |
... | ... |
@@ -0,0 +1,34 @@ |
1 |
+<?php |
|
2 |
+require_once 'lib/api.php'; |
|
3 |
+// some sort of limit?! |
|
4 |
+session_start(); |
|
5 |
+ |
|
6 |
+$ret = ''; |
|
7 |
+$data = array(); |
|
8 |
+ |
|
9 |
+if (isset($_GET['handle'])) { |
|
10 |
+ $data['handle'] = htmlspecialchars($_GET['handle']); |
|
11 |
+} |
|
12 |
+ |
|
13 |
+if ($data) { |
|
14 |
+ $ret = api_call('vorgang/lesen', $data); |
|
15 |
+} |
|
16 |
+ |
|
17 |
+$auftrag = $ret['vorgang']; |
|
18 |
+ |
|
19 |
+$changes = $_GET; |
|
20 |
+unset($changes['handle']); |
|
21 |
+ |
|
22 |
+foreach ($changes as $path => $value) { |
|
23 |
+ $current =& $auftrag; |
|
24 |
+ // setze Referenz $current Schritt für Schritt auf $array['item_1']['item_2'][...]['item_n'] |
|
25 |
+ foreach(explode('/', $path) as $key) { |
|
26 |
+ $current =& $current[$key]; |
|
27 |
+ } |
|
28 |
+ // belege dieses Array-Element mit $value |
|
29 |
+ $current = $value; |
|
30 |
+} |
|
31 |
+ |
|
32 |
+api_call('vorgang/aendern', $auftrag); |
|
33 |
+ |
|
34 |
+ |
... | ... |
@@ -1,9 +1,107 @@ |
1 |
-function kunde_zum_auftrag_clicked() { |
|
1 |
+var auftragsname_automatisch = false; |
|
2 | 2 |
|
3 |
+ |
|
4 |
+function kunde_suchen( ) { |
|
5 |
+ $('#kundensuche-dialog').modal("show"); |
|
6 |
+ $('#kundensuche_suchfeld').change(); |
|
7 |
+} |
|
8 |
+ |
|
9 |
+function lade_kundendaten_callback( data ) { |
|
10 |
+ $('#kundendaten_kundenadresse').html(data['html']); |
|
11 |
+ |
|
12 |
+ var fields = ["firma", "vorname", "nachname", "adresse", "plz", "ort"]; |
|
13 |
+ for (let idx in fields) { |
|
14 |
+ val = fields[idx]; |
|
15 |
+ $('#kundendaten_'+val).removeClass('abweichung'); |
|
16 |
+ $('#auftragsdaten_'+val).removeClass('abweichung'); |
|
17 |
+ if ($('#auftragsdaten_'+val).text() != '') { |
|
18 |
+ var abweichung = true; |
|
19 |
+ if ($('#kundendaten_'+val).text() != '') { |
|
20 |
+ if ($('#auftragsdaten_'+val).text() == $('#kundendaten_'+val).text()) { |
|
21 |
+ abweichung = false; |
|
22 |
+ } |
|
23 |
+ } |
|
24 |
+ if (abweichung) { |
|
25 |
+ $('#kundendaten_'+val).addClass('abweichung'); |
|
26 |
+ $('#auftragsdaten_'+val).addClass('abweichung'); |
|
27 |
+ } |
|
28 |
+ } |
|
29 |
+ } |
|
30 |
+ tel = $('#auftragsdaten_telefon').text(); |
|
31 |
+ var found = false; |
|
32 |
+ $('#kundendaten_telefon>.telefon_wert').each(function () { |
|
33 |
+ if ($(this).text() == tel) { |
|
34 |
+ found = true; |
|
35 |
+ } |
|
36 |
+ }); |
|
37 |
+ if (! found) { |
|
38 |
+ $('#auftragsdaten_telefon').addClass('abweichung'); |
|
39 |
+ } else { |
|
40 |
+ $('#auftragsdaten_telefon').removeClass('abweichung'); |
|
41 |
+ } |
|
42 |
+ |
|
43 |
+ $('span.telefon_wert').click(telefonnummer_fuer_auftrag); |
|
44 |
+ |
|
45 |
+ // Auftragsname setzen |
|
46 |
+ if (auftragsname_automatisch || $('#name').val() == '' || $('#name').val() == $('#auftragsdaten_nachname').text()) { |
|
47 |
+ var name = ''; |
|
48 |
+ if ($('#auftragsdaten_firma').text() != '') { |
|
49 |
+ name = $('#auftragsdaten_firma').text() |
|
50 |
+ } else { |
|
51 |
+ if ($('#kundendaten_firma').text() != '') { |
|
52 |
+ name = $('#kundendaten_firma').text(); |
|
53 |
+ } else { |
|
54 |
+ name = $('#auftragsdaten_nachname').text(); |
|
55 |
+ if ($('#auftragsdaten_vorname').text() != '') { |
|
56 |
+ name += ', '+$('#auftragsdaten_vorname').text(); |
|
57 |
+ } else { |
|
58 |
+ if ($('#auftragsdaten_nachname').text() == $('#kundendaten_nachname').text() && |
|
59 |
+ $('#auftragsdaten_vorname').text() == '') { |
|
60 |
+ name += ', ' + $('#kundendaten_vorname').text(); |
|
61 |
+ } |
|
62 |
+ } |
|
63 |
+ } |
|
64 |
+ } |
|
65 |
+ $('#name').val(name); |
|
66 |
+ auftrag_name_speichern(); |
|
67 |
+ auftragsname_automatisch = name; |
|
68 |
+ } |
|
3 | 69 |
} |
4 | 70 |
|
71 |
+function auftrag_name_speichern() { |
|
72 |
+ name = $('#name').val(); |
|
73 |
+ $.getJSON('ajax_vorgang_aendern.php', {"handle": $('#handle').val(), "name": name}); |
|
74 |
+} |
|
75 |
+ |
|
76 |
+function auftrag_telefon_speichern() { |
|
77 |
+ nummer = $('#telefon').val(); |
|
78 |
+ $.getJSON('ajax_vorgang_aendern.php', {"handle": $('#handle').val(), "telefon": nummer}); |
|
79 |
+} |
|
80 |
+ |
|
81 |
+function telefonnummer_fuer_auftrag() { |
|
82 |
+ $('#telefon').val($(this).text()); |
|
83 |
+ auftrag_telefon_speichern() |
|
84 |
+} |
|
85 |
+ |
|
86 |
+ |
|
87 |
+function gitterbox_loeschen() { |
|
88 |
+} |
|
5 | 89 |
|
6 | 90 |
|
7 | 91 |
$(document).ready(function () { |
8 |
- $('#kunde_zum_auftrag').click(kunde_zum_auftrag_clicked); |
|
92 |
+ $('#kundendaten_kundennr').change(function () { |
|
93 |
+ if ($('#kundendaten_kundennr').val() != '') { |
|
94 |
+ $.getJSON('ajax_kundendaten.php', {"kundennr": $('#kundendaten_kundennr').val()}, lade_kundendaten_callback); |
|
95 |
+ } else { |
|
96 |
+ $('#kundendaten_kundenadresse').clear(); |
|
97 |
+ } |
|
98 |
+ }); |
|
99 |
+ $('#name').change(auftrag_name_speichern); |
|
100 |
+ $('#telefon').change(auftrag_telefon_speichern); |
|
101 |
+ $('#auftragsdaten_telefon').click(telefonnummer_fuer_auftrag); |
|
102 |
+ $('#btn_kunde_suchen').click( kunde_suchen ); |
|
103 |
+ if ($('#kundendaten_kundennr').val() != '') { |
|
104 |
+ $.getJSON('ajax_kundendaten.php', {"kundennr": $('#kundendaten_kundennr').val()}, lade_kundendaten_callback); |
|
105 |
+ } |
|
106 |
+ modal_kundensuche(); |
|
9 | 107 |
}); |
... | ... |
@@ -1,3 +1,108 @@ |
1 |
+// Modal Kundensuche |
|
2 |
+function kundensuche_callback( data ) { |
|
3 |
+ $('#kundensuche_ergebnisse').empty(); |
|
4 |
+ var item; |
|
5 |
+ for (let key in data) { |
|
6 |
+ var item = data[key]; |
|
7 |
+ var name = ''; |
|
8 |
+ if (item['nachname']) { |
|
9 |
+ name += item['nachname']; |
|
10 |
+ } |
|
11 |
+ if (item['vorname'] != null) { |
|
12 |
+ name = name + ', ' + item['vorname']; |
|
13 |
+ } |
|
14 |
+ if (item['firma'] != null) { |
|
15 |
+ if (name != '') { |
|
16 |
+ name = item['firma'] + ' (' + name + ')'; |
|
17 |
+ } else { |
|
18 |
+ name = item['firma']; |
|
19 |
+ } |
|
20 |
+ } |
|
21 |
+ var telefon = ''; |
|
22 |
+ for (let x in item['kontakt']) { |
|
23 |
+ kk = item['kontakt'][x]; |
|
24 |
+ if (telefon != '') { |
|
25 |
+ telefon = telefon+' / '; |
|
26 |
+ } |
|
27 |
+ telefon += kk['wert']; |
|
28 |
+ } |
|
29 |
+ var adresse = ''; |
|
30 |
+ if (item['ort']) { |
|
31 |
+ adresse = item['ort']; |
|
32 |
+ if (item['plz']) { |
|
33 |
+ adresse = item['plz'] + ' ' + adresse; |
|
34 |
+ } |
|
35 |
+ if (item['adresse']) { |
|
36 |
+ adresse = item['adresse'] + ' · '+adresse; |
|
37 |
+ } |
|
38 |
+ } |
|
39 |
+ if (adresse) { |
|
40 |
+ adresse = ' · '+adresse; |
|
41 |
+ } |
|
42 |
+ $('#kundensuche_ergebnisse').append( |
|
43 |
+ '<a href="#" class="kundensuche_ergebnis">#<span class="kundensuche_kundennr">'+item['kundennr']+'</span>: '+name + adresse+'<br>'+telefon+'</a>'); |
|
44 |
+ } |
|
45 |
+ $('.kundensuche_ergebnis').click(function ( ev ) { |
|
46 |
+ var kundennr = $(this).find('span').text(); |
|
47 |
+ $('#kundendaten_kundennr').val(kundennr); |
|
48 |
+ $('#kundendaten_kundennr').change(); |
|
49 |
+ $('#kundensuche-dialog').modal('hide'); |
|
50 |
+ ev.preventDefault(); |
|
51 |
+ }); |
|
52 |
+} |
|
53 |
+ |
|
54 |
+function kundeerstellen_callback( data ) { |
|
55 |
+ if (data['kundennr'] != '') { |
|
56 |
+ $('#kundendaten_kundennr').val(kundennr); |
|
57 |
+ $('#kundendaten_kundennr').change(); |
|
58 |
+ $('#kundeerstellen-dialog').modal('hide'); |
|
59 |
+ } |
|
60 |
+} |
|
61 |
+ |
|
62 |
+ |
|
63 |
+function kundensuche_kundeerstellen_submit() |
|
64 |
+{ |
|
65 |
+ $.getJSON('ajax_kunde_erstellen.php', { |
|
66 |
+ "firma": $('#kundeerstellen_firma').val(), |
|
67 |
+ "vorname": $('#kundeerstellen_vorname').val(), |
|
68 |
+ "nachname": $('#kundeerstellen_nachname').val(), |
|
69 |
+ "adresse": $('#kundeerstellen_adresse').val(), |
|
70 |
+ "plz": $('#kundeerstellen_plz').val(), |
|
71 |
+ "ort": $('#kundeerstellen_ort').val(), |
|
72 |
+ "telefon": $('#kundeerstellen_telefon').val() |
|
73 |
+ }, kundeerstellen_callback); |
|
74 |
+} |
|
75 |
+ |
|
76 |
+function modal_kundensuche() { |
|
77 |
+ // Modal Kundensuche |
|
78 |
+ var kundensuche_typeTimer; |
|
79 |
+ var kundensuche_suche; |
|
80 |
+ $('span.clickable_text').click( function () { |
|
81 |
+ $('#kundensuche_suchfeld').val(this.textContent); |
|
82 |
+ $('#kundensuche_suchfeld').change(); |
|
83 |
+ }); |
|
84 |
+ $('#kundensuche_suchfeld').focus( function() { |
|
85 |
+ $(this).select(); |
|
86 |
+ }); |
|
87 |
+ $('#kundensuche_suchfeld').on('paste change', function() { |
|
88 |
+ if ($('#kundensuche_suchfeld').val().length > 2) { |
|
89 |
+ $.getJSON('ajax_kundensuche.php', {"name": $('#kundensuche_suchfeld').val()}, kundensuche_callback); |
|
90 |
+ } |
|
91 |
+ }); |
|
92 |
+ $('#kundensuche_suchfeld').keyup( function () { |
|
93 |
+ clearTimeout(kundensuche_typeTimer); |
|
94 |
+ kundensuche_suche = ''; |
|
95 |
+ kundensuche_typeTimer = setTimeout( function() { |
|
96 |
+ $('#kundensuche_suchfeld').change(); |
|
97 |
+ },1000); |
|
98 |
+ }); |
|
99 |
+ $('#kundensuche_neuerkunde').click(function () { |
|
100 |
+ $('#kundensuche-dialog').modal('hide'); |
|
101 |
+ $('#kundeerstellen-dialog').modal('show'); |
|
102 |
+ }); |
|
103 |
+ $('#kundeerstellen_submit').click( kundensuche_kundeerstellen_submit ); |
|
104 |
+} |
|
105 |
+ |
|
1 | 106 |
|
2 | 107 |
$(document).ready( function () { |
3 | 108 |
|
... | ... |
@@ -38,14 +38,15 @@ div.lieferart { |
38 | 38 |
display: flex; |
39 | 39 |
|
40 | 40 |
} |
41 |
-div.lieferart > p { |
|
41 |
+div.lieferart > a { |
|
42 | 42 |
text-align: center; |
43 | 43 |
padding: 0.2em; |
44 | 44 |
margin: 0.2em; |
45 | 45 |
border: 1px solid #040; |
46 |
+ color: #000; |
|
46 | 47 |
} |
47 | 48 |
|
48 |
-p.gitterbox { |
|
49 |
+a.gitterbox { |
|
49 | 50 |
|
50 | 51 |
} |
51 | 52 |
|
... | ... |
@@ -211,3 +212,18 @@ input[type=submit] { |
211 | 212 |
margin-top: 5em; |
212 | 213 |
} |
213 | 214 |
|
215 |
+span.abweichung { |
|
216 |
+ color: #f00; |
|
217 |
+ background-color: yellow; |
|
218 |
+} |
|
219 |
+ |
|
220 |
+a.kundensuche_ergebnis { |
|
221 |
+ display: block; |
|
222 |
+ color: #000; |
|
223 |
+ border: 1px solid #040; |
|
224 |
+ border-radius: 3px; |
|
225 |
+ padding: 0.2em; |
|
226 |
+ margin-bottom: 0.2em; |
|
227 |
+} |
|
228 |
+ |
|
229 |
+ |
... | ... |
@@ -1,8 +1,11 @@ |
1 | 1 |
<?php |
2 | 2 |
require_once 'lib/api.php'; |
3 |
+require_once 'lib/modal.php'; |
|
4 |
+require_once 'lib/tools.php'; |
|
3 | 5 |
session_start(); |
4 | 6 |
|
5 | 7 |
$handle = null; |
8 |
+$handle_length = 8; |
|
6 | 9 |
if (isset($_GET['handle'])) { |
7 | 10 |
$handle = $_GET['handle']; |
8 | 11 |
} else { |
... | ... |
@@ -12,8 +15,8 @@ if (isset($_GET['handle'])) { |
12 | 15 |
|
13 | 16 |
$data = array("handle" => $handle); |
14 | 17 |
|
15 |
-$ret = api_call('auftrag/lesen', $data); |
|
16 |
-$a = $ret['auftrag']; |
|
18 |
+$ret = api_call('vorgang/lesen', $data); |
|
19 |
+$a = $ret['vorgang']; |
|
17 | 20 |
|
18 | 21 |
if (isset($_GET['handle']) && $a['revision'] == 0) { |
19 | 22 |
echo "Fehler im System"; |
... | ... |
@@ -24,77 +27,30 @@ if (isset($_GET['handle']) && $a['revision'] == 0) { |
24 | 27 |
|
25 | 28 |
$previous = 'unbestaetigte.php'; |
26 | 29 |
$headline = 'Auftrag bestätigen'; |
27 |
-$content = ''; |
|
30 |
+$content = '<input type="hidden" id="handle" name="handle" value="'.$handle.'">'; |
|
28 | 31 |
|
29 | 32 |
$content .= '<h3>Kundendaten</h3>'; |
30 |
-$content .= '<div class="auftrag-kopf">'; |
|
31 |
-$addr = array(); |
|
32 |
-if (isset($a['kundendaten']['firma'])) { |
|
33 |
- $addr[] = $a['kundendaten']['firma']; |
|
34 |
-} |
|
35 |
-if (isset($a['kundendaten']['vorname'])) { |
|
36 |
- $addr[] = $a['kundendaten']['vorname'].' '.$a['kundendaten']['nachname']; |
|
37 |
-} else { |
|
38 |
- $addr[] = $a['kundendaten']['nachname']; |
|
39 |
-} |
|
40 |
-if (isset($a['kundendaten']['adresse'])) { |
|
41 |
- $addr[] = $a['kundendaten']['adresse']; |
|
42 |
-} |
|
43 |
-if (isset($a['kundendaten']['ort'])) { |
|
44 |
- $addr[] = $a['kundendaten']['plz'].' '.$a['kundendaten']['ort']; |
|
45 |
-} |
|
46 |
-$addr[] = $a['kundendaten']['telefon']; |
|
47 |
- |
|
48 |
-$name = $a['name']; |
|
49 |
-if (!$name) { |
|
50 |
- $name .= $a['telefon']; |
|
51 |
-} |
|
52 |
- |
|
53 |
-$content .= '<div class="kundendaten_auftrag">'.implode('<br>', $addr).' |
|
54 |
-<div class="auftragname_input"> |
|
55 |
-<label for="name"><em>Name für den Auftrag</em></label><br><input type="text" placeholder="Name" value="'.$name.'"><br> |
|
56 |
-<button class="btn btn-secondary" id="name_save" label="Name speichern">Speichern</button> |
|
57 |
-</div> |
|
58 |
-</div>'; |
|
59 |
- |
|
60 |
-$addr = array(); |
|
61 |
-if (isset($a['kundennr'])) { |
|
62 |
- $addr[] = 'Kundennummer: '.$a['kundennr']; |
|
63 |
- $data = array("kundennr" => $a['kundennr']); |
|
64 |
- $ret = api_call('kunde/laden', $data); |
|
65 |
- if (isset($ret['kunde'])) { |
|
66 |
- if (isset($ret['kunde']['firma'])) { |
|
67 |
- $addr[] = $ret['kunde']['firma']; |
|
68 |
- } |
|
69 |
- if (isset($ret['kunde']['vorname'])) { |
|
70 |
- $addr[] = $ret['kunde']['vorname'].' '.$ret['kunde']['nachname']; |
|
71 |
- } else { |
|
72 |
- $addr[] = $ret['kunde']['nachname']; |
|
73 |
- } |
|
74 |
- if (isset($ret['kunde']['adresse'])) { |
|
75 |
- $addr[] = $ret['kunde']['adresse']; |
|
76 |
- } |
|
77 |
- if (isset($ret['kunde']['ort'])) { |
|
78 |
- $addr[] = $ret['kunde']['plz'].' '.$ret['kunde']['ort']; |
|
79 |
- } |
|
80 |
- foreach ($ret['kunde']['kontakt'] as $kk) { |
|
81 |
- $addr[] = ucwords($kk['typ']).': '.$kk['wert'].($kk['notizen'] ? ' ('.$kk['notizen'].')' : ''); |
|
82 |
- } |
|
83 |
- } else { |
|
84 |
- $addr[] = '<em>Fehler beim Abrufen der Kundendaten</em>'; |
|
85 |
- } |
|
86 |
-} else { |
|
87 |
- $addr[] = '<em>Keinem Kundenkonto zugeordnet</em>'; |
|
88 |
-} |
|
89 |
- |
|
90 |
-$content .= '<div class="kundendaten_aktionen"> |
|
91 |
- <button id="kunde_zum_auftrag" title="Fehlende Daten von Kundendaten übernehmen" class="btn btn-secondary"><----</button><br> |
|
92 |
- <button id="auftrag_zum_kunde" title="abweichende Daten in den Kundendaten aktualisieren" class="btn btn-secondary">----></button> |
|
33 |
+$content .= '<p><label for="name">Name für den Auftrag</label> <input type="text" name="auftrag_name" id="name" value="'.$a['name'].'"></p>'; |
|
34 |
+$content .= '<p><label for="telefon">Telefonnummer für den Auftrag</label> <input type="text" name="auftrag_telefon" id="telefon" value="'.$a['telefon'].'"></p>'; |
|
35 |
+ |
|
36 |
+$content .= '<div class="auftrag-kopf"> |
|
37 |
+<div class="kundendaten_auftrag"> |
|
38 |
+<p><em>Angaben des Kunden:</em></p> |
|
39 |
+<p id="auftrag_kundenadresse">'; |
|
40 |
+$content .= adresse($a['kundendaten'], 'auftragsdaten'); |
|
41 |
+ |
|
42 |
+$content .= '</p>'; |
|
43 |
+$content .= '</div> |
|
44 |
+<div class="kundendaten_kunde"> |
|
45 |
+<p><em>Aus der Datenbank</em></p> |
|
46 |
+<p id="kundendaten_kundenadresse">---</p>'; |
|
47 |
+$content .= '</td><td><input type="hidden" name="kundendaten_kundennr" id="kundendaten_kundennr" value="'.(isset($a['kundennr']) ? $a['kundennr'] : '').'"><button class="btn btn-secondary" id="btn_kunde_suchen">Kunde suchen</button>'; |
|
48 |
+$content .= '</div>'; |
|
93 | 49 |
|
94 |
-</div>'; |
|
95 |
-$content .= '<div class="kundendaten_kunde">'.implode('<br>', $addr).'<br><button class="btn btn-secondary" id="kunde_suchen">Kunde suchen</button></div>'; |
|
50 |
+$content .= '</td></tr></table>'; |
|
96 | 51 |
$content .= '</div>'; |
97 | 52 |
|
53 |
+ |
|
98 | 54 |
$content .= '<div class="unterauftrag-container">'; |
99 | 55 |
foreach ($a['bestellung'] as $best) { |
100 | 56 |
// Evtl. Mehrere Posten in dieser Bestellung |
... | ... |
@@ -108,7 +64,7 @@ foreach ($a['bestellung'] as $best) { |
108 | 64 |
} else { |
109 | 65 |
$img .= 'Gitterbox'; |
110 | 66 |
} |
111 |
- $obst[] = '<p class="gitterbox">'.$img.'</p>'; |
|
67 |
+ $obst[] = '<a href="#" class="gitterbox">'.$img.'</a>'; |
|
112 | 68 |
} |
113 | 69 |
foreach ($best['anhaenger'] as $anh) { |
114 | 70 |
$img = '<img class="anhaenger" src="/assets/images/anhaenger.png"><br>'; |
... | ... |
@@ -117,39 +73,68 @@ foreach ($a['bestellung'] as $best) { |
117 | 73 |
} else { |
118 | 74 |
$img .= ' <em>Anhänger</em>'; |
119 | 75 |
} |
120 |
- $obst[] = '<p class="anhaenger">'.$img.'</p>'; |
|
76 |
+ $obst[] = '<a href="#" class="anhaenger">'.$img.'</a>'; |
|
77 |
+ } |
|
78 |
+ $content .= '<div class="lieferart">'.implode('', $obst).'<a href="#" class="gitterbox_neu">+<br>Weitere Lieferung</a></div>'; |
|
79 |
+ $content .= '<div class="obstmenge">'; |
|
80 |
+ $val = 0; |
|
81 |
+ if (isset($best['obstmenge'])) { |
|
82 |
+ $val = $best['obstmenge']; |
|
121 | 83 |
} |
122 |
- $content .= '<div class="lieferart">'.implode('', $obst).'</div>'; |
|
84 |
+ $content .= '<label for="obstmenge">Obstmenge:</label> <input type="number" id="obstmenge" name="obstmenge" value="'.$val.'" step="10" min="0" maxlength="4"> '; |
|
85 |
+ foreach (array(50, 100, 150, 200, 250, 300, 350, 400) as $v) { |
|
86 |
+ $v = max((count($best['gitterbox'])-1),0) * 400 + $v; |
|
87 |
+ $content .= '<button class="obstmenge_vorschlag btn btn-outline-secondary">'.$v.'</button> '; |
|
88 |
+ } |
|
89 |
+ $content .= '</div>'; |
|
123 | 90 |
// Gebrauchte |
91 |
+ $sel = 'gebrauchte_nein'; |
|
124 | 92 |
if ($best['gebrauchte']) { |
125 |
- $content .= '<p class="gebrauchte">Gebrauchte Kartons: <strong>JA</strong></p>'; |
|
126 |
- } else { |
|
127 |
- $content .= '<p class="gebrauchte">Gebrauchte Kartons: <strong>NEIN</strong></p>'; |
|
93 |
+ $sel = 'gebrauchte_ja'; |
|
128 | 94 |
} |
95 |
+ $content .= '<p class="gebrauchte">Gebrauchte Kartons: |
|
96 |
+ <input type="radio" name="gebrauchte" id="gebrauchte_ja" value="gebrauchte_ja" '.($best['gebrauchte'] ? 'checked="checked"' : '').'> <label for="gebrauchte_ja">JA</label> |
|
97 |
+ <input type="radio" name="gebrauchte" id="gebrauchte_nein" value="gebrauchte_nein" '.($best['gebrauchte'] ? '' : 'checked="checked"').'> <label for="gebrauchte_nein">NEIN</label> |
|
98 |
+ </p>'; |
|
129 | 99 |
// Neue |
130 |
- $neue = array(); |
|
131 |
- if (count($best['neue']) == 1) { |
|
132 |
- $key = array_keys($best['neue']); |
|
133 |
- if ($key[0] != 'sonstiges') { |
|
134 |
- $neue[] = 'Nur/Zuerst <strong>'.$key[0].'</strong>'; |
|
135 |
- } |
|
136 |
- } else { |
|
137 |
- foreach ($best['neue'] as $key => $val) { |
|
138 |
- $neue[] = '<strong>'.$key.'</strong>: '.$val; |
|
139 |
- } |
|
100 |
+ $content .= '<div class="neue"> |
|
101 |
+ <input type="radio" name="neue" value="3er" id="btn_neue_3er" '.(isset($best['neue']['3er']) && $best['neue']['3er'] == '100%' ? 'checked="checked"' : '').'> <label for="btn_neue_3er">3er</label> |
|
102 |
+ <input type="radio" name="neue" value="5er" id="btn_neue_5er" '.(isset($best['neue']['5er']) && $best['neue']['5er'] == '100%' ? 'checked="checked"' : '').'> <label for="btn_neue_5er">5er</label> |
|
103 |
+ <input type="radio" name="neue" value="10er" id="btn_neue_10er" '.(isset($best['neue']['10er']) && $best['neue']['10er'] == '100%' ? 'checked="checked"' : '').'> <label for="btn_neue_10er">10er</label> |
|
104 |
+ <input type="radio" name="neue" value="sonstiges" id="btn_neue_sonstiges" '.((isset($best['neue']['10er']) && $best['neue']['10er'] == '100%') || (isset($best['neue']['5er']) && $best['neue']['5er'] == '100%') || (isset($best['neue']['3er']) && $best['neue']['3er'] == '100%') ? '' : 'checked="checked"').'> <label for="btn_neue_sonstiges">Sonstiges</label> |
|
105 |
+ '; |
|
106 |
+ $neue = array("3er" => '', "5er" => '', "10er" => ''); |
|
107 |
+ foreach ($neue as $key => $val) { |
|
108 |
+ $val = ''; |
|
109 |
+ if (isset($best['neue'][$key])) { |
|
110 |
+ $val = $best['neue'][$key]; |
|
111 |
+ } |
|
112 |
+ $neue[] = 'Neue <strong>'.$key.'</strong>: <input type="text" id="neue_'.$key.'" value="'.$val.'"> <button class="btn btn-secondary" id="button_halb_'.$key.'">Halbe Liter in '.$key.'</button>'; |
|
140 | 113 |
} |
141 | 114 |
if (isset($best['neue']['sonstiges'])) { |
142 | 115 |
$neue[] = '<em>'.$best['neue']['sonstiges'].'</em>'; |
143 | 116 |
} |
144 |
- $content .= '<div class="neue"><p>'.implode('</p><p>', $neue).'</p></div>'; |
|
145 |
- if (isset($best['anmerkungen'])) { |
|
146 |
- $content .= '<div class="anmerkungen">'.htmlspecialchars($best['anmerkungen']).'</div>'; |
|
117 |
+ $content .= '<div class="neue_detail"><p>'.implode('</p><p>', $neue).'</p></div>'; |
|
118 |
+ $content .= '</div>'; |
|
119 |
+ $content .= '<div class="anmerkungen"><textarea name="anmerkungen" id="anmerkungen">'.htmlspecialchars($best['anmerkungen']).'</textarea></div>'; |
|
120 |
+ $content .= '<div class="frischsaft"> |
|
121 |
+ <input type="radio" name="frischsaft_choose" id="frischsaft_nein" '.(isset($best['frischsaft']) && $best['frischsaft'] > 0 ? '' : 'checked="checked"').'> <label for="frischsaft_nein">Nein</label> |
|
122 |
+ <input type="radio" name="frischsaft_choose" id="frischsaft_ja" '.(isset($best['frischsaft']) && $best['frischsaft'] > 0 ? 'checked="checked"' : '').'> <label for="frischsaft_ja">Ja</label> |
|
123 |
+ <input type="number" name="frischsaft" value="'.htmlspecialchars($best['frischsaft']).'"> Liter frisch</div>'; |
|
124 |
+ if (count($a['bestellung']) > 1) { |
|
125 |
+ $content .= '<div class="unterauftrag_bestaetigen"><button class="btn btn-secondary">Diesen Unterauftrag separat annehmen</button></div>'; |
|
147 | 126 |
} |
148 | 127 |
$content .= '</div>'; // Unterauftrag |
149 | 128 |
} |
150 | 129 |
|
151 | 130 |
$content .= '</div>'; // unterauftrag-container |
131 |
+$content .= '<div class="auftrag_bestaetigen"><button class="btn btn-primary">Auftrag bestätigen</button> |
|
132 |
+<button class="btn btn-secondary">Auftrag annehmen und sofort verarbeiten</button></div>'; |
|
152 | 133 |
$content .= '</form>'; |
153 | 134 |
|
135 |
+ |
|
136 |
+$content .= modal_kundensuche($a['kundendaten']); |
|
137 |
+ |
|
138 |
+ |
|
154 | 139 |
include "template.php"; |
155 | 140 |
|
... | ... |
@@ -0,0 +1,72 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+function modal_kundensuche($k = null) { |
|
4 |
+ if (!$k) { |
|
5 |
+ $k = array( |
|
6 |
+ "firma" => "", |
|
7 |
+ "vorname" => "", |
|
8 |
+ "nachname" => "", |
|
9 |
+ "adresse" => "", |
|
10 |
+ "plz" => "", |
|
11 |
+ "ort" => "", |
|
12 |
+ "telefon" => "" |
|
13 |
+ ); |
|
14 |
+ } |
|
15 |
+ |
|
16 |
+ $ret = ' |
|
17 |
+ <div class="modal fade" id="kundensuche-dialog" tabindex="-1" role="dialog" aria-labelledby="Kunde suchen" aria-hidden="true"> |
|
18 |
+ <div class="modal-dialog"> |
|
19 |
+ <div class="modal-content"> |
|
20 |
+ <div class="modal-header"> |
|
21 |
+ <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> |
|
22 |
+ </div> |
|
23 |
+ |
|
24 |
+ <div class="modal-body"> |
|
25 |
+ <p><input id="kundensuche_suchfeld" type="text" name="kundensuche_suchfeld" value="'.$k['nachname'].'"></p> |
|
26 |
+ </div> |
|
27 |
+ |
|
28 |
+ <div class="modal-body" id="kundensuche_ergebnisse"> |
|
29 |
+ </div> |
|
30 |
+ |
|
31 |
+ <div class="modal-footer"> |
|
32 |
+ <button type="button" class="btn btn-outline-primary" id="kundensuche_neuerkunde">Neuen Kunden anlegen</button> |
|
33 |
+ <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Abbrechen</button> |
|
34 |
+ </div> |
|
35 |
+ </div> |
|
36 |
+ </div> |
|
37 |
+ </div> |
|
38 |
+ <div class="modal fade" id="kundeerstellen-dialog" tabindex="-1" role="dialog" aria-labelledby="Kunde anlegen" aria-hidden="true"> |
|
39 |
+ <div class="modal-dialog"> |
|
40 |
+ <div class="modal-content"> |
|
41 |
+ <div class="modal-header"> |
|
42 |
+ <h4 class="modal-title">Neuer Kunde</h4> |
|
43 |
+ </div> |
|
44 |
+ |
|
45 |
+ <div class="modal-body"> |
|
46 |
+ <table> |
|
47 |
+ <tr><td>Firmenname:</td><td><input type="text" name="kundeerstellen_firma" id="kundeerstellen_firma" value="'.$k['firma'].'"</td></tr> |
|
48 |
+ <tr><td>Vorname:</td><td><input type="text" name="kundeerstellen_vorname" id="kundeerstellen_vorname" value="'.$k['vorname'].'"</td></tr> |
|
49 |
+ <tr><td>Nachname:</td><td><input type="text" name="kundeerstellen_nachname" id="kundeerstellen_nachname" value="'.$k['nachname'].'"</td></tr> |
|
50 |
+ <tr><td>Adresse:</td><td><input type="text" name="kundeerstellen_adresse" id="kundeerstellen_adresse" value="'.$k['adresse'].'"</td></tr> |
|
51 |
+ <tr><td>PLZ:</td><td><input type="text" name="kundeerstellen_plz" id="kundeerstellen_plz" value="'.$k['plz'].'"</td></tr> |
|
52 |
+ <tr><td>Ort:</td><td><input type="text" name="kundeerstellen_ort" id="kundeerstellen_ort" value="'.$k['ort'].'"</td></tr> |
|
53 |
+ <tr><td>Telefon:</td><td><input type="text" name="kundeerstellen_telefon" id="kundeerstellen_telefon" value="'.$k['telefon'].'"</td></tr> |
|
54 |
+ </table> |
|
55 |
+ </div> |
|
56 |
+ |
|
57 |
+ <div class="modal-body" id="kundensuche_ergebnisse"> |
|
58 |
+ </div> |
|
59 |
+ |
|
60 |
+ <div class="modal-footer"> |
|
61 |
+ <button type="button" class="btn btn-primary" id="kundeerstellen_submit">Kunde anlegen</button> |
|
62 |
+ <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Abbrechen</button> |
|
63 |
+ </div> |
|
64 |
+ </div> |
|
65 |
+ </div> |
|
66 |
+ </div> |
|
67 |
+'; |
|
68 |
+ return $ret; |
|
69 |
+} |
|
70 |
+ |
|
71 |
+ |
|
72 |
+ |
... | ... |
@@ -0,0 +1,38 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+function adresse($adresse, $idprefix=null) |
|
4 |
+{ |
|
5 |
+ if (!$idprefix) { |
|
6 |
+ $idprefix = ''; |
|
7 |
+ } |
|
8 |
+ $ret = '<span id="'.$idprefix.'_nachname">'.$adresse['nachname'].'</span>'; |
|
9 |
+ if (isset($adresse['vorname'])) { |
|
10 |
+ $ret .= ', <span id="'.$idprefix.'_vorname">'.$adresse['vorname'].'</span>'; |
|
11 |
+ } |
|
12 |
+ if (isset($adresse['firma'])) { |
|
13 |
+ $ret = '<span id="'.$idprefix.'_firma">'.$adresse['firma'].'</span><br>'.$ret; |
|
14 |
+ } |
|
15 |
+ if (isset($adresse['adresse'])) { |
|
16 |
+ $ret .= '<br><span id="'.$idprefix.'_adresse">'.$adresse['adresse'].'</span>'; |
|
17 |
+ } |
|
18 |
+ if (isset($adresse['ort'])) { |
|
19 |
+ $ret .= '<br>'; |
|
20 |
+ if (isset($adresse['plz'])) { |
|
21 |
+ $ret .= '<span id="'.$idprefix.'_plz">'.$adresse['plz'].'</span> '; |
|
22 |
+ } |
|
23 |
+ $ret .= '<span id="'.$idprefix.'_ort">'.$adresse['ort'].'</span>'; |
|
24 |
+ } |
|
25 |
+ if (isset($adresse['telefon'])) { |
|
26 |
+ $ret .= '<br><span id="'.$idprefix.'_telefon">'.$adresse['telefon'].'</span>'; |
|
27 |
+ } |
|
28 |
+ if (isset($adresse['kontakt'])) { |
|
29 |
+ $ret .= '<span id="'.$idprefix.'_telefon">'; |
|
30 |
+ foreach ($adresse['kontakt'] as $kk) { |
|
31 |
+ $ret .= '<br>'.ucwords($kk['typ']).': <span class="telefon_wert">'.$kk['wert'].'</span>'.($kk['notizen'] ? ' ('.$kk['notizen'].')' : ''); |
|
32 |
+ } |
|
33 |
+ $ret .= '</span>'; |
|
34 |
+ } |
|
35 |
+ return $ret; |
|
36 |
+} |
|
37 |
+ |
|
38 |
+ |
... | ... |
@@ -4,7 +4,7 @@ session_start(); |
4 | 4 |
|
5 | 5 |
$data = array("ziel" => "presse"); |
6 | 6 |
|
7 |
-$auftraege = api_call('auftrag/liste', $data); |
|
7 |
+$auftraege = api_call('vorgang/liste', $data); |
|
8 | 8 |
|
9 | 9 |
$previous = 'index.php'; |
10 | 10 |
$headline = 'Aufträge an der Presse'; |
... | ... |
@@ -14,7 +14,7 @@ $content .= '<div class="navbutton"><a class="btn btn-primary" href="unbearbeite |
14 | 14 |
|
15 | 15 |
$content .= '<div class="auftrag-container">'; |
16 | 16 |
|
17 |
-foreach ($auftraege["auftraege"] as $a) { |
|
17 |
+foreach ($auftraege["vorgaenge"] as $a) { |
|
18 | 18 |
$name = $a['name']; |
19 | 19 |
if (!$name) { |
20 | 20 |
$name .= $a['telefon']; |
... | ... |
@@ -16,7 +16,7 @@ |
16 | 16 |
<link href="assets/style.css" rel="stylesheet"> |
17 | 17 |
<script src="assets/script.js"></script> |
18 | 18 |
<?php |
19 |
- $f = 'assets/'.str_replace('.php','.js', $_SERVER['PHP_SELF']); |
|
19 |
+ $f = 'assets/'.str_replace('.php','.js', basename($_SERVER['PHP_SELF'])); |
|
20 | 20 |
if (file_exists($f)) { |
21 | 21 |
echo '<script src="'.$f.'"></script>'; |
22 | 22 |
} |
... | ... |
@@ -7,7 +7,7 @@ $data = array("filter" => array( |
7 | 7 |
"value" => "%bestaetigt%", |
8 | 8 |
"relation" => "notlike")); |
9 | 9 |
|
10 |
-$auftraege = api_call('auftrag/liste', $data); |
|
10 |
+$auftraege = api_call('vorgang/liste', $data); |
|
11 | 11 |
|
12 | 12 |
$previous = 'index.php'; |
13 | 13 |
$headline = 'Neue Aufträge annehmen'; |
... | ... |
@@ -16,7 +16,7 @@ $content = ''; |
16 | 16 |
$content .= '<div class="navbutton"><a class="btn btn-primary" href="auftrag_bestaetigen.php">Auftrag manuell erfassen</a></div>'; |
17 | 17 |
$content .= '<div class="auftrag-container">'; |
18 | 18 |
|
19 |
-foreach ($auftraege["auftraege"] as $a) { |
|
19 |
+foreach ($auftraege["vorgaenge"] as $a) { |
|
20 | 20 |
$name = $a['name']; |
21 | 21 |
if (!$name) { |
22 | 22 |
$name .= $a['telefon']; |
... | ... |
@@ -97,6 +97,10 @@ foreach ($auftraege["auftraege"] as $a) { |
97 | 97 |
if (isset($best['anmerkungen'])) { |
98 | 98 |
$content .= '<div class="anmerkungen">'.htmlspecialchars($best['anmerkungen']).'</div>'; |
99 | 99 |
} |
100 |
+ if (isset($best['frischsaft'])) { |
|
101 |
+ $content .= '<div class="frischsaft">'.htmlspecialchars($best['frischsaft']).' Liter frisch</div>'; |
|
102 |
+ } |
|
103 |
+ |
|
100 | 104 |
$content .= '</div>'; // Unterauftrag |
101 | 105 |
} |
102 | 106 |
$content .= '</a>'; // auftrag |
... | ... |
@@ -105,3 +109,5 @@ $content .= '</div>'; // auftrag-container |
105 | 109 |
|
106 | 110 |
include "template.php"; |
107 | 111 |
|
112 |
+print_r($auftraege["vorgaenge"]); |
|
113 |
+ |
|
108 | 114 |