-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added view and controller to edit the invoice settings
- Loading branch information
1 parent
26be655
commit 14386d5
Showing
6 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Setting; | ||
use Framework\Facades\Http; | ||
use Framework\Routing\BaseController; | ||
use Framework\Routing\ControllerInterface; | ||
|
||
class EditInvoiceSettings extends BaseController implements ControllerInterface | ||
{ | ||
public function execute(): void | ||
{ | ||
if (Http::requestMethod() === 'GET') { | ||
view('settings.editInvoice'); | ||
return; | ||
} | ||
|
||
if (Http::requestMethod() === 'POST') { | ||
$this->settingFromParam('invoiceSenderName'); | ||
$this->settingFromParam('invoiceSenderStreet'); | ||
$this->settingFromParam('invoiceSenderPostalCode'); | ||
$this->settingFromParam('invoiceSenderCity'); | ||
$this->settingFromParam('invoiceSenderAddition'); | ||
|
||
$this->settingFromParam('invoiceBankName'); | ||
$this->settingFromParam('invoiceIBAN'); | ||
$this->settingFromParam('invoiceBIC'); | ||
|
||
$this->settingFromParam('invoiceAuthor'); | ||
$this->settingFromParam('invoiceName'); | ||
|
||
Http::redirect('/'); | ||
} | ||
|
||
Http::redirect('/'); | ||
} | ||
|
||
private function settingFromParam(string $name): void | ||
{ | ||
Setting::findByName($name)->setValue(Http::param($name))->save(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?= component('layout.header') ?> | ||
|
||
<h1><?= __('EditInvoiceData') ?></h1> | ||
|
||
<form method="post"> | ||
<h2><?= __('Sender') ?></h2> | ||
|
||
<label for="invoiceSenderName" class="required"><?= __('Name') ?>:</label><br> | ||
<input id="invoiceSenderName" name="invoiceSenderName" type="text" value="<?= setting('invoiceSenderName') ?>" autofocus required><br> | ||
|
||
<label for="invoiceSenderStreet" class="required"><?= __('Street') ?>:</label><br> | ||
<input id="invoiceSenderStreet" name="invoiceSenderStreet" type="text" value="<?= setting('invoiceSenderStreet') ?>" required><br> | ||
|
||
<label for="invoiceSenderPostalCode" class="required"><?= __('PostalCode') ?>:</label><br> | ||
<input id="invoiceSenderPostalCode" name="invoiceSenderPostalCode" type="text" value="<?= setting('invoiceSenderPostalCode') ?>" required><br> | ||
|
||
<label for="invoiceSenderCity" class="required"><?= __('City') ?>:</label><br> | ||
<input id="invoiceSenderCity" name="invoiceSenderCity" type="text" value="<?= setting('invoiceSenderCity') ?>" required><br> | ||
|
||
<label for="invoiceSenderAddition"><?= __('Addition') ?>:</label><br> | ||
<input id="invoiceSenderAddition" name="invoiceSenderAddition" type="text" value="<?= setting('invoiceSenderAddition') ?>"><br> | ||
|
||
<h2><?= __('Bank') ?></h2> | ||
|
||
<label for="invoiceBankName" class="required"><?= __('Name') ?>:</label><br> | ||
<input id="invoiceBankName" name="invoiceBankName" type="text" value="<?= setting('invoiceBankName') ?>" required><br> | ||
|
||
<label for="invoiceIBAN" class="required"><?= __('IBAN') ?>:</label><br> | ||
<input id="invoiceIBAN" name="invoiceIBAN" type="text" value="<?= setting('invoiceIBAN') ?>" required><br> | ||
|
||
<label for="invoiceBIC" class="required"><?= __('BIC') ?>:</label><br> | ||
<input id="invoiceBIC" name="invoiceBIC" type="text" value="<?= setting('invoiceBIC') ?>" required><br> | ||
|
||
<h2><?= __('Miscellaneous') ?></h2> | ||
|
||
<label for="invoiceAuthor" class="required"><?= __('Author') ?>:</label><br> | ||
<input id="invoiceAuthor" name="invoiceAuthor" type="text" value="<?= setting('invoiceAuthor') ?>" required><br> | ||
|
||
<label for="invoiceName" class="required"><?= __('InvoiceName') ?>:</label><br> | ||
<input id="invoiceName" name="invoiceName" type="text" value="<?= setting('invoiceName') ?>" required><br> | ||
|
||
<button><?= __('Save') ?></button> | ||
</form> | ||
|
||
<?= component('layout.footer') ?> |