Proyectos de Subversion LeadersLinked - Backend

Rev

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