Proyectos de Subversion LeadersLinked - Backend

Rev

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

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