Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 6846 | Rev 6852 | 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
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
7
 
8
 
9
$routeDatatable = $this->url('microlearning/content/capsules');
10
 
11
$allowAdd       = $acl->isAllowed($roleName, 'microlearning/content/capsules/add') ? 1 : 0;
12
$allowEdit      = $acl->isAllowed($roleName, 'microlearning/content/capsules/edit') ? 1 : 0;
13
$allowDelete    = $acl->isAllowed($roleName, 'microlearning/content/capsules/delete') ? 1 : 0;
14
$allowUsers     = $acl->isAllowed($roleName, 'microlearning/content/capsules/users') ? 1 : 0;
15
 
16
 
17
 
18
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
19
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
20
 
21
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
22
 
23
 
24
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
25
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.css'));
26
 
27
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
28
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
29
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
30
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
31
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fas/theme.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.js'));
33
 
34
 
35
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
36
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
37
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
38
 
39
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
40
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
41
 
42
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
43
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
44
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
45
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
46
 
6701 nelberth 47
$this->headLink()->appendStylesheet($this->basePath('plugins/nelberth-editor/style.css'));
1 www 48
 
49
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
50
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
51
 
52
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
53
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
54
 
55
 
56
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
57
 
58
 
59
$this->headStyle()->captureStart();
60
echo <<<CSS
61
 
62
 
63
#gridTableUsers {
64
    display: flex;
65
    flex-flow: column;
66
    width: 100%;
67
}
68
 
69
#gridTableUsers thead {
70
    flex: 0 0 auto;
71
}
72
 
73
#gridTableUsers tbody {
74
    flex: 1 1 auto;
75
    display: block;
76
    overflow-y: auto;
77
    overflow-x: hidden;
78
}
79
 
80
#gridTableUsers tr {
81
    width: 100%;
82
    display: table;
83
    table-layout: fixed;
84
}
85
CSS;
86
$this->headStyle()->captureEnd();
87
 
88
$this->headLink()->captureStart();
89
 
