Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 6849 | Rev 6854 | 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;
6852 nelberth 796
		blockCelda=true;
6682 nelberth 797
		xf=320,yf =480;
798
		negritas=false, bold="";
799
		shadow = true, nueve=true;
800
		italic=false, ita="";
801
		rectangulo=false, diez=false;
802
     	fontfamily="Arial";
803
     	r=0,g=0,b=0,a=1;
804
		window.clearInterval(editorNoticia);
805
		setTimeout(function(){
806
			scroll_altura=$(".articulo_noticia").offset().top-110;
807
			anchoFondoOscuro = $(".articulo_noticia").width();
808
			altoFondoOscuro = $(".editor_imagenes").height();
809
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
810
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
811
 
812
		},navegacion(nuevoHtmlImagen,campo,image));
813
 
814
		}
815
 
816
		$(document).on("click", ".volver", function(){
817
		var nombre_user = $(".perfil_u_nombre").text();
818
		var primer_nombre = nombre_user.split(" ")[0];
819
		 cortar=false;
820
		cinco=true;
821
		recorte_listo=false;
822
		texto="";
823
		seis=true;
824
		color="#ffffff";
825
		texto_listo=false,siete=false;
826
		uno=true;
827
		size=48;
828
		xf=320,yf =480;
6852 nelberth 829
		blockCelda=true;
6682 nelberth 830
		negritas=false, bold="";
831
		shadow = true, nueve=true;
832
		italic=false, ita="";
833
		rectangulo=false, diez=false;
834
     	fontfamily="Arial";
835
     	r=0,g=0,b=0,a=1;
836
		 var imagenServidorNoticia;
837
         console.log(seleccionarCampo)
838
		window.clearInterval(editorNoticia);
839
		setTimeout(function(){
840
			scroll_altura=$(".articulo_noticia").offset().top-110;
841
			anchoFondoOscuro = $(".articulo_noticia").width();
842
			altoFondoOscuro = $(".editor_imagenes").height();
843
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
844
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
845
 
846
		},navegacion(nuevoHtmlImagen,seleccionarCampo));
847
 
848
		})
849
 
850
		function navegacion(nuevoHtmlImagen,campo,image='',reload=true){
851
                selectorElementoName=campo.find('#name')
852
 
6824 nelberth 853
                selectorElementoEditor=campo.find('#contenido');
6682 nelberth 854
 
855
				if(image!=''){
856
					const getBase64FromUrl = async (url) => {
857
						const data = await fetch(url);
858
						const blob = await data.blob();
859
						return new Promise((resolve) => {
860
							const reader = new FileReader();
861
							reader.readAsDataURL(blob);
862
							reader.onloadend = function() {
863
							const base64data = reader.result;
864
							resolve(base64data);
865
							}
866
						});
867
					}
868
 
869
					getBase64FromUrl(image).then(function(e){
870
						selectorElementoName.trigger('change');
871
						$(".volver").css("display","block")
872
						$(".a1").addClass("paso");
873
						$(".titulo_pasos").html("LABEL_STEP_2");
874
						setTimeout(function(){
875
							recorte_listo=true;
876
							$(".fondo_oscuro").css("display","none");
877
							$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
878
							$(".recortar10").removeClass("recortar");
879
							$(".canvas").removeClass("recortar");
880
							$(".b1").addClass("paso");
881
							$(".titulo_pasos").html("LABEL_STEP_3");
882
							if(texto!=""){
883
								seis=true;
884
								siete=true;
885
							}
886
							cinco=true;
887
							dos=true;
888
							cuatro=true;
889
							actualizar();
890
 
891
						},editorNoticia(e));
892
 
893
 
894
					})
895
 
896
					setTimeout(function(){
897
						$(".canvas_subir").html('<span class="icon-plus fa fa-spinner"></span> Cargando...')
898
						selectorElementoName.trigger('change');
899
					},selectorElementoEditor.html(nuevoHtmlImagen));
900
				}else{
901
					setTimeout(function(){
902
					    selectorElementoName.trigger('change');
903
					},selectorElementoEditor.html(nuevoHtmlImagen));
904
				}
905
 
906
		}
907
 
908
		$(window).on("scroll", function(){
909
			console.log(scroll_altura)
910
		if($(window).scrollTop()>scroll_altura){
911
			$("#cuadro_noticias").addClass("fixed");
912
		}else{
913
			$("#cuadro_noticias").removeClass("fixed");
914
		}
915
	})
916
 
917
	$(document).on("dragover", "#imagen_noticia", function(e){
918
		e.preventDefault();
919
		e.stopPropagation();
920
		$(this).css({"background":"rgba(0,0,0,.2)"})
921
	})
922
	$(document).on("drop", "#imagen_noticia", function(e){
923
		e.preventDefault();
924
		e.stopPropagation();
925
		$(this).css("background", "none");
926
		var archivo = e.originalEvent.dataTransfer.files;
927
		var img=archivo[0];
928
		if(img.type =="image/jpeg"||img.type =="image/png"){
929
			$(".modificar").removeClass("animated");
930
			var render = new FileReader();
931
			render.readAsDataURL(img);
932
			render.onload = function(e){
933
				$(".volver").css("display","block")
934
				$(".a1").addClass("paso");
935
				$(".titulo_pasos").html("LABEL_STEP_2");
936
				console.log(e.target.result)
937
				editorNoticia(e.target.result)
938
			}
939
		}
940
	})
941
	$(document).on("dragover", "body", function(e){
942
		e.preventDefault();
943
		e.stopPropagation();
944
	})
945
	$(document).on("drop", "body", function(e){
946
		e.preventDefault();
947
		e.stopPropagation();
948
	})
949
 
950
	var canvas='<div class="editorNoticia"><canvas id="editorNoticia">LABEL_NOT_SUPPORTED</canvas></div>';
951
	$(document).on("mouseover", ".editorNoticia", function(){
952
		$("body").css({"overflow": "hidden"});
953
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre").css("margin-right", "17px")
954
		$(".barra,.footer").css("padding-right","17px")
955
 
956
 
957
	})
958
	$(document).on("mouseover", "#editorNoticia", function(){
959
		if(recorte_listo){
960
			ocho=true;
961
		}
962
	})
963
	$(document).on("mouseout", "#editorNoticia", function(){
964
		if(recorte_listo){
965
			ocho=false;
966
			actualizar2()
967
		}
968
	})
969
	$(document).on("mouseout", ".editorNoticia",function(){
970
		$("body").css({"overflow": "auto"})
971
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre").css("margin-right", "0px")
972
		$(".barra,.footer").css("padding-right","0px")
973
 
974
	})
975
	$(document).on('mousewheel', ".editorNoticia",function(e){
976
		var ruedita = e.originalEvent.wheelDelta
977
		if(ruedita>0){
978
			scale = scale+(scale/10);
979
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
980
		}else{
981
			scale = scale-(scale/10);
982
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
983
		}
984
		$("#editorNoticia").css({"transform": "scale("+scale+")"});
985
	})
986
	$(document).on("click", ".as", function(e){
987
		e.preventDefault();
988
		 scale = $(this).data("scale");
989
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
990
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
991
 
992
	})
993
	$(document).on("click", ".ps", function(e){
994
		e.preventDefault();
995
		$(".cantidades_scale").slideToggle(200).css("display", "block");
996
	})
997
	$(document).on("click", "#cerrar_filter_modal, .icon_filter", function(e){
998
		e.preventDefault();
999
		if(recorte_listo){
1000
		$(".contenido_filter").slideToggle(200).css("display", "block");
1001
		}
1002
	})
1003
	$(document).on("click", "#cerrar_text_modal, .icon_text", function(e){
1004
		e.preventDefault();
1005
		if(recorte_listo){
1006
			$(".contenido_text").slideToggle(200).css("display", "block");
1007
		}
1008
	})
1009
 
