Proyectos de Subversion LeadersLinked - Backend

Rev

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