90
$this->inlineScript()->captureStart();
91
echo <<<JS
92
    jQuery( document ).ready(function( $ ) {
93
 
94
        $.validator.setDefaults({
95
            debug: true,
96
            highlight: function(element) {
97
                $(element).addClass('is-invalid');
98
            },
99
            unhighlight: function(element) {
100
                $(element).removeClass('is-invalid');
101
            },
102
            errorElement: 'span',
103
            errorClass: 'error invalid-feedback',
104
            errorPlacement: function(error, element) {
105
                if(element.parent('.btn-file').length) {
106
                    error.insertAfter(element.parent().parent());
107
                } else if(element.parent('.toggle').length) {
108
                    error.insertAfter(element.parent().parent());
109
                } else {
110
                    error.insertAfter(element.parent());
111
                }
112
            }
113
        });
114
 
115
 
116
        $.fn.showFormErrorValidator = function(fieldname, errors) {
117
            var field = $(fieldname);
118
            if(field) {
119
                $(field).addClass('is-invalid');
120
 
121
 
122
                var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
123
                if(element.parent('.btn-file').length) {
124
                    error.insertAfter(element.parent().parent());
125
                } else if(element.parent('.toggle').length) {
126
                    error.insertAfter(element.parent().parent());
127
                } else {
128
                    error.insertAfter(element.parent());
129
                }
130
            }
131
        };
132
 
133
 
134
 
135
        var allowEdit   = $allowEdit;
136
        var allowDelete = $allowDelete;
137
        var allowUsers  = $allowUsers;
138
 
139
 
140
        var gridTable = $('#gridTable').dataTable( {
141
            'processing': true,
142
            'serverSide': true,
143
            'searching': true,
144
            'order': [[ 0, 'asc' ]],
145
            'ordering':  true,
146
            'ordenable' : true,
147
            'responsive': true,
148
            'select' : false,
149
        	'paging': true,
150
            'pagingType': 'simple_numbers',
151
 
152
    		'ajax': {
153
    			'url' : '$routeDatatable',
154
    			'type' : 'get',
155
                'data': function ( d ) {
156
                    d.topic_uuid = $('#form-filter #topic_uuid').val();
157
 
158
                },
159
                'beforeSend': function (request) {
160
                  NProgress.start();
161
                },
162
                'dataFilter': function(response) {
163
                    var response = jQuery.parseJSON( response );
164
 
165
                    var json                = {};
166
                    json.recordsTotal       = 0;
167
                    json.recordsFiltered    = 0;
168
                    json.data               = [];
169
 
170
                    if(response.success) {
171
                        $('#form-capsule-add').attr('action', response.data.link_add );
172
 
173
                        json.recordsTotal       = response.data.total;
174
                        json.recordsFiltered    = response.data.total;
175
                        json.data               = response.data.items;
176
                    } else {
177
                        $.fn.showError(response.data)
178
                    }
179
 
180
                    return JSON.stringify( json );
181
                }
182
    		},
183
            'language' : {
184
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
185
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
186
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
187
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
188
                'sInfo':           'LABEL_DATATABLE_SINFO',
189
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
190
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
191
                'sInfoPostFix':    '',
192
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
193
                'sUrl':            '',
194
                'sInfoThousands':  ',',
195
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
196
                'oPaginate': {
197
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
198
                    'sLast':     'LABEL_DATATABLE_SLAST',
199
                    'sNext':     'LABEL_DATATABLE_SNEXT',
200
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
201
                },
202
                'oAria': {
203
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
204
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
205
                },
206
            },
207
            'drawCallback': function( settings ) {
208
                NProgress.done();
209
                $('button.btn-delete').confirmation({
210
                    rootSelector: 'button.btn-delete',
211
                    title : 'LABEL_ARE_YOU_SURE',
212
                    singleton : true,
213
                    btnOkLabel: 'LABEL_YES',
214
                    btnCancelLabel: 'LABEL_NO',
215
                    onConfirm: function(value) {
216
                        action = $(this).data('href');
217
                        NProgress.start();
218
                        $.ajax({
219
                            'dataType'  : 'json',
220
                            'accept'    : 'application/json',
221
                            'method'    : 'post',
222
                            'url'       :  action,
223
                        }).done(function(response) {
224
                            if(response['success']) {
225
                                $.fn.showSuccess(response['data']);
226
                                gridTable.api().ajax.reload(null, false);
227
                            } else {
228
                                $.fn.showError(response['data']);
229
                            }
230
                        }).fail(function( jqXHR, textStatus, errorThrown) {
231
                            $.fn.showError(textStatus);
232
                        }).always(function() {
233
                            NProgress.done();
234
                        });
235
                    },
236
                });
237
            },
238
            'aoColumns': [
239
                { 'mDataProp': 'name' },
240
                { 'mDataProp': 'details' },
241
                { 'mDataProp': 'images' },
242
                { 'mDataProp': 'actions' },
243
    	    ],
244
            'columnDefs': [
245
                {
246
                    'targets': 0,
247
                    'className' : 'text-vertical-middle',
248
                },
249
                {
250
                    'targets': -3,
251
                    'orderable': false,
252
                    'render' : function ( data, type, row ) {
253
                        var s = '';
254
                        s += 'LABEL_STATUS: ' + data['status']  + '<br/>';
255
 
256
                         if(allowUsers && row['actions']['link_total_users']  ) {
257
                            s += 'LABEL_TOTAL_USERS: ' + data['total_users']  + ' <button class="btn btn-view-total-users" data-href="' + row['actions']['link_total_users'] + '" data-toggle="tooltip" title="LABEL_VIEW"><i class="fa fa-external-link"></i></button> <br>';
258
                         } else {
259
                            s += 'LABEL_TOTAL_USERS: ' + data['total_users']  + '<br/>';
260
                         }
261
                         if(allowUsers && row['actions']['link_total_users_actives']  ) {
262
                            s += 'LABEL_TOTAL_USERS_ACTIVE: ' + data['total_users_active']  + ' <button class="btn btn-view-total-users" data-href="' + row['actions']['link_total_users_actives'] + '" data-toggle="tooltip" title="LABEL_VIEW"><i class="fa fa-external-link"></i></button> <br>';
263
                         } else {
264
                            s += 'LABEL_TOTAL_USERS_ACTIVE: ' + data['total_users_active']  + '<br/>';
265
                         }
266
 
267
                        return s;
268
                    }
269
                },
270
                {
271
                    'targets': -2,
272
                    'orderable': false,
273
                    'render' : function ( data, type, row ) {
274
                        s = '';
275
 
276
                        if( data['image'] )  {
277
                            s = s + '&nbsp; <img class="btn-view-image-app" data-href="' + data['image'] + '" data-toggle="tooltip" src="'+data['image']+'" title="LABEL_VIEW" style="width: 40px; object-fit: cover; height: 40px;" /> '
278
                        }  else {
279
                            s = s + '';
280
                        }
281
 
282
                        if( data['marketplace'] )  {
283
                            s = s + '&nbsp; <img class="btn-view-image-marketplace" data-href="' + data['image'] + '" data-toggle="tooltip" src="'+data['image']+'" title="LABEL_VIEW" style="width: 40px; object-fit: cover; height: 40px;" /> '
284
                        }  else {
285
                            s = s + '';
286
                        }
287
 
288
 
289
 
290
                        return s;
291
                    }
292
                },
293
 
294
 
295
                {
296
                    'targets': -1,
297
                    'orderable': false,
298
                    'render' : function ( data, type, row ) {
299
                        s = '';
300
 
301
                        if(allowEdit && data['link_edit']  ) {
302
                            s = s + '<button class="btn btn-info btn-sm btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
303
                        }
304
                        if(allowDelete && data['link_delete']  ) {
305
                            s = s + '<button class="btn btn-danger btn-sm btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>&nbsp;';
306
                        }
307
 
308
                        return s;
309
                    }
310
                }
311
              ],
312
        });
313
 
314
 
6823 nelberth 315
        var seleccionarCampo;
1 www 316
    var validatorAdd = $('#form-capsule-add').validate({
317
        debug: true,
318
        onclick: false,
319
        onkeyup: false,
320
        ignore: [],
321
        rules: {
322
            'name': {
323
                required: true,
324
                maxlength: 128,
325
            },
326
            'description': {
327
                updateCkeditor:function() {
328
                        CKEDITOR.instances.description_add.updateElement();
329
                },
330
                required: true
331
            },
332
           'file': {
333
                required: true,
334
                extension: 'jpg|jpeg|png',
335
                accept: 'image/jpg,image/jpeg,image/png'
336
            },
337
            'order' : {
338
                required: true,
339
                digits: true,
340
                min: 1,
341
                max: 250
342
            },
343
           'marketplace': {
344
                required: false,
345
                extension: 'jpg|jpeg|png',
346
                accept: 'image/jpg,image/jpeg,image/png'
347
            },
348
            'status' : {
349
                required: true,
350
            },
351
            'privacy' : {
352
                required: true,
353
            },
354
            'type' : {
355
                required: true,
356
            },
357
            'cost' : {
358
                required: function() {
359
                    return $('#form-capsule-add #type').val() == 's';
360
                },
361
                'number' : true,
362
                'min' : 0
363
            }
364
        },
365
        submitHandler: function(form)
366
        {
367
            var formdata = false;
368
            if (window.FormData){
369
                formdata = new FormData(form); //form[0]);
370
            }
371
 
372
            $('input[type="submit"]').prop('disabled', true);
373
 
374
            $.ajax({
375
                'dataType'  : 'json',
376
                'accept'    : 'application/json',
377
                'method'    : 'post',
378
                'url'       :  $('#form-capsule-add').attr('action'),
379
                'data'      :  formdata,
380
                'processData': false,
381
                'contentType': false,
382
            }).done(function(response) {
383
                if(response['success']) {
384
                    $.fn.showSuccess(response['data']);
385
 
6703 nelberth 386
                    $('body, html').animate({scrollTop: '0px'}, 300);
387
					$('#content1').css('display','block');
388
                    $('.contenido').html('');
389
            		seleccionarCampo.css('display','none');
1 www 390
                    gridTable.api().ajax.reload(null, false);
391
                } else {
392
                    validatorAdd.resetForm();
393
                    if(jQuery.type(response['data']) == 'string') {
394
                        $.fn.showError(response['data']);
395
                    } else  {
396
                        $.each(response['data'], function( fieldname, errors ) {
397
                            $.fn.showFormErrorValidator('#form-capsule-add #' + fieldname, errors);
398
                        });
399
                    }
400
                }
401
            }).fail(function( jqXHR, textStatus, errorThrown) {
402
                $.fn.showError(textStatus);
403
            }).always(function() {
404
                NProgress.done();
405
            });
406
            return false;
407
        },
408
        invalidHandler: function(form, validator) {
409
 
410
        }
411
    });
412
 
413
    var validatorEdit  = $('#form-capsule-edit').validate({
414
        debug: true,
415
        onclick: false,
416
        onkeyup: false,
417
        ignore: [],
418
        rules: {
419
              'name': {
420
                required: true,
421
                maxlength: 128,
422
            },
423
            'description': {
424
                updateCkeditor:function() {
425
                        CKEDITOR.instances.description_edit.updateElement();
426
                },
427
                required: true
428
            },
429
           'file': {
430
                required: false,
431
                extension: 'jpg|jpeg|png',
432
                accept: 'image/jpg,image/jpeg,image/png'
433
            },
434
            'order' : {
435
                required: true,
436
                digits: true,
437
                min: 1,
438
                max: 250
439
            },
440
           'marketplace': {
441
                required: false,
442
                extension: 'jpg|jpeg|png',
443
                accept: 'image/jpg,image/jpeg,image/png'
444
            },
445
            'status' : {
446
                required: true,
447
            },
448
            'privacy' : {
449
                required: true,
450
            },
451
            'type' : {
452
                required: true,
453
            },
454
            'cost' : {
455
                required: function() {
456
                    return $('#form-capsule-edit #type').val() == 's';
457
                },
458
                'number' : true,
459
                'min' : 0
460
            }
461
        },
462
        submitHandler: function(form)
463
        {
464
            var formdata = false;
465
            if (window.FormData){
466
                formdata = new FormData(form); //form[0]);
467
            }
468
 
469
            $('input[type="submit"]').prop('disabled', true);
470
 
471
            $.ajax({
472
                'dataType'  : 'json',
473
                'accept'    : 'application/json',
474
                'method'    : 'post',
475
                'url'       :  $('#form-capsule-edit').attr('action'),
476
                'data'      :  formdata,
477
                'processData': false,
478
                'contentType': false,
479
            }).done(function(response) {
480
                if(response['success']) {
481
                    $.fn.showSuccess(response['data']);
482
 
483
 
484
                    $('#modalCapsuleEdit').modal('hide');
485
                    gridTable.api().ajax.reload(null, false);
486
                } else {
487
                    validatorAdd.resetForm();
488
                    if(jQuery.type(response['data']) == 'string') {
489
                        $.fn.showError(response['data']);
490
                    } else  {
491
                        $.each(response['data'], function( fieldname, errors ) {
492
                            $.fn.showFormErrorValidator('#form-capsule-edit #' + fieldname, errors);
493
                        });
494
                    }
495
                }
496
            }).fail(function( jqXHR, textStatus, errorThrown) {
497
                $.fn.showError(textStatus);
498
            }).always(function() {
499
                NProgress.done();
500
            });
501
            return false;
502
        },
503
        invalidHandler: function(form, validator) {
504
 
505
        }
506
    });
507
 
508
 
509
 
510
        $('body').on('click', '.btn-view-image-marketplace', function(e) {
511
            e.preventDefault();
512
 
513
            $('#image-marketplace').attr('src', $(this).data('href'));
514
            $('#modalAppMarkeplate').modal('show');
515
            return false;
516
        });
517
 
518
        $('body').on('click', '.btn-view-image-app', function(e) {
519
            e.preventDefault();
520
 
521
            $('#image-app').attr('src', $(this).data('href'));
522
            $('#modalImageApp').modal('show');
523
            return false;
524
        });
525
 
526
        $('#form-capsule-add #order').inputNumberFormat({decimal: 0});
527
 
528
        $('#form-capsule-add #file').fileinput({
529
            theme: 'fas',
530
            language: 'es',
531
            showUpload: false,
532
            dropZoneEnabled: false,
533
            maxFileCount: 1,
534
            allowedFileExtensions: ['jpeg', 'jpg', 'png'],
535
            msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
536
        });
537
 
538
 
539
        $('#form-capsule-add #marketplace').fileinput({
540
            theme: 'fas',
541
            language: 'es',
542
            showUpload: false,
543
            dropZoneEnabled: false,
544
            maxFileCount: 1,
545
            allowedFileExtensions: ['jpeg', 'jpg', 'png'],
546
            msgPlaceholder: 'LABEL_MARKETPLACE_RECOMMENDED_SIZE $marketplace_size',
547
        });
548
 
549
        $('body').on('click', 'button.btn-add', function(e) {
550
            e.preventDefault();
551
 
552
            $('#form-capsule-add #name').val('');
553
            $('#form-capsule-add #order').val('1');
554
            $('#form-capsule-add #file').fileinput('reset');
555
            $('#form-capsule-add #file').val('');
556
 
557
            $('#form-capsule-add #marketplace').fileinput('reset');
558
            $('#form-capsule-add #marketplace').val('');
559
            $('#form-capsule-add #privacy').val('');
560
            $('#form-capsule-add #status').val('');
561
            $('#form-capsule-add #cost').val('');
562
            $('#form-capsule-add #form-row-cost').hide();
563
 
564
            CKEDITOR.instances.description_add.setData('');
565
            validatorAdd.resetForm();
566
 
6694 nelberth 567
            $('body, html').animate({scrollTop: '0px'}, 300);
568
		    $('#content1').css('display','none');
569
            seleccionarCampo= $('#modalCapsuleAdd');
570
            seleccionarCampo.css('display','block')
571
		    iniciarEditor(seleccionarCampo)
1 www 572
            return false;
573
        });
574
 
575
 
576
        $('#form-capsule-edit #order').inputNumberFormat({decimal: 0});
577
 
578
        $('#form-capsule-edit #file').fileinput({
579
            theme: 'fas',
580
            language: 'es',
581
            showUpload: false,
582
            dropZoneEnabled: false,
583
            maxFileCount: 1,
584
            allowedFileExtensions: ['jpeg', 'jpg', 'png'],
585
            msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
586
        });
587
 
588
        $('#form-capsule-edit #marketplace').fileinput({
589
            theme: 'fas',
590
            language: 'es',
591
            showUpload: false,
592
            dropZoneEnabled: false,
593
            maxFileCount: 1,
594
            allowedFileExtensions: ['jpeg', 'jpg', 'png'],
595
            msgPlaceholder: 'LABEL_MARKETPLACE_RECOMMENDED_SIZE $marketplace_size',
596
        });
597
 
598
        $('body').on('click', 'button.btn-edit', function(e) {
599
            e.preventDefault();
600
 
601
            var url = $(this).data('href');
602
            $.ajax({
603
                'dataType'  : 'json',
604
                'accept'    : 'application/json',
605
                'method'    : 'get',
606
                'url'       :  url,
607
            }).done(function(response) {
608
                if(response['success']) {
609
                    $('#form-capsule-edit').attr('action',url);
610
                    $('#form-capsule-edit #name').val(response['data']['name']);
611
                    $('#form-capsule-edit #order').val(response['data']['order']);
612
                    $('#form-capsule-edit #file').fileinput('reset');
613
                    $('#form-capsule-edit #file').val('');
614
 
615
                    $('#form-capsule-edit #marketplace').fileinput('reset');
616
                    $('#form-capsule-edit #marketplace').val('');
617
                    $('#form-capsule-edit #privacy').val(response['data']['privacy']);
618
                    $('#form-capsule-edit #type').val(response['data']['type']);
619
                    $('#form-capsule-edit #status').val(response['data']['status']);
620
 
621
                    if('s' == response['data']['type']) {
622
                        $('#form-capsule-edit #form-row-cost').show();
623
                        $('#form-capsule-edit #cost').val(response['data']['cost']);
624
                    } else {
625
                        $('#form-capsule-edit #form-row-cost').hide();
626
                        $('#form-capsule-edit #cost').val('');
627
                    }
628
 
629
                    CKEDITOR.instances.description_edit.setData(response['data']['description']);
630
                    validatorEdit.resetForm();
631
 
632
 
633
                    $('#modalCapsuleEdit').modal('show');
634
                } else {
635
                    validatorEdit.resetForm();
636
                    if(jQuery.type(response['data']) == 'string') {
637
                        $.fn.showError(response['data']);
638
                    } else  {
639
                        $.each(response['data'], function( fieldname, errors ) {
640
                            $.fn.showFormErrorValidator('#form-capsule-edit #' + fieldname, errors);
641
                        });
642
                    }
643
                }
644
            }).fail(function( jqXHR, textStatus, errorThrown) {
645
                $.fn.showError(textStatus);
646
            }).always(function() {
647
                NProgress.done();
648
            });
649
        });
650
 
6703 nelberth 651
        $('body').on('click', '#ir_atras', function(e) {
1 www 652
            e.preventDefault();
6703 nelberth 653
            $('body, html').animate({scrollTop: '0px'}, 300);
654
			$('#content1').css('display','block');
655
            seleccionarCampo.css('display','none');
656
            $('.contenido').html('');
657
            return false;
1 www 658
        });
659
 
660
 
661
        CKEDITOR.replace('description_add');
662
        CKEDITOR.replace('description_edit');
663
 
664
        $('#form-capsule-add #type').change(function(e) {
665
            e.preventDefault();
666
 
667
            if('s' == $(this).val()) {
668
                $('#form-capsule-add #form-row-cost').show();
669
            } else {
670
                $('#form-capsule-add #cost').val(0);
671
                $('#form-capsule-add #form-row-cost').hide();
672
            }
673
 
674
        });
675
 
676
        $('#form-capsule-edit #type').change(function(e) {
677
            e.preventDefault();
678
 
679
            if('s' == $(this).val()) {
680
                $('#form-capsule-edit #form-row-cost').show();
681
            } else {
682
                $('#form-capsule-edit #cost').val(0);
683
                $('#form-capsule-edit #form-row-cost').hide();
684
            }
685
 
686
        });
687
 
688
        $('#form-capsule-add #order').inputNumberFormat({decimal: 0});
689
        $('#form-capsule-add #cost').inputNumberFormat({decimal: 2});
690
 
691
        $('#form-filter #topic_uuid').change(function(e) {
692
            e.preventDefault();
693
 
694
            gridTable.api().ajax.reload(null, false);
695
 
696
        });
697
 
698
 
699
 
700
 
701
 
702
    $('body').on('click', 'button.btn-view-total-users', function(e) {
703
        e.preventDefault();
704
 
705
        var href = $(this).data('href');
706
        NProgress.start();
707
        $.ajax({
708
            'dataType'  : 'json',
709
            'accept'    : 'application/json',
710
            'method'    : 'get',
711
            'url'       : href,
712
        }).done(function(response) {
713
            if(response['success']) {
714
 
715
                $('#table-users-topic').val(response['data']['topic']);
716
      			$('#table-users-capsule').val(response['data']['capsule']);
717
 
718
                $('#gridTableUsers tbody').empty();
719
 
720
                $.each(response['data']['items'], function(index, item) {
721
 
722
                    console.log(item);
723
 
724
                    var s = '<tr>';
725
                    s = s + '<td>' + item['first_name'] + '</td>';
726
                    s = s + '<td>' + item['last_name'] + '</td>';
727
                    s = s + '<td>' + item['email'] + '</td>';
728
 
729
                    s = s + '<td>';
730
                    if(item['details']['access']) {
731
                        s = s + 'LABEL_ACCESS : ' + item['details']['access'] + '<br>';
732
                    }
733
                    if(item['details']['paid_from']) {
734
                        s = s + 'LABEL_PAID_FROM : ' + item['details']['paid_from'] + '<br>';
735
                    }
736
                    if(item['details']['paid_to']) {
737
                        s = s + 'LABEL_PAID_TO : ' + item['details']['paid_to'] + '<br>';
738
                    }
739
 
740
                    s = s + '</td>';
741
                    s = s + '</tr>';
742
 
743
                    $('#gridTableUsers tbody').append(s);
744
 
745
 
746
                });
747
 
748
                $('#notificationUsersModal').modal('show');
749
 
750
            } else {
751
                $.fn.showError(response['data']);
752
 
753
            }
754
        }).fail(function( jqXHR, textStatus, errorThrown) {
755
            $.fn.showError(textStatus);
756
        }).always(function() {
757
 
758
            NProgress.done();
759
        });
760
        return false;
761
 
762
    });
6823 nelberth 763
	fileToggle=true;
1 www 764
    $('body').on('click', 'button.btn-refresh', function(e) {
765
        e.preventDefault();
766
        gridTable.api().ajax.reload(null, false);
767
    });
6682 nelberth 768
       	/*Script del editor (Aqui comienza el cielo y la tierra) */
769
		var imagenServidorNoticia;
770
		var scroll_altura,viente;
771
		var nombre_user = $(".perfil_u_nombre").text();
772
		var primer_nombre = nombre_user.split(" ")[0];
773
		var nuevoHtmlImagen='<div class="articulo_noticia animated fadeIn"><div class="pasos"><div class="titulo_pasos animated fadeInDown delay-04 fast">LABEL_STEP_1</div><div class="paso_opcion"><div class="responsing_cut"><div class="icon_cut"><span class="fa fa-scissors"></span></div><div class="contenido_cut"><div class="animated fadeInRight delay-04 fast"><div><div class="titulo_cut"><div>LABEL_CUT</div><div class="fa fa-times" id="cerrar_cut_modal"></div></div><div class="opcion_editor recortar10"><div>LABEL_CUT</div><div id="blockCelda"><span class="fa fa-lock"></span></div></div></div></div></div></div><div class="responsing_text"><div class="icon_text"><span class="fa fa-text-width"></span></div><div class="contenido_text"><div class="animated fadeInRight delay-04 fast"><div class="texto"><div class="titulo_text"><div>LABEL_ADD_TEXT</div><div class="fa fa-times" id="cerrar_text_modal"></div></div><input id="texto_input" type="text" name="texto" placeholder="LABEL_ADD_TEXT_HERE"><div class="fonts"><div class="font" id="negritas" data-tooltip="Negritas"><i class="fa fa-bold" aria-hidden="true"></i></div><div class="font" id="italic" data-tooltip="Letra Cursiva"><i class="fa fa-italic" aria-hidden="true"></i></div><input type="color" class="" data-tooltip="Color de la letra" name="" id="color" value="#ffffff"> <input type="number" class="" data-tooltip="Tamaño de la letra" name="" id="font-size" max="500" min="1" step="1" value="48"></div><div class="fonts"><div class="font fa" data-tooltip="Sombra de la letra" id="shadow">A</div><div class="font" id="rectangulo" data-tooltip="Fondo de la letra"><div class="rectangulo">C</div></div><input type="color" name="" id="colorrect" value="#000000" class="" data-tooltip="Color del fondo"> <input type="number" name="" id="opacidad" max="100" min="1" step="1" value="100" class="" data-tooltip="Transparensia del fondo"></div><div class="fonts_style"><div class="fs at" id="arial">LABEL_FONT_ARIAL</div><div class="fs" id="calibri">LABEL_FONT_CALIBRI</div><div class="fs" id="forte">LABEL_FONT_FORTE</div><div class="fs" id="impact">LABEL_FONT_IMPACT</div><div class="fs" id="jokerman">LABEL_FONT_JOKERMAN</div><div class="fs" id="mb">LABEL_FONT_MV_BOLI</div><div class="fs" id="tnr">LABEL_FONT_TIMES_NEW_ROMAN</div><div class="fs" id="verdana">LABEL_FONT_VERDANA</div><div class="fs" id="vivaldi">LABEL_FONT_VIVALDI</div></div></div></div></div></div><div class="responsing_filtros"><div class="icon_filter"><span class="fa fa-eyedropper"></span></div><div class="contenido_filter"><div class="titulo_filtro"><div>LABEL_FILTERS</div><div class="fa fa-times" id="cerrar_filter_modal"></div></div><div class="opciones_imagen"><div class="opcion_editor oa" id="normal">LABEL_FILTER_NORMAL</div><div class="opcion_editor" id="noche">LABEL_FILTER_NIGHT</div><div class="opcion_editor" id="sa">LABEL_FILTER_SAINT_ANA</div><div class="opcion_editor" id="crema">LABEL_FILTER_CREAM</div><div class="opcion_editor" id="magia">LABEL_FILTER_MAGIC</div><div class="opcion_editor" id="relieve">LABEL_FILTER_RELIEF</div><div class="opcion_editor" id="luz">LABEL_FILTER_LIGHT</div><div class="opcion_editor" id="saturacion">LABEL_FILTER_SATURATION</div><div class="opcion_editor" id="retoque">LABEL_FILTER_RETOUCH</div><div class="opcion_editor" id="orange">LABEL_FILTER_ORANGE</div><div class="opcion_editor" id="setenta">LABEL_FILTER_WIND</div><div class="opcion_editor" id="desierto">LABEL_FILTER_DESERT</div><div class="opcion_editor" id="bosque">LABEL_FILTER_FOREST</div><div class="opcion_editor" id="villa">LABEL_FILTER_TOWN</div><div class="opcion_editor" id="rosa">LABEL_FILTER_PINK</div><div class="opcion_editor" id="historia">LABEL_FILTER_HISTORY</div><div class="opcion_editor" id="gris">LABEL_FILTER_GRAY</div><div class="opcion_editor" id="lhs">LABEL_FILTER_OLD_PICTURE</div><div class="opcion_editor" id="encantador">LABEL_FILTER_CHARMING</div><div class="opcion_editor" id="emocion">LABEL_FILTER_EMOTION</div><div class="opcion_editor" id="beige">LABEL_FILTER_BEIGE</div><div class="opcion_editor" id="fine">LABEL_FILTER_FINE</div><div class="opcion_editor" id="lord">LABEL_FILTER_LORD</div><div class="opcion_editor" id="70">LABEL_FILTER_70S</div><div class="opcion_editor" id="arbol">LABEL_FILTER_TREE</div><div class="opcion_editor" id="verano">LABEL_FILTER_SUMMER</div><div class="opcion_editor" id="cf">LABEL_FILTER_COLD_WEATHER</div><div class="opcion_editor" id="angeles">LABEL_FILTER_ANGELS</div><div class="opcion_editor" id="caliente">LABEL_FILTER_HOT</div><div class="opcion_editor" id="otono">LABEL_FILTER_FALL</div><div class="opcion_editor" id="marzo">LABEL_FILTER_MARCH</div><div class="opcion_editor" id="pera">LABEL_FILTER_PEAR</div><div class="opcion_editor" id="comun">LABEL_FILTER_COMMON</div><div class="opcion_editor" id="oro">LABEL_FILTER_GOLD</div><div class="opcion_editor" id="gotico">LABEL_FILTER_GOTHIC</div><div class="opcion_editor" id="forestal">LABEL_FILTER_FORESTRY</div><div class="opcion_editor" id="luna">LABEL_FILTER_MOON</div><div class="opcion_editor" id="fiesta">LABEL_FILTER_PARTY</div></div></div></div><div class="volver"><span class="icon-undo"></span>LABEL_START_OVER</div><div class="paso_1 paso animated bounceInDown delay-04 fast">1</div><div class="paso_2 a1 animated bounceInDown delay-06 fast">2</div><div class="paso_2 b1 animated bounceInDown delay-08 fast">3</div></div></div><div class="editor_imagenes"><div class="fondo_oscuro"></div><div class="editor_imagenes2"><div class="filtros animated fadeInLeft delay-04 fast"><div class="titulo_filtro"><span class="icon-eyedropper fa fa-eyedropper"></span>LABEL_FILTERS</div><div class="opciones_imagen"><div class="opcion_editor oa" id="normal">LABEL_FILTER_NORMAL</div><div class="opcion_editor" id="noche">LABEL_FILTER_NIGHT</div><div class="opcion_editor" id="sa">LABEL_FILTER_SAINT_ANA</div><div class="opcion_editor" id="crema">LABEL_FILTER_CREAM</div><div class="opcion_editor" id="magia">LABEL_FILTER_MAGIC</div><div class="opcion_editor" id="relieve">LABEL_FILTER_RELIEF</div><div class="opcion_editor" id="luz">LABEL_FILTER_LIGHT</div><div class="opcion_editor" id="saturacion">LABEL_FILTER_SATURATION</div><div class="opcion_editor" id="retoque">LABEL_FILTER_RETOUCH</div><div class="opcion_editor" id="orange">LABEL_FILTER_ORANGE</div><div class="opcion_editor" id="setenta">LABEL_FILTER_WIND</div><div class="opcion_editor" id="desierto">LABEL_FILTER_DESERT</div><div class="opcion_editor" id="bosque">LABEL_FILTER_FOREST</div><div class="opcion_editor" id="villa">LABEL_FILTER_TOWN</div><div class="opcion_editor" id="rosa">LABEL_FILTER_PINK</div><div class="opcion_editor" id="historia">LABEL_FILTER_HISTORY</div><div class="opcion_editor" id="gris">LABEL_FILTER_GRAY</div><div class="opcion_editor" id="lhs">LABEL_FILTER_OLD_PICTURE</div><div class="opcion_editor" id="encantador">LABEL_FILTER_CHARMING</div><div class="opcion_editor" id="emocion">LABEL_FILTER_EMOTION</div><div class="opcion_editor" id="beige">LABEL_FILTER_BEIGE</div><div class="opcion_editor" id="fine">LABEL_FILTER_FINE</div><div class="opcion_editor" id="lord">LABEL_FILTER_LORD</div><div class="opcion_editor" id="70">LABEL_FILTER_70S</div><div class="opcion_editor" id="arbol">LABEL_FILTER_TREE</div><div class="opcion_editor" id="verano">LABEL_FILTER_SUMMER</div><div class="opcion_editor" id="cf">LABEL_FILTER_COLD_WEATHER</div><div class="opcion_editor" id="angeles">LABEL_FILTER_ANGELS</div><div class="opcion_editor" id="caliente">LABEL_FILTER_HOT</div><div class="opcion_editor" id="otono">LABEL_FILTER_FALL</div><div class="opcion_editor" id="marzo">LABEL_FILTER_MARCH</div><div class="opcion_editor" id="pera">LABEL_FILTER_PEAR</div><div class="opcion_editor" id="comun">LABEL_FILTER_COMMON</div><div class="opcion_editor" id="oro">LABEL_FILTER_GOLD</div><div class="opcion_editor" id="gotico">LABEL_FILTER_GOTHIC</div><div class="opcion_editor" id="forestal">LABEL_FILTER_FORESTRY</div><div class="opcion_editor" id="luna">LABEL_FILTER_MOON</div><div class="opcion_editor" id="fiesta">LABEL_FILTER_PARTY</div></div></div><div class="canvas_imagen"><div class="canvas recortar"><div class="canvas_subir" id="imagen_noticia"><span class="icon-plus fa fa-plus"></span>LABEL_DRAG_IMAGE_HERE</div></div></div><div class="modificar animated fadeInRight delay-04 fast"><div><div class="titulo_recortar"><span class="icon-ungroup fa fa-scissors"></span>LABEL_CUT</div><div class="opcion_editor recortar10"><div>LABEL_CUT</div><div id="blockCelda"><span class="fa fa-lock"></span></div></div></div><div class="texto"><div class="titulo_texto"><span class="icon-plus fa fa-text-width"></span>LABEL_ADD_TEXT</div><input id="texto_input" type="text" name="texto" placeholder="LABEL_ADD_TEXT_HERE"><div class="fonts"><div class="font" id="negritas" data-tooltip="Negritas"><i class="fa fa-bold" aria-hidden="true"></i></div><div class="font" id="italic" data-tooltip="Letra Cursiva"><i class="fa fa-italic" aria-hidden="true"></i></div><input type="color" class="" data-tooltip="Color de la letra" name="" id="color" value="#ffffff"> <input type="number" class="" data-tooltip="Tamaño de la letra" name="" id="font-size" max="500" min="1" step="1" value="48"></div><div class="fonts"><div class="font fa" data-tooltip="Sombra de la letra" id="shadow">A</div><div class="font" id="rectangulo" data-tooltip="Fondo de la letra"><div class="rectangulo">C</div></div><input type="color" name="" id="colorrect" value="#000000" class="" data-tooltip="Color del fondo"> <input type="number" name="" id="opacidad" max="100" min="1" step="1" value="100" class="" data-tooltip="Transparensia del fondo"></div><div class="fonts_style"><div class="fs at" id="arial">LABEL_FONT_ARIAL</div><div class="fs" id="calibri">LABEL_FONT_CALIBRI</div><div class="fs" id="forte">LABEL_FONT_FORTE</div><div class="fs" id="impact">LABEL_FONT_IMPACT</div><div class="fs" id="jokerman">LABEL_FONT_JOKERMAN</div><div class="fs" id="mb">LABEL_FONT_MV_BOLI</div><div class="fs" id="tnr">LABEL_FONT_TIMES_NEW_ROMAN</div><div class="fs" id="verdana">LABEL_FONT_VERDANA</div><div class="fs" id="vivaldi">LABEL_FONT_VIVALDI</div></div></div></div></div><div class="botones_dimenciones"><div class="scale"><div class="dimenciones"><div id="ancho">1240px</div><div>x</div><div id="alto">720px</div></div><div class="porciento"><div id="menos_scale"><span class="icon-minus fa fa-minus"></span></div><div class="ps"><ul class="cantidades_scale"><li data-scale="2" class="as">200%</li><li data-scale="1" class="as">100%</li><li data-scale="0.75" class="as">75%</li><li data-scale="0.5" class="as">50%</li><li data-scale="0.25" class="as">25%</li></ul><div id="porciento_scale">50%</div></div><div id="mas_scale"><span class="icon-plus fa fa-plus"></span></div></div></div><div class="botones"><button class="boton_normal" id="ir_atras">LABEL_GO_BACK</button><button class="boton_normal" id="boton_recortar">LABEL_DATATABLE_SNEXT</button></div></div></div></div><dav class="fixed_noticia"></dav><dav class="cuadro_noticias animated bounceInUp delay-04" id="cuadro_noticias"><dav class="relative"><div class="titulo_topico">LABEL_TITLE</div><canvas class="imagen_noticias" id="imagen_noticias" width="320" height="480"></canvas></dav><div class="progreso d-flex align-items-center justify-content-between"><progress value="0" max="100"></progress><span class="ml-2">0.0%</span></div></dav>'
774
 
775
		$(document).on("click", ".info_noticia", function(e){
776
			imagenServidorNoticia = elemento.toDataURL("image/jpeg", 1.0);
777
			console.log(imagenServidorNoticia.split(','))
778
			$('.background').val(imagenServidorNoticia.split(',')[1]);
779
            $('.imageType .file').val(imagenServidorNoticia.split(',')[1]);
780
			console.log($('.file').val())
781
			$(".c1").addClass("paso");
1 www 782
 
6682 nelberth 783
 
784
		})
785
 
786
		function iniciarEditor(campo, image=''){
787
		 cortar=false;
788
		recorte_listo=false;
789
		texto="";
790
		seis=true;
791
		color="#ffffff";
792
		texto_listo=false,siete=false;
793
		uno=true;
794
		size=48;
795
		cinco=true;
796
		xf=320,yf =480;
797
		negritas=false, bold="";
798
		shadow = true, nueve=true;
799
		italic=false, ita="";
800
		rectangulo=false, diez=false;
801
     	fontfamily="Arial";
802
     	r=0,g=0,b=0,a=1;
803
		window.clearInterval(editorNoticia);
804
		setTimeout(function(){
805
			scroll_altura=$(".articulo_noticia").offset().top-110;
806
			anchoFondoOscuro = $(".articulo_noticia").width();
807
			altoFondoOscuro = $(".editor_imagenes").height();
808
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
809
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
810
 
811
		},navegacion(nuevoHtmlImagen,campo,image));
812
 
813
		}
814
 
815
		$(document).on("click", ".volver", function(){
816
		var nombre_user = $(".perfil_u_nombre").text();
817
		var primer_nombre = nombre_user.split(" ")[0];
818
		 cortar=false;
819
		cinco=true;
820
		recorte_listo=false;
821
		texto="";
822
		seis=true;
823
		color="#ffffff";
824
		texto_listo=false,siete=false;
825
		uno=true;
826
		size=48;
827
		xf=320,yf =480;
828
		negritas=false, bold="";
829
		shadow = true, nueve=true;
830
		italic=false, ita="";
831
		rectangulo=false, diez=false;
832
     	fontfamily="Arial";
833
     	r=0,g=0,b=0,a=1;
834
		 var imagenServidorNoticia;
835
         console.log(seleccionarCampo)
836
		window.clearInterval(editorNoticia);
837
		setTimeout(function(){
838
			scroll_altura=$(".articulo_noticia").offset().top-110;
839
			anchoFondoOscuro = $(".articulo_noticia").width();
840
			altoFondoOscuro = $(".editor_imagenes").height();
841
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
842
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
843
 
844
		},navegacion(nuevoHtmlImagen,seleccionarCampo));
845
 
846
		})
847
 
848
		function navegacion(nuevoHtmlImagen,campo,image='',reload=true){
849
                selectorElementoName=campo.find('#name')
850
 
6824 nelberth 851
                selectorElementoEditor=campo.find('#contenido');
6682 nelberth 852
 
853
				if(image!=''){
854
					const getBase64FromUrl = async (url) => {
855
						const data = await fetch(url);
856
						const blob = await data.blob();
857
						return new Promise((resolve) => {
858
							const reader = new FileReader();
859
							reader.readAsDataURL(blob);
860
							reader.onloadend = function() {
861
							const base64data = reader.result;
862
							resolve(base64data);
863
							}
864
						});
865
					}
866
 
867
					getBase64FromUrl(image).then(function(e){
868
						selectorElementoName.trigger('change');
869
						$(".volver").css("display","block")
870
						$(".a1").addClass("paso");
871
						$(".titulo_pasos").html("LABEL_STEP_2");
872
						setTimeout(function(){
873
							recorte_listo=true;
874
							$(".fondo_oscuro").css("display","none");
875
							$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
876
							$(".recortar10").removeClass("recortar");
877
							$(".canvas").removeClass("recortar");
878
							$(".b1").addClass("paso");
879
							$(".titulo_pasos").html("LABEL_STEP_3");
880
							if(texto!=""){
881
								seis=true;
882
								siete=true;
883
							}
884
							cinco=true;
885
							dos=true;
886
							cuatro=true;
887
							actualizar();
888
 
889
						},editorNoticia(e));
890
 
891
 
892
					})
893
 
894
					setTimeout(function(){
895
						$(".canvas_subir").html('<span class="icon-plus fa fa-spinner"></span> Cargando...')
896
						selectorElementoName.trigger('change');
897
					},selectorElementoEditor.html(nuevoHtmlImagen));
898
				}else{
899
					setTimeout(function(){
900
					    selectorElementoName.trigger('change');
901
					},selectorElementoEditor.html(nuevoHtmlImagen));
902
				}
903
 
904
		}
905
 
906
		$(window).on("scroll", function(){
907
			console.log(scroll_altura)
908
		if($(window).scrollTop()>scroll_altura){
909
			$("#cuadro_noticias").addClass("fixed");
910
		}else{
911
			$("#cuadro_noticias").removeClass("fixed");
912
		}
913
	})
914
 
915
	$(document).on("dragover", "#imagen_noticia", function(e){
916
		e.preventDefault();
917
		e.stopPropagation();
918
		$(this).css({"background":"rgba(0,0,0,.2)"})
919
	})
920
	$(document).on("drop", "#imagen_noticia", function(e){
921
		e.preventDefault();
922
		e.stopPropagation();
923
		$(this).css("background", "none");
924
		var archivo = e.originalEvent.dataTransfer.files;
925
		var img=archivo[0];
926
		if(img.type =="image/jpeg"||img.type =="image/png"){
927
			$(".modificar").removeClass("animated");
928
			var render = new FileReader();
929
			render.readAsDataURL(img);
930
			render.onload = function(e){
931
				$(".volver").css("display","block")
932
				$(".a1").addClass("paso");
933
				$(".titulo_pasos").html("LABEL_STEP_2");
934
				console.log(e.target.result)
935
				editorNoticia(e.target.result)
936
			}
937
		}
938
	})
939
	$(document).on("dragover", "body", function(e){
940
		e.preventDefault();
941
		e.stopPropagation();
942
	})
943
	$(document).on("drop", "body", function(e){
944
		e.preventDefault();
945
		e.stopPropagation();
946
	})
947
 
948
	var canvas='<div class="editorNoticia"><canvas id="editorNoticia">LABEL_NOT_SUPPORTED</canvas></div>';
949
	$(document).on("mouseover", ".editorNoticia", function(){
950
		$("body").css({"overflow": "hidden"});
951
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre").css("margin-right", "17px")
952
		$(".barra,.footer").css("padding-right","17px")
953
 
954
 
955
	})
956
	$(document).on("mouseover", "#editorNoticia", function(){
957
		if(recorte_listo){
958
			ocho=true;
959
		}
960
	})
961
	$(document).on("mouseout", "#editorNoticia", function(){
962
		if(recorte_listo){
963
			ocho=false;
964
			actualizar2()
965
		}
966
	})
967
	$(document).on("mouseout", ".editorNoticia",function(){
968
		$("body").css({"overflow": "auto"})
969
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre").css("margin-right", "0px")
970
		$(".barra,.footer").css("padding-right","0px")
971
 
972
	})
973
	$(document).on('mousewheel', ".editorNoticia",function(e){
974
		var ruedita = e.originalEvent.wheelDelta
975
		if(ruedita>0){
976
			scale = scale+(scale/10);
977
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
978
		}else{
979
			scale = scale-(scale/10);
980
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
981
		}
982
		$("#editorNoticia").css({"transform": "scale("+scale+")"});
983
	})
984
	$(document).on("click", ".as", function(e){
985
		e.preventDefault();
986
		 scale = $(this).data("scale");
987
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
988
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
989
 
990
	})
991
	$(document).on("click", ".ps", function(e){
992
		e.preventDefault();
993
		$(".cantidades_scale").slideToggle(200).css("display", "block");
994
	})
995
	$(document).on("click", "#cerrar_filter_modal, .icon_filter", function(e){
996
		e.preventDefault();
997
		if(recorte_listo){
998
		$(".contenido_filter").slideToggle(200).css("display", "block");
999
		}
1000
	})
1001
	$(document).on("click", "#cerrar_text_modal, .icon_text", function(e){
1002
		e.preventDefault();
1003
		if(recorte_listo){
1004
			$(".contenido_text").slideToggle(200).css("display", "block");
1005
		}
1006
	})
1007
 
1008
	$(document).on("click", "#cerrar_cut_modal, .icon_cut", function(e){
1009
		e.preventDefault();
1010
		if(cortar){
1011
			$(".contenido_cut").slideToggle(200).css("display", "block");
1012
		}
1013
 
1014
	})
1015
	$(document).on("click", "#menos_scale", function(e){
1016
		e.preventDefault();
1017
		scale = scale-(scale/10);
1018
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
1019
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
1020
	})
1021
 
1022
	$(document).on("click", "#mas_scale", function(e){
1023
		e.preventDefault();
1024
		scale = scale+(scale/10);
1025
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
1026
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
1027
	})
1028
	$(document).on("click", "#noche", function(){
1029
		$(".oa").removeClass("oa")
1030
		filter( .5,1.3,1.31,1.33,1.38);
1031
		$(this).addClass("oa")
1032
	})
1033
	$(document).on("click", "#sa", function(){
1034
		$(".oa").removeClass("oa")
1035
		filter( .7,1.1,1.64,1.66,1.50);
1036
		$(this).addClass("oa")
1037
	})
1038
	$(document).on("click", "#crema", function(){
1039
		$(".oa").removeClass("oa")
1040
		filter( .75,1,1.66,1.60,1.51);
1041
		$(this).addClass("oa")
1042
	})
1043
	$(document).on("click", "#setenta", function(){
1044
		$(".oa").removeClass("oa")
1045
		filter( .8,.75,1.60,1.66,1.58);
1046
		$(this).addClass("oa")
1047
	})
1048
	$(document).on("click", "#orange", function(){
1049
		$(".oa").removeClass("oa")
1050
		filter( .8,1,1.6,1.45,1.49);
1051
		$(this).addClass("oa")
1052
	})
1053
	$(document).on("click", "#relieve", function(){
1054
		$(".oa").removeClass("oa")
1055
		filter( .7,1.2,1.60,1.66,1.58);
1056
		$(this).addClass("oa")
1057
	})
1058
	$(document).on("click", "#bosque", function(){
1059
		$(".oa").removeClass("oa")
1060
		filter( .85,.75,1.47,1.66,1.54);
1061
		$(this).addClass("oa")
1062
	})
1063
	$(document).on("click", "#desierto", function(){
1064
		$(".oa").removeClass("oa")
1065
		filter( .8,.9,1.66,1.43,1.28);
1066
		$(this).addClass("oa")
1067
	})
1068
	$(document).on("click", "#villa", function(){
1069
		$(".oa").removeClass("oa")
1070
		filter( .8,.8,1.71,1.64,1.58);
1071
		$(this).addClass("oa")
1072
	})
1073
	$(document).on("click", "#magia", function(){
1074
		$(".oa").removeClass("oa")
1075
		filter( .7,1.2,1.49,1.49,1.6);
1076
		$(this).addClass("oa")
1077
	})
1078
	$(document).on("click", "#luz", function(){
1079
		$(".oa").removeClass("oa")
1080
		filter( .9,.9,1.45,1.54,1.54);
1081
		$(this).addClass("oa")
1082
	})
1083
	$(document).on("click", "#retoque", function(){
1084
		$(".oa").removeClass("oa")
1085
		filter( .9,1.3,1,1,1);
1086
		$(this).addClass("oa")
1087
	})
1088
	$(document).on("click", "#saturacion", function(){
1089
		$(".oa").removeClass("oa")
1090
		filter( 1,1.5,1,1,1);
1091
		$(this).addClass("oa")
1092
	})
1093
	$(document).on("click", "#rosa", function(){
1094
		$(".oa").removeClass("oa")
1095
		filter( .8,1.2,1.24,.99,1);
1096
		$(this).addClass("oa")
1097
	})
1098
	$(document).on("click", "#historia", function(){
1099
		$(".oa").removeClass("oa")
1100
		filter( .9,1.1,1.33,1.19,.91);
1101
		$(this).addClass("oa")
1102
	})
1103
	$(document).on("click", "#encantador", function(){
1104
		$(".oa").removeClass("oa")
1105
		filter( .9,1.2,26,-12,0,2);
1106
		$(this).addClass("oa")
1107
	})
1108
	$(document).on("click", "#emocion", function(){
1109
		$(".oa").removeClass("oa")
1110
		filter( 1.1,1.4,40,12,-6,2);
1111
		$(this).addClass("oa")
1112
	})
1113
	$(document).on("click", "#beige", function(){
1114
		$(".oa").removeClass("oa")
1115
		filter( .9,1.32,56,47,17,2);
1116
		$(this).addClass("oa")
1117
	})
1118
	$(document).on("click", "#fine", function(){
1119
		$(".oa").removeClass("oa")
1120
		filter( .87,1.19,55,37,23,2);
1121
		$(this).addClass("oa")
1122
	})
1123
	$(document).on("click", "#lord", function(){
1124
		$(".oa").removeClass("oa")
1125
		filter( 1.2,.9,67,13,-23,2);
1126
		$(this).addClass("oa")
1127
	})
1128
	$(document).on("click", "#70", function(){
1129
		$(".oa").removeClass("oa")
1130
		filter( 1.2,1.2,35,7,18,2);
1131
		$(this).addClass("oa")
1132
	})
1133
	$(document).on("click", "#arbol", function(){
1134
		$(".oa").removeClass("oa")
1135
		filter(.92,1.23,-11,11,11,2);
1136
		$(this).addClass("oa")
1137
	})
1138
	$(document).on("click", "#verano", function(){
1139
		$(".oa").removeClass("oa")
1140
		filter( 1,1.4,-3,-1,-12,2);
1141
		$(this).addClass("oa")
1142
	})
1143
	$(document).on("click", "#cf", function(){
1144
		$(".oa").removeClass("oa")
1145
		filter( .85,1.26,-15,2,-1,2);
1146
		$(this).addClass("oa")
1147
	})
1148
	$(document).on("click", "#angeles", function(){
1149
		$(".oa").removeClass("oa")
1150
		filter( 1,1.4,5,12,1,2);
1151
		$(this).addClass("oa")
1152
	})
1153
	$(document).on("click", "#caliente", function(){
1154
		$(".oa").removeClass("oa")
1155
		filter( .9,1.2,43,-17,-55,2);
1156
		$(this).addClass("oa")
1157
	})
1158
	$(document).on("click", "#otono", function(){
1159
		$(".oa").removeClass("oa")
1160
		filter( 1,1.29,29,26,17,2);
1161
		$(this).addClass("oa")
1162
	})
1163
	$(document).on("click", "#marzo", function(){
1164
		$(".oa").removeClass("oa")
1165
		filter( .85,1.3,43,25,-11,2);
1166
		$(this).addClass("oa")
1167
	})
1168
	$(document).on("click", "#pera", function(){
1169
		$(".oa").removeClass("oa")
1170
		filter( .8,1.25,31,41,12,2);
1171
		$(this).addClass("oa")
1172
	})
1173
	$(document).on("click", "#comun", function(){
1174
		$(".oa").removeClass("oa")
1175
		filter( 1,1.36,4,5,1,2);
1176
		$(this).addClass("oa")
1177
	})
1178
	$(document).on("click", "#oro", function(){
1179
		$(".oa").removeClass("oa")
1180
		filter( .9,1.3,37,-25,1,2);
1181
		$(this).addClass("oa")
1182
	})
1183
	$(document).on("click", "#gotico", function(){
1184
		$(".oa").removeClass("oa")
1185
		filter( 1.1,1.3,-47,-42,-30,2);
1186
		$(this).addClass("oa")
1187
	})
1188
	$(document).on("click", "#forestal", function(){
1189
		$(".oa").removeClass("oa")
1190
		filter( 1,1.4,-5,42,11,2);
1191
		$(this).addClass("oa")
1192
	})
1193
	$(document).on("click", "#luna", function(){
1194
		$(".oa").removeClass("oa")
1195
		filter( .9,1.2,-5,-7,4,2);
1196
		$(this).addClass("oa")
1197
	})
1198
	$(document).on("click", "#fiesta", function(){
1199
		$(".oa").removeClass("oa")
1200
		filter( 1.1,1.3,-1,-1,26,2);
1201
		$(this).addClass("oa")
1202
	})
1203
	$(document).on("click", "#gris", function(){
1204
		$(".oa").removeClass("oa")
1205
		filtergris(1,1)
1206
		$(this).addClass("oa")
1207
	})
1208
	$(document).on("click", "#lhs", function(){
1209
		$(".oa").removeClass("oa")
1210
		filtergris(.8,1.5);
1211
		$(this).addClass("oa")
1212
	})
1213
	$(document).on("click", "#normal", function(){
1214
		$(".oa").removeClass("oa")
1215
		$(this).addClass("oa")
1216
		filter();
1217
	})
1218
	var texto_listo=false,siete=false;
1219
	var texto;
1220
	$(document).on("keyup", "#texto_input", function(e){
1221
		e.preventDefault();
1222
		texto = $(this).val();
1223
		if(texto_actualizar){
1224
			siete=true;
1225
		}
1226
		if(texto!=""){
1227
			texto_actualizar=true;
1228
			actualizar2();
1229
		}else{
1230
			actualizar2();
1231
		}
1232
 
1233
	})
1234
	var color="#ffffff";
1235
	$(document).on("change", "#color", function(){
1236
    	color=$(this).val();
1237
    	seis=true;
1238
    	actualizar2();
1239
    })
1240
    var size=48;
1241
    $(document).on("keyup change", "#font-size", function(){
1242
    	size=$(this).val();
1243
    	size = parseInt(size);
1244
    	seis=true;
1245
    	siete=true;
1246
    	actualizar2();
1247
    })
1248
    var negritas=false, bold="";
1249
    $(document).on("click", "#negritas", function(e){
1250
    	e.preventDefault();
1251
    	if(!negritas){
1252
    		bold="bold";
1253
    		$(this).addClass("fa");
1254
    		seis=true;
1255
    		siete=true;
1256
    		actualizar2();
1257
    		negritas=true;
1258
    	}else{
1259
    		bold="";
1260
    		$(this).removeClass("fa");
1261
    		seis=true;
1262
    		siete=true;
1263
    		actualizar2();
1264
    		negritas=false;
1265
    	}
1266
    })
1267
    var italic=false, ita="";
1268
     $(document).on("click", "#italic", function(e){
1269
    	e.preventDefault();
1270
    	if(!italic){
1271
    		ita="italic";
1272
    		$(this).addClass("fa");
1273
    		seis=true;
1274
    		siete=true;
1275
    		actualizar2();
1276
    		italic=true;
1277
    	}else{
1278
    		ita="";
1279
    		$(this).removeClass("fa");
1280
    		seis=true;
1281
    		siete=true;
1282
    		actualizar2();
1283
    		italic=false;
1284
    	}
1285
    })
1286
     var fontfamily="Arial";
1287
     $(document).on("click", ".fs", function(e){
1288
    	e.preventDefault();
1289
    	$(".at").removeClass("at");
1290
    	$(this).addClass("at");
1291
    	fontfamily= $(this).text();
1292
    	seis=true;
1293
    	siete=true;
1294
    	actualizar2();
1295
 
1296
    })
1297
     var shadow = true, nueve=true;
1298
     $(document).on("click","#shadow", function(e){
1299
     	e.preventDefault();
1300
     	if(shadow){
1301
     		$(this).removeClass("fa");
1302
     		seis=true;
1303
     		nueve=false;
1304
     		actualizar2();
1305
     		shadow=false;
1306
     	}else{
1307
     		$(this).addClass("fa");
1308
     		seis=true;
1309
     		nueve=true;
1310
     		actualizar2();
1311
     		shadow=true;
1312
     	}
1313
 
1314
     })
1315
     var rectangulo=false, diez=false, colorrect="#000000";
1316
     $(document).on("click", "#rectangulo", function(e){
1317
     	e.preventDefault();
1318
     	if(!rectangulo){
1319
     		$(this).addClass("fa");
1320
     		diez=true;
1321
     		actualizar2();
1322
     		rectangulo=true;
1323
     	}else{
1324
     		$(this).removeClass("fa");
1325
     		diez=false;
1326
     		actualizar2();
1327
     		rectangulo=false;
1328
     	}
1329
 
1330
     })
1331
     var r=0,g=0,b=0;
1332
    $(document).on("change", "#colorrect", function(){
1333
    	colorrect=$(this).val();
1334
    	r=parseInt(colorrect.slice(1,3),16);
1335
    	g=parseInt(colorrect.slice(3,5),16);
1336
    	b=parseInt(colorrect.slice(5,7),16);
1337
    	seis=true;
1338
    	actualizar2();
1339
    })
1340
    var a=1;
1341
 
1342
    $(document).on("keyup change", "#opacidad", function(){
1343
    	a=$(this).val();
1344
    	a=a/100;
1345
    	seis=true;
1346
    	actualizar2();
1347
    })
1348
	var imaNoti = new Image();
1349
	function filter(brillo=1, contraste=1, rojo=1, verde=1, azul=1, valor=1){
1350
		cuatro=false;
1351
		restaurar(brillo, contraste);
1352
		datos=imagenOriginal.data;
1353
		if(valor==2){
1354
			for (var i =  0; i <datos.length; i+=4) {
1355
				datos[i]=datos[i]+rojo;
1356
				datos[i+1]=datos[i+1]+verde;
1357
				datos[i+2]=datos[i+2]+azul;
1358
			}
1359
		}else{
1360
			for (var i =  0; i <datos.length; i+=4) {
1361
				datos[i]=datos[i]*rojo;
1362
				datos[i+1]=datos[i+1]*verde;
1363
				datos[i+2]=datos[i+2]*azul
1364
			}
1365
		}
1366
		editor.putImageData(imagenOriginal,0,0)
1367
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1368
	    imaNoti.src = imagenNoticia;
1369
		actualizar2();
1370
	}
1371
	function filtergris(brillo=1, contraste=1){
1372
		cuatro=false;
1373
		restaurar(brillo, contraste);
1374
		datos=imagenOriginal.data;
1375
		var auxiliar;
1376
		for (var i =  0; i <datos.length; i+=4) {
1377
			auxiliar = 0.34 * datos[i] + 0.5 *datos[i+1] + 0.16 * datos[i+2];
1378
			datos[i]=auxiliar;
1379
			datos[i+1]=auxiliar;
1380
			datos[i+2]=auxiliar;
1381
		}
1382
 
1383
		editor.putImageData(imagenOriginal,0,0)
1384
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1385
	    imaNoti.src = imagenNoticia;
1386
		actualizar2();
1387
	}
1388
	function restaurar(brillo = 1, contraste=1){
1389
		editor.filter = "none"
1390
		editor.filter = 'contrast('+contraste+') brightness('+brillo+') saturate(1) sepia(0)';
1391
		editor.fillStyle="rgba(255,255,255,1)"
1392
		editor.fillRect(0,0,ancho,alto);
1393
		editor.fillStyle=""+color+"";
1394
		var pxf=0,pyf=0;
1395
			if(xf>=(yf/recorte)){
1396
				pxf=xf/ancho;
1397
				pyf=yf/pxf;
1398
				py=(alto/2)-(pyf/2);
1399
				editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
1400
			}else{
1401
				pyf=yf/alto;
1402
				pxf=xf/pyf;
1403
				px=(ancho/2)-(pxf/2);
1404
				editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
1405
			}
1406
		imagenOriginal = editor.getImageData(0,0,ancho,alto)
1407
	}
1408
	var ocho=false;
1409
	function actualizar2(){
1410
		if(recorte_listo){
1411
		if(cuatro){
1412
			imagenOriginal = editor.getImageData(0,0,ancho,alto)
1413
			var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1414
	    	imaNoti.src = imagenNoticia;
1415
	    	cuatro=false;
1416
		}
1417
		editor.filter = "none"
1418
		$(imaNoti).ready(function(e){
1419
			noticia.drawImage(imaNoti,0,0,320,480);
1420
			editor.drawImage(imaNoti,0,0,ancho,alto)
1421
			if(texto_actualizar){
1422
				if(texto!=""){
1423
					if(seis){
1424
						ancho_imaNoti = imaNoti.width;
1425
 
1426
						scale_noticia = -(((ancho_imaNoti-320)/ancho_imaNoti)-1);
1427
						editor.fillStyle=""+color+"";
1428
						editor.strokeStyle="rgb(255,255,255)";
1429
						if(nueve){
1430
							editor.shadowColor="rgba(0,0,0,.5)";
1431
							editor.shadowOffsetX=6;
1432
							editor.shadowOffsetY=6;
1433
							editor.shadowBlur=6;
1434
							noticia.shadowColor="rgba(0,0,0,.5)";
1435
							noticia.shadowOffsetX=6*scale_noticia;
1436
							noticia.shadowOffsetY=6*scale_noticia;
1437
							noticia.shadowBlur=6*scale_noticia;
1438
						}else{
1439
							editor.shadowColor="rgba(0,0,0,0)";
1440
							noticia.shadowColor="rgba(0,0,0,0)";
1441
						}
1442
						editor.font=""+ita+" "+bold+" "+size+"px "+fontfamily+"";
1443
						editor.textAlign="start";
1444
						editor.textBaseline="top";
1445
 
1446
						var sizeNoticia = size*scale_noticia;
1447
						noticia.fillStyle=""+color+"";
1448
						noticia.font=""+ita+" "+bold+" "+sizeNoticia+"px "+fontfamily+"";
1449
						noticia.textAlign="start";
1450
						noticia.textBaseline="top";
1451
						seis=false;
1452
					}
1453
					if(siete){
1454
						dimencionesTexto = editor.measureText(texto);
1455
						txf=dimencionesTexto.width+20;
1456
						tyf= (20+size);
1457
						siete=false;
1458
					}
1459
					if(cinco){
1460
						dimencionesTexto = editor.measureText(texto);
1461
						if(xf>=(yf/recorte)){
1462
							tx=(xf/2)-(dimencionesTexto.width/2);
1463
							ty=(xf*recorte/2)-(size/2);
1464
						}else{
1465
							tx=(yf/recorte/2)-(dimencionesTexto.width/2);
1466
							ty=(yf/2)-(size/2);
1467
						}
1468
 
1469
						txf=dimencionesTexto.width+20;
1470
						tyf= size+20;
1471
						cinco=false;
1472
					}
1473
					if(diez){
1474
						editor.fillStyle="rgba("+r+","+g+","+b+","+a+")";
1475
						noticia.fillStyle="rgba("+r+","+g+","+b+","+a+")";
1476
						editor.fillRect(tx-10,ty-10,txf,tyf);
1477
						noticia.fillRect(((tx-10)*scale_noticia),((ty-10)*scale_noticia),txf*scale_noticia,tyf*scale_noticia);
1478
						editor.fillStyle=""+color+"";
1479
						noticia.fillStyle=""+color+"";
1480
 
1481
					}
1482
					editor.fillText(texto,tx,ty);
1483
					noticia.fillText(texto,(tx*scale_noticia),ty*scale_noticia);
1484
					if(ocho){
1485
						editor.strokeRect(tx-10,ty-10,txf,tyf)
1486
						editor.arc(tx+txf,ty+tyf,10,0,Math.PI*2,false);
1487
						editor.fill();
1488
						editor.beginPath();
1489
					}
1490
					texto_listo=true;
1491
				}
1492
			}
1493
		})
1494
 
1495
	}
1496
	}
1497
	function actualizar(){
1498
			$(imagen).ready(function(e){
1499
				if(uno){
1500
					ancho=imagen.width, alto = imagen.height;
1501
					elemento.width = ancho;
1502
					elemento.height = alto;
1503
					$(".scale").css("display","flex");
1504
					mitadX=ancho/2;
1505
					mitadY=alto/2;
1506
					x=mitadX-xf/2;
1507
					y=mitadY-yf/2;
1508
					if(ancho<=alto){
1509
					 scale = -(((alto-450)/alto)-1);
1510
 
1511
					}else{
1512
					 scale = -(((ancho-500)/ancho)-1);
1513
					}
1514
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
1515
					$("#ancho").html(ancho+"px");
1516
					$("#alto").html(alto+"px");
1517
					uno=false;
1518
				}
1519
				if(dos){
1520
 
1521
					if(xf>=(yf/recorte)){
1522
						alto=xf*recorte;
1523
						ancho=xf;
1524
					}else{
1525
						ancho=yf/recorte;
1526
						alto=yf;
1527
 
1528
					}
1529
					elemento.width = ancho;
1530
					elemento.height = alto;
1531
					if(xf<=yf){
1532
					 scale = -(((yf-450)/yf)-1);
1533
 
1534
					}else{
1535
					 scale = -(((xf-500)/xf)-1);
1536
					}
1537
 
1538
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
1539
					$("#ancho").html(Math.round(xf)+"px");
1540
					$("#alto").html(Math.round(yf)+"px");
1541
					dos=false;
1542
				}
1543
 
1544
					var pxf=0,pyf=0;
1545
					noticia.fillStyle="rgba(255,255,255,1)"
1546
					noticia.fillRect(0,0,320,480);
1547
				if(xf>=(yf/recorte)){
1548
					pxf=xf/320;
1549
					pyf=yf/pxf;
1550
					py=(480/2)-(pyf/2);
1551
					noticia.drawImage(imagen,x,y,xf,yf,0,py,320,pyf);
1552
				}else{
1553
					pyf=yf/480;
1554
					pxf=xf/pyf;
1555
					px=(320/2)-(pxf/2);
1556
					noticia.drawImage(imagen,x,y,xf,yf,px,0,pxf,480);
1557
				}
1558
 
1559
				$("#editorNoticia").css({"transform": "scale("+scale+")"});
1560
				if(!recorte_listo){
1561
					editor.drawImage(imagen,0,0,ancho,alto);
1562
					editor.fillStyle="rgba(0,0,0,.2)"
1563
					editor.fillRect(0,0,ancho,alto);
1564
					editor.fillStyle="rgba(255,255,255,.1)"
1565
					editor.fillRect(x,y,xf,yf);
1566
					editor.fillStyle="rgba(255,255,255,.5)"
1567
					editor.fillRect(x,y,16,16);
1568
					editor.fillRect((x+xf)-16,y,16,16);
1569
					editor.fillRect(x,y+yf-16,16,16);
1570
					editor.fillRect(x+xf-16,yf+y-16,16,16);
1571
					esta=true;
1572
				}else{
1573
					var pxf=0,pyf=0;
1574
 
1575
					editor.fillStyle="rgba(255,255,255,1)"
1576
					editor.fillRect(0,0,ancho,alto);
1577
					if(xf>=(yf/recorte)){
1578
						pxf=xf/ancho;
1579
						pyf=yf/pxf;
1580
						py=(alto/2)-(pyf/2);
1581
						editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
1582
					}else{
1583
						pyf=yf/alto;
1584
						pxf=xf/pyf;
1585
						px=(ancho/2)-(pxf/2);
1586
						editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
1587
				}
1588
 
1589
				}
1590
			})
1591
		}
1592
	var imagenOriginal;
1593
	var x,y,xf=320,yf =480, elemento,editor,centro, total,scale,dimencionesTexto,ancho_imaNoti,
1594
	recorte_listo=false,alto,ancho,tx,ty,txf,tyf,cuatro=true,texto_actualizar=false,cinco=true,seis=true,cuatro;
1595
	var  mitadY,mitadX, uno=true,dos=false, recorte=480/320, imagen_noticias, scale_noticia, tres=true,rotar=false, cortar=false;;
1596
	var translateX;
1597
 
1598
	$(document).on("click", ".recortar10", function(e){
1599
 
1600
		e.preventDefault();
1601
		recorte_listo=false;
1602
		uno=true;
1603
		$(".fondo_oscuro").css("display","block");
1604
		$("#boton_recortar").addClass("recortar").text("Recortar").removeClass("info_noticia");
1605
		$("#boton_recortar3").addClass("recortar").text("Recortar").removeClass("info_noticia3");
1606
		$(".contenido_text").css("display", "none");
1607
		$(".contenido_filter").css("display", "none");
1608
		$(".recortar10").addClass("recortar");
1609
		$(".canvas").addClass("recortar")
1610
		$(".oa").removeClass("oa");
1611
		$("#normal").addClass("oa");
1612
		$(".b1").removeClass("paso");
1613
		$(".titulo_pasos").html("LABEL_STEP_2");
1614
		window.clearInterval(actualizar2);
1615
		actualizar();
1616
 
1617
	})
1618
 
1619
 
1620
	blockCelda=true;
1621
	$(document).on("click", "#blockCelda", function(e){
1622
		e.preventDefault();
1623
		if(blockCelda){
1624
			$(this).html('<span class="fa fa-unlock"></span>')
1625
 
1626
			blockCelda=false;
1627
		}else{
1628
			$(this).html('<span class="fa fa-lock"></span>')
1629
			blockCelda=true;
1630
		}
1631
		t4=true;
1632
 
1633
	})
1634
	var imagen
1635
	function editorNoticia(img){
1636
		 cortar=true;
1637
		imagen= new Image();
1638
		$(".canvas").html(canvas);
1639
		elemento = document.getElementById("editorNoticia");
1640
		editor = elemento.getContext("2d");
1641
		elemento2 = document.getElementById("imagen_noticias");
1642
		noticia = elemento2.getContext("2d");
1643
 
1644
		$(document).on("click", ".boton_marino.recortar",function(e){
1645
			e.preventDefault();
1646
			recorte_listo=true;
1647
			$(".fondo_oscuro").css("display","none");
1648
			$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
1649
			$(".recortar10").removeClass("recortar");
1650
			$(".canvas").removeClass("recortar");
1651
			$(".b1").addClass("paso");
1652
			$(".titulo_pasos").html("LABEL_STEP_3");
1653
			if(texto!=""){
1654
				seis=true;
1655
				siete=true;
1656
			}
1657
			cinco=true;
1658
			dos=true;
1659
			cuatro=true;
1660
			actualizar();
1661
		})
1662
 
1663
		var cli = false, t1= false, t2=false,t3=false,t4=false,tcli=false;
1664
		var mouse =[];
1665
 
1666
 
1667
		function raton(elemento, e){
1668
			return {
1669
				x:((e.pageX - elemento.offsetLeft - ((ancho/2)-((ancho*scale)/2)))/scale),
1670
				y:((e.pageY - elemento.offsetTop - ((alto/2)-((alto*scale)/2)))/scale)
1671
			}
1672
		}
1673
 
1674
		imagen.src=img;
1675
		$(".recortar10").addClass("recortar");
1676
		$("#boton_recortar").removeClass("boton_normal").addClass("recortar boton_marino").text("LABEL_CUT")
1677
		actualizar();
1678
 
1679
		$(elemento).mousemove(function(e){
1680
			mouse = raton(this, e);
1681
			//console.log("raton x: "+mouse.x+ " raton Y: " +mouse.y+ " tx: "+tx+" ty: "+ty+" txf:"+(txf+tx)+" tyf:"+(tyf+ty) )
1682
			if(!recorte_listo){
1683
				if(x+16<mouse.x &&(xf+x-16)>mouse.x && y+16<mouse.y && (y+yf-16)>mouse.y){
1684
			 		$(elemento).css("cursor","move");
1685
			 	}else if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && (y+yf-16)<mouse.y && (y+yf)>mouse.y){
1686
			 		$(elemento).css("cursor","nw-resize");
1687
			 	}else if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1688
			 		$(elemento).css("cursor","ne-resize");
1689
			 	}else if(x<mouse.x &&(16+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1690
			 		$(elemento).css("cursor","se-resize");
1691
			 	}else if(x<mouse.x &&(16+x)>mouse.x && (y+yf-16)<mouse.y &&(y+yf)>mouse.y){
1692
			 		$(elemento).css("cursor","sw-resize");
1693
			 	}else{
1694
			 		$(elemento).css("cursor","default");
1695
			 	}
1696
			}else if(texto_listo){
1697
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
1698
			 		$(elemento).css("cursor","move");
1699
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
1700
			 		$(elemento).css("cursor","pointer");
1701
			 	}else{
1702
			 		$(elemento).css("cursor","default");
1703
			 	}
1704
			}
1705
			else{
1706
				$(elemento).css("cursor","default");
1707
			}
1708
		})
1709
		$(elemento).mousedown(function(e){
1710
			mouse = raton(this, e);
1711
			if(!recorte_listo){
1712
				if(x+16<mouse.x &&(xf+x-16)>mouse.x && y+16<mouse.y && (y+yf-16)>mouse.y){
1713
			 		cli = true;
1714
			 	}
1715
			 	if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && (y+yf-16)<mouse.y && (y+yf)>mouse.y){
1716
			 		t4 = true;
1717
			 	}
1718
				if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1719
			 		t3 = true;
1720
			 	}
1721
			 	if(x<mouse.x &&(16+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1722
			 		t1 = true;
1723
			 	}
1724
			 	if(x<mouse.x &&(16+x)>mouse.x && (y+yf-16)<mouse.y &&(y+yf)>mouse.y){
1725
			 		t2 = true;
1726
			 	}
1727
			}else if(texto_listo){
1728
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
1729
			 		tcli=true;
1730
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
1731
			 		rotar=true;
1732
			 	}
1733
			}
1734
 
1735
		 })