1010
	$(document).on("click", "#cerrar_cut_modal, .icon_cut", function(e){
1011
		e.preventDefault();
1012
		if(cortar){
1013
			$(".contenido_cut").slideToggle(200).css("display", "block");
1014
		}
1015
 
1016
	})
1017
	$(document).on("click", "#menos_scale", function(e){
1018
		e.preventDefault();
1019
		scale = scale-(scale/10);
1020
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
1021
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
1022
	})
1023
 
1024
	$(document).on("click", "#mas_scale", function(e){
1025
		e.preventDefault();
1026
		scale = scale+(scale/10);
1027
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
1028
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
1029
	})
1030
	$(document).on("click", "#noche", function(){
1031
		$(".oa").removeClass("oa")
1032
		filter( .5,1.3,1.31,1.33,1.38);
1033
		$(this).addClass("oa")
1034
	})
1035
	$(document).on("click", "#sa", function(){
1036
		$(".oa").removeClass("oa")
1037
		filter( .7,1.1,1.64,1.66,1.50);
1038
		$(this).addClass("oa")
1039
	})
1040
	$(document).on("click", "#crema", function(){
1041
		$(".oa").removeClass("oa")
1042
		filter( .75,1,1.66,1.60,1.51);
1043
		$(this).addClass("oa")
1044
	})
1045
	$(document).on("click", "#setenta", function(){
1046
		$(".oa").removeClass("oa")
1047
		filter( .8,.75,1.60,1.66,1.58);
1048
		$(this).addClass("oa")
1049
	})
1050
	$(document).on("click", "#orange", function(){
1051
		$(".oa").removeClass("oa")
1052
		filter( .8,1,1.6,1.45,1.49);
1053
		$(this).addClass("oa")
1054
	})
1055
	$(document).on("click", "#relieve", function(){
1056
		$(".oa").removeClass("oa")
1057
		filter( .7,1.2,1.60,1.66,1.58);
1058
		$(this).addClass("oa")
1059
	})
1060
	$(document).on("click", "#bosque", function(){
1061
		$(".oa").removeClass("oa")
1062
		filter( .85,.75,1.47,1.66,1.54);
1063
		$(this).addClass("oa")
1064
	})
1065
	$(document).on("click", "#desierto", function(){
1066
		$(".oa").removeClass("oa")
1067
		filter( .8,.9,1.66,1.43,1.28);
1068
		$(this).addClass("oa")
1069
	})
1070
	$(document).on("click", "#villa", function(){
1071
		$(".oa").removeClass("oa")
1072
		filter( .8,.8,1.71,1.64,1.58);
1073
		$(this).addClass("oa")
1074
	})
1075
	$(document).on("click", "#magia", function(){
1076
		$(".oa").removeClass("oa")
1077
		filter( .7,1.2,1.49,1.49,1.6);
1078
		$(this).addClass("oa")
1079
	})
1080
	$(document).on("click", "#luz", function(){
1081
		$(".oa").removeClass("oa")
1082
		filter( .9,.9,1.45,1.54,1.54);
1083
		$(this).addClass("oa")
1084
	})
1085
	$(document).on("click", "#retoque", function(){
1086
		$(".oa").removeClass("oa")
1087
		filter( .9,1.3,1,1,1);
1088
		$(this).addClass("oa")
1089
	})
1090
	$(document).on("click", "#saturacion", function(){
1091
		$(".oa").removeClass("oa")
1092
		filter( 1,1.5,1,1,1);
1093
		$(this).addClass("oa")
1094
	})
1095
	$(document).on("click", "#rosa", function(){
1096
		$(".oa").removeClass("oa")
1097
		filter( .8,1.2,1.24,.99,1);
1098
		$(this).addClass("oa")
1099
	})
1100
	$(document).on("click", "#historia", function(){
1101
		$(".oa").removeClass("oa")
1102
		filter( .9,1.1,1.33,1.19,.91);
1103
		$(this).addClass("oa")
1104
	})
1105
	$(document).on("click", "#encantador", function(){
1106
		$(".oa").removeClass("oa")
1107
		filter( .9,1.2,26,-12,0,2);
1108
		$(this).addClass("oa")
1109
	})
1110
	$(document).on("click", "#emocion", function(){
1111
		$(".oa").removeClass("oa")
1112
		filter( 1.1,1.4,40,12,-6,2);
1113
		$(this).addClass("oa")
1114
	})
1115
	$(document).on("click", "#beige", function(){
1116
		$(".oa").removeClass("oa")
1117
		filter( .9,1.32,56,47,17,2);
1118
		$(this).addClass("oa")
1119
	})
1120
	$(document).on("click", "#fine", function(){
1121
		$(".oa").removeClass("oa")
1122
		filter( .87,1.19,55,37,23,2);
1123
		$(this).addClass("oa")
1124
	})
1125
	$(document).on("click", "#lord", function(){
1126
		$(".oa").removeClass("oa")
1127
		filter( 1.2,.9,67,13,-23,2);
1128
		$(this).addClass("oa")
1129
	})
1130
	$(document).on("click", "#70", function(){
1131
		$(".oa").removeClass("oa")
1132
		filter( 1.2,1.2,35,7,18,2);
1133
		$(this).addClass("oa")
1134
	})
1135
	$(document).on("click", "#arbol", function(){
1136
		$(".oa").removeClass("oa")
1137
		filter(.92,1.23,-11,11,11,2);
1138
		$(this).addClass("oa")
1139
	})
1140
	$(document).on("click", "#verano", function(){
1141
		$(".oa").removeClass("oa")
1142
		filter( 1,1.4,-3,-1,-12,2);
1143
		$(this).addClass("oa")
1144
	})
1145
	$(document).on("click", "#cf", function(){
1146
		$(".oa").removeClass("oa")
1147
		filter( .85,1.26,-15,2,-1,2);
1148
		$(this).addClass("oa")
1149
	})
1150
	$(document).on("click", "#angeles", function(){
1151
		$(".oa").removeClass("oa")
1152
		filter( 1,1.4,5,12,1,2);
1153
		$(this).addClass("oa")
1154
	})
1155
	$(document).on("click", "#caliente", function(){
1156
		$(".oa").removeClass("oa")
1157
		filter( .9,1.2,43,-17,-55,2);
1158
		$(this).addClass("oa")
1159
	})
1160
	$(document).on("click", "#otono", function(){
1161
		$(".oa").removeClass("oa")
1162
		filter( 1,1.29,29,26,17,2);
1163
		$(this).addClass("oa")
1164
	})
1165
	$(document).on("click", "#marzo", function(){
1166
		$(".oa").removeClass("oa")
1167
		filter( .85,1.3,43,25,-11,2);
1168
		$(this).addClass("oa")
1169
	})
1170
	$(document).on("click", "#pera", function(){
1171
		$(".oa").removeClass("oa")
1172
		filter( .8,1.25,31,41,12,2);
1173
		$(this).addClass("oa")
1174
	})
1175
	$(document).on("click", "#comun", function(){
1176
		$(".oa").removeClass("oa")
1177
		filter( 1,1.36,4,5,1,2);
1178
		$(this).addClass("oa")
1179
	})
1180
	$(document).on("click", "#oro", function(){
1181
		$(".oa").removeClass("oa")
1182
		filter( .9,1.3,37,-25,1,2);
1183
		$(this).addClass("oa")
1184
	})
1185
	$(document).on("click", "#gotico", function(){
1186
		$(".oa").removeClass("oa")
1187
		filter( 1.1,1.3,-47,-42,-30,2);
1188
		$(this).addClass("oa")
1189
	})
1190
	$(document).on("click", "#forestal", function(){
1191
		$(".oa").removeClass("oa")
1192
		filter( 1,1.4,-5,42,11,2);
1193
		$(this).addClass("oa")
1194
	})
1195
	$(document).on("click", "#luna", function(){
1196
		$(".oa").removeClass("oa")
1197
		filter( .9,1.2,-5,-7,4,2);
1198
		$(this).addClass("oa")
1199
	})
