Fixes for designs (#3376)

* Fixes for detaching a useR

* Fixes for designs
This commit is contained in:
David Bomba 2020-02-26 15:11:17 +11:00 committed by GitHub
parent f20b0f7720
commit acb0c0f7c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 8 deletions

View File

@ -66,7 +66,7 @@ class Bold extends AbstractDesign
return '
<div class="flex mt-32 pl-12">
<div class="w-1/2 mr-40 flex flex-col">
<h2 class="text-2xl uppercase font-semibold text-teal-600 tracking-tight">$your_invoice_label</h2> $client_details
<h2 class="text-2xl uppercase font-semibold text-teal-600 tracking-tight">$entity_label</h2> $client_details
</div>
<div class="w-1/2">
<div class="w-full bg-teal-600 px-5 py-3 text-white flex">

View File

@ -71,7 +71,7 @@ class Business extends AbstractDesign
return '
<div class="flex items-center justify-between mt-20">
<div class="w-1/2 flex flex-col">
<span>$invoice_issued_to_label</span>
<span>$entity_label</span>
<section class="flex flex-col text-orange-600 mt-2">
$client_details
</section>

View File

@ -69,8 +69,8 @@ class Creative extends AbstractDesign
return '
<div class="flex justify-between mt-8">
<div class="w-2/3 flex flex-col">
<h1 class="text-5xl uppercase font-semibold">Invoice</h1>
<i class="ml-4 text-5xl text-pink-700">#entity_number</i>
<h1 class="text-5xl uppercase font-semibold">$entity_label</h1>
<i class="ml-4 text-5xl text-pink-700">$entity_number</i>
</div>
<div class="flex">
<div class="flex justify-between flex-col">

View File

@ -79,7 +79,7 @@ class Hipster extends AbstractDesign
<span>$date</span>
</div>
<div class="ml-10">
<span class="uppercase">$balance_due_label</span>
<span class="uppercase">$due_date_label</span>
<span>$due_date</span>
</div>
<div class="ml-4">

View File

@ -67,7 +67,7 @@ class Playful extends AbstractDesign
<div class="flex mt-16">
<div class="w-1/2">
<div class="flex flex-col">
<p class="font-semibold text-teal-600 pl-4">$invoice_to_label:</p>
<p class="font-semibold text-teal-600 pl-4">$entity_label</p>
<div class="flex border-dashed border-t-4 border-b-4 border-teal-600 py-4 mt-4 pl-4">
<section class="flex flex-col">
$client_details

View File

@ -24,6 +24,7 @@ use App\Http\Requests\User\ShowUserRequest;
use App\Http\Requests\User\StoreUserRequest;
use App\Http\Requests\User\UpdateUserRequest;
use App\Jobs\Company\CreateCompanyToken;
use App\Models\CompanyToken;
use App\Models\CompanyUser;
use App\Models\User;
use App\Repositories\UserRepository;
@ -627,7 +628,10 @@ class UserController extends BaseController
$company_user = CompanyUser::whereUserId($user->id)
->whereCompanyId(auth()->user()->companyId())->first();
$company_user->token->delete();
$token = $company_user->token->where('company_id', $company_user->company_id)->where('user_id', $company_user->user_id)->first();
$token->delete();
$company_user->delete();
return response()->json(['message' => 'User detached from company'], 200);

View File

@ -12,6 +12,9 @@
namespace App\Utils\Traits;
use App\Models\Country;
use App\Models\Credit;
use App\Models\Invoice;
use App\Models\Quote;
use App\Utils\Number;
/**
@ -274,12 +277,25 @@ trait MakesInvoiceValues
$data['$number'] = $this->number ?: '&nbsp;';
$data['$invoice.number'] = &$data['$number'];
$data['$invoice_number'] = &$data['$number'];
$data['$entity_number'] = &$data['$number'];
$data['$po_number'] = $this->po_number ?: '&nbsp;';
$data['$invoice.po_number'] = &$data['$po_number'];
$data['$line_taxes'] = $this->makeLineTaxes() ?: '&nbsp;';
$data['$invoice.line_taxes'] = &$data['$line_taxes'];
$data['$total_taxes'] = $this->makeTotalTaxes() ?: '&nbsp;';
$data['$invoice.total_taxes'] = &$data['$total_taxes'];
if($this instanceof Invoice)
$data['$entity_label'] = ctrans('texts.invoice');
if($this instanceof Quote)
$data['$entity_label'] = ctrans('texts.quote');
if($this instanceof Credit)
$data['$entity_label'] = ctrans('texts.credit');
// $data['$tax'] = ;
// $data['$item'] = ;
// $data['$description'] = ;

View File

@ -6,6 +6,7 @@ use App\Designs\Designer;
use App\Designs\Modern;
use App\Jobs\Invoice\CreateInvoicePdf;
use App\Jobs\Quote\CreateQuotePdf;
use App\Utils\Traits\GeneratesCounter;
use Tests\MockAccountData;
use Tests\TestCase;
@ -16,6 +17,7 @@ use Tests\TestCase;
class DesignTest extends TestCase
{
use MockAccountData;
use GeneratesCounter;
public function setUp() :void
{
@ -45,7 +47,7 @@ class DesignTest extends TestCase
$this->invoice->uses_inclusive_taxes = false;
$settings = $this->invoice->client->settings;
$settings->invoice_design_id = "6";
$settings->invoice_design_id = "5";
$this->client->settings = $settings;
$this->client->save();
@ -74,6 +76,29 @@ class DesignTest extends TestCase
CreateQuotePdf::dispatchNow($this->quote, $this->quote->company, $this->quote->client->primary_contact()->first());
}
public function testAllDesigns()
{
for($x=1; $x<=10; $x++)
{
$settings = $this->invoice->client->settings;
$settings->quote_design_id = (string)$x;
$this->client->settings = $settings;
$this->client->save();
CreateQuotePdf::dispatchNow($this->quote, $this->quote->company, $this->quote->client->primary_contact()->first());
$this->quote->number = $this->getNextQuoteNumber($this->quote->client);
$this->quote->save();
}
$this->assertTrue(true);
}
}