1736
 
1737
		 $(elemento).mousemove(function(e){
1738
		 	mouse = raton(this, e);
1739
		 	if(!recorte_listo){
1740
			 	if(cli){
1741
			 		if((mouse.y-(yf/2))>=0&&(mouse.y+(yf/2))<=alto){
1742
				 		y = (mouse.y-(yf/2));
1743
			 		}else{
1744
			 			if((mouse.y-(yf/2))<0){
1745
			 				y=0;
1746
			 			}
1747
			 			if((mouse.y+(yf/2))>alto){
1748
			 				y=alto-yf;
1749
			 			}
1750
			 		}
1751
			 		if((mouse.x-(xf/2))>=0&&(mouse.x+(xf/2))<=ancho){
1752
			 			x = (mouse.x-(xf/2));
1753
			 		}else{
1754
			 			if((mouse.x-(xf/2))<0){
1755
			 				x=0;
1756
			 			}
1757
			 			if((mouse.x+(xf/2))>ancho){
1758
			 				x=(ancho)-xf;
1759
			 			}
1760
			 		}
1761
			 	}
1762
				if(blockCelda){
1763
			 	if(t4){
1764
			 		if(mouse.y<(alto-10)&&(x+xf)<=(ancho)){
1765
				 		if(Math.round(xf)>=50){
1766
							if(((mouse.y-y)/recorte)>50){
1767
				 				yf=mouse.y-y;
1768
				 				xf=(yf/recorte);
1769
				 			}
1770
						}
1771
			 		}else{
1772
			 			if(mouse.y>=(alto-10)){
1773
			 				yf=alto-y;
1774
				 			xf=(yf/recorte);
1775
				 			t4=false;
1776
			 			}
1777
			 			if(x+xf>(ancho)){
1778
			 				xf=(ancho)-x;
1779
				 			yf=(xf*recorte);
1780
				 			t4=false;
1781
			 			}
1782
			 		}
1783
			 	}
1784
			 	if(t3){
1785
			 		if(mouse.y>0&&(x+xf)<=(ancho)){
1786
				 		if(Math.round(xf)>=50){
1787
							if(((yf+(y-mouse.y))/recorte)>50){
1788
					 			yf=yf+(y-mouse.y);
1789
					 			xf=(yf/recorte);
1790
					 			y=mouse.y;
1791
				 			}
1792
				 		}
1793
 
1794
			 		}else{
1795
			 			if(mouse.y<=0) {
1796
			 				yf=yf+(y-mouse.y);
1797
				 			xf=(yf/recorte);
1798
			 				y=0;
1799
			 				t3=false;
1800
			 			}
1801
			 			if(x+xf>(ancho)){
1802
			 				xf=(ancho)-x;
1803
				 			yf=xf*recorte;
1804
				 			t3=false;
1805
			 			}
1806
			 		}
1807
			 	}
1808
			 	if(t2){
1809
			 		if(mouse.y<(alto-10)&&x>=0){
1810
				 		if(Math.round(xf)>=50){
1811
							if(((mouse.y-y)/recorte)>50){
1812
					 			x=(x+(yf-(mouse.y-y))/recorte);
1813
					 			yf=mouse.y-y;
1814
					 			xf=(yf/recorte);
1815
				 			}
1816
					 	}
1817
 
1818
			 		}else{
1819
			 			if(mouse.y>=(alto-10)) {
1820
			 				yf=alto-y;
1821
				 			xf=(yf/recorte);
1822
				 			t2=false;
1823
			 			}
1824
			 			if(0>x){
1825
			 				x=0;
1826
			 				xf=mouse.y-y;
1827
				 			yf=(xf*recorte);
1828
				 			t2=false;
1829
			 			}
1830
			 		}
1831
			 	}
1832
			 	if(t1){
1833
			 		if(mouse.y>0&&x>=0){
1834
				 		if(Math.round(xf)>=50){
1835
							if(((yf+(y-mouse.y))/recorte)>50){
1836
								yf=yf+(y-mouse.y);
1837
					 			xf=(yf/recorte);
1838
					 			x=(x-(y-mouse.y)/recorte);
1839
					 			y=mouse.y;
1840
							}
1841
				 		}
1842
			 		}else{
1843
			 			if(mouse.y<=0) {
1844
			 				yf=yf+(y-mouse.y);
1845
				 			xf=(yf/recorte);
1846
			 				y=0;
1847
			 				t1=false;
1848
			 			}
1849
			 			if(0>x){
1850
			 				x=0;
1851
			 				xf=yf+(y-mouse.y);
1852
				 			yf=(xf*recorte);
1853
				 			t1=false;
1854
			 			}
1855
			 		}
1856
			 	}
1857
				}else{
1858
				 if(t4){
1859
			 		if(mouse.y<(alto-10-(2/scale))&&mouse.x<=(ancho-(2/scale))){
1860
 
1861
							if((mouse.y-y)>50){
1862
				 				yf=mouse.y-y;
1863
				 			}
1864
							if((mouse.x-x)>50){
1865
								xf=mouse.x-x;
1866
							}
1867
 
1868
			 		}else{
1869
			 			if(mouse.y>=(alto-10-(2/scale))){
1870
			 				yf=alto-y;
1871
			 			}
1872
			 			if(mouse.x>(ancho-(2/scale))){
1873
			 				xf=(ancho)-x;
1874
			 			}
1875
						 t4=false;
1876
			 		}
1877
			 	}
1878
			 	if(t3){
1879
			 		if(mouse.y>(2/scale)&&mouse.x<=(ancho-(2/scale))){
1880
 
1881
							if((yf-(mouse.y-y))>50){
1882
				 				yf=yf-(mouse.y-y);
1883
								y=mouse.y;
1884
				 			}
1885
							if((mouse.x-x)>50){
1886
								xf=mouse.x-x;
1887
							}
1888
 
1889
 
1890
			 		}else{
1891
						if(mouse.x>(ancho-(2/scale))){
1892
							xf=ancho-x;
1893
						}
1894
						if(mouse.y<=(2/scale)){
1895
							yf=yf-(mouse.y-y);
1896
							y=0;
1897
						}
1898
			 			t3=false;
1899
			 		}
1900
			 	}
1901
				/* Izquierda abajo */
1902
			 	if(t2){
1903
			 		if(mouse.y<(alto-10-(2/scale))&&mouse.x>=(2/scale)){
1904
							 if((mouse.y-y)>50){
1905
								yf=mouse.y-y;
1906
				 			}
1907
							if((xf-(mouse.x-x))>50){
1908
								xf=xf-(mouse.x-x);
1909
								x=mouse.x
1910
							}
1911
 
1912
			 		}else{
1913
			 			if(mouse.y>=(alto-10-(2/scale))) {
1914
							yf=alto-y;
1915
			 			}
1916
 
1917
			 			if(mouse.x<(2/scale)){
1918
							xf=xf-(mouse.x-x);
1919
			 				x=0;
1920
			 			}
1921
						 t2=false;
1922
			 		}
1923
			 	}
1924
				/* izquierda arriba */
1925
			 	if(t1){
1926
			 		if(mouse.y>(2/scale)&&mouse.x>=(2/scale)){
1927
 
1928
							if((yf-(mouse.y-y))>50){
1929
				 				yf=yf-(mouse.y-y);
1930
								y=mouse.y;
1931
				 			}
1932
							if((xf-(mouse.x-x))>50){
1933
								xf=xf-(mouse.x-x);
1934
								x=mouse.x
1935
							}
1936
 
1937
			 		}else{
1938
						if(mouse.y<=(2/scale)){
1939
							yf=yf-(mouse.y-y);
1940
							y=0;
1941
						}
1942
						 if(mouse.x<(2/scale)){
1943
							xf=xf-(mouse.x-x);
1944
			 				x=0;
1945
 
1946
			 			}
1947
						 t1=false;
1948
			 		}
1949
			 	}
1950
			}
1951
 
1952
		 	actualizar();
1953
		 	}else if(texto_listo){
1954
		 		if(tcli){
1955
		 			tx=mouse.x-(txf/2)
1956
		 			ty=mouse.y-(tyf/2)
1957
		 		}else if(rotar){
1958
 
1959
		 		}
1960
 
1961
		 		actualizar2();
1962
		 	}
1963
		 })
