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
7992064a
Commit
7992064a
authored
Jul 15, 2024
by
Thidaporn Laisan
Browse files
update parameter
parent
885add3c
Changes
8
Show whitespace changes
Inline
Side-by-side
app/Http/Livewire/Pages/Parameter/ParameterEdit.php
0 → 100644
View file @
7992064a
<?php
namespace
App\Http\Livewire\Pages\Patch
;
use
Livewire\Component
;
use
App\Models\ConfParameter
;
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'
);
}
}
app/Http/Livewire/Pages/Parameter/ParameterIndex.php
0 → 100644
View file @
7992064a
<?php
namespace
App\Http\Livewire\Pages\Parameter
;
use
Livewire\Component
;
use
Livewire\WithPagination
;
use
App\Models\ConfParameter
;
use
App\Models\TabParameterInfo
;
use
App\Models\TabSpnpage
;
class
ParameterIndex
extends
Component
{
use
WithPagination
;
public
$action
=
'list'
;
public
$searchBy
,
$searchByPage
,
$editPid
,
$message
,
$keyword
,
$perPage
=
10
,
$searchSelected
=
'name'
,
$searchSelectedPage
=
''
;
protected
$listeners
=
[
'deleteItem'
,
'deleteSelected'
,
'showparameterListForm'
];
public
function
mount
()
{
$this
->
searchBy
=
[
'name'
=>
'By Name'
,
'value'
=>
'By Value'
,
'description'
=>
'By Description'
];
$this
->
searchByPage
=
TabSpnpage
::
select
(
'pagecode'
,
'pagename'
)
->
get
()
->
toArray
();
logger
(
$this
->
searchByPage
);
}
public
function
render
()
{
$query
=
ConfParameter
::
select
(
'conf_parameter.PID'
,
'conf_parameter.name'
,
'conf_parameter.value'
,
'conf_parameter.description'
,
'conf_parameter.active'
,
'tab_parameter_info.pageCode'
)
->
leftJoin
(
'tab_parameter_info'
,
'conf_parameter.name'
,
'='
,
'tab_parameter_info.parameterName'
);
if
(
$this
->
searchSelected
&&
$this
->
keyword
)
{
$query
->
where
(
$this
->
searchSelected
,
'LIKE'
,
'%'
.
$this
->
keyword
.
'%'
);
}
if
(
$this
->
searchSelectedPage
)
{
$query
->
where
(
'tab_parameter_info.pageCode'
,
$this
->
searchSelectedPage
);
}
$query
->
orderBy
(
'PID'
,
'DESC'
);
$results
=
$query
->
paginate
(
$this
->
perPage
);
return
view
(
'livewire.pages.parameter.parameter-index'
,
compact
(
'results'
));
}
public
function
search
()
{
$this
->
resetPage
();
}
public
function
showparameterListForm
()
{
$this
->
action
=
'list'
;
}
public
function
showparameterAddForm
()
{
$this
->
action
=
'add'
;
}
public
function
showparameterEditForm
(
$pid
)
{
$this
->
editPid
=
$pid
;
$this
->
action
=
'edit'
;
// $this->emit('showpatchEditForm');
}
}
app/Http/Livewire/Pages/Patch/ModalEditCode.php
View file @
7992064a
...
@@ -22,7 +22,7 @@ class ModalEditCode extends Component
...
@@ -22,7 +22,7 @@ class ModalEditCode extends Component
$patchFile
=
TabPatchFile
::
where
(
'fid'
,
$this
->
patchFileId
)
->
first
();
$patchFile
=
TabPatchFile
::
where
(
'fid'
,
$this
->
patchFileId
)
->
first
();
$this
->
patchFile
=
TabPatchFile
::
where
(
'fid'
,
$this
->
patchFileId
)
->
first
();
$this
->
patchFile
=
TabPatchFile
::
where
(
'fid'
,
$this
->
patchFileId
)
->
first
();
$this
->
isOpenEditCode
=
true
;
$this
->
isOpenEditCode
=
true
;
$this
->
dbCode
=
base64_decode
(
$this
->
patchFile
)
$this
->
dbCode
=
base64_decode
(
$this
->
patchFile
)
;
// $this->gitCode = $this->getFileContentFromGit();
// $this->gitCode = $this->getFileContentFromGit();
}
}
...
...
bootstrap/cache/livewire-components.php
View file @
7992064a
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
'delete-modal'
=>
'App\\Http\\Livewire\\DeleteModal'
,
'delete-modal'
=>
'App\\Http\\Livewire\\DeleteModal'
,
'main-container'
=>
'App\\Http\\Livewire\\MainContainer'
,
'main-container'
=>
'App\\Http\\Livewire\\MainContainer'
,
'navbar'
=>
'App\\Http\\Livewire\\Navbar'
,
'navbar'
=>
'App\\Http\\Livewire\\Navbar'
,
'pages.parameter.parameter-index'
=>
'App\\Http\\Livewire\\Pages\\Parameter\\ParameterIndex'
,
'pages.patch.modal-edit-code'
=>
'App\\Http\\Livewire\\Pages\\Patch\\ModalEditCode'
,
'pages.patch.modal-edit-code'
=>
'App\\Http\\Livewire\\Pages\\Patch\\ModalEditCode'
,
'pages.patch.patch-create'
=>
'App\\Http\\Livewire\\Pages\\Patch\\PatchCreate'
,
'pages.patch.patch-create'
=>
'App\\Http\\Livewire\\Pages\\Patch\\PatchCreate'
,
'pages.patch.patch-edit'
=>
'App\\Http\\Livewire\\Pages\\Patch\\PatchEdit'
,
'pages.patch.patch-edit'
=>
'App\\Http\\Livewire\\Pages\\Patch\\PatchEdit'
,
...
...
resources/views/livewire/main-container.blade.php
View file @
7992064a
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
<livewire:pages.send-patch.send-patch
/>
<livewire:pages.send-patch.send-patch
/>
@elseif ($currentContent === 'Patch')
@elseif ($currentContent === 'Patch')
<livewire:pages.patch.patch-index
/>
<livewire:pages.patch.patch-index
/>
@elseif ($currentContent === 'Parameter')
<livewire:pages.parameter.parameter-index
/>
@else
@else
@livewire('code-comparer')
@livewire('code-comparer')
@endif
@endif
...
...
resources/views/livewire/navbar.blade.php
View file @
7992064a
...
@@ -17,6 +17,9 @@
...
@@ -17,6 +17,9 @@
<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>
<a
href=
"#"
class=
"text-gray-700 hover:text-stone-700"
>
Send Patch
</a>
</li>
</li>
<li
x-data=
"{ open: false }"
wire:click.prevent=
"loadContent('Parameter')"
class=
"relative"
>
<a
href=
"#"
class=
"text-gray-700 hover:text-stone-700"
>
Parameter
</a>
</li>
<li
x-data=
"{ open: false }"
@
click.away=
"open = false"
@
mouseenter=
"open = true"
class=
"relative"
>
<li
x-data=
"{ open: false }"
@
click.away=
"open = false"
@
mouseenter=
"open = true"
class=
"relative"
>
<a
href=
"#"
class=
"text-gray-700 hover:text-stone-700"
>
Configuration
</a>
<a
href=
"#"
class=
"text-gray-700 hover:text-stone-700"
>
Configuration
</a>
<ul
x-show=
"open"
@
click=
"open = false"
@
mouseleave=
"open = false"
<ul
x-show=
"open"
@
click=
"open = false"
@
mouseleave=
"open = false"
...
...
resources/views/livewire/pages/parameter/parameter-edit.blade.php
0 → 100644
View file @
7992064a
<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
class=
'pl-4 mt-1'
>
@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>
resources/views/livewire/pages/parameter/parameter-index.blade.php
0 → 100644
View file @
7992064a
<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"
>
SPN Parameter
</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=
"showparameterAddForm"
>
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>
<span
class=
"w-26"
x-show=
"isInputActive === true"
>
Page
</span>
<span
class=
"w-52"
x-show=
"isInputActive === true"
>
<select
wire:model.defer=
"searchSelectedPage"
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 ($searchByPage as $page)
@if (isset($page['pagecode'])
&&
isset($page['pagename']))
<option
value=
""
>
Please Select
</option>
<option
value=
"{{ $page['pagecode'] }}"
>
{{ $page['pagename'] }}
</option>
@endif
@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"
>
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"
>
Value
</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"
>
Page
</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"
>
Active
</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 $para)
<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=
"selectedParameter"
value=
"{{ $para->id }}"
/>
</label>
</td>
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2"
>
{{ \Illuminate\Support\Str::limit($para->name, 40) }}
</td>
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2"
>
{{ $para->value }}
</td>
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2"
>
{{ $para->description }}
</td>
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2"
>
{{ $para->pageCode }}
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2"
>
{{ $para->active }}
</td>
<td
class=
"whitespace-nowrap px-1 py-3 sm:px-2"
>
<div
class=
"flex justify-center space-x-2"
>
<a
wire:click=
"showparameterEditForm({{ $para->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.parameter.parameter-create
>
@elseif($action === 'edit')
<livewire:pages.parameter.parameter-edit
:editPid=
"$editPid"
>
@endif
</main>
</div>
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