Proyectos de Subversion LeadersLinked - Backend

Rev

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