mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #7132 from turbo124/v5-develop
Localize dates in Client Portal
This commit is contained in:
commit
1db4a9fad9
@ -276,6 +276,9 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
|
|
||||||
public function locale()
|
public function locale()
|
||||||
{
|
{
|
||||||
|
if(!$this->language())
|
||||||
|
return 'en';
|
||||||
|
|
||||||
return $this->language()->locale ?: 'en';
|
return $this->language()->locale ?: 'en';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,8 +96,13 @@ return [
|
|||||||
'prefix_indexes' => true,
|
'prefix_indexes' => true,
|
||||||
'strict' => env('DB_STRICT', false),
|
'strict' => env('DB_STRICT', false),
|
||||||
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
|
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
|
||||||
'ssl_mode' => env('SSL_MODE',''),
|
|
||||||
// 'options' => Ninja::isHosted() ? config('ninja.db_options') : [],
|
// 'options' => Ninja::isHosted() ? config('ninja.db_options') : [],
|
||||||
|
'options' => [
|
||||||
|
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
|
||||||
|
PDO::MYSQL_ATTR_SSL_KEY => env("DB_CLIENT_KEY", ''),
|
||||||
|
PDO::MYSQL_ATTR_SSL_CERT => env("DB_CLIENT_CERT", ''),
|
||||||
|
PDO::MYSQL_ATTR_SSL_CA => env("DB_CA_CERT", ''),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'db-ninja-01a' => [
|
'db-ninja-01a' => [
|
||||||
|
@ -60,6 +60,7 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'db_options' => [
|
'db_options' => [
|
||||||
|
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
|
||||||
PDO::MYSQL_ATTR_SSL_KEY => env("DB_CLIENT_KEY", ''),
|
PDO::MYSQL_ATTR_SSL_KEY => env("DB_CLIENT_KEY", ''),
|
||||||
PDO::MYSQL_ATTR_SSL_CERT => env("DB_CLIENT_CERT", ''),
|
PDO::MYSQL_ATTR_SSL_CERT => env("DB_CLIENT_CERT", ''),
|
||||||
PDO::MYSQL_ATTR_SSL_CA => env("DB_CA_CERT", ''),
|
PDO::MYSQL_ATTR_SSL_CA => env("DB_CA_CERT", ''),
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
{{ App\Utils\Number::formatMoney($credit->balance, $credit->client) }}
|
{{ App\Utils\Number::formatMoney($credit->balance, $credit->client) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||||
{{ $credit->formatDate($credit->date, $credit->client->date_format()) }}
|
{{ $credit->translateDate($credit->date, $credit->client->date_format(), $credit->client->locale()) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||||
{{ $credit->public_notes }}
|
{{ $credit->public_notes }}
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
{{ $invoice->number }}
|
{{ $invoice->number }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
||||||
{{ $invoice->formatDate($invoice->date, $invoice->client->date_format()) }}
|
{{ $invoice->translateDate($invoice->date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
||||||
{{ App\Utils\Number::formatMoney($invoice->amount, $invoice->client) }}
|
{{ App\Utils\Number::formatMoney($invoice->amount, $invoice->client) }}
|
||||||
@ -88,7 +88,7 @@
|
|||||||
{{ App\Utils\Number::formatMoney($invoice->balance, $invoice->client) }}
|
{{ App\Utils\Number::formatMoney($invoice->balance, $invoice->client) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
||||||
{{ $invoice->formatDate($invoice->due_date, $invoice->client->date_format()) }}
|
{{ $invoice->translateDate($invoice->due_date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
||||||
{!! App\Models\Invoice::badgeForStatus($invoice->status) !!}
|
{!! App\Models\Invoice::badgeForStatus($invoice->status) !!}
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
{{ $payment->number }}
|
{{ $payment->number }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||||
{{ $payment->formatDate($payment->date, $payment->client->date_format()) }}
|
{{ $payment->translateDate($payment->date, $payment->client->date_format(), $payment->client->locale()) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||||
{{ optional($payment->type)->name }}
|
{{ optional($payment->type)->name }}
|
||||||
|
@ -74,13 +74,13 @@
|
|||||||
{{ $quote->number }}
|
{{ $quote->number }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
||||||
{{ $quote->formatDate($quote->date, $quote->client->date_format()) }}
|
{{ $quote->translateDate($quote->date, $quote->client->date_format(), $quote->client->locale()) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
||||||
{{ App\Utils\Number::formatMoney($quote->amount, $quote->client) }}
|
{{ App\Utils\Number::formatMoney($quote->amount, $quote->client) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
||||||
{{ $quote->formatDate($quote->due_date, $quote->client->date_format()) }}
|
{{ $quote->translateDate($quote->due_date, $quote->client->date_format(), $quote->client->locale()) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
|
||||||
{!! App\Models\Quote::badgeForStatus($quote->status_id) !!}
|
{!! App\Models\Quote::badgeForStatus($quote->status_id) !!}
|
||||||
|
@ -50,10 +50,10 @@
|
|||||||
{{ \App\Models\RecurringInvoice::frequencyForKey($invoice->frequency_id) }}
|
{{ \App\Models\RecurringInvoice::frequencyForKey($invoice->frequency_id) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||||
{{ $invoice->formatDate($invoice->date, $invoice->client->date_format()) }}
|
{{ $invoice->translateDate($invoice->date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||||
{{ $invoice->formatDate($invoice->next_send_date, $invoice->client->date_format()) }}
|
{{ $invoice->translateDate($invoice->next_send_date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||||
{{ $invoice->remaining_cycles == '-1' ? ctrans('texts.endless') : $invoice->remaining_cycles }}
|
{{ $invoice->remaining_cycles == '-1' ? ctrans('texts.endless') : $invoice->remaining_cycles }}
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
{{ App\Utils\Number::formatMoney($recurring_invoice->amount, $recurring_invoice->client) }}
|
{{ App\Utils\Number::formatMoney($recurring_invoice->amount, $recurring_invoice->client) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||||
{{ $recurring_invoice->formatDate($recurring_invoice->date, $recurring_invoice->client->date_format()) }}
|
{{ $recurring_invoice->translateDate($recurring_invoice->date, $recurring_invoice->client->date_format(), $recurring_invoice->client->locale()) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||||
<a href="{{ route('client.recurring_invoice.show', $recurring_invoice->hashed_id) }}"
|
<a href="{{ route('client.recurring_invoice.show', $recurring_invoice->hashed_id) }}"
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
{{ App\Utils\Number::formatMoney($invoice->amount, $invoice->client) }}
|
{{ App\Utils\Number::formatMoney($invoice->amount, $invoice->client) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||||
{{ $invoice->formatDate($invoice->date, $invoice->client->date_format()) }}
|
{{ $invoice->translateDate($invoice->date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@empty
|
@empty
|
||||||
@ -124,7 +124,7 @@
|
|||||||
{{ App\Utils\Number::formatMoney($invoice->amount, $invoice->client) }}
|
{{ App\Utils\Number::formatMoney($invoice->amount, $invoice->client) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||||
{{ $invoice->formatDate($invoice->date, $invoice->client->date_format()) }}
|
{{ $invoice->translateDate($invoice->date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@empty
|
@empty
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
{{ ctrans('texts.invoice_date') }}
|
{{ ctrans('texts.invoice_date') }}
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
{{ $invoice->formatDate($invoice->date, $invoice->client->date_format()) }}
|
{{ $invoice->translateDate($invoice->date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||||
</dd>
|
</dd>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
{{ ctrans('texts.expires') }}
|
{{ ctrans('texts.expires') }}
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
|
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
{{ $client->formatDate($account->plan_expires, $client->date_format()) }}
|
{{ $client->translateDate($account->plan_expires, $client->date_format(), $client->locale()) }}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
{{ ctrans('texts.quote_date') }}
|
{{ ctrans('texts.quote_date') }}
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
{{ $quote->formatDate($quote->date, $quote->client->date_format()) }}
|
{{ $quote->translateDate($quote->date, $quote->client->date_format(), $quote->client->locale()) }}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
{{ ctrans('texts.start_date') }}
|
{{ ctrans('texts.start_date') }}
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
{{ $invoice->formatDate($invoice->start_date, $invoice->client->date_format()) }}
|
{{ $invoice->translateDate($invoice->start_date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||||
@ -26,7 +26,7 @@
|
|||||||
{{ ctrans('texts.next_send_date') }}
|
{{ ctrans('texts.next_send_date') }}
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
{{ $invoice->formatDate($invoice->next_send_date, $invoice->client->date_format()) }}
|
{{ $invoice->translateDate($invoice->next_send_date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
{{ ctrans('texts.start_date') }}
|
{{ ctrans('texts.start_date') }}
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
{{ $invoice->formatDate($invoice->start_date, $invoice->client->date_format()) }}
|
{{ $invoice->translateDate($invoice->start_date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||||
@ -27,7 +27,7 @@
|
|||||||
{{ ctrans('texts.next_send_date') }}
|
{{ ctrans('texts.next_send_date') }}
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
{{ $invoice->formatDate($invoice->next_send_date, $invoice->client->date_format()) }}
|
{{ $invoice->translateDate($invoice->next_send_date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||||
|
@ -51,10 +51,14 @@ class CreditsTest extends TestCase
|
|||||||
|
|
||||||
$company = Company::factory()->create(['account_id' => $account->id]);
|
$company = Company::factory()->create(['account_id' => $account->id]);
|
||||||
$company->settings = CompanySettings::defaults();
|
$company->settings = CompanySettings::defaults();
|
||||||
|
$company->settings->language_id = "1";
|
||||||
$company->save();
|
$company->save();
|
||||||
|
|
||||||
$client = Client::factory()->create(['company_id' => $company->id, 'user_id' => $user->id]);
|
$client = Client::factory()->create(['company_id' => $company->id, 'user_id' => $user->id]);
|
||||||
$client->settings = ClientSettings::defaults();
|
$client->settings = ClientSettings::defaults();
|
||||||
|
$settings = $client->settings;
|
||||||
|
$settings->language_id = "1";
|
||||||
|
$client->settings = $settings;
|
||||||
$client->save();
|
$client->save();
|
||||||
|
|
||||||
ClientContact::factory()->count(2)->create([
|
ClientContact::factory()->count(2)->create([
|
||||||
@ -63,7 +67,7 @@ class CreditsTest extends TestCase
|
|||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Credit::factory()->create([
|
$c1 = Credit::factory()->create([
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -72,7 +76,7 @@ class CreditsTest extends TestCase
|
|||||||
'status_id' => Credit::STATUS_SENT,
|
'status_id' => Credit::STATUS_SENT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Credit::factory()->create([
|
$c2 = Credit::factory()->create([
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -81,7 +85,7 @@ class CreditsTest extends TestCase
|
|||||||
'status_id' => Credit::STATUS_SENT,
|
'status_id' => Credit::STATUS_SENT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Credit::factory()->create([
|
$c3 = Credit::factory()->create([
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -92,6 +96,10 @@ class CreditsTest extends TestCase
|
|||||||
|
|
||||||
$this->actingAs($client->contacts->first(), 'contact');
|
$this->actingAs($client->contacts->first(), 'contact');
|
||||||
|
|
||||||
|
$c1->load('client');
|
||||||
|
$c2->load('client');
|
||||||
|
$c3->load('client');
|
||||||
|
|
||||||
Livewire::test(CreditsTable::class, ['company' => $company])
|
Livewire::test(CreditsTable::class, ['company' => $company])
|
||||||
->assertDontSee('testing-number-01')
|
->assertDontSee('testing-number-01')
|
||||||
->assertSee('testing-number-02')
|
->assertSee('testing-number-02')
|
||||||
@ -108,7 +116,13 @@ class CreditsTest extends TestCase
|
|||||||
|
|
||||||
$company = Company::factory()->create(['account_id' => $account->id]);
|
$company = Company::factory()->create(['account_id' => $account->id]);
|
||||||
|
|
||||||
|
|
||||||
$client = Client::factory()->create(['company_id' => $company->id, 'user_id' => $user->id]);
|
$client = Client::factory()->create(['company_id' => $company->id, 'user_id' => $user->id]);
|
||||||
|
$client->settings = ClientSettings::defaults();
|
||||||
|
$settings = $client->settings;
|
||||||
|
$settings->language_id = "1";
|
||||||
|
$client->settings = $settings;
|
||||||
|
$client->save();
|
||||||
|
|
||||||
ClientContact::factory()->count(2)->create([
|
ClientContact::factory()->count(2)->create([
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
namespace Tests\Feature\ClientPortal;
|
namespace Tests\Feature\ClientPortal;
|
||||||
|
|
||||||
|
|
||||||
|
use App\DataMapper\ClientSettings;
|
||||||
use App\Http\Livewire\InvoicesTable;
|
use App\Http\Livewire\InvoicesTable;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
@ -49,8 +50,14 @@ class InvoicesTest extends TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
$company = Company::factory()->create(['account_id' => $account->id]);
|
$company = Company::factory()->create(['account_id' => $account->id]);
|
||||||
|
$company->settings->language_id = "1";
|
||||||
|
$company->save();
|
||||||
|
|
||||||
$client = Client::factory()->create(['company_id' => $company->id, 'user_id' => $user->id]);
|
$client = Client::factory()->create(['company_id' => $company->id, 'user_id' => $user->id]);
|
||||||
|
$settings = $client->settings;
|
||||||
|
$settings->language_id = "1";
|
||||||
|
$client->settings = $settings;
|
||||||
|
$client->save();
|
||||||
|
|
||||||
ClientContact::factory()->count(2)->create([
|
ClientContact::factory()->count(2)->create([
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
@ -58,21 +65,21 @@ class InvoicesTest extends TestCase
|
|||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$sent = Invoice::factory()->create([
|
$sent = Invoice::factory()->for($client)->create([
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
'status_id' => Invoice::STATUS_SENT,
|
'status_id' => Invoice::STATUS_SENT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$paid = Invoice::factory()->create([
|
$paid = Invoice::factory()->for($client)->create([
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
'status_id' => Invoice::STATUS_PAID,
|
'status_id' => Invoice::STATUS_PAID,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$unpaid = Invoice::factory()->create([
|
$unpaid = Invoice::factory()->for($client)->create([
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user