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
e440445a
Commit
e440445a
authored
Dec 13, 2024
by
Sarun Mungthanya
Browse files
issue send patch and delete multi pendding snkey
parent
33217108
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
app/Http/Livewire/Pages/SendPatch/SendPatchEdit.php
View file @
e440445a
...
...
@@ -19,13 +19,14 @@ class SendPatchEdit extends Component
public
$search
=
''
;
public
$server_lists
;
public
$selectedOwnerType
=
''
;
public
$showMessage
=
false
;
public
$message
;
public
$searchSelected
=
'SNKEY'
;
public
$keyword
=
''
;
public
$selectedPenddings
=
[];
public
$serverkey
=
''
,
$showSearch
=
false
,
$searchInProgress
=
false
,
$resultsServerkey
=
[]
,
$resultsServerkeyArr
=
[];
public
$serverKeyWaitingSend
=
[],
$serverKeySuccess
=
[];
protected
$listeners
=
[
'deletePatch'
,
'refreshComponent'
=>
'$refresh'
,
'sendPatch'
];
protected
$listeners
=
[
'deletePatch'
,
'refreshComponent'
=>
'$refresh'
,
'sendPatch'
,
'deleteSelected'
];
public
function
mount
(
$editPid
)
{
// $this->setPage(1);
...
...
@@ -191,16 +192,28 @@ class SendPatchEdit extends Component
static
::
logSendPatch
(
$this
->
PID
,
$serverId
,
"Delete Patch"
);
}
public
function
deleteSelected
(
$selectedPenddings
)
public
function
deleteSelected
()
{
// if (!\Auth::user()->hasPermissions(['delete-user'])) {
// $this->showNoPermissionModal = TRUE;
// return;
// }
ConfServerPendding
::
destroy
(
$selectedPenddings
);
$message
=
"Deleted ID : "
.
json_encode
(
$selectedPenddings
)
.
" Successfully"
;
if
(
isset
(
$this
->
selectedPenddings
)){
foreach
(
$this
->
selectedPenddings
as
$serverId
)
{
$pendding
=
ConfServerPendding
::
where
(
"ServerID"
,
$serverId
)
->
where
(
"PatchID"
,
$this
->
PID
,)
->
delete
();
static
::
logSendPatch
(
$this
->
PID
,
$serverId
,
"Delete Patch"
);
}
}
$message
=
"Deleted Successfully"
;
$this
->
message
=
$message
;
if
(
$this
->
message
)
{
$this
->
dispatchBrowserEvent
(
'show-message'
,
[
'message'
=>
$this
->
message
]);
}
$this
->
selectedPenddings
=
[];
}
public
static
function
logSendPatch
(
$patchId
,
$serverId
,
$logDesc
)
...
...
app/Http/Livewire/Pages/SendPatch/SendPatchIndex.php
View file @
e440445a
...
...
@@ -22,8 +22,9 @@ class SendPatchIndex extends Component
public
$action
=
'list'
;
public
$totalItems
;
public
$showMessage
=
false
;
protected
$listeners
=
[
'showGroupList'
,
'deleteItem'
,
'deleteSelected'
];
protected
$listeners
=
[
'showGroupList'
,
'deleteItem'
];
public
function
mount
()
{
$this
->
searchBy
=
[
...
...
app/Http/Livewire/Pages/ServerLicense/ServerLicenseCreate.php
View file @
e440445a
...
...
@@ -44,9 +44,9 @@ class ServerLicenseCreate extends Component
'serverKey'
=>
'required|string|max:255'
,
'teamId'
=>
'required|integer'
,
'customerSize'
=>
'required|integer'
,
'customerType
s
'
=>
'required'
,
'customerType'
=>
'required
|not_in:0
'
,
'company'
=>
'required|string|max:255'
,
'branch'
=>
'nullable|string|max:255'
,
//
'branch' => 'nullable|string|max:255',
'status'
=>
'required|in:Y,N'
,
'licenseDate'
=>
'nullable|date'
,
'phpVersionId'
=>
'required|integer'
,
...
...
@@ -55,10 +55,14 @@ class ServerLicenseCreate extends Component
'installVersion'
=>
'nullable|string|max:255'
,
'databaseType'
=>
'required'
,
'ownerType'
=>
'nullable'
,
// 'hscodeMethod' => 'required|integer|in:1,2',
'customerUrl'
=>
'nullable|string|max:255'
,
'contact'
=>
'nullable|string|max:255'
,
'contactCustomerName'
=>
'nullable|string|max:255'
,
// 'hscodeMethod' => 'required|integer|in:1,2',
];
protected
$messages
=
[
'customerType.not_in'
=>
'Please select customer type.'
,
];
public
function
mount
()
{
...
...
@@ -91,7 +95,6 @@ class ServerLicenseCreate extends Component
public
function
save
()
{
$this
->
validate
();
// dd($this->teamId);
ConfServerLicense
::
create
([
'SNKEY'
=>
$this
->
serverKey
,
'NBTEAM'
=>
$this
->
teamId
,
...
...
@@ -100,17 +103,17 @@ class ServerLicenseCreate extends Component
'COMPANY'
=>
$this
->
company
,
'BRANCH'
=>
$this
->
branch
,
'STATUS'
=>
$this
->
status
,
'LICENSEDATE'
=>
$this
->
licenseDate
??
' '
,
'PHP_VERSION_ID'
=>
$this
->
phpVersionId
??
' '
,
'CUR_VERSION'
=>
$this
->
currentVersion
??
' '
,
'INSTALL_DATE'
=>
$this
->
installDate
??
' '
,
'INSTALL_VERSION'
=>
$this
->
installVersion
??
' '
,
'DATABASETYPE'
=>
$this
->
databaseType
??
' '
,
'OWNERTYPE'
=>
$this
->
ownerType
??
' '
,
'HSCODEMETHOD'
=>
$this
->
hscodeMethod
??
' '
,
'CUSTOMERURL'
=>
$this
->
customerUrl
??
' '
,
'CONTACT'
=>
$this
->
contact
??
' '
,
'CONTACTCUSTOMERNAME'
=>
$this
->
contactCustomerName
??
' '
,
'LICENSEDATE'
=>
$this
->
licenseDate
??
' '
,
'PHP_VERSION_ID'
=>
$this
->
phpVersionId
??
' '
,
'CUR_VERSION'
=>
$this
->
currentVersion
??
' '
,
'INSTALL_DATE'
=>
$this
->
installDate
??
' '
,
'INSTALL_VERSION'
=>
$this
->
installVersion
??
' '
,
'DATABASETYPE'
=>
$this
->
databaseType
??
' '
,
'OWNERTYPE'
=>
$this
->
ownerType
??
' '
,
'HSCODEMETHOD'
=>
$this
->
hscodeMethod
??
' '
,
'CUSTOMERURL'
=>
$this
->
customerUrl
??
' '
,
'CONTACT'
=>
$this
->
contact
??
' '
,
'CONTACTCUSTOMERNAME'
=>
$this
->
contactCustomerName
??
' '
,
]);
return
redirect
()
->
route
(
'server-license.index'
)
->
with
(
'message'
,
'Server License saved successfully.'
);
...
...
app/Http/Livewire/Pages/ServerLicense/ServerLicenseEdit.php
View file @
e440445a
...
...
@@ -44,7 +44,7 @@ class ServerLicenseEdit extends Component
public
$contactCustomerName
;
public
$licenseId
;
public
$message
,
$messages
=
[];
protected
$listeners
=
[
'gotoModal'
,
'setMessage'
];
protected
$listeners
=
[
'gotoModal'
,
'setMessage'
];
public
$modalLoaded
=
false
;
public
$SNKEY
;
public
$selectDateOrg
;
...
...
@@ -64,21 +64,22 @@ class ServerLicenseEdit extends Component
'serverKey'
=>
'required|string|max:255'
,
'teamId'
=>
'required|integer'
,
'customerSize'
=>
'required|integer'
,
'customerType
s
'
=>
'required'
,
'customerType'
=>
'required
|not_in:0
'
,
'company'
=>
'required|string|max:255'
,
'branch'
=>
'nullable|string|max:255'
,
//
'branch' => 'nullable|string|max:255',
'status'
=>
'required|in:Y,N'
,
'licenseDate'
=>
'nullable
|date
'
,
'licenseDate'
=>
'nullable'
,
'phpVersionId'
=>
'required|integer'
,
'currentVersion'
=>
'nullable|string|max:255'
,
'installDate'
=>
'nullable
|date
'
,
'installDate'
=>
'nullable'
,
'installVersion'
=>
'nullable|string|max:255'
,
'databaseType'
=>
'required'
,
'ownerType'
=>
'nullable'
,
// 'hscodeMethod' => 'required|integer|in:1,2',
'customerUrl'
=>
'nullable|string|max:255'
,
'contact'
=>
'nullable|string|max:255'
,
'contactCustomerName'
=>
'nullable|string|max:255'
,
// 'hscodeMethod' => 'required|integer|in:1,2',
];
public
function
loadModal
()
...
...
@@ -152,8 +153,10 @@ class ServerLicenseEdit extends Component
}
public
function
updateLicense
()
{
// dd( $this->teamId);
$this
->
validate
();
$customMessages
=
[
'customerType.not_in'
=>
'Please select customer type.'
,
];
$this
->
validate
(
$this
->
rules
,
$customMessages
);
$license
=
ConfServerLicense
::
find
(
$this
->
licenseId
);
if
(
$license
)
{
...
...
@@ -372,7 +375,7 @@ class ServerLicenseEdit extends Component
$groupedData
=
[];
$globalTemp
=
$this
->
globalList
;
if
(
!
empty
(
$globalTemp
))
{
if
(
!
empty
(
$globalTemp
))
{
foreach
(
$globalTemp
[
'profilecode'
]
as
$index
=>
$profileCode
)
{
if
(
isset
(
$globalTemp
[
'name'
][
$index
])
&&
isset
(
$globalTemp
[
'value'
][
$index
]))
{
if
(
!
isset
(
$groupedData
[
$profileCode
]))
{
...
...
@@ -684,12 +687,14 @@ class ServerLicenseEdit extends Component
$textLog
.
=
"
{
$filename
}
|"
;
}
$zip
->
close
();
if
(
isset
(
$tempFiles
)){
foreach
(
$tempFiles
as
$file
)
{
if
(
file_exists
(
$file
))
{
unlink
(
$file
);
}
}
}
if
(
file_exists
(
$zipFilePath
))
{
$textLog
=
rtrim
(
$textLog
,
'|'
)
.
" ]"
;
...
...
@@ -729,7 +734,6 @@ class ServerLicenseEdit extends Component
->
where
(
'cp.ServerID'
,
$this
->
licenseId
)
->
orderBy
(
$this
->
sortHistoryField
,
$this
->
sortHistoryDirection
)
->
paginate
(
$this
->
perPage
);
}
public
function
sortHistoryBy
(
$field
)
{
...
...
resources/views/livewire/pages/patch/patch-index.blade.php
View file @
e440445a
...
...
@@ -70,12 +70,12 @@
<tr>
<th
scope=
"col"
class=
"whitespace-nowrap rounded-tl-lg bg-slate-300 px-4 py-3 font-semibold uppercase text-black dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
#
Patch ID
</th>
<th
scope=
"col"
{{--
<th
scope=
"col"
class=
"whitespace-nowrap bg-slate-300 px-2 py-3 font-semibold uppercase text-black dark:bg-navy-800 dark:text-navy-100 lg:px-2"
>
Patch ID
</th>
</th>
--}}
<th
scope=
"col"
class=
"whitespace-nowrap bg-slate-300 px-2 py-3 font-semibold uppercase text-black dark:bg-navy-800 dark:text-navy-100 lg:px-2"
>
Patch Name
...
...
@@ -111,7 +111,7 @@
@foreach ($results as $patch)
<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"
>
<label
for=
"selectedPatch-{{ $patch->id }}"
class=
"inline-flex items-center space-x-2"
>
<input
id=
"selectedPatch-{{ $patch->id }}"
...
...
@@ -119,8 +119,8 @@
type=
"checkbox"
wire:model.defer=
"selectedPatch"
value=
"{{ $patch->id }}"
/>
</label>
</td>
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2"
>
{{ $patch->PID }}
</td>
</td>
--}}
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2
text-center
"
>
{{ $patch->PID }}
</td>
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2"
>
{{ \Illuminate\Support\Str::limit($patch->PATCHNAME, 120) }}
</td>
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2"
>
{{ $patch->PDATE }}
</td>
...
...
resources/views/livewire/pages/send-patch/send-patch-edit.blade.php
View file @
e440445a
...
...
@@ -82,8 +82,7 @@
<ul
x-show=
"open"
@
click.away=
"open = false"
class=
"absolute left-0 right-0 border border-gray-200 rounded-md max-h-64 overflow-auto z-50 bg-white"
>
<li
class=
"p-2 bg-gray-200 hover:bg-gray-300 cursor-pointer font-semibold"
{{
--
wire:click=
"selectAllResults"
--
}}
@
click=
"serverKeySelectAll()"
>
{{
--
wire:click=
"selectAllResults"
--
}}
@
click=
"serverKeySelectAll()"
>
Select All
</li>
@forelse($resultsServerkey as $result)
...
...
@@ -207,7 +206,7 @@
<div
class=
"flex justify-between"
>
<div
class=
"flex items-center justify-start mb-3"
>
<span
class=
"cursor-pointer text-black p-2 rounded-lg hover:bg-primary hover:text-white mr-3"
wire:
click=
"
d
eleteSelected"
><i
class=
"fa fa-trash"
aria-hidden=
"true"
></i>
on
click=
"
confirmD
eleteSelected
()
"
><i
class=
"fa fa-trash"
aria-hidden=
"true"
></i>
Delete
</span>
<span
class=
"cursor-pointer text-black p-2 rounded-lg hover:bg-primary hover:text-white"
wire:click=
"export"
><i
class=
"fa fa-download"
aria-hidden=
"true"
></i>
Export
</span>
...
...
@@ -278,11 +277,16 @@
<tr>
<td
class=
"px-6 py-4 whitespace-nowrap"
>
<label
class=
"inline-flex items-center space-x-2"
>
@if ($server->TaskStatus == '999')
@else
<input
class=
"form-checkbox individual-checkbox is-basic h-4 w-4 rounded border-slate-400/70 checked:bg-primary checked:border-primary hover:border-primary focus:border-primary dark:bg-navy-900 dark:border-navy-500 dark:checked:bg-accent dark:checked:border-accent dark:hover:border-accent dark:focus:border-accent"
type=
"checkbox"
@
click=
"deleteSelectedPatch
"
type=
"checkbox"
wire:model.defer=
"selectedPenddings
"
value=
"{{ $server->ServerID }}"
data-serverId =
"{{ $server->ServerID }}"
/>
@endif
</label>
</td>
<td
class=
"px-6 py-4 whitespace-nowrap text-sm text-gray-500"
>
...
...
resources/views/livewire/pages/send-patch/send-patch-index.blade.php
View file @
e440445a
...
...
@@ -8,17 +8,21 @@
</div>
</div>
<div
class=
"m-2"
>
@if ($action === 'list')
@if ($message)
<div
class=
"alert alert-success"
>
<div
wire:ignore
x-data=
"{ show: true }"
x-init=
"setTimeout(() => show = false, 3000)"
x-show.transition.duration.500ms=
"show"
<div
x-data=
"{ show: @entangle('showMessage'), message: '' }"
x-init=
"window.addEventListener('show-message', event => {
show = true;
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"
>
{{ $message }}
</div>
</div>
@endif
<div
class=
"my-5 flex h-8 place-content-center px-4 "
>
<h2
class=
"text-xl text-slate-800"
>
Send Patch to Customer
...
...
@@ -135,4 +139,4 @@
<livewire:pages.send-patch.send-patch-edit
:editPid=
"$editPid"
>
@endif
</main>
</div>
</div>
resources/views/livewire/pages/server-license/map-to.blade.php
View file @
e440445a
...
...
@@ -24,28 +24,28 @@
@foreach ($mapToList['id'] as $index => $onload)
<tr
class=
"border-b"
>
<td
class=
"py-2 px-4 border w-24 text-center"
>
{{ $index +1 }}
</td>
<td
class=
"py-2 px-4 border w-32"
>
{{--
<td
class=
"py-2 px-4 border w-32"
>
<input
type=
"text"
class=
"w-full p-2 border border-gray-300 rounded-md"
wire:model.defer=
"mapToList.step.{{ $index }}"
/>
</td>
<td
class=
"py-2 px-4 border w-48"
>
<input
type=
"text"
class=
"w-full p-2 border border-gray-300 rounded-md"
wire:model.defer=
"mapToList.level.{{ $index }}"
/>
</td>
--}}
<td
class=
"py-2 px-4 border w-32"
>
<input
type=
"text"
class=
"w-full p-2 border border-gray-300 rounded-md"
wire:model.defer=
"mapToList.name.{{ $index }}"
/>
</td>
<td
class=
"py-2 px-4 border w-64"
>
{{--
<td
class=
"py-2 px-4 border w-64"
>
<textarea
class=
"w-full p-1 border rounded"
wire:model.defer=
"mapToList.desc.{{ $index }}"
></textarea>
</td>
</td>
--}}
<td
class=
"py-2 px-4 border w-64"
>
<textarea
class=
"w-full p-1 border rounded"
wire:model.defer=
"mapToList.validateCode.{{ $index }}"
></textarea>
</td>
<td
class=
"py-2 px-4 border w-48"
>
<input
type=
"text"
class=
"w-full p-2 border border-gray-300 rounded-md"
wire:model.defer=
"mapToList.doctype.{{ $index }}"
/>
</td>
<td
class=
"py-2 px-4 border w-24"
>
{{--
<td
class=
"py-2 px-4 border w-24"
>
<input
type=
"text"
class=
"w-full p-2 border border-gray-300 rounded-md"
wire:model.defer=
"mapToList.active.{{ $index }}"
/>
</td>
</td>
--}}
</tr>
@endforeach
@endif
...
...
resources/views/livewire/pages/server-license/server-license-create.blade.php
View file @
e440445a
...
...
@@ -57,18 +57,18 @@
@enderror
</div>
</div>
<!-- Customer Type -->
<div
class=
"mt-3 flex items-center"
>
<label
for=
"customerType"
class=
"w-1/4 text-gray-700"
>
Customer Type
</label>
<div
class=
"flex flex-col w-3/4"
>
<select
id=
"customerType"
wire:model.defer=
"customerType"
class=
" p-2 border border-gray-300 rounded-md"
>
@foreach ($customerTypes as $type)
<option
value=
"{{ $type->id }}"
>
{{ $type->sizeTypeName }}
</option>
@endforeach
</select>
@error('customerType
s
')
@error('customerType')
<div
class=
"text-red-500 text-sm "
>
{{ $message }}
</div>
@enderror
...
...
resources/views/livewire/pages/server-license/server-license-edit.blade.php
View file @
e440445a
This diff is collapsed.
Click to expand it.
resources/views/livewire/pages/server-license/server-license-index.blade.php
View file @
e440445a
...
...
@@ -76,12 +76,12 @@
<table
aria-describedby=
"mydesc"
class=
"is-hoverable table w-full text-left border-b"
>
<thead>
<tr>
<th
scope=
"col"
{{--
<th
scope=
"col"
class=
"whitespace-nowrap rounded-tl-lg bg-slate-300 px-4 py-3 font-semibold uppercase text-black dark:bg-navy-800 dark:text-navy-100 lg:px-5"
>
#
</th>
</th>
--}}
<th
scope=
"col"
class=
"whitespace-nowrap bg-slate-300 px-
2
py-3 font-semibold uppercase text-black dark:bg-navy-800 dark:text-navy-100 lg:px-2"
>
class=
"whitespace-nowrap
rounded-tl-lg
bg-slate-300 px-
4
py-3 font-semibold uppercase text-black dark:bg-navy-800 dark:text-navy-100 lg:px-2"
>
Server Key
</th>
<th
scope=
"col"
...
...
@@ -115,14 +115,14 @@
@foreach ($results as $license)
<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"
>
<label
class=
"inline-flex items-center space-x-2"
>
<input
class=
"form-checkbox is-basic h-4 w-4 rounded border-slate-400/70 checked:bg-primary checked:border-primary focus:border-primary dark:bg-navy-900 dark:border-navy-500 dark:checked:bg-accent dark:checked:border-accent dark:hover:border-accent dark:focus:border-accent"
type=
"checkbox"
wire:model.defer=
"selectedLicense"
value=
"{{ $license->ID }}"
/>
</label>
</td>
</td>
--}}
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2"
>
{{ $license->SNKEY }}
</td>
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2"
>
{{ \Illuminate\Support\Str::limit($license->COMPANY, 40) }}
</td>
...
...
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