Commit 1c651af7 authored by Sarun Mungthanya's avatar Sarun Mungthanya
Browse files

update message alert

parent 4a8a9412
......@@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Cache;
class PatchEdit extends Component
{
public $patchId;
public $patchId ,$message;
public $progressSave = 0, $isProcessing = false, $progress = 0, $currentStep = 0;
public $searchProject = '';
public $selectedBranch, $selectedPatch, $showModal;
......@@ -237,25 +237,25 @@ class PatchEdit extends Component
$this->currentStep += 1;
$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 {
$this->isProcessing = false;
session()->flash('message', 'Patch details and file changes updated successfully.');
$this->reset(['fileChangesTemp', 'fileGitChanges', 'currentStep', 'progress']);
$this->emit('reloadComponent', $this->patchId);
// $this->isProcessing = false;
// session()->flash('message', 'Patch details and file changes updated successfully.');
// $this->message = 'Patch details and file changes updated successfully.';
// $this->reset(['fileChangesTemp', 'fileGitChanges', 'currentStep', 'progress']);
}
}
return $this->progress;
}
// public function processStep()
// {
// // จำลองการประมวลผล
// if ($this->progress < 100) {
// $this->progress += 10; // เพิ่มค่าความคืบหน้า
// }
// return $this->progress;
// }
private function formatFilePath($file)
{
......@@ -341,7 +341,7 @@ class PatchEdit extends Component
$pathFile = TabPatchFile::where("fid", $patchFileId)->delete();
$message = "Deleted File ID : " . json_encode($patchFileId) . " Successfully";
// $this->message = $message;
$this->message = $message;
$this->emit('reloadComponent', $patchId);
}
public function deleteSelectedPatchFiles($selectedFiles)
......
......@@ -10,8 +10,8 @@ use App\Models\TabPatchFile;
class PatchIndex extends Component
{
use WithPagination;
public $action = 'edit';
public $searchBy, $editPid, $message, $keyword, $perPage = 10, $searchSelected = 'PID' ;
public $action = 'list';
public $searchBy, $editPid, $message, $keyword, $perPage = 10, $searchSelected = 'PID' , $selectedPatch = [] ;
protected $listeners = [ 'deleteItem', 'deleteSelected' ,'showpatchListForm'];
public function mount()
{
......
......@@ -4,7 +4,7 @@
console.log(result)
progress = result;
if (progress >= 100) {
progress = 0 ;
progress = 0;
clearInterval(interval);
}
});
......@@ -28,6 +28,14 @@
<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>
......@@ -82,8 +90,8 @@
<div x-show="isLoading" class="mx-auto mt-2">
<span>Loading...</span>
</div>
<select x-model="selectedProject" x-show="!isLoading"
id="project" class="ml-2 w-64 h-8 mt-1 border border-gray-300 rounded-md">
<select x-model="selectedProject" x-show="!isLoading" 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>
......
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