Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17125 | Rev 17190 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 17125 Rev 17178
Línea 2... Línea 2...
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
3
$currentUser    = $this->currentUserHelper();
Línea 4... Línea 4...
4
 
4
 
Línea 5... Línea -...
5
$roleName = $currentUser->getUserTypeId();
-
 
6
 
5
$roleName = $currentUser->getUserTypeId();
7
 
6
 
Línea 8... Línea 7...
8
$routeAdd       = $this->url('microlearning/content/topics/add');
7
$routeAdd       = $this->url('microlearning/content/topics/add');
9
$routeDatatable = $this->url('microlearning/content/topics');
8
$routeDatatable = $this->url('microlearning/content/topics');
10
 
9
 
Línea 11... Línea 10...
11
$allowAdd               = $acl->isAllowed($roleName, 'microlearning/content/topics/add') ? 1 : 0;
10
$allowAdd               = $acl->isAllowed($roleName, 'microlearning/content/topics/add') ? 1 : 0;
12
$allowEdit              = $acl->isAllowed($roleName, 'microlearning/content/topics/edit') ? 1 : 0;
11
$allowEdit              = $acl->isAllowed($roleName, 'microlearning/content/topics/edit') ? 1 : 0;
13
$allowDelete            = $acl->isAllowed($roleName, 'microlearning/content/topics/delete') ? 1 : 0;
12
$allowDelete            = $acl->isAllowed($roleName, 'microlearning/content/topics/delete') ? 1 : 0;
Línea -... Línea 13...
-
 
13
 
14
 
14
// NProgress
Línea 15... Línea 15...
15
 
15
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
16
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
16
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
17
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
17
 
18
 
-
 
19
$this->inlineScript()->appendFile($this->basePath('assets/vendors/ckeditor/ckeditor.js'));
18
// CKEditor
20
 
19
$this->inlineScript()->appendFile($this->basePath('assets/vendors/ckeditor/ckeditor.js'));
21
 
20
 
22
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/css/fileinput.min.css'));
21
// File Input
23
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.css'));
22
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/css/fileinput.min.css'));
24
 
23
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.css'));
Línea 25... Línea -...
25
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/piexif.js'));
-
 
26
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/sortable.js'));
-
 
27
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/fileinput.js'));
-
 
28
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/locales/es.js'));
-
 
29
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/fas/theme.js'));
24
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/piexif.js'));
30
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.js'));
25
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/sortable.js'));
31
 
26
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/fileinput.js'));
32
 
-
 
33
 
27
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/locales/es.js'));
34
 
28
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/fas/theme.js'));
35
 
29
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.js'));
36
 
30
 
Línea -... Línea 31...
-
 
31
// Datatables
37
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
32
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
38
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
33
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
39
 
34
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
Línea 40... Línea 35...
40
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
35
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
Línea 41... Línea 36...
41
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
36
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
Línea -... Línea 37...
-
 
37
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
42
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
38
 
43
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
39
// Select2
Línea 44... Línea -...
44
 
-
 
45
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/select2.js'));
-
 
46
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/i18n/es.js'));
-
 
47
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2/css/select2.css'));
-
 
-
 
40
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/select2.js'));
48
 
41
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/i18n/es.js'));
Línea 49... Línea -...
49
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2-bootstrap5-theme/select2-bootstrap-5-theme.css'));
-
 
50
 
-
 
51
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jsrender/jsrender.min.js'));
-
 
52
 
-
 
53
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
-
 
54
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
-
 
55
 
42
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2/css/select2.css'));
56
 
43
 
57
 
44
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2-bootstrap5-theme/select2-bootstrap-5-theme.css'));
58
 
-
 
59
 
45
 
60
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-input-number/input-number-format.jquery.js'));
46
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jsrender/jsrender.min.js'));
61
 
47
 
62
 
48
// Toggle
63
$status_active = \LeadersLinked\Model\Degree::STATUS_ACTIVE;
49
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
64
 
50
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
65
 
51
 
66
 
52
// Input Number Format
67
 
53
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-input-number/input-number-format.jquery.js'));
68
$this->inlineScript()->captureStart();
54
 
