Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 7707 Rev 11215
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 -... Línea 5...
-
 
5
$roleName = $currentUser->getUserTypeId();
5
$roleName = $currentUser->getUserTypeId();
6
 
Línea 6... Línea -...
6
 
-
 
Línea -... Línea 7...
-
 
7
 
-
 
8
$routeDatatable = $this->url('followers');
-
 
9
 
-
 
10
 
-
 
11
$allowDelete    = $acl->isAllowed($roleName, 'followers/delete') ? 1 : 0;
-
 
12
 
-
 
13
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
-
 
14
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
-
 
15
 
-
 
16
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
-
 
17
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
-
 
18
 
-
 
19
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
-
 
20
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
-
 
21
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
-
 
22
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
-
 
23
 
-
 
24
 
-
 
25
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
-
 
26
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
7
$routeDatatable = $this->url('followers');
27
 
-
 
28
 
-
 
29
 
-
 
30
$this->inlineScript()->captureStart();
-
 
31
echo <<<JS
-
 
32
    jQuery( document ).ready(function( $ ) {
-
 
33
 
-
 
34
        var allowDelete = $allowDelete;
-
 
35
 
-
 
36
 
-
 
37
        var gridTable = $('#gridTable').dataTable( {
-
 
38
            'processing': true,
-
 
39
            'serverSide': true,
-
 
40
            'searching': true,
-
 
41
            'order': [[ 1, 'asc' ]],
-
 
42
            'ordering':  true,
-
 
43
            'ordenable' : true,
8
 
44
            'responsive': true,
9
$allowDelete = $acl->isAllowed($roleName, 'followers/delete') ? 1 : 0;
45
            'select' : false,
-
 
46
        	'paging': true,
-
 
47
            'pagingType': 'simple_numbers',
-
 
48
    		'ajax': {
-
 
49
    			'url' : '$routeDatatable',
-
 
50
    			'type' : 'get',
-
 
51
                'beforeSend': function (request) {
-
 
52
                  NProgress.start();
-
 
53
                },
-
 
54
                'dataFilter': function(response) {
-
 
55
                    var response = jQuery.parseJSON( response );
-
 
56
 
-
 
57
                    var json                = {};
-
 
58
                    json.recordsTotal       = 0;
-
 
59
                    json.recordsFiltered    = 0;
-
 
60
                    json.data               = [];
-
 
61
 
-
 
62
 
-
 
63
                    if(response.success) {
-
 
64
                        json.recordsTotal       = response.data.total;
-
 
65
                        json.recordsFiltered    = response.data.total;
-
 
66
                        json.data               = response.data.items;
-
 
67
                    } else {
-
 
68
                        $.fn.showError(response.data)
-
 
69
                    }
-
 
70
 
-
 
71
                    return JSON.stringify( json );
-
 
72
                }
-
 
73
    		},
-
 
74
            'language' : {
-
 
75
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
-
 
76
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
-
 
77
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
-
 
78
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
-
 
79
                'sInfo':           'LABEL_DATATABLE_SINFO',
-
 
80
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
-
 
81
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
-
 
82
                'sInfoPostFix':    '',
-
 
83
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
-
 
84
                'sUrl':            '',
-
 
85
                'sInfoThousands':  ',',
-
 
86
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
-
 
87
                'oPaginate': {
-
 
88
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
-
 
89
                    'sLast':     'LABEL_DATATABLE_SLAST',
-
 
90
                    'sNext':     'LABEL_DATATABLE_SNEXT',
-
 
91
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
-
 
92
                },
-
 
93
                'oAria': {
-
 
94
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
-
 
95
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
-
 
96
                },
-
 
97
            },
-
 
98
            'drawCallback': function( settings ) {
-
 
99
                NProgress.done();
-
 
100
                $('button.btn-delete').confirmation({
-
 
101
                    rootSelector: 'button.btn-delete',
-
 
102
                    title : 'LABEL_ARE_YOU_SURE',
-
 
103
                    singleton : true,
-
 
104
                    btnOkLabel: 'LABEL_YES',
-
 
105
                    btnCancelLabel: 'LABEL_NO',
-
 
106
                    onConfirm: function(value) {
-
 
107
                        action = $(this).data('href');
-
 
108
                        NProgress.start();
-
 
109
                        $.ajax({
-
 
110
                            'dataType'  : 'json',
-
 
111
                            'accept'    : 'application/json',
-
 
112
                            'method'    : 'post',
-
 
113
                            'url'       :  action,
-
 
114
                        }).done(function(response) {
-
 
115
                            if(response['success']) {
-
 
116
                                $.fn.showSuccess(response['data']);
-
 
117
                                gridTable.api().ajax.reload(null, false);
-
 
118
                            } else {
-
 
119
                                $.fn.showError(response['data']);
-
 
120
                            }
-
 
121
                        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
122
                            $.fn.showError(textStatus);
-
 
123
                        }).always(function() {
-
 
124
                            NProgress.done();
-
 
125
                        });
-
 
126
                    },
-
 
127
                });
-
 
128
            },
-
 
129
            'aoColumns': [
-
 
130
                { 'mDataProp': 'first_name' },
-
 
131
                { 'mDataProp': 'last_name' },
-
 
132
                { 'mDataProp': 'email' },
-
 
133
                { 'mDataProp': 'actions' },
-
 
134
    	    ],
-
 
135
            'columnDefs': [
-
 
136
                {
-
 
137
                    'targets': 0,
-
 
138
                    'className' : 'text-vertical-middle',
-
 
139
                },
-
 
140
                {
-
 
141
                    'targets': 1,
-
 
142
                    'className' : 'text-vertical-middle',
-
 
143
                },
-
 
144
                {
-
 
145
                    'targets': 2,
-
 
146
                    'className' : 'text-vertical-middle',
-
 
147
                },
-
 
148
                {
-
 
149
                    'targets': -1,
-
 
150
                    'orderable': false,
-
 
151
                    'render' : function ( data, type, row ) {
-
 
152
                        s = '&nbsp;';
-
 
153
 
-
 
154
                        if(allowDelete && data['link_delete']) {
-
 
155
                            s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-times"></i> LABEL_DELETE </button>&nbsp;';
-
 
156
                        }
-
 
157
 
-
 
158
                        return s;
-
 
159
                    }
-
 
160
                }
-
 
161
 
10
 
162
            ],
-
 
163
        });
-
 
164
 
11
$js = <<<JS
165
        $('body').on('click', 'button.btn-refresh', function(e) {
12
const backendVar={
166
            e.preventDefault();
Línea -... Línea 167...
-
 
167
            gridTable.api().ajax.reload(null, false);
-
 
168
        });
13
    table_link: "$routeDatatable", 
169
 
14
    allowDelete: "$allowDelete"
-
 
15
}
-
 
16
JS;
170
 
Línea 17... Línea -...
17
 
-
 
18
$this->inlineScript()->appendScript($js);
-
 
19
$this->headLink()->appendStylesheet('/react-bundles/followers/main.css');
171
 
-
 
172
    });
