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
7aa8d437
Commit
7aa8d437
authored
Jul 05, 2024
by
Sarun Mungthanya
Browse files
update load spn patch
parent
930e8709
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Http/Livewire/Pages/SendPatch/SendPatchEdit.php
View file @
7aa8d437
...
@@ -11,7 +11,7 @@ use Livewire\Component;
...
@@ -11,7 +11,7 @@ use Livewire\Component;
class
SendPatchEdit
extends
Component
class
SendPatchEdit
extends
Component
{
{
public
$PID
,
$
test
;
public
$PID
,
$
serverKeyOption
;
public
$perPage
=
10
;
public
$perPage
=
10
;
public
$search
=
''
;
public
$search
=
''
;
public
$server_lists
;
public
$server_lists
;
...
@@ -20,7 +20,7 @@ class SendPatchEdit extends Component
...
@@ -20,7 +20,7 @@ class SendPatchEdit extends Component
public
$searchSelected
=
'SNKEY'
;
public
$searchSelected
=
'SNKEY'
;
public
$keyword
=
''
;
public
$keyword
=
''
;
public
$selectedPenddings
=
[];
public
$selectedPenddings
=
[];
protected
$listeners
=
[
'deletePatch'
,
'refreshComponent'
=>
'$refresh'
];
protected
$listeners
=
[
'deletePatch'
,
'refreshComponent'
=>
'$refresh'
];
public
function
mount
(
$editPid
)
public
function
mount
(
$editPid
)
{
{
// $this->PID = $editPid;
// $this->PID = $editPid;
...
@@ -28,34 +28,45 @@ class SendPatchEdit extends Component
...
@@ -28,34 +28,45 @@ class SendPatchEdit extends Component
$this
->
updateServerLists
();
$this
->
updateServerLists
();
}
}
public
function
updatedSelectedOwnerType
()
public
function
updatedSelectedOwnerType
(
$value
)
{
{
$this
->
updateServerLists
();
if
(
!
empty
(
$value
))
{
// อัปเดต serverKeyOption โดยพิจารณาจาก owner type ที่เลือก
$this
->
serverKeyOption
=
$this
->
fetchServerKeyOption
(
$value
);
}
else
{
$this
->
serverKeyOption
=
[];
}
}
}
p
ublic
function
updatedSearch
(
)
p
rotected
function
fetchServerKeyOption
(
$ownerType
)
{
{
$this
->
updateServerLists
();
$query
=
ConfServerLicense
::
query
();
if
(
$ownerType
)
{
$query
->
where
(
'OWNERTYPE'
,
$ownerType
);
}
if
(
$this
->
search
)
{
$query
->
where
(
'SNKEY'
,
'like'
,
'%'
.
$this
->
search
.
'%'
);
}
return
$query
->
get
([
'ID as id'
,
'SNKEY as name'
])
->
toArray
();
}
}
private
function
updateServerLists
()
public
function
render
()
{
{
//
$query = ConfServerLicense::query();
$query
=
ConfServerLicense
::
query
();
//
if ($this->selectedOwnerType) {
if
(
$this
->
selectedOwnerType
)
{
//
$query->where('OWNERTYPE', $this->selectedOwnerType);
$query
->
where
(
'OWNERTYPE'
,
$this
->
selectedOwnerType
);
//
}
}
//
if ($this->search) {
if
(
$this
->
search
)
{
//
$query->where('SNKEY', 'like', '%' . $this->search . '%');
$query
->
where
(
'SNKEY'
,
'like'
,
'%'
.
$this
->
search
.
'%'
);
//
}
}
//
$this->server
_lists
= $query->
limit(20)->
get(['ID as id', 'SNKEY as name'])->toArray();
$this
->
server
KeyOption
=
$query
->
get
([
'ID as id'
,
'SNKEY as name'
])
->
toArray
();
// // dd( $this->server_lists);
// // dd( $this->server_lists);
}
public
function
render
()
{
$ownerType
=
ConfServerOwnertype
::
all
();
$ownerType
=
ConfServerOwnertype
::
all
();
$results
=
$this
->
searchSelected
&&
$this
->
keyword
$results
=
$this
->
searchSelected
&&
$this
->
keyword
...
@@ -95,7 +106,6 @@ class SendPatchEdit extends Component
...
@@ -95,7 +106,6 @@ class SendPatchEdit extends Component
$this
->
server_lists
=
[];
$this
->
server_lists
=
[];
}
}
}
}
}
}
public
function
resendPatch
(
$serverId
)
public
function
resendPatch
(
$serverId
)
...
@@ -108,7 +118,6 @@ class SendPatchEdit extends Component
...
@@ -108,7 +118,6 @@ class SendPatchEdit extends Component
// $pendding->TaskFinish = '0000_00_00 00:00:00';
// $pendding->TaskFinish = '0000_00_00 00:00:00';
// $pendding->save();
// $pendding->save();
static
::
logSendPatch
(
$this
->
PID
,
$serverId
,
"Reload Patch"
);
static
::
logSendPatch
(
$this
->
PID
,
$serverId
,
"Reload Patch"
);
}
}
public
function
deletePatch
(
$serverId
)
public
function
deletePatch
(
$serverId
)
{
{
...
@@ -130,7 +139,6 @@ class SendPatchEdit extends Component
...
@@ -130,7 +139,6 @@ class SendPatchEdit extends Component
$message
=
"Deleted ID : "
.
json_encode
(
$selectedPenddings
)
.
" Successfully"
;
$message
=
"Deleted ID : "
.
json_encode
(
$selectedPenddings
)
.
" Successfully"
;
$this
->
message
=
$message
;
$this
->
message
=
$message
;
$this
->
selectedPenddings
=
[];
$this
->
selectedPenddings
=
[];
}
}
public
static
function
logSendPatch
(
$patchId
,
$serverId
,
$logDesc
)
public
static
function
logSendPatch
(
$patchId
,
$serverId
,
$logDesc
)
...
...
resources/views/livewire/pages/sendpatch/send-patch-edit.blade.php
View file @
7aa8d437
<div
class=
"p-4 h-fit"
>
<div
class=
"p-4 h-fit"
x-data=
"{ tomGReady: false }"
x-show=
"tomGReady"
>
<div
class=
"mb-4"
x-data=
"{ tomGReady: false }"
x-show=
"tomGReady"
>
<div
class=
"mb-4"
>
<div
class=
"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-5"
>
<div
class=
"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-5"
>
<div>
<div>
<label
for=
"server_of"
class=
"block text-sm font-medium text-gray-700"
>
Server of
</label>
<label
for=
"server_of"
class=
"block text-sm font-medium text-gray-700"
>
Server of
</label>
...
@@ -14,27 +14,22 @@
...
@@ -14,27 +14,22 @@
<div
class=
""
wire:ignore
>
<div
class=
""
wire:ignore
>
<label
for=
"server_key"
class=
"block text-sm font-medium text-gray-700"
>
Server Key:
</label>
<label
for=
"server_key"
class=
"block text-sm font-medium text-gray-700"
>
Server Key:
</label>
<input
id=
"server_key"
class=
"mt-1.5 relative flex w-full"
x-data=
"{
<input
id=
"server_key"
class=
"mt-1.5 relative flex w-full"
x-data=
"{
serverKeyLists: @entangle('server_lists')
serverKeyLists: @entangle('server_lists'),
serverKeyOption: @entangle('serverKeyOption')
}"
}"
x-init=
"serverKeyLists = []
x-init=
"serverKeyLists = []
;
const tempLicense = pages.serverLicenseSelect;
const tempLicense = pages.serverLicenseSelect;
pages.fetchServerLicenses(tempLicense).then(() => {
tempLicense.serverkey.options = serverKeyOption;
$el._x_tom = new Tom($el, {
...tempLicense.serverkey,
$el._x_tom = new Tom($el, {
onChange: (value) => {
...tempLicense.serverkey,
serverKeyLists = value;
onChange: (value) => {
}
serverKeyLists = value;
});
$el._x_tom.setValue(serverKeyLists);
tomGReady = true;
});
{{-- $watch('test', (value) => {
if (tomGReady) {
$el._x_tom.clearOptions();
$el._x_tom.addOption(value);
$el._x_tom.refreshOptions(false);
}
}
}); --}}"
type=
"text"
placeholder=
"Search Server Key"
>
});
$el._x_tom.setValue(serverKeyLists);
tomGReady = true;"
type=
"text"
placeholder=
"Search Server Key"
>
</div>
</div>
<div>
<div>
<label
for=
"company"
class=
"block text-sm font-medium text-gray-700"
>
Company
</label>
<label
for=
"company"
class=
"block text-sm font-medium text-gray-700"
>
Company
</label>
...
@@ -147,10 +142,12 @@
...
@@ -147,10 +142,12 @@
<td
class=
"px-6 py-4 whitespace-nowrap text-sm text-gray-500"
>
{{ $server->TaskDate }}
</td>
<td
class=
"px-6 py-4 whitespace-nowrap text-sm text-gray-500"
>
{{ $server->TaskDate }}
</td>
<td
class=
"px-6 py-4 whitespace-nowrap text-sm text-gray-500"
>
<td
class=
"px-6 py-4 whitespace-nowrap text-sm text-gray-500"
>
@if ($server->TaskStatus == '999')
@if ($server->TaskStatus == '999')
<button
type=
"button"
wire:click=
"resendPatch({{ $server->ServerID }})"
class=
"btn bg-info text-white px-4 py-2 rounded"
><i
class=
"fa fa-repeat"
<button
type=
"button"
wire:click=
"resendPatch({{ $server->ServerID }})"
class=
"btn bg-info text-white px-4 py-2 rounded"
><i
class=
"fa fa-repeat"
aria-hidden=
"true"
></i></button>
aria-hidden=
"true"
></i></button>
@else
@else
<button
type=
"button"
wire:click=
"deletePatch({{ $server->ServerID }})"
class=
"btn bg-info-focus text-white px-4 py-2 rounded"
><i
class=
"fa fa-trash"
<button
type=
"button"
wire:click=
"deletePatch({{ $server->ServerID }})"
class=
"btn bg-info-focus text-white px-4 py-2 rounded"
><i
class=
"fa fa-trash"
aria-hidden=
"true"
></i></button>
aria-hidden=
"true"
></i></button>
@endif
@endif
...
...
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