1200
	$(document).on("click", "#fiesta", function(){
1201
		$(".oa").removeClass("oa")
1202
		filter( 1.1,1.3,-1,-1,26,2);
1203
		$(this).addClass("oa")
1204
	})
1205
	$(document).on("click", "#gris", function(){
1206
		$(".oa").removeClass("oa")
1207
		filtergris(1,1)
1208
		$(this).addClass("oa")
1209
	})
1210
	$(document).on("click", "#lhs", function(){
1211
		$(".oa").removeClass("oa")
1212
		filtergris(.8,1.5);
1213
		$(this).addClass("oa")
1214
	})
1215
	$(document).on("click", "#normal", function(){
1216
		$(".oa").removeClass("oa")
1217
		$(this).addClass("oa")
1218
		filter();
1219
	})
1220
	var texto_listo=false,siete=false;
1221
	var texto;
1222
	$(document).on("keyup", "#texto_input", function(e){
1223
		e.preventDefault();
1224
		texto = $(this).val();
1225
		if(texto_actualizar){
1226
			siete=true;
1227
		}
1228
		if(texto!=""){
1229
			texto_actualizar=true;
1230
			actualizar2();
1231
		}else{
1232
			actualizar2();
1233
		}
1234
 
1235
	})
1236
	var color="#ffffff";
1237
	$(document).on("change", "#color", function(){
1238
    	color=$(this).val();
1239
    	seis=true;
1240
    	actualizar2();
1241
    })
1242
    var size=48;
1243
    $(document).on("keyup change", "#font-size", function(){
1244
    	size=$(this).val();
1245
    	size = parseInt(size);
1246
    	seis=true;
1247
    	siete=true;
1248
    	actualizar2();
1249
    })
1250
    var negritas=false, bold="";
1251
    $(document).on("click", "#negritas", function(e){
1252
    	e.preventDefault();
1253
    	if(!negritas){
1254
    		bold="bold";
1255
    		$(this).addClass("fa");
1256
    		seis=true;
1257
    		siete=true;
1258
    		actualizar2();
1259
    		negritas=true;
1260
    	}else{
1261
    		bold="";
1262
    		$(this).removeClass("fa");
1263
    		seis=true;
1264
    		siete=true;
1265
    		actualizar2();
1266
    		negritas=false;
1267
    	}
1268
    })
1269
    var italic=false, ita="";
1270
     $(document).on("click", "#italic", function(e){
1271
    	e.preventDefault();
1272
    	if(!italic){
1273
    		ita="italic";
1274
    		$(this).addClass("fa");
1275
    		seis=true;
1276
    		siete=true;
1277
    		actualizar2();
1278
    		italic=true;
1279
    	}else{
1280
    		ita="";
1281
    		$(this).removeClass("fa");
1282
    		seis=true;
1283
    		siete=true;
1284
    		actualizar2();
1285
    		italic=false;
1286
    	}
1287
    })
1288
     var fontfamily="Arial";
1289
     $(document).on("click", ".fs", function(e){
1290
    	e.preventDefault();
1291
    	$(".at").removeClass("at");
1292
    	$(this).addClass("at");
1293
    	fontfamily= $(this).text();
1294
    	seis=true;
1295
    	siete=true;
1296
    	actualizar2();
1297
 
1298
    })
1299
     var shadow = true, nueve=true;
1300
     $(document).on("click","#shadow", function(e){
1301
     	e.preventDefault();
1302
     	if(shadow){
1303
     		$(this).removeClass("fa");
1304
     		seis=true;
1305
     		nueve=false;
1306
     		actualizar2();
1307
     		shadow=false;
1308
     	}else{
1309
     		$(this).addClass("fa");
1310
     		seis=true;
1311
     		nueve=true;
1312
     		actualizar2();
1313
     		shadow=true;
1314
     	}
1315
 
1316
     })
1317
     var rectangulo=false, diez=false, colorrect="#000000";
1318
     $(document).on("click", "#rectangulo", function(e){
1319
     	e.preventDefault();
1320
     	if(!rectangulo){
1321
     		$(this).addClass("fa");
1322
     		diez=true;
1323
     		actualizar2();
1324
     		rectangulo=true;
1325
     	}else{
1326
     		$(this).removeClass("fa");
1327
     		diez=false;
1328
     		actualizar2();
1329
     		rectangulo=false;
1330
     	}
1331
 
1332
     })
1333
     var r=0,g=0,b=0;
1334
    $(document).on("change", "#colorrect", function(){
1335
    	colorrect=$(this).val();
1336
    	r=parseInt(colorrect.slice(1,3),16);
1337
    	g=parseInt(colorrect.slice(3,5),16);
1338
    	b=parseInt(colorrect.slice(5,7),16);
1339
    	seis=true;
1340
    	actualizar2();
1341
    })
1342
    var a=1;
1343
 
1344
    $(document).on("keyup change", "#opacidad", function(){
1345
    	a=$(this).val();
1346
    	a=a/100;
1347
    	seis=true;
1348
    	actualizar2();
1349
    })
1350
	var imaNoti = new Image();
1351
	function filter(brillo=1, contraste=1, rojo=1, verde=1, azul=1, valor=1){
1352
		cuatro=false;
1353
		restaurar(brillo, contraste);
1354
		datos=imagenOriginal.data;
1355
		if(valor==2){
1356
			for (var i =  0; i <datos.length; i+=4) {
1357
				datos[i]=datos[i]+rojo;
1358
				datos[i+1]=datos[i+1]+verde;
1359
				datos[i+2]=datos[i+2]+azul;
1360
			}
1361
		}else{
1362
			for (var i =  0; i <datos.length; i+=4) {
1363
				datos[i]=datos[i]*rojo;
1364
				datos[i+1]=datos[i+1]*verde;
1365
				datos[i+2]=datos[i+2]*azul
1366
			}
1367
		}
1368
		editor.putImageData(imagenOriginal,0,0)
1369
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1370
	    imaNoti.src = imagenNoticia;
1371
		actualizar2();
1372
	}
1373
	function filtergris(brillo=1, contraste=1){
1374
		cuatro=false;
1375
		restaurar(brillo, contraste);
1376
		datos=imagenOriginal.data;
1377
		var auxiliar;
1378
		for (var i =  0; i <datos.length; i+=4) {
1379
			auxiliar = 0.34 * datos[i] + 0.5 *datos[i+1] + 0.16 * datos[i+2];
1380
			datos[i]=auxiliar;
1381
			datos[i+1]=auxiliar;
1382
			datos[i+2]=auxiliar;
1383
		}
1384
 
1385
		editor.putImageData(imagenOriginal,0,0)
1386
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1387
	    imaNoti.src = imagenNoticia;
1388
		actualizar2();
1389
	}
1390
	function restaurar(brillo = 1, contraste=1){
1391
		editor.filter = "none"
1392
		editor.filter = 'contrast('+contraste+') brightness('+brillo+') saturate(1) sepia(0)';
1393
		editor.fillStyle="rgba(255,255,255,1)"
1394
		editor.fillRect(0,0,ancho,alto);
1395
		editor.fillStyle=""+color+"";
1396
		var pxf=0,pyf=0;
1397
			if(xf>=(yf/recorte)){
1398
				pxf=xf/ancho;
1399
				pyf=yf/pxf;
1400
				py=(alto/2)-(pyf/2);
1401
				editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
1402
			}else{
1403
				pyf=yf/alto;
1404
				pxf=xf/pyf;
1405
				px=(ancho/2)-(pxf/2);
1406
				editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
1407
			}
1408
		imagenOriginal = editor.getImageData(0,0,ancho,alto)
1409
	}
1410
	var ocho=false;
