| 15540 | efrain | 1 | <?php
 | 
        
           |  |  | 2 | $acl            = $this->viewModel()->getRoot()->getVariable('acl');
 | 
        
           |  |  | 3 | $currentUser    = $this->currentUserHelper();
 | 
        
           |  |  | 4 |   | 
        
           |  |  | 5 | $roleName = $currentUser->getUserTypeId();
 | 
        
           |  |  | 6 |   | 
        
           |  |  | 7 |   | 
        
           |  |  | 8 | $route      = $this->url('engagement/setup');
 | 
        
           |  |  | 9 |   | 
        
           |  |  | 10 | $this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
 | 
        
           |  |  | 11 | $this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
 | 
        
           |  |  | 12 |   | 
        
           |  |  | 13 | $this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
 | 
        
           |  |  | 14 | $this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
 | 
        
           |  |  | 15 | $this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
 | 
        
           |  |  | 16 |   | 
        
           |  |  | 17 | $this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
 | 
        
           |  |  | 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) {
 | 
        
           |  |  | 35 |                 if(element.parent('.form-group').length) {
 | 
        
           |  |  | 36 |                     error.insertAfter(element);
 | 
        
           |  |  | 37 |                 } else if(element.parent('.toggle').length) {
 | 
        
           |  |  | 38 |                     error.insertAfter(element.parent().parent());
 | 
        
           |  |  | 39 |                 } else {
 | 
        
           |  |  | 40 |                     error.insertAfter(element.parent());
 | 
        
           |  |  | 41 |                 }
 | 
        
           |  |  | 42 |             }
 | 
        
           |  |  | 43 |         });
 | 
        
           |  |  | 44 |   | 
        
           |  |  | 45 |   | 
        
           |  |  | 46 |         $.fn.showFormErrorValidator = function(fieldname, errors) {
 | 
        
           |  |  | 47 |             var field = $(fieldname);
 | 
        
           |  |  | 48 |             if(field) {
 | 
        
           |  |  | 49 |                 $(field).addClass('is-invalid');
 | 
        
           |  |  | 50 |   | 
        
           |  |  | 51 |   | 
        
           |  |  | 52 |                 var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
 | 
        
           |  |  | 53 |                 if(field.parent('.form-group').length) {
 | 
        
           |  |  | 54 |                     error.insertAfter(field);
 | 
        
           |  |  | 55 |                 } else  if(field.parent('.toggle').length) {
 | 
        
           |  |  | 56 |                     error.insertAfter(field.parent().parent());
 | 
        
           |  |  | 57 |                 } else {
 | 
        
           |  |  | 58 |                     error.insertAfter(field.parent());
 | 
        
           |  |  | 59 |                 }
 | 
        
           |  |  | 60 |             }
 | 
        
           |  |  | 61 |         };
 | 
        
           |  |  | 62 |   | 
        
           |  |  | 63 |         var validator = $('#form').validate({
 | 
        
           |  |  | 64 |             debug: true,
 | 
        
           |  |  | 65 |             onclick: false,
 | 
        
           |  |  | 66 |             onkeyup: false,
 | 
        
           |  |  | 67 |             ignore: [],
 | 
        
           |  |  | 68 |             rules: {
 | 
        
           |  |  | 69 |                 'daily_pulse_how_are_you_feel': {
 | 
        
           |  |  | 70 |                     required: true,
 | 
        
           |  |  | 71 |                     min: 0,
 | 
        
           |  |  | 72 |   | 
        
           |  |  | 73 |                 },
 | 
        
           |  |  | 74 |                 'daily_pulse_climate_on_your_organization': {
 | 
        
           |  |  | 75 |                     required: true,
 | 
        
           |  |  | 76 |                     min: 0,
 | 
        
           |  |  | 77 |   | 
        
           |  |  | 78 |                 },
 | 
        
           |  |  | 79 |                 'feed_survey': {
 | 
        
           |  |  | 80 |                     required: true,
 | 
        
           |  |  | 81 |                     min: 0,
 | 
        
           |  |  | 82 |   | 
        
           |  |  | 83 |                 },
 | 
        
           |  |  | 84 |                 'internal_survey': {
 | 
        
           |  |  | 85 |                     required: true,
 | 
        
           |  |  | 86 |                     min: 0,
 | 
        
           |  |  | 87 |   | 
        
           |  |  | 88 |                 },
 | 
        
           |  |  | 89 |             },
 | 
        
           |  |  | 90 |             submitHandler: function(form)
 | 
        
           |  |  | 91 |             {
 | 
        
           |  |  | 92 |   | 
        
           |  |  | 93 |                 $.ajax({
 | 
        
           |  |  | 94 |                     'dataType'  : 'json',
 | 
        
           |  |  | 95 |                     'accept'    : 'application/json',
 | 
        
           |  |  | 96 |                     'method'    : 'post',
 | 
        
           |  |  | 97 |                     'url'       :  $('#form').attr('action'),
 | 
        
           |  |  | 98 |                     'data'      :  $('#form').serialize(),
 | 
        
           |  |  | 99 |                 }).done(function(response) {
 | 
        
           |  |  | 100 |                     NProgress.start();
 | 
        
           |  |  | 101 |                     if(response['success']) {
 | 
        
           |  |  | 102 |                         $.fn.showSuccess(response['data']);
 | 
        
           |  |  | 103 |                     } else {
 | 
        
           |  |  | 104 |                         validator.resetForm();
 | 
        
           |  |  | 105 |                         if(jQuery.type(response['data']) == 'string') {
 | 
        
           |  |  | 106 |                             $.fn.showError(response['data']);
 | 
        
           |  |  | 107 |                         } else  {
 | 
        
           |  |  | 108 |                             $.each(response['data'], function( fieldname, errors ) {
 | 
        
           |  |  | 109 |                                 $.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
 | 
        
           |  |  | 110 |                             });
 | 
        
           |  |  | 111 |                         }
 | 
        
           |  |  | 112 |                     }
 | 
        
           |  |  | 113 |                 }).fail(function( jqXHR, textStatus, errorThrown) {
 | 
        
           |  |  | 114 |                     $.fn.showError(textStatus);
 | 
        
           |  |  | 115 |                 }).always(function() {
 | 
        
           |  |  | 116 |                     NProgress.done();
 | 
        
           |  |  | 117 |                 });
 | 
        
           |  |  | 118 |                 return false;
 | 
        
           |  |  | 119 |             },
 | 
        
           |  |  | 120 |             invalidHandler: function(form, validator) {
 | 
        
           |  |  | 121 |             }
 | 
        
           |  |  | 122 |         });
 | 
        
           |  |  | 123 |   | 
        
           |  |  | 124 |   | 
        
           |  |  | 125 |         $('#form #daily_pulse_how_are_you_feel').inputNumberFormat({decimal: 0});
 | 
        
           |  |  | 126 |         $('#form #daily_pulse_climate_on_your_organization').inputNumberFormat({decimal: 0});
 | 
        
           |  |  | 127 |         $('#form #feed_survey').inputNumberFormat({decimal: 0});
 | 
        
           |  |  | 128 |         $('#form #internal_survey').inputNumberFormat({decimal: 0});
 | 
        
           |  |  | 129 |   | 
        
           |  |  | 130 |   | 
        
           |  |  | 131 |   | 
        
           |  |  | 132 |   | 
        
           |  |  | 133 |     });
 | 
        
           |  |  | 134 | JS;
 | 
        
           |  |  | 135 | $this->inlineScript()->captureEnd();
 | 
        
           |  |  | 136 | ?>
 | 
        
           |  |  | 137 |   | 
        
           |  |  | 138 |   | 
        
           |  |  | 139 |   | 
        
           |  |  | 140 | <!-- Content Header (Page header) -->
 | 
        
           |  |  | 141 | <section class="content-header">
 | 
        
           |  |  | 142 |     <div class="container-fluid">
 | 
        
           |  |  | 143 |         <div class="row mb-2">
 | 
        
           |  |  | 144 |             <div class="col-sm-12">
 | 
        
           |  |  | 145 |                 <h1>LABEL_ENGAGEMENT (LABEL_POINTS)</h1>
 | 
        
           |  |  | 146 |             </div>
 | 
        
           |  |  | 147 |         </div>
 | 
        
           |  |  | 148 |     </div><!-- /.container-fluid -->
 | 
        
           |  |  | 149 | </section>
 | 
        
           |  |  | 150 |   | 
        
           |  |  | 151 | <section class="content">
 | 
        
           |  |  | 152 |     <div class="container-fluid">
 | 
        
           |  |  | 153 |         <div class="row">
 | 
        
           |  |  | 154 |             <div class="col-12">
 | 
        
           |  |  | 155 |                 <div class="card">
 | 
        
           |  |  | 156 |                 	 <?php
 | 
        
           |  |  | 157 |                     $form = $this->form;
 | 
        
           |  |  | 158 |                     $form->setAttributes([
 | 
        
           |  |  | 159 |                         'method'    => 'post',
 | 
        
           |  |  | 160 |                         'name'      => 'form',
 | 
        
           |  |  | 161 |                         'id'        => 'form',
 | 
        
           |  |  | 162 |                         'action'    => $route,
 | 
        
           |  |  | 163 |                     ]);
 | 
        
           |  |  | 164 |   | 
        
           |  |  | 165 |                     $form->prepare();
 | 
        
           |  |  | 166 |                     echo $this->form()->openTag($form);
 | 
        
           |  |  | 167 |                     ?>
 | 
        
           |  |  | 168 |                     <div class="card-body">
 | 
        
           |  |  | 169 |                         <div class="form-group">
 | 
        
           |  |  | 170 |                             <?php
 | 
        
           |  |  | 171 |                             $element = $form->get('daily_pulse_how_are_you_feel');
 | 
        
           |  |  | 172 |                             $element->setOptions(['label' => 'LABEL_HOW_ARE_YOU_FEEL']);
 | 
        
           |  |  | 173 |                             $element->setAttributes(['class' => 'form-control']);
 | 
        
           |  |  | 174 |   | 
        
           |  |  | 175 |                             echo $this->formLabel($element);
 | 
        
           |  |  | 176 |                             echo $this->formNumber($element);
 | 
        
           |  |  | 177 |                             ?>
 | 
        
           |  |  | 178 |                         </div>
 | 
        
           |  |  | 179 |                       	<div class="form-group">
 | 
        
           |  |  | 180 |                             <?php
 | 
        
           |  |  | 181 |                             $element = $form->get('daily_pulse_climate_on_your_organization');
 | 
        
           |  |  | 182 |                             $element->setOptions(['label' => 'LABEL_CLIMATE_ON_YOUR_ORGANIZATION']);
 | 
        
           |  |  | 183 |                             $element->setAttributes(['class' => 'form-control']);
 | 
        
           |  |  | 184 |   | 
        
           |  |  | 185 |                             echo $this->formLabel($element);
 | 
        
           |  |  | 186 |                             echo $this->formNumber($element);
 | 
        
           |  |  | 187 |                             ?>
 | 
        
           |  |  | 188 |                         </div>
 | 
        
           |  |  | 189 |                         <div class="form-group">
 | 
        
           |  |  | 190 |                             <?php
 | 
        
           |  |  | 191 |                             $element = $form->get('feed_survey');
 | 
        
           |  |  | 192 |                             $element->setOptions(['label' => 'LABEL_FEED_SURVEY']);
 | 
        
           |  |  | 193 |                             $element->setAttributes(['class' => 'form-control']);
 | 
        
           |  |  | 194 |   | 
        
           |  |  | 195 |                             echo $this->formLabel($element);
 | 
        
           |  |  | 196 |                             echo $this->formNumber($element);
 | 
        
           |  |  | 197 |                             ?>
 | 
        
           |  |  | 198 |                         </div>
 | 
        
           |  |  | 199 |                       	<div class="form-group">
 | 
        
           |  |  | 200 |                             <?php
 | 
        
           |  |  | 201 |                             $element = $form->get('internal_survey');
 | 
        
           |  |  | 202 |                             $element->setOptions(['label' => 'LABEL_INTERNAL_SURVEY']);
 | 
        
           |  |  | 203 |                             $element->setAttributes(['class' => 'form-control']);
 | 
        
           |  |  | 204 |   | 
        
           |  |  | 205 |                             echo $this->formLabel($element);
 | 
        
           |  |  | 206 |                             echo $this->formNumber($element);
 | 
        
           |  |  | 207 |                             ?>
 | 
        
           |  |  | 208 |                         </div>
 | 
        
           |  |  | 209 |   | 
        
           |  |  | 210 |   | 
        
           |  |  | 211 |   | 
        
           |  |  | 212 |                		</div>
 | 
        
           |  |  | 213 |   | 
        
           |  |  | 214 |                		<div class="card-footer">
 | 
        
           |  |  | 215 |                    		<div class="text-right">
 | 
        
           |  |  | 216 |                         <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
 | 
        
           |  |  | 217 |                     	</div>
 | 
        
           |  |  | 218 |                		</div>
 | 
        
           |  |  | 219 |                		 <?php echo $this->form()->closeTag($form); ?>
 | 
        
           |  |  | 220 |                 </div>
 | 
        
           |  |  | 221 |             </div>
 | 
        
           |  |  | 222 |         </div>
 | 
        
           |  |  | 223 |     </div>
 | 
        
           |  |  | 224 | </section>
 |