Proyectos de Subversion LeadersLinked - Backend

Rev

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

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