1964
		 $(elemento).mouseup(function(e){
1965
		 	if(!recorte_listo){
1966
			 	cli=false;
1967
			 	t1=false;
1968
			 	t2=false;
1969
			 	t3=false;
1970
			 	t4=false;
1971
		 	}else if (texto_listo) {
1972
		 		tcli=false;
1973
		 	}
1974
		 })
1975
 
1976
 
1977
	}
1978
	/* Titulo */
1979
 
1980
var titulo_noticia, censor_titulo = true, numero_titulo=0;
1981
	$(document).on("keyup change", "#name", function(e){
1982
	console.log(numero_titulo)
1983
	titulo_noticia = $(this).val();
1984
	titulo_elemento= $(".titulo_topico");
1985
	if(titulo_noticia!=""){
1986
		if(censor_titulo){
1987
			titulo_elemento.html(titulo_noticia);
1988
			if(titulo_elemento.height()>38){
1989
				var titulo_noticia2 = "";
1990
				for(var i =0; i <titulo_noticia.length;i++){
1991
					titulo_noticia2 = titulo_noticia2 + titulo_noticia.split("")[i];
1992
					titulo_elemento.html(titulo_noticia2);
1993
					if(titulo_elemento.height()>38){
1994
						titulo_noticia2 = titulo_noticia2.slice(0,-5) + "...";
1995
						titulo_elemento.html(titulo_noticia2);
1996
						numero_titulo = titulo_noticia2.length;
1997
						censor_titulo=false;
1998
						break;
1999
					}
2000
 
2001
				}
2002
			}else{
2003
				numero_titulo=0;
2004
			}
2005
		}else{
2006
			if(numero_titulo+1>=titulo_noticia.length){
2007
				titulo_elemento.html(titulo_noticia);
2008
				censor_titulo=true;
2009
			}
2010
		}
2011
	}else{
2012
		titulo_elemento.html("LABEL_TITLE");
2013
		censor_titulo = true;
2014
	}
2015
})
2016
 
