diff --git a/resources/views/admin/new/types2.blade.php b/resources/views/admin/new/types2.blade.php index 5c51dbe..6dd5c21 100644 --- a/resources/views/admin/new/types2.blade.php +++ b/resources/views/admin/new/types2.blade.php @@ -1,483 +1,550 @@ @extends('admin.master') -@section("title","Modules") -@section("desc","Bu sayfada içerik türlerini yönetebilirsiniz") +@section("title", "Modules") +@section("desc", "Bu sayfada içerik türlerini yönetebilirsiniz") @section('content') - + [ + 'Copy Paste Permission' => 'copy_paste_permission', + 'Copy Start Until Paste Permission' => 'copy_start_until_paste_permission', + 'Row Column History Permission' => 'row_column_history_permission', + 'Clear Value Permission' => 'clear_value_permission', + 'Inspection Photo Upload Permission' => 'inspection_photo_upload_permission', + ], + 'Toolbar Actions' => [ + 'Add Row Permission' => 'add_row_permission', + 'Apply Filter Permission' => 'apply_filter_permission', + 'Column Chooser Permission' => 'column_chooser_permission', + 'Revert Permission' => 'revert_permission', + 'Save Permission' => 'save_permission', + 'Search Panel Permission' => 'search_panel_permission', + 'Export Permission' => 'export_permission', + 'Group Panel Permission' => 'group_panel_permission', + 'Clear Filter Permission' => 'clear_filter_permission', + 'Select All Permission' => 'select_all_permission', + 'Deselect All Permission' => 'deselect_all_permission', + 'Refresh Permission' => 'refresh_permission', + 'Delete Selected Permission' => 'delete_selected_permission', + 'MTO Sync Permission' => 'mto_sync_permission', + ], + ]; + ?> -
-
-
-

{{__('Modules')}}

