diff --git a/modules/anagrafiche/actions.php b/modules/anagrafiche/actions.php index f10f8c5b9..7810d283b 100755 --- a/modules/anagrafiche/actions.php +++ b/modules/anagrafiche/actions.php @@ -284,6 +284,16 @@ switch (post('op')) { break; + // Informazioni sulla posizione della sede + case 'posizione': + $sede = $anagrafica->sedeLegale; + $sede->gaddress = post('gaddress'); + $sede->lat = post('lat'); + $sede->lng = post('lng'); + + $sede->save(); + break; + case 'delete': // Se l'anagrafica non è l'azienda principale, la disattivo if (!$anagrafica->isAzienda()) { diff --git a/modules/anagrafiche/edit.php b/modules/anagrafiche/edit.php index 019c4846f..8567d2908 100755 --- a/modules/anagrafiche/edit.php +++ b/modules/anagrafiche/edit.php @@ -131,114 +131,168 @@ if (!$is_cliente) { -
-
-

-
-
-
+
+
+
+
+

+
+
-
- {[ "type": "text", "label": "", "name": "indirizzo", "value": "$indirizzo$" ]} -
+
+
+ {[ "type": "text", "label": "", "name": "indirizzo", "value": "$indirizzo$" ]} +
-
- {[ "type": "text", "label": "", "name": "indirizzo2", "value": "$indirizzo2$" ]} -
+
+ {[ "type": "text", "label": "", "name": "indirizzo2", "value": "$indirizzo2$" ]} +
-
- {[ "type": "text", "label": "", "name": "cap", "maxlength": 5, "class": "text-center", "value": "$cap$" ]} -
+
+ {[ "type": "text", "label": "", "name": "cap", "maxlength": 5, "class": "text-center", "value": "$cap$" ]} +
-
- {[ "type": "text", "label": "", "name": "citta", "class": "text-center", "value": "$citta$" ]} +
+ +
+
+ {[ "type": "text", "label": "", "name": "citta", "class": "text-center", "value": "$citta$" ]} +
+ +
+ {[ "type": "text", "label": "", "name": "provincia", "maxlength": 2, "class": "text-center provincia-mask text-uppercase", "value": "$provincia$", "extra": "onkeyup=\"this.value = this.value.toUpperCase();\"" ]} +
+ +
+ {[ "type": "select", "label": "", "name": "id_nazione", "value": "$id_nazione$", "ajax-source": "nazioni" ]} +
+
+ +
+
+ {[ "type": "text", "label": "", "name": "telefono", "class": "text-center", "value": "$telefono$", "icon-before": "" ]} +
+ +
+ {[ "type": "text", "label": "", "name": "cellulare", "class": "text-center", "value": "$cellulare$", "icon-before": "" ]} +
+ +
+ {[ "type": "text", "label": "", "name": "email", "class": "email-mask", "placeholder": "casella@dominio.ext", "value": "$email$", "icon-before": "", "validation": "email" ]} +
+
+ +
+
+ {[ "type": "text", "label": "", "name": "fax", "class": "text-center", "value": "$fax$", "icon-before": "" ]} +
+ +
+ {[ "type": "select", "label": "", "name": "idzona", "values": "query=SELECT id, CONCAT_WS( ' - ', nome, descrizione) AS descrizione FROM an_zone ORDER BY descrizione ASC", "value": "$idzona$", "placeholder": "", "icon-after": "add|" ]} +
+ +
+ {[ "type": "number", "label": "", "name": "km", "decimals":"1", "class": "text-center", "value": "$km$", "icon-after": "Km" ]} +
+
+
-
-
- {[ "type": "text", "label": "", "name": "provincia", "maxlength": 2, "class": "text-center provincia-mask text-uppercase", "value": "$provincia$", "extra": "onkeyup=\"this.value = this.value.toUpperCase();\"" ]} -
- -
- {[ "type": "select", "label": "", "name": "id_nazione", "value": "$id_nazione$", "ajax-source": "nazioni" ]} -
- -
- {[ "type": "select", "label": "", "name": "idzona", "values": "query=SELECT id, CONCAT_WS( ' - ', nome, descrizione) AS descrizione FROM an_zone ORDER BY descrizione ASC", "value": "$idzona$", "placeholder": "", "icon-after": "add|" ]} -
- -
- {[ "type": "number", "label": "", "name": "km", "decimals":"1", "class": "text-center", "value": "$km$", "icon-after": "Km" ]} -
-
- -
-
- {[ "type": "text", "label": "", "name": "telefono", "class": "text-center", "value": "$telefono$", "icon-before": "" ]} -
- -
- {[ "type": "text", "label": "", "name": "fax", "class": "text-center", "value": "$fax$", "icon-before": "" ]} -
- -
- {[ "type": "text", "label": "", "name": "cellulare", "class": "text-center", "value": "$cellulare$", "icon-before": "" ]} -
- -
- {[ "type": "text", "label": "", "name": "email", "class": "email-mask", "placeholder": "casella@dominio.ext", "value": "$email$", "icon-before": "", "validation": "email" ]} -
-
- - -
-
-
- {[ "type": "text", "label": "'.tr('Indirizzo Google').'", "name": "gaddress", "value": "$gaddress$", "extra": "data-geo=\'formatted_address\'" ]} -
- -
- {[ "type": "text", "label": "'.tr('Latitudine').'", "name": "lat", "value": "$lat$", "extra": "data-geo=\'lat\'", "class": "text-right" ]} -
- -
- {[ "type": "text", "label": "'.tr('Longitudine').'", "name": "lng", "value": "$lng$", "extra": "data-geo=\'lng\'", "class": "text-right" ]} -
+echo ' +
+
+
+

'.tr('Geolocalizzazione').'

-
'; - - // Calcola percorso - if (empty($record['gaddress']) || (empty($record['lat']) && empty($record['lng']))) { - echo ' - '; - } +
'; +if (empty($google)) { echo ' -
'; +
+ '.Modules::link('Impostazioni', $dbo->fetchOne("SELECT `id` FROM `zz_settings` WHERE nome='Google Maps API key'")['id'], tr('Per abilitare la visualizzazione delle anagrafiche nella mappa, inserire la Google Maps API Key nella scheda Impostazioni')).'. +
'; +} elseif (!empty($record['gaddress']) || (!empty($record['lat']) && !empty($record['lng']))) { + echo ' +
- if (!empty($record['gaddress']) || (!empty($record['lat']) && !empty($record['lng']))) { - echo ' -
'; - } +
+
'; + + // Navigazione diretta verso l'indirizzo + echo ' + + '.tr('Calcola percorso').' + '; + + // Modifica manuale delle informazioni + echo ' + + '.tr('Modifica posizione').' + '; } else { + // Modifica manuale delle informazioni echo ' -
- '.Modules::link('Impostazioni', $dbo->fetchOne("SELECT `id` FROM `zz_settings` WHERE nome='Google Maps API key'")['id'], tr('Per abilitare la visualizzazione delle anagrafiche nella mappa, inserire la Google Maps API Key nella scheda Impostazioni')).'. -
'; + + '.tr('Modifica posizione').' + '; + + // Ricerca diretta su Google Maps + echo ' + + '.tr('Cerca su Google Maps').' + '; } echo ' +
+
+
-
'; + + '; if ($is_cliente or $is_fornitore or $is_tecnico) { echo ' @@ -637,16 +691,6 @@ if (empty($record['deleted_at'])) { $("#colore").parent().find(".square").css("background", $("#colore").val()); - $("#geocomplete input").geocomplete({ - map: $("#map").length ? "#map" : false, - location: $("#gaddress").val() ? $("#gaddress").val() : [$("#lat").val(), $("#lng").val()], - details: ".details", - detailsAttribute: "data-geo" - }).bind("geocode:result", function (event, result) { - $("#lat").val(result.geometry.location.lat()); - $("#lng").val(result.geometry.location.lng()); - }); - // Abilito solo ragione sociale oppure solo cognome-nome in base a cosa compilo $('#nome, #cognome').bind("keyup change", function(e) { if ($('#nome').val() == '' && $('#cognome').val() == '' ){ diff --git a/modules/anagrafiche/modals/posizione.php b/modules/anagrafiche/modals/posizione.php new file mode 100644 index 000000000..885f358b9 --- /dev/null +++ b/modules/anagrafiche/modals/posizione.php @@ -0,0 +1,50 @@ + + + + +
+
+ {[ "type": "text", "label": "'.tr('Indirizzo Google').'", "name": "gaddress", "value": "'.$record['gaddress'].'", "extra": "data-geo=\'formatted_address\'" ]} +
+ +
+ {[ "type": "text", "label": "'.tr('Latitudine').'", "name": "lat", "value": "'.$record['lat'].'", "extra": "data-geo=\'lat\'", "class": "text-right" ]} +
+ +
+ {[ "type": "text", "label": "'.tr('Longitudine').'", "name": "lng", "value": "'.$record['lng'].'", "extra": "data-geo=\'lng\'", "class": "text-right" ]} +
+
+ +
+ + +
+
+ +
+
+'; + +echo ' + + +';