first commit

This commit is contained in:
Kevin Adametz 2021-01-08 17:48:20 +01:00
commit 0baac018a2
1011 changed files with 145854 additions and 0 deletions

View file

@ -0,0 +1,48 @@
<?php
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailAccountActive extends Mailable
{
use Queueable, SerializesModels;
protected $confirmation_code;
protected $user;
public $subject;
public function __construct(User $user)
{
$this->user = $user;
$this->subject = __('email.account_active');
}
public function build()
{
$salutation = __('email.salutation').",";
if($this->user->account){
if($this->user->account->salutation === "mr"){
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
}else{
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
}
}
return $this->view('emails.auth')->with([
'url' => route('login'),
'salutation' => $salutation,
'button' => __('Login'),
'copy1line' => __('email.account_active_copy1line'),
'copy2line' => __('email.copy2line'),
'copy3line' => __('email.copy3line'),
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),
]);
}
}

View file

@ -0,0 +1,46 @@
<?php
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailActivateUser extends Mailable
{
use Queueable, SerializesModels;
protected $token;
protected $user;
public $subject;
public function __construct($token, User $user)
{
$this->token = $token;
$this->user = $user;
$this->subject = __('email.change_e_mail');
}
public function build()
{
$salutation = __('email.salutation').",";
if($this->user->account){
if($this->user->account->salutation === "mr"){
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
}else{
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
}
}
return $this->view('emails.auth')->with([
'url' => route('user_update_email_confirm', $this->token),
'salutation' => $salutation,
'button' => __('email.change_e_mail'),
'copy1line' => __('email.active_copy1line'),
'copy2line' => __('email.copy2line'),
'copy3line' => __('email.copy3line'),
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),
]);
}
}

89
app/Mail/MailCheckout.php Normal file
View file

@ -0,0 +1,89 @@
<?php
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Services\Util;
class MailCheckout extends Mailable
{
use Queueable, SerializesModels;
protected $txaction;
protected $shopping_order;
protected $shopping_payment;
protected $send_link;
protected $mode;
public $subject;
public $data;
public function __construct($txaction, $shopping_order, $shopping_payment, $send_link, $mode)
{
$this->txaction = $txaction;
$this->shopping_order = $shopping_order;
$this->shopping_payment = $shopping_payment;
$this->send_link = $send_link;
$this->mode = $mode;
if($this->txaction === 'paid'){
$this->subject = __('email.checkout_subject_paid')." ";
$this->subject .= ".gruene-seele.bio";
}elseif($this->txaction === 'extern'){
$this->subject = __('email.checkout_subject_extern').": ";
$this->subject .= $shopping_order->member->account->m_first_name." ".$shopping_order->member->account->m_last_name." - ";
$this->subject .= $shopping_order->shopping_user->billing_firstname." ".$shopping_order->shopping_user->billing_lastname;
}else{
$this->subject = __('email.checkout_subject')." ";
$this->subject .= ".gruene-seele.bio";
}
/*if($shopping_order->user_shop){
$this->subject .= $shopping_order->user_shop->slug.".";
}*/
}
public function build()
{
$salutation = __('email.hello').",";
if($this->txaction !== 'extern' && $this->shopping_order->shopping_user){
$salutation = __('email.hello')." ".$this->shopping_order->shopping_user->billing_firstname.",";
//make Adresse
}
if($this->txaction === 'paid' || $this->txaction === 'extern'){
return $this->view('emails.checkout')->with([
'salutation' => $salutation,
'copy1line' => __('email.checkout_copy1line'),
'shopping_order' => $this->shopping_order,
'shopping_payment' => $this->shopping_payment,
'copy3line' => __('email.checkout_copy3line'),
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),
'send_link' => $this->send_link,
'url' => Util::getMyMivitaUrl(),
'button' => Util::getMyMivitaUrl(false),
'mode' => $this->mode
]);
}else{
return $this->view('emails.checkout_status')->with([
'salutation' => $salutation,
'copy1line' => __('email.status_copy1line'),
'txaction' => $this->txaction,
'shopping_order' => $this->shopping_order,
'shopping_payment' => $this->shopping_payment,
'copy3line' => __('email.checkout_copy3line'),
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),
'send_link' => false,
'mode' => $this->mode
]);
}
}
}

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

