Proyectos de Subversion LeadersLinked - Backend

Rev

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

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