|
6 | 6 | </section> |
7 | 7 | <br> |
8 | 8 | <div class="contain-table"> |
9 | | - <div class="d-flex justify-content-end"> |
10 | | - <button type="button" class="btn btn-outline-success" id="button-call">Llamar a la api</button> |
11 | | - </div> |
12 | | - |
| 9 | + <?php |
| 10 | + if($active){ |
| 11 | + echo ' <div class="d-flex justify-content-end">'; |
| 12 | + echo '<button type="button" class="btn btn-outline-success" id="button-call">Llamar a la api</button>'; |
| 13 | + echo '</div>'; |
| 14 | + } |
| 15 | + ?> |
13 | 16 | <?php |
14 | 17 | echo br(2); |
15 | 18 | if(is_array($currency_list_dbarraypre) ) |
16 | 19 | { |
17 | | - if(count($currency_list_dbarraypre) && $user_preferences[0]['user_status'] === 'ACTIVO') |
| 20 | + if(count($currency_list_dbarraypre)) |
18 | 21 | { |
19 | 22 | echo '<h1 style="text-align: center;">Your preferences currencies</h1>'; |
20 | 23 | $this->table->clear(); |
21 | 24 | $this->table->set_template( array( 'table_open' => '<table id="table_id">',) ); |
22 | 25 | $this->table->set_heading(array_keys($currency_list_dbarraypre[0])); |
23 | 26 | echo $this->table->generate($currency_list_dbarraypre); |
24 | 27 | } |
25 | | - // else |
26 | | - // <h1 style="text-align: center;">History of your coins rate</h1> |
27 | | - // echo "There's not data stored today, check if your system already call the api in backend, or check if your DB is configured."; |
28 | 28 | } |
29 | 29 | echo br(2); |
30 | 30 |
|
|
38 | 38 | $this->table->set_heading(array_keys($currency_list_dbarraynow[0])); |
39 | 39 | echo $this->table->generate($currency_list_dbarraynow); |
40 | 40 | } |
41 | | - // else |
42 | | - // <h1 style="text-align: center;">History of your coins rate</h1> |
43 | | - // echo "There's not data stored today, check if your system already call the api in backend, or check if your DB is configured."; |
44 | 41 | } |
45 | 42 |
|
46 | 43 |
|
|
54 | 51 | $(document).ready( function () { |
55 | 52 |
|
56 | 53 | // --------------------------------------------------------------------------- |
57 | | - |
| 54 | + let activeUser = "<?php echo $active ?>" |
| 55 | + |
58 | 56 | table1 = $('#table_id').DataTable( |
59 | 57 | { |
60 | 58 | "order": [0] |
61 | 59 | } |
62 | 60 | ); |
| 61 | + |
| 62 | + if(activeUser){ |
63 | 63 | $('#table_id tbody').on('click', 'tr', function () { |
64 | 64 | var data = table1.row(this).data() |
65 | 65 | alert(data,'primary') |
|
111 | 111 |
|
112 | 112 |
|
113 | 113 | }); |
| 114 | + } |
114 | 115 |
|
115 | 116 |
|
116 | 117 | // --------------------------------------------------------------------------- |
117 | 118 |
|
| 119 | + |
118 | 120 | table2 = $('#table_id2').DataTable( |
119 | 121 | { |
120 | 122 | "order": [0] |
121 | 123 | } |
122 | 124 | ); |
| 125 | + if(activeUser){ |
| 126 | + |
123 | 127 | $('#table_id2 tbody').on('click', 'tr', function () { |
124 | 128 | var data = table2.row(this).data() |
125 | 129 | alert(data,'primary') |
|
168 | 172 | }); |
169 | 173 |
|
170 | 174 | }) |
171 | | - |
172 | | - |
173 | 175 | }); |
174 | 176 |
|
| 177 | + } |
175 | 178 |
|
176 | 179 |
|
177 | 180 |
|
|
0 commit comments