@ -0,0 +1,59 @@
<?php
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Services\Util;
class MailContact extends Mailable
{
use Queueable, SerializesModels;
public $user_shop;
public $subject;
public $data;
public function __construct($data)
{
$this->data = $data;
$this->user_shop = Util::getUserShop();
$this->subject = __('email.your_request_from').' mivita.care';
if($this->user_shop){
$this->subject = __('email.your_request_from')." ".$this->user_shop->slug.'.mivita.care';
}
}
public function build()
{
$salutation = __('email.hello');
if(isset($this->data['first_name'])){
$salutation .= " ".$this->data['first_name'];
}
if(isset($this->data['salutation'])){
if($this->data['salutation'] === 'mr'){
$this->data['salutation'] = 'Herr';
}
if($this->data['salutation'] === 'ms'){
$this->data['salutation'] = 'Frau';
}
}
$copy1line = __('email.your_request_from')." mivita.care";
if($this->user_shop){
$copy1line = __('email.your_request_from')." ".$this->user_shop->slug.'.mivita.care';
}
return $this->view('emails.contact')->with([
'salutation' => $salutation,
'copy1line' => $copy1line,
'data' => $this->data,
'copy3line' => __('email.copy3line'),
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),
]);
}
}

View file

@ -0,0 +1,83 @@
<?php
namespace App\Mail;
use App\Models\UserMessage;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailCustomMessage extends Mailable
{
use Queueable, SerializesModels;
protected $data;
protected $user;
protected $sender;
public $subject;
public $message;
public $message_last;
protected $save;
public function __construct(User $user, $data, $sender, $save = false)
{
$this->save = $save;
$this->data = $data;
$this->user = $user;
$this->sender = $sender;
$this->subject = isset($data['subject']) ? $data['subject'] : __('email.email_subject');
$this->message = isset($data['message']) ? $data['message'] : '';
$this->message_last = isset($data['message_last']) ? $data['message_last'] : '';
}
public function build()
{
$salutation = __('email.salutation').",";
if($this->user->account){
if($this->user->account->salutation === "mr"){
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
}else{
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
}
}
if($this->save){
UserMessage::create([
'user_id' => $this->user->id,
'send_user_id' => $this->sender->id,
'email' => $this->user->email,
'subject' => $this->subject,
'message' => $this->message." ".$this->message_last,
'send' => true,
'sent_at' => now(),
]);
}
$url = "";
$button = "";
if(isset($this->data['confirmation_code'])){
$url = route('register_verify', $this->data['confirmation_code']);
$button = __('email.button_account');
}
if(isset($this->data['url'])){
$url =$this->data['url'];
$button = $this->data['button'];
}
return $this->view('emails.custom')->with([
'url' => $url,
'title' => $salutation,
'button' => $button,
'content' => $this->message,
'content_last' => $this->message_last,
'copy2line' => __('email.copy2line'),
'copy3line' => __('email.copy3line'),
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),
]);
}
}

116
app/Mail/MailInfo.php Normal file
View file

