Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4575 | Rev 4584 | 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 }))
4582 stevensc 80
const languagesArray = Object.entries($userLanguages).map(([key, value]) => ({ value: key, name: value }))
81
const languagesOptions = Object.entries($languagesOptions).map(([key, value]) => ({ value: key, name: value }))
4573 stevensc 82
 
1 www 83
const backendVars = {
84
  userIdEncrypted:"$user_uuid",
85
  userProfileIdEncrypted:"$user_profile_uuid",
86
  cover:"$cover",
87
  following:"$following",
88
  follower:"$follower",
89
  image:"$image",
90
  facebook: "$facebook",
91
  twitter: "$twitter",
92
  instagram: "$instagram",
93
  fullName: `$full_name`,
94
  overview: `$overview`,
4069 stevensc 95
  userExperiences: $userExperiences,
1 www 96
  userEducations: JSON.parse('$userEducations'),
97
  months: JSON.parse('$monthsJson'),
98
  formattedAddress: "$formatted_address",
4582 stevensc 99
  userLanguages: languagesArray,
4573 stevensc 100
  userSkills: skillsArray,
3912 efrain 101
  userAptitudes: JSON.parse('$userAptitudes'),
102
  userHobbiesAndInterests: JSON.parse('$userHobbiesAndInterests'),
1 www 103
  imageSizeCover: "$image_size_cover",
104
  imageProfileCover: "$image_size_profile",
105
  companySizesOptions: JSON.parse('$companySizesOptions'),
106
  degreesOptions: JSON.parse('$degreesOptions'),
107
  industriesOptions: JSON.parse('$industriesOptions'),
108
  // industriesOptions: [],
109
  newIndustrisOptions: JSON.parse('$industriesOptions'),
4582 stevensc 110
  languagesOptions: languagesOptions,
4575 stevensc 111
  skillsOptions: skillsOptions,
3912 efrain 112
  aptitudesOptions: JSON.parse('$aptitudesOptions'),
113
  hobbiesAndInterestsOptions: JSON.parse('$hobbiesAndInterestsOptions'),
4573 stevensc 114
}
3912 efrain 115
 
1 www 116
JS;
117
$this->inlineScript()->appendScript($js);
4553 stevensc 118
if ($currentNetwork->theme_id == Theme::THEME_LEADERSLINKED_LINKEDIN) {
119
  $this->headLink()->appendStylesheet('/react-bundles/profile/edit/main.css');
120
  $this->inlineScript()->appendFile('/react-bundles/profile/edit/linkedinProfileEditBundle.js');
4554 stevensc 121
  $this->headLink()->appendStylesheet('/react-bundles/profile/view/main.css');
122
} else {
4553 stevensc 123
  $this->headLink()->appendStylesheet('/react-bundles/profile/edit/main.css');
124
  $this->inlineScript()->appendFile('/react-bundles/profile/edit/profileEditBundle.js');
125
}
1 www 126
?>
127
 
128
 
129
<div id="react-my-profile-edit">
130
  <div class="process-comm" id="paginator-process-comm">
131
    <div class="spinner">
132
      <div class="bounce1"></div>
133
      <div class="bounce2"></div>
134
      <div class="bounce3"></div>
135
    </div>
136
  </div>
137
</div>
138
<script src="https://cdn.ckeditor.com/4.16.0/standard/ckeditor.js"></script>