Proyectos de Subversion LeadersLinked - Backend

Rev

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