delete project confirmation

This commit is contained in:
ayntk-ai
2024-08-31 15:07:50 +02:00
parent 830c047ccf
commit b656cabb33
2 changed files with 9 additions and 4 deletions

View File

@@ -3,6 +3,8 @@
namespace App\Livewire\Project;
use App\Models\Project;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Livewire\Component;
class DeleteProject extends Component
@@ -21,8 +23,12 @@ class DeleteProject extends Component
$this->projectName = Project::findOrFail($this->project_id)->name;
}
public function delete()
public function delete($password)
{
if (!Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
return;
}
$this->validate([
'project_id' => 'required|int',
]);

View File

@@ -2,12 +2,11 @@
title="Confirm Project Deletion?"
buttonTitle="Delete Project"
isErrorButton
action="delete_project"
submitAction="delete"
:actions="['This will delete the selected project.']"
confirmationLabel="Please confirm the execution of the actions by entering the Project Name below"
shortConfirmationLabel="Project Name"
submitAction="delete_project"
buttonTitle="Delete Project"
confirmText="{{ $projectName }}"
confirmationText="{{ $projectName }}"
step3ButtonText="Permanently Delete Project"
/>