Proyectos de Subversion LeadersLinked - Backend

Rev

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