1 www 2017
});
2018
JS;
2019
$this->inlineScript()->captureEnd();
2020
?>
2021
 
2022
 
2023
 
2024
<!-- Content Header (Page header) -->
2025
<section class="content-header">
2026
	<div class="container-fluid">
2027
    	<div class="row mb-2">
2028
        	<div class="col-sm-12">
2029
            	<h1>LABEL_CAPSULES</h1>
2030
			</div>
2031
		</div>
2032
	</div><!-- /.container-fluid -->
2033
</section>
2034
 
6704 nelberth 2035
<section class="content" id="content1">
1 www 2036
	<div class="container-fluid">
2037
    	<div class="row">
2038
        	<div class="col-12">
2039
				<div class="card">
2040
					<div class="card-header">
2041
						<?php
2042
                        $form = $this->form;
2043
            	        $form->setAttributes([
2044
                            'name'    => 'form-filter',
2045
                            'id'      => 'form-filter',
2046
                        ]);
2047
 
2048
                        $form->prepare();
2049
                        echo $this->form()->openTag($form);
2050
                        ?>
2051
                        <div class="form-group">
2052
                            <?php
2053
                            $element = $form->get('topic_uuid');
2054
 
2055
                            $element->setAttributes(['class' => 'form-control']);
2056
                            $element->setLabel('LABEL_TOPIC');
