Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 6950 | Rev 6952 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

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