1411
	function actualizar2(){
1412
		if(recorte_listo){
1413
		if(cuatro){
1414
			imagenOriginal = editor.getImageData(0,0,ancho,alto)
1415
			var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1416
	    	imaNoti.src = imagenNoticia;
1417
	    	cuatro=false;
1418
		}
1419
		editor.filter = "none"
1420
		$(imaNoti).ready(function(e){
1421
			noticia.drawImage(imaNoti,0,0,320,480);
1422
			editor.drawImage(imaNoti,0,0,ancho,alto)
1423
			if(texto_actualizar){
1424
				if(texto!=""){
1425
					if(seis){
1426
						ancho_imaNoti = imaNoti.width;
1427
 
1428
						scale_noticia = -(((ancho_imaNoti-320)/ancho_imaNoti)-1);
1429
						editor.fillStyle=""+color+"";
1430
						editor.strokeStyle="rgb(255,255,255)";
1431
						if(nueve){
1432
							editor.shadowColor="rgba(0,0,0,.5)";
1433
							editor.shadowOffsetX=6;
1434
							editor.shadowOffsetY=6;
1435
							editor.shadowBlur=6;
1436
							noticia.shadowColor="rgba(0,0,0,.5)";
1437
							noticia.shadowOffsetX=6*scale_noticia;
1438
							noticia.shadowOffsetY=6*scale_noticia;
1439
							noticia.shadowBlur=6*scale_noticia;
1440
						}else{
1441
							editor.shadowColor="rgba(0,0,0,0)";
1442
							noticia.shadowColor="rgba(0,0,0,0)";
1443
						}
1444
						editor.font=""+ita+" "+bold+" "+size+"px "+fontfamily+"";
1445
						editor.textAlign="start";
1446
						editor.textBaseline="top";
1447
 
1448
						var sizeNoticia = size*scale_noticia;
1449
						noticia.fillStyle=""+color+"";
1450
						noticia.font=""+ita+" "+bold+" "+sizeNoticia+"px "+fontfamily+"";
1451
						noticia.textAlign="start";
1452
						noticia.textBaseline="top";
1453
						seis=false;
1454
					}
1455
					if(siete){
1456
						dimencionesTexto = editor.measureText(texto);
1457
						txf=dimencionesTexto.width+20;
1458
						tyf= (20+size);
1459
						siete=false;
1460
					}
1461
					if(cinco){
1462
						dimencionesTexto = editor.measureText(texto);
1463
						if(xf>=(yf/recorte)){
1464
							tx=(xf/2)-(dimencionesTexto.width/2);
1465
							ty=(xf*recorte/2)-(size/2);
1466
						}else{
1467
							tx=(yf/recorte/2)-(dimencionesTexto.width/2);
1468
							ty=(yf/2)-(size/2);
1469
						}
1470
 
1471
						txf=dimencionesTexto.width+20;
1472
						tyf= size+20;
1473
						cinco=false;
1474
					}
1475
					if(diez){
1476
						editor.fillStyle="rgba("+r+","+g+","+b+","+a+")";
1477
						noticia.fillStyle="rgba("+r+","+g+","+b+","+a+")";
1478
						editor.fillRect(tx-10,ty-10,txf,tyf);
1479
						noticia.fillRect(((tx-10)*scale_noticia),((ty-10)*scale_noticia),txf*scale_noticia,tyf*scale_noticia);
1480
						editor.fillStyle=""+color+"";
1481
						noticia.fillStyle=""+color+"";
1482
 
1483
					}
1484
					editor.fillText(texto,tx,ty);
1485
					noticia.fillText(texto,(tx*scale_noticia),ty*scale_noticia);
1486
					if(ocho){
1487
						editor.strokeRect(tx-10,ty-10,txf,tyf)
1488
						editor.arc(tx+txf,ty+tyf,10,0,Math.PI*2,false);
1489
						editor.fill();
1490
						editor.beginPath();
1491
					}
1492
					texto_listo=true;
1493
				}
1494
			}
1495
		})
1496
 
1497
	}
1498
	}
1499
	function actualizar(){
1500
			$(imagen).ready(function(e){
1501
				if(uno){
1502
					ancho=imagen.width, alto = imagen.height;
1503
					elemento.width = ancho;
1504
					elemento.height = alto;
1505
					$(".scale").css("display","flex");
1506
					mitadX=ancho/2;
1507
					mitadY=alto/2;
1508
					x=mitadX-xf/2;
1509
					y=mitadY-yf/2;
1510
					if(ancho<=alto){
1511
					 scale = -(((alto-450)/alto)-1);
1512
 
1513
					}else{
1514
					 scale = -(((ancho-500)/ancho)-1);
1515
					}
1516
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
1517
					$("#ancho").html(ancho+"px");
1518
					$("#alto").html(alto+"px");
1519
					uno=false;
1520
				}
1521
				if(dos){
1522
 
1523
					if(xf>=(yf/recorte)){
1524
						alto=xf*recorte;
1525
						ancho=xf;
1526
					}else{
1527
						ancho=yf/recorte;
1528
						alto=yf;
1529
 
1530
					}
1531
					elemento.width = ancho;
1532
					elemento.height = alto;
1533
					if(xf<=yf){
1534
					 scale = -(((yf-450)/yf)-1);
1535
 
1536
					}else{
1537
					 scale = -(((xf-500)/xf)-1);
1538
					}
1539
 
1540
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
1541
					$("#ancho").html(Math.round(xf)+"px");
1542
					$("#alto").html(Math.round(yf)+"px");
1543
					dos=false;
1544
				}
1545
 
1546
					var pxf=0,pyf=0;
1547
					noticia.fillStyle="rgba(255,255,255,1)"
1548
					noticia.fillRect(0,0,320,480);
1549
				if(xf>=(yf/recorte)){
1550
					pxf=xf/320;
1551
					pyf=yf/pxf;
1552
					py=(480/2)-(pyf/2);
1553
					noticia.drawImage(imagen,x,y,xf,yf,0,py,320,pyf);
1554
				}else{
1555
					pyf=yf/480;
1556
					pxf=xf/pyf;
1557
					px=(320/2)-(pxf/2);
1558
					noticia.drawImage(imagen,x,y,xf,yf,px,0,pxf,480);
1559
				}
1560
 
1561
				$("#editorNoticia").css({"transform": "scale("+scale+")"});
1562
				if(!recorte_listo){
1563
					editor.drawImage(imagen,0,0,ancho,alto);
1564
					editor.fillStyle="rgba(0,0,0,.2)"
1565
					editor.fillRect(0,0,ancho,alto);
1566
					editor.fillStyle="rgba(255,255,255,.1)"
1567
					editor.fillRect(x,y,xf,yf);
1568
					editor.fillStyle="rgba(255,255,255,.5)"
1569
					editor.fillRect(x,y,16,16);
1570
					editor.fillRect((x+xf)-16,y,16,16);
1571
					editor.fillRect(x,y+yf-16,16,16);
1572
					editor.fillRect(x+xf-16,yf+y-16,16,16);
1573
					esta=true;
1574
				}else{
1575
					var pxf=0,pyf=0;
1576
 
1577
					editor.fillStyle="rgba(255,255,255,1)"
1578
					editor.fillRect(0,0,ancho,alto);
1579
					if(xf>=(yf/recorte)){
1580
						pxf=xf/ancho;
1581
						pyf=yf/pxf;
1582
						py=(alto/2)-(pyf/2);
1583
						editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
1584
					}else{
1585
						pyf=yf/alto;
1586
						pxf=xf/pyf;
1587
						px=(ancho/2)-(pxf/2);
1588
						editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
1589
				}
1590
 
1591
				}
1592
			})
1593
		}
1594
	var imagenOriginal;
1595
	var x,y,xf=320,yf =480, elemento,editor,centro, total,scale,dimencionesTexto,ancho_imaNoti,
1596
	recorte_listo=false,alto,ancho,tx,ty,txf,tyf,cuatro=true,texto_actualizar=false,cinco=true,seis=true,cuatro;
1597
	var  mitadY,mitadX, uno=true,dos=false, recorte=480/320, imagen_noticias, scale_noticia, tres=true,rotar=false, cortar=false;;
1598
	var translateX;
1599
 
1600
	$(document).on("click", ".recortar10", function(e){
1601
 
1602
		e.preventDefault();
1603
		recorte_listo=false;
1604
		uno=true;
1605
		$(".fondo_oscuro").css("display","block");
1606
		$("#boton_recortar").addClass("recortar").text("Recortar").removeClass("info_noticia");
1607
		$("#boton_recortar3").addClass("recortar").text("Recortar").removeClass("info_noticia3");
1608
		$(".contenido_text").css("display", "none");
1609
		$(".contenido_filter").css("display", "none");
1610
		$(".recortar10").addClass("recortar");
1611
		$(".canvas").addClass("recortar")
1612
		$(".oa").removeClass("oa");
1613
		$("#normal").addClass("oa");
1614
		$(".b1").removeClass("paso");
1615
		$(".titulo_pasos").html("LABEL_STEP_2");
1616
		window.clearInterval(actualizar2);
1617
		actualizar();
1618
 
1619
	})
1620
 
1621
 
1622
	blockCelda=true;
1623
	$(document).on("click", "#blockCelda", function(e){
1624
		e.preventDefault();
1625
		if(blockCelda){
1626
			$(this).html('<span class="fa fa-unlock"></span>')
1627
 
1628
			blockCelda=false;
1629
		}else{
1630
			$(this).html('<span class="fa fa-lock"></span>')
1631
			blockCelda=true;
1632
		}
1633
		t4=true;
1634
 
1635
	})
1636
	var imagen
1637
	function editorNoticia(img){
1638
		 cortar=true;
1639
		imagen= new Image();
1640
		$(".canvas").html(canvas);
1641
		elemento = document.getElementById("editorNoticia");
1642
		editor = elemento.getContext("2d");
1643
		elemento2 = document.getElementById("imagen_noticias");
1644
		noticia = elemento2.getContext("2d");
1645
 
1646
		$(document).on("click", ".boton_marino.recortar",function(e){
1647
			e.preventDefault();
1648
			recorte_listo=true;
1649
			$(".fondo_oscuro").css("display","none");
1650
			$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
1651
			$(".recortar10").removeClass("recortar");
1652
			$(".canvas").removeClass("recortar");
1653
			$(".b1").addClass("paso");
1654
			$(".titulo_pasos").html("LABEL_STEP_3");
1655
			if(texto!=""){
1656
				seis=true;
1657
				siete=true;
1658
			}
1659
			cinco=true;
1660
			dos=true;
1661
			cuatro=true;
1662
			actualizar();
1663
		})
1664
 
1665
		var cli = false, t1= false, t2=false,t3=false,t4=false,tcli=false;
1666
		var mouse =[];
1667
 
1668
 
1669
		function raton(elemento, e){
1670
			return {
1671
				x:((e.pageX - elemento.offsetLeft - ((ancho/2)-((ancho*scale)/2)))/scale),
1672
				y:((e.pageY - elemento.offsetTop - ((alto/2)-((alto*scale)/2)))/scale)
1673
			}
1674
		}
1675
 
1676
		imagen.src=img;
1677
		$(".recortar10").addClass("recortar");
1678
		$("#boton_recortar").removeClass("boton_normal").addClass("recortar boton_marino").text("LABEL_CUT")
1679
		actualizar();
1680
 
1681
		$(elemento).mousemove(function(e){
1682
			mouse = raton(this, e);
1683
			//console.log("raton x: "+mouse.x+ " raton Y: " +mouse.y+ " tx: "+tx+" ty: "+ty+" txf:"+(txf+tx)+" tyf:"+(tyf+ty) )
1684
			if(!recorte_listo){
1685
				if(x+16<mouse.x &&(xf+x-16)>mouse.x && y+16<mouse.y && (y+yf-16)>mouse.y){
1686
			 		$(elemento).css("cursor","move");
1687
			 	}else if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && (y+yf-16)<mouse.y && (y+yf)>mouse.y){
1688
			 		$(elemento).css("cursor","nw-resize");
1689
			 	}else if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1690
			 		$(elemento).css("cursor","ne-resize");
1691
			 	}else if(x<mouse.x &&(16+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1692
			 		$(elemento).css("cursor","se-resize");
1693
			 	}else if(x<mouse.x &&(16+x)>mouse.x && (y+yf-16)<mouse.y &&(y+yf)>mouse.y){
1694
			 		$(elemento).css("cursor","sw-resize");
1695
			 	}else{
1696
			 		$(elemento).css("cursor","default");
1697
			 	}
1698
			}else if(texto_listo){
1699
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
1700
			 		$(elemento).css("cursor","move");
1701
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
1702
			 		$(elemento).css("cursor","pointer");
1703
			 	}else{
1704
			 		$(elemento).css("cursor","default");
1705
			 	}
1706
			}
1707
			else{
1708
				$(elemento).css("cursor","default");
1709
			}
1710
		})
1711
		$(elemento).mousedown(function(e){
1712
			mouse = raton(this, e);
1713
			if(!recorte_listo){
1714
				if(x+16<mouse.x &&(xf+x-16)>mouse.x && y+16<mouse.y && (y+yf-16)>mouse.y){
1715
			 		cli = true;
1716
			 	}
1717
			 	if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && (y+yf-16)<mouse.y && (y+yf)>mouse.y){
1718
			 		t4 = true;
1719
			 	}
1720
				if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1721
			 		t3 = true;
1722
			 	}
1723
			 	if(x<mouse.x &&(16+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1724
			 		t1 = true;
1725
			 	}
1726
			 	if(x<mouse.x &&(16+x)>mouse.x && (y+yf-16)<mouse.y &&(y+yf)>mouse.y){
1727
			 		t2 = true;
1728
			 	}
1729
			}else if(texto_listo){
1730
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
1731
			 		tcli=true;
1732
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
1733
			 		rotar=true;
1734
			 	}
1735
			}
1736
 
1737
		 })
1738
 
1739
		 $(elemento).mousemove(function(e){
1740
		 	mouse = raton(this, e);
1741
		 	if(!recorte_listo){
1742
			 	if(cli){
1743
			 		if((mouse.y-(yf/2))>=0&&(mouse.y+(yf/2))<=alto){
1744
				 		y = (mouse.y-(yf/2));
1745
			 		}else{
1746
			 			if((mouse.y-(yf/2))<0){
1747
			 				y=0;
1748
			 			}
1749
			 			if((mouse.y+(yf/2))>alto){
1750
			 				y=alto-yf;
1751
			 			}
1752
			 		}
1753
			 		if((mouse.x-(xf/2))>=0&&(mouse.x+(xf/2))<=ancho){
1754
			 			x = (mouse.x-(xf/2));
1755
			 		}else{
1756
			 			if((mouse.x-(xf/2))<0){
1757
			 				x=0;
1758
			 			}
1759
			 			if((mouse.x+(xf/2))>ancho){
1760
			 				x=(ancho)-xf;
1761
			 			}
1762
			 		}
1763
			 	}
1764
				if(blockCelda){
1765
			 	if(t4){
1766
			 		if(mouse.y<(alto-10)&&(x+xf)<=(ancho)){
1767
				 		if(Math.round(xf)>=50){
1768
							if(((mouse.y-y)/recorte)>50){
1769
				 				yf=mouse.y-y;
1770
				 				xf=(yf/recorte);
1771
				 			}
1772
						}
1773
			 		}else{
1774
			 			if(mouse.y>=(alto-10)){
1775
			 				yf=alto-y;
1776
				 			xf=(yf/recorte);
1777
				 			t4=false;
1778
			 			}
1779
			 			if(x+xf>(ancho)){
1780
			 				xf=(ancho)-x;
1781
				 			yf=(xf*recorte);
1782
				 			t4=false;
1783
			 			}
1784
			 		}
1785
			 	}
1786
			 	if(t3){
1787
			 		if(mouse.y>0&&(x+xf)<=(ancho)){
1788
				 		if(Math.round(xf)>=50){
1789
							if(((yf+(y-mouse.y))/recorte)>50){
1790
					 			yf=yf+(y-mouse.y);
1791
					 			xf=(yf/recorte);
1792
					 			y=mouse.y;
1793
				 			}
1794
				 		}
1795
 
1796
			 		}else{
1797
			 			if(mouse.y<=0) {
1798
			 				yf=yf+(y-mouse.y);
1799
				 			xf=(yf/recorte);
1800
			 				y=0;
1801
			 				t3=false;
1802
			 			}
1803
			 			if(x+xf>(ancho)){
1804
			 				xf=(ancho)-x;
1805
				 			yf=xf*recorte;
1806
				 			t3=false;
1807
			 			}
1808
			 		}
1809
			 	}
1810
			 	if(t2){
1811
			 		if(mouse.y<(alto-10)&&x>=0){
1812
				 		if(Math.round(xf)>=50){
1813
							if(((mouse.y-y)/recorte)>50){
1814
					 			x=(x+(yf-(mouse.y-y))/recorte);
1815
					 			yf=mouse.y-y;
1816
					 			xf=(yf/recorte);
1817
				 			}
1818
					 	}
1819
 
1820
			 		}else{
1821
			 			if(mouse.y>=(alto-10)) {
1822
			 				yf=alto-y;
1823
				 			xf=(yf/recorte);
1824
				 			t2=false;
1825
			 			}
1826
			 			if(0>x){
1827
			 				x=0;
1828
			 				xf=mouse.y-y;
1829
				 			yf=(xf*recorte);
1830
				 			t2=false;
1831
			 			}
1832
			 		}
1833
			 	}
1834
			 	if(t1){
1835
			 		if(mouse.y>0&&x>=0){
1836
				 		if(Math.round(xf)>=50){
1837
							if(((yf+(y-mouse.y))/recorte)>50){
1838
								yf=yf+(y-mouse.y);
1839
					 			xf=(yf/recorte);
1840
					 			x=(x-(y-mouse.y)/recorte);
1841
					 			y=mouse.y;
1842
							}
1843
				 		}
1844
			 		}else{
1845
			 			if(mouse.y<=0) {
1846
			 				yf=yf+(y-mouse.y);
1847
				 			xf=(yf/recorte);
1848
			 				y=0;
1849
			 				t1=false;
1850
			 			}
1851
			 			if(0>x){
1852
			 				x=0;
1853
			 				xf=yf+(y-mouse.y);
1854
				 			yf=(xf*recorte);
1855
				 			t1=false;
1856
			 			}
1857
			 		}
1858
			 	}
1859
				}else{
1860
				 if(t4){
1861
			 		if(mouse.y<(alto-10-(2/scale))&&mouse.x<=(ancho-(2/scale))){
1862
 
1863
							if((mouse.y-y)>50){
1864
				 				yf=mouse.y-y;
1865
				 			}
1866
							if((mouse.x-x)>50){
1867
								xf=mouse.x-x;
1868
							}
1869
 
1870
			 		}else{
1871
			 			if(mouse.y>=(alto-10-(2/scale))){
1872
			 				yf=alto-y;
1873
			 			}
1874
			 			if(mouse.x>(ancho-(2/scale))){
1875
			 				xf=(ancho)-x;
1876
			 			}
1877
						 t4=false;
1878
			 		}
1879
			 	}
1880
			 	if(t3){
1881
			 		if(mouse.y>(2/scale)&&mouse.x<=(ancho-(2/scale))){
1882
 
1883
							if((yf-(mouse.y-y))>50){
1884
				 				yf=yf-(mouse.y-y);
1885
								y=mouse.y;
1886
				 			}
1887
							if((mouse.x-x)>50){
1888
								xf=mouse.x-x;
1889
							}
1890
 
1891
 
1892
			 		}else{
1893
						if(mouse.x>(ancho-(2/scale))){
1894
							xf=ancho-x;
1895
						}
1896
						if(mouse.y<=(2/scale)){
1897
							yf=yf-(mouse.y-y);
1898
							y=0;
1899
						}
1900
			 			t3=false;
1901
			 		}
1902
			 	}
1903
				/* Izquierda abajo */
1904
			 	if(t2){
1905
			 		if(mouse.y<(alto-10-(2/scale))&&mouse.x>=(2/scale)){
1906
							 if((mouse.y-y)>50){
1907
								yf=mouse.y-y;
1908
				 			}
1909
							if((xf-(mouse.x-x))>50){
1910
								xf=xf-(mouse.x-x);
1911
								x=mouse.x
1912
							}
1913
 
1914
			 		}else{
1915
			 			if(mouse.y>=(alto-10-(2/scale))) {
1916
							yf=alto-y;
1917
			 			}
1918
 
1919
			 			if(mouse.x<(2/scale)){
1920
							xf=xf-(mouse.x-x);
1921
			 				x=0;
1922
			 			}
1923
						 t2=false;
1924
			 		}
1925
			 	}
1926
				/* izquierda arriba */
1927
			 	if(t1){
1928
			 		if(mouse.y>(2/scale)&&mouse.x>=(2/scale)){
1929
 
1930
							if((yf-(mouse.y-y))>50){
1931
				 				yf=yf-(mouse.y-y);
1932
								y=mouse.y;
1933
				 			}
1934
							if((xf-(mouse.x-x))>50){
1935
								xf=xf-(mouse.x-x);
1936
								x=mouse.x
1937
							}
1938
 
1939
			 		}else{
1940
						if(mouse.y<=(2/scale)){
1941
							yf=yf-(mouse.y-y);
1942
							y=0;
1943
						}
1944
						 if(mouse.x<(2/scale)){
1945
							xf=xf-(mouse.x-x);
1946
			 				x=0;
1947
 
1948
			 			}
1949
						 t1=false;
1950
			 		}
1951
			 	}
1952
			}
1953
 
1954
		 	actualizar();
1955
		 	}else if(texto_listo){
1956
		 		if(tcli){
1957
		 			tx=mouse.x-(txf/2)
1958
		 			ty=mouse.y-(tyf/2)
1959
		 		}else if(rotar){
1960
 
1961
		 		}
1962
 
1963
		 		actualizar2();
1964
		 	}
1965
		 })
1966
		 $(elemento).mouseup(function(e){
1967
		 	if(!recorte_listo){
1968
			 	cli=false;
1969
			 	t1=false;
1970
			 	t2=false;
1971
			 	t3=false;
1972
			 	t4=false;
1973
		 	}else if (texto_listo) {
1974
		 		tcli=false;
1975
		 	}
1976
		 })
1977
 
1978
 
1979
	}
1980
	/* Titulo */
1981
 
1982
var titulo_noticia, censor_titulo = true, numero_titulo=0;
1983
	$(document).on("keyup change", "#name", function(e){
1984
	console.log(numero_titulo)
1985
	titulo_noticia = $(this).val();
1986
	titulo_elemento= $(".titulo_topico");
1987
	if(titulo_noticia!=""){
1988
		if(censor_titulo){
1989
			titulo_elemento.html(titulo_noticia);
1990
			if(titulo_elemento.height()>38){
1991
				var titulo_noticia2 = "";
1992
				for(var i =0; i <titulo_noticia.length;i++){
1993
					titulo_noticia2 = titulo_noticia2 + titulo_noticia.split("")[i];
1994
					titulo_elemento.html(titulo_noticia2);
1995
					if(titulo_elemento.height()>38){
1996
						titulo_noticia2 = titulo_noticia2.slice(0,-5) + "...";
1997
						titulo_elemento.html(titulo_noticia2);
1998
						numero_titulo = titulo_noticia2.length;
1999
						censor_titulo=false;
2000
						break;
2001
					}
2002
 
2003
				}
2004
			}else{
2005
				numero_titulo=0;
2006
			}
2007
		}else{
2008
			if(numero_titulo+1>=titulo_noticia.length){
2009
				titulo_elemento.html(titulo_noticia);
2010
				censor_titulo=true;
2011
			}
2012
		}
2013
	}else{
2014
		titulo_elemento.html("LABEL_TITLE");
2015
		censor_titulo = true;
2016
	}
2017
})
2018
 
1 www 2019
});
2020
JS;
2021
$this->inlineScript()->captureEnd();
2022
?>
2023
 
2024
 
2025
 
2026
<!-- Content Header (Page header) -->
2027
<section class="content-header">
2028
	<div class="container-fluid">
2029
    	<div class="row mb-2">
2030
        	<div class="col-sm-12">
2031
            	<h1>LABEL_CAPSULES</h1>
2032
			</div>
2033
		</div>
2034
	</div><!-- /.container-fluid -->
2035
</section>
2036
 
6704 nelberth 2037
<section class="content" id="content1">
1 www 2038
	<div class="container-fluid">
2039
    	<div class="row">
2040
        	<div class="col-12">
2041
				<div class="card">
2042
					<div class="card-header">
2043
						<?php
2044
                        $form = $this->form;
2045
            	        $form->setAttributes([
2046
                            'name'    => 'form-filter',
2047
                            'id'      => 'form-filter',
2048
                        ]);
2049
 
2050
                        $form->prepare();
2051
                        echo $this->form()->openTag($form);
2052
                        ?>
2053
                        <div class="form-group">
2054
                            <?php
2055
                            $element = $form->get('topic_uuid');
2056
 
2057
                            $element->setAttributes(['class' => 'form-control']);
2058
                            $element->setLabel('LABEL_TOPIC');
2059
                            echo $this->formLabel($element);
2060
                            echo $this->formSelect($element);
2061
                            ?>
2062
                        </div>
2063
						<?php echo $this->form()->closeTag($form); ?>
2064
					</div>
2065
					<div class="card-body">
20 steven 2066
        	    		<table id="gridTable" class="table   table-hover">
1 www 2067
                      		<thead>
2068
        						<tr>
2069
                                	<th>LABEL_NAME</th>
2070
                                  	<th>LABEL_DETAILS</th>
2071
                                  	<th>LABEL_IMAGES</th>
2072
                                  	<th>LABEL_ACTIONS</th>
2073
                                </tr>
2074
                       		</thead>
2075
                         	<tbody>
2076
                         	</tbody>
2077
                    	</table>
2078
                   	</div>
2079
                   	<div class="card-footer clearfix">
2080
                   		<div style="float:right;">
2081
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
2082
							<?php if($allowAdd) : ?>
2083
							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
2084
							<?php endif; ?>
2085
						</div>
2086
                 	</div>
2087
          		</div>
2088
           	</div>
2089
        </div>
2090
 	</div>
2091
</section>
2092
 
2093
 
2094
<!-- The Modal -->
6694 nelberth 2095
<div id="modalCapsuleAdd" style='display:none'>
1 www 2096
 
6694 nelberth 2097
 
1 www 2098
            <!-- Modal Header -->
2099
 
6701 nelberth 2100
              <div class="d-flex justify-content-center tituloEditor">
2101
              <h4>LABEL_ADD_CAPSULE</h4>
2102
 
2103
             </div>
1 www 2104
            <!-- Modal body -->
6701 nelberth 2105
      		<div class="grid-padre">
1 www 2106
       			 <?php
2107
       			 $form = $this->formAdd;
2108
            		$form->setAttributes([
2109
                        'method'  => 'post',
2110
            		    'action'  => '',
2111
                        'name'    => 'form-capsule-add',
2112
                        'id'      => 'form-capsule-add',
2113
                    ]);
2114
 
2115
                    $form->prepare();
2116
                    echo $this->form()->openTag($form);
2117
                    ?>
6701 nelberth 2118
    				<div class="form-group grid-1-2">
1 www 2119
    				<?php
2120
                        $element = $form->get('name');
2121
 
2122
                        $element->setAttributes(['class' => 'form-control']);
2123
                        $element->setOptions(['label' => 'LABEL_NAME']);
2124
                        echo $this->formLabel($element);
2125
                        echo $this->formText($element);
2126
                    ?>
2127
				</div>
6701 nelberth 2128
                <div class="form-group grid-1-2">
1 www 2129
                	<?php
2130
                    $element = $form->get('description');
2131
                    $element->setAttributes(['id' => 'description_add', 'class' => 'form-control', 'rows' => '2','class' => 'form-control']);
2132
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
2133
                    echo $this->formLabel($element);
2134
                    echo $this->formTextArea($element);
2135
                    ?>
2136
   				</div>
6701 nelberth 2137
				<div class="form-group grid-1-2">
1 www 2138
    				<?php
2139
                        $element = $form->get('order');
2140
                        $element->setAttributes(['class' => 'form-control']);
2141
                        $element->setOptions(['label' => 'LABEL_ORDER']);
2142
                        echo $this->formLabel($element);
2143
                        echo $this->formText($element);
2144
                    ?>
2145
				</div>
6701 nelberth 2146
				<div class="form-group grid-1-2">
1 www 2147
               		<?php
2148
                    $element = $form->get('file');
2149
 
2150
                    $element->setAttributes(['class' => 'form-control',  'accept' => 'image/jpg,image/jpeg,image/png']);
2151
                    $element->setOptions(['label' => 'LABEL_IMAGE']);
2152
                    echo $this->formLabel($element);
2153
                    ?>
2154
                    <div class="file-loading">
2155
                    	<?php echo $this->formFile($element); ?>
2156
                	</div>
2157
          		</div>
6701 nelberth 2158
          		<div class="form-group grid-1-2">
1 www 2159
    				<?php
2160
                        $element = $form->get('status');
2161
                        $element->setAttributes(['class' => 'form-control']);
2162
                        $element->setOptions(['label' => 'LABEL_STATUS']);
2163
                        echo $this->formLabel($element);
2164
                        echo $this->formSelect($element);
2165
                    ?>
2166
				</div>
6701 nelberth 2167
				<div class="form-group grid-1-2">
1 www 2168
    				<?php
2169
                        $element = $form->get('privacy');
2170
                        $element->setAttributes(['class' => 'form-control']);
2171
                        $element->setOptions(['label' => 'LABEL_PRIVACY']);
2172
                        echo $this->formLabel($element);
2173
                        echo $this->formSelect($element);
2174
                    ?>
2175
				</div>
6701 nelberth 2176
				<div class="form-group grid-1-2">
1 www 2177
    				<?php
2178
                        $element = $form->get('type');
2179
                        $element->setAttributes(['class' => 'form-control']);
2180
                        $element->setOptions(['label' => 'LABEL_TYPE']);
2181
                        echo $this->formLabel($element);
2182
                        echo $this->formSelect($element);
2183
                    ?>
2184
				</div>
6701 nelberth 2185
				<div class="form-group grid-1-2" id="form-row-cost">
1 www 2186
    				<?php
2187
                        $element = $form->get('cost');
2188
                        $element->setAttributes(['class' => 'form-control']);
2189
                        $element->setOptions(['label' => 'LABEL_COST']);
2190
                        echo $this->formLabel($element);
2191
                        echo $this->formText($element);
2192
                    ?>
2193
				</div>
6849 nelberth 2194
				<div class="form-group grid-1-2">
1 www 2195
 
2196
                 	<?php
2197
                    $element = $form->get('marketplace');
2198
                    $element->setAttributes([ 'class' => 'form-control', 'accept' => 'image/jpg,image/jpeg,image/png']);
2199
                    $element->setOptions(['label' => 'LABEL_IMAGE_MARKETPLACE']);
2200
                    echo $this->formLabel($element);
2201
                    ?>
2202
                    <div class="file-loading">
2203
                    	<?php echo $this->formFile($element); ?>
2204
                	</div>
2205
          		</div>
2206
 
6701 nelberth 2207
                  <div class="contenido form-group " id="contenido"></div>
6823 nelberth 2208
 
1 www 2209
     	      		<?php echo $this->form()->closeTag($form); ?>
2210
      		</div>
2211
 
2212
 
6694 nelberth 2213
 
1 www 2214
</div>
2215
 
2216
 
