feat: add types2.blade.php view for module and permission management

This commit is contained in:
Ümit Tunç
2026-04-29 06:22:02 +03:00
parent c553960ac9
commit 09ecd719b8
+53 -36
View File
@@ -293,37 +293,46 @@
{ {
caption: "{{__('Permissions')}}", caption: "{{__('Permissions')}}",
columns: [ columns: [
{ dataField: "full_control", caption: "Full", cellTemplate: renderPermissionCell }, { dataField: "full_control", caption: "Full", width: 100, cellTemplate: renderPermissionCell },
{ dataField: "write", caption: "Write", cellTemplate: renderPermissionCell }, { dataField: "write", caption: "Write", width: 100, cellTemplate: renderPermissionCell },
{ dataField: "read", caption: "Read", cellTemplate: renderPermissionCell }, { dataField: "read", caption: "Read", width: 100, cellTemplate: renderPermissionCell },
{ dataField: "modify", caption: "Mod", cellTemplate: renderPermissionCell } { dataField: "modify", caption: "Mod", width: 100, cellTemplate: renderPermissionCell }
] ]
}, },
{ {
type: "buttons", caption: "{{__('Actions')}}",
width: 150, width: 80,
buttons: [ alignment: "center",
{ cellTemplate: function(container, options) {
icon: "link", const data = options.data;
hint: "Go to Link", const $dropdown = $(`
onClick: function(e) { <div class="dropdown">
window.open("{{ url('admin/types') }}/" + e.row.data.slug, "_blank"); <button class="btn btn-sm btn-alt-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-boundary="window">
} <i class="fa fa-cog"></i>
}, </button>
{ <div class="dropdown-menu dropdown-menu-right">
icon: "key", <a class="dropdown-item" href="{{ url('admin/types') }}/${data.slug}" target="_blank">
hint: "General Permissions", <i class="fa fa-link mr-2"></i> {{__('Go to Link')}}
onClick: function(e) { </a>
const data = e.row.data; <a class="dropdown-item opt-gen-perms" href="javascript:void(0)">
// Default to Full Control modal as a starting point, or we could add a multi-edit modal <i class="fa fa-key mr-2"></i> {{__('General Permissions')}}
</a>
<a class="dropdown-item opt-spec-perms" href="javascript:void(0)">
<i class="fa fa-cogs mr-2"></i> {{__('Specific Permissions')}}
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger opt-delete" href="javascript:void(0)">
<i class="fa fa-trash mr-2"></i> {{__('Delete')}}
</a>
</div>
</div>
`);
$dropdown.find('.opt-gen-perms').on('click', function() {
window.openLevelEdit(data.id, 'full_control', data.full_control, data.title, data.icon); window.openLevelEdit(data.id, 'full_control', data.full_control, data.title, data.icon);
} });
},
{ $dropdown.find('.opt-spec-perms').on('click', function() {
icon: "preferences",
hint: "Specific Permissions",
onClick: function(e) {
const data = e.row.data;
const $btn = $("<button>") const $btn = $("<button>")
.data('id', data.id) .data('id', data.id)
.data('title', data.title) .data('title', data.title)
@@ -335,12 +344,9 @@
.appendTo('body'); .appendTo('body');
$btn.trigger('click'); $btn.trigger('click');
$btn.remove(); $btn.remove();
} });
},
{ $dropdown.find('.opt-delete').on('click', function() {
icon: "trash",
hint: "Delete",
onClick: function(e) {
Swal.fire({ Swal.fire({
title: '{{__("Are you sure?")}}', title: '{{__("Are you sure?")}}',
text: '{{__("This module and all its settings will be deleted!")}}', text: '{{__("This module and all its settings will be deleted!")}}',
@@ -352,14 +358,15 @@
cancelButtonText: '{{__("Cancel")}}' cancelButtonText: '{{__("Cancel")}}'
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
window.location.href = "{{ url('admin/types') }}/" + e.row.data.id + "/delete"; window.location.href = "{{ url('admin/types') }}/" + data.id + "/delete";
} }
}); });
});
$dropdown.appendTo(container);
} }
} }
] ]
}
]
}); });
function renderPermissionCell(container, options) { function renderPermissionCell(container, options) {
@@ -670,6 +677,16 @@
.font-w600 { .font-w600 {
font-weight: 600; font-weight: 600;
} }
/* Fix for dropdown visibility in dxDataGrid */
.dx-datagrid-rowsview .dx-selection-disabled,
.dx-datagrid-rowsview .dx-row > td {
overflow: visible !important;
}
.dropdown-menu {
z-index: 1060 !important; /* Higher than grid fixed columns */
}
</style> </style>
@endsection @endsection