Commit 2a80d6b3 authored by Sarun Mungthanya's avatar Sarun Mungthanya
Browse files

add create code from commit

parent ac9a8eac
......@@ -93,7 +93,7 @@ class CodeComparer extends Component
$projectId = 60; // ใช้ Project ID ที่ถูกต้อง
$filePath = 'IE5DEV.shippingnet/USERFUNC.inc'; // เส้นทางไฟล์ที่ถูกต้อง
$branch = 'master'; // หรือ branch ที่คุณต้องการ
$token = 'glpat-JUEx89aC_VcFPRiSeJh_';
$token = env('GITLAB_API_TOKEN');
$client = new Client([
'base_uri' => 'https://idemo.netbay.co.th/gitlab/api/v4/',
......
......@@ -6,7 +6,7 @@ use Livewire\Component;
class MainContainer extends Component
{
public $currentContent = '';
public $currentContent = 'Patch';
public $loading = false;
protected $listeners = ['menuChanged' => 'loadContent'];
......@@ -16,9 +16,11 @@ class MainContainer extends Component
$this->loading = true;
// Simulate loading delay
sleep(1);
// sleep(1);
$this->currentContent = $menu;
$this->emitTo('pages.patch.patch-index', 'showpatchListForm');
// $this->emitTo('PatchIndex', 'showpatchListForm');
$this->loading = false;
}
......
......@@ -6,7 +6,7 @@ use Livewire\Component;
class Navbar extends Component
{
public $currentMenu = 'home';
public $currentMenu = 'Patch';
public function loadContent($menu)
{
......
<?php
namespace App\Http\Livewire\Pages\Patch;
use App\Models\TabPatchFile;
use Livewire\Component;
class ModalEditCode extends Component
{
public $openModalEditCode = false;
public $patchFileId, $patchFile, $gitCode, $dbCode;
public $preImpHeader;
public $isOpenEditCode= false;
protected $listeners = ['openModalEditCode'];
public function openModalEditCode($patchFileId)
{
$this->patchFileId = $patchFileId;
$this->patchFile = TabPatchFile::where('fid', $this->patchFileId)->first();
$this->isOpenEditCode = true;
}
public function closeModal()
{
$this->isOpenEditCode = false;
}
public function updateCode()
{
}
public function render()
{
return view('livewire.pages.patch.modal-edit-code');
}
}
<?php
namespace App\Http\Livewire\Pages\Patch;
use GuzzleHttp\Exception\RequestException;
use App\Models\ConfSmartupdate;
use App\Models\MasterPhpVer;
use App\Models\TabPatchFile;
use Livewire\Component;
use GuzzleHttp\Client;
use ZipArchive;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
class PatchCreate extends Component
{
public $projects = [];
public $branches = [];
public $selectedProject;
public $selectedBranch;
public $startCommit = '3d8740';
public $endCommit = '608212';
public $fileChanges = [], $filePathChanges = [];
public $searchProject = 'SPN64Bits';
public $UNINSTALL = '$b=1';
public $PATCHNAME, $PDATE, $PHP_VERSION, $PLEVEL, $PCODE, $MAJOR_VERSION, $PDESC, $Remark, $POWNER, $PAPPROVEDATE, $PTYPE, $SPECIFIC_CUSTOMER, $PATCHCODE, $PATCHCODE_SERVER;
public function mount()
{
$this->PDATE = date("Y-m-d H:i:s");
$this->PAPPROVEDATE = date("Y-m-d H:i:s");
$this->PLEVEL = 'High';
$this->PATCHCODE = 'function updatePatchFile($PATH_APP,$content){
$handle = fopen($PATH_APP, "w");
fputs($handle,base64_decode($content));
fclose($handle);
}
updatePatchFile("$$file_name_0","$$file_data_0");
$PATCH_STATUS="OK";';
$nextPid = ConfSmartupdate::max('PID') + 1;
$this->PATCHCODE_SERVER = '$a=1;
Query2Array("select * from tab_patch_file where ptid=' . "'" . $nextPid . "'" . '");
for($i=0;$i<count($fid);$i++){
${\'file_name_\'.$i}=$file_name[$i];
${\'file_data_\'.$i}=$file_data[$i];
}
$max=count($fid);';
}
public function updatedSearchProject()
{
$this->fetchProjects();
}
public function fetchProjects()
{
$client = new Client([
'headers' => [
'Authorization' => 'Bearer ' . env('GITLAB_API_TOKEN'),
'Accept' => 'application/json',
],
'verify' => false,
]);
$page = 1;
$perPage = 100;
$response = $client->get(env('GITLAB_API_URL') . '/projects', [
'query' => [
'membership' => true,
'min_access_level' => 30,
'search' => $this->searchProject,
'per_page' => $perPage,
],
]);
$this->projects = json_decode($response->getBody(), true);
$this->dispatchBrowserEvent('projects-fetched');
}
public function updatedSelectedProject($value)
{
$this->fetchBranches($value);
}
public function fetchBranches($projectId)
{
$client = new Client([
'headers' => [
'Authorization' => 'Bearer ' . env('GITLAB_API_TOKEN'),
'Accept' => 'application/json',
],
'verify' => false,
]);
$response = $client->get(env('GITLAB_API_URL') . "/projects/{$projectId}/repository/branches");
$this->branches = json_decode($response->getBody(), true);
}
public function getChangedFiles()
{
$client = new Client([
'headers' => [
'Authorization' => 'Bearer ' . env('GITLAB_API_TOKEN'),
'Accept' => 'application/json',
],
'verify' => false,
]);
$response = $client->get(env('GITLAB_API_URL') . "/projects/{$this->selectedProject}/repository/compare", [
'query' => [
'from' => $this->startCommit,
'to' => $this->endCommit,
],
]);
$data = json_decode($response->getBody(), true);
foreach ($data['diffs'] as $file) {
$this->filePathChanges[] = $file['new_path'];
}
$this->fileChanges = $this->buildTree($data['diffs']);
// dd($this->fileChanges);
$this->dispatchBrowserEvent('files-fetched', ['fileChanges' => $this->fileChanges]);
}
private function buildTree($files)
{
$tree = [];
foreach ($files as $file) {
$path = explode('/', $file['new_path']);
$current = &$tree;
foreach ($path as $part) {
if (!isset($current[$part])) {
$current[$part] = [];
}
$current = &$current[$part];
}
}
return $tree;
}
// $changedFiles = [];
// foreach ($data['diffs'] as $file) {
// $changedFiles[] = $file['new_path'];
// }
// $zip = new ZipArchive;
// $zipFileName = storage_path('app/changed_files.zip');
// if ($zip->open($zipFileName, ZipArchive::CREATE) === TRUE) {
// foreach ($changedFiles as $file) {
// $fileResponse = $client->get(env('GITLAB_API_URL')."/projects/{$this->selectedProject}/repository/files/" . urlencode($file) . '/raw', [
// 'query' => [
// 'ref' => $this->endCommit,
// ],
// ]);
// $fileContent = $fileResponse->getBody();
// $zip->addFromString($file, $fileContent);
// }
// $zip->close();
// }
// return response()->download($zipFileName);
// }
public function save()
{
// $this->validate([
// 'PATCHNAME' => 'required|string|max:255',
// 'PDATE' => 'required|date',
// 'PHP_VERSION' => 'required|integer',
// 'PLEVEL' => 'required|string|max:255',
// 'PCODE' => 'required|string|max:255',
// 'MAJOR_VERSION' => 'required|string|max:255',
// 'PDESC' => 'required|string|max:255',
// 'Remark' => 'required|string|max:255',
// 'POWNER' => 'required|string|max:255',
// 'PAPPROVEDATE' => 'required|date',
// 'PTYPE' => 'required|string|max:255',
// 'PATCHCODE' => 'required|string',
// 'UNINSTALL' => 'required|string|max:255',
// 'PATCHCODE_SERVER' => 'required|string',
// ]);
$codePhpVersion = MasterPhpVer::find($this->PHP_VERSION);
$confSmartUpdate = new ConfSmartUpdate();
$confSmartUpdate->PATCHNAME = $this->PATCHNAME;
$confSmartUpdate->PDATE = $this->PDATE;
$confSmartUpdate->PHP_VERSION_ID = $this->PHP_VERSION;
$confSmartUpdate->PLEVEL = $this->PLEVEL;
$confSmartUpdate->PCODE = $this->PCODE;
$confSmartUpdate->MAJOR_VERSION = $this->MAJOR_VERSION;
$confSmartUpdate->PDESC = $this->PDESC;
$confSmartUpdate->Remark = $this->Remark;
$confSmartUpdate->POWNER = $this->POWNER;
$confSmartUpdate->PAPPROVEDATE = $this->PAPPROVEDATE;
$confSmartUpdate->PTYPE = $this->PTYPE;
$confSmartUpdate->PATCHCODE = ($codePhpVersion->check_code ?? ''). " " .$this->PATCHCODE;
$confSmartUpdate->UNINSTALL = $this->UNINSTALL;
$confSmartUpdate->PATCHCODE_SERVER = $this->PATCHCODE_SERVER;
$confSmartUpdate->save();
if (count($this->filePathChanges) > 0) {
foreach ($this->filePathChanges as $file) {
$filedata = $this->getFileContentFromGit($file, $this->endCommit);
$filepath = new TabPatchFile;
$filepath->ptid = $confSmartUpdate->PID;
$filepath->file_name = str_replace("IE5DEV.shippingnet", ".", $file);
$filepath->file_data = base64_encode($filedata);
$filepath->save();
}
}
session()->flash('message', 'Patch details saved successfully.');
}
private function getFileContentFromGit($filePath, $commit)
{
$token = env('GITLAB_API_TOKEN');
$client = new Client([
'base_uri' => 'https://idemo.netbay.co.th/gitlab/api/v4/',
'headers' => [
'Authorization' => "Bearer $token",
'Accept' => 'application/json',
],
'verify' => false,
]);
try {
$response = $client->get("projects/$this->selectedProject/repository/files/" . urlencode($filePath) . "/raw", [
'query' => ['ref' => $commit]
]);
$statusCode = $response->getStatusCode();
$content = $response->getBody()->getContents();
if ($statusCode == 200) {
return $content;
} else {
throw new \Exception("Failed to fetch file. Status code: $statusCode");
}
} catch (RequestException $e) {
throw $e;
} catch (\Exception $e) {
throw $e;
}
}
public function render()
{
return view('livewire.pages.patch.patch-create');
}
}
<?php
namespace App\Http\Livewire\Pages\Patch;
use Livewire\Component;
use App\Models\ConfSmartUpdate;
use App\Models\TabPatchFile;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
class PatchEdit extends Component
{
public $patchId;
public $searchProject = '';
public $selectedBranch , $selectedPatch;
public $selectedProject;
public $projects = [];
public $branches = [];
public $fileChanges = [];
public $startCommit;
public $endCommit;
public $PATCHNAME;
public $PDATE;
public $PHP_VERSION;
public $PLEVEL;
public $PCODE;
public $MAJOR_VERSION;
public $PDESC;
public $Remark;
public $POWNER;
public $PAPPROVEDATE;
public $PTYPE;
public $PATCHCODE;
public $UNINSTALL;
public $PATCHCODE_SERVER;
public $filePathChanges = [];
protected $listeners = [ 'gotoModal'];
public function mount($editPid)
{
$this->patchId = $editPid;
$this->loadPatchData();
}
public function loadPatchData()
{
$patch = ConfSmartUpdate::findOrFail($this->patchId);
$this->PATCHNAME = $patch->PATCHNAME;
$this->PDATE = $patch->PDATE;
$this->PHP_VERSION = $patch->PHP_VERSION;
$this->PLEVEL = $patch->PLEVEL;
$this->PCODE = $patch->PCODE;
$this->MAJOR_VERSION = $patch->MAJOR_VERSION;
$this->PDESC = $patch->PDESC;
$this->Remark = $patch->Remark;
$this->POWNER = $patch->POWNER;
$this->PAPPROVEDATE = $patch->PAPPROVEDATE;
$this->PTYPE = $patch->PTYPE;
$this->PATCHCODE = $patch->PATCHCODE;
$this->UNINSTALL = $patch->UNINSTALL;
$this->PATCHCODE_SERVER = $patch->PATCHCODE_SERVER;
$filePath = TabPatchFile::where("ptid", $this->patchId)->get()->toArray();
$filePath = $this->buildTree($filePath);
$this->fileChanges = $filePath ;
}
public function save()
{
$this->validate([
'PATCHNAME' => 'required|string|max:255',
'PDATE' => 'required|date',
'PHP_VERSION' => 'required|integer',
'PLEVEL' => 'required|string|max:255',
'PCODE' => 'required|string|max:255',
'MAJOR_VERSION' => 'required|string|max:255',
'PDESC' => 'required|string|max:255',
'Remark' => 'required|string|max:255',
'POWNER' => 'required|string|max:255',
'PAPPROVEDATE' => 'required|date',
'PTYPE' => 'required|string|max:255',
'PATCHCODE' => 'required|string',
'UNINSTALL' => 'required|string|max:255',
'PATCHCODE_SERVER' => 'required|string',
]);
$confSmartUpdate = ConfSmartUpdate::findOrFail($this->patchId);
$confSmartUpdate->PATCHNAME = $this->PATCHNAME;
$confSmartUpdate->PDATE = $this->PDATE;
$confSmartUpdate->PHP_VERSION = $this->PHP_VERSION;
$confSmartUpdate->PLEVEL = $this->PLEVEL;
$confSmartUpdate->PCODE = $this->PCODE;
$confSmartUpdate->MAJOR_VERSION = $this->MAJOR_VERSION;
$confSmartUpdate->PDESC = $this->PDESC;
$confSmartUpdate->Remark = $this->Remark;
$confSmartUpdate->POWNER = $this->POWNER;
$confSmartUpdate->PAPPROVEDATE = $this->PAPPROVEDATE;
$confSmartUpdate->PTYPE = $this->PTYPE;
$confSmartUpdate->PATCHCODE = $this->PATCHCODE;
$confSmartUpdate->UNINSTALL = $this->UNINSTALL;
$confSmartUpdate->PATCHCODE_SERVER = $this->PATCHCODE_SERVER;
$confSmartUpdate->save();
if (count($this->filePathChanges) > 0) {
foreach ($this->filePathChanges as $file) {
$filePath = str_replace("IE5DEV.shippingnet", ".", $file);
$filedata = $this->getFileContentFromGit($filePath, $this->endCommit);
$filepath = new TabPatchFile;
$filepath->ptid = $confSmartUpdate->PID;
$filepath->file_name = $filePath;
$filepath->file_data = base64_encode($filedata);
$filepath->save();
}
}
session()->flash('message', 'Patch details and file changes updated successfully.');
}
private function getFileContentFromGit($filePath, $commit)
{
$token = env('GITLAB_API_TOKEN');
$client = new Client([
'base_uri' => 'https://idemo.netbay.co.th/gitlab/api/v4/',
'headers' => [
'Authorization' => "Bearer $token",
'Accept' => 'application/json',
],
'verify' => false,
]);
try {
$response = $client->get("projects/$this->selectedProject/repository/files/" . urlencode($filePath) . "/raw", [
'query' => ['ref' => $commit]
]);
$statusCode = $response->getStatusCode();
$content = $response->getBody()->getContents();
if ($statusCode == 200) {
return $content;
} else {
throw new \Exception("Failed to fetch file. Status code: $statusCode");
}
} catch (RequestException $e) {
throw $e;
} catch (\Exception $e) {
throw $e;
}
}
private function buildTree($files)
{
$tree = [];
foreach ($files as $file) {
$filePath = "IE5DEV.shippingnet" . substr($file['file_name'], 1);
$pathParts = explode('/', $filePath);
$current = &$tree;
foreach ($pathParts as $part) {
if (!isset($current[$part])) {
$current[$part] = [];
}
$current = &$current[$part];
}
$current['id'] = $file['fid'];
}
return $tree;
}
public function gotoModal(){
dd("dddd");
}
public function render()
{
return view('livewire.pages.patch.patch-edit');
}
}
<?php
namespace App\Http\Livewire\Pages\Patch;
use Livewire\Component;
use Livewire\WithPagination;
use App\Models\ConfSmartUpdate;
class PatchIndex extends Component
{
use WithPagination;
public $action = 'list';
public $searchBy, $editPid, $message, $keyword, $perPage = 10, $searchSelected = 'PID' ;
protected $listeners = [ 'deleteItem', 'deleteSelected' ,'showpatchListForm'];
public function mount()
{
$this->searchBy = [
'PID' => 'PID',
'PATCHNAME' => 'Patch Name',
'PDESC' => 'Description',
'MAJOR_VERSION' => 'Major Vaersion',
'Remark' => 'Remark'
];
}
public function render()
{
$query = ConfSmartUpdate::select('PID', 'PATCHNAME', 'PDESC', 'PDATE', 'PLEVEL', 'Remark', 'MAJOR_VERSION');
if ($this->searchSelected && $this->keyword) {
$query->where($this->searchSelected, 'LIKE', '%' . $this->keyword . '%');
}
$query->orderBy('PID', 'DESC');
$results = $query->paginate($this->perPage);
return view('livewire.pages.patch.patch-index', compact('results'));
}
public function search()
{
$this->resetPage();
}
public function showpatchListForm()
{
$this->action = 'list';
}
public function showpatchAddForm()
{
$this->action = 'add';
}
public function showpatchEditForm($pid)
{
$this->editPid = $pid;
$this->action = 'edit';
// $this->emit('showpatchEditForm');
}
}
......@@ -8,6 +8,7 @@ class ConfSmartupdate extends Model
{
protected $table = 'conf_smartupdate';
protected $primaryKey = 'PID';
public $timestamps = false;
protected $fillable = [
'PID',
'PATCHNAME',
......
......@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
class TabPatchFile extends Model
{
protected $table = 'tab_patch_file';
public $timestamps = false;
protected $fillable = [
'fid',
'ptid',
......
......@@ -3,6 +3,10 @@
'delete-modal' => 'App\\Http\\Livewire\\DeleteModal',
'main-container' => 'App\\Http\\Livewire\\MainContainer',
'navbar' => 'App\\Http\\Livewire\\Navbar',
'pages.patch.modal-edit-code' => 'App\\Http\\Livewire\\Pages\\Patch\\ModalEditCode',
'pages.patch.patch-create' => 'App\\Http\\Livewire\\Pages\\Patch\\PatchCreate',
'pages.patch.patch-edit' => 'App\\Http\\Livewire\\Pages\\Patch\\PatchEdit',
'pages.patch.patch-index' => 'App\\Http\\Livewire\\Pages\\Patch\\PatchIndex',
'pages.role.role-index' => 'App\\Http\\Livewire\\Pages\\Role\\RoleIndex',
'pages.send-patch.send-patch' => 'App\\Http\\Livewire\\Pages\\SendPatch\\SendPatch',
'pages.send-patch.send-patch-edit' => 'App\\Http\\Livewire\\Pages\\SendPatch\\SendPatchEdit',
......
......@@ -59,11 +59,11 @@
{{ $slot }}
@yield('content')
</main>
<footer class="bg-gray-800 text-white p-4">
{{-- <footer class="bg-gray-800 text-white p-4">
<div class="container mx-auto">
<p class="text-center">&copy; 2024 Your Company</p>
</div>
</footer>
</footer> --}}
@livewireScripts
@isset($script)
{{ $script }}
......
......@@ -5,15 +5,19 @@
<div class="animate-spin rounded-full h-32 w-32 border-t-2 border-b-2 border-blue-500"></div>
</div>
</div>
{{-- end loading --}}
@if ($currentContent === 'Role')
<livewire:pages.role.role-index />
@elseif ($currentContent === 'User')
<livewire:pages.user.user-index />
@elseif ($currentContent === 'SendPatch')
<livewire:pages.send-patch.send-patch />
@else
@livewire('code-comparer')
@endif
<div wire:loading.remove>
@if ($currentContent === 'Role')
<livewire:pages.role.role-index />
@elseif ($currentContent === 'User')
<livewire:pages.user.user-index />
@elseif ($currentContent === 'SendPatch')
<livewire:pages.send-patch.send-patch />
@elseif ($currentContent === 'Patch')
<livewire:pages.patch.patch-index />
@else
@livewire('code-comparer')
@endif
</div>
</div>
<nav class="bg-white shadow p-4 z-100">
<div class="container mx-auto flex justify-between items-center">
<div class="text-xl font-bold text-stone-700">SPN Patch</div>
<div class="text-xl font-bold text-stone-700"><a href="/">SPN Patch</a></div>
<ul class="flex space-x-4 z-50">
<li x-data="{ open: false }" @click.away="open = false" @mouseenter="open = true" class="relative">
<a href="#" class="text-gray-700 hover:text-stone-700">Server License Management</a>
......@@ -11,16 +11,10 @@
<li><a href="#" class="block px-4 py-2 text-gray-700 hover:bg-stone-100">Submenu 3</a></li>
</ul>
</li>
<li x-data="{ open: false }" @click.away="open = false" @mouseenter="open = true" class="relative">
<a href="#" class="text-gray-700 hover:text-stone-700">Patch Management</a>
<ul x-show="open" @click="open = false" @mouseleave="open = false"
class="absolute left-0 mt-2 w-48 bg-white shadow-lg">
<li><a href="#" class="block px-4 py-2 text-gray-700 hover:bg-stone-100">Submenu 1</a></li>
<li><a href="#" class="block px-4 py-2 text-gray-700 hover:bg-stone-100">Submenu 2</a></li>
<li><a href="#" class="block px-4 py-2 text-gray-700 hover:bg-stone-100">Submenu 3</a></li>
</ul>
<li x-data="{ open: false }" wire:click.prevent="loadContent('Patch')" class="relative">
<a href="#" class="text-gray-700 hover:text-stone-700">Patch</a>
</li>
<li x-data="{ open: false }"wire:click.prevent="loadContent('SendPatch')" class="relative">
<li x-data="{ open: false }" wire:click.prevent="loadContent('SendPatch')" class="relative">
<a href="#" class="text-gray-700 hover:text-stone-700">Send Patch</a>
</li>
<li x-data="{ open: false }" @click.away="open = false" @mouseenter="open = true" class="relative">
......
<div x-data="{ isOpenEditCode: @entangle('isOpenEditCode') }">
{{-- <style>
.bg-gray-800.bg-opacity-75 {
background-color: rgba(31, 41, 55, 0.75);
}
.bg-white {
background-color: rgba(255, 255, 255, 0.9);
}
.scrollable-modal {
max-height: 90vh;
overflow-y: auto;
}
</style> --}}
<div wire:loading.class="flex" wire:loading.class.remove="hidden"
wire:target="search, openModalMergeVessel, closeModal, mergeFlight"
class="fixed inset-0 items-center justify-center z-50 bg-gray-800 bg-opacity-75 hidden">
<div class="bg-white p-4 rounded-lg flex items-center justify-center">
<svg class="animate-spin h-5 w-5 text-gray-600" 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-8v8H4z"></path>
</svg>
<span class="ml-2 text-gray-600">Loading...</span>
</div>
</div>
<div x-show="isOpenEditCode"
class="fixed inset-0 flex items-center justify-center z-50 bg-gray-800 bg-opacity-75">
<div class="bg-white rounded-lg w-4/5">
<style>
code[class*="language-"],
pre[class*="language-"] {
background: white !important;
color: black;
}
.token.deleted {
background-color: #f8d7da;
color: #721c24;
}
.token.inserted {
background-color: #d4edda;
color: #155724;
}
</style>
<div class="flex w-full justify-between rounded-t-lg bg-slate-100 px-4 py-3 dark:bg-navy-800 sm:px-5">
<h3 class="text-base font-medium text-slate-700 dark:text-navy-100">
Edit Code
</h3>
<button type="button" @click="isOpenEditCode = false"
class="btn -mr-1.5 h-7 w-7 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" viewBox="0 0 24 24"
stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
<div class="flex " x-data="{ gitCode: @entangle('gitCode') }">
<div class="w-1/2 p-4">
<h3 class="text-lg font-semibold">GitLab Code:</h3>
<div class="relative">
<div class="overflow-auto p-2 bg-gray-100 rounded">
<pre class="line-numbers language-markup"><code >{{ $gitCode }}</code></pre>
</div>
</div>
</div>
<div class="w-1/2 p-4">
<h3 class="text-lg font-semibold">Your Code:</h3>
<textarea wire:model.defer="code" rows="20" class="w-full p-2 border rounded language-markup"
placeholder="Paste your code here...">
</textarea>
<button wire:click="compare" id="compare"
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded mt-2">Compare</button>
</div>
</div>
<div class="mx-3">
<h3 class="text-lg font-semibold mt-4">Differences:</h3>
<div class="overflow-auto p-2 bg-gray-100 rounded">
{{-- <pre class="line-numbers "> <code >{!! $diffResult !!}</code></pre> --}}
</div>
</div>
</div>
</div>
</div>
<div class="max-w-full mx-auto p-6 bg-gray-100">
@if (session()->has('message'))
<div class="alert alert-success">
{{ session('message') }}
</div>
@endif
{{-- <style>
.tree ul {
padding-left: 1.25rem; /* 1rem = 16px, so 1.25rem = 20px */
list-style-type: none;
position: relative;
}
.tree ul::before {
content: '';
border-left: 2px solid #d3d3d3;
position: absolute;
top: 0;
bottom: 0;
left: 0.75rem; /* 0.75rem = 12px */
}
.tree li {
margin: 0.5rem 0;
padding-left: 1.25rem;
position: relative;
}
.tree li::before {
content: '';
border-top: 2px solid #d3d3d3;
position: absolute;
top: 0.875rem; /* 0.875rem = 14px */
left: 0;
width: 0.75rem; /* 0.75rem = 12px */
}
.tree li::after {
content: '';
border-left: 2px solid #d3d3d3;
position: absolute;
top: 0;
bottom: 0;
left: 0;
height: 0.875rem; /* 0.875rem = 14px */
margin-top: 0.875rem;
}
.tree li:last-child::after {
display: none;
} --}}
<div class="flex flex-wrap -mx-3">
<div class="w-full md:w-1/2 px-3 mb-6">
<div x-data="{
searchQuery: 'SPN64Bits',
selectedBranch: @entangle('selectedBranch'),
selectedProject: @entangle('selectedProject'),
projects: @entangle('projects').defer,
branches: @entangle('branches').defer,
fileChanges: @entangle('fileChanges').defer,
isLoading: false,
fetchProjects() {
this.isLoading = true;
this.selectedProject = '60';
this.$wire.set('searchProject', this.searchQuery);
},
fetchBranches() {
// this.selectedBranch = '';
if (this.selectedProject) {
this.$wire.set('selectedProject', this.selectedProject);
}
},
renderTree(subtree) {
return Object.keys(subtree).map(key => {
if (typeof subtree[key] === 'object' && Object.keys(subtree[key]).length > 0) {
return `<li>
<strong>${key}</strong>
<ul class='pl-4 mt-1'>${this.renderTree(subtree[key])}</ul>
</li>`;
} else {
return `<li class='text-gray-700'><i class='fa fa-file text-base mr-2'></i>${key}</li>`;
}
}).join('');
}
}" @projects-fetched.window="isLoading = false"
@files-fetched.window="isLoading = false" x-init="fetchProjects"
class="p-6 bg-white shadow-md rounded-lg">
</style>
<div class="">
<div class="flex mb-3">
<label for="searchProject" class="form-label text-lg mr-2">Search Project:</label>
<input type="text" @input.debounce.500ms="fetchProjects"
class="form-input h-8 ml-2 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"
id="searchProject" placeholder="Enter project name" x-model="searchQuery">
</div>
</div>
{{-- <div x-show="!isLoading && projects.length > 0" class="grid grid-cols-3"> --}}
<div x-show="true" class="">
<div class="flex mb-3">
<label for="project" class="form-label text-lg mr-2">Select Project:</label>
<div x-show="isLoading" class="mx-auto mt-2">
<span>Loading...</span>
</div>
<select x-model="selectedProject" x-show="!isLoading" @change="fetchBranches" id="project"
class="ml-2 w-64 h-8 mt-1 border border-gray-300 rounded-md">
<option value="">Choose Project</option>
<template x-for="project in projects" :key="project.id">
<option :value="project.id" x-text="project.name"></option>
</template>
</select>
</div>
</div>
{{-- <template x-if="selectedProject"> --}}
{{-- <template x-if="true">
<div class="mb-3">
<label for="branch" class="form-label w-64 text-lg mr-2">Select Branch:</label>
<select x-model="selectedBranch" id="branch"
class="ml-2 w-64 h-8 mt-1 border border-gray-300 rounded-md">
<option value="">Choose Branch</option>
<template x-for="branch in branches" :key="branch.name">
<option :value="branch.name" x-text="branch.name"></option>
</template>
</select>
</div>
</template> --}}
<div class="mb-3">
<input type="text" value="c5d80f79" wire:model.defer="startCommit" placeholder="Start Commit"
class="placeholder:text-sm text-lg mb-2 form-input rounded-lg border border-slate-300 px-2">
<input type="text" value="254e87" wire:model.defer="endCommit" placeholder="End Commit"
class="placeholder:text-sm text-lg mb-2 form-input rounded-lg border border-slate-300 px-2">
<div class="text-center">
<button type="button" wire:click="getChangedFiles"
class="btn mx-auto mt-3 text-white bg-stone-700 px-3 py-2">Get
Changed
Files</button>
</div>
</div>
<div wire:loading.class="flex" wire:loading.class.remove="hidden"
class="flex inset-0 items-center justify-center z-50 bg-slate-50 dark:bg-navy-900 hidden">
<div class="app-preloader grid h-full w-full place-content-center">
<div class="app-preloader-inner relative inline-block h-48 w-48"></div>
</div>
</div>
<template x-if="Object.keys(fileChanges).length > 0">
<div class="mt-5 bg-gray-100 p-4 rounded-lg shadow">
<h3 class="text-lg mb-3">Changed Files</h3>
<div class="tree">
<ul x-html="renderTree(fileChanges)"></ul>
</div>
</div>
</template>
</div>
</div>
<div class="w-full md:w-1/2 px-3 mb-6">
<div class="p-6 bg-white shadow-md rounded-lg">
<h2 class="text-2xl font-bold mb-4">Create Patch</h2>
<div class="mb-4">
<label for="patch_name" class="block text-gray-700">Patch name</label>
<input type="text" id="patch_name" class="w-full mt-1 p-2 border border-gray-300 rounded-md"
wire:model.defer="PATCHNAME">
</div>
<div class="mb-4">
<label for="patch_date" class="block text-gray-700">Patch date</label>
<input type="datetime-local" id="patch_date"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" wire:model.defer="PDATE">
</div>
<div class="mb-4">
<label for="php_version" class="block text-gray-700">PHP Version</label>
<select id="php_version" wire:model.defer="PHP_VERSION"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
<option value="0">ALL</option>
<option value="1">32Bits (PHP 5.2)</option>
<option value="2">64Bits (PHP 5.6)</option>
<option value="3">64Bits (PHP 8.0)</option>
</select>
</div>
<div class="mb-4">
<label for="patch_level" class="block text-gray-700">Patch level</label>
<input type="text" id="patch_level" class="w-full mt-1 p-2 border border-gray-300 rounded-md"
wire:model.defer="PLEVEL">
</div>
<div class="mb-4">
<label for="code" class="block text-gray-700">Patch Code</label>
<input type="text" id="code" wire:model.defer="PCODE"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
</div>
<div class="mb-4">
<label for="major_version" class="block text-gray-700">Major version</label>
<input type="text" id="major_version"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" wire:model.defer="MAJOR_VERSION">
</div>
<div class="mb-4">
<label for="pdesc" class="block text-gray-700">Patch Desciption</label>
<input type="text" id="pdesc" wire:model.defer="PDESC"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
</div>
<div class="mb-4">
<label for="remark" class="block text-gray-700">Remark</label>
<input type="text" id="remark" wire:model.defer="Remark"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
</div>
<div class="mb-4">
<label for="owner" class="block text-gray-700">Owner</label>
<input type="text" id="owner" wire:model.defer="POWNER"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" value="aom">
</div>
<div class="mb-4">
<label for="papprovedate" class="block text-gray-700">Papprovedate</label>
<input type="datetime-local" id="papprovedate" wire:model.defer="PAPPROVEDATE"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" value="2024-03-27T15:00">
</div>
<div class="mb-4">
<label for="ptype" class="block text-gray-700">Ptype</label>
<input type="text" id="ptype" wire:model.defer="PTYPE"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
</div>
<div class="mb-4">
<label for="specific_customer" class="block text-gray-700">Specific Customer</label>
<input type="text" id="specific_customer"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
</div>
<div class="mb-4">
<label for="patchcode" class="block text-gray-700">Patchcode</label>
<textarea id="patchcode" wire:model.defer="PATCHCODE" class="w-full mt-1 p-2 border border-gray-300 rounded-md"
rows="5">pathcode</textarea>
</div>
<div class="mb-4">
<label for="uninstall" class="block text-gray-700">Uninstall</label>
<input type="text" id="uninstall" wire:model.defer="UNINSTALL"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" value="$b=1">
</div>
<div class="mb-4">
<label for="patchcode_server" class="block text-gray-700">Patchcode_server</label>
<textarea id="patchcode_server" wire:model.defer="PATCHCODE_SERVER"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" rows="5"></textarea>
</div>
<div class="flex justify-center">
<button type="button" wire:click="save"
class="bg-stone-700 text-white px-4 py-2 rounded-md hover:bg-blue-600">Save</button>
</div>
</div>
</div>
</div>
<div class="max-w-full mx-auto p-6 bg-gray-100">
<div class="flex flex-wrap -mx-3">
<div class="w-full md:w-1/2 px-3 mb-6">
<div x-data="{
searchQuery: 'SPN64Bits',
selectedBranch: @entangle('selectedBranch'),
selectedProject: @entangle('selectedProject'),
projects: @entangle('projects').defer,
branches: @entangle('branches').defer,
fileChanges: @entangle('fileChanges').defer,
isLoading: false,
fetchProjects() {
this.isLoading = true;
this.selectedProject = '60';
this.$wire.set('searchProject', this.searchQuery);
},
fetchBranches() {
if (this.selectedProject) {
this.$wire.set('selectedProject', this.selectedProject);
}
}
}" @projects-fetched.window="isLoading = false"
@files-fetched.window="isLoading = false" x-init="fetchProjects"
class="p-6 bg-white shadow-md rounded-lg">
<div class="">
<div class="flex mb-3">
<label for="searchProject" class="form-label text-lg mr-2">Search Project:</label>
<input type="text" @input.debounce.500ms="fetchProjects"
class="form-input h-8 ml-2 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"
id="searchProject" placeholder="Enter project name" x-model="searchQuery">
</div>
</div>
<div x-show="true" class="">
<div class="flex mb-3">
<label for="project" class="form-label text-lg mr-2">Select Project:</label>
<div x-show="isLoading" class="mx-auto mt-2">
<span>Loading...</span>
</div>
<select x-model="selectedProject" x-show="!isLoading" @change="fetchBranches" id="project"
class="ml-2 w-64 h-8 mt-1 border border-gray-300 rounded-md">
<option value="">Choose Project</option>
<template x-for="project in projects" :key="project.id">
<option :value="project.id" x-text="project.name"></option>
</template>
</select>
</div>
</div>
<div class="mb-3">
<input type="text" wire:model.defer="startCommit" placeholder="Start Commit"
class="placeholder:text-sm text-lg mb-2 form-input rounded-lg border border-slate-300 px-2">
<input type="text" wire:model.defer="endCommit" placeholder="End Commit"
class="placeholder:text-sm text-lg mb-2 form-input rounded-lg border border-slate-300 px-2">
<div class="text-center">
<button type="button" wire:click="getChangedFiles"
class="btn mx-auto mt-3 text-white bg-stone-700 px-3 py-2">Get Changed Files</button>
</div>
</div>
<div wire:loading.class="flex" wire:loading.class.remove="hidden"
class="flex inset-0 items-center justify-center z-50 bg-slate-50 dark:bg-navy-900 hidden">
<div class="app-preloader grid h-full w-full place-content-center">
<div class="app-preloader-inner relative inline-block h-48 w-48"></div>
</div>
</div>
<div class="mt-5 bg-gray-100 p-4 rounded-lg shadow">
<h3 class="text-lg mb-3">Changed Files</h3>
<div class="file-tree">
<ul>
@foreach ($fileChanges as $name => $item)
@include('livewire.pages.patch.tree-item', [
'name' => $name,
'item' => $item,
])
@endforeach
</ul>
</div>
</div>
</div>
</div>
<div class="w-full md:w-1/2 px-3 mb-6">
<div class="p-6 bg-white shadow-md rounded-lg">
<h2 class="text-2xl font-bold mb-4">Edit Patch</h2>
<div class="mb-4">
<label for="patch_name" class="block text-gray-700">Patch name</label>
<input type="text" id="patch_name" class="w-full mt-1 p-2 border border-gray-300 rounded-md"
wire:model.defer="PATCHNAME">
</div>
<div class="mb-4">
<label for="patch_date" class="block text-gray-700">Patch date</label>
<input type="datetime-local" id="patch_date"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" wire:model.defer="PDATE">
</div>
<div class="mb-4">
<label for="php_version" class="block text-gray-700">PHP Version</label>
<select id="php_version" wire:model.defer="PHP_VERSION"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
<option value="0">ALL</option>
<option value="1">32Bits (PHP 5.2)</option>
<option value="2">64Bits (PHP 5.6)</option>
<option value="3">64Bits (PHP 8.0)</option>
</select>
</div>
<div class="mb-4">
<label for="patch_level" class="block text-gray-700">Patch level</label>
<input type="text" id="patch_level" class="w-full mt-1 p-2 border border-gray-300 rounded-md"
wire:model.defer="PLEVEL">
</div>
<div class="mb-4">
<label for="code" class="block text-gray-700">Patch Code</label>
<input type="text" id="code" wire:model.defer="PCODE"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
</div>
<div class="mb-4">
<label for="major_version" class="block text-gray-700">Major version</label>
<input type="text" id="major_version" class="w-full mt-1 p-2 border border-gray-300 rounded-md"
wire:model.defer="MAJOR_VERSION">
</div>
<div class="mb-4">
<label for="pdesc" class="block text-gray-700">Patch Description</label>
<input type="text" id="pdesc" wire:model.defer="PDESC"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
</div>
<div class="mb-4">
<label for="remark" class="block text-gray-700">Remark</label>
<input type="text" id="remark" wire:model.defer="Remark"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
</div>
<div class="mb-4">
<label for="owner" class="block text-gray-700">Owner</label>
<input type="text" id="owner" wire:model.defer="POWNER"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" value="aom">
</div>
<div class="mb-4">
<label for="papprovedate" class="block text-gray-700">Papprovedate</label>
<input type="datetime-local" id="papprovedate" wire:model.defer="PAPPROVEDATE"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" value="2024-03-27T15:00">
</div>
<div class="mb-4">
<label for="ptype" class="block text-gray-700">Ptype</label>
<input type="text" id="ptype" wire:model.defer="PTYPE"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
</div>
<div class="mb-4">
<label for="specific_customer" class="block text-gray-700">Specific Customer</label>
<input type="text" id="specific_customer"
class="w-full mt-1 p-2 border border-gray-300 rounded-md">
</div>
<div class="mb-4">
<label for="patchcode" class="block text-gray-700">Patchcode</label>
<textarea id="patchcode" wire:model.defer="PATCHCODE" class="w-full mt-1 p-2 border border-gray-300 rounded-md"
rows="5">pathcode</textarea>
</div>
<div class="mb-4">
<label for="uninstall" class="block text-gray-700">Uninstall</label>
<input type="text" id="uninstall" wire:model.defer="UNINSTALL"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" value="$b=1">
</div>
<div class="mb-4">
<label for="patchcode_server" class="block text-gray-700">Patchcode_server</label>
<textarea id="patchcode_server" wire:model.defer="PATCHCODE_SERVER"
class="w-full mt-1 p-2 border border-gray-300 rounded-md" rows="5"></textarea>
</div>
<div class="flex justify-center">
<button type="button" wire:click="save"
class="bg-stone-700 text-white px-4 py-2 rounded-md hover:bg-blue-600">Save</button>
</div>
</div>
</div>
</div>
<livewire:pages.patch.modal-edit-code>
</div>
{{-- <li class='text-gray-700'><a href='#' wire:click='openEditCode(${key})'></a><i class='fa fa-file text-base mr-2'></i>${key} </li> --}}
<div wire:loading.remove>
<style>
table {
width: 100%;
table-layout: auto;
}
.table-responsive {
overflow-x: auto;
}
</style>
<main 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 ($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"
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="grid grid-cols-1 gap-4 sm:gap-5 lg:gap-6 ">
<div class="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">
Patch Management
</h2>
</div>
<div class="flex justify-between">
<div class="px-2 ml-4">
<button type="button" class="py-2 px-3 bg-stone-700 rounded-lg text-white" wire:click="showpatchAddForm">Add</button>
</div>
<div class="inline-flex flex-initial">
<div x-data="{ isInputActive: true }">
<div class="flex gap-4 px-5 items-center">
<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">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4.5 w-4.5" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<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" />
</svg>
</button>
<span class="w-64" x-show="isInputActive === true">
<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"
placeholder="Search Keyword" type="text" wire:model.defer="keyword" />
</span>
<span class="w-52" x-show="isInputActive === true">
<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">
@foreach ($searchBy as $key => $by)
<option value="{{ $key }}">{{ $by }}</option>
@endforeach
</select>
</span>
<button type="button" class="bg-stone-700 text-white px-4 py-2 rounded"
wire:click="search">Search</button>
</div>
</div>
</div>
</div>
<div class="mx-3 mt-3 px-4">
<div class="is-scrollbar-hidden min-w-full table-responsive" x-data="pages.tables.initExample1">
<table class="is-hoverable table w-full text-left">
<thead>
<tr>
<th
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">
#
</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">
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">
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">
Patch 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">
Patch Level
</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">
Major Version
</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">
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">
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">
Action
</th>
</tr>
</thead>
<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 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" wire:model.defer="selectedPatch"
value="{{ $patch->id }}" />
</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">
{{ \Illuminate\Support\Str::limit($patch->PATCHNAME, 40) }}</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->PLEVEL }}</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">{{ $patch->MAJOR_VERSION }}
</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->Remark }}</td>
<td class="whitespace-nowrap px-1 py-3 sm:px-2">
<div class="flex justify-center space-x-2">
<a wire:click="showpatchEditForm({{ $patch->PID }})"
class="btn h-8 w-8 p-0 text-info hover:bg-info/20 focus:bg-info/20 active:bg-info/25">
<i class="fa fa-edit"></i>
</a>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<livewire:delete-modal />
{{ $results->links('livewire.paginate-custom') }}
</div>
</div>
</div>
@elseif($action === 'add')
<livewire:pages.patch.patch-create >
@elseif($action === 'edit')
<livewire:pages.patch.patch-edit :editPid="$editPid">
@endif
</main>
</div>
@php
$isFile = isset($item['id']);
@endphp
<li class="{{ $isFile ? 'file' : 'folder' }}">
@if($isFile)
<a href="#" class="text-bold" wire:click.prevent="$emit('openModalEditCode', '{{ $item['id'] }}')"><i class='fa fa-file text-base mr-2'></i>{{ $name }}</a>
@else
<span>{{ $name }}</span>
<ul class='pl-4 mt-1'>
@foreach($item as $childName => $childItem)
@include('livewire.pages.patch.tree-item', ['name' => $childName, 'item' => $childItem])
@endforeach
</ul>
@endif
</li>
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