Proyectos de Subversion LeadersLinked - Backend

Rev

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