Commit 1a4c4e24 authored by Sarun Mungthanya's avatar Sarun Mungthanya
Browse files

update ui user management

parent 7fe8bcbb
...@@ -5,21 +5,22 @@ namespace App\Http\Livewire\Pages\User; ...@@ -5,21 +5,22 @@ namespace App\Http\Livewire\Pages\User;
use Livewire\Component; use Livewire\Component;
use App\Models\User; use App\Models\User;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Str;
class UserCreate extends Component class UserCreate extends Component
{ {
public $name, $email ,$password , $password_confirmation; public $username, $first_name , $last_name, $phone , $email ,$password , $password_confirmation;
public $description; public $description;
public $action; public $action;
public $group_lists; public $group_lists;
protected $rules = [ protected $rules = [
'name' => 'required|string|max:255', 'username' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users,email', 'email' => 'required|string|email|max:255|unique:users,email',
'password' => 'required|string|min:8|confirmed', 'password' => 'required|string|min:8|confirmed',
]; ];
protected $messages = [ protected $messages = [
'name.required' => 'The name field is required.', 'username.required' => 'The username field is required.',
'email.required' => 'The email field is required.', 'email.required' => 'The email field is required.',
'email.email' => 'The email must be a valid email address.', 'email.email' => 'The email must be a valid email address.',
'email.unique' => 'This email address is already taken.', 'email.unique' => 'This email address is already taken.',
...@@ -41,8 +42,11 @@ class UserCreate extends Component ...@@ -41,8 +42,11 @@ class UserCreate extends Component
{ {
$this->validate(); $this->validate();
$UsereData = [ $UsereData = [
'name' => $this->name, 'username' => $this->username,
'uid' => \Str::random(40), 'first_name' => $this->first_name,
'last_name' => $this->last_name,
'phone' => $this->phone,
'uid' => Str::random(40),
'email' => $this->email, 'email' => $this->email,
'password' => Hash::make($this->password) 'password' => Hash::make($this->password)
]; ];
...@@ -60,17 +64,17 @@ class UserCreate extends Component ...@@ -60,17 +64,17 @@ class UserCreate extends Component
} }
$this->reset([ $this->reset([
'name', 'email', 'description', 'group_lists' 'username', 'email', 'description', 'group_lists'
]); ]);
if (auth()->guest()) { if (auth()->guest()) {
return redirect()->route('login'); // เปลี่ยนเส้นทางไปยังหน้า register return redirect()->route('login');
} }
$this->emit('showUserList', 'User successfully created.'); $this->emit('showUserList', 'User successfully created.');
} }
public function goBack() public function goBack()
{ {
if (auth()->guest()) { if (auth()->guest()) {
return redirect()->route('login'); // เปลี่ยนเส้นทางไปยังหน้า register return redirect()->route('login');
} }
$this->emit('showUserList'); $this->emit('showUserList');
} }
......
...@@ -11,13 +11,13 @@ class UserEdit extends Component ...@@ -11,13 +11,13 @@ class UserEdit extends Component
public $editUserId; public $editUserId;
public $userId; public $userId;
public $user; public $user;
public $username, $email, $current_password, $new_password, $new_password_confirmation ,$changePassword = false ; public $username, $first_name , $last_name, $phone ,$email, $current_password, $new_password, $new_password_confirmation ,$changePassword = false ;
public $group_lists; public $group_lists;
protected function rules() protected function rules()
{ {
$rules = [ $rules = [
'name' => 'required|string|max:255', 'username' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users,email,' . $this->user->id, 'email' => 'required|string|email|max:255|unique:users,email,' . $this->user->id,
]; ];
...@@ -30,7 +30,7 @@ class UserEdit extends Component ...@@ -30,7 +30,7 @@ class UserEdit extends Component
} }
protected $messages = [ protected $messages = [
'name.required' => 'The name field is required.', 'username.required' => 'The username field is required.',
'email.required' => 'The email field is required.', 'email.required' => 'The email field is required.',
'email.email' => 'The email must be a valid email address.', 'email.email' => 'The email must be a valid email address.',
'email.unique' => 'This email address is already taken.', 'email.unique' => 'This email address is already taken.',
...@@ -45,6 +45,9 @@ class UserEdit extends Component ...@@ -45,6 +45,9 @@ class UserEdit extends Component
$this->editUserId = $editUserId; $this->editUserId = $editUserId;
$this->user = User::findOrFail($editUserId); $this->user = User::findOrFail($editUserId);
$this->username = $this->user->username; $this->username = $this->user->username;
$this->first_name = $this->user->first_name;
$this->last_name = $this->user->last_name;
$this->phone = $this->user->phone;
$this->email = $this->user->email; $this->email = $this->user->email;
$this->group_lists = $this->user->groups()->pluck('group_id')->implode(','); $this->group_lists = $this->user->groups()->pluck('group_id')->implode(',');
} }
...@@ -69,7 +72,10 @@ class UserEdit extends Component ...@@ -69,7 +72,10 @@ class UserEdit extends Component
} }
$this->user->username = $this->username; $this->user->username = $this->username;
$this->user->email = $this->email; $this->user->email = $this->email;
$this->first_name = $this->user->first_name;
$this->last_name = $this->user->last_name;
$this->phone = $this->user->phone;
if ($this->changePassword) { if ($this->changePassword) {
$this->user->password = Hash::make($this->new_password); $this->user->password = Hash::make($this->new_password);
} }
......
...@@ -15,12 +15,12 @@ class UserIndex extends Component ...@@ -15,12 +15,12 @@ class UserIndex extends Component
protected $paginationTheme = 'bootstrap'; protected $paginationTheme = 'bootstrap';
public $perPage = 10; public $perPage = 10;
public $url; public $url;
public $searchSelected = 'name'; public $searchSelected = 'username';
public $editUserId; public $editUserId;
public $deleteUserId; public $deleteUserId;
public $keyword = ''; public $keyword = '';
public $route = ''; public $route = '';
public $selectedOption = 'name'; public $selectedOption = 'username';
public $searchBy; public $searchBy;
public $menu; public $menu;
public $action = 'list'; public $action = 'list';
...@@ -39,7 +39,10 @@ class UserIndex extends Component ...@@ -39,7 +39,10 @@ class UserIndex extends Component
// $this->message = session('message'); // $this->message = session('message');
// $this->showMessage = true; // $this->showMessage = true;
} }
public function search()
{
$this->resetPage();
}
public function render() public function render()
{ {
...@@ -59,7 +62,7 @@ class UserIndex extends Component ...@@ -59,7 +62,7 @@ class UserIndex extends Component
]); ]);
} }
public function showUserCreateForm() public function showUserAddForm()
{ {
if (!Auth::user()->hasPermissions(['add-user'])) { if (!Auth::user()->hasPermissions(['add-user'])) {
$this->showNoPermissionModal = TRUE; $this->showNoPermissionModal = TRUE;
......
...@@ -22,6 +22,9 @@ class User extends Authenticatable ...@@ -22,6 +22,9 @@ class User extends Authenticatable
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];
protected $fillable = [ protected $fillable = [
'username', 'username',
'first_name',
'last_name',
'phone',
'uid', 'uid',
'email', 'email',
'password', 'password',
......
...@@ -53,9 +53,9 @@ ...@@ -53,9 +53,9 @@
</style> </style>
</head> </head>
<body class="h-full bg-slate-150"> <body class="h-full bg-main-container">
<main class="flex-grow overflow-auto bg-slate-150"> <main class="flex-grow overflow-auto bg-main-container">
{{ $slot }} {{ $slot }}
@yield('content') @yield('content')
</main> </main>
......
...@@ -163,8 +163,8 @@ ...@@ -163,8 +163,8 @@
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label for="pdesc" class="block text-gray-700">Patch Desciption</label> <label for="pdesc" class="block text-gray-700">Patch Desciption</label>
<input type="text" id="pdesc" wire:model.defer="PDESC" <textarea id="pdesc" wire:model.defer="PDESC"
class="w-full mt-1 p-2 border border-gray-300 rounded-md"> class="w-full mt-1 p-2 border border-gray-300 rounded-md" rows="3"></textarea>
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label for="remark" class="block text-gray-700">Remark</label> <label for="remark" class="block text-gray-700">Remark</label>
......
...@@ -265,8 +265,8 @@ ...@@ -265,8 +265,8 @@
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label for="pdesc" class="block text-gray-700">Patch Description</label> <label for="pdesc" class="block text-gray-700">Patch Description</label>
<input type="text" id="pdesc" wire:model.defer="PDESC" <textarea id="pdesc" wire:model.defer="PDESC"
class="w-full mt-1 p-2 border border-gray-300 rounded-md"> class="w-full mt-1 p-2 border border-gray-300 rounded-md" rows="3"></textarea>
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label for="remark" class="block text-gray-700">Remark</label> <label for="remark" class="block text-gray-700">Remark</label>
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
<div class="mb-4"> <div class="mb-4">
<label for="owner" class="block text-gray-700">Owner</label> <label for="owner" class="block text-gray-700">Owner</label>
<input type="text" id="owner" wire:model.defer="POWNER" <input type="text" id="owner" wire:model.defer="POWNER"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" value="aom"> class="w-full mt-1 p-2 border border-gray-300 rounded-md" >
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label for="papprovedate" class="block text-gray-700">Papprovedate</label> <label for="papprovedate" class="block text-gray-700">Papprovedate</label>
......
<div class="grid grid-cols-1 gap-4 sm:gap-5 lg:gap-6"> <div class="max-w-lg mx-auto p-8 bg-white shadow-lg rounded-lg">
<form wire:submit.prevent="submitForm"> <form wire:submit.prevent="submitForm">
@csrf @csrf
<div class="card pb-4"> <div class="mb-6">
<div class="my-3 flex h-8 items-center justify-between px-4 sm:px-5"> <h2
<h2 class="font-medium tracking-wide text-slate-700 line-clamp-1 dark:text-navy-100 lg:text-base"> class="font-medium flex items-center tracking-wide text-slate-700 line-clamp-1 dark:text-navy-100 lg:text-base">
<i class="fa-solid fa-edit text-primary"></i> Create <i class="fa-solid fa-edit text-primary"></i> Create
</h2> </h2>
</div>
<form class="space-y-6">
<div class="mb-2">
<label for="username" class="block text-sm font-medium text-gray-700">Username:</label>
<input type="text" wire:model.defer="username" id="username"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Enter your name">
@error('username')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</div>
<div class="mb-2">
<label for="first_name" class="block text-sm font-medium text-gray-700">Firstname:</label>
<input type="text" wire:model.defer="first_name" id="first_name"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Enter your name">
@error('first_name')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</div>
<div class="mb-2">
<label for="last_name" class="block text-sm font-medium text-gray-700">Lastname:</label>
<input type="text" wire:model.defer="last_name" id="last_name"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Enter your name">
@error('last_name')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</div> </div>
<div class="w-3/4 px-3 space-y-3 m-auto mb-4">
<div class="flex items-center">
<label class="w-2/12 mr-2">
<span>Name :</span>
</label>
<span class="relative flex w-full">
<input wire:model.defer="name"
class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
placeholder="" name="name" type="text" value="{{ old('name') }}" />
@error('name')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</span>
</div> <div class="mb-2">
<label for="email" class="block text-sm font-medium text-gray-700">Email:</label>
<input type="email" wire:model.email="email" id="email"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Enter your email">
@error('email')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</div>
<div class="mb-2">
<label for="phone" class="block text-sm font-medium text-gray-700">Phone:</label>
<input type="text" wire:model.defer="phone" id="phone"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Enter your name">
@error('phone')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</div>
<div class="mb-2">
<label for="password" class="block text-sm font-medium text-gray-700">Password:</label>
<input type="password" wire:model.password="password" id="password"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Enter your password">
@error('password')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</div>
<div class="flex items-center"> <div class="mb-2">
<label class="w-2/12 mr-2"> <label for="password_confirmation" class="block text-sm font-medium text-gray-700">Confirm
<span>Email :</span> Password:</label>
</label> <input type="password" wire:model.defer="password_confirmation" id="password_confirmation"
<span class="relative flex w-full"> class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
<input wire:model.email="email" placeholder="Confirm your password">
class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
placeholder="" name="email" type="text" value="{{ old('email') }}" />
@error('email')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</span>
</div>
<div class="flex items-center">
<label class="w-2/12 mr-2">
<span>Password :</span>
</label>
<span class="relative flex w-full">
<input wire:model.password="password"
class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
placeholder="" name="password" type="password" value="{{ old('password') }}" />
@error('password')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</span>
</div>
<div class="flex items-center">
<label class="w-2/12 mr-2">
<span>Confirm Password :</span>
</label>
<span class="relative flex w-full">
<input wire:model.defer="password_confirmation"
class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
placeholder="" name="password_confirmation" type="password" />
</span>
</div>
@error('password_confirmation') @error('password_confirmation')
<span class="text-red-500 text-xs">{{ $message }}</span> <span class="text-red-500 text-xs">{{ $message }}</span>
@enderror @enderror
<div class="flex items-center " wire:ignore>
<label class="w-2/12 mr-2">
<span>Add Groups :</span>
</label>
<span class="relative flex w-full">
<input class="mt-1.5 relative flex w-2/4" wire:ignore x-data="{ groupLists: @entangle('group_lists') }"
x-init="groupLists = [];
const tempGroup = pages.groupSelect;
pages.fetchGroups(tempGroup).then(() => {
$el._x_tom = new Tom($el, {
...tempGroup.group,
onChange: (value) => {
groupLists = value;
}
});
})" type="text">
</span>
</div>
</div> </div>
<div class="grid grid-cols-12 justify-center space-x-2 pt-4">
<span wire:click="goBack" <div wire:ignore class="mb-2">
class="col-start-4 btn border border-slate-300 font-medium text-slate-800 hover:bg-slate-150 focus:bg-slate-150 active:bg-slate-150/80 dark:border-navy-450 dark:text-navy-50 dark:hover:bg-navy-500 dark:focus:bg-navy-500 dark:active:bg-navy-500/90"> <label for="group" class="block text-sm font-medium text-gray-700">Add Groups:</label>
Cancel <span class="relative flex w-full">
<input class="mt-1.5 relative flex w-full" x-data="{ groupLists: @entangle('group_lists') }" x-init="groupLists = [];
const tempGroup = pages.groupSelect;
pages.fetchGroups(tempGroup).then(() => {
$el._x_tom = new Tom($el, {
...tempGroup.group,
onChange: (value) => {
groupLists = value;
}
});
})"
type="text">
</span> </span>
<button type="submit"
class="btn ml-3 bg-primary font-medium text-white hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90 dark:bg-accent dark:hover:bg-accent-focus dark:focus:bg-accent-focus dark:active:bg-accent/90">
Save
</button>
</div> </div>
</div>
</form> <div class="flex justify-end space-x-4 mt-3">
<button type="button" wire:click="goBack"
class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md shadow-sm hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-400">Cancel</button>
<button type="submit" type="submit"
class="px-4 py-2 bg-primary text-white rounded-md shadow-sm hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">Save</button>
</div>
</form>
</div> </div>
<div class="grid grid-cols-1 gap-4 sm:gap-5 lg:gap-6"x-data="{ changePassword: @entangle('changePassword'), tomGReady: false }" x-show="tomGReady"> <div class="max-w-lg mx-auto p-8 bg-white shadow-lg rounded-lg" x-data="{ changePassword: @entangle('changePassword'), tomGReady: false }" x-show="tomGReady">
<form wire:submit.prevent="submitEditForm"> <form wire:submit.prevent="submitEditForm">
@csrf @csrf
<div class="card pb-4"> <div class="mb-6">
<div class="my-3 flex h-8 items-center justify-between px-4 sm:px-5"> <h2
<h2 class="font-medium tracking-wide text-slate-700 line-clamp-1 dark:text-navy-100 lg:text-base"> class="font-medium flex items-center tracking-wide text-slate-700 line-clamp-1 dark:text-navy-100 lg:text-base">
<i class="fa-solid fa-edit text-primary"></i> Edit User <i class="fa-solid fa-edit text-primary"></i> Edit User
</h2> </h2>
</div> </div>
<div class="w-3/4 px-3 space-y-3 m-auto mb-4">
<div class="flex items-center">
<label class="w-2/12 mr-2">
<span>Name:</span>
</label>
<span class="relative flex w-full">
<input wire:model.defer="name"
class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
placeholder="Name" name="name" type="text" />
@error('name')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</span>
</div>
<div class="flex items-center"> <form class="space-y-6">
<label class="w-2/12 mr-2"> <div class="mb-2">
<span>Email:</span> <label for="username" class="block text-sm font-medium text-gray-700">Username:</label>
</label> <input type="text" wire:model.defer="username" id="username"
<span class="relative flex w-full"> class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
<input wire:model.defer="email" placeholder="Enter your name">
class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent" @error('username')
placeholder="Email" name="email" type="email" /> <span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@error('email') @enderror
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span> </div>
@enderror <div class="mb-2">
</span> <label for="first_name" class="block text-sm font-medium text-gray-700">Firstname:</label>
</div> <input type="text" wire:model.defer="first_name" id="first_name"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Enter your name">
@error('first_name')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</div>
<div class="mb-2">
<label for="last_name" class="block text-sm font-medium text-gray-700">Lastname:</label>
<input type="text" wire:model.defer="last_name" id="last_name"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Enter your name">
@error('last_name')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</div>
<div class="mb-2">
<label for="email" class="block text-sm font-medium text-gray-700">Email:</label>
<input type="email" wire:model.email="email" id="email"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Enter your email">
@error('email')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</div>
<div class="mb-2">
<label for="phone" class="block text-sm font-medium text-gray-700">Phone:</label>
<input type="text" wire:model.defer="phone" id="phone"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Enter your name">
@error('phone')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</div>
<div wire:ignore class="mb-2">
<label for="group" class="block text-sm font-medium text-gray-700">Add Groups:</label>
<span class="relative flex w-full">
<input class="mt-1.5 relative flex w-full" wire:ignore x-data="{ groupLists: @entangle('group_lists') }"
x-init="groupLists = @js($userGroups);
const tempGroup = pages.groupSelect;
pages.fetchGroups(tempGroup).then(() => {
$el._x_tom = new Tom($el, {
...tempGroup.group,
onChange: (value) => {
groupLists = value;
}
});
$el._x_tom.setValue(groupLists);
tomGReady = true
})" type="text">
</span>
</div>
<div class="mb-2">
<button type="button" @click="changePassword = !changePassword"
class="btn border bg-gray-300 border-gray-300 font-medium text-gray-800 hover:text-white focus:text-white hover:bg-gray-500 focus:bg-gray-500 active:bg-gray-150/80 dark:border-navy-450 dark:text-navy-50 dark:hover:bg-navy-500 dark:focus:bg-navy-500 dark:active:bg-navy-500/90">
Change Password
</button>
</div>
<div x-show="changePassword">
<div class="mb-2">
<label for="current_password" class="block text-sm font-medium text-gray-700">Current Password:</label>
<input type="password" wire:model.defer="current_password" id="current_password"
class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
placeholder="Current Password">
@error('current_password')
<span class="text-red-500 text-xs">{{ $message }}</span>
@enderror
<div class="flex items-center " wire:ignore>
<span class="w-2/12 mr-2">Add Groups:</span>
<span class="relative flex w-full">
<input class="mt-1.5 relative flex w-1/2" wire:ignore x-data="{ groupLists: @entangle('group_lists') }"
x-init="groupLists = @js($userGroups);
const tempGroup = pages.groupSelect;
pages.fetchGroups(tempGroup).then(() => {
$el._x_tom = new Tom($el, {
...tempGroup.group,
onChange: (value) => {
groupLists = value;
}
});
$el._x_tom.setValue(groupLists);
tomGReady = true
})" type="text">
</span>
</div>
<!-- Toggle Button for Change Password -->
<div class="flex items-center">
<button type="button" @click="changePassword = !changePassword"
class="btn border bg-gray-300 border-gray-300 font-medium text-gray-800 hover:text-white focus:text-white hover:bg-gray-500 focus:bg-gray-500 active:bg-gray-150/80 dark:border-navy-450 dark:text-navy-50 dark:hover:bg-navy-500 dark:focus:bg-navy-500 dark:active:bg-navy-500/90">
Change Password
</button>
</div> </div>
<!-- Password Fields (Hidden by Default) --> <div class="mb-2">
<div x-show="changePassword"> <label for="new_password" class="block text-sm font-medium text-gray-700">New Password:</label>
<div class="flex items-center mt-4"> <input type="password" wire:model.defer="new_password" id="new_password"
<label class="w-2/12 mr-2"> class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
<span>Current Password:</span> placeholder="Current Password">
</label> @error('new_password')
<span class="relative flex w-full"> <span class="text-red-500 text-xs">{{ $message }}</span>
<input wire:model.defer="current_password" @enderror
class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
placeholder="Current Password" name="current_password" type="password" /> </div>
@error('current_password')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</span>
</div>
<div class="flex items-center mt-4"> <div class="mb-2">
<label class="w-2/12 mr-2"> <label for="new_password_confirmation" class="block text-sm font-medium text-gray-700">Confirm New Password:</label>
<span>New Password:</span> <input type="password" wire:model.defer="new_password_confirmation" id="new_password_confirmation"
</label> class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary focus:border-primary sm:text-sm"
<span class="relative flex w-full"> placeholder="Current Password">
<input wire:model.defer="new_password" @error('new_password_confirmation')
class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent" <span class="text-red-500 text-xs">{{ $message }}</span>
placeholder="New Password" name="new_password" type="password" /> @enderror
@error('new_password')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</span>
</div>
<div class="flex items-center mt-4">
<label class="w-2/12 mr-2">
<span>Confirm New Password:</span>
</label>
<span class="relative flex w-full">
<input wire:model.defer="new_password_confirmation"
class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
placeholder="Confirm New Password" name="new_password_confirmation" type="password" />
@error('new_password_confirmation')
<span class="text-red-500 text-md self-center ml-4">{{ $message }}</span>
@enderror
</span>
</div>
</div> </div>
</div> </div>
<div class="grid grid-cols-12 justify-center space-x-2 pt-4">
<span wire:click="goBack" <div class="flex justify-end space-x-4 mt-3">
class="col-start-4 btn border border-slate-300 font-medium text-slate-800 hover:bg-slate-150 focus:bg-slate-150 active:bg-slate-150/80 dark:border-navy-450 dark:text-navy-50 dark:hover:bg-navy-500 dark:focus:bg-navy-500 dark:active:bg-navy-500/90"> <button type="button" wire:click="goBack"
Cancel class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md shadow-sm hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-400">Cancel</button>
</span> <button type="submit" type="submit"
<button type="submit" class="px-4 py-2 bg-primary text-white rounded-md shadow-sm hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">Save</button>
class="btn ml-3 bg-primary font-medium text-white hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90 dark:bg-accent dark:hover:bg-accent-focus dark:focus:bg-accent-focus dark:active:bg-accent/90">
Save
</button>
</div> </div>
</div> </form>
</form>
</div> </div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment