1 |
www |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
$routeDatatableTransaction = $this->url('account-settings/transactions');
|
|
|
4 |
$routeDatatableBrowser = $this->url('account-settings/browsers');
|
|
|
5 |
$routeDatatableIp = $this->url('account-settings/ips');
|
|
|
6 |
$routeDatatableDevice = $this->url('account-settings/devices');
|
|
|
7 |
$routeAddFund = $this->url('account-settings/transactions/add-funds');
|
|
|
8 |
$routeAddFacebook = $this->url('account-settings/add-facebook');
|
|
|
9 |
$routeRemoveFacebook = $this->url('account-settings/remove-facebook');
|
|
|
10 |
$routeAddTwitter = $this->url('account-settings/add-twitter');
|
|
|
11 |
$routeRemoveTwitter = $this->url('account-settings/remove-twitter');
|
|
|
12 |
$routeAddGoogle = $this->url('account-settings/add-google');
|
|
|
13 |
$routeRemoveGoogle = $this->url('account-settings/remove-google');
|
|
|
14 |
$routeDatatableTransaction = $this->url('account-settings/transactions');
|
|
|
15 |
$routeAddFund = $this->url('account-settings/transactions/add-funds');
|
|
|
16 |
$routeDatatableBrowser = $this->url('account-settings/browsers');
|
|
|
17 |
$routeDatatableIp = $this->url('account-settings/ips');
|
|
|
18 |
$routeDatatableDevice = $this->url('account-settings/devices');
|
|
|
19 |
|
|
|
20 |
$this->inlineScript()->appendFile('https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places');
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
$error_msg = "Por favor seleccione una ubicación real";
|
|
|
24 |
|
|
|
25 |
$amountsJson = json_encode($amounts);
|
|
|
26 |
|
|
|
27 |
$js = <<<JS
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
const backendVars = {
|
|
|
31 |
twitter: $twitter,
|
|
|
32 |
facebook: $facebook,
|
|
|
33 |
google: $google,
|
|
|
34 |
socialNetworkRoutes: {
|
|
|
35 |
twitter:{
|
|
|
36 |
add: '$routeAddTwitter',
|
|
|
37 |
remove: '$routeRemoveTwitter',
|
|
|
38 |
},
|
|
|
39 |
facebook:{
|
|
|
40 |
add: '$routeAddFacebook',
|
|
|
41 |
remove: '$routeRemoveFacebook'
|
|
|
42 |
},
|
|
|
43 |
google: {
|
|
|
44 |
add: '$routeAddGoogle',
|
|
|
45 |
remove: '$routeRemoveGoogle'
|
|
|
46 |
}
|
|
|
47 |
},
|
|
|
48 |
routeTransactions: '$routeDatatableTransaction',
|
|
|
49 |
routeAddFunds: '$routeAddFund',
|
|
|
50 |
balance: '$balance',
|
|
|
51 |
amounts: JSON.parse('$amountsJson'),
|
|
|
52 |
routeBrowsers: '$routeDatatableBrowser',
|
|
|
53 |
routeIPs: '$routeDatatableIp',
|
|
|
54 |
routeDevices: "$routeDatatableDevice"
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
// autoComplete place
|
|
|
58 |
let autoComplete;
|
|
|
59 |
|
|
|
60 |
function handleScriptLoad(updateQuery, autoCompleteRef, setAddresObject, setError) {
|
|
|
61 |
autoComplete = new window.google.maps.places.Autocomplete(
|
|
|
62 |
autoCompleteRef.current,
|
|
|
63 |
{ types: ["(cities)"]}
|
|
|
64 |
);
|
|
|
65 |
autoComplete.setFields(["address_components", "formatted_address", "geometry"]);
|
|
|
66 |
autoComplete.addListener("place_changed", () =>
|
|
|
67 |
handlePlaceSelect(updateQuery, setAddresObject, setError)
|
|
|
68 |
);
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
async function handlePlaceSelect(updateQuery, setAddresObject, setError) {
|
|
|
72 |
const addressObject = autoComplete.getPlace();
|
|
|
73 |
// console.log(addressObject.geometry.location.lat());
|
|
|
74 |
// console.log(addressObject.geometry.location.lng());
|
|
|
75 |
const query = addressObject.formatted_address;
|
|
|
76 |
if(query){
|
|
|
77 |
setError("");
|
|
|
78 |
updateQuery(query);
|
|
|
79 |
setAddresObject({...addressObject, address_components:[...addressObject.address_components, {latitude: addressObject.geometry.location.lat(),longitude: addressObject.geometry.location.lng(), types:["geometry"]}]});
|
|
|
80 |
}else{
|
|
|
81 |
setError("$error_msg");
|
|
|
82 |
}
|
|
|
83 |
}
|
|
|
84 |
JS;
|
|
|
85 |
$this->inlineScript()->appendScript($js);
|
|
|
86 |
$this->headLink()->appendStylesheet('/react-bundles/account-settings/main.css');
|
|
|
87 |
$this->inlineScript()->appendFile('/react-bundles/account-settings/accountSettingsBundle.js');
|
|
|
88 |
?>
|
|
|
89 |
|
|
|
90 |
<div id="react_account_settings">
|
|
|
91 |
<div class="process-comm" id="paginator-process-comm">
|
|
|
92 |
<div class="spinner">
|
|
|
93 |
<div class="bounce1"></div>
|
|
|
94 |
<div class="bounce2"></div>
|
|
|
95 |
<div class="bounce3"></div>
|
|
|
96 |
</div>
|
|
|
97 |
</div>
|
|
|
98 |
</div>
|