new role functionality

This commit is contained in:
2026-05-11 11:46:40 +08:00
parent 909c767e01
commit 6739a5e169
6 changed files with 116 additions and 3 deletions

View File

@@ -0,0 +1,33 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Create Role') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 text-gray-900">
<form method="POST" action="{{ route('role.store') }}" class="space-y-6 max-w-xl">
@csrf
<div>
<x-input-label for="name" :value="__('Name')" />
<x-text-input id="name" class="mt-1 block w-full" type="text" name="name" :value="old('name')" required autofocus autocomplete="off" />
<x-input-error class="mt-2" :messages="$errors->get('name')" />
</div>
<div class="flex items-center gap-4">
<x-primary-button>{{ __('Save') }}</x-primary-button>
<a href="{{ route('role.index') }}" class="text-sm text-gray-600 underline hover:text-gray-900">
{{ __('Cancel') }}
</a>
</div>
</form>
</div>
</div>
</div>
</div>
</x-app-layout>

View File

@@ -1,14 +1,26 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Roles') }}
</h2>
<div class="flex items-center justify-between gap-4">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Roles') }}
</h2>
<a href="{{ route('role.create') }}" class="inline-flex items-center rounded-md border border-transparent bg-gray-800 px-4 py-2 text-xs font-semibold uppercase tracking-widest text-white transition hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
{{ __('New Role') }}
</a>
</div>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 text-gray-900">
@if (session('status') === 'role-created')
<div class="mb-4 rounded-md bg-green-50 px-4 py-3 text-sm text-green-700">
{{ __('Role created successfully.') }}
</div>
@endif
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">