Proyectos de Subversion LeadersLinked - Backend

Rev

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