Proyectos de Subversion LeadersLinked - Backend

Rev

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