-
 
173
JS;
-
 
174
$this->inlineScript()->captureEnd();
-
 
175
?>
-
 
176
 
-
 
177
 
-
 
178
 
-
 
179
 
-
 
180
 
-
 
181
 
-
 
182
 
-
 
183
<!-- Content Header (Page header) -->
-
 
184
<section class="content-header">
-
 
185
	<div class="container-fluid">
-
 
186
    	<div class="row mb-2">
-
 
187
        	<div class="col-sm-12">
-
 
188
            	<h1>LABEL_FOLLOWERS</h1>
-
 
189
			</div>
-
 
190
		</div>
-
 
191
	</div><!-- /.container-fluid -->
-
 
192
</section>
-
 
193
 
-
 
194
<section class="content">
-
 
195
	<div class="container-fluid">
-
 
196
    	<div class="row">
-
 
197
        	<div class="col-12">
-
 
198
				<div class="card">
-
 
199
					<div class="card-body">
-
 
200
        	    		<table id="gridTable" class="table   table-hover">
-
 
201
                      		<thead>
-
 
202
        						<tr>
-
 
203
                                	<th>LABEL_FIRST_NAME</th>
-
 
204
                                	<th>LABEL_LAST_NAME</th>
-
 
205
                                	<th>LABEL_EMAIL</th>
-
 
206
                                  	<th>LABEL_ACTIONS</th>
-
 
207
                                </tr>
-
 
208
                       		</thead>
-
 
209
                         	<tbody>
-
 
210
                         	</tbody>
-
 
211
                    	</table>
-
 
212
                   	</div>
-
 
213
                   	<div class="card-footer clearfix">
-
 
214
                   		<div style="float:right;">
-
 
215
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
-
 
216
						</div>
-
 
217
                 	</div>