Proyectos de Subversion LeadersLinked - Backend

Rev

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