diff --git a/app/Livewire/Admin/EditClient.php b/app/Livewire/Admin/EditClient.php new file mode 100644 index 0000000..0ac03ad --- /dev/null +++ b/app/Livewire/Admin/EditClient.php @@ -0,0 +1,45 @@ +client = Client::find($id); + + if ($this->client) { + $this->clientForm->addClient($this->client); + } + } catch (Exception $e) { + $this->dispatch('notify', message: 'Ocorreu um erro inesperado ao editar o cliente. ' + $e); + } + } + public function edit($clientId) + { + $this->clientForm->validate(); + + try { + $this->clientForm->updateClient($this->client); + $this->dispatch('notify', message: $this->client->client_name + ' atualizado com sucesso!'); + } catch (Exception $e) { + $this->dispatch('notify', message: 'Ocorreu um erro inesperado ao tentar confirmar edição do cliente. ' + $e); + } + } + public function render() + { + return view('livewire.admin.edit-client'); + } +} diff --git a/resources/views/livewire/admin/edit-client.blade.php b/resources/views/livewire/admin/edit-client.blade.php new file mode 100644 index 0000000..ae753fd --- /dev/null +++ b/resources/views/livewire/admin/edit-client.blade.php @@ -0,0 +1,192 @@ +