2217
<!-- The Modal -->
2218
<div class="modal" id="modalCapsuleEdit">
2219
	<div class="modal-dialog  modal-xl">
2220
    	<div class="modal-content">
2221
 
2222
            <!-- Modal Header -->
2223
      		<div class="modal-header">
2224
        		<h4 class="modal-title">LABEL_EDIT_CAPSULE</h4>
2225
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2226
      		</div>
2227
 
2228
            <!-- Modal body -->
2229
      		<div class="modal-body">
2230
       			 <?php
2231
       			  $form = $this->formEdit;
2232
            		$form->setAttributes([
2233
                        'method'    => 'post',
2234
                        'name'      => 'form-capsule-edit',
2235
                        'id'        => 'form-capsule-edit'
2236
                    ]);
2237
 
2238
                    $form->prepare();
2239
                    echo $this->form()->openTag($form);
2240
                ?>
2241
    			<div class="form-group">
2242
    				<?php
2243
                        $element = $form->get('name');
2244
                        $element->setAttributes(['class' => 'form-control']);
2245
                        $element->setOptions(['label' => 'LABEL_NAME']);
2246
                        echo $this->formLabel($element);
2247
                        echo $this->formText($element);
2248
                    ?>
2249
				</div>
2250
                <div class="form-group">
2251
                	<?php
2252
                    $element = $form->get('description');
2253
                    $element->setAttributes(['id' => 'description_edit', 'rows' => '2', 'class' => 'form-control',   'class' => 'form-control']);
2254
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
2255
                    echo $this->formLabel($element);
2256
                    echo $this->formTextArea($element);
2257
                    ?>
2258
   				</div>
2259
				<div class="form-group">
2260
    				<?php
2261
                        $element = $form->get('order');
2262
                        $element->setAttributes(['class' => 'form-control']);
2263
                        $element->setOptions(['label' => 'LABEL_ORDER']);
2264
                        echo $this->formLabel($element);
2265
                        echo $this->formText($element);
2266
                    ?>
2267
				</div>
2268
				<div class="form-group">
2269
 
2270
 
2271
                 		<?php
2272
                        $element = $form->get('file');
2273
                        $element->setOptions(['label' => 'LABEL_IMAGE']);
2274
                        echo $this->formLabel($element);
2275
                        ?>
2276
                        <div class="file-loading">
2277
                        <?php
2278
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'image/jpg,image/jpeg,image/png']);
2279
                        echo $this->formFile($element);
2280
                        ?>
2281
                	</div>
2282
          		</div>
2283
 
2284
          		<div class="form-group">
2285
    				<?php
2286
                        $element = $form->get('status');
2287
                        $element->setAttributes(['class' => 'form-control']);
2288
                        $element->setOptions(['label' => 'LABEL_STATUS']);
2289
                        echo $this->formLabel($element);
2290
                        echo $this->formSelect($element);
2291
                    ?>
2292
				</div>
2293
				<div class="form-group">
2294
    				<?php
2295
                        $element = $form->get('privacy');
2296
                        $element->setAttributes(['class' => 'form-control']);
2297
                        $element->setOptions(['label' => 'LABEL_PRIVACY']);
2298
                        echo $this->formLabel($element);
2299
                        echo $this->formSelect($element);
2300
                    ?>
2301
				</div>
2302
				<div class="form-group">
2303
    				<?php
2304
                        $element = $form->get('type');
2305
                        $element->setAttributes(['class' => 'form-control']);
2306
                        $element->setOptions(['label' => 'LABEL_TYPE']);
2307
                        echo $this->formLabel($element);
2308
                        echo $this->formSelect($element);
2309
                    ?>
2310
				</div>
2311
				<div class="form-group" id="form-row-cost">
2312
    				<?php
2313
                        $element = $form->get('cost');
2314
                        $element->setAttributes(['class' => 'form-control']);
2315
                        $element->setOptions(['label' => 'LABEL_COST']);
2316
                        echo $this->formLabel($element);
2317
                        echo $this->formText($element);
2318
                    ?>
2319
				</div>
2320
 
2321
 
2322
        				<div class="form-group">
2323
                    		<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2324
                    		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
2325
                   		</div>
2326
     	      		<?php echo $this->form()->closeTag($form); ?>
2327
      		</div>
2328
 
2329
            <!-- Modal footer -->
2330
      		<div class="modal-footer">
2331
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2332
      		</div>
2333
 
2334
    	</div>
2335
	</div>
2336
</div>
2337
 
2338
 
2339
 
2340
<!-- The Modal -->
2341
<div class="modal" id="modalAppMarkeplate">
2342
	<div class="modal-dialog">
2343
		<div class="modal-content">
2344
        	<!-- Modal Header -->
2345
        	<div class="modal-header">
2346
           		<h4 class="modal-title">LABEL_IMAGE_MARKETPLACE</h4>
2347
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2348
      		</div>
2349
 
2350
           	<!-- Modal body -->
2351
           	<div class="modal-body text-center">
2352
    			<img src="" class="img img-responsive" style="width: 300px; height: auto" id="image-marketplace" />
2353
          	</div>
2354
 
2355
            <!-- Modal footer -->
2356
  			<div class="modal-footer">
2357
    			<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2358
      		</div>
2359
      	</div>
2360
	</div>
2361
</div>
2362
 
2363
 
2364
<!-- The Modal -->
2365
<div class="modal" id="modalImageApp">
2366
	<div class="modal-dialog ">
2367
    	<div class="modal-content">
2368
 
2369
            <!-- Modal Header -->
2370
      		<div class="modal-header">
2371
        		<h4 class="modal-title">LABEL_IMAGE</h4>
2372
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2373
      		</div>
2374
 
2375
            <!-- Modal body -->
2376
            <div class="modal-body text-center">
2377
				<img src="" class="img img-responsive" style="width: 300px; height: auto" id="image-app" />
2378
      		</div>
2379
 
2380
            <!-- Modal footer -->
2381
      		<div class="modal-footer">
2382
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2383
          	</div>
2384
         </div>
2385
	</div>
2386
</div>
2387
 
2388
 
2389
 
2390
 
2391
 
2392
 
2393
<!-- The Modal -->
2394
<div class="modal" id="notificationUsersModal">
2395
	<div class="modal-dialog modal-xl">
2396
    	<div class="modal-content">
2397
 
2398
            <!-- Modal Header -->
2399
      		<div class="modal-header">
2400
        		<h4 class="modal-title">LABEL_USERS</h4>
2401
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2402
      		</div>
2403
 
2404
            <!-- Modal body -->
2405
      		<div class="modal-body">
2406
      			<form>
2407
      				<div class="form-group">
2408
      					<label>LABEL_TOPIC</label>
2409
      					<input type="text" readonly="readonly" id="table-users-topic" class="form-control" >
2410
      				</div>
2411
      				<div class="form-group">
2412
      					<label>LABEL_CAPSULE</label>
2413
      					<input type="text" readonly="readonly" id="table-users-capsule" class="form-control" >
2414
      				</div>
2415
      			</form>
2416
      			<div style="height: 300px;overflow: scroll;">
20 steven 2417
				<table id="gridTableUsers" style="width: 100%" class="table   table-hover">
1 www 2418
            		<thead>
2419
            			<tr>
2420
                      		<th>LABEL_FIRST_NAME</th>
2421
                     		<th>LABEL_LAST_NAME</th>
2422
                         	<th>LABEL_EMAIL</th>
2423
                       		<th>LABEL_DETAILS</th>
2424
             			</tr>
2425
                  	</thead>
2426
               		<tbody>
2427
               		</tbody>
2428
         		</table>
2429
         		</div>
2430
 
2431
      		</div>
2432
 
2433
            <!-- Modal footer -->
2434
      		<div class="modal-footer">
2435
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2436
      		</div>
2437
 
2438
    	</div>
2439
	</div>
2440
</div>
2441
 
2442
 
2443
 
2444
 
2445
 
2446
 
2447
 
2448