Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sarun Mungthanya
SpnPatch-Laravel
Commits
1a4c4e24
Commit
1a4c4e24
authored
Sep 11, 2024
by
Sarun Mungthanya
Browse files
update ui user management
parent
7fe8bcbb
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
app/Http/Livewire/Pages/User/UserCreate.php
View file @
1a4c4e24
...
...
@@ -5,21 +5,22 @@ namespace App\Http\Livewire\Pages\User;
use
Livewire\Component
;
use
App\Models\User
;
use
Illuminate\Support\Facades\Hash
;
use
Str
;
class
UserCreate
extends
Component
{
public
$
name
,
$email
,
$password
,
$password_confirmation
;
public
$
username
,
$first_name
,
$last_name
,
$phone
,
$email
,
$password
,
$password_confirmation
;
public
$description
;
public
$action
;
public
$group_lists
;
protected
$rules
=
[
'name'
=>
'required|string|max:255'
,
'
user
name'
=>
'required|string|max:255'
,
'email'
=>
'required|string|email|max:255|unique:users,email'
,
'password'
=>
'required|string|min:8|confirmed'
,
];
protected
$messages
=
[
'name.required'
=>
'The name field is required.'
,
'
user
name.required'
=>
'The
user
name field is required.'
,
'email.required'
=>
'The email field is required.'
,
'email.email'
=>
'The email must be a valid email address.'
,
'email.unique'
=>
'This email address is already taken.'
,
...
...
@@ -41,8 +42,11 @@ class UserCreate extends Component
{
$this
->
validate
();
$UsereData
=
[
'name'
=>
$this
->
name
,
'uid'
=>
\
Str
::
random
(
40
),
'username'
=>
$this
->
username
,
'first_name'
=>
$this
->
first_name
,
'last_name'
=>
$this
->
last_name
,
'phone'
=>
$this
->
phone
,
'uid'
=>
Str
::
random
(
40
),
'email'
=>
$this
->
email
,
'password'
=>
Hash
::
make
(
$this
->
password
)
];
...
...
@@ -60,17 +64,17 @@ class UserCreate extends Component
}
$this
->
reset
([
'name'
,
'email'
,
'description'
,
'group_lists'
'
user
name'
,
'email'
,
'description'
,
'group_lists'
]);
if
(
auth
()
->
guest
())
{
return
redirect
()
->
route
(
'login'
);
// เปลี่ยนเส้นทางไปยังหน้า register
return
redirect
()
->
route
(
'login'
);
}
$this
->
emit
(
'showUserList'
,
'User successfully created.'
);
}
public
function
goBack
()
{
if
(
auth
()
->
guest
())
{
return
redirect
()
->
route
(
'login'
);
// เปลี่ยนเส้นทางไปยังหน้า register
return
redirect
()
->
route
(
'login'
);
}
$this
->
emit
(
'showUserList'
);
}
...
...
app/Http/Livewire/Pages/User/UserEdit.php
View file @
1a4c4e24
...
...
@@ -11,13 +11,13 @@ class UserEdit extends Component
public
$editUserId
;
public
$userId
;
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
;
protected
function
rules
()
{
$rules
=
[
'name'
=>
'required|string|max:255'
,
'
user
name'
=>
'required|string|max:255'
,
'email'
=>
'required|string|email|max:255|unique:users,email,'
.
$this
->
user
->
id
,
];
...
...
@@ -30,7 +30,7 @@ class UserEdit extends Component
}
protected
$messages
=
[
'name.required'
=>
'The name field is required.'
,
'
user
name.required'
=>
'The
user
name field is required.'
,
'email.required'
=>
'The email field is required.'
,
'email.email'
=>
'The email must be a valid email address.'
,
'email.unique'
=>
'This email address is already taken.'
,
...
...
@@ -45,6 +45,9 @@ class UserEdit extends Component
$this
->
editUserId
=
$editUserId
;
$this
->
user
=
User
::
findOrFail
(
$editUserId
);
$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
->
group_lists
=
$this
->
user
->
groups
()
->
pluck
(
'group_id'
)
->
implode
(
','
);
}
...
...
@@ -69,7 +72,10 @@ class UserEdit extends Component
}
$this
->
user
->
username
=
$this
->
username
;
$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
)
{
$this
->
user
->
password
=
Hash
::
make
(
$this
->
new_password
);
}
...
...
app/Http/Livewire/Pages/User/UserIndex.php
View file @
1a4c4e24
...
...
@@ -15,12 +15,12 @@ class UserIndex extends Component
protected
$paginationTheme
=
'bootstrap'
;
public
$perPage
=
10
;
public
$url
;
public
$searchSelected
=
'name'
;
public
$searchSelected
=
'
user
name'
;
public
$editUserId
;
public
$deleteUserId
;
public
$keyword
=
''
;
public
$route
=
''
;
public
$selectedOption
=
'name'
;
public
$selectedOption
=
'
user
name'
;
public
$searchBy
;
public
$menu
;
public
$action
=
'list'
;
...
...
@@ -39,7 +39,10 @@ class UserIndex extends Component
// $this->message = session('message');
// $this->showMessage = true;
}
public
function
search
()
{
$this
->
resetPage
();
}
public
function
render
()
{
...
...
@@ -59,7 +62,7 @@ class UserIndex extends Component
]);
}
public
function
showUser
Create
Form
()
public
function
showUser
Add
Form
()
{
if
(
!
Auth
::
user
()
->
hasPermissions
([
'add-user'
]))
{
$this
->
showNoPermissionModal
=
TRUE
;
...
...
app/Models/User.php
View file @
1a4c4e24
...
...
@@ -22,6 +22,9 @@ class User extends Authenticatable
protected
$dates
=
[
'deleted_at'
];
protected
$fillable
=
[
'username'
,
'first_name'
,
'last_name'
,
'phone'
,
'uid'
,
'email'
,
'password'
,
...
...
resources/views/components/app-layout.blade.php
View file @
1a4c4e24
...
...
@@ -53,9 +53,9 @@
</style>
</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 }}
@yield('content')
</main>
...
...
resources/views/livewire/pages/patch/patch-create.blade.php
View file @
1a4c4e24
...
...
@@ -163,8 +163,8 @@
</div>
<div
class=
"mb-4"
>
<label
for=
"pdesc"
class=
"block text-gray-700"
>
Patch Desciption
</label>
<
input
type=
"text"
id=
"pdesc"
wire:model.defer=
"PDESC"
class=
"w-full mt-1 p-2 border border-gray-300 rounded-md"
>
<
textarea
id=
"pdesc"
wire:model.defer=
"PDESC"
class=
"w-full mt-1 p-2 border border-gray-300 rounded-md"
rows=
"3"
></textarea
>
</div>
<div
class=
"mb-4"
>
<label
for=
"remark"
class=
"block text-gray-700"
>
Remark
</label>
...
...
resources/views/livewire/pages/patch/patch-edit.blade.php
View file @
1a4c4e24
...
...
@@ -265,8 +265,8 @@
</div>
<div
class=
"mb-4"
>
<label
for=
"pdesc"
class=
"block text-gray-700"
>
Patch Description
</label>
<
input
type=
"text"
id=
"pdesc"
wire:model.defer=
"PDESC"
class=
"w-full mt-1 p-2 border border-gray-300 rounded-md"
>
<
textarea
id=
"pdesc"
wire:model.defer=
"PDESC"
class=
"w-full mt-1 p-2 border border-gray-300 rounded-md"
rows=
"3"
></textarea
>
</div>
<div
class=
"mb-4"
>
<label
for=
"remark"
class=
"block text-gray-700"
>
Remark
</label>
...
...
@@ -276,7 +276,7 @@
<div
class=
"mb-4"
>
<label
for=
"owner"
class=
"block text-gray-700"
>
Owner
</label>
<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
class=
"mb-4"
>
<label
for=
"papprovedate"
class=
"block text-gray-700"
>
Papprovedate
</label>
...
...
resources/views/livewire/pages/user/user-create.blade.php
View file @
1a4c4e24
<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"
>
@csrf
<div
class=
"card pb-4"
>
<div
class=
"my-3 flex h-8 items-center justify-between px-4 sm:px-5"
>
<h2
class=
"font-medium 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
</h2>
<div
class=
"mb-6"
>
<h2
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
</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
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"
>
<label
class=
"w-2/12 mr-2"
>
<span>
Email :
</span>
</label>
<span
class=
"relative flex w-full"
>
<input
wire:model.email=
"email"
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>
<div
class=
"mb-2"
>
<label
for=
"password_confirmation"
class=
"block text-sm font-medium text-gray-700"
>
Confirm
Password:
</label>
<input
type=
"password"
wire:model.defer=
"password_confirmation"
id=
"password_confirmation"
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=
"Confirm your password"
>
@error('password_confirmation')
<span
class=
"text-red-500 text-xs"
>
{{ $message }}
</span>
@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
class=
"grid grid-cols-12 justify-center space-x-2 pt-4"
>
<span
wire:click=
"goBack"
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"
>
Cancel
<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"
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>
<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>
</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>
resources/views/livewire/pages/user/user-edit.blade.php
View file @
1a4c4e24
<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"
>
@csrf
<div
class=
"card pb-4"
>
<div
class=
"my-3 flex h-8 items-center justify-between px-4 sm:px-5"
>
<h2
class=
"font-medium 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
</h2>
</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=
"mb-6"
>
<h2
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
</h2>
</div>
<div
class=
"flex items-center"
>
<label
class=
"w-2/12 mr-2"
>
<span>
Email:
</span>
</label>
<span
class=
"relative flex w-full"
>
<input
wire:model.defer=
"email"
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=
"Email"
name=
"email"
type=
"email"
/>
@error('email')
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
@enderror
</span>
</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
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>
<!-- Password Fields (Hidden by Default) -->
<div
x-show=
"changePassword"
>
<div
class=
"flex items-center mt-4"
>
<label
class=
"w-2/12 mr-2"
>
<span>
Current Password:
</span>
</label>
<span
class=
"relative flex w-full"
>
<input
wire:model.defer=
"current_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=
"Current Password"
name=
"current_password"
type=
"password"
/>
@error('current_password')
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
@enderror
</span>
</div>
<div
class=
"mb-2"
>
<label
for=
"new_password"
class=
"block text-sm font-medium text-gray-700"
>
New Password:
</label>
<input
type=
"password"
wire:model.defer=
"new_password"
id=
"new_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('new_password')
<span
class=
"text-red-500 text-xs"
>
{{ $message }}
</span>
@enderror
</div>
<div
class=
"flex items-center mt-4"
>
<label
class=
"w-2/12 mr-2"
>
<span>
New Password:
</span>
</label>
<span
class=
"relative flex w-full"
>
<input
wire:model.defer=
"new_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=
"New Password"
name=
"new_password"
type=
"password"
/>
@error('new_password')
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
@enderror
</span>
</div>
<div
class=
"mb-2"
>
<label
for=
"new_password_confirmation"
class=
"block text-sm font-medium text-gray-700"
>
Confirm New Password:
</label>
<input
type=
"password"
wire:model.defer=
"new_password_confirmation"
id=
"new_password_confirmation"
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('new_password_confirmation')
<span
class=
"text-red-500 text-xs"
>
{{ $message }}
</span>
@enderror
<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
class=
"grid grid-cols-12 justify-center space-x-2 pt-4"
>
<span
wire:click=
"goBack"
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"
>
Cancel
</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
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>
</div>
</form>
</form>
</div>
resources/views/livewire/pages/user/user-index.blade.php
View file @
1a4c4e24
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment