UI fixes in Invoices

This commit is contained in:
Pinga 2024-03-05 17:36:03 +02:00
parent abdf0bcb7b
commit c78f3db100
2 changed files with 11 additions and 6 deletions

View file

@ -9,6 +9,7 @@ use Mpociot\VatCalculator\VatCalculator;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use Ramsey\Uuid\Uuid;
use League\ISO3166\ISO3166;
class FinancialsController extends Controller
{
@ -39,6 +40,7 @@ class FinancialsController extends Controller
return $response->withHeader('Location', '/invoices')->withStatus(302);
}
$iso3166 = new ISO3166();
$db = $this->container->get('db');
// Get the current URI
$uri = $request->getUri()->getPath();
@ -78,6 +80,8 @@ class FinancialsController extends Controller
$validVAT = null;
}
$totalAmount = $grossPrice + $taxValue;
$billing_country = $iso3166->alpha2($billing['cc']);
$billing_country = $billing_country['name'];
return view($response,'admin/financials/viewInvoice.twig', [
'invoice_details' => $invoice_details,
@ -92,11 +96,12 @@ class FinancialsController extends Controller
'phone' => $phone,
'email' => $email,
'vatRate' => ($taxRate * 100) . "%",
'vatAmount' => $taxValue,
'vatAmount' => sprintf("%.2f", $taxValue),
'validVAT' => $validVAT,
'netPrice' => $netPrice,
'total' => $totalAmount,
'currentUri' => $uri
'netPrice' => sprintf("%.2f", $netPrice),
'total' => sprintf("%.2f", $totalAmount),
'currentUri' => $uri,
'billing_country' => $billing_country,
]);
}

View file

@ -47,7 +47,7 @@
{{ billing_vat }} {% if validVAT %}<svg xmlns="http://www.w3.org/2000/svg" class="icon text-success" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l5 5l10 -10" /></svg>{% endif %}<br>
{{ billing.street1 }}<br>
{{ billing.city }}, {{ billing.sp }}<br>
{{ billing.pc }}, {{ billing.cc }}<br>
{{ billing.pc }}, {{ billing_country }}<br>
{{ billing.email }}
</address>
</div>
@ -93,7 +93,7 @@
{% endfor %}
{% else %}
<tr>
<td colspan="2" class="text-center">{{ __('No items found.') }}</td>
<td colspan="3" class="text-center">{{ __('No items found.') }}</td>
</tr>
{% endif %}
<tr>