2057
                            echo $this->formLabel($element);
2058
                            echo $this->formSelect($element);
2059
                            ?>
2060
                        </div>
2061
						<?php echo $this->form()->closeTag($form); ?>
2062
					</div>
2063
					<div class="card-body">
20 steven 2064
        	    		<table id="gridTable" class="table   table-hover">
1 www 2065
                      		<thead>
2066
        						<tr>
2067
                                	<th>LABEL_NAME</th>
2068
                                  	<th>LABEL_DETAILS</th>
2069
                                  	<th>LABEL_IMAGES</th>
2070
                                  	<th>LABEL_ACTIONS</th>
2071
                                </tr>
2072
                       		</thead>
2073
                         	<tbody>
2074
                         	</tbody>
2075
                    	</table>
2076
                   	</div>
2077
                   	<div class="card-footer clearfix">
2078
                   		<div style="float:right;">
2079
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
2080
							<?php if($allowAdd) : ?>
2081
							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
2082
							<?php endif; ?>
2083
						</div>
2084
                 	</div>
2085
          		</div>
2086
           	</div>
2087
        </div>
2088
 	</div>
2089
</section>
2090
 
2091
 
2092
<!-- The Modal -->
6694 nelberth 2093
<div id="modalCapsuleAdd" style='display:none'>
1 www 2094
 
