Proyectos de Subversion LeadersLinked - Backend

Rev

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