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
1c651af7
Commit
1c651af7
authored
Aug 06, 2024
by
Sarun Mungthanya
Browse files
update message alert
parent
4a8a9412
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/Http/Livewire/Pages/Patch/PatchEdit.php
View file @
1c651af7
...
@@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Cache;
...
@@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Cache;
class
PatchEdit
extends
Component
class
PatchEdit
extends
Component
{
{
public
$patchId
;
public
$patchId
,
$message
;
public
$progressSave
=
0
,
$isProcessing
=
false
,
$progress
=
0
,
$currentStep
=
0
;
public
$progressSave
=
0
,
$isProcessing
=
false
,
$progress
=
0
,
$currentStep
=
0
;
public
$searchProject
=
''
;
public
$searchProject
=
''
;
public
$selectedBranch
,
$selectedPatch
,
$showModal
;
public
$selectedBranch
,
$selectedPatch
,
$showModal
;
...
@@ -237,25 +237,25 @@ class PatchEdit extends Component
...
@@ -237,25 +237,25 @@ class PatchEdit extends Component
$this
->
currentStep
+=
1
;
$this
->
currentStep
+=
1
;
$this
->
progress
=
round
((
$this
->
currentStep
/
$totalFiles
)
*
100
,
2
);
$this
->
progress
=
round
((
$this
->
currentStep
/
$totalFiles
)
*
100
,
2
);
if
(
$this
->
progress
==
100
)
{
// $this->isProcessing = false;
$this
->
message
=
'Patch details and file changes updated successfully.'
;
$this
->
emit
(
'reloadComponent'
,
$this
->
patchId
);
$this
->
reset
([
'fileChangesTemp'
,
'fileGitChanges'
,
'currentStep'
]);
}
}
else
{
}
else
{
$this
->
isProcessing
=
false
;
// $this->isProcessing = false;
session
()
->
flash
(
'message'
,
'Patch details and file changes updated successfully.'
);
// session()->flash('message', 'Patch details and file changes updated successfully.');
$this
->
reset
([
'fileChangesTemp'
,
'fileGitChanges'
,
'currentStep'
,
'progress'
]);
// $this->message = 'Patch details and file changes updated successfully.';
$this
->
emit
(
'reloadComponent'
,
$this
->
patchId
);
// $this->reset(['fileChangesTemp', 'fileGitChanges', 'currentStep', 'progress']);
}
}
}
}
return
$this
->
progress
;
return
$this
->
progress
;
}
}
// public function processStep()
// {
// // จำลองการประมวลผล
// if ($this->progress < 100) {
// $this->progress += 10; // เพิ่มค่าความคืบหน้า
// }
// return $this->progress;
// }
private
function
formatFilePath
(
$file
)
private
function
formatFilePath
(
$file
)
{
{
...
@@ -341,7 +341,7 @@ class PatchEdit extends Component
...
@@ -341,7 +341,7 @@ class PatchEdit extends Component
$pathFile
=
TabPatchFile
::
where
(
"fid"
,
$patchFileId
)
->
delete
();
$pathFile
=
TabPatchFile
::
where
(
"fid"
,
$patchFileId
)
->
delete
();
$message
=
"Deleted File ID : "
.
json_encode
(
$patchFileId
)
.
" Successfully"
;
$message
=
"Deleted File ID : "
.
json_encode
(
$patchFileId
)
.
" Successfully"
;
//
$this->message = $message;
$this
->
message
=
$message
;
$this
->
emit
(
'reloadComponent'
,
$patchId
);
$this
->
emit
(
'reloadComponent'
,
$patchId
);
}
}
public
function
deleteSelectedPatchFiles
(
$selectedFiles
)
public
function
deleteSelectedPatchFiles
(
$selectedFiles
)
...
...
app/Http/Livewire/Pages/Patch/PatchIndex.php
View file @
1c651af7
...
@@ -10,8 +10,8 @@ use App\Models\TabPatchFile;
...
@@ -10,8 +10,8 @@ use App\Models\TabPatchFile;
class
PatchIndex
extends
Component
class
PatchIndex
extends
Component
{
{
use
WithPagination
;
use
WithPagination
;
public
$action
=
'
edi
t'
;
public
$action
=
'
lis
t'
;
public
$searchBy
,
$editPid
,
$message
,
$keyword
,
$perPage
=
10
,
$searchSelected
=
'PID'
;
public
$searchBy
,
$editPid
,
$message
,
$keyword
,
$perPage
=
10
,
$searchSelected
=
'PID'
,
$selectedPatch
=
[]
;
protected
$listeners
=
[
'deleteItem'
,
'deleteSelected'
,
'showpatchListForm'
];
protected
$listeners
=
[
'deleteItem'
,
'deleteSelected'
,
'showpatchListForm'
];
public
function
mount
()
public
function
mount
()
{
{
...
...
resources/views/livewire/pages/patch/patch-edit.blade.php
View file @
1c651af7
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
console.log(result)
console.log(result)
progress = result;
progress = result;
if (progress >= 100) {
if (progress >= 100) {
progress = 0
;
progress = 0;
clearInterval(interval);
clearInterval(interval);
}
}
});
});
...
@@ -28,6 +28,14 @@
...
@@ -28,6 +28,14 @@
<div
x-show=
"progress > 0"
x-text=
"progress + '%'"
></div>
<div
x-show=
"progress > 0"
x-text=
"progress + '%'"
></div>
@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=
"progress-bar"
:style=
"`width: ${progress}%`"
></div>
<div
class=
"progress-bar"
:style=
"`width: ${progress}%`"
></div>
...
@@ -82,8 +90,8 @@
...
@@ -82,8 +90,8 @@
<div
x-show=
"isLoading"
class=
"mx-auto mt-2"
>
<div
x-show=
"isLoading"
class=
"mx-auto mt-2"
>
<span>
Loading...
</span>
<span>
Loading...
</span>
</div>
</div>
<select
x-model=
"selectedProject"
x-show=
"!isLoading"
<select
x-model=
"selectedProject"
x-show=
"!isLoading"
id=
"project"
id=
"project"
class=
"ml-2 w-64 h-8 mt-1 border border-gray-300 rounded-md"
>
class=
"ml-2 w-64 h-8 mt-1 border border-gray-300 rounded-md"
>
<option
value=
""
>
Choose Project
</option>
<option
value=
""
>
Choose Project
</option>
<template
x-for=
"project in projects"
:key=
"project.id"
>
<template
x-for=
"project in projects"
:key=
"project.id"
>
<option
:value=
"project.id"
x-text=
"project.name"
></option>
<option
:value=
"project.id"
x-text=
"project.name"
></option>
...
...
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