| 15394 |
efrain |
1 |
<?php
|
|
|
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
|
|
|
5 |
$roleName = $currentUser->getUserTypeId();
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
$routeSave = $this->url('settings/my-private-network/calendar');
|
|
|
9 |
|
| 16822 |
efrain |
10 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
|
|
|
11 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
|
| 15394 |
efrain |
12 |
|
|
|
13 |
|
|
|
14 |
|
| 16822 |
efrain |
15 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/jquery.validate.js'));
|
|
|
16 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/additional-methods.js'));
|
|
|
17 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/localization/messages_es.js'));
|
| 15394 |
efrain |
18 |
|
|
|
19 |
|
|
|
20 |
$this->inlineScript()->captureStart();
|
|
|
21 |
echo <<<JS
|
|
|
22 |
jQuery( document ).ready(function( $ ) {
|
|
|
23 |
|
|
|
24 |
$.validator.setDefaults({
|
|
|
25 |
debug: true,
|
|
|
26 |
highlight: function(element) {
|
|
|
27 |
$(element).addClass('is-invalid');
|
|
|
28 |
},
|
|
|
29 |
unhighlight: function(element) {
|
|
|
30 |
$(element).removeClass('is-invalid');
|
|
|
31 |
},
|
|
|
32 |
errorElement: 'span',
|
|
|
33 |
errorClass: 'error invalid-feedback',
|
|
|
34 |
errorPlacement: function(error, element) {
|
| 16822 |
efrain |
35 |
error.insertAfter(element.parent());
|
| 15394 |
efrain |
36 |
}
|
|
|
37 |
});
|
|
|
38 |
|
| 15423 |
stevensc |
39 |
$.fn.handleDisable = function() {
|
|
|
40 |
const disabledValue = $('button[type="submit"]').prop('disabled')
|
|
|
41 |
$('button[type="submit"]').prop('disabled', !disabledValue);
|
|
|
42 |
}
|
| 15394 |
efrain |
43 |
|
|
|
44 |
$.fn.showFormErrorValidator = function(fieldname, errors) {
|
|
|
45 |
var element = $(fieldname);
|
|
|
46 |
if(element) {
|
|
|
47 |
$(element).addClass('is-invalid');
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
|
| 16822 |
efrain |
51 |
error.insertAfter(element.parent());
|
| 15394 |
efrain |
52 |
}
|
|
|
53 |
};
|
|
|
54 |
|
|
|
55 |
var validator = $('#form').validate({
|
|
|
56 |
debug: true,
|
|
|
57 |
onclick: false,
|
|
|
58 |
onkeyup: false,
|
|
|
59 |
ignore: [],
|
|
|
60 |
rules: {
|
|
|
61 |
'css_calendar_expire_bg_color': {
|
|
|
62 |
required: true,
|
|
|
63 |
maxlength: 7,
|
|
|
64 |
},
|
|
|
65 |
'css_calendar_expire_text_color': {
|
|
|
66 |
required: true,
|
|
|
67 |
maxlength: 7,
|
|
|
68 |
},
|
|
|
69 |
'css_calendar_zoom_bg_color': {
|
|
|
70 |
required: true,
|
|
|
71 |
maxlength: 7,
|
|
|
72 |
},
|
|
|
73 |
'css_calendar_zoom_text_color': {
|
|
|
74 |
required: true,
|
|
|
75 |
maxlength: 7,
|
|
|
76 |
},
|
|
|
77 |
'css_calendar_planning_objectives_and_goals_bg_color': {
|
|
|
78 |
required: true,
|
|
|
79 |
maxlength: 7,
|
|
|
80 |
},
|
|
|
81 |
'css_calendar_planning_objectives_and_goals_text_color': {
|
|
|
82 |
required: true,
|
|
|
83 |
maxlength: 7,
|
|
|
84 |
},
|
|
|
85 |
'css_calendar_performance_evaluation_bg_color': {
|
|
|
86 |
required: true,
|
|
|
87 |
maxlength: 7,
|
|
|
88 |
},
|
|
|
89 |
'css_calendar_performance_evaluation_text_color': {
|
|
|
90 |
required: true,
|
|
|
91 |
maxlength: 7,
|
|
|
92 |
},
|
|
|
93 |
'css_calendar_recruitment_and_selection_bg_color': {
|
|
|
94 |
required: true,
|
|
|
95 |
maxlength: 7,
|
|
|
96 |
},
|
|
|
97 |
'css_calendar_recruitment_and_selection_text_color': {
|
|
|
98 |
required: true,
|
|
|
99 |
maxlength: 7,
|
|
|
100 |
},
|
|
|
101 |
'css_calendar_survey_bg_color': {
|
|
|
102 |
required: true,
|
|
|
103 |
maxlength: 7,
|
|
|
104 |
},
|
|
|
105 |
'css_calendar_survey_text_color': {
|
|
|
106 |
required: true,
|
|
|
107 |
maxlength: 7,
|
|
|
108 |
},
|
|
|
109 |
'css_calendar_organizational_climate_bg_color': {
|
|
|
110 |
required: true,
|
|
|
111 |
maxlength: 7,
|
|
|
112 |
},
|
|
|
113 |
'css_calendar_organizational_climate_text_color': {
|
|
|
114 |
required: true,
|
|
|
115 |
maxlength: 7,
|
|
|
116 |
},
|
|
|
117 |
|
|
|
118 |
|
|
|
119 |
},
|
|
|
120 |
submitHandler: function(form)
|
|
|
121 |
{
|
|
|
122 |
var formdata = false;
|
|
|
123 |
if (window.FormData){
|
|
|
124 |
formdata = new FormData(form); //form[0]);
|
|
|
125 |
}
|
|
|
126 |
|
| 15423 |
stevensc |
127 |
$.fn.handleDisable()
|
| 15394 |
efrain |
128 |
|
|
|
129 |
$.ajax({
|
|
|
130 |
'dataType' : 'json',
|
|
|
131 |
'accept' : 'application/json',
|
|
|
132 |
'method' : 'post',
|
|
|
133 |
'url' : $('#form').attr('action'),
|
|
|
134 |
'data' : formdata,
|
|
|
135 |
'processData': false,
|
|
|
136 |
'contentType': false,
|
|
|
137 |
}).done(function(response) {
|
|
|
138 |
if(response['success']) {
|
|
|
139 |
$.fn.showSuccess(response['data']);
|
|
|
140 |
|
|
|
141 |
} else {
|
|
|
142 |
validator.resetForm();
|
|
|
143 |
if(jQuery.type(response['data']) == 'string') {
|
| 15423 |
stevensc |
144 |
$.fn.showError(response['data'], $.fn.handleDisable);
|
| 15394 |
efrain |
145 |
} else {
|
|
|
146 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
147 |
$.fn.showFormErrorValidator('#form #' + fieldname, errors);
|
|
|
148 |
});
|
|
|
149 |
}
|
|
|
150 |
}
|
|
|
151 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
152 |
$.fn.showError(textStatus);
|
|
|
153 |
}).always(function() {
|
|
|
154 |
NProgress.done();
|
|
|
155 |
});
|
|
|
156 |
return false;
|
|
|
157 |
},
|
|
|
158 |
invalidHandler: function(form, validator) {
|
|
|
159 |
|
|
|
160 |
}
|
|
|
161 |
});
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
|
165 |
});
|
|
|
166 |
JS;
|
|
|
167 |
$this->inlineScript()->captureEnd();
|
|
|
168 |
?>
|
|
|
169 |
|
|
|
170 |
<!-- Content Header (Page header) -->
|
| 16822 |
efrain |
171 |
<div class="container">
|
|
|
172 |
<div class="card">
|
|
|
173 |
<?php
|
|
|
174 |
$form = $this->form;
|
|
|
175 |
$form->setAttributes([
|
|
|
176 |
'method' => 'post',
|
|
|
177 |
'action' => $routeSave,
|
|
|
178 |
'name' => 'form',
|
|
|
179 |
'id' => 'form',
|
|
|
180 |
]);
|
|
|
181 |
|
|
|
182 |
$form->prepare();
|
|
|
183 |
echo $this->form()->openTag($form);
|
|
|
184 |
?>
|
|
|
185 |
<div class="card-body">
|
|
|
186 |
<h6 class="card-title">LABEL_MY_PRIVATE_NETWORK_CALENDAR</h6>
|
| 15394 |
efrain |
187 |
|
|
|
188 |
|
| 16822 |
efrain |
189 |
|
|
|
190 |
<?php
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
$styles = [
|
|
|
194 |
'Color de fondo de un evento cerca de expirar' => 'css_calendar_expire_bg_color',
|
|
|
195 |
'Color del texto de un evento cerca de expirar' => 'css_calendar_expire_text_color',
|
|
|
196 |
'Color de fondo de una conferencia Zoom' => 'css_calendar_zoom_bg_color',
|
|
|
197 |
'Color del texto de una conferencia Zoom' => 'css_calendar_zoom_text_color',
|
|
|
198 |
'Color de fondo de una planificación de objetivos' => 'css_calendar_planning_objectives_and_goals_bg_color',
|
|
|
199 |
'Color de texto de una planificación de objetivos' => 'css_calendar_planning_objectives_and_goals_text_color',
|
|
|
200 |
'Color de fondo de una evaluación de desempeño' => 'css_calendar_performance_evaluation_bg_color',
|
|
|
201 |
'Color de texto de una evaluación de desempeño' => 'css_calendar_performance_evaluation_text_color',
|
|
|
202 |
'Color de fondo de un proceso de reclutamiento y selección' => 'css_calendar_recruitment_and_selection_bg_color',
|
|
|
203 |
'Color de texto de un proceso de reclutamiento y selección' => 'css_calendar_recruitment_and_selection_text_color',
|
|
|
204 |
'Color de fondo de una encuesta' => 'css_calendar_survey_bg_color',
|
|
|
205 |
'Color de texto de una encuesta' => 'css_calendar_survey_text_color',
|
|
|
206 |
'Color de fondo de una encuesta de clima organizacional' => 'css_calendar_organizational_climate_bg_color',
|
|
|
207 |
'Color de texto de una encuesta de clima organizacional' => 'css_calendar_organizational_climate_text_color',
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
];
|
|
|
212 |
|
|
|
213 |
|
|
|
214 |
$col = 0;
|
|
|
215 |
foreach ($styles as $label => $field) :
|
|
|
216 |
if($col == 0) {
|
|
|
217 |
echo "<div class=\"row\">";
|
|
|
218 |
|
|
|
219 |
}
|
|
|
220 |
|
|
|
221 |
|
|
|
222 |
$value = $form->get($field)->getValue();
|
|
|
223 |
|
|
|
224 |
?>
|
|
|
225 |
|
|
|
226 |
|
|
|
227 |
|
| 16841 |
efrain |
228 |
<div class=" mt-3 col-6">
|
| 16822 |
efrain |
229 |
<label for="<?php echo $field ?>" class="form-label"><?php echo $label ?></label>
|
|
|
230 |
<input type="color" id="<?php echo $field ?>" name="<?php echo $field ?>" class="form-control form-control-color" value="<?php echo $value ?>" >
|
|
|
231 |
|
|
|
232 |
</div>
|
|
|
233 |
<?php
|
|
|
234 |
$col++;
|
|
|
235 |
if($col == 2) {
|
|
|
236 |
echo "</div>";
|
|
|
237 |
$col = 0;
|
|
|
238 |
}
|
|
|
239 |
?>
|
|
|
240 |
<?php
|
|
|
241 |
endforeach;
|
|
|
242 |
|
|
|
243 |
if($col != 0) {
|
|
|
244 |
echo "</div>";
|
|
|
245 |
}
|
|
|
246 |
?>
|
| 15423 |
stevensc |
247 |
|
| 16822 |
efrain |
248 |
|
|
|
249 |
|
|
|
250 |
</div>
|
|
|
251 |
<div class="card-footer text-right">
|
|
|
252 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
253 |
</div>
|
|
|
254 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
255 |
</div>
|
|
|
256 |
</div>
|