Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 6857 | Rev 6859 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

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