Proyectos de Subversion LeadersLinked - Backend

Rev

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

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