@ -0,0 +1,116 @@
<?php
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailInfo extends Mailable
{
use Queueable, SerializesModels;
protected $user;
protected $action;
protected $data;
public $subject;
public function __construct($user, $action, $data = [])
{
$this->user = $user;
$this->action = $action;
$this->data = $data;
if($this->action === "delete_membership"){
$this->subject = 'Mitgliedschaft beenden - beantragt';
}
if($this->action === "check_is_like_customer"){
$this->subject = 'Kunden überprüfen - Kundenhoheit';
}
if($this->action === "change_is_like_customer"){
$this->subject = 'Kunden erneut überprüfen - Kundenhoheit';
}
}
public function build()
{
$content = "";
if($this->action === "delete_membership"){
$content .= __(strtoupper($this->user->account->salutation))." ";
$content .= $this->user->account->first_name." ".$this->user->account->last_name."\n";
$content .= $this->user->account->address."\n";
$content .= $this->user->account->zipcode." ".$this->user->account->city."\n";
$content .= $this->user->account->country_id ? $this->user->account->country->de."\n\n" : "\n\n";
if($this->user->account->phone){
$content .= "Telefon: ";
$content .= $this->user->account->pre_phone_id ? $this->user->account->pre_phone->phone." " : " ";
$content .= $this->user->account->phone;
}
if($this->user->account->mobil){
$content .= "Mobil: ";
$content .= $this->user->account->pre_mobil_id ? $this->user->account->pre_mobil->phone." " : " ";
$content .= $this->user->account->mobil;
}
$content .= "E-Mail: ".$this->user->email;
$copy1line = "Infos zum Berater:"."\n";
$button = "zum Berater";
$title = "Ein Berater möchte seine Mitgliedschaft beenden.";
$url = route('admin_lead_edit', $this->user->id).'?show=check_lead';
}
if($this->action === "check_is_like_customer") {
$copy1line = "Hier geht es zum Kunden:"."\n";
$button = "zum Kunden";
$title = "Ein Kunden muss überprüft werden und einem Berater zugeordnet werden, da die Adresse nicht eindeutig ist.";
$url = route('admin_customer_detail', $this->user->id);
$content .= $this->user ? 'Firma: '.$this->user->billing_company."\n" : '';
$content .= \App\Services\HTMLHelper::getSalutationLang($this->user->billing_salutation)." ";
$content .= $this->user->billing_firstname." ";
$content .= $this->user->billing_lastname."\n";
$content .= $this->user->billing_address;
$content .= $this->user->billing_address_2 ? '/ '.$this->user->billing_address_2."\n" : "\n";
$content .= $this->user->billing_zipcode." ";
$content .= $this->user->billing_city."\n";
$content .= $this->user->billing_email."\n";
$content .= $this->user->billing_phone."\n";
$content .= $this->user->billing_country->getLocated();
}
if($this->action === "change_is_like_customer"){
$copy1line = "Hier geht es zum Kunden:"."\n";
$button = "zum Kunden";
$title = "Ein Kunden muss erneut überprüft werden, da bei einer Änderung eine bestehende Kundenhoheit gefunden wurde.";
$url = route('admin_customer_detail', $this->user->id);
$content .= "Folgende Daten für die Kundenhoheit wurden geändert:"."\n";
foreach ($this->data as $key=>$value){
$content .= $this->user->{$key}." => ".$value."\n";
}
$content .= "\n"."\n"."Rechnungsadresse des Kunden vor der Änderung:"."\n";
$content .= $this->user ? 'Firma: '.$this->user->billing_company."\n" : '';
$content .= \App\Services\HTMLHelper::getSalutationLang($this->user->billing_salutation)." ";
$content .= $this->user->billing_firstname." ";
$content .= $this->user->billing_lastname."\n";
$content .= $this->user->billing_address;
$content .= $this->user->billing_address_2 ? '/ '.$this->user->billing_address_2."\n" : "\n";
$content .= $this->user->billing_zipcode." ";
$content .= $this->user->billing_city."\n";
$content .= $this->user->billing_email."\n";
$content .= $this->user->billing_phone."\n";
$content .= $this->user->billing_country->getLocated();
}
return $this->view('emails.info')->with([
'url' => $url,
'title' => $title,
'button' => $button,
'copy1line' => $copy1line,
'copy2line' => __('email.copy2line'),
'content' => $content,
]);
}
}

View file

@ -0,0 +1,63 @@
<?php
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailReleaseAccount extends Mailable
{
use Queueable, SerializesModels;
protected $user;
public $subject;
public function __construct(User $user)
{
$this->user = $user;
$this->subject = 'Neuer Berater Registrierung prüfen';
}
public function build()
{
$content = __(strtoupper($this->user->account->salutation))." ";
$content .= $this->user->account->first_name." ".$this->user->account->last_name."\n";
$content .= $this->user->account->address."\n";
$content .= $this->user->account->zipcode." ".$this->user->account->city."\n";
$content .= $this->user->account->country_id ? $this->user->account->country->de."\n\n" : "\n\n";
if($this->user->account->phone){
$content .= "Telefon: ";
$content .= $this->user->account->pre_phone_id ? $this->user->account->pre_phone->phone." " : " ";
$content .= $this->user->account->phone;
}
if($this->user->account->mobil){
$content .= "Mobil: ";
$content .= $this->user->account->pre_mobil_id ? $this->user->account->pre_mobil->phone." " : " ";
$content .= $this->user->account->mobil;
}
$content .= "E-Mail: ".$this->user->email;
$copy1line = "Ein neuer Berater hat sich registriert und wartet auf die Überprüfung und Freigabe seiner Daten:"."\n";
$copy1line .= "+ Überprüfung der Ausweisdate"."\n";
$copy1line .= "+ Überprüfung des Gewerbenachweises"."\n";
$copy1line .= "+ Eintrag Account ID"."\n";
$copy1line .= "+ Überprüfung / Kenntnisnahme Sponsor"."\n";
$copy1line .= "+ Überprüfung der Rechnungsdaten"."\n";
$copy1line .= 'Nach erfolgreicher Überprüfung mit dem Button „Daten vollständig => Berater freischalten“ den Berater freischalten.'."\n";
$copy1line .= 'Der Berater erhält eine Mail, dass sein Account freigeschaltet wurde. Der Vertrag wird automatisch mit den Daten des Vertriebspartners erstellt.'."\n";
return $this->view('emails.info')->with([
'url' => route('admin_lead_edit', $this->user->id).'?show=check_lead',
'title' => 'Berater Registrierung prüfen',
'button' => 'zur Berater Prüfung',
'copy1line' => $copy1line,
'copy2line' => __('email.copy2line'),
'content' => $content,
]);
}
}

