Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 7574 | Rev 7707 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

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