mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Fixes for template mocked data
This commit is contained in:
parent
a58967dcab
commit
148f4c2c6d
@ -76,6 +76,26 @@ class InvoiceItemFactory
|
||||
$data[] = $item;
|
||||
}
|
||||
|
||||
|
||||
$item = self::create();
|
||||
$item->quantity = $faker->numberBetween(1, 10);
|
||||
$item->cost = $faker->randomFloat(2, 1, 1000);
|
||||
$item->line_total = $item->quantity * $item->cost;
|
||||
$item->is_amount_discount = true;
|
||||
$item->discount = $faker->numberBetween(1, 10);
|
||||
$item->notes = str_replace(['"',"'"], ['',""], $faker->realText(20));
|
||||
$item->product_key = $faker->word();
|
||||
// $item->custom_value1 = $faker->realText(10);
|
||||
// $item->custom_value2 = $faker->realText(10);
|
||||
// $item->custom_value3 = $faker->realText(10);
|
||||
// $item->custom_value4 = $faker->realText(10);
|
||||
$item->tax_name1 = 'GST';
|
||||
$item->tax_rate1 = 10.00;
|
||||
$item->type_id = '2';
|
||||
|
||||
$data[] = $item;
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,7 @@ class TransactionTransformer implements BankRevenueInterface
|
||||
}
|
||||
|
||||
$amount = (float) $transaction["transactionAmount"]["amount"];
|
||||
$base_type = $amount < 0 ? 'DEBIT' : 'CREDIT';
|
||||
|
||||
// description could be in varios places
|
||||
$description = '';
|
||||
@ -140,7 +141,7 @@ class TransactionTransformer implements BankRevenueInterface
|
||||
return [
|
||||
'transaction_id' => 0,
|
||||
'nordigen_transaction_id' => $transactionId,
|
||||
'amount' => $amount,
|
||||
'amount' => abs($amount),
|
||||
'currency_id' => $this->convertCurrency($transaction["transactionAmount"]["currency"]),
|
||||
'category_id' => null,
|
||||
'category_type' => array_key_exists('additionalInformation', $transaction) ? $transaction["additionalInformation"] : '',
|
||||
@ -148,7 +149,7 @@ class TransactionTransformer implements BankRevenueInterface
|
||||
'description' => $description,
|
||||
'participant' => $participant,
|
||||
'participant_name' => $participant_name,
|
||||
'base_type' => $amount < 0 ? 'DEBIT' : 'CREDIT',
|
||||
'base_type' => $base_type,
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class Portal extends Component
|
||||
public function mount()
|
||||
{
|
||||
|
||||
$this->companies = auth()->user()->account->companies->map(function ($company) {
|
||||
$this->companies = auth()->guard('user')->check() ? auth()->guard('user')->user()->account->companies->map(function ($company) {
|
||||
return [
|
||||
'key' => $company->company_key,
|
||||
'city' => $company->settings->city,
|
||||
@ -37,7 +37,7 @@ class Portal extends Component
|
||||
'zip' => $company->settings->postal_code,
|
||||
'legal_entity_id' => $company->legal_entity_id
|
||||
];
|
||||
})->toArray();
|
||||
})->toArray() : [];
|
||||
|
||||
}
|
||||
|
||||
@ -48,6 +48,8 @@ class Portal extends Component
|
||||
if (Auth::attempt($credentials)) {
|
||||
session()->flash('message', 'Logged in successfully.');
|
||||
|
||||
App::setLocale(auth()->guard('user')->user()->account->companies->first()->getLocale());
|
||||
|
||||
$this->companies = auth()->user()->account->companies->map(function ($c){
|
||||
return ['name' => $c->settings->name, 'company_key' => $c->company_key, 'legal_entity_id' => $c->legal_entity_id];
|
||||
})->toArray();
|
||||
@ -65,6 +67,12 @@ class Portal extends Component
|
||||
|
||||
}
|
||||
|
||||
public function register(string $company_key)
|
||||
{
|
||||
nlog("Please register {$company_key}");
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.e-invoice.portal');
|
||||
|
File diff suppressed because one or more lines are too long
@ -221,6 +221,7 @@ class TemplateService
|
||||
$this->entity = $this->company->invoices()->first() ?? $this->company->quotes()->first();
|
||||
|
||||
$this->data = $tm->engines;
|
||||
|
||||
$this->variables = $tm->variables[0];
|
||||
$this->twig->addGlobal('currency_code', $this->company->currency()->code);
|
||||
$this->twig->addGlobal('show_credits', true);
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="flex flex-col h-screen bg-gray-100 p-10">
|
||||
<div class="flex flex-col bg-gray-100 p-10">
|
||||
|
||||
@if (Auth::guard('user')->check())
|
||||
<div class="w-full">
|
||||
@ -20,23 +20,63 @@
|
||||
|
||||
@foreach($companies as $company)
|
||||
|
||||
<div class="w-full mx-6 md:mx-0">
|
||||
<dl class="grid grid-cols-2 gap-4">
|
||||
<div class="flex items-center">
|
||||
<span class="font-semibold text-gray-700">Company Name:</span>
|
||||
<div class="w-full mx-6 md:mx-0 border-b border-gray-300">
|
||||
<dl class="grid grid-cols-2 gap-4 mb-4">
|
||||
|
||||
<div class="flex items-center p-1">
|
||||
<span class="font-semibold text-gray-700">{{ ctrans('texts.name') }}:</span>
|
||||
<span class="ml-2 text-gray-600">{{ $company['name'] }}</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center p-1">
|
||||
<span class="font-semibold text-gray-700">{{ ctrans('texts.address1') }}:</span>
|
||||
<span class="ml-2 text-gray-600">{{ $company['line1'] }}</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center p-1">
|
||||
<span class="font-semibold text-gray-700">{{ ctrans('texts.address2') }}:</span>
|
||||
<span class="ml-2 text-gray-600">{{ $company['line2'] }}</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center p-1">
|
||||
<span class="font-semibold text-gray-700">{{ ctrans('texts.city') }}:</span>
|
||||
<span class="ml-2 text-gray-600">{{ $company['city'] }}</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center p-1">
|
||||
<span class="font-semibold text-gray-700">{{ ctrans('texts.state') }}:</span>
|
||||
<span class="ml-2 text-gray-600">{{ $company['county'] }}</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center p-1">
|
||||
<span class="font-semibold text-gray-700">{{ ctrans('texts.postal_code') }}:</span>
|
||||
<span class="ml-2 text-gray-600">{{ $company['zip'] }}</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center p-1">
|
||||
<span class="font-semibold text-gray-700">{{ ctrans('texts.country') }}:</span>
|
||||
<span class="ml-2 text-gray-600">{{ $company['country'] }}</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center p-1">
|
||||
<span class="font-semibold text-gray-700">{{ ctrans('texts.vat_number') }}</span>
|
||||
<span class="ml-2 text-gray-600">{{ $company['vat_number'] }}</span>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="p-2 border-b border-gray-300">{{ $company['legal_entity_id'] }}</div>
|
||||
<div class="p-2 border-b border-gray-300">
|
||||
<button class="text-blue-500 hover:underline">Register</button>
|
||||
{{ $company['legal_entity_id'] }}
|
||||
</div>
|
||||
|
||||
<div class="p-2 border-b border-gray-300">
|
||||
@if($company['legal_entity_id'])
|
||||
<p>Registered</p>
|
||||
@else
|
||||
<button class="bg-blue-500 justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" wire:click="register('{{ $company['key'] }}')" wire:loading.attr="disabled">Register</button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@endforeach
|
||||
|
||||
@ -63,6 +103,7 @@
|
||||
Login
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
@if (session()->has('error'))
|
||||
|
Loading…
Reference in New Issue
Block a user