Proyectos de Subversion LeadersLinked - Backend

Rev

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

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