commit 08-2025

This commit is contained in:
Kevin Adametz 2025-08-12 15:51:04 +02:00
parent 9b54eb0512
commit 02f2a4c23e
184 changed files with 31653 additions and 22327 deletions

87
app/Mail/MailLogistic.php Normal file
View file

@ -0,0 +1,87 @@
<?php
namespace App\Mail;
use App\User;
use App\Services\Invoice;
use App\Models\ShoppingOrder;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Storage;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailLogistic extends Mailable
{
use Queueable, SerializesModels;
protected $shopping_order;
public $subject;
public function __construct(ShoppingOrder $shopping_order)
{
$this->shopping_order = $shopping_order;
$name = $shopping_order->shopping_user->billing_firstname . ' ' . $shopping_order->shopping_user->billing_lastname;
$company = $shopping_order->shopping_user->billing_company ?? '';
$this->subject = 'Partner';
if($shopping_order->user_white_label){
//Bei allen, die ein eigenes Logo haben
$this->subject .= ' (mit Logo)';
}else{
//Bei allen, die kein Tattoostudio sind
$this->subject = ' - ';
}
if($shopping_order->shopping_user->same_as_billing){
//Rechnungsadresse und Lieferadresse sind gleich
$this->subject = '';
}else{
//hat eine andere Lieferadresse
$this->subject = ' Lieferadresse';
}
$this->subject .= ' '.$company.' (' . $name . ')';
}
public function build()
{
$title = false;
$copy1line = false;
$filename = Invoice::getFilename($this->shopping_order);
$path = Invoice::getDownloadPath($this->shopping_order);
if (!Storage::disk('public')->exists($path)) {
return;
}
$file = Storage::disk('public')->path($path);
$mime = Storage::disk('public')->mimeType($path);
$mail = $this->view('emails.logistic')->with([
'title' => $title,
'copy1line' => $copy1line,
])->attach($file,[
'as' => $filename,
'mime' => $mime,
]);
//Wenn das Logo gesetzt ist und die Rechnungsadresse und Lieferadresse unterschiedlich sind, dann wird der Lieferschein angehängt
if($this->shopping_order->user_white_label && !$this->shopping_order->shopping_user->same_as_billing){
$filenameDelivery = Invoice::getDeliveryFilename($this->shopping_order);
$pathDelivery = Invoice::getDownloadPathDelivery($this->shopping_order);
if (!Storage::disk('public')->exists($pathDelivery)) {
return;
}
$fileDelivery = Storage::disk('public')->path($pathDelivery);
$mimeDelivery = Storage::disk('public')->mimeType($pathDelivery);
$mail->attach($fileDelivery,[
'as' => $filenameDelivery,
'mime' => $mimeDelivery,
]); // attach file;
}
return $mail;
}
}

59
app/Mail/MailLogitic.php Normal file
View file

@ -0,0 +1,59 @@
<?php
namespace App\Mail;
use App\User;
use App\Services\Invoice;
use App\Models\ShoppingOrder;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Storage;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailLogistic extends Mailable
{
use Queueable, SerializesModels;
protected $shopping_order;
public $subject;
public function __construct(ShoppingOrder $shopping_order)
{
$this->shopping_order = $shopping_order;
if($shopping_order->user_white_label){
//Bei allen, die ein eigenes Logo haben
$this->subject = 'Partner (mit Logo) - Firma (Vorname Nachname)';
}else{
//Bei allen, die kein Tattoostudio sind
$this->subject = 'Partner - Firma (Vorname Nachname)';
}
}
public function build()
{
$title = false;
$copy1line = false;
$filename = Invoice::getFilename($this->shopping_order);
$path = Invoice::getDownloadPath($this->shopping_order);
if (!Storage::disk('public')->exists($path)) {
return;
}
$file = Storage::disk('public')->path($path);
$mime = Storage::disk('public')->mimeType($path);
return $this->view('emails.blank')->with([
'title' => $title,
'copy1line' => $copy1line,
])->attach($file,[
'as' => $filename,
'mime' => $mime,
]); // attach file;
}
}

View file

@ -0,0 +1,60 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Services\Util;
class PaymentReminderEmail extends Mailable
{
use Queueable, SerializesModels;
protected $emailSubject;
protected $message;
protected $order;
public $data;
/**
* Erstellt eine neue PaymentReminderEmail Instanz
*
* @param string $subject
* @param string $message
* @param object|null $user
* @param object|null $order
* @param float|null $paymentAmount
* @param string|null $dueDate
* @param string|null $paymentUrl
*/
public function __construct($subject, $message, $order = null)
{
$this->emailSubject = $subject;
$this->message = $message;
$this->order = $order;
}
/**
* Baut die E-Mail
*
* @return $this
*/
public function build()
{
$paymentUrl = route('user_myorder_detail', ['id' => $this->order->id]);
$buttonText = __('email.my_orders') ?: 'Meine Bestellungen';
return $this->subject($this->emailSubject)
->view('emails.payment_reminder')
->with([
'content' => $this->message,
'url' => $paymentUrl,
'button' => $buttonText,
]);
}
}