6694 nelberth 2095
 
1 www 2096
            <!-- Modal Header -->
2097
 
6701 nelberth 2098
              <div class="d-flex justify-content-center tituloEditor">
2099
              <h4>LABEL_ADD_CAPSULE</h4>
2100
 
2101
             </div>
1 www 2102
            <!-- Modal body -->
6701 nelberth 2103
      		<div class="grid-padre">
1 www 2104
       			 <?php
2105
       			 $form = $this->formAdd;
2106
            		$form->setAttributes([
2107
                        'method'  => 'post',
2108
            		    'action'  => '',
2109
                        'name'    => 'form-capsule-add',
2110
                        'id'      => 'form-capsule-add',
2111
                    ]);
2112
 
2113
                    $form->prepare();
2114
                    echo $this->form()->openTag($form);
2115
                    ?>
6701 nelberth 2116
    				<div class="form-group grid-1-2">
1 www 2117
    				<?php
2118
                        $element = $form->get('name');
2119
 
2120
                        $element->setAttributes(['class' => 'form-control']);
2121
                        $element->setOptions(['label' => 'LABEL_NAME']);
2122
                        echo $this->formLabel($element);
2123
                        echo $this->formText($element);
2124
                    ?>
2125
				</div>
6701 nelberth 2126
                <div class="form-group grid-1-2">
