Proyectos de Subversion LeadersLinked - Backend

Rev

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