Rework service, removed redundant code, service invoicing improvements

This commit is contained in:
2024-07-29 23:12:53 +10:00
parent 5f10175b35
commit 0b5bc9e012
29 changed files with 474 additions and 523 deletions

View File

@@ -14,7 +14,7 @@ class OrderRequestApprove extends Mailable
{
use Queueable, SerializesModels;
public Service $service;
public Service $so;
public string $notes;
/**
@@ -25,7 +25,7 @@ class OrderRequestApprove extends Mailable
*/
public function __construct(Service $o,string $notes='')
{
$this->service = $o;
$this->so = $o;
$this->notes = $notes;
}
@@ -36,14 +36,14 @@ class OrderRequestApprove extends Mailable
*/
public function build()
{
Config::set('site',$this->service->site);
Config::set('site',$this->so->site);
// @todo This is not consistent with Cancel/Change Request
switch ($this->service->category) {
case 'broadband': $subject = sprintf('%s: %s',$this->service->category,$this->service->type->service_address);
switch ($this->so->product->category) {
case 'broadband': $subject = sprintf('%s: %s',$this->so->product->category,$this->so->type->service_address);
break;
case 'phone': $subject = sprintf('%s: %s',$this->service->category,$this->service->type->service_number);
case 'phone': $subject = sprintf('%s: %s',$this->so->product->category,$this->so->type->service_number);
break;
default:
@@ -53,6 +53,6 @@ class OrderRequestApprove extends Mailable
return $this
->markdown('email.admin.order.approve')
->subject($subject)
->with(['site'=>$this->service->site]);
->with(['site'=>$this->so->site]);
}
}