Proyectos de Subversion LeadersLinked - Backend

Rev

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