Make use of some settings #136
This commit is contained in:
@@ -1,8 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
// TODO: finish XML creation
|
|
||||||
// TODO: adapt models, views and company settings accordingly
|
|
||||||
// TODO: define routes export <-> download, format = xml | pdf
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Inertia\Inertia;
|
use Inertia\Inertia;
|
||||||
@@ -192,7 +188,9 @@ public function preview($id)
|
|||||||
'isPDF' => false,
|
'isPDF' => false,
|
||||||
'fontPath' => '/storage/fonts',
|
'fontPath' => '/storage/fonts',
|
||||||
'giroCode' => $giroCode,
|
'giroCode' => $giroCode,
|
||||||
'totalPages' => 1
|
'totalPages' => 1,
|
||||||
|
'companyName' => Setting::get('company.name'),
|
||||||
|
'companyAddress' => Setting::get('company.address')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -665,8 +663,6 @@ public function remind(Request $request, int $id)
|
|||||||
$to = $request->query('to');
|
$to = $request->query('to');
|
||||||
$cc = $request->query('cc');
|
$cc = $request->query('cc');
|
||||||
|
|
||||||
// TODO: get from settings
|
|
||||||
$bcc = 'buchhaltung@tooloop.de';
|
|
||||||
|
|
||||||
if (empty($to) || !filter_var($to, FILTER_VALIDATE_EMAIL)) {
|
if (empty($to) || !filter_var($to, FILTER_VALIDATE_EMAIL)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -679,10 +675,9 @@ public function remind(Request $request, int $id)
|
|||||||
'error' => 'Keine gültige E_Mail-Adresse ' . $cc
|
'error' => 'Keine gültige E_Mail-Adresse ' . $cc
|
||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mail::to($to)
|
Mail::to($to)
|
||||||
->cc($cc)
|
->cc($cc)
|
||||||
->bcc($cc)
|
->bcc(Setting::get('company.email'))
|
||||||
->send(new Reminder($invoice));
|
->send(new Reminder($invoice));
|
||||||
// return new Reminder($invoice);
|
// return new Reminder($invoice);
|
||||||
}
|
}
|
||||||
@@ -738,7 +733,7 @@ protected function generateInvoiceNumber()
|
|||||||
// Setze neue Nummer ins Format (bei Bedarf Padding hier ergänzen)
|
// Setze neue Nummer ins Format (bei Bedarf Padding hier ergänzen)
|
||||||
return str_replace('{number}', (string)$newNumber, $format);
|
return str_replace('{number}', (string)$newNumber, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a GiroCode for the invoice
|
* Generate a GiroCode for the invoice
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use App\Models\Setting;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
@@ -24,12 +25,16 @@ public function __construct(public array $offer) {}
|
|||||||
*/
|
*/
|
||||||
public function envelope(): Envelope
|
public function envelope(): Envelope
|
||||||
{
|
{
|
||||||
|
$companyEmail = Setting::get('company.email');
|
||||||
|
|
||||||
return new Envelope(
|
return new Envelope(
|
||||||
// TODO: get from settings
|
from: new Address($companyEmail, Setting::get('company.name')),
|
||||||
from: new Address('buchhaltung@tooloop.de', 'Tooloop Multimedia'),
|
// TODO: get current user name
|
||||||
bcc: [new Address('daniel.stock@tooloop.de', 'Daniel Stock')],
|
bcc: [new Address($companyEmail, 'Daniel Stock')],
|
||||||
subject: 'Auftragsbestätigung',
|
subject: 'Auftragsbestätigung',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
|
use App\Models\Setting;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
@@ -26,8 +27,7 @@ public function __construct(public array $invoice) {}
|
|||||||
public function envelope(): Envelope
|
public function envelope(): Envelope
|
||||||
{
|
{
|
||||||
return new Envelope(
|
return new Envelope(
|
||||||
// TODO: get from settings
|
from: new Address(Setting::get('company.email'), Setting::get('company.name')),
|
||||||
from: new Address('buchhaltung@tooloop.de', 'Tooloop Multimedia'),
|
|
||||||
subject: 'Zahlungserinnerung',
|
subject: 'Zahlungserinnerung',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,4 +23,8 @@ public static function allKeyValue(): array
|
|||||||
{
|
{
|
||||||
return self::query()->pluck('value', 'key')->toArray();
|
return self::query()->pluck('value', 'key')->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function get(string $key): string {
|
||||||
|
return Setting::where('key', $key)->value('value');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -54,8 +54,13 @@
|
|||||||
|
|
||||||
<address>
|
<address>
|
||||||
<div class="sender">
|
<div class="sender">
|
||||||
<!-- TODO: Firmenadresse aus Settings -->
|
{{ $companyname }},
|
||||||
Tooloop Multimedia Daniel Stock, Rehmstraße 4, 86161 Augsburg
|
{{ $companyAddress['lineOne'] }},
|
||||||
|
@if($companyAddress['lineOne'])
|
||||||
|
{{ $companyAddress['lineTwo'] }}
|
||||||
|
@endif
|
||||||
|
{{ $companyAddress['postalCode'] }}
|
||||||
|
{{ $companyAddress['city'] }}
|
||||||
</div>
|
</div>
|
||||||
<div class="recipient">
|
<div class="recipient">
|
||||||
{{ $invoice['customer']['companyName'] }}<br />
|
{{ $invoice['customer']['companyName'] }}<br />
|
||||||
|
|||||||
Reference in New Issue
Block a user