Proyectos de Subversion LeadersLinked - Backend

Rev

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