-
-
- + + +
+ - -
- -
- - - - - - - - - - [ - 'Copy Paste Permission' => 'copy_paste_permission', - 'Copy Start Until Paste Permission' => 'copy_start_until_paste_permission', - 'Row Column History Permission' => 'row_column_history_permission', - 'Clear Value Permission' => 'clear_value_permission', - 'Inspection Photo Upload Permission' => 'inspection_photo_upload_permission', - ], - 'Toolbar Actions' => [ - 'Add Row Permission' => 'add_row_permission', - 'Apply Filter Permission' => 'apply_filter_permission', - 'Column Chooser Permission' => 'column_chooser_permission', - 'Revert Permission' => 'revert_permission', - 'Save Permission' => 'save_permission', - 'Search Panel Permission' => 'search_panel_permission', - 'Export Permission' => 'export_permission', - 'Group Panel Permission' => 'group_panel_permission', - 'Clear Filter Permission' => 'clear_filter_permission', - 'Select All Permission' => 'select_all_permission', - 'Deselect All Permission' => 'deselect_all_permission', - 'Refresh Permission' => 'refresh_permission', - 'Delete Selected Permission' => 'delete_selected_permission', - 'MTO Sync Permission' => 'mto_sync_permission', - ], - ]; - - $levels = levels(); - foreach($levels AS $level => $detail) { - - ?> - - - - - - - - - -
{{e2("User No")}}{{e2("Level")}}{{e2("Full Control")}}{{e2("Write")}}{{e2("Read")}}{{e2("Modify")}}
{{$detail[0]}}{{$level}}{{$detail[1]==1 ? "✅" : "❌"}}{{$detail[2]==1 ? "✅" : "❌"}}{{$detail[3]==1 ? "✅" : "❌"}}{{$detail[4]==1 ? "✅" : "❌"}}
- - - - - - - - - - - - - - - - - - - - - - @foreach($types AS $a) - - - - - - - - - - - - - - - - - - - @endforeach - -
{{__("Enabled")}}{{__("Mobile")}}{{__("Icon")}}{{__("Icon Name")}}{{__("Title")}}{{__("Parent")}}{{__("ID")}}{{__("Order")}}{{__("Full Control")}} {{__("Write")}} {{__("Read")}} {{__("Modify")}}
- - - - - icon .".png")}}" width="24" alt=""> - - - +
+ +
+
+
-
-
-
- -
- -
-
-
- @foreach(explode(',', $a->full_control) as $level) - @if($level) - {{ intval($level) }} - @endif - @endforeach -
- - -
-
-
-
- @foreach(explode(',', $a->write) as $level) - @if($level) - {{ $level }} - @endif - @endforeach -
- - -
-
-
-
- @foreach(explode(',', $a->read) as $level) - @if($level) - {{ $level }} - @endif - @endforeach -
- - -
-
-
-
- @foreach(explode(',', $a->modify) as $level) - @if($level) - {{ $level }} - @endif - @endforeach -
- - -
-
-
- - - - - - - -
-
-
-
-
-
- - + + +
+
+ + + + + + + + + + + + + @php $levels = levels(); @endphp + @foreach($levels as $level => $detail) + + + + + + + + + @endforeach + +
{{e2("Level ID")}}{{e2("Level Name")}}{{e2("Full Control")}}{{e2("Write")}}{{e2("Read")}}{{e2("Modify")}}
+ {{$detail[0]}} + {{$level}} + @if($detail[1] == 1) @else @endif + + @if($detail[2] == 1) @else @endif + + @if($detail[3] == 1) @else @endif + + @if($detail[4] == 1) @else @endif +
+
- +
+ + + + -
- + // Update modal title and icon + $('.modal-icon').attr('src', `{{url("assets/icons")}}/${currentModuleData.icon}.png`); + $('.modal-module-title').text(currentModuleData.title); + $('.modal-permission-title').text(getPermissionTitle(currentType)); + } else { + // If button is inside Specific Permissions modal + $('.modal-icon').attr('src', ''); // Or default icon + $('.modal-module-title').text($('#spModalTitle').text()); + $('.modal-permission-title').text(currentType); // Directly use the permission name + } - + // Check current levels from the target input + const currentVal = $('#' + currentTarget).val(); + const currentLevels = currentVal ? currentVal.toString().split(',').filter(l => l) : []; + + $('.level-checkbox').prop('checked', false); + + currentLevels.forEach(level => { + $('#level_' + parseInt(level)).prop('checked', true); + }); + + $('#levelModal').modal('show'); + } catch (error) { + console.error('Error opening level modal:', error); + $('#levelModal').modal('show'); + } + }); + + function getPermissionTitle(type) { + const titles = { + 'full_control': 'Full Control', + 'write': 'Write Permission', + 'read': 'Read Permission', + 'modify': 'Modify Permission' + }; + return titles[type] || type; + } + + // Save button click handler + $('#saveLevels').click(function () { + if (!currentTarget) return; + + const selectedLevels = []; + $('.level-checkbox:checked').each(function () { + selectedLevels.push(parseInt($(this).val())); + }); + + const $target = $('#' + currentTarget); + const $container = $target.closest('.level-input'); + const $tags = $container.find('.level-tags'); + + // Update hidden input + $target.val(selectedLevels.join(',')).trigger('change'); + + // Update badges + $tags.empty(); + selectedLevels.forEach(level => { + $tags.append( + `${level}` + ); + }); + + $('#levelModal').modal('hide'); + }); + + // AJAX setup + $.ajaxSetup({ + headers: { + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') + } + }); + + // Edit sınıfına sahip elementlerin değişikliklerini izle + $(document).on('change', '.edit', function () { + $.post('{{url("admin-ajax/input-edit")}}', { + table: $(this).attr("table"), + value: $(this).val(), + id: $(this).data("id"), + name: $(this).attr("name"), + _token: '{{ csrf_token() }}' + }); + }); + + + @endsection @@ -497,16 +564,17 @@ $(document).on('change', '.edit', function() {
- +
- +
@foreach($specificPermissionsList as $groupName => $perms) -
- - - - - - - - - @foreach($perms as $label => $key) - - - - - @endforeach - -
Permission NameAllowed Levels (e.g. 1,2)
{{$label}} -
-
- -
- - -
- {{$key}} -
-
+
+ + + + + + + + + @foreach($perms as $label => $key) + + + + + @endforeach + +
Permission NameAllowed Levels (e.g. 1,2)
{{$label}} +
+
+ +
+ + +
+ {{$key}} +
+
@endforeach
@@ -559,8 +625,10 @@ $(document).on('change', '.edit', function() {
- + \ No newline at end of file