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
Show 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;
...
@@ -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'
,
'
user
name'
=>
'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.'
,
'
user
name.required'
=>
'The
user
name 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'
'
user
name'
,
'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'
);
}
}
...
...
app/Http/Livewire/Pages/User/UserEdit.php
View file @
1a4c4e24
...
@@ -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'
,
'
user
name'
=>
'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.'
,
'
user
name.required'
=>
'The
user
name 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,6 +72,9 @@ class UserEdit extends Component
...
@@ -69,6 +72,9 @@ 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
);
...
...
app/Http/Livewire/Pages/User/UserIndex.php
View file @
1a4c4e24
...
@@ -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
=
'
user
name'
;
public
$editUserId
;
public
$editUserId
;
public
$deleteUserId
;
public
$deleteUserId
;
public
$keyword
=
''
;
public
$keyword
=
''
;
public
$route
=
''
;
public
$route
=
''
;
public
$selectedOption
=
'name'
;
public
$selectedOption
=
'
user
name'
;
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
showUser
Create
Form
()
public
function
showUser
Add
Form
()
{
{
if
(
!
Auth
::
user
()
->
hasPermissions
([
'add-user'
]))
{
if
(
!
Auth
::
user
()
->
hasPermissions
([
'add-user'
]))
{
$this
->
showNoPermissionModal
=
TRUE
;
$this
->
showNoPermissionModal
=
TRUE
;
...
...
app/Models/User.php
View file @
1a4c4e24
...
@@ -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'
,
...
...
resources/views/components/app-layout.blade.php
View file @
1a4c4e24
...
@@ -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>
...
...
resources/views/livewire/pages/patch/patch-create.blade.php
View file @
1a4c4e24
...
@@ -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>
...
...
resources/views/livewire/pages/patch/patch-edit.blade.php
View file @
1a4c4e24
...
@@ -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>
...
...
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"
>
<form
wire:submit.prevent=
"submitForm"
>
@csrf
@csrf
<div
class=
"
card p
b-
4
"
>
<div
class=
"
m
b-
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>
</div>
<div
class=
"w-3/4 px-3 space-y-3 m-auto mb-4"
>
<div
class=
"flex items-center"
>
<form
class=
"space-y-6"
>
<label
class=
"w-2/12 mr-2"
>
<div
class=
"mb-2"
>
<span>
Name :
</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=
"name"
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=
""
name=
"name"
type=
"text"
value=
"{{ old('name') }}"
/>
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
@error('name')
@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>
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
@enderror
@enderror
</span>
</div>
</div>
<div
class=
"flex items-center"
>
<div
class=
"mb-2"
>
<label
class=
"w-2/12 mr-2"
>
<label
for=
"email"
class=
"block text-sm font-medium text-gray-700"
>
Email:
</label>
<span>
Email :
</span>
<input
type=
"email"
wire:model.email=
"email"
id=
"email"
</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=
"Enter your email"
>
<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')
@error('email')
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
@enderror
@enderror
</span>
</div>
</div>
<div
class=
"flex items-center"
>
<div
class=
"mb-2"
>
<label
class=
"w-2/12 mr-2"
>
<label
for=
"phone"
class=
"block text-sm font-medium text-gray-700"
>
Phone:
</label>
<span>
Password :
</span>
<input
type=
"text"
wire:model.defer=
"phone"
id=
"phone"
</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=
"Enter your name"
>
<input
wire:model.password=
"password"
@error('phone')
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>
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
@enderror
@enderror
</span>
</div>
</div>
<div
class=
"flex items-center"
>
<div
class=
"mb-2"
>
<label
class=
"w-2/12 mr-2"
>
<label
for=
"password"
class=
"block text-sm font-medium text-gray-700"
>
Password:
</label>
<span>
Confirm Password :
</span>
<input
type=
"password"
wire:model.password=
"password"
id=
"password"
</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=
"Enter your password"
>
<input
wire:model.defer=
"password_confirmation"
@error('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"
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
placeholder=
""
name=
"password_confirmation"
type=
"password"
/>
@enderror
</span>
</div>
</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')
@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
>
</div
>
<label
class=
"w-2/12 mr-2"
>
<
span>
Add Groups :
</span
>
<
div
wire:ignore
class=
"mb-2"
>
</label>
<label
for=
"group"
class=
"block text-sm font-medium text-gray-700"
>
Add Groups:
</label>
<span
class=
"relative flex w-full"
>
<span
class=
"relative flex w-full"
>
<input
class=
"mt-1.5 relative flex w-2/4"
wire:ignore
x-data=
"{ groupLists: @entangle('group_lists') }"
<input
class=
"mt-1.5 relative flex w-full"
x-data=
"{ groupLists: @entangle('group_lists') }"
x-init=
"groupLists = [];
x-init=
"groupLists = [];
const tempGroup = pages.groupSelect;
const tempGroup = pages.groupSelect;
pages.fetchGroups(tempGroup).then(() => {
pages.fetchGroups(tempGroup).then(() => {
$el._x_tom = new Tom($el, {
$el._x_tom = new Tom($el, {
...
@@ -78,21 +88,16 @@
...
@@ -78,21 +88,16 @@
groupLists = value;
groupLists = value;
}
}
});
});
})"
type=
"text"
>
})"
type=
"text"
>
</span>
</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>
</div>
<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>
</form>
</div>
</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"
>
<form
wire:submit.prevent=
"submitEditForm"
>
@csrf
@csrf
<div
class=
"
card p
b-
4
"
>
<div
class=
"
m
b-
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"
>
<form
class=
"space-y-6"
>
<label
class=
"w-2/12 mr-2"
>
<div
class=
"mb-2"
>
<span>
Name:
</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=
"name"
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=
"Name"
name=
"name"
type=
"text"
/>
@error('name')
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
@enderror
@enderror
</span>
</div>
</div>
<div
class=
"mb-2"
>
<div
class=
"flex items-center"
>
<label
for=
"first_name"
class=
"block text-sm font-medium text-gray-700"
>
Firstname:
</label>
<label
class=
"w-2/12 mr-2"
>
<input
type=
"text"
wire:model.defer=
"first_name"
id=
"first_name"
<span>
Email:
</span>
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"
</label>
placeholder=
"Enter your name"
>
<span
class=
"relative flex w-full"
>
@error('first_name')
<input
wire:model.defer=
"email"
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
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"
@enderror
placeholder=
"Email"
name=
"email"
type=
"email"
/>
</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')
@error('email')
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
<span
class=
"text-red-500 text-md self-center ml-4"
>
{{ $message }}
</span>
@enderror
@enderror
</span>
</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>
<div
wire:ignore
class=
"mb-2"
>
<label
for=
"group"
class=
"block text-sm font-medium text-gray-700"
>
Add Groups:
</label>
<div
class=
"flex items-center "
wire:ignore
>
<span
class=
"w-2/12 mr-2"
>
Add Groups:
</span>
<span
class=
"relative flex w-full"
>
<span
class=
"relative flex w-full"
>
<input
class=
"mt-1.5 relative flex w-
1/2
"
wire:ignore
x-data=
"{ groupLists: @entangle('group_lists') }"
<input
class=
"mt-1.5 relative flex w-
full
"
wire:ignore
x-data=
"{ groupLists: @entangle('group_lists') }"
x-init=
"groupLists = @js($userGroups);
x-init=
"groupLists = @js($userGroups);
const tempGroup = pages.groupSelect;
const tempGroup = pages.groupSelect;
pages.fetchGroups(tempGroup).then(() => {
pages.fetchGroups(tempGroup).then(() => {
...
@@ -56,69 +73,53 @@
...
@@ -56,69 +73,53 @@
})"
type=
"text"
>
})"
type=
"text"
>
</span>
</span>
</div>
</div>
<!-- Toggle Button for Change Password -->
<div
class=
"
flex items-center
"
>
<div
class=
"
mb-2
"
>
<button
type=
"button"
@
click=
"changePassword = !changePassword"
<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"
>
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
Change Password
</button>
</button>
</div>
</div>
<!-- Password Fields (Hidden by Default) -->
<div
x-show=
"changePassword"
>
<div
x-show=
"changePassword"
>
<div
class=
"flex items-center mt-4"
>
<div
class=
"mb-2"
>
<label
class=
"w-2/12 mr-2"
>
<label
for=
"current_password"
class=
"block text-sm font-medium text-gray-700"
>
Current Password:
</label>
<span>
Current Password:
</span>
<input
type=
"password"
wire:model.defer=
"current_password"
id=
"current_password"
</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=
"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')
@error('current_password')
<span
class=
"text-red-500 text-
md self-center ml-4
"
>
{{ $message }}
</span>
<span
class=
"text-red-500 text-
xs
"
>
{{ $message }}
</span>
@enderror
@enderror
</span>
</div>
</div>
<div
class=
"flex items-center mt-4"
>
<div
class=
"mb-2"
>
<label
class=
"w-2/12 mr-2"
>
<label
for=
"new_password"
class=
"block text-sm font-medium text-gray-700"
>
New Password:
</label>
<span>
New Password:
</span>
<input
type=
"password"
wire:model.defer=
"new_password"
id=
"new_password"
</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"
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')
@error('new_password')
<span
class=
"text-red-500 text-
md self-center ml-4
"
>
{{ $message }}
</span>
<span
class=
"text-red-500 text-
xs
"
>
{{ $message }}
</span>
@enderror
@enderror
</span>
</div>
</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>
Confirm 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_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')
@error('new_password_confirmation')
<span
class=
"text-red-500 text-
md self-center ml-4
"
>
{{ $message }}
</span>
<span
class=
"text-red-500 text-
xs
"
>
{{ $message }}
</span>
@enderror
@enderror
</span>
</div>
</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>
</div>
<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>
</div>
resources/views/livewire/pages/user/user-index.blade.php
View file @
1a4c4e24
<div>
<div
class=
"border-0 shadow-none"
>
@include('components.no-permission')
`
<div
wire:loading.class=
""
wire:loading.class.remove=
"hidden"
wire:target=
"save"
class=
"absolute inset-0 items-center justify-center z-50 bg-slate-50 dark:bg-navy-900 hidden"
>
<div
class=
"flex items-center space-x-4 py-5 lg:py-6 "
>
<div
class=
"flex justify-center items-center "
>
<ul
class=
"hidden flex-wrap items-center space-x-2 sm:flex"
>
<div
class=
"items-center h-100vh"
style=
"align-content: center;"
>
<li
class=
"flex items-center space-x-2"
>
<div
class=
"animate-spin rounded-full h-32 w-32 border-t-2 border-b-2 border-blue-500"
></div>
<a
class=
"text-primary transition-colors hover:text-primary-focus dark:text-accent-light dark:hover:text-accent"
href=
"/"
>
Home
</a>
<svg
x-ignore
xmlns=
"http://www.w3.org/2000/svg"
class=
"h-4 w-4"
fill=
"none"
viewBox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M9 5l7 7-7 7"
/>
</svg>
</li>
<li
class=
"flex items-center space-x-2"
>
<a
class=
"text-primary transition-colors hover:text-primary-focus dark:text-accent-light dark:hover:text-accent"
wire:click=
"$emit('menuClicked', 'User')"
>
User Management
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div
class=
"m-2"
>
{{--
<div
wire:loading.class=
"flex"
wire:loading.class.remove=
"hidden"
class=
"absolute inset-0 items-center justify-center z-50 bg-slate-50 dark:bg-navy-900 hidden"
>
<div
class=
"flex justify-center items-center "
>
<div
class=
"animate-spin rounded-full h-32 w-32 border-t-2 border-b-2 border-blue-500"
></div>
</div>
</div>
--}}
@if ($action === 'list')
@if ($action === 'list')
@if ($message)
<div
x-data=
"{ show: @entangle('showMessage'), message: '' }"
x-init=
"window.addEventListener('show-message', event => {
<div
class=
"alert alert-success"
>
<div
wire:ignore
x-data=
"{ show: true }"
x-init=
"setTimeout(() => show = false, 3000)"
show = true;
x-show.transition.duration.500ms=
"show"
message = event.detail.message;
console.log(show, message);
setTimeout(() => { show = false, console.log(show, message); }, 3000);
});"
>
<div
x-show.transition.duration.500ms=
"show"
class=
"fixed top-5 right-5 z-50 bg-green-500 text-white py-2 px-4 rounded-md shadow-lg"
>
class=
"fixed top-5 right-5 z-50 bg-green-500 text-white py-2 px-4 rounded-md shadow-lg"
>
{{ $message }}
{{ $message }}
</div>
</div>
</div>
</div>
<div
x-data=
"{
@endif
showDeleteListModal: @entangle('showDeleteListModal'),
<div
class=
"grid grid-cols-1 gap-4 sm:gap-5 lg:gap-6 bg-main-container rounded-md"
>
showAlert: false,
<div
class=
"my-1 flex h-8 items-center justify-between px-4 sm:px-5"
>
toggleGroup(event) {
<h2
class=
"text-2xl text-black "
>
const groupId = event.target.value;
if (event.target.checked) {
if (!this.selectedUsersAlpine.includes(groupId)) {
this.selectedUsersAlpine.push(groupId);
}
} else {
this.selectedUsersAlpine = this.selectedUsersAlpine.filter(id => id !== groupId);
}
},
selectedUsersAlpine: [],
selectedUsers: @entangle('selectedUsers')
}"
class=
"grid grid-cols-1 gap-4 sm:gap-5 lg:gap-6 "
>
<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"
>
User Management
User Management
</h2>
</h2>
</div>
</div>
{{-- @include('components/search-by', ['searchBy' => $searchBy ?? []]) --}}
<div
class=
"pb-4 pt-5 bg-white rounded-lg shadow-lg"
>
<div
class=
"flex justify-between"
>
<div
class=
"flex justify-between"
>
<div
class=
"px-2 ml-4"
>
<div
class=
"px-2 ml-4"
>
<button
wire:click=
"showUserCreateForm()"
<button
type=
"button"
class=
"py-2 px-3 bg-primary rounded-md text-white hover:bg-primary-focus"
class=
"btn h-6 w-28 rounded space-x-1 bg-primary px-3 text-xs 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"
>
wire:click=
"showUserAddForm"
>
Add
</button>
<svg
xmlns=
"http://www.w3.org/2000/svg"
fill=
"none"
viewBox=
"0 0 24 24"
stroke-width=
"1.5"
stroke=
"currentColor"
class=
"w-3 h-3"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
d=
"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"
>
</path>
</svg>
<span>
Create
</span>
</button>
<a
@
click.prevent=
"if (selectedUsersAlpine.length > 0) { showDeleteListModal = true; } else { showAlert = true;}"
class=
"btn h-6 w-28 rounded space-x-1 bg-primary px-3 text-xs 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"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
fill=
"none"
viewBox=
"0 0 24 24"
stroke-width=
"1.5"
stroke=
"currentColor"
class=
"w-3 h-3"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
d=
"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"
>
</path>
</svg>
<span>
Delete
</span>
</a>
</div>
</div>
<div
class=
"inline-flex flex-initial"
>
<div
class=
"inline-flex flex-initial"
>
<div
x-data=
"{ isInputActive: true }"
>
<div
x-data=
"{ isInputActive: true }"
>
<div
class=
"flex gap-
3
px-5 items-center"
>
<div
class=
"flex gap-
4
px-5 items-center"
>
<button
@
click=
"isInputActive = !isInputActive"
<button
@
click=
"isInputActive = !isInputActive"
class=
"btn h-8 w-10 rounded-full p-0 hover:bg-
slate-300/20 focus:bg-slate-300/20 active:bg-slate-300/25
dark:hover:bg-navy-300/20 dark:focus:bg-navy-300/20 dark:active:bg-navy-300/25"
>
class=
"btn h-8 w-10 rounded-full p-0 hover:bg-
primary-focus hover:text-main-container active:text-main-container focus:text-main-container primary-focus hover:text-main-container active:text-main-container focus:text-main-container
dark:hover:bg-navy-300/20 dark:focus:bg-navy-300/20 dark:active:bg-navy-300/25"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
class=
"h-4.5 w-4.5"
fill=
"none"
<svg
xmlns=
"http://www.w3.org/2000/svg"
class=
"h-4.5 w-4.5"
fill=
"none"
viewBox=
"0 0 24 24"
stroke=
"currentColor"
>
viewBox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"1.5"
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"1.5"
...
@@ -93,53 +51,56 @@
...
@@ -93,53 +51,56 @@
<span
class=
"w-64"
x-show=
"isInputActive === true"
>
<span
class=
"w-64"
x-show=
"isInputActive === true"
>
<input
<input
class=
"form-input h-9 peer w-full rounded-lg border border-slate-300 bg-transparent px-3 py-2 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"
class=
"form-input h-9 peer w-full rounded-lg border border-slate-300 bg-transparent px-3 py-2 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=
"Search Keyword"
type=
"text"
wire:model=
"keyword"
/>
placeholder=
"Search Keyword"
type=
"text"
wire:model
.defer
=
"keyword"
/>
</span>
</span>
<span
class=
"w-52"
x-show=
"isInputActive === true"
>
<span
class=
"w-52"
x-show=
"isInputActive === true"
>
<select
wire:model=
"searchSelected"
<select
wire:model
.defer
=
"searchSelected"
class=
"form-select h-9 w-full rounded-lg border border-slate-300 bg-
white
px-3 py-2 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:bg-navy-700 dark:hover:border-navy-400 dark:focus:border-accent"
>
class=
"form-select h-9 w-full rounded-lg border border-slate-300 bg-
main-container
px-3 py-2 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:bg-navy-700 dark:hover:border-navy-400 dark:focus:border-accent"
>
@foreach ($searchBy as $key => $by)
@foreach ($searchBy as $key => $by)
<option
value=
"{{ $key }}"
>
{{ $by }}
</option>
<option
value=
"{{ $key }}"
>
{{ $by }}
</option>
@endforeach
@endforeach
</select>
</select>
</span>
</span>
<button
type=
"button"
class=
"bg-primary text-white px-4 py-2 rounded hover:bg-primary-focus"
wire:click=
"search"
>
Search
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@include('livewire.select-atleast-modal')
<div
class=
"mx-3 mt-3 px-4"
>
<div
class=
"mx-3 mt-3 px-4"
>
<div
class=
"is-scrollbar-hidden min-w-full
overflow-x-auto
"
x-data=
"pages.tables.initExample1"
>
<div
class=
"is-scrollbar-hidden min-w-full
table-responsive
"
x-data=
"pages.tables.initExample1"
>
<table
class=
"is-hoverable w-full text-left
"
>
<table
class=
"is-hoverable
table
w-full text-left
border-b"
>
<thead>
<thead>
<tr>
<tr>
<th
<th
class=
"whitespace-nowrap rounded-tl-lg bg-slate-
2
00 px-4 py-3 font-semibold uppercase text-
s
la
te-800
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
class=
"whitespace-nowrap rounded-tl-lg bg-slate-
3
00 px-4 py-3 font-semibold uppercase text-
b
la
ck
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
#
#
</th>
</th>
<th
<th
class=
"whitespace-nowrap bg-slate-
2
00 px-4 py-3 font-semibold uppercase text-
s
la
te-800
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
class=
"whitespace-nowrap bg-slate-
3
00 px-4 py-3 font-semibold uppercase text-
b
la
ck
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
Name
Name
</th>
</th>
<th
<th
class=
"whitespace-nowrap bg-slate-
2
00 px-4 py-3 font-semibold uppercase text-
s
la
te-800
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
class=
"whitespace-nowrap bg-slate-
3
00 px-4 py-3 font-semibold uppercase text-
b
la
ck
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
Email
Email
</th>
</th>
<th
<th
class=
"whitespace-nowrap bg-slate-
2
00 px-4 py-3 font-semibold uppercase text-
s
la
te-800
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
class=
"whitespace-nowrap bg-slate-
3
00 px-4 py-3 font-semibold uppercase text-
b
la
ck
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
Group
Group
</th>
</th>
<th
<th
class=
"whitespace-nowrap bg-slate-
2
00 px-4 py-3 font-semibold uppercase text-
s
la
te-800
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
class=
"whitespace-nowrap bg-slate-
3
00 px-4 py-3 font-semibold uppercase text-
b
la
ck
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
Create Date
Create Date
</th>
</th>
<th
<th
class=
"whitespace-nowrap rounded-tr-lg bg-slate-
2
00 px-4 py-3 font-semibold uppercase text-
s
la
te-800
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
class=
"whitespace-nowrap rounded-tr-lg bg-slate-
3
00 px-4 py-3 font-semibold uppercase text-
b
la
ck
dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
Action
Action
</th>
</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
@foreach ($results as $user)
@foreach ($results as $user)
<tr
class=
"border-y border-transparent border-b-slate-200 dark:border-b-navy-500"
>
<tr
class=
"border-y border-transparent border-b-slate-200 dark:border-b-navy-500"
>
<td
class=
"whitespace-nowrap px-4 py-3 sm:px-5"
>
<td
class=
"whitespace-nowrap px-4 py-3 sm:px-5"
>
...
@@ -154,7 +115,7 @@
...
@@ -154,7 +115,7 @@
<td
class=
"whitespace-nowrap px-4 py-3 sm:px-5"
>
{{ $user->email }}
</td>
<td
class=
"whitespace-nowrap px-4 py-3 sm:px-5"
>
{{ $user->email }}
</td>
<td
class=
"whitespace-nowrap px-4 py-3 sm:px-5"
>
<td
class=
"whitespace-nowrap px-4 py-3 sm:px-5"
>
@php
@php
$groups = $user->groups->take(5);
// Take the first 5 groups
$groups = $user->groups->take(5);
$remainingCount = $user->groups->count() - $groups->count();
$remainingCount = $user->groups->count() - $groups->count();
@endphp
@endphp
...
@@ -170,26 +131,23 @@
...
@@ -170,26 +131,23 @@
@endif
@endif
</td>
</td>
<td
class=
"whitespace-nowrap px-4 py-3 sm:px-5"
>
{{ $user->created_at }}
</td>
<td
class=
"whitespace-nowrap px-4 py-3 sm:px-5"
>
{{ $user->created_at }}
</td>
<td
class=
"whitespace-nowrap px-
4
py-3 sm:px-
5
"
>
<td
class=
"whitespace-nowrap px-
1
py-3 sm:px-
2
"
>
<div
class=
"flex justify-center space-x-2"
>
<div
class=
"flex justify-center space-x-2"
>
<a
wire:click=
"showUserEditForm({{ $user->id }})"
<a
wire:click=
"showUserEditForm({{ $user->id }})"
class=
"btn h-8 w-8 p-0
text-info hover:bg-info/20 focus:bg-info/20
active:bg-info/25"
>
class=
"btn h-8 w-8 p-0
hover:text-main-container active:text-main-container hover:primary-focus focus:primary-focus
active:bg-info/25"
>
<i
class=
"fa fa-edit"
></i>
<i
class=
"fa fa-edit"
></i>
</a>
</a>
<div>
<a
@
click=
"$wire.emit('showDeleteModal', {{ $user->id }})"
<a
@
click=
"$wire.emit('showDeleteModal', {{ $user->id }})"
class=
"btn h-8 w-8 p-0
text-error hover:bg-error/20 focus:bg-error/20
active:bg-
error
/25"
>
class=
"btn h-8 w-8 p-0
hover:text-main-container active:text-main-container hover:primary-focus focus:primary-focus
active:bg-
info
/25"
>
<i
class=
"fa fa-trash
-alt
"
></i>
<i
class=
"fa fa-trash"
></i>
</a>
</a>
</div>
</div>
</div>
</td>
</td>
</tr>
</tr>
@endforeach
@endforeach
</tbody>
</tbody>
</table>
</table>
</div>
</div>
<template
x-if=
"showDeleteListModal"
>
<template
x-if=
"showDeleteListModal"
>
<div
class=
"fixed inset-0 z-[100] flex flex-col items-center justify-center overflow-hidden px-4 py-6 sm:px-5"
<div
class=
"fixed inset-0 z-[100] flex flex-col items-center justify-center overflow-hidden px-4 py-6 sm:px-5"
@
keydown.window.escape=
"showDeleteListModal = false"
>
@
keydown.window.escape=
"showDeleteListModal = false"
>
...
@@ -223,18 +181,13 @@
...
@@ -223,18 +181,13 @@
</div>
</div>
</template>
</template>
<livewire:delete-modal
/>
<livewire:delete-modal
/>
{{ $results->links('livewire.paginate-custom') }}
{{ $results->links('livewire.paginate-custom') }}
</div>
</div>
</div>
</div>
{{--
<div
class=
"px-4"
>
<div
x-data=
"pages.basicTable.initGridTable({{ $json_columns }}, {{ $users }}, {{ $paginate }}, '{{ $url }}', {{ json_encode($permission) }})"
></div>
</div>
--}}
</div>
</div>
@elseif($action === 'create')
@elseif($action === 'create')
<livewire:pages.user.user-create
wire:key=
"user-create"
/>
<livewire:pages.user.user-create
wire:key=
"user-create"
/>
@elseif($action === 'edit')
@elseif($action === 'edit')
...
@@ -242,4 +195,6 @@
...
@@ -242,4 +195,6 @@
@else
@else
<div></div>
<div></div>
@endif
@endif
</div>
</div>
</div>
\ No newline at end of file
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