Commit 7fe8bcbb authored by Sarun Mungthanya's avatar Sarun Mungthanya
Browse files

update ui delete patch

parent eb19084d
...@@ -11,13 +11,18 @@ use Livewire\WithPagination; ...@@ -11,13 +11,18 @@ use Livewire\WithPagination;
class DeleteMultiPatch extends Component class DeleteMultiPatch extends Component
{ {
public $serverkey = '', $showSearch, $searchInProgress, $results, $selectedPatches = []; public $serverkey = '', $companyName, $showSearch, $searchInProgress, $results, $selectedPatches = [];
public function selectResult($key) public function selectResult($key)
{ {
$this->serverkey = $key; $this->serverkey = $key;
$this->results = []; $this->results = [];
$this->showSearch = false; $this->showSearch = false;
$serverLicense = ConfServerLicense::where('SNKEY', $this->serverkey)->first();
if (isset($serverLicense)) {
$this->companyName = $serverLicense->COMPANY;
}
$this->emit('updateServerkey', $key); $this->emit('updateServerkey', $key);
} }
public function updatedServerkey() public function updatedServerkey()
...@@ -29,6 +34,7 @@ class DeleteMultiPatch extends Component ...@@ -29,6 +34,7 @@ class DeleteMultiPatch extends Component
$this->searchInProgress = true; $this->searchInProgress = true;
$this->results = ConfServerLicense::where('SNKEY', 'LIKE', '%' . $this->serverkey . '%')->take(50)->get(); $this->results = ConfServerLicense::where('SNKEY', 'LIKE', '%' . $this->serverkey . '%')->take(50)->get();
$this->searchInProgress = false; $this->searchInProgress = false;
} }
public function render() public function render()
......
...@@ -2,24 +2,38 @@ ...@@ -2,24 +2,38 @@
namespace App\Http\Livewire\Pages\SendPatch; namespace App\Http\Livewire\Pages\SendPatch;
use App\Models\ConfServerLicense;
use App\Models\ConfServerPendding;
use App\Models\ConfSmartupdate;
use App\Http\Livewire\Pages\SendPatch\SendPatchEdit;
use App\Models\LogSendPath2customer;
use Livewire\Component; use Livewire\Component;
class DeleteMultiPatchBox extends Component class DeleteMultiPatchBox extends Component
{ {
protected $listeners = ['updateSelectedPatches']; protected $listeners = ['updateServerkey' , 'updateDeletedPatches'];
public $selectedPatches = []; public $selectedPatches = [];
public $selectedPatchName = []; public $selectedPatchName = [];
public $serverkey = '', $showSearch = false, $searchInProgress, $reponseMessages = []; public $serverkey = '', $serverId, $showSearch = false, $searchInProgress, $reponseMessages = [];
public $showProgressModal = false; public $showProgressModal = false;
public $results = []; public $results = [];
public function mount($selectedPatches) public function mount($selectedPatches)
{ {
$this->selectedPatches = $selectedPatches; $this->selectedPatches = $selectedPatches;
} }
public function updateSelectedPatches($patchId, $allSelectPatchName) public function updateServerkey($serverkey)
{
$serverLicense = ConfServerLicense::where("SNKEY", $serverkey)->first();
if (isset($serverLicense)) {
$this->serverId = $serverLicense->ID;
$this->serverkey = $serverkey;
}
}
public function updateDeletedPatches($patchId, $allSelectPatchName)
{ {
if (is_array($patchId)) { if (is_array($patchId)) {
$this->selectedPatches = $patchId; $this->selectedPatches = $patchId;
...@@ -37,6 +51,57 @@ class DeleteMultiPatchBox extends Component ...@@ -37,6 +51,57 @@ class DeleteMultiPatchBox extends Component
} }
} }
} }
public function removePatch($key)
{
$keyIndex = array_search($key, $this->selectedPatches);
if ($keyIndex !== false) {
unset($this->selectedPatches[$keyIndex]);
unset($this->selectedPatchName[$keyIndex]);
$this->selectedPatches = array_values($this->selectedPatches);
$this->selectedPatchName = array_values($this->selectedPatchName);
}
$this->emit('removePatchSelected', $key);
}
public function deleteSelectedPatches()
{
$this->reponseMessages = [];
if (count($this->selectedPatches) > 0 && !empty($this->serverkey)) {
foreach ($this->selectedPatches as $pId) {
$serverLicense = ConfServerLicense::where('SNKEY', $this->serverkey)->first();
if (isset($serverLicense)) {
ConfServerPendding::where("PatchID", $pId)->where('ServerID', $serverLicense->ID)->delete();
static::logSendPatch($pId, $serverLicense->ID, "Delete Patch");
$this->reponseMessages[] = "[Delete Patch] Send Success Serverkey : " . $this->serverkey . " and Patch : " . $pId;
} else {
$this->reponseMessages[] = '<span class="text-error">Serverkey : ' . $this->serverkey . ' not found</span>';
}
}
}
$this->showProgressModal = true;
$this->selectedPatchName = [];
$this->selectedPatches = [];
$this->emit('updateSelectPatchAfterDeleted');
}
public static function logSendPatch($patchId, $serverId, $logDesc)
{
$log = new LogSendPath2customer;
$log->UID = auth()->user()->uid;
$log->PATCHID = $patchId;
$log->SERVERKEYID = $serverId;
$log->ACTDATETIME = date("Y-m-d H:i:s");
$log->LOGDESC = $logDesc;
$log->IPACTIVE = request()->ip();
$log->save();
}
public function render() public function render()
{ {
return view('livewire.pages.send-patch.delete-multi-patch-box'); return view('livewire.pages.send-patch.delete-multi-patch-box');
......
...@@ -15,8 +15,9 @@ class DeleteMultiPatchList extends Component ...@@ -15,8 +15,9 @@ class DeleteMultiPatchList extends Component
public $serverkey = ''; public $serverkey = '';
public $searchBy, $serverId, $editPid, $message, $keyword, $perPage = 10, $searchSelected = 'PID'; public $searchBy, $serverId, $editPid, $message, $keyword, $perPage = 10, $searchSelected = 'PID';
public $selectedPatches = []; public $selectedPatches = [];
protected $results;
protected $listeners = ['updateServerkey']; protected $listeners = ['updateServerkey' , 'updateSelectPatchAfterDeleted', 'removePatchSelected'];
public function mount() public function mount()
{ {
...@@ -28,6 +29,7 @@ class DeleteMultiPatchList extends Component ...@@ -28,6 +29,7 @@ class DeleteMultiPatchList extends Component
'Remark' => 'Remark' 'Remark' => 'Remark'
]; ];
// dd($results);
// $this->selectedPatches = []; // $this->selectedPatches = [];
} }
public function search() public function search()
...@@ -37,20 +39,36 @@ class DeleteMultiPatchList extends Component ...@@ -37,20 +39,36 @@ class DeleteMultiPatchList extends Component
public function updateServerkey($serverkey) public function updateServerkey($serverkey)
{ {
$serverLicense = ConfServerLicense::where("SNKEY", $serverkey)->first(); $serverLicense = ConfServerLicense::where("SNKEY", $serverkey)->first();
if (isset($serverLicense)) { if (isset($serverLicense)) {
$this->serverId = $serverLicense->ID; $this->serverId = $serverLicense->ID;
} }
$this->render(); $this->render();
} }
public function updateSelectPatchAfterDeleted()
{
$this->selectedPatches = [];
$this->render();
}
public function removePatchSelected($key)
{
$this->selectedPatches = array_filter($this->selectedPatches, function ($patch) use ($key) {
return $patch!== $key;
});
$this->resetPage();
}
public function render() public function render()
{ {
$query = ConfServerPendding::select('PID', 'PATCHNAME', 'PDESC', 'PDATE', 'PLEVEL', 'Remark', 'MAJOR_VERSION') $query = ConfServerPendding::select('PID', 'PATCHNAME', 'PDESC', 'PDATE', 'PLEVEL', 'Remark', 'MAJOR_VERSION')
->join('conf_smartupdate', 'conf_smartupdate.PID', '=', 'conf_server_pendding.PatchID') ->join('conf_smartupdate', 'conf_smartupdate.PID', '=', 'conf_server_pendding.PatchID')
->where('conf_server_pendding.ServerID', $this->serverId); ->where('conf_server_pendding.ServerID', $this->serverId)
->where('conf_server_pendding.TaskStatus' , '!=', '999');
if ($this->searchSelected && $this->keyword) { if ($this->searchSelected && $this->keyword) {
$query->where($this->searchSelected, 'LIKE', '%' . $this->keyword . '%'); $query->where($this->searchSelected, 'LIKE', '%' . $this->keyword . '%');
......
<div> <div class="w-full md:w-1/3 px-3 mb-6" x-data="{ showProgressModal: @entangle('showProgressModal') }">
{{-- The whole world belongs to you. --}}
<div class="p-6 bg-white shadow-md rounded-lg">
<h2 class="text-2xl font-bold mb-4">Selected Patches</h2>
<div class="bg-gray m-3">
@if (count($selectedPatchName) > 0)
@foreach ($selectedPatchName as $key => $patch)
<div class="flex items-center bg-lime-800 text-white w-full px-4 py-2 rounded m-1">
<span class="flex-grow"> {{ $selectedPatches[$key] . ' : ' . $patch }}</span>
<button wire:click="removePatch('{{ $selectedPatches[$key] }}')" class="ml-2">
<i class="fas fa-trash-alt"></i>
</button>
</div>
@endforeach
@else
<span class="flex-grow">No patch selected</span>
@endif
</div>
<div class="flex flex-col items-center">
<div>
@if (!empty($serverkey) && $showSearch)
<ul class="mt-2 border border-gray-200 rounded-md max-h-64 overflow-auto">
@forelse($results as $result)
<li class="p-2 hover:bg-gray-100 cursor-pointer"
wire:click="selectResult('{{ $result->SNKEY }}')">
{{ $result->SNKEY }}
</li>
@empty
<li class="p-2 text-gray-500">No results found</li>
@endforelse
</ul>
@endif
</div>
<button type="button" class="bg-primary text-white px-4 py-2 rounded max-w-xs mt-4"
wire:click="deleteSelectedPatches" @click="showProgressModal = true" wire:loading.attr="disabled"
class="bg-primary text-white px-4 py-2 rounded relative">
<span wire:loading.remove wire:target="deleteSelectedPatches">Delete Patch</span>
<span wire:loading wire:target="deleteSelectedPatches">
<svg class="animate-spin h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.964 7.964 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</path>
</svg>
</span>
</button>
</div>
</div>
<div x-show="showProgressModal" x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="opacity-0 scale-90" x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-300" x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-90" class="fixed z-10 inset-0 overflow-y-auto">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div x-show="showProgressModal" class="fixed inset-0 transition-opacity" aria-hidden="true">
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
</div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div x-show="showProgressModal"
class="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:p-6">
<div>
<div class="mt-3 text-center sm:mt-5">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">
Delete Patch ID
</h3>
<div class="mt-2">
<ul>
@if (count($reponseMessages) > 0)
@foreach ($reponseMessages as $message)
<li>{!! $message !!}</li>
@endforeach
@endif
</ul>
</div>
</div>
</div>
<div class="mt-5 sm:mt-6">
<button @click="showProgressModal = false" type="button"
class="inline-flex justify-center w-full rounded-md border border-transparent shadow-sm px-4 py-2 bg-green-600 text-base font-medium text-white hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 sm:text-sm">
Close
</button>
</div>
</div>
</div>
</div>
</div> </div>
...@@ -9,10 +9,22 @@ ...@@ -9,10 +9,22 @@
this.loadSelectedPatch(); this.loadSelectedPatch();
this.resetCheckAllCheckbox(); this.resetCheckAllCheckbox();
}); });
// this.$watch('selectedPatch.length', () => {
// this.resetCheckAllCheckbox();
// });
this.loadSelectedPatch(); this.loadSelectedPatch();
Livewire.on('removePatchSelected', (patch) => {
const checkboxes = document.querySelectorAll('.individual-checkbox');
checkboxes.forEach(checkbox => {
if (checkbox.value === patch) {
checkbox.checked = false;
this.updatePatchSelection(checkbox.value, checkbox.getAttribute('data-patchname'), false);
}
});
this.updateSelectedPatchList();
});
Livewire.on('updateSelectPatchAfterDeleted', () => {
this.clearAllSelections();
});
}, },
toggleAllCheckboxes(event) { toggleAllCheckboxes(event) {
const checkboxes = document.querySelectorAll('.individual-checkbox'); const checkboxes = document.querySelectorAll('.individual-checkbox');
...@@ -33,8 +45,6 @@ ...@@ -33,8 +45,6 @@
}, },
updatePatchSelection(patch, patchName, isSelected) { updatePatchSelection(patch, patchName, isSelected) {
const pagePatches = this.selectedPatchByPage[this.currentPage] || []; const pagePatches = this.selectedPatchByPage[this.currentPage] || [];
console.log(this.allSelectPatches)
console.log(this.allSelectPatchName)
if (isSelected) { if (isSelected) {
if (!pagePatches.includes(patch)) { if (!pagePatches.includes(patch)) {
pagePatches.push(patch); pagePatches.push(patch);
...@@ -52,9 +62,14 @@ ...@@ -52,9 +62,14 @@
this.allSelectPatchName.splice(indexAll, 1); this.allSelectPatchName.splice(indexAll, 1);
} }
} }
Livewire.emit('updateSelectedPatches', this.allSelectPatches, this.allSelectPatchName); Livewire.emit('updateDeletedPatches', this.allSelectPatches, this.allSelectPatchName);
this.selectedPatchByPage[this.currentPage] = pagePatches; this.selectedPatchByPage[this.currentPage] = pagePatches;
}, },
clearAllSelections() {
this.allSelectPatches = [];
this.allSelectPatchName = [];
},
updateSelectedPatchList() { updateSelectedPatchList() {
this.selectedPatch = Object.values(this.selectedPatchByPage).flat(); this.selectedPatch = Object.values(this.selectedPatchByPage).flat();
}, },
...@@ -74,128 +89,125 @@ ...@@ -74,128 +89,125 @@
checkAllCheckbox.checked = checkboxes.length > 0 && pagePatches.length === checkboxes checkAllCheckbox.checked = checkboxes.length > 0 && pagePatches.length === checkboxes
.length; .length;
} }
}" x-init="$watch('selectedPatch', () => resetCheckAllCheckbox())" class="min-w-[2rem]"> }" x-init="$watch('selectedPatch', () => resetCheckAllCheckbox())" class="w-full mb-6">
<div class="w-full md:w-2/3 px-3 mb-6"> <div class="p-6 bg-white shadow-md rounded-lg">
<div class="p-6 bg-white shadow-md rounded-lg"> <div x-show="true" class="">
<div x-show="true" class=""> <div class="flex justify-between mb-5">
<div class="flex justify-between mb-5"> <h2 class="font-medium tracking-wide text-slate-700 line-clamp-1 dark:text-navy-100 lg:text-base">
<h2 class="font-medium tracking-wide text-slate-700 line-clamp-1 dark:text-navy-100 lg:text-base"> Patch List
Patch List </h2>
</h2> <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-4 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-14 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-14 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"> <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" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /> </svg>
</svg> </button>
</button> <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.defer="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.defer="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-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"> @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"
<button type="button" class="bg-stone-700 text-white px-4 py-2 rounded" wire:click="search">Search</button>
wire:click="search">Search</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="mt-3 ">
<div class="is-scrollbar-hidden min-w-full table-responsive">
<div class="mx-3 mt-3 px-4"> <table class="is-hoverable table w-full text-left">
<div class="is-scrollbar-hidden min-w-full table-responsive"> <thead>
<tr>
<table class="is-hoverable table w-full text-left"> <th
<thead> class="whitespace-nowrap rounded-tl-lg bg-slate-200 px-4 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-5">
<tr> <input
<th class="form-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"
class="whitespace-nowrap rounded-tl-lg bg-slate-200 px-4 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-5"> type="checkbox" id="check-all" @click="toggleAllCheckboxes" />
<input </th>
class="form-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" <th
type="checkbox" id="check-all" @click="toggleAllCheckboxes" /> class="whitespace-nowrap bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2">
</th> Patch ID
<th </th>
class="whitespace-nowrap bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2"> <th
Patch ID class="whitespace-nowrap bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2">
</th> Patch Name
<th </th>
class="whitespace-nowrap bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2"> <th
Patch Name class="whitespace-nowrap bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2">
</th> Description
<th </th>
class="whitespace-nowrap bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2"> <th
Description class="whitespace-nowrap bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2">
</th> Server
<th </th>
class="whitespace-nowrap bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2"> <th
Server class="whitespace-nowrap bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2">
</th> Date
<th </th>
class="whitespace-nowrap bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2"> <th
Date class="whitespace-nowrap rounded-tr-lg bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2">
</th> Remark
<th </th>
class="whitespace-nowrap rounded-tr-lg bg-slate-200 px-2 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-2"> </tr>
Remark </thead>
</th> <tbody>
@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">
<label class="inline-flex items-center space-x-2">
<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="updateSelectedPatch" value="{{ $patch->PID }}"
data-patchname = "{{ $patch->PATCHNAME }}" />
</label>
</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">{{ $patch->PID }}</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2" data-id="{{ $patch->PID }}">
{{ \Illuminate\Support\Str::limit($patch->PATCHNAME, 40) }}
</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">
{{ \Illuminate\Support\Str::limit($patch->PDESC, 40) }}</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">{{ $patch->server }}
</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">{{ $patch->PDATE }}
</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">{{ $patch->Remark }}
</td>
</tr> </tr>
</thead> @endforeach
<tbody> </tbody>
@foreach ($results as $patch) </table>
<tr class="border-y border-transparent border-b-slate-200 dark:border-b-navy-500"> <div class="justify-center flex">
<td class="whitespace-nowrap px-4 py-3 sm:px-5"> <span wire:loading>
<label class="inline-flex items-center space-x-2"> <svg class="animate-spin h-16 w-16 text-primary m-2 " xmlns="http://www.w3.org/2000/svg"
<input fill="none" viewBox="0 0 24 24">
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" <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
type="checkbox" @click="updateSelectedPatch" stroke-width="4"></circle>
value="{{ $patch->PID }}" <path class="opacity-75" fill="currentColor"
data-patchname = "{{ $patch->PATCHNAME }}" /> d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.964 7.964 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</label> </path>
</td> </svg>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">{{ $patch->PID }}</td> </span>
<td class="whitespace-nowrap px-1 py-3 sm:px-2" data-id="{{ $patch->PID }}">
{{ \Illuminate\Support\Str::limit($patch->PATCHNAME, 40) }}
</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">
{{ \Illuminate\Support\Str::limit($patch->PDESC, 40) }}</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">{{ $patch->server }}
</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">{{ $patch->PDATE }}
</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">{{ $patch->Remark }}
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="justify-center flex">
<span wire:loading >
<svg class="animate-spin h-16 w-16 text-primary m-2 " xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.964 7.964 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</path>
</svg>
</span>
</div>
</div> </div>
<livewire:delete-modal />
{{ $results->links('livewire.paginate-custom') }}
</div> </div>
<livewire:delete-modal />
{{ $results->links('livewire.paginate-custom') }}
</div> </div>
</div> </div>
</div> </div>
......
<div class="w-full px-3 mb-6"> <div class="w-full px-3 mb-6 bg-main-container">
<div class="p-6 bg-white rounded-lg relative"> <div class="p-6 rounded-lg relative h-svh bg-main-container ">
<div class="flex flex-col items-center"> <div class="flex flex-wrap -mx-3">
<div class="flex flex-row justify-items-start self-start "> <div class="w-2/3 px-3 mb-6 ">
<h5 class="flex justify-self-center items-center mx-2 ml-4">Serverkey</h5> <div class="shadow-md bg-white w-full mb-3 p-3 rounded-lg">
<div class="flex flex-col"> <div class="flex flex-col items-center ">
<input type="text" <div class="flex flex-row justify-items-start self-start ">
class="form-input h-9 peer w-64 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" <h5 class="flex justify-self-center items-center mx-2 ml-4 text-xl">Serverkey : </h5>
wire:model.debounce.500ms="serverkey" placeholder="Search for a server key"> <div class="flex flex-col">
@if (!empty($serverkey) && $showSearch) <input type="text"
<ul class="form-input h-9 peer w-64 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="z-50 border border-gray-200 top-14 rounded-md max-h-64 w-64 overflow-auto absolute bg-white mt-1"> wire:model.debounce.500ms="serverkey" placeholder="Search for a server key">
@forelse($results as $result) @if (!empty($serverkey) && $showSearch)
<li class="p-2 hover:bg-gray-100 cursor-pointer" <ul
wire:click="selectResult('{{ $result->SNKEY }}')"> class="z-50 border border-gray-200 top-14 rounded-md max-h-64 w-64 overflow-auto absolute bg-white mt-1">
{{ $result->SNKEY }} @forelse($results as $result)
</li> <li class="p-2 hover:bg-gray-100 cursor-pointer"
@empty wire:click="selectResult('{{ $result->SNKEY }}')">
<li class="p-2 text-gray-500">No results found</li> {{ $result->SNKEY }}
@endforelse </li>
</ul> @empty
@endif <li class="p-2 text-gray-500">No results found</li>
@endforelse
</ul>
@endif
</div>
<span wire:loading>
<svg class="animate-spin h-5 w-5 text-primary m-2" xmlns="http://www.w3.org/2000/svg"
fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10"
stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.964 7.964 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</path>
</svg>
</span>
<span
class="flex justify-self-center items-center ml-3">{{ !empty($companyName) ? '(' . $companyName . ')' : '' }}
</span>
</div>
</div>
</div> </div>
<span wire:loading>
<svg class="animate-spin h-5 w-5 text-primary m-2" xmlns="http://www.w3.org/2000/svg" fill="none" <livewire:pages.send-patch.delete-multi-patch-list />
viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.964 7.964 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</path>
</svg>
</span>
</div> </div>
<livewire:pages.send-patch.delete-multi-patch-box :selectedPatches="$selectedPatches" />
</div> </div>
<livewire:pages.send-patch.delete-multi-patch-list :serverkey="$serverkey" :results="$results" />
<livewire:pages.send-patch.delete-multi-patch-box :selectedPatches="$selectedPatches" />
</div> </div>
</div> </div>
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<h2 class="text-2xl font-bold mb-4">Selected Patches</h2> <h2 class="text-2xl font-bold mb-4">Selected Patches</h2>
<div class="bg-gray m-3"> <div class="bg-gray m-3">
@foreach ($selectedPatchName as $key => $patch) @foreach ($selectedPatchName as $key => $patch)
<button class="bg-blue-500 text-white px-4 py-2 rounded m-1">{{ $selectedPatches[$key]." : ".$patch }}</button> <button class="bg-lime-800 text-white px-4 py-2 rounded m-1">{{ $selectedPatches[$key]." : ".$patch }}</button>
@endforeach @endforeach
</div> </div>
<div class="flex flex-col items-center"> <div class="flex flex-col items-center">
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
</ul> </ul>
@endif @endif
</div> </div>
<button type="button" class="bg-stone-700 text-white px-4 py-2 rounded max-w-xs mt-4" <button type="button" class="bg-primary text-white px-4 py-2 rounded max-w-xs mt-4"
wire:click="sendSelectedPatches" @click="showProgressModal = true" wire:loading.attr="disabled" wire:click="sendSelectedPatches" @click="showProgressModal = true" wire:loading.attr="disabled"
type="button" class="bg-stone-700 text-white px-4 py-2 rounded relative"> type="button" class="bg-primary text-white px-4 py-2 rounded relative">
<span wire:loading.remove>Send Patch</span> <span wire:loading.remove>Send Patch</span>
<span wire:loading> <span wire:loading>
<svg class="animate-spin h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" <svg class="animate-spin h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none"
......
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
@endforeach @endforeach
</select> </select>
</span> </span>
<button type="button" class="bg-stone-700 text-white px-4 py-2 rounded" <button type="button" class="bg-primary text-white px-4 py-2 rounded"
wire:click="search">Search</button> wire:click="search">Search</button>
</div> </div>
</div> </div>
......
...@@ -39,7 +39,7 @@ const customColors = { ...@@ -39,7 +39,7 @@ const customColors = {
error: "#DC3545", error: "#DC3545",
"error-focus": "#C82333", "error-focus": "#C82333",
"slate-100": "#2D6A4F", "slate-100": "#2D6A4F",
"main-container": "#ffffff", // background "main-container": "#f3f4f6", // background
}; };
module.exports = { module.exports = {
content: [ content: [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment