Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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