Proyectos de Subversion LeadersLinked - Backend

Rev

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