1 www 2127
                	<?php
2128
                    $element = $form->get('description');
2129
                    $element->setAttributes(['id' => 'description_add', 'class' => 'form-control', 'rows' => '2','class' => 'form-control']);
2130
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
2131
                    echo $this->formLabel($element);
2132
                    echo $this->formTextArea($element);
2133
                    ?>
2134
   				</div>
6701 nelberth 2135
				<div class="form-group grid-1-2">
1 www 2136
    				<?php
2137
                        $element = $form->get('order');
2138
                        $element->setAttributes(['class' => 'form-control']);
2139
                        $element->setOptions(['label' => 'LABEL_ORDER']);
2140
                        echo $this->formLabel($element);
2141
                        echo $this->formText($element);
2142
                    ?>
2143
				</div>
6701 nelberth 2144
				<div class="form-group grid-1-2">
1 www 2145
               		<?php
2146
                    $element = $form->get('file');
2147
 
2148
                    $element->setAttributes(['class' => 'form-control',  'accept' => 'image/jpg,image/jpeg,image/png']);
2149
                    $element->setOptions(['label' => 'LABEL_IMAGE']);
2150
                    echo $this->formLabel($element);
2151
                    ?>
2152
                    <div class="file-loading">
2153
                    	<?php echo $this->formFile($element); ?>
2154
                	</div>
2155
          		</div>
6701 nelberth 2156
          		<div class="form-group grid-1-2">
1 www 2157
    				<?php
2158
                        $element = $form->get('status');
2159
                        $element->setAttributes(['class' => 'form-control']);
2160
                        $element->setOptions(['label' => 'LABEL_STATUS']);
2161
                        echo $this->formLabel($element);
2162
                        echo $this->formSelect($element);
2163
                    ?>
2164
				</div>
6701 nelberth 2165
				<div class="form-group grid-1-2">
1 www 2166
    				<?php
2167
                        $element = $form->get('privacy');
2168
                        $element->setAttributes(['class' => 'form-control']);
2169
                        $element->setOptions(['label' => 'LABEL_PRIVACY']);
2170
                        echo $this->formLabel($element);
2171
                        echo $this->formSelect($element);
2172
                    ?>
2173
				</div>
6701 nelberth 2174
				<div class="form-group grid-1-2">
1 www 2175
    				<?php
2176
                        $element = $form->get('type');
2177
                        $element->setAttributes(['class' => 'form-control']);
2178
                        $element->setOptions(['label' => 'LABEL_TYPE']);
2179
                        echo $this->formLabel($element);
2180
                        echo $this->formSelect($element);
2181
                    ?>
2182
				</div>
6701 nelberth 2183
				<div class="form-group grid-1-2" id="form-row-cost">
1 www 2184
    				<?php
2185
                        $element = $form->get('cost');
2186
                        $element->setAttributes(['class' => 'form-control']);
2187
                        $element->setOptions(['label' => 'LABEL_COST']);
2188
                        echo $this->formLabel($element);
2189
                        echo $this->formText($element);
2190
                    ?>
2191
				</div>
6849 nelberth 2192
				<div class="form-group grid-1-2">
1 www 2193
 
2194
                 	<?php
2195
                    $element = $form->get('marketplace');
2196
                    $element->setAttributes([ 'class' => 'form-control', 'accept' => 'image/jpg,image/jpeg,image/png']);
2197
                    $element->setOptions(['label' => 'LABEL_IMAGE_MARKETPLACE']);
2198
                    echo $this->formLabel($element);
2199
                    ?>
2200
                    <div class="file-loading">
2201
                    	<?php echo $this->formFile($element); ?>
2202
                	</div>
2203
          		</div>
2204
 
6701 nelberth 2205
                  <div class="contenido form-group " id="contenido"></div>
6823 nelberth 2206
 
1 www 2207
     	      		<?php echo $this->form()->closeTag($form); ?>
2208
      		</div>
2209
 
2210
 
6694 nelberth 2211
 
1 www 2212
</div>
2213
 
2214
 
2215
<!-- The Modal -->
2216
<div class="modal" id="modalCapsuleEdit">
2217
	<div class="modal-dialog  modal-xl">
2218
    	<div class="modal-content">
2219
 
2220
            <!-- Modal Header -->
2221
      		<div class="modal-header">
2222
        		<h4 class="modal-title">LABEL_EDIT_CAPSULE</h4>
2223
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2224
      		</div>
2225
 
2226
            <!-- Modal body -->
2227
      		<div class="modal-body">
2228
       			 <?php
2229
       			  $form = $this->formEdit;
2230
            		$form->setAttributes([
2231
                        'method'    => 'post',
2232
                        'name'      => 'form-capsule-edit',
2233
                        'id'        => 'form-capsule-edit'
2234
                    ]);
2235
 
2236
                    $form->prepare();
2237
                    echo $this->form()->openTag($form);
2238
                ?>
2239
    			<div class="form-group">
2240
    				<?php
2241
                        $element = $form->get('name');
2242
                        $element->setAttributes(['class' => 'form-control']);
2243
                        $element->setOptions(['label' => 'LABEL_NAME']);
2244
                        echo $this->formLabel($element);
2245
                        echo $this->formText($element);
2246
                    ?>
2247
				</div>
2248
                <div class="form-group">
2249
                	<?php
2250
                    $element = $form->get('description');
2251
                    $element->setAttributes(['id' => 'description_edit', 'rows' => '2', 'class' => 'form-control',   'class' => 'form-control']);
2252
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
2253
                    echo $this->formLabel($element);
2254
                    echo $this->formTextArea($element);
2255
                    ?>
2256
   				</div>
2257
				<div class="form-group">
2258
    				<?php
2259
                        $element = $form->get('order');
2260
                        $element->setAttributes(['class' => 'form-control']);
2261
                        $element->setOptions(['label' => 'LABEL_ORDER']);
2262
                        echo $this->formLabel($element);
2263
                        echo $this->formText($element);
2264
                    ?>
2265
				</div>
2266
				<div class="form-group">
2267
 
2268
 
2269
                 		<?php
2270
                        $element = $form->get('file');
2271
                        $element->setOptions(['label' => 'LABEL_IMAGE']);
2272
                        echo $this->formLabel($element);
2273
                        ?>
2274
                        <div class="file-loading">
2275
                        <?php
2276
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'image/jpg,image/jpeg,image/png']);
2277
                        echo $this->formFile($element);
2278
                        ?>
2279
                	</div>
2280
          		</div>
2281
 
2282
          		<div class="form-group">
2283
    				<?php
2284
                        $element = $form->get('status');
2285
                        $element->setAttributes(['class' => 'form-control']);
2286
                        $element->setOptions(['label' => 'LABEL_STATUS']);
2287
                        echo $this->formLabel($element);
2288
                        echo $this->formSelect($element);
2289
                    ?>
2290
				</div>
2291
				<div class="form-group">
2292
    				<?php
2293
                        $element = $form->get('privacy');
2294
                        $element->setAttributes(['class' => 'form-control']);
2295
                        $element->setOptions(['label' => 'LABEL_PRIVACY']);
2296
                        echo $this->formLabel($element);
2297
                        echo $this->formSelect($element);
2298
                    ?>
2299
				</div>
2300
				<div class="form-group">
2301
    				<?php
2302
                        $element = $form->get('type');
2303
                        $element->setAttributes(['class' => 'form-control']);
2304
                        $element->setOptions(['label' => 'LABEL_TYPE']);
2305
                        echo $this->formLabel($element);
2306
                        echo $this->formSelect($element);
2307
                    ?>
2308
				</div>
2309
				<div class="form-group" id="form-row-cost">
2310
    				<?php
2311
                        $element = $form->get('cost');
2312
                        $element->setAttributes(['class' => 'form-control']);
2313
                        $element->setOptions(['label' => 'LABEL_COST']);
2314
                        echo $this->formLabel($element);
2315
                        echo $this->formText($element);
2316
                    ?>
2317
				</div>
2318
 
2319
 
2320
        				<div class="form-group">
2321
                    		<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2322
                    		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
2323
                   		</div>
2324
     	      		<?php echo $this->form()->closeTag($form); ?>
2325
      		</div>
2326
 
2327
            <!-- Modal footer -->
2328
      		<div class="modal-footer">
2329
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2330
      		</div>
2331
 
2332
    	</div>
2333
	</div>
2334
</div>
2335
 
2336
 
2337
 
2338
<!-- The Modal -->
2339
<div class="modal" id="modalAppMarkeplate">
2340
	<div class="modal-dialog">
2341
		<div class="modal-content">
2342
        	<!-- Modal Header -->
2343
        	<div class="modal-header">
2344
           		<h4 class="modal-title">LABEL_IMAGE_MARKETPLACE</h4>
2345
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2346
      		</div>
2347
 
2348
           	<!-- Modal body -->
2349
           	<div class="modal-body text-center">
2350
    			<img src="" class="img img-responsive" style="width: 300px; height: auto" id="image-marketplace" />
2351
          	</div>
2352
 
2353
            <!-- Modal footer -->
2354
  			<div class="modal-footer">
2355
    			<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2356
      		</div>
2357
      	</div>
2358
	</div>
2359
</div>
2360
 
2361
 
2362
<!-- The Modal -->
2363
<div class="modal" id="modalImageApp">
2364
	<div class="modal-dialog ">
2365
    	<div class="modal-content">
2366
 
2367
            <!-- Modal Header -->
2368
      		<div class="modal-header">
2369
        		<h4 class="modal-title">LABEL_IMAGE</h4>
2370
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2371
      		</div>
2372
 
2373
            <!-- Modal body -->
2374
            <div class="modal-body text-center">
2375
				<img src="" class="img img-responsive" style="width: 300px; height: auto" id="image-app" />
2376
      		</div>
2377
 
2378
            <!-- Modal footer -->
2379
      		<div class="modal-footer">
2380
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2381
          	</div>
2382
         </div>
2383
	</div>
2384
</div>
2385
 
2386
 
2387
 
2388
 
2389
 
2390
 
2391
<!-- The Modal -->
2392
<div class="modal" id="notificationUsersModal">
2393
	<div class="modal-dialog modal-xl">
2394
    	<div class="modal-content">
2395
 
2396
            <!-- Modal Header -->
2397
      		<div class="modal-header">
2398
        		<h4 class="modal-title">LABEL_USERS</h4>
2399
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2400
      		</div>
2401
 
2402
            <!-- Modal body -->
2403
      		<div class="modal-body">
2404
      			<form>
2405
      				<div class="form-group">
2406
      					<label>LABEL_TOPIC</label>
2407
      					<input type="text" readonly="readonly" id="table-users-topic" class="form-control" >
2408
      				</div>
2409
      				<div class="form-group">
2410
      					<label>LABEL_CAPSULE</label>
2411
      					<input type="text" readonly="readonly" id="table-users-capsule" class="form-control" >
2412
      				</div>
2413
      			</form>
2414
      			<div style="height: 300px;overflow: scroll;">
20 steven 2415
				<table id="gridTableUsers" style="width: 100%" class="table   table-hover">
1 www 2416
            		<thead>
2417
            			<tr>
2418
                      		<th>LABEL_FIRST_NAME</th>
2419
                     		<th>LABEL_LAST_NAME</th>
2420
                         	<th>LABEL_EMAIL</th>
2421
                       		<th>LABEL_DETAILS</th>
2422
             			</tr>
2423
                  	</thead>
2424
               		<tbody>
2425
               		</tbody>
2426
         		</table>
2427
         		</div>
2428
 
2429
      		</div>
2430
 
2431
            <!-- Modal footer -->
2432
      		<div class="modal-footer">
2433
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2434
      		</div>
2435
 
2436
    	</div>
2437
	</div>
2438
</div>
2439
 
2440
 
2441
 
2442
 
2443
 
2444
 
2445
 
2446