feat: add types2.blade.php view for module and permission management
This commit is contained in:
@@ -293,71 +293,78 @@
|
|||||||
{
|
{
|
||||||
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')}}
|
||||||
window.openLevelEdit(data.id, 'full_control', data.full_control, data.title, data.icon);
|
</a>
|
||||||
}
|
<a class="dropdown-item opt-spec-perms" href="javascript:void(0)">
|
||||||
},
|
<i class="fa fa-cogs mr-2"></i> {{__('Specific Permissions')}}
|
||||||
{
|
</a>
|
||||||
icon: "preferences",
|
<div class="dropdown-divider"></div>
|
||||||
hint: "Specific Permissions",
|
<a class="dropdown-item text-danger opt-delete" href="javascript:void(0)">
|
||||||
onClick: function(e) {
|
<i class="fa fa-trash mr-2"></i> {{__('Delete')}}
|
||||||
const data = e.row.data;
|
</a>
|
||||||
const $btn = $("<button>")
|
</div>
|
||||||
.data('id', data.id)
|
</div>
|
||||||
.data('title', data.title)
|
`);
|
||||||
.data('slug', data.slug)
|
|
||||||
.data('permissions', data.specific_permissions)
|
$dropdown.find('.opt-gen-perms').on('click', function() {
|
||||||
.data('mobile-columns', data.mobile_columns)
|
window.openLevelEdit(data.id, 'full_control', data.full_control, data.title, data.icon);
|
||||||
.addClass('open-specific-permissions')
|
});
|
||||||
.hide()
|
|
||||||
.appendTo('body');
|
$dropdown.find('.opt-spec-perms').on('click', function() {
|
||||||
$btn.trigger('click');
|
const $btn = $("<button>")
|
||||||
$btn.remove();
|
.data('id', data.id)
|
||||||
}
|
.data('title', data.title)
|
||||||
},
|
.data('slug', data.slug)
|
||||||
{
|
.data('permissions', data.specific_permissions)
|
||||||
icon: "trash",
|
.data('mobile-columns', data.mobile_columns)
|
||||||
hint: "Delete",
|
.addClass('open-specific-permissions')
|
||||||
onClick: function(e) {
|
.hide()
|
||||||
Swal.fire({
|
.appendTo('body');
|
||||||
title: '{{__("Are you sure?")}}',
|
$btn.trigger('click');
|
||||||
text: '{{__("This module and all its settings will be deleted!")}}',
|
$btn.remove();
|
||||||
icon: 'warning',
|
});
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonColor: '#d33',
|
$dropdown.find('.opt-delete').on('click', function() {
|
||||||
cancelButtonColor: '#3085d6',
|
Swal.fire({
|
||||||
confirmButtonText: '{{__("Yes, delete it!")}}',
|
title: '{{__("Are you sure?")}}',
|
||||||
cancelButtonText: '{{__("Cancel")}}'
|
text: '{{__("This module and all its settings will be deleted!")}}',
|
||||||
}).then((result) => {
|
icon: 'warning',
|
||||||
if (result.isConfirmed) {
|
showCancelButton: true,
|
||||||
window.location.href = "{{ url('admin/types') }}/" + e.row.data.id + "/delete";
|
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-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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user