|
24 | 24 | *} |
25 | 25 | <script type="text/javascript"> |
26 | 26 | $(document).ready(function() { |
27 | | - |
| 27 | +
|
28 | 28 | var id_tab_parentmodule = {$id_tab_parentmodule|intval}; |
29 | 29 | var id_tab_module = {$id_tab_module|intval}; |
30 | | - |
| 30 | +
|
31 | 31 | $('tr.child-'+id_tab_parentmodule+' > td > input.view.'+id_tab_module).change( function () { |
32 | 32 |
|
33 | 33 | if (!$(this).prop('checked')) |
|
37 | 37 | $('#table_module_2 thead th:eq(1) input').trigger('click'); |
38 | 38 | } |
39 | 39 | }); |
40 | | - |
| 40 | +
|
41 | 41 | $('tr.child-'+id_tab_parentmodule+' > td > input.edit.'+id_tab_module).change( function () { |
42 | 42 |
|
43 | 43 | if (!$(this).prop('checked')) |
|
47 | 47 | $('#table_module_2 thead th:eq(2) input').trigger('click'); |
48 | 48 | } |
49 | 49 | }); |
50 | | - |
| 50 | +
|
51 | 51 | $('div.productTabs').find('a').each(function() { |
52 | 52 | $(this).attr('href', '#'); |
53 | 53 | }); |
|
187 | 187 | }); |
188 | 188 | }); |
189 | 189 |
|
| 190 | + // Change Accesses of hotels |
| 191 | + $(".changeHotelAccess").change(function(){ |
| 192 | + var tout = $(this).data('rel').split('||'); |
| 193 | + var id_hotel = tout[0]; |
| 194 | + var id_profile = tout[2]; |
| 195 | + var enabled = $(this).is(':checked') ? 1 : 0; |
| 196 | + var enabled_attr = $(this).is(':checked') ? true : false; |
| 197 | + var table = 'table#table_hotel_'+id_profile; |
| 198 | +
|
| 199 | + if (id_hotel == -1) { |
| 200 | + $(table+' .ajax-htl-all').attr("checked", enabled_attr); |
| 201 | + } |
| 202 | +
|
| 203 | + $.ajax({ |
| 204 | + url: "{$link->getAdminLink('AdminAccess')|addslashes}", |
| 205 | + cache: false, |
| 206 | + data : { |
| 207 | + ajaxMode: '1', |
| 208 | + id_hotel: id_hotel, |
| 209 | + enabled: enabled, |
| 210 | + id_profile: id_profile, |
| 211 | + submitAddHotelAccess: '1', |
| 212 | + action: 'updateHotelAccess', |
| 213 | + ajax: '1', |
| 214 | + token: '{getAdminToken tab='AdminAccess'}' |
| 215 | + }, |
| 216 | + success : function(res,textStatus,jqXHR) |
| 217 | + { |
| 218 | + try { |
| 219 | + if (res == 'ok') { |
| 220 | + showSuccessMessage("{l s='Update successful'}"); |
| 221 | + } else { |
| 222 | + showErrorMessage("{l s='Update error'}"); |
| 223 | + } |
| 224 | + } |
| 225 | + catch(e) |
| 226 | + { |
| 227 | + jAlert('Technical error'); |
| 228 | + } |
| 229 | + } |
| 230 | + }); |
| 231 | + }); |
| 232 | +
|
190 | 233 | }); |
191 | 234 | </script> |
192 | 235 | {if $show_toolbar} |
|
213 | 256 | {/foreach} |
214 | 257 | {foreach $profiles as $profile} |
215 | 258 | <div class="profile-{$profile.id_profile} tab-profile" style="display:{if $profile.id_profile != $current_profile}none{/if}"> |
216 | | - <div class="row"> |
| 259 | + <div class="row"> |
217 | 260 | {if $profile.id_profile != $admin_profile} |
218 | | - <div class="col-lg-6"> |
| 261 | + <div class="col-lg-6"> |
| 262 | + {if isset($hotels) && $hotels} |
| 263 | + <div class="panel"> |
| 264 | + <h3>{l s='Hotel Permissions'}</h3> |
| 265 | + <table class="table" id="table_hotel_{$profile.id_profile}"> |
| 266 | + <thead> |
| 267 | + <tr> |
| 268 | + <th>{l s='Hotel'}</th> |
| 269 | + <th> |
| 270 | + <input type="checkbox"{if $access_edit == 1} class="changeHotelAccess" data-rel="-1||all||{$profile.id_profile}"{else} disabled="disabled"{/if}/> |
| 271 | + {l s='All'} |
| 272 | + </th> |
| 273 | + </tr> |
| 274 | + </thead> |
| 275 | + <tbody> |
| 276 | + {if !count($hotels)} |
| 277 | + <tr> |
| 278 | + <td colspan="6">{l s='No menu'}</td> |
| 279 | + </tr> |
| 280 | + {else} |
| 281 | + {foreach $hotels as $hotelInfo} |
| 282 | + {assign var=result_accesses value=0} |
| 283 | + <tr class="parentTr"> |
| 284 | + <td>{$hotelInfo['hotel_name']|escape:'html':'UTF-8'}</td> |
| 285 | + <td> |
| 286 | + <input type="checkbox"{if $access_edit == 1} data-rel="{$hotelInfo['id']}||specific||{$profile.id_profile|escape:'html':'UTF-8'}||all" class="changeHotelAccess ajax-htl-all"{else} class="all" disabled="disabled"{/if}{if isset($hotelAccess[$profile.id_profile][$hotelInfo.id]['access']) && $hotelAccess[$profile.id_profile][$hotelInfo.id]['access']} checked="checked"{/if}/> |
| 287 | + </td> |
| 288 | + </tr> |
| 289 | + {/foreach} |
| 290 | + {/if} |
| 291 | + </tbody> |
| 292 | + </table> |
| 293 | + </div> |
| 294 | + {/if} |
219 | 295 | <div class="panel"> |
220 | 296 | <h3>{l s='Menu'}</h3> |
221 | 297 | <table class="table" id="table_{$profile.id_profile}"> |
|
255 | 331 | {if !$tab.id_parent OR $tab.id_parent == -1} |
256 | 332 | {assign var=is_child value=false} |
257 | 333 | {assign var=result_accesses value=0} |
258 | | - <tr{if !$is_child} class="parent"{/if}> |
259 | | - <td{if !$is_child} class="bold"{/if}>{if $is_child} » {/if}<strong>{$tab.name}</strong></td> |
| 334 | + <tr {if !$is_child} class="parent"{/if}> |
| 335 | + <td {if !$is_child} class="bold"{/if}>{if $is_child} » {/if}<strong>{$tab.name}</strong></td> |
260 | 336 | {foreach $perms as $perm} |
261 | 337 | {if $access_edit == 1} |
262 | 338 | <td> |
|
0 commit comments