mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add option for html entity view in Client Portal
This commit is contained in:
parent
0d9b40dcb6
commit
2873b0e522
@ -493,7 +493,10 @@ class CompanySettings extends BaseSettings
|
|||||||
|
|
||||||
public $payment_email_all_contacts = false;
|
public $payment_email_all_contacts = false;
|
||||||
|
|
||||||
|
public $show_pdfhtml_on_mobile = true;
|
||||||
|
|
||||||
public static $casts = [
|
public static $casts = [
|
||||||
|
'show_pdfhtml_on_mobile' => 'bool',
|
||||||
'payment_email_all_contacts' => 'bool',
|
'payment_email_all_contacts' => 'bool',
|
||||||
'statement_design_id' => 'string',
|
'statement_design_id' => 'string',
|
||||||
'delivery_note_design_id' => 'string',
|
'delivery_note_design_id' => 'string',
|
||||||
|
@ -57,6 +57,8 @@ class PdfSlot extends Component
|
|||||||
|
|
||||||
private $entity_calc;
|
private $entity_calc;
|
||||||
|
|
||||||
|
public $html_entity_option = true;
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
MultiDB::setDb($this->db);
|
MultiDB::setDb($this->db);
|
||||||
@ -128,7 +130,8 @@ class PdfSlot extends Component
|
|||||||
$this->entity_calc = $this->entity->calc();
|
$this->entity_calc = $this->entity->calc();
|
||||||
|
|
||||||
$this->settings = $this->entity->client ? $this->entity->client->getMergedSettings() : $this->entity->company->settings;
|
$this->settings = $this->entity->client ? $this->entity->client->getMergedSettings() : $this->entity->company->settings;
|
||||||
|
$this->html_entity_option = $this->entity->client ? $this->entity->client->getSetting('show_pdfhtml_on_mobile') : $this->entity->company->getSetting('show_pdfhtml_on_mobile');
|
||||||
|
|
||||||
$this->show_cost = in_array('$product.unit_cost', $this->settings->pdf_variables->product_columns);
|
$this->show_cost = in_array('$product.unit_cost', $this->settings->pdf_variables->product_columns);
|
||||||
$this->show_line_total = in_array('$product.line_total', $this->settings->pdf_variables->product_columns);
|
$this->show_line_total = in_array('$product.line_total', $this->settings->pdf_variables->product_columns);
|
||||||
$this->show_quantity = in_array('$product.quantity', $this->settings->pdf_variables->product_columns);
|
$this->show_quantity = in_array('$product.quantity', $this->settings->pdf_variables->product_columns);
|
||||||
|
@ -100,8 +100,8 @@ class PaymentMigrationRepository extends BaseRepository
|
|||||||
$payment->deleted_at = $data['deleted_at'] ?: null;
|
$payment->deleted_at = $data['deleted_at'] ?: null;
|
||||||
|
|
||||||
|
|
||||||
if ($payment->currency_id == 0) {
|
if (!$payment->currency_id || $payment->currency_id == 0 || $payment->currency_id == '') {
|
||||||
$payment->currency_id = $payment->company->settings->currency_id;
|
$payment->currency_id = $payment->client->settings->currency_id ?? $payment->company->settings->currency_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Ensure payment number generated*/
|
/*Ensure payment number generated*/
|
||||||
|
@ -11,25 +11,29 @@
|
|||||||
|
|
||||||
namespace App\Services\Client;
|
namespace App\Services\Client;
|
||||||
|
|
||||||
|
use App\Utils\Number;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Services\Email\Email;
|
use App\Services\Email\Email;
|
||||||
use App\Services\Email\EmailObject;
|
|
||||||
use App\Utils\Number;
|
|
||||||
use App\Utils\Traits\MakesDates;
|
use App\Utils\Traits\MakesDates;
|
||||||
use Illuminate\Mail\Mailables\Address;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use App\Services\Email\EmailObject;
|
||||||
|
use App\Utils\Traits\GeneratesCounter;
|
||||||
|
use Illuminate\Mail\Mailables\Address;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
|
|
||||||
class ClientService
|
class ClientService
|
||||||
{
|
{
|
||||||
use MakesDates;
|
use MakesDates, GeneratesCounter;
|
||||||
|
|
||||||
private string $client_start_date;
|
private string $client_start_date;
|
||||||
|
|
||||||
private string $client_end_date;
|
private string $client_end_date;
|
||||||
|
|
||||||
|
private bool $completed = true;
|
||||||
|
|
||||||
public function __construct(private Client $client)
|
public function __construct(private Client $client)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -145,6 +149,31 @@ class ClientService
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function applyNumber(): self
|
||||||
|
{
|
||||||
|
$x = 1;
|
||||||
|
|
||||||
|
if(isset($this->client->number))
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
do {
|
||||||
|
try {
|
||||||
|
$this->client->number = $this->getNextClientNumber($this->client);
|
||||||
|
$this->client->saveQuietly();
|
||||||
|
|
||||||
|
$this->completed = false;
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
$x++;
|
||||||
|
|
||||||
|
if ($x > 10) {
|
||||||
|
$this->completed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while ($this->completed);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function updatePaymentBalance()
|
public function updatePaymentBalance()
|
||||||
{
|
{
|
||||||
$amount = Payment::query()->where('client_id', $this->client->id)
|
$amount = Payment::query()->where('client_id', $this->client->id)
|
||||||
|
@ -21,7 +21,11 @@
|
|||||||
</button>
|
</button>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@if($html_entity_option)
|
||||||
<div class="hidden lg:block">
|
<div class="hidden lg:block">
|
||||||
|
@else
|
||||||
|
<div>
|
||||||
|
@endif
|
||||||
<div wire:init="getPdf()">
|
<div wire:init="getPdf()">
|
||||||
<div class="flex mt-4 place-items-center" id="loader" wire:ignore>
|
<div class="flex mt-4 place-items-center" id="loader" wire:ignore>
|
||||||
<span class="loader m-auto" wire:ignore></span>
|
<span class="loader m-auto" wire:ignore></span>
|
||||||
@ -61,17 +65,18 @@
|
|||||||
</style>
|
</style>
|
||||||
</div>
|
</div>
|
||||||
@if($pdf)
|
@if($pdf)
|
||||||
<!-- <iframe id="pdf-iframe" src="{!! $pdf !!}" class="h-screen w-full border-0 mt-4"></iframe> -->
|
|
||||||
<iframe id="pdf-iframe" src="/{{ $route_entity }}/showBlob/{{ $pdf }}" class="h-screen w-full border-0 mt-4"></iframe>
|
<iframe id="pdf-iframe" src="/{{ $route_entity }}/showBlob/{{ $pdf }}" class="h-screen w-full border-0 mt-4"></iframe>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if($html_entity_option)
|
||||||
<div class="block lg:hidden">
|
<div class="block lg:hidden">
|
||||||
@include('portal.ninja2020.components.html-viewer')
|
@include('portal.ninja2020.components.html-viewer')
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@endif
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user