Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6791 | Rev 6818 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 6791 Rev 6816
Línea 1... Línea 1...
1
<?php
1
<?php
2
$notify = '';
2
$notify = '';
3
$messages = $this->flashMessenger()->getInfoMessages();
3
$messages = $this->flashMessenger()->getInfoMessages();
-
 
4
 
4
foreach ($messages as $message) {
5
foreach ($messages as $message) {
5
	$notify .= "$.fn.showInfo('$message')";
6
	$notify .= "$.fn.showInfo('$message')";
6
}
7
}
Línea 7... Línea 8...
7
 
8
 
Línea 24... Línea 25...
24
	$this->inlineScript()->captureStart();
25
	$this->inlineScript()->captureStart();
25
	echo " jQuery( document ).ready(function( $ ) { $notify }); ";
26
	echo " jQuery( document ).ready(function( $ ) { $notify }); ";
26
	$this->inlineScript()->captureEnd();
27
	$this->inlineScript()->captureEnd();
27
}
28
}
Línea -... Línea 29...
-
 
29
 
-
 
30
$js = <<<JS
-
 
31
let autoComplete;
-
 
32
 
-
 
33
function handleScriptLoad(updateQuery, autoCompleteRef, setAddresObject, setError) {
-
 
34
  autoComplete = new window.google.maps.places.Autocomplete(
-
 
35
    autoCompleteRef.current,
-
 
36
    { types: ["(cities)"]}
-
 
37
  );
-
 
38
  autoComplete.setFields(["address_components", "formatted_address", "geometry"]);
-
 
39
  autoComplete.addListener("place_changed", () =>
-
 
40
    handlePlaceSelect(updateQuery, setAddresObject, setError)
-
 
41
  );
-
 
42
}
-
 
43
 
-
 
44
async function handlePlaceSelect(updateQuery, setAddresObject, setError) {
-
 
45
  const addressObject = autoComplete.getPlace();
-
 
46
  // console.log(addressObject.geometry.location.lat());
-
 
47
  // console.log(addressObject.geometry.location.lng());
-
 
48
  const query = addressObject.formatted_address;
-
 
49
  if(query){
-
 
50
    setError("");
-
 
51
    updateQuery(query);
-
 
52
    setAddresObject({
-
 
53
      ...addressObject, 
-
 
54
      address_components:[
-
 
55
        ...addressObject.address_components, 
-
 
56
        {
-
 
57
          latitude: addressObject.geometry.location.lat(),
-
 
58
          longitude: addressObject.geometry.location.lng(), 
-
 
59
          types:["geometry"]
-
 
60
        }
-
 
61
      ]
-
 
62
    });
-
 
63
  }else{
-
 
64
    setError("$error_msg");
-
 
65
  }
-
 
66
}
-
 
67
JS;
-
 
68
 
Línea 28... Línea 69...
28
 
69
$this->inlineScript()->appendScript($js);
29
 
70
 
30
?>
71
?>