1 |
www |
1 |
<?php
|
4842 |
efrain |
2 |
use LeadersLinked\Model\Network;
|
|
|
3 |
|
3639 |
efrain |
4 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
5 |
|
|
|
6 |
$currentUser = $this->currentUserHelper();
|
|
|
7 |
$roleName = $currentUser->getUserTypeId();
|
|
|
8 |
|
|
|
9 |
|
1 |
www |
10 |
$this->headLink()->appendStylesheet('/react-bundles/dashboard/main.css');
|
|
|
11 |
$this->inlineScript()->appendFile('https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places');
|
|
|
12 |
$currentUser = $this->currentUserHelper();
|
|
|
13 |
$currentUser = $currentUser->getUser();
|
|
|
14 |
|
4842 |
efrain |
15 |
$currentNetwork = $this->currentNetworkHelper();
|
|
|
16 |
$currentNetwork = $currentNetwork->getNetwork();
|
1 |
www |
17 |
|
4842 |
efrain |
18 |
|
3639 |
efrain |
19 |
$allowSearchCompany = $acl->isAllowed($roleName, 'search/company') ? 1 : 0;
|
|
|
20 |
|
|
|
21 |
|
4842 |
efrain |
22 |
$allowViewConnectionLevelFilter =$currentNetwork->relationship_user_mode == Network::RELATIONSHIP_USER_MODE_USER_2_USER ? 1 : 0;
|
|
|
23 |
|
1 |
www |
24 |
$routeMoodle = $this->url('moodle');
|
|
|
25 |
$emojione_image_path_png = $this->basePath('vendors/smiley/assets/png/');
|
|
|
26 |
$id = $user_uuid ?? null;
|
|
|
27 |
$industryFilters = json_encode($industries, true);
|
|
|
28 |
$connectionLeves = json_encode($connectionLeves, true);
|
|
|
29 |
$_employeeTypes = json_encode($employeeTypes);
|
|
|
30 |
$companySizes = json_encode($companySizes, true);
|
|
|
31 |
$groupTypes = json_encode($groupTypes, true);
|
|
|
32 |
$googleMapPlacesUrl = 'https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places';
|
|
|
33 |
$error_msg = "Por favor seleccione una ubicación real";
|
|
|
34 |
|
|
|
35 |
$js = <<<JS
|
|
|
36 |
const filters = {
|
|
|
37 |
industryFilters: '$industryFilters',
|
|
|
38 |
connectionLevelFilters: '$connectionLeves',
|
|
|
39 |
employeeTypeFilters: '$_employeeTypes',
|
|
|
40 |
companySizeFilters: '$companySizes',
|
|
|
41 |
groupTypeFilters: '$groupTypes',
|
3639 |
efrain |
42 |
allowSearchCompany: '$allowSearchCompany' === '1',
|
4842 |
efrain |
43 |
allowViewConnectionLevelFilter: '$allowViewConnectionLevelFilter' === '1',
|
1 |
www |
44 |
}
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
const backendVars={
|
|
|
48 |
id: "$id",
|
|
|
49 |
labelSend: "LABEL_SEND",
|
|
|
50 |
labelUsers: "LABEL_USERS",
|
3639 |
efrain |
51 |
labelWriteMessage: "LABEL_WRITE_YOUR_MESSAGE_HERE",
|
|
|
52 |
|
1 |
www |
53 |
}
|
|
|
54 |
|
|
|
55 |
function handleScriptLoad(updateQuery, autoCompleteRef, setAddresObject, setError) {
|
|
|
56 |
autoComplete = new window.google.maps.places.Autocomplete(
|
|
|
57 |
autoCompleteRef.current,
|
|
|
58 |
{ types: ["(cities)"]}
|
|
|
59 |
);
|
|
|
60 |
autoComplete.setFields(["address_components", "formatted_address", "geometry"]);
|
|
|
61 |
autoComplete.addListener("place_changed", () =>
|
|
|
62 |
handlePlaceSelect(updateQuery, setAddresObject, setError)
|
|
|
63 |
);
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
async function handlePlaceSelect(updateQuery, setAddresObject, setError) {
|
|
|
67 |
const addressObject = autoComplete.getPlace();
|
|
|
68 |
// console.log(addressObject.geometry.location.lat());
|
|
|
69 |
// console.log(addressObject.geometry.location.lng());
|
|
|
70 |
const query = addressObject.formatted_address;
|
|
|
71 |
if(query){
|
|
|
72 |
setError("");
|
|
|
73 |
updateQuery(query);
|
|
|
74 |
setAddresObject({...addressObject, address_components:[...addressObject.address_components, {latitude: addressObject.geometry.location.lat(),longitude: addressObject.geometry.location.lng(), types:["geometry"]}]});
|
|
|
75 |
}else{
|
|
|
76 |
setError("$error_msg");
|
|
|
77 |
}
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
JS;
|
|
|
81 |
$this->inlineScript()->appendScript($js);
|
|
|
82 |
$this->inlineScript()->appendFile('/react-bundles/search/searchBundle.js');
|
|
|
83 |
?>
|
|
|
84 |
|
|
|
85 |
<div id="react_search" class="posts-section">
|
|
|
86 |
<div class="process-comm" id="paginator-process-comm">
|
|
|
87 |
<div class="spinner">
|
|
|
88 |
<div class="bounce1"></div>
|
|
|
89 |
<div class="bounce2"></div>
|
|
|
90 |
<div class="bounce3"></div>
|
|
|
91 |
</div>
|
|
|
92 |
</div>
|
|
|
93 |
</div>
|