View file

@ -0,0 +1,51 @@
<?php
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailResetPassword extends Mailable
{
use Queueable, SerializesModels;
protected $token;
protected $user;
public $subject;
public function __construct($token, $user)
{
$this->token = $token;
$this->user = $user;
$this->subject = __('email.reset_passwort');
}
public function build()
{
$salutation = __('email.salutation').",";
if($this->user->account){
if($this->user->account->salutation === "mr"){
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
}else{
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
}
}
return $this->view('emails.auth')->with([
'url' => route('password.reset', $this->token),
'salutation' => $salutation,
'button' => __('email.reset_passwort'),
'copy1line' => __('email.reset_pass_copy1line'),
'copy2line' => __('email.copy2line'),
'copy3line' => __('email.copy3line'),
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),
]);
}
}

63
app/Mail/MailSyS.php Normal file
View file

@ -0,0 +1,63 @@
<?php
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailSyS extends Mailable
{
use Queueable, SerializesModels;
protected $model;
protected $action;
public $subject;
public function __construct($model, $action)
{
$this->model = $model;
$this->action = $action;
if($this->action === "log"){
$this->subject = 'mivita Logger';
}
}
public function build()
{
$content = "";
if($this->action === "log"){
$title = "New Log";
if($this->model->user_id && $this->model->user){
$content .= "From User: ".$this->model->user->id." | ".$this->model->user->email."\n";
}
if($this->model->model && $this->model->model_id){
$content .= "Apply: ".$this->model->model." | ".$this->model->model_id."\n";
if($this->model->model === 'App\User'){
$apply = User::find($this->model->model_id);
$content .= $this->model->model.": ".$apply->email." | ".$this->model->model_id."\n";
}
}
$content .= "\n";
$content .= "Action: ".$this->model->action."\n";
$content .= "Message: ".$this->model->message."\n";
$content .= "\n";
$content .= "Channel: ".$this->model->channel."\n";
$content .= "Level: ".$this->model->getLevelType()."\n";
$content .= "\n";
$content .= "Time: ".$this->model->created_at->format("d.m.Y H:i");
}
return $this->view('emails.sys')->with([
'title' => $title,
'content' => $content,
]);
}
}

View file

@ -0,0 +1,49 @@
<?php
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailVerifyAccount extends Mailable
{
use Queueable, SerializesModels;
protected $confirmation_code;
protected $user;
public $subject;
public function __construct($confirmation_code, User $user)
{
$this->confirmation_code = $confirmation_code;
$this->user = $user;
$this->subject = __('email.email_verify');
}
public function build()
{
$salutation = __('email.salutation').",";
if($this->user->account){
if($this->user->account->salutation === "mr"){
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
}else{
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
}
}
return $this->view('emails.auth')->with([
'url' => route('register_verify', $this->confirmation_code),
'salutation' => $salutation,
'button' => __('email.email_verify'),
'copy1line' => __('email.email_verify_copy1line'),
'copy2line' => __('email.copy2line'),
'copy3line' => __('email.copy3line'),
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),
]);
}
}

View file

@ -0,0 +1,48 @@
<?php
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailVerifyContact extends Mailable
{
use Queueable, SerializesModels;
protected $confirmation_code;
protected $user;
public $subject;
public function __construct($confirmation_code, User $user)
{
$this->confirmation_code = $confirmation_code;
$this->user = $user;
$this->subject = __('email.verify_e_mail');
}
public function build()
{
$salutation = __('email.salutation').",";
if($this->user->account){
if($this->user->account->salutation === "mr"){
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
}else{
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
}
}
return $this->view('emails.auth')->with([
'url' => route('register_verify', $this->confirmation_code),
'salutation' => $salutation,
'button' => __('email.verify_e_mail'),
'copy1line' => __('email.verify_copy1line'),
'copy2line' => __('email.copy2line'),
'copy3line' => __('email.copy3line'),
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),
]);
}
}