Proyectos de Subversion LeadersLinked - Backend

Rev

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

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