69
echo <<<JS
55
$this->inlineScript()->captureStart();
70
    jQuery( document ).ready(function( $ ) {
56
echo <<<JS
71
 
57
    jQuery(document).ready(function ($) {
72
        $.validator.setDefaults({
58
        $.validator.setDefaults({
73
            debug: true,
59
            debug: true,
74
            highlight: function(element) {
60
            highlight: function (element) {
75
                $(element).addClass('is-invalid');
61
                $(element).addClass('is-invalid')
76
            },
62
            },
77
            unhighlight: function(element) {
63
            unhighlight: function (element) {
78
                $(element).removeClass('is-invalid');
64
                $(element).removeClass('is-invalid')
79
            },
-
 
80
            errorElement: 'span',
-
 
81
            errorClass: 'error invalid-feedback',
-
 
82
            errorPlacement: function(error, element) {
-
 
Línea -... Línea 65...
-
 
65
            },
-
 
66
            errorElement: 'span',
-
 
67
            errorClass: 'error invalid-feedback',
-
 
68
            errorPlacement: function (error, element) {
-
 
69
                if (element.parent('.btn-file').length) {
-
 
70
                    error.insertAfter(element.parent().parent())
-
 
71
                } else if (element.parent('.toggle').length) {
-
 
72
                    error.insertAfter(element.parent().parent())
-
 
73
                } else {
-
 
74
                    error.insertAfter(element.parent())
-
 
75
                }
-
 
76
            }
-
 
77
        })
-
 
78
 
-
 
79
        var allowAdd = $allowAdd
-
 
80
        var allowEdit = $allowEdit
-
 
81
        var allowDelete = $allowDelete
-
 
82
 
-
 
83
        // Datatables
-
 
84
        var gridTable = $('#gridTable').dataTable({
-
 
85
            processing: true,
-
 
86
            serverSide: true,
-
 
87
            searching: true,
-
 
88
            order: [[0, 'asc']],
Línea 83... Línea -...
83
                if(element.parent('.btn-file').length) {
-
 
84
                    error.insertAfter(element.parent().parent());
-
 
85
                } else if(element.parent('.toggle').length) {
-
 
86
                    error.insertAfter(element.parent().parent());
-
 
87
                } else {
-
 
88
                    error.insertAfter(element.parent());
-
 
89
                }
-
 
90
            }
-
 
91
        });
-
 
92
    
-
 
93
 
-
 
94
 
-
 
95
 
-
 
96
 
-
 
97
 
-
 
98
        var allowEdit   = $allowEdit;
-
 
99
        var allowDelete = $allowDelete;
-
 
100
        
-
 
101
        var gridTable = $('#gridTable').dataTable( {
-
 
102
            'processing': true,
-
 
103
            'serverSide': true,
-
 
104
            'searching': true,
-
 
105
            'order': [[ 0, 'asc' ]],
-
 
106
            'ordering':  true,
89
            ordering: true,
107
            'ordenable' : true,
90
            ordenable: true,
108
            'responsive': true,
91
            responsive: true,
109
            'select' : false,
92
            select: false,
110
        	'paging': true,
-
 
111
            'pagingType': 'simple_numbers',
93
            paging: true,
112
    		'ajax': {
94
            pagingType: 'simple_numbers',
113
    			'url' : '$routeDatatable',
95
            ajax: {
114
    			'type' : 'get',
96
                url: '$routeDatatable',
115
                'beforeSend': function (request) {
97
                type: 'get',
116
                  NProgress.start();
98
                beforeSend: function (request) {
117
                },
99
                    NProgress.start()
118
                'dataFilter': function(response) {
100
                },
119
                    var response = jQuery.parseJSON( response );
101
                dataFilter: function (response) {
120
                    
102
                    var response = jQuery.parseJSON(response)
121
                    var json                = {};
103
 
122
                    json.recordsTotal       = 0;
104
                    var json = {}
123
                    json.recordsFiltered    = 0;
105
                    json.recordsTotal = 0
124
                    json.data               = [];
106
                    json.recordsFiltered = 0
125
                    
107
                    json.data = []
126
                    
108
 
127
                    if(response.success) {
109
                    if (response.success) {
128
                        json.recordsTotal       = response.data.total;
110
                        json.recordsTotal = response.data.total
129
                        json.recordsFiltered    = response.data.total;
111
                        json.recordsFiltered = response.data.total
130
                        json.data               = response.data.items;
112
                        json.data = response.data.items
131
                    } else {
113
                    } else {
132
                        $.fn.showError(response.data)
114
                        $.fn.showError(response.data)
133
                    }
115
                    }
134
                    
116
 
135
                    return JSON.stringify( json );
117
                    return JSON.stringify(json)
136
                }
118
                }
137
    		},
119
            },
138
            'language' : {
120
            language: {
139
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
121
                sProcessing: 'LABEL_DATATABLE_SPROCESSING',
140
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
122
                sLengthMenu: 'LABEL_DATATABLE_SLENGTHMENU',
141
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
-
 
142
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
-
 
143
                'sInfo':           'LABEL_DATATABLE_SINFO',
-
 
144
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
-
 
145
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
123
                sZeroRecords: 'LABEL_DATATABLE_SZERORECORDS',
-
 
124
                sEmptyTable: 'LABEL_DATATABLE_SEMPTYTABLE',
-
 
125
                sInfo: 'LABEL_DATATABLE_SINFO',
-
 
126
                sInfoEmpty: 'LABEL_DATATABLE_SINFOEMPTY',
-
 
127
                sInfoFiltered: 'LABEL_DATATABLE_SINFOFILTERED',
146
                'sInfoPostFix':    '',
128
                sInfoPostFix: '',
147
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
129
                sSearch: 'LABEL_DATATABLE_SSEARCH',
148
                'sUrl':            '',
130
                sUrl: '',
149
                'sInfoThousands':  ',',
-
 
150
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
131
                sInfoThousands: ',',
151
                'oPaginate': {
132
                sLoadingRecords: 'LABEL_DATATABLE_SLOADINGRECORDS',
152
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
133
                oPaginate: {
153
                    'sLast':     'LABEL_DATATABLE_SLAST',
134
                    sFirst: 'LABEL_DATATABLE_SFIRST',
154
                    'sNext':     'LABEL_DATATABLE_SNEXT',
135
                    sLast: 'LABEL_DATATABLE_SLAST',
155
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
136
                    sNext: 'LABEL_DATATABLE_SNEXT',
156
                },
137
                    sPrevious: 'LABEL_DATATABLE_SPREVIOUS'
157
                'oAria': {
138
                },
158
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
139
                oAria: {
159
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
140
                    sSortAscending: ': LABEL_DATATABLE_SSORTASCENDING',
160
                },
141
                    sSortDescending: ':LABEL_DATATABLE_SSORTDESCENDING'
161
            },
142
                }
162
            'drawCallback': function( settings ) {
143
            },
163
                NProgress.done();
144
            drawCallback: function (settings) {
164
                
145
                NProgress.done()
165
            },
146
            },
166
            'aoColumns': [
147
            aoColumns: [
-
 
148
                { mDataProp: 'name' },
167
                { 'mDataProp': 'name' },
149
                { mDataProp: 'details' },
-
 
150
                { mDataProp: 'image' },
168
                { 'mDataProp': 'status' },
151
                { mDataProp: 'actions' }
-
 
152
            ],
-
 
153
            columnDefs: [
-
 
154
                {
-
 
155
                    targets: 0,
169
                { 'mDataProp': 'image' },
156
                    className: 'text-vertical-middle'
170
                { 'mDataProp': 'actions' },
157
                },
-
 
158
                {
-
 
159
                    targets: -3,
-
 
160
                    orderable: false,
-
 
161
                    render: function (data, type, row) {
171
    	    ],
162
                        var s = ''
-
 
163
                        s += 'LABEL_STATUS: ' + data['status'] + '<br/>'
-
 
164
 
-
 
165
                        if (allowUsers && row['actions']['link_total_users']) {
-
 
166
                            s +=
-
 
167
                                'LABEL_TOTAL_USERS: ' +
-
 
168
                                data['total_users'] +
-
 
169
                                ' <button class="btn btn-view-total-users" data-href="' +
172
            'columnDefs': [
170
                                row['actions']['link_total_users'] +
173
                {
-
 
Línea 174... Línea 171...
174
                    'targets': 0,
171
                                '" data-toggle="tooltip" title="LABEL_VIEW"><i class="fa fa-external-link-alt"></i></button> <br>'
175
                    'className' : 'text-vertical-middle',
172
                        } else {
176
                },
173
                            s += 'LABEL_TOTAL_USERS: ' + data['total_users'] + '<br/>'
-
 
174
                        }
-
 
175
                        if (allowUsers && row['actions']['link_total_users_actives']) {
-
 
176
                            s +=
-
 
177
                                'LABEL_TOTAL_USERS_ACTIVE: ' +
-
 
178
                                data['total_users_active'] +
-
 
179
                                ' <button class="btn btn-view-total-users" data-href="' +
-
 
180
                                row['actions']['link_total_users_actives'] +
-
 
181
                                '" data-toggle="tooltip" title="LABEL_VIEW"><i class="fa fa-external-link-alt"></i></button> <br>'
-
 
182
                        } else {
-
 
183
                            s +=
-
 
184
                                'LABEL_TOTAL_USERS_ACTIVE: ' + data['total_users_active'] + '<br/>'
-
 
185
                        }
-
 
186
 
-
 
187
                        return s
-
 
188
                    }
-
 
189
                },
-
 
190
                {
Línea -... Línea 191...
-
 
191
                    targets: -2,
-
 
192
                    orderable: false,
-
 
193
                    render: function (data, type, row) {
-
 
194
                        s = ''
-
 
195
 
-
 
196
                        if (data['marketplace']) {
-
 
197
                            s =
-
 
198
                                s +
-
 
199
                                '&nbsp; <img class="btn-view-image-marketplace" data-href="' +
-
 
200
                                data['marketplace'] +
-
 
201
                                '" data-toggle="tooltip" src="' +
Línea -... Línea 202...
-
 
202
                                data['marketplace'] +
-
 
203
                                '" title="LABEL_VIEW" style="width: 40px; object-fit: cover; height: 40px;" /> '
-
 
204
                        } else {
177
                {
205
                            s = s + ''
178
                    'targets': -2,
206
                        }
179
                    'orderable': false,
207
 
180
                    'render' : function ( data, type, row ) {
208
                        if (data['image']) {
181
                        s = '&nbsp;';
209
                            s =
182
 
210
                                s +
183
                        if( data )  {
211
                                '&nbsp; <img class="btn-view-image-app" data-href="' +
-
 
212
                                data['image'] +
-
 
213
                                '" data-toggle="tooltip" src="' +
-
 
214
                                data['image'] +
-
 
215
                                '" title="LABEL_VIEW" style="width: 40px; object-fit: cover; height: 40px;" /> '
184
                            s = s + '&nbsp;<img class="btn-view-image-app" data-href="' + data + '" data-toggle="tooltip" src="'+data+'" title="LABEL_VIEW" style="width: 40px; object-fit: cover; height: 40px;" /> '
216
                        } else {
185
                        }  else {
217
                            s = s + ''
186
                            s = s + '&nbsp;LABEL_IMAGE: <br>';    
218
                        }
-
 
219
 
-
 
220
                        return s
-
 
221
                    }
-
 
222
                },
187
                        } 
223
                {
188
 
224
                    targets: -1,
189
 
225
                    orderable: false,
190
                        return s;
226
                    render: function (data, type, row) {
191
                    }
227
                        s = ''
192
                },
228
 
193
 
229
                        if (allowEdit && data['link_edit']) {
Línea 194... Línea -...
194
 
-
 
-
 
230
                            s =
195
                {
231
                                s +
196
                    'targets': -1,
232
                                '<button class="btn btn-info btn-sm btn-edit" data-href="' +
197
                    'orderable': false,
233
                                data['link_edit'] +
198
                    'render' : function ( data, type, row ) {
234
                                '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pen"></i> LABEL_EDIT </button>&nbsp;'
199
                        s = '';
235
                        }
200
                        
236
                        if (allowDelete && data['link_delete']) {
201
                        if(allowEdit && data['link_edit']  ) {
237
                            s =
202
                            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-pen"></i> LABEL_EDIT </button>&nbsp;';
238
                                s +
203
                        }
239
                                '<button class="btn btn-danger btn-sm btn-delete" data-href="' +
204
                        if(allowDelete && data['link_delete']  ) {
-
 
205
                            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;';
-
 
206
                        }
-
 
207
                        return s;
-
 
208
                    }
240
                                data['link_delete'] +
-
 
241
                                '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>&nbsp;'
-
 
242
                        }
-
 
243
                        return s
-
 
244
                    }
209
                }
245
                }
210
              ],
246
            ]
211
        });
247
        })
212
 
248
 
213
 
249
        // Validación de formulario de creación
214
    var validatorAdd = $('#form-add').validate({
250
        var validatorAdd = $('#form-add').validate({
215
        debug: true,
251
            debug: true,
216
        onclick: false,
252
            onclick: false,
217
        onkeyup: false,
253
            onkeyup: false,
218
        ignore: [],
254
            ignore: [],
219
        rules: {
255
            rules: {
220
            'name': {
256
                name: {
-
 
257
                    required: true,
-
 
258
                    maxlength: 128
-
 
259
                },
-
 
260
                description: {
-
 
261
                    updateCkeditor: function () {
221
                required: true,
262
                        CKEDITOR.instances.description_add.updateElement()
222
                maxlength: 128,
263
                    },
-
 
264
                    required: true
-
 
265
                },
-
 
266
                file: {
-
 
267
                    required: true,
-
 
268
                    extension: 'jpg|jpeg|png',
-
 
269
                    accept: 'image/jpg,image/jpeg,image/png'
223
            },
270
                },
-
 
271
                order: {
-
 
272
                    required: true,
-
 
273
                    digits: true,
-
 
274
                    min: 1,
-
 
275
                    max: 250
-
 
276
                },
-
 
277
                marketplace: {
-
 
278
                    required: false,
224
            'description': {
279
                    extension: 'jpg|jpeg|png',
225
                updateCkeditor:function() {
-
 
226
                        CKEDITOR.instances.description_add.updateElement();
280
                    accept: 'image/jpg,image/jpeg,image/png'
227
                },
-
 
228
                required: true
281
                },
229
            },
282
                status: {
230
           'file': {
283
                    required: true
231
                required: true,
-
 
232
                extension: 'jpg|jpeg|png',
-
 
233
                accept: 'image/jpg,image/jpeg,image/png'
-
 
234
            },
-
 
235
            'order' : {
-
 
236
                required: true,
-
 
237
                digits: true,
-
 
238
                min: 1,
-
 
239
                max: 250
-
 
240
            },
-
 
241
            'status' : {
-
 
242
                required: true,
-
 
243
            },
-
 
244
        },
-
 
245
        submitHandler: function(form)
-
 
246
        {
-
 
247
            var formdata = false;
-
 
248
            if (window.FormData){
-
 
249
                formdata = new FormData(form); //form[0]);
-
 
250
            }
-
 
251
		
-
 
252
            console.log(formdata);
-
 
253
 
-
 
254
			$('.info_noticia').prop('disabled', true);
-
 
255
			NProgress.start();
-
 
256
            $.ajax({
-
 
257
                'dataType'  : 'json',
-
 
258
                'accept'    : 'application/json',
-
 
259
                'method'    : 'post',
-
 
260
                'url'       :  $('#form-add').attr('action'),
-
 
261
                'data'      :  formdata,
-
 
262
                'processData': false,
-
 
263
                'contentType': false,
-
 
264
            }).done(function(response) {
-
 
265
				console.log(response)
284
                },
266
				if(response['success']) {
-
 
267
                    $.fn.showSuccess(response['data']);
-
 
268
 
-
 
269
                    $('#row-add').hide();
-
 
270
                    $('#row-edit').hide();
-
 
Línea -... Línea 285...
-
 
285
                privacy: {
271
                    $('#row-listing').show();
286
                    required: true
272
 
287
                },
-
 
288
                type: {
-
 
289
                    required: true
-
 
290
                },
-
 
291
                cost: {
-
 
292
                    required: function () {
273
 
293
                        return $('#form-add #type').val() == 's'
-
 
294
                    },
274
                    gridTable.api().ajax.reload(null, false);
295
                    number: true,
275
                } else {
296
                    min: 0
-
 
297
                }
-
 
298
            },
-
 
299
            submitHandler: function (form) {
276
                    validatorAdd.resetForm();
300
                var formdata = false
277
                    if(jQuery.type(response['data']) == 'string') {
301
                if (window.FormData) {
278
                        $.fn.showError(response['data']);
302
                    formdata = new FormData(form)
-
 
303
                }
Línea 279... Línea 304...
279
                    } else  {
304
 
280
                        $.each(response['data'], function( fieldname, errors ) {
305
                $('.info_noticia').prop('disabled', true)
-
 
306
                NProgress.start()
-
 
307
                $.ajax({
-
 
308
                    dataType: 'json',
281
                            $.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
309
                    accept: 'application/json',
-
 
310
                    method: 'post',
-
 
311
                    url: $('#form-add').attr('action'),
-
 
312
                    data: formdata,
282
                        });
313
                    processData: false,
283
                    }
314
                    contentType: false
284
                }
315
                })
-
 
316
                    .done(function (response) {
-
 
317
                        console.log(response)
285
            }).fail(function( jqXHR, textStatus, errorThrown) {
318
                        if (response['success']) {
-
 
319
                            $.fn.showSuccess(response['data'])
-
 
320
 
286
				
321
                            $('#row-add').hide()
287
 
322
                            $('#row-edit').hide()
288
                $.fn.showError(textStatus);
323
                            $('#row-listing').show()
-
 
324
 
-
 
325
                            gridTable.api().ajax.reload(null, false)
-
 
326
                        } else {
-
 
327
                            validatorAdd.resetForm()
-
 
328
                            if (jQuery.type(response['data']) == 'string') {
-
 
329
                                $.fn.showError(response['data'])
-
 
330
                            } else {
-
 
331
                                $.each(response['data'], function (fieldname, errors) {
-
 
332
                                    $.fn.showFormErrorValidator('#form-add #' + fieldname, errors)
289
            }).always(function() {
333
                                })
-
 
334
                            }
290
 
335
                        }
291
                NProgress.done();
336
                    })
292
            });
337
                    .fail(function (jqXHR, textStatus, errorThrown) {
-
 
338
                        $.fn.showError(textStatus)
-
 
339
                    })
-
 
340
                    .always(function () {
-
 
341
                        NProgress.done()
293
            return false;
342
                    })
294
        },
343
                return false
295
        invalidHandler: function(form, validator) {
344
            },
296
            
345
            invalidHandler: function (form, validator) { }
297
        }
346
        })
298
    });
347
 
299
 
348
        // Validación de formulario de edición
300
    var validatorEdit  = $('#form-edit').validate({
349
        var validatorEdit = $('#form-edit').validate({
301
        debug: true,
350
            debug: true,
302
        onclick: false,
351
            onclick: false,
303
        onkeyup: false,
352
            onkeyup: false,
304
        ignore: [],
353
            ignore: [],
-
 
354
            rules: {
-
 
355
                name: {
-
 
356
                    required: true,
-
 
357
                    maxlength: 128
-
 
358
                },
-
 
359
                description: {
-
 
360
                    updateCkeditor: function () {
-
 
361
                        CKEDITOR.instances.description_edit.updateElement()
-
 
362
                    },
-
 
363
                    required: true
-
 
364
                },
-
 
365
                file: {
-
 
366
                    required: false,
-
 
367
                    extension: 'jpg|jpeg|png',
-
 
368
                    accept: 'image/jpg,image/jpeg,image/png'
-
 
369
                },
-
 
370
                order: {
-
 
371
                    required: true,
-
 
372
                    digits: true,
-
 
373
                    min: 1,
-
 
374
                    max: 250
-
 
375
                },
305
        rules: {
376
                marketplace: {
-
 
377
                    required: false,
-
 
378
                    extension: 'jpg|jpeg|png',
-
 
379
                    accept: 'image/jpg,image/jpeg,image/png'
-
 
380
                },
-
 
381
                status: {
-
 
382
                    required: true
-
 
383
                },
-
 
384
                privacy: {
-
 
385
                    required: true
-
 
386
                },
-
 
387
                type: {
-
 
388
                    required: true
-
 
389
                },
-
 
390
                cost: {
-
 
391
                    required: function () {
-
 
392
                        return $('#form-edit #type').val() == 's'
-
 
393
                    },
-
 
394
                    number: true,
-
 
395
                    min: 0
-
 
396
                }
-
 
397
            },
-
 
398
            submitHandler: function (form) {
-
 
399
                var formdata = false
-
 
400
                if (window.FormData) {
-
 
401
                    formdata = new FormData(form)
-
 
402
                }
-
 
403
 
-
 
404
                NProgress.start()
-
 
405
                $.ajax({
-
 
406
                    dataType: 'json',
-
 
407
                    accept: 'application/json',
-
 
408
                    method: 'post',
-
 
409
                    url: $('#form-edit').attr('action'),
-
 
410
                    data: formdata,
306
            'name': {
411
                    processData: false,
-
 
412
                    contentType: false
-
 
413
                })
-
 
414
                    .done(function (response) {
-
 
415
                        if (response['success']) {
-
 
416
                            $.fn.showSuccess(response['data'])
-
 
417
 
-
 
418
                            gridTable.api().ajax.reload(null, false)
307
                required: true,
419
 
308
                maxlength: 128,
420
                            $('#row-add').hide()
-
 
421
                            $('#row-edit').hide()
-
 
422
                            $('#row-listing').show()
Línea -... Línea 423...
-
 
423
                        } else {
-
 
424
                            validatorEdit.resetForm()
-
 
425
                            if (jQuery.type(response['data']) == 'string') {
-
 
426
                                $.fn.showError(response['data'])
-
 
427
                            } else {
-
 
428
                                $.each(response['data'], function (fieldname, errors) {
-
 
429
                                    $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors)
309
            },
430
                                })
-
 
431
                            }
-
 
432
                        }
-
 
433
                    })
310
            'description': {
434
                    .fail(function (jqXHR, textStatus, errorThrown) {
-
 
435
                        $.fn.showError(textStatus)
-
 
436
                    })
-
 
437
                    .always(function () {
-
 
438
                        NProgress.done()
311
                updateCkeditor:function() {
439
                    })
-
 
440
                return false
312
                        CKEDITOR.instances.description_edit.updateElement();
441
            },
313
                },
442
            invalidHandler: function (form, validator) { }
314
                required: true
443
        })
315
            },
444
 
Línea -... Línea 445...
-
 
445
        // Evento de botón de vista de imagen de la aplicación
-
 
446
        $('body').on('click', '.btn-view-image-app', function (e) {
-
 
447
            e.preventDefault()
-
 
448
 
-
 
449
            $('#image-app').attr('src', $(this).data('href'))
-
 
450
            $('#modalPreviewImage').modal('show')
-
 
451
            return false
-
 
452
        })
-
 
453
 
-
 
454
        // Evento de botón de vista de imagen del marketplace
-
 
455
        $('body').on('click', '.btn-view-image-marketplace', function (e) {
-
 
456
            e.preventDefault()
-
 
457
 
-
 
458
            $('#image-marketplace').attr('src', $(this).data('href'))
-
 
459
            $('#modalPreviewMarketPlace').modal('show')
-
 
460
            return false
-
 
461
        })
-
 
462
 
-
 
463
        // Evento de botón de añadir
-
 
464
        $('body').on('click', 'button.btn-add', function (e) {
-
 
465
            e.preventDefault()
-
 
466
            NProgress.start()
-
 
467
 
-
 
468
            $.ajax({
-
 
469
                dataType: 'json',
-
 
470
                method: 'get',
-
 
471
                url: '$routeAdd'
-
 
472
            })
-
 
473
                .done(function (response) {
-
 
474
                    if (response['success']) {
-
 
475
                        $('#table-capsules tbody').empty()
-
 
476
 
-
 
477
                        $('#capsule_uuid').children().not(':first').remove()
-
 
478
                        $.each(response['data']['capsules'], function (index, element) {
-
 
479
                            $('#capsule_uuid').append(
-
 
480
                                $('<option>', {
-
 
481
                                    value: element.id,
-
 
482
                                    text: element.name
-
 
483
                                })
-
 
484
                            )
-
 
485
                        })
-
 
486
 
-
 
487
                        $('#form-add #name').val('')
-
 
488
                        $('#form-add #privacy').val('')
-
 
489
                        $('#form-add #status').val('')
-
 
490
                        $('#form-add #cost').val('')
-
 
491
                        $('#form-add #form-row-cost').hide()
-
 
492
                        $('#form-add #file').fileinput('reset')
-
 
493
                        $('#form-add #file').val('')
-
 
494
                        $('#form-add #marketplace').fileinput('reset')
-
 
495
                        $('#form-add #marketplace').val('')
-
 
496
                        $('#form-add #order').val('1')
-
 
497
 
-
 
498
                        CKEDITOR.instances.description_add.setData('')
Línea 316... Línea 499...
316
           'file': {
499
                        validatorAdd.resetForm()
317
                required: false,
500
 
318
                extension: 'jpg|jpeg|png',
501
                        $('#row-edit').hide()
319
                accept: 'image/jpg,image/jpeg,image/png'
502
                        $('#row-listing').hide()
320
            },
503
                        $('#row-add').show()
-
 
504
                    } else {
-
 
505
                        $.fn.showError(response['data'])
-
 
506
                    }
-
 
507
                })
321
            'order' : {
508
                .fail(function (jqXHR, textStatus, errorThrown) {
-
 
509
                    $.fn.showError(textStatus)
-
 
510
                })
-
 
511
                .always(function () {
-
 
512
                    NProgress.done()
322
                required: true,
513
                })
323
                digits: true,
514
 
324
                min: 1,
515
            return false
325
                max: 250
516
        })
326
            },
517
 
327
            'status' : {
518
        // Evento de botón de editar
328
                required: true,
519
        $('body').on('click', 'button.btn-edit', function (e) {
-
 
520
            e.preventDefault()
-
 
521
            var url = $(this).data('href')
-
 
522
 
-
 
523
            NProgress.start()
-
 
524
            $.ajax({
329
            },
525
                dataType: 'json',
330
 
526
                accept: 'application/json',
-
 
527
                method: 'get',
-
 
528
                url: url
-
 
529
            })
-
 
530
                .done(function (response) {
331
        },
531
                    if (response['success']) {
-
 
532
                        $('#form-edit').attr('action', url)
-
 
533
 
-
 
534
                        $('#form-edit #capsule_uuid').children().not(':first').remove()
-
 
535
 
-
 
536
                        $.each(response['data']['capsules'], function (index, element) {
-
 
537
                            $('#form-edit #capsule_uuid').append(
332
        submitHandler: function(form)
538
                                $('<option>', {
-
 
539
                                    value: element.id,
-
 
540
                                    text: element.name
-
 
541
                                })
333
        {
542
                            )
334
            var formdata = false;
543
 
335
            if (window.FormData){
544
                            if (element.checked) {
-
 
545
                                let data = {
Línea 336... Línea -...
336
                formdata = new FormData(form); //form[0]);
-
 
337
            }
546
                                    id: element.id,
338
 
-
 
339
 
547
                                    name: element.name
340
			NProgress.start();
-
 
341
            $.ajax({
-
 
342
                'dataType'  : 'json',
-
 
343
                'accept'    : 'application/json',
-
 
344
                'method'    : 'post',
-
 
345
                'url'       :  $('#form-edit').attr('action'),
-
 
346
                'data'      :  formdata,
-
 
347
                'processData': false,
-
 
348
                'contentType': false,
-
 
349
            }).done(function(response) {
-
 
350
                if(response['success']) {
-
 
351
                    $.fn.showSuccess(response['data']);
-
 
352
                       
-
 
353
             
-
 
354
                    gridTable.api().ajax.reload(null, false);
-
 
355
 
-
 
356
 
-
 
357
                    $('#row-add').hide();
-
 
358
                    $('#row-edit').hide();
-
 
Línea 359... Línea 548...
359
                    $('#row-listing').show();
548
                                }
360
 
-
 
361
                } else {
549
 
362
                    validatorEdit.resetForm();
-
 
363
                    if(jQuery.type(response['data']) == 'string') {
550
                                $('#table-capsules tbody').append(
364
                        $.fn.showError(response['data']);
-
 
365
                    } else  {
-
 
366
                        $.each(response['data'], function( fieldname, errors ) {
-
 
367
                            $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
-
 
368
                        });
551
                                    $('#trCapsuleTemplate').render(data)
369
                    }
552
                                )
370
                }
553
                            }
371
            }).fail(function( jqXHR, textStatus, errorThrown) {
554
                        })
372
                $.fn.showError(textStatus);
555
 
373
            }).always(function() {
556
                        $('#form-edit').attr('action', url)
374
				
-
 
375
 
557
                        $('#form-edit #name').val(response['data']['name'])
376
                NProgress.done();
-
 
377
            });
558
                        $('#form-edit #privacy').val(response['data']['privacy'])
378
            return false;
559
                        $('#form-edit #type').val(response['data']['type'])
379
        },
560
                        $('#form-edit #order').val(response['data']['order'])
380
        invalidHandler: function(form, validator) {
561
                        $('#form-edit #status').val(response['data']['status'])
381
            
562
 
382
        }
-
 
383
    });
563
                        if ('s' == response['data']['type']) {
384
 
564
                            $('#form-edit #form-row-cost').show()
-
 
565
                            $('#form-edit #cost').val(response['data']['cost'])
-
 
566
                        } else {
385
    $('body').on('click', 'button.btn-delete', function(e) { 
567
                            $('#form-edit #form-row-cost').hide()
-
 
568
                            $('#form-edit #cost').val('')
-
 
569
                        }
386
        e.preventDefault();
570
 
387
        var action = $(this).data('href');
571
                        $('#form-edit #file').fileinput('reset')
-
 
572
                        $('#form-edit #file').val(response['data']['image'])
388
 
573
 
389
 
574
                        $('#form-edit #marketplace').fileinput('reset')
390
          swal.fire({
575
                        $('#form-edit #marketplace').val(response['data']['marketplace'])
-
 
576
 
-
 
577
                        CKEDITOR.instances.description_edit.setData(
-
 
578
                            response['data']['description']
-
 
579
                        )
-
 
580
                        validatorEdit.resetForm()
-
 
581
 
-
 
582
                        $('#row-add').hide()
-
 
583
                        $('#row-listing').hide()
-
 
584
                        $('#row-edit').show()
-
 
585
                    } else {
-
 
586
                        validatorEdit.resetForm()
-
 
587
                        if (jQuery.type(response['data']) == 'string') {
-
 
588
                            $.fn.showError(response['data'])
-
 
589
                        } else {
391
            title: 'LABEL_ARE_YOU_SURE',
590
                            $.each(response['data'], function (fieldname, errors) {
-
 
591
                                $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors)
-
 
592
                            })
-
 
593
                        }
-
 
594
                    }
-
 
595
                })
-
 
596
                .fail(function (jqXHR, textStatus, errorThrown) {
-
 
597
                    $.fn.showError(textStatus)
-
 
598
                })
-
 
599
                .always(function () {
-
 
600
                    NProgress.done()
-
 
601
                })
-
 
602
        })
-
 
603
 
-
 
604
        // Evento de botón de eliminar
-
 
605
        $('body').on('click', 'button.btn-delete', function (e) {
-
 
606
            e.preventDefault()
-
 
607
            var action = $(this).data('href')
-
 
608
 
-
 
609
            swal
-
 
610
                .fire({
-
 
611
                    title: 'LABEL_ARE_YOU_SURE',
-
 
612
                    icon: 'question',
-
 
613
                    cancelButtonText: 'LABEL_NO',
-
 
614
                    showCancelButton: true,
392
            icon: 'question',
615
                    confirmButtonText: 'LABEL_YES'
393
            cancelButtonText: 'LABEL_NO',
616
                })
Línea 394... Línea -...
394
            showCancelButton: true,
-
 
-
 
617
                .then((result) => {
395
            confirmButtonText: 'LABEL_YES'
618
                    if (result.isConfirmed) {
396
          }).then((result) => {
619
                        NProgress.start()
397
            if (result.isConfirmed) {
-
 
398
 
620
                        $.ajax({
399
                    NProgress.start();
621
                            dataType: 'json',
400
                    $.ajax({
622
                            accept: 'application/json',
401
                        'dataType'  : 'json',
623
                            method: 'post',
402
                        'accept'    : 'application/json',
624
                            url: action
-
 
625
                        })
403
                        'method'    : 'post',
626
                            .done(function (response) {
404
                        'url'       :  action,
-
 
-
 
627
                                if (response['success']) {
-
 
628
                                    $.fn.showSuccess(response['data'])
405
                    }).done(function(response) {
629
                                    gridTable.api().ajax.reload(null, false)
406
                        if(response['success']) {
630
                                } else {
-
 
631
                                    $.fn.showError(response['data'])
407
                            $.fn.showSuccess(response['data']);
632
                                }
408
                            gridTable.api().ajax.reload(null, false);
633
                            })
409
                        } else {
-
 
Línea -... Línea 634...
-
 
634
                            .fail(function (jqXHR, textStatus, errorThrown) {
-
 
635
                                $.fn.showError(textStatus)
410
                            $.fn.showError(response['data']);
636
                            })
411
                        }
637
                            .always(function () {
-
 
638
                                NProgress.done()
412
                    }).fail(function( jqXHR, textStatus, errorThrown) {
639
                            })
413
                        $.fn.showError(textStatus);
640
                    }
-
 
641
                })
414
                    }).always(function() {
642
        })
415
                        NProgress.done();
643
 
-
 
644
        // Evento de botón de cancelar
Línea 416... Línea 645...
416
                    });
645
        $('body').on('click', 'button.btn-cancel', function (e) {
417
                }
-
 
418
           });
-
 
419
        });
-
 
420
 
-
 
421
    
-
 
422
        $('body').on('click', '.btn-view-image-app', function(e) {
-
 
423
            e.preventDefault();
-
 
424
    
-
 
425
            $('#image-app').attr('src', $(this).data('href'));
-
 
426
            $('#modalPreviewImage').modal('show');
-
 
427
            return false;
-
 
428
        });		
-
 
429
 
-
 
430
        $('#form-add #order').inputNumberFormat({decimal: 0});
-
 
431
 
-
 
432
 
-
 
433
 
-
 
434
        $('body').on('click', 'button.btn-add', function(e) {
-
 
435
            e.preventDefault();
-
 
436
            NProgress.start();
-
 
437
 
-
 
438
            $.ajax({
-
 
439
                'dataType': 'json',
-
 
440
                'method': 'get',
-
 
441
                'url': '$routeAdd',
-
 
442
            }).done(function(response) {
-
 
443
                if (response['success']) {
-
 
444
 
-
 
445
                    $('#table-capsules tbody').empty();
-
 
446
                    
-
 
447
                    $('#capsule_uuid').children().not(':first').remove();
-
 
448
                    $.each(response['data']['capsules'], function(index, element) {
-
 
449
                        $('#capsule_uuid').append($('<option>', {
-
 
450
                            value: element.id,
-
 
Línea -... Línea 646...
-
 
646
            e.preventDefault()
-
 
647
            $('#row-add').hide()
-
 
648
            $('#row-edit').hide()
-
 
649
            $('#row-listing').show()
-
 
650
        })
-
 
651
 
-
 
652
        // Evento de botón de refrescar
-
 
653
        $('body').on('click', 'button.btn-refresh', function (e) {
-
 
654
            e.preventDefault()
-
 
655
            gridTable.api().ajax.reload(null, false)
-
 
656
        })
-
 
657
 
-
 
658
        // Evento de botón de vista de usuarios
-
 
659
        $('body').on('click', 'button.btn-view-total-users', function (e) {
-
 
660
            e.preventDefault()
-
 
661
 
-
 
662
            var href = $(this).data('href')
Línea -... Línea 663...
-
 
663
            NProgress.start()
-
 
664
            $.ajax({
Línea 451... Línea -...
451
                            text: element.name
-
 
452
                        }));
-
 
453
                    });
-
 
454
    
-
 
455
                    $('#form-add #name').val('');
-
 
456
                    $('#form-add #order').val('1');
-
 
457
                    $('#form-add #name').val('');
-
 
458
            
-
 
459
                    $('#form-add #status').val('');
-
 
460
                    $('#form-add #file').fileinput('reset');
-
 
461
                    $('#form-add #file').val('');
-
 
462
                    
-
 
463
 
-
 
464
            
-
 
465
                    CKEDITOR.instances.description_add.setData('');
-
 
466
                    validatorAdd.resetForm();
-
 
467
                
-
 
468
                    $('#row-edit').hide();
-
 
469
                    $('#row-listing').hide();
-
 
470
                    $('#row-add').show();
-
 
471
                } else {
-
 
472
                    $.fn.showError(response['data']);
-
 
473
                }
-
 
474
            }).fail(function(jqXHR, textStatus, errorThrown) {
-
 
475
                $.fn.showError(textStatus);
-
 
476
            }).always(function() {
-
 
477
                NProgress.done();
-
 
478
            });
-
 
479
 
-
 
480
 
-
 
481
 
-
 
482
 
-
 
483
            return false;
-
 
484
        });
-
 
485
 
-
 
486
 
-
 
487
    
-
 
488
        $('#form-edit #order').inputNumberFormat({decimal: 0});
-
 
489
    
-
 
490
          $('#form-add #file').fileinput({
-
 
491
                theme: 'fa',
-
 
492
                language: 'es',
-
 
493
                showUpload: false,
-
 
494
                dropZoneEnabled: false,
-
 
495
                maxFileCount: 1,
-
 
496
                msgPlaceholder:  'LABEL_RECOMMENDED_SIZE $image_size',
-
 
497
                allowedFileExtensions: ['jpeg', 'jpg', 'png'],
-
 
498
            });
-
 
499
    
-
 
500
            $('#form-edit #file').fileinput({
-
 
501
                theme: 'fa',
-
 
502
                language: 'es',
-
 
503
                showUpload: false,
-
 
504
                dropZoneEnabled: false,
-
 
505
                maxFileCount: 1,
-
 
506
                msgPlaceholder:  'LABEL_RECOMMENDED_SIZE $image_size',
-
 
507
                allowedFileExtensions: ['jpeg', 'jpg', 'png'],
-
 
508
            });
-
 
509
		
-
 
510
        $('body').on('click', 'button.btn-edit', function(e) {
665
            dataType: 'json',
511
            e.preventDefault();
-
 
512
    
-
 
513
            var url = $(this).data('href');
-
 
514
			NProgress.start();
666
            accept: 'application/json',
Línea 515... Línea -...
515
            $.ajax({
-
 
516
                'dataType'  : 'json',
-
 
517
                'accept'    : 'application/json',
667
            method: 'get',
518
                'method'    : 'get',
-
 
519
                'url'       :  url,
-
 
520
            }).done(function(response) {
-
 
521
                if(response['success']) {
-
 
522
					console.log(response['data'])
-
 
523
                    $('#form-edit')[0].reset();
-
 
524
    
-
 
525
                    $('#form-edit').attr('action',url);
-
 
526
                    $('#form-edit #name').val(response['data']['name']);
668
            url: href
527
                    $('#form-edit #order').val(response['data']['order']);
-
 
528
                    $('#form-edit #capsule_uuid').children().not(':first').remove();
-
 
529
 
669
            })
530
                    $.each(response['data']['capsules'], function(index, element) {
-
 
531
                        $('#form-edit #capsule_uuid').append($('<option>', {
-
 
532
                            value: element.id,
-
 
533
                            text: element.name
-
 
534
                        }));
-
 
535
 
670
            .done(function (response) {
-
 
671
                if (response['success']) {
536
                        if(element.checked ) {
672
                $('#table-users-capsule').val(response['data']['capsule'])
537
                            let data = {
673
 
-
 
674
                $('#gridTableUsers tbody').empty()
538
                                id : element.id, 
675
 
539
                                name : element.name,
676
                $.each(response['data']['items'], function (index, item) {
540
                            };
677
                    var s = '<tr>'
-
 
678
                    s = s + '<td>' + item['first_name'] + '</td>'
541
                                
679
                    s = s + '<td>' + item['last_name'] + '</td>'
542
                            $('#table-capsules tbody').append(
680
                    s = s + '<td>' + item['email'] + '</td>'
543
                                $('#trCapsuleTemplate').render(data)
681
 
544
                            );
682
                    s = s + '<td>'
545
                        }
683
                    if (item['details']['access']) {
-
 
684
                    s = s + 'LABEL_ACCESS : ' + item['details']['access'] + '<br>'
546
                    });
685
                    }
547
 
686
                    if (item['details']['paid_from']) {
548
					$('#form-edit #status').val(response['data']['status']);
-
 
549
                    $('#form-edit #file').fileinput('reset');
687
                    s =
550
                    $('#form-edit #file').val('');
-
 
551
 
-
 
552
                    CKEDITOR.instances.description_edit.setData(response['data']['description']);
688
                        s + 'LABEL_PAID_FROM : ' + item['details']['paid_from'] + '<br>'
553
                    validatorEdit.resetForm();
689
                    }
554
 
690
                    if (item['details']['paid_to']) {
555
                    $('#row-add').hide();
-
 
556
                    $('#row-listing').hide();
-
 
557
                    $('#row-edit').show();
691
                    s = s + 'LABEL_PAID_TO : ' + item['details']['paid_to'] + '<br>'
Línea -... Línea 692...
-
 
692
                    }
-
 
693
 
-
 
694
                    s = s + '</td>'
-
 
695
                    s = s + '</tr>'
-
 
696
 
-
 
697
                    $('#gridTableUsers tbody').append(s)
-
 
698
                })
558
	
699
 
-
 
700
                $('#notificationUsersModal').modal('show')
-
 
701
                } else {
-
 
702
                $.fn.showError(response['data'])
Línea 559... Línea 703...
559
                } else {
703
                }
-
 
704
            })
Línea 560... Línea 705...
560
                    validatorEdit.resetForm();
705
            .fail(function (jqXHR, textStatus, errorThrown) {
561
                    if(jQuery.type(response['data']) == 'string') {
706
                $.fn.showError(textStatus)
562
                        $.fn.showError(response['data']);
-
 
Línea -... Línea 707...
-
 
707
            })
-
 
708
            .always(function () {
-
 
709
                NProgress.done()
-
 
710
            })
-
 
711
            return false
-
 
712
        })
-
 
713
 
-
 
714
        // Evento de cambio de tipo de formulario de creación
-
 
715
        $('#form-add #type').change(function (e) {
-
 
716
            e.preventDefault()
-
 
717
 
-
 
718
            if ('s' == $(this).val()) {
-
 
719
            $('#form-add #form-row-cost').show()
-
 
720
            } else {
-
 
721
            $('#form-add #cost').val(0)
-
 
722
            $('#form-add #form-row-cost').hide()
-
 
723
            }
-
 
724
        })
-
 
725
 
-
 
726
        // Evento de cambio de tipo de formulario de edición
-
 
727
        $('#form-edit #type').change(function (e) {
-
 
728
            e.preventDefault()
-
 
729
 
-
 
730
            if ('s' == $(this).val()) {
-
 
731
            $('#form-edit #form-row-cost').show()
-
 
732
            } else {
-
 
733
            $('#form-edit #cost').val(0)
-
 
734
            $('#form-edit #form-row-cost').hide()
-
 
735
            }
-
 
736
        })
-
 
737
 
-
 
738
        // Formato de número de formulario de creación
-
 
739
        $('#form-add #cost').inputNumberFormat({ decimal: 2 })
-
 
740
 
-
 
741
        // Formato de número de formulario de edición
-
 
742
        $('#form-edit #cost').inputNumberFormat({ decimal: 2 })
-
 
743
 
-
 
744
        // Formato de número de formulario de creación
-
 
745
        $('#form-add #order').inputNumberFormat({ decimal: 0 })
-
 
746
 
-
 
747
        // Formato de número de formulario de edición
-
 
748
        $('#form-edit #order').inputNumberFormat({ decimal: 0 })
-
 
749
 
-
 
750
        // Configuración del formulario de creación
-
 
751
        $('#form-add #file').fileinput({
-
 
752
            theme: 'fa',
-
 
753
            language: 'es',
-
 
754
            showUpload: false,
-
 
755
            dropZoneEnabled: false,
-
 
756
            maxFileCount: 1,
-
 
757
            msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
-
 
758
            allowedFileExtensions: ['jpeg', 'jpg', 'png']
-
 
759
        })
-
 
760
 
-
 
761
        // Configuración del formulario de edición
-
 
762
        $('#form-edit #file').fileinput({
-
 
763
            theme: 'fa',
-
 
764
            language: 'es',
-
 
765
            showUpload: false,
-
 
766
            dropZoneEnabled: false,
-
 
767
            maxFileCount: 1,
-
 
768
            msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
563
                    } else  {
769
            allowedFileExtensions: ['jpeg', 'jpg', 'png']
-
 
770
        })
-
 
771
 
Línea 564... Línea 772...
564
                        $.each(response['data'], function( fieldname, errors ) {
772
        // Configuración del formulario de creación
Línea 565... Línea -...
565
                            $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
-
 
566
                        });
-
 
567
                    }
-
 
568
                }
773
        $('#form-add #marketplace').fileinput({
569
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
Línea 570... Línea 774...
570
                $.fn.showError(textStatus);
774
            theme: 'fa',
571
            }).always(function() {
775
            language: 'es',
Línea -... Línea 776...
-
 
776
            showUpload: false,
572
                NProgress.done();
777
            dropZoneEnabled: false,
573
            });
778
            maxFileCount: 1,
574
        });
779
            msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $marketplace_size',
575
 
780
            allowedFileExtensions: ['jpeg', 'jpg', 'png']
576
        $('body').on('click', 'button.btn-cancel', function(e) {
781
        })
-
 
782
 
577
            e.preventDefault();
783
        // Configuración del formulario de edición
578
            $('#row-add').hide();
784
        $('#form-edit #marketplace').fileinput({
579
            $('#row-edit').hide();
785
            theme: 'fa',
580
            $('#row-listing').show();
786
            language: 'es',
-
 
787
            showUpload: false,
-
 
788
            dropZoneEnabled: false,
-
 
789
            maxFileCount: 1,
-
 
790
            msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $marketplace_size',
581
            
791
            allowedFileExtensions: ['jpeg', 'jpg', 'png']
-
 
792
        })
-
 
793
 
-
 
794
        // Evento de botón de seleccionar capsule
-
 
795
        $('#btn-select-capsule').click(function (e) {
-
 
796
            e.preventDefault()
-
 
797
 
-
 
798
            var id = $('#capsule_uuid option:selected').val()
-
 
799
 
582
        });
800
            if (!id) return false
-
 
801
 
583
    
802
            var name = $('#capsule_uuid option:selected').text()
-
 
803
            var key = '#tr_capsule_id_' + id
-
 
804
            var element = $(key)
584
        $('body').on('click', 'button.btn-refresh', function(e) {
805
 
-
 
806
            if (element.length > 0) return false
585
            e.preventDefault();
807
 
586
            gridTable.api().ajax.reload(null, false);
808
            if (name.length > 50) name = name.substr(0, 50) + '...'
587
        });
809
 
588
 
810
            let data = { id, name }
589
        $('#btn-select-capsule').click(function(e) {
811
 
590
            e.preventDefault();
812
            $('#table-capsules tbody').append($('#trCapsuleTemplate').render(data))
Línea -... Línea 813...
-
 
813
 
591
 
814
            return false
592
            var id  = $('#capsule_uuid option:selected').val(); 
815
        })
593
 
816
 
594
            if(!id)  return false;
817
        // Configuración del formulario de creación
-
 
818
        $('#capsule_uuid').select2({
-
 
819
            theme: 'bootstrap-5',
-
 
820
            width: '100%'
-
 
821
        })
595
 
822
 
-
 
823
        // Configuración del editor de CKEditor para el formulario de creación
-
 
824
        CKEDITOR.replace('description_add', {
-
 
825
            toolbar: [
-
 
826
                { name: 'editing', items: ['Scayt'] },
-
 
827
                { name: 'links', items: ['Link', 'Unlink'] },
-
 
828
                {
-
 
829
                    name: 'paragraph',
-
 
830
                    items: [
596
            var name = $('#capsule_uuid option:selected').text();
831
                        'NumberedList',
-
 
832
                        'BulletedList',
597
            var key         = '#tr_capsule_id_' + id ;
833
                        '-',
-
 
834
                        'Outdent',
-
 
835
                        'Indent',
598
            var element     = $(key)
836
                        'Blockquote'
-
 
837
                    ]
599
 
838
                },
600
            if(element.length > 0)  return false;
839
                {
601
 
840
                    name: 'basicstyles',
602
            if(name.length > 50)  name = name.substr(0, 50) + '...';
841
                    items: ['Bold', 'Italic', 'Strike', 'RemoveFormat']
603
 
842
                },
604
            let data = { id, name };  
843
                '/',
605
                
844
                {
606
            $('#table-capsules tbody').append(
845
                    name: 'insert',
607
                $('#trCapsuleTemplate').render(data)
846
                    items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar']
608
            );
847
                },
Línea 609... Línea 848...
609
 
848
                { name: 'styles', items: ['Styles', 'Format'] },
610
            return false;
849
                { name: 'tools', items: ['Maximize'] }
611
        });
850
            ],
612
 
851
            removePlugins: 'elementspath,Anchor',
613
        $('#capsule_uuid').select2({
852
            heigth: 100
-
 
853
        })
614
            theme: 'bootstrap-5',
854
 
615
            width: '100%',
855
        // Configuración del editor de CKEditor para el formulario de edición
616
        });
856
        CKEDITOR.replace('description_edit', {
617
        
-
 
618
        CKEDITOR.replace('description_add', {
857
            toolbar: [
619
			toolbar: [
858
                { name: 'editing', items: ['Scayt'] },
620
                    { name: 'editing', items: ['Scayt'] },
859
                { name: 'links', items: ['Link', 'Unlink'] },
621
                    { name: 'links', items: ['Link', 'Unlink'] },
860
                {
622
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
861
                    name: 'paragraph',
623
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
862
                    items: [
624
                    '/',
863
                        'NumberedList',
625
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
864
                        'BulletedList',
626
                    { name: 'styles', items: ['Styles', 'Format'] },
865
                        '-',
627
                    { name: 'tools', items: ['Maximize'] }
866
                        'Outdent',
628
                ],
867
                        'Indent',
629
                removePlugins: 'elementspath,Anchor',
868
                        'Blockquote'
630
                heigth: 100
-
 
631
		});
869
                    ]
632
 
870
                },
633
        CKEDITOR.replace('description_edit', {
871
                {
-
 
872
                    name: 'basicstyles',
634
			toolbar: [
873
                    items: ['Bold', 'Italic', 'Strike', 'RemoveFormat']
635
                    { name: 'editing', items: ['Scayt'] },
874
                },
636
                    { name: 'links', items: ['Link', 'Unlink'] },
875
                '/',
637
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
876
                {
638
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
877
                    name: 'insert',
Línea 684... Línea 923...
684
	
923
	
685
	<div class="card" id="row-add" style="display:none">
924
	<div class="card" id="row-add" style="display:none">
686
	 	<div class="card-header">
925
	 	<div class="card-header">
687
	 		<h6 class="card-title">LABEL_ADD_TOPIC</h6>
926
	 		<h6 class="card-title">LABEL_ADD_TOPIC</h6>
-
 
927
	 	</div>
688
	 	</div>
928
 
689
	 	<?php
929
	 	<?php
690
		$form = $this->formAdd;
930
		$form = $this->formAdd;
691
		$form->setAttributes([
931
		$form->setAttributes([
692
			'method'  => 'post',
932
			'method'  => 'post',
Línea 696... Línea 936...
696
		]);
936
		]);
Línea 697... Línea 937...
697
 
937
 
698
		$form->prepare();
938
		$form->prepare();
699
		echo $this->form()->openTag($form);
939
		echo $this->form()->openTag($form);
700
		?>
-
 
701
	 	<div class="card-body">
-
 
702
			<div class="row">
-
 
703
    	 		<div class="col-12 mt-3">
-
 
704
    			<?php
-
 
705
    			$element = $form->get('name');
-
 
706
    
-
 
707
    			$element->setAttributes(['class' => 'form-control']);
-
 
708
    			$element->setOptions(['label' => 'LABEL_NAME']);
-
 
709
    			echo $this->formLabel($element);
-
 
710
    			echo $this->formText($element);
-
 
711
    			?>
-
 
712
    			</div>
-
 
713
    		</div>
-
 
714
    
940
		?>
715
            <div class="row">
-
 
716
    	 	         	<div class="col-12 mt-3">
-
 
717
    			<?php
-
 
718
    			$element = $form->get('description');
-
 
719
    			$element->setAttributes(['id' => 'description_add', 'class' => 'form-control', 'rows' => '2', 'class' => 'form-control']);
-
 
720
    			$element->setOptions(['label' => 'LABEL_DESCRIPTION']);
-
 
721
    			echo $this->formLabel($element);
-
 
722
    			echo $this->formTextArea($element);
-
 
723
    			?>
-
 
724
    			</div>
-
 
725
    		</div>
-
 
726
    
-
 
727
            <div class="row">
-
 
728
    	 	    <div class="col-12 mt-3">
-
 
729
    			<?php
-
 
730
    			$element = $form->get('order');
-
 
731
    			$element->setAttributes(['class' => 'form-control']);
-
 
732
    			$element->setOptions(['label' => 'LABEL_ORDER']);
-
 
733
    			echo $this->formLabel($element);
-
 
734
    			echo $this->formText($element);
-
 
735
    			?>
-
 
736
    			</div>
-
 
737
    		</div>
-
 
738
    
941
            <div class="card-body">
739
            <div class="row">
942
                <div class="row">
740
    	 	         	<div class="col-12 mt-3">
-
 
741
    			<?php
-
 
742
    			$element = $form->get('status');
-
 
743
    			$element->setAttributes(['class' => 'form-control']);
-
 
744
    			$element->setOptions(['label' => 'LABEL_STATUS']);
-
 
745
    			echo $this->formLabel($element);
-
 
746
    			echo $this->formSelect($element);
-
 
747
    			
-
 
748
    			?>
-
 
749
    			</div>
-
 
750
    		</div>
-
 
751
    
-
 
752
            <div class="row">
-
 
753
    	 		<div class="col-12 mt-3">
943
                    <div class="col-12 mt-3">
754
                            <?php
944
                        <?php
755
                            $element = $form->get('file');
-
 
756
                            $element->setOptions(['label' => 'LABEL_IMAGE']);
-
 
757
                            $element->setAttributes(['class' => 'form-control']);
-
 
758
                            $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
-
 
759
                            echo $this->formLabel($element);
-
 
760
                            echo $this->formFile($element);
-
 
761
                            ?>
-
 
762
                	</div>
-
 
763
         	</div> 
-
 
764
 
-
 
765
            <div class="row">
-
 
766
	 	        <div class="col-8 mt-3">
-
 
767
					<select name="capsule_uuid" id="capsule_uuid">
-
 
768
                   		<option value="">LABEL_SELECT</option>
-
 
769
                  	</select>
-
 
770
                </div>
-
 
771
         		<div class="col-4 mt-3">
-
 
772
                 	<button type="button" class="btn btn-primary" id="btn-select-capsule" data-toggle="tooltip" title="LABEL_ADD LABEL_CAPSULE">LABEL_ADD LABEL_CAPSULE</button>
-
 
773
       			</div>
-
 
Línea 774... Línea -...
774
     		</div>
-
 
775
            
-
 
776
            <div class="row">
945
                        $element = $form->get('name');
777
                <div class="col-12 mt-3">
-
 
778
                    <table id="table-capsules" class="table table-bordered">
-
 
779
                        <thead>
946
            
780
                            <tr>
947
                        $element->setAttributes(['class' => 'form-control']);
781
                                <th>LABEL_NAME</th>
-
 
782
                                <th>LABEL_ACTIONS</th>
948
                        $element->setOptions(['label' => 'LABEL_NAME']);
783
                            </tr>
949
                        echo $this->formLabel($element);
784
                        </thead>
-
 
785
                        <tbody>
950
                        echo $this->formText($element);
786
                        </tbody>
951
                        ?>
787
                    </table>
-
 
Línea -... Línea 952...
-
 
952
                    </div>
-
 
953
                </div>
-
 
954
 
-
 
955
                <div class="row">
-
 
956
                    <div class="col-12 mt-3">
-
 
957
                        <?php
-
 
958
                        $element = $form->get('description');
-
 
959
                        $element->setAttributes(['id' => 'description_add', 'class' => 'form-control', 'rows' => '2', 'class' => 'form-control']);
-
 
960
                        $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
-
 
961
                        echo $this->formLabel($element);
-
 
962
                        echo $this->formTextArea($element);
-
 
963
                        ?>
-
 
964
                    </div>
-
 
965
                </div>
-
 
966
        
-
 
967
                <div class="row">
-
 
968
                    <div class="col-12 mt-3">
-
 
969
                        <?php
-
 
970
                        $element = $form->get('order');
-
 
971
                        $element->setAttributes(['class' => 'form-control']);
-
 
972
                        $element->setOptions(['label' => 'LABEL_ORDER']);
-
 
973
                        echo $this->formLabel($element);
-
 
974
                        echo $this->formText($element);
-
 
975
                        ?>
-
 
976
                    </div>
-
 
977
                </div>
-
 
978
        
-
 
979
                <div class="row">
-
 
980
                    <div class="col-12 mt-3">
-
 
981
                        <?php
-
 
982
                        $element = $form->get('status');
-
 
983
                        $element->setAttributes(['class' => 'form-control']);
-
 
984
                        $element->setOptions(['label' => 'LABEL_STATUS']);
-
 
985
                        echo $this->formLabel($element);
-
 
986
                        echo $this->formSelect($element);
-
 
987
                        ?>
-
 
988
                    </div>
-
 
989
                </div>
-
 
990
 
-
 
991
                <div class="row">
-
 
992
                    <div class="col-12 mt-3">
-
 
993
                        <?php
-
 
994
                        $element = $form->get('privacy');
-
 
995
                        $element->setAttributes(['class' => 'form-control']);
-
 
996
                        $element->setOptions(['label' => 'LABEL_PRIVACY']);
-
 
997
                        echo $this->formLabel($element);
-
 
998
                        echo $this->formSelect($element);
-
 
999
                        ?>
-
 
1000
                    </div>
-
 
1001
                </div>	
-
 
1002
 
-
 
1003
                <div class="row">
-
 
1004
                    <div class="col-12 mt-3">
-
 
1005
                        <?php
-
 
1006
                        $element = $form->get('type');
-
 
1007
                        $element->setAttributes(['class' => 'form-control']);
-
 
1008
                        $element->setOptions(['label' => 'LABEL_TYPE']);
-
 
1009
                        echo $this->formLabel($element);
-
 
1010
                        echo $this->formSelect($element);
-
 
1011
                        ?>
-
 
1012
                    </div>
-
 
1013
                </div>
-
 
1014
 
-
 
1015
                <div class="row"  id="form-row-cost">
-
 
1016
                    <div class="col-12 mt-3">
-
 
1017
                        <?php
-
 
1018
                        $element = $form->get('cost');
-
 
1019
                        $element->setAttributes(['class' => 'form-control']);
-
 
1020
                        $element->setOptions(['label' => 'LABEL_COST']);
-
 
1021
                        echo $this->formLabel($element);
-
 
1022
                        echo $this->formText($element);
-
 
1023
                        ?>
-
 
1024
                    </div>
-
 
1025
                </div>
-
 
1026
        
-
 
1027
                <div class="row">
-
 
1028
                    <div class="col-12 mt-3">
-
 
1029
                        <?php
-
 
1030
                        $element = $form->get('file');
-
 
1031
                        $element->setOptions(['label' => 'LABEL_IMAGE']);
-
 
1032
                        $element->setAttributes(['class' => 'form-control']);
-
 
1033
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
-
 
1034
                        echo $this->formLabel($element);
-
 
1035
                        echo $this->formFile($element);
-
 
1036
                        ?>
-
 
1037
                    </div>
-
 
1038
                </div> 
-
 
1039
 
-
 
1040
                <div class="row">
-
 
1041
                    <div class="col-8 mt-3">
-
 
1042
                        <select name="capsule_uuid" id="capsule_uuid">
-
 
1043
                            <option value="">LABEL_SELECT</option>
-
 
1044
                        </select>
-
 
1045
                    </div>
-
 
1046
                    <div class="col-4 mt-3">
-
 
1047
                        <button type="button" class="btn btn-primary" id="btn-select-capsule" data-toggle="tooltip" title="LABEL_ADD LABEL_CAPSULE">LABEL_ADD LABEL_CAPSULE</button>
-
 
1048
                    </div>
-
 
1049
                </div>
-
 
1050
                
-
 
1051
                <div class="row">
-
 
1052
                    <div class="col-12 mt-3">
-
 
1053
                        <table id="table-capsules" class="table table-bordered">
-
 
1054
                            <thead>
-
 
1055
                                <tr>
-
 
1056
                                    <th>LABEL_NAME</th>
-
 
1057
                                    <th>LABEL_ACTIONS</th>
-
 
1058
                                </tr>
-
 
1059
                            </thead>
-
 
1060
                            <tbody>
-
 
1061
                            </tbody>
788
                </div>
1062
                        </table>
-
 
1063
                    </div>
789
            </div>
1064
                </div>
790
 
1065
            </div>
791
	 	</div>
1066
            
792
	 	<div class="card-footer text-right">
1067
            <div class="card-footer text-right">
793
	 	     <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
1068
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
794
      		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
1069
                <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
Línea 795... Línea 1070...
795
	 	</div>
1070
            </div>
796
	 	<?php echo $this->form()->closeTag($form); ?>
-
 
797
	</div>
1071
	 	<?php echo $this->form()->closeTag($form); ?>
798
	
1072
	</div>
799
	
1073
	
-
 
1074
	
800
	<div class="card" id="row-edit" style="display:none">
1075
	<div class="card" id="row-edit" style="display:none">
801
	 
1076
	 	<div class="card-header">
802
	 	<div class="card-header">
1077
	 		<h6 class="card-title">LABEL_EDIT_TOPIC</h6>
803
	 		<h6 class="card-title">LABEL_EDIT_TOPIC</h6>
1078
	 	</div>
804
	 	</div>
1079
 
Línea 812... Línea 1087...
812
 
1087
 
813
		$form->prepare();
1088
		$form->prepare();
814
		echo $this->form()->openTag($form);
1089
		echo $this->form()->openTag($form);
Línea 815... Línea 1090...
815
		?>
1090
		?>
-
 
1091
		
-
 
1092
            <div class="card-body">
-
 
1093
                <div class="row">
-
 
1094
                    <div class="col-12 mt-3">
-
 
1095
                        <?php
-
 
1096
                        $element = $form->get('name');
-
 
1097
                        $element->setAttributes(['class' => 'form-control']);
-
 
1098
                        $element->setOptions(['label' => 'LABEL_NAME']);
-
 
1099
                        echo $this->formLabel($element);
-
 
1100
                        echo $this->formText($element);
-
 
1101
                        ?>
Línea 816... Línea 1102...
816
		
1102
                    </div>
817
	 	<div class="card-body">
1103
                </div>
818
 
1104
 
819
  <div class="row">
1105
                <div class="row">
820
	 	         	<div class="col-12 mt-3">
1106
                    <div class="col-12 mt-3">
821
			<?php
1107
                        <?php
822
			$element = $form->get('description');
1108
                        $element = $form->get('description');
823
			$element->setAttributes(['id' => 'description_edit', 'rows' => '2', 'class' => 'form-control',   'class' => 'form-control']);
1109
                        $element->setAttributes(['id' => 'description_edit', 'rows' => '2', 'class' => 'form-control',   'class' => 'form-control']);
824
			$element->setOptions(['label' => 'LABEL_DESCRIPTION']);
1110
                        $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
825
			echo $this->formLabel($element);
1111
                        echo $this->formLabel($element);
826
			echo $this->formTextArea($element);
1112
                        echo $this->formTextArea($element);
Línea 827... Línea 1113...
827
			?>
1113
                        ?>
828
			</div>
1114
                    </div>
829
		</div>
1115
                </div>
830
 
1116
 
831
         <div class="row">
1117
                <div class="row">
832
	 	         	<div class="col-12 mt-3">
1118
                    <div class="col-12 mt-3">
833
			<?php
1119
                        <?php
834
			$element = $form->get('order');
1120
                        $element = $form->get('order');
835
			$element->setAttributes(['class' => 'form-control']);
1121
                        $element->setAttributes(['class' => 'form-control']);
836
			$element->setOptions(['label' => 'LABEL_ORDER']);
1122
                        $element->setOptions(['label' => 'LABEL_ORDER']);
837
			echo $this->formLabel($element);
1123
                        echo $this->formLabel($element);
Línea -... Línea 1124...
-
 
1124
                        echo $this->formText($element);
-
 
1125
                        ?>
-
 
1126
                    </div>
-
 
1127
                </div>
-
 
1128
 
-
 
1129
                <div class="row">
-
 
1130
                    <div class="col-12 mt-3">
-
 
1131
                        <?php
-
 
1132
                        $element = $form->get('status');
-
 
1133
                        $element->setAttributes(['class' => 'form-control']);
-
 
1134
                        $element->setOptions(['label' => 'LABEL_STATUS']);
Línea -... Línea 1135...
-
 
1135
                        echo $this->formLabel($element);
-
 
1136
                        echo $this->formSelect($element);
-
 
1137
                        ?>
-
 
1138
                    </div>
-
 
1139
                </div>
-
 
1140
 
-
 
1141
                <div class="row">
-
 
1142
                    <div class="col-12 mt-3">
-
 
1143
                        <?php
-
 
1144
                        $element = $form->get('privacy');
-
 
1145
                        $element->setAttributes(['class' => 'form-control']);
Línea 838... Línea 1146...
838
			echo $this->formText($element);
1146
                        $element->setOptions(['label' => 'LABEL_PRIVACY']);
839
			?>
1147
                        echo $this->formLabel($element);
840
			</div>
1148
                        echo $this->formSelect($element);
841
		</div>
1149
                        ?>
842
 
1150
                    </div>
843
 
1151
                </div>
844
 
1152
 
845
         <div class="row">
1153
                <div class="row">
846
	 	         	<div class="col-12 mt-3">
1154
                    <div class="col-12 mt-3">
847
			<?php
1155
                        <?php
848
			$element = $form->get('status');
1156
                        $element = $form->get('type');
Línea -... Línea 1157...
-
 
1157
                        $element->setAttributes(['class' => 'form-control']);
-
 
1158
                        $element->setOptions(['label' => 'LABEL_TYPE']);
-
 
1159
                        echo $this->formLabel($element);
-
 
1160
                        echo $this->formSelect($element);
-
 
1161
                        ?>
-
 
1162
                    </div>
-
 
1163
                </div>
-
 
1164
 
-
 
1165
                <div class="row"  id="form-row-cost">
-
 
1166
                    <div class="col-12 mt-3">
-
 
1167
                        <?php
-
 
1168
                        $element = $form->get('cost');
849
			$element->setAttributes(['class' => 'form-control']);
1169
                        $element->setAttributes(['class' => 'form-control']);
850
			$element->setOptions(['label' => 'LABEL_STATUS']);
1170
                        $element->setOptions(['label' => 'LABEL_COST']);
851
			echo $this->formLabel($element);
1171
                        echo $this->formLabel($element);
852
			echo $this->formSelect($element);
1172
                        echo $this->formText($element);
853
			?>
1173
                        ?>
854
			</div>
1174
                    </div>
855
		</div>
1175
                </div>
856
 
1176
 
857
         <div class="row">
1177
                <div class="row">
858
	 	         	<div class="col-12 mt-3">
1178
                    <div class="col-12 mt-3">
859
                        <?php
1179
                        <?php
860
                        $element = $form->get('file');
1180
                        $element = $form->get('file');
861
                        $element->setOptions(['label' => 'LABEL_IMAGE']);
-
 
Línea -... Línea 1181...
-
 
1181
                        $element->setOptions(['label' => 'LABEL_IMAGE']);
-
 
1182
                        $element->setAttributes(['class' => 'form-control']);
-
 
1183
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
-
 
1184
                        echo $this->formLabel($element);
-
 
1185
                        echo $this->formFile($element);
-
 
1186
                        ?>
-
 
1187
                    </div>
-
 
1188
                </div>  
-
 
1189
                
-
 
1190
                <div class="row">
-
 
1191
                    <div class="col-12 mt-3">
-
 
1192
                        <?php
862
                        $element->setAttributes(['class' => 'form-control']);
1193
                        $element = $form->get('marketplace');
Línea 863... Línea 1194...
863
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
1194
                        $element->setOptions(['label' => 'LABEL_MARKETPLACE']);
864
                        echo $this->formLabel($element);
1195
                        $element->setAttributes(['class' => 'form-control']);
865
                        echo $this->formFile($element);
1196
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
866
                        ?>
1197
                        echo $this->formLabel($element);
867
                    </div>
1198
                        echo $this->formFile($element);
868
                </div> 
1199
                        ?>
869
             
1200
                    </div>
Línea 870... Línea -...
870
                
-
 
871
	 	</div>
-
 
872
	 	
1201
                </div> 
873
	 	<div class="card-footer text-right">
1202
            </div>
874
			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
1203
	 	
875
      		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
1204
            <div class="card-footer text-right">
Línea 902... Línea 1231...
902
			</div>
1231
			</div>
903
		</div>
1232
		</div>
904
	</div>
1233
	</div>
905
</div>
1234
</div>
Línea -... Línea 1235...
-
 
1235
 
-
 
1236
<!-- The Modal -->
-
 
1237
<div class="modal" id="modalPreviewMarketPlace">
-
 
1238
	<div class="modal-dialog">
-
 
1239
		<div class="modal-content">
-
 
1240
			<!-- Modal Header -->
-
 
1241
			<div class="modal-header">
-
 
1242
				<h6 class="modal-title">LABEL_IMAGE_MARKETPLACE</h6>
-
 
1243
				<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
-
 
1244
			</div>
-
 
1245
 
-
 
1246
			<!-- Modal body -->
-
 
1247
			<div class="modal-body text-center">
-
 
1248
				<img src="" class="img img-responsive" style="width: 300px; height: auto" id="image-marketplace" />
-
 
1249
			</div>
-
 
1250
 
-
 
1251
			<!-- Modal footer -->
-
 
1252
			<div class="modal-footer text-right">
-
 
1253
				<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
-
 
1254
			</div>
-
 
1255
		</div>
-
 
1256
	</div>
-
 
1257
</div>
-
 
1258
 
-
 
1259
<!-- The Modal -->
-
 
1260
<div class="modal" id="notificationUsersModal">
-
 
1261
	<div class="modal-dialog modal-xl">
-
 
1262
		<div class="modal-content">
-
 
1263
 
-
 
1264
			<!-- Modal Header -->
-
 
1265
			<div class="modal-header">
-
 
1266
				<h6 class="modal-title">LABEL_USERS</h6>
-
 
1267
				<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
-
 
1268
			</div>
-
 
1269
 
-
 
1270
			<!-- Modal body -->
-
 
1271
			<div class="modal-body">
-
 
1272
				<form>
-
 
1273
					<div class="row">
-
 
1274
						<div class="col-12 mt-3">
-
 
1275
						<label>LABEL_CAPSULE</label>
-
 
1276
						<input type="text" readonly="readonly" id="table-users-capsule" class="form-control">
-
 
1277
						</div>
-
 
1278
					</div>	
-
 
1279
				</form>
-
 
1280
				<div class="row">
-
 
1281
					<div class="col-12 mt-3">
-
 
1282
        				<div style="height: 300px;overflow: scroll;">
-
 
1283
        					<table id="gridTableUsers" style="width: 100%" class="table table-bordered">
-
 
1284
        						<thead>
-
 
1285
        							<tr>
-
 
1286
        								<th>LABEL_FIRST_NAME</th>
-
 
1287
        								<th>LABEL_LAST_NAME</th>
-
 
1288
        								<th>LABEL_EMAIL</th>
-
 
1289
        								<th>LABEL_DETAILS</th>
-
 
1290
        							</tr>
-
 
1291
        						</thead>
-
 
1292
        						<tbody>
-
 
1293
        						</tbody>
-
 
1294
        					</table>
-
 
1295
        				</div>
-
 
1296
    				</div>
-
 
1297
    			</div>	
-
 
1298
			</div>
-
 
1299
 
-
 
1300
			<!-- Modal footer -->
-
 
1301
			<div class="modal-footer text-right">
-
 
1302
				<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
-
 
1303
			</div>
-
 
1304
 
-
 
1305
		</div>
-
 
1306
	</div>
-
 
1307
</div>
906
 
1308
 
907
<script id="trCapsuleTemplate" type="text/x-jsrender">
1309
<script id="trCapsuleTemplate" type="text/x-jsrender">
908
    <tr id="tr_capsule_id_{{:id}}">
1310
    <tr id="tr_capsule_id_{{:id}}">
909
       <td class="text-left">
1311
       <td class="text-left">
910
            <input type="hidden" class="capsule_id" name="capsule_id[]" value="{{:id}}" />      
1312
            <input type="hidden" class="capsule_id" name="capsule_id[]" value="{{:id}}" />      
Línea 915... Línea 1317...
915
                <i class="fa fa-ban" aria-hidden="true"></i>
1317
                <i class="fa fa-ban" aria-hidden="true"></i>
916
                <span class="d-none d-md-inline">LABEL_DELETE</span>
1318
                <span class="d-none d-md-inline">LABEL_DELETE</span>
917
            </button>   
1319
            </button>   
918
       </td>
1320
       </td>
919
   </tr>
1321
   </tr>
920
</script>
1322
</script>
921
1323