feat: add types2.blade.php view for module and permission management
This commit is contained in:
@@ -293,71 +293,78 @@
|
||||
{
|
||||
caption: "{{__('Permissions')}}",
|
||||
columns: [
|
||||
{ dataField: "full_control", caption: "Full", cellTemplate: renderPermissionCell },
|
||||
{ dataField: "write", caption: "Write", cellTemplate: renderPermissionCell },
|
||||
{ dataField: "read", caption: "Read", cellTemplate: renderPermissionCell },
|
||||
{ dataField: "modify", caption: "Mod", cellTemplate: renderPermissionCell }
|
||||
{ dataField: "full_control", caption: "Full", width: 100, cellTemplate: renderPermissionCell },
|
||||
{ dataField: "write", caption: "Write", width: 100, cellTemplate: renderPermissionCell },
|
||||
{ dataField: "read", caption: "Read", width: 100, cellTemplate: renderPermissionCell },
|
||||
{ dataField: "modify", caption: "Mod", width: 100, cellTemplate: renderPermissionCell }
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "buttons",
|
||||
width: 150,
|
||||
buttons: [
|
||||
{
|
||||
icon: "link",
|
||||
hint: "Go to Link",
|
||||
onClick: function(e) {
|
||||
window.open("{{ url('admin/types') }}/" + e.row.data.slug, "_blank");
|
||||
}
|
||||
},
|
||||
{
|
||||
icon: "key",
|
||||
hint: "General Permissions",
|
||||
onClick: function(e) {
|
||||
const data = e.row.data;
|
||||
// Default to Full Control modal as a starting point, or we could add a multi-edit modal
|
||||
window.openLevelEdit(data.id, 'full_control', data.full_control, data.title, data.icon);
|
||||
}
|
||||
},
|
||||
{
|
||||
icon: "preferences",
|
||||
hint: "Specific Permissions",
|
||||
onClick: function(e) {
|
||||
const data = e.row.data;
|
||||
const $btn = $("<button>")
|
||||
.data('id', data.id)
|
||||
.data('title', data.title)
|
||||
.data('slug', data.slug)
|
||||
.data('permissions', data.specific_permissions)
|
||||
.data('mobile-columns', data.mobile_columns)
|
||||
.addClass('open-specific-permissions')
|
||||
.hide()
|
||||
.appendTo('body');
|
||||
$btn.trigger('click');
|
||||
$btn.remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
icon: "trash",
|
||||
hint: "Delete",
|
||||
onClick: function(e) {
|
||||
Swal.fire({
|
||||
title: '{{__("Are you sure?")}}',
|
||||
text: '{{__("This module and all its settings will be deleted!")}}',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: '{{__("Yes, delete it!")}}',
|
||||
cancelButtonText: '{{__("Cancel")}}'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = "{{ url('admin/types') }}/" + e.row.data.id + "/delete";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
caption: "{{__('Actions')}}",
|
||||
width: 80,
|
||||
alignment: "center",
|
||||
cellTemplate: function(container, options) {
|
||||
const data = options.data;
|
||||
const $dropdown = $(`
|
||||
<div class="dropdown">
|
||||
<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">
|
||||
<a class="dropdown-item" href="{{ url('admin/types') }}/${data.slug}" target="_blank">
|
||||
<i class="fa fa-link mr-2"></i> {{__('Go to Link')}}
|
||||
</a>
|
||||
<a class="dropdown-item opt-gen-perms" href="javascript:void(0)">
|
||||
<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);
|
||||
});
|
||||
|
||||
$dropdown.find('.opt-spec-perms').on('click', function() {
|
||||
const $btn = $("<button>")
|
||||
.data('id', data.id)
|
||||
.data('title', data.title)
|
||||
.data('slug', data.slug)
|
||||
.data('permissions', data.specific_permissions)
|
||||
.data('mobile-columns', data.mobile_columns)
|
||||
.addClass('open-specific-permissions')
|
||||
.hide()
|
||||
.appendTo('body');
|
||||
$btn.trigger('click');
|
||||
$btn.remove();
|
||||
});
|
||||
|
||||
$dropdown.find('.opt-delete').on('click', function() {
|
||||
Swal.fire({
|
||||
title: '{{__("Are you sure?")}}',
|
||||
text: '{{__("This module and all its settings will be deleted!")}}',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: '{{__("Yes, delete it!")}}',
|
||||
cancelButtonText: '{{__("Cancel")}}'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = "{{ url('admin/types') }}/" + data.id + "/delete";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$dropdown.appendTo(container);
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -670,6 +677,16 @@
|
||||
.font-w600 {
|
||||
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>
|
||||
@endsection
|
||||
|
||||
|
||||
Reference in New Issue
Block a user