Proyectos de Subversion LeadersLinked - Backend

Rev

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