Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4574 | Rev 4582 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
4554 stevensc 2
 
4553 stevensc 3
use LeadersLinked\Model\Theme;
1 www 4
 
5
$this->inlineScript()->appendFile('https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places');
6
 
4553 stevensc 7
$currentNetworkHelper = $this->currentNetworkHelper();
8
$currentNetwork = $currentNetworkHelper->getNetwork();
9
 
1 www 10
// months
11
$months = [
12
  'LABEL_MONTH_JANUARY',
13
  'LABEL_MONTH_FEBRUARY',
14
  'LABEL_MONTH_MARCH',
15
  'LABEL_MONTH_APRIL',
16
  'LABEL_MONTH_MAY',
17
  'LABEL_MONTH_JUNE',
18
  'LABEL_MONTH_JULY',
19
  'LABEL_MONTH_AUGUST',
20
  'LABEL_MONTH_SEPTEMBER',
21
  'LABEL_MONTH_OCTOBER',
22
  'LABEL_MONTH_NOVEMBER',
23
  'LABEL_MONTH_DECEMBER',
24
];
25
 
26
// vars to json
27
$userExperiences = json_encode($user_experiences);
28
$userEducations = json_encode($user_educations);
29
$monthsJson = json_encode($months);
30
$userLanguages = json_encode($user_languages);
31
$userSkills = json_encode($user_skills);
32
$companySizesOptions = json_encode($company_sizes);
33
$degreesOptions = json_encode($degrees);
34
$industriesOptions = json_encode($industries);
35
$languagesOptions = json_encode($languages);
36
$skillsOptions = json_encode($skills);
3912 efrain 37
$userAptitudes = json_encode($user_aptitudes);
38
$userHobbiesAndInterests = json_encode($user_hobbies_and_interests);
39
$aptitudesOptions = json_encode($aptitudes);
40
$hobbiesAndInterestsOptions = json_encode($hobbies_and_interests);
41
 
1 www 42
$googleMapPlacesUrl = 'https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places';
43
$error_msg = "Por favor seleccione una ubicación real";
44
 
45
 
46
 
47
$js = <<<JS
48
 
49
 
50
// autoComplete place
51
let autoComplete;
52
 
53
function handleScriptLoad(updateQuery, autoCompleteRef, setAddresObject, setError) {
54
  autoComplete = new window.google.maps.places.Autocomplete(
55
    autoCompleteRef.current,
56
    { types: ["(cities)"]}
57
  );
58
  autoComplete.setFields(["address_components", "formatted_address", "geometry"]);
59
  autoComplete.addListener("place_changed", () =>
60
    handlePlaceSelect(updateQuery, setAddresObject, setError)
61
  );
62
}
63
 
64
async function handlePlaceSelect(updateQuery, setAddresObject, setError) {
65
  const addressObject = autoComplete.getPlace();
66
  // console.log(addressObject.geometry.location.lat());
67
  // console.log(addressObject.geometry.location.lng());
68
  const query = addressObject.formatted_address;
69
  if(query){
70
    setError("");
71
    updateQuery(query);
72
    setAddresObject({...addressObject, address_components:[...addressObject.address_components, {latitude: addressObject.geometry.location.lat(),longitude: addressObject.geometry.location.lng(), types:["geometry"]}]});
73
  }else{
74
    setError("$error_msg");
75
  }
76
}
77
 
4573 stevensc 78
const skillsArray = Object.entries($userSkills).map(([key, value]) => ({ value: key, name: value }))
4574 stevensc 79
const skillsOptions = Object.entries($skillsOptions).map(([key, value]) => ({ value: key, name: value }))
4573 stevensc 80
 
1 www 81
const backendVars = {
82
  userIdEncrypted:"$user_uuid",
83
  userProfileIdEncrypted:"$user_profile_uuid",
84
  cover:"$cover",
85
  following:"$following",
86
  follower:"$follower",
87
  image:"$image",
88
  facebook: "$facebook",
89
  twitter: "$twitter",
90
  instagram: "$instagram",
91
  fullName: `$full_name`,
92
  overview: `$overview`,
4069 stevensc 93
  userExperiences: $userExperiences,
1 www 94
  userEducations: JSON.parse('$userEducations'),
95
  months: JSON.parse('$monthsJson'),
96
  formattedAddress: "$formatted_address",
97
  userLanguages: JSON.parse('$userLanguages'),
4573 stevensc 98
  userSkills: skillsArray,
3912 efrain 99
  userAptitudes: JSON.parse('$userAptitudes'),
100
  userHobbiesAndInterests: JSON.parse('$userHobbiesAndInterests'),
1 www 101
  imageSizeCover: "$image_size_cover",
102
  imageProfileCover: "$image_size_profile",
103
  companySizesOptions: JSON.parse('$companySizesOptions'),
104
  degreesOptions: JSON.parse('$degreesOptions'),
105
  industriesOptions: JSON.parse('$industriesOptions'),
106
  // industriesOptions: [],
107
  newIndustrisOptions: JSON.parse('$industriesOptions'),
108
  languagesOptions: JSON.parse('$languagesOptions'),
4575 stevensc 109
  skillsOptions: skillsOptions,
3912 efrain 110
  aptitudesOptions: JSON.parse('$aptitudesOptions'),
111
  hobbiesAndInterestsOptions: JSON.parse('$hobbiesAndInterestsOptions'),
4573 stevensc 112
}
3912 efrain 113
 
1 www 114
JS;
115
$this->inlineScript()->appendScript($js);
4553 stevensc 116
if ($currentNetwork->theme_id == Theme::THEME_LEADERSLINKED_LINKEDIN) {
117
  $this->headLink()->appendStylesheet('/react-bundles/profile/edit/main.css');
118
  $this->inlineScript()->appendFile('/react-bundles/profile/edit/linkedinProfileEditBundle.js');
4554 stevensc 119
  $this->headLink()->appendStylesheet('/react-bundles/profile/view/main.css');
120
} else {
4553 stevensc 121
  $this->headLink()->appendStylesheet('/react-bundles/profile/edit/main.css');
122
  $this->inlineScript()->appendFile('/react-bundles/profile/edit/profileEditBundle.js');
123
}
1 www 124
?>
125
 
126
 
127
<div id="react-my-profile-edit">
128
  <div class="process-comm" id="paginator-process-comm">
129
    <div class="spinner">
130
      <div class="bounce1"></div>
131
      <div class="bounce2"></div>
132
      <div class="bounce3"></div>
133
    </div>
134
  </div>
135
</div>
136
<script src="https://cdn.ckeditor.com/4.16.0/standard/ckeditor.js"></script>