Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 2449 | Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
2
 
3
$this->inlineScript()->appendFile('https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places');
4
 
5
// months
6
$months = [
7
  'LABEL_MONTH_JANUARY',
8
  'LABEL_MONTH_FEBRUARY',
9
  'LABEL_MONTH_MARCH',
10
  'LABEL_MONTH_APRIL',
11
  'LABEL_MONTH_MAY',
12
  'LABEL_MONTH_JUNE',
13
  'LABEL_MONTH_JULY',
14
  'LABEL_MONTH_AUGUST',
15
  'LABEL_MONTH_SEPTEMBER',
16
  'LABEL_MONTH_OCTOBER',
17
  'LABEL_MONTH_NOVEMBER',
18
  'LABEL_MONTH_DECEMBER',
19
];
20
 
21
// vars to json
22
$userExperiences = json_encode($user_experiences);
23
$userEducations = json_encode($user_educations);
24
$monthsJson = json_encode($months);
25
$userLanguages = json_encode($user_languages);
26
$userSkills = json_encode($user_skills);
27
$companySizesOptions = json_encode($company_sizes);
28
$degreesOptions = json_encode($degrees);
29
$industriesOptions = json_encode($industries);
30
$languagesOptions = json_encode($languages);
31
$skillsOptions = json_encode($skills);
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
 
36
 
37
$js = <<<JS
38
 
39
 
40
// autoComplete place
41
let autoComplete;
42
 
43
function handleScriptLoad(updateQuery, autoCompleteRef, setAddresObject, setError) {
44
  autoComplete = new window.google.maps.places.Autocomplete(
45
    autoCompleteRef.current,
46
    { types: ["(cities)"]}
47
  );
48
  autoComplete.setFields(["address_components", "formatted_address", "geometry"]);
49
  autoComplete.addListener("place_changed", () =>
50
    handlePlaceSelect(updateQuery, setAddresObject, setError)
51
  );
52
}
53
 
54
async function handlePlaceSelect(updateQuery, setAddresObject, setError) {
55
  const addressObject = autoComplete.getPlace();
56
  // console.log(addressObject.geometry.location.lat());
57
  // console.log(addressObject.geometry.location.lng());
58
  const query = addressObject.formatted_address;
59
  if(query){
60
    setError("");
61
    updateQuery(query);
62
    setAddresObject({...addressObject, address_components:[...addressObject.address_components, {latitude: addressObject.geometry.location.lat(),longitude: addressObject.geometry.location.lng(), types:["geometry"]}]});
63
  }else{
64
    setError("$error_msg");
65
  }
66
}
67
 
68
const backendVars = {
69
  userIdEncrypted:"$user_uuid",
70
  userProfileIdEncrypted:"$user_profile_uuid",
71
  cover:"$cover",
72
  following:"$following",
73
  follower:"$follower",
74
  image:"$image",
75
  facebook: "$facebook",
76
  twitter: "$twitter",
77
  instagram: "$instagram",
78
  fullName: `$full_name`,
79
  overview: `$overview`,
80
  userExperiences: JSON.parse('$userExperiences'),
81
  userEducations: JSON.parse('$userEducations'),
82
  months: JSON.parse('$monthsJson'),
83
  formattedAddress: "$formatted_address",
84
  userLanguages: JSON.parse('$userLanguages'),
85
  userSkills: JSON.parse('$userSkills'),
86
  imageSizeCover: "$image_size_cover",
87
  imageProfileCover: "$image_size_profile",
88
  companySizesOptions: JSON.parse('$companySizesOptions'),
89
  degreesOptions: JSON.parse('$degreesOptions'),
90
  industriesOptions: JSON.parse('$industriesOptions'),
91
  // industriesOptions: [],
92
  newIndustrisOptions: JSON.parse('$industriesOptions'),
93
  languagesOptions: JSON.parse('$languagesOptions'),
94
  skillsOptions: JSON.parse('$skillsOptions'),
95
}
96
JS;
97
$this->inlineScript()->appendScript($js);
98
$this->inlineScript()->appendFile('/react-bundles/profile/edit/profileEditBundle.js');
99
?>
100
 
101
 
102
<div id="react-my-profile-edit">
103
  <div class="process-comm" id="paginator-process-comm">
104
    <div class="spinner">
105
      <div class="bounce1"></div>
106
      <div class="bounce2"></div>
107
      <div class="bounce3"></div>
108
    </div>
109
  </div>
110
</div>
111
<script src="https://cdn.ckeditor.com/4.16.0/standard/ckeditor.js"></script>