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