Proyectos de Subversion LeadersLinked - Backend

Rev

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