1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Patches from v5-dev

This commit is contained in:
David Bomba 2022-07-20 10:56:02 +10:00
commit e337abe819
37 changed files with 226 additions and 277 deletions

View File

@ -1 +1 @@
5.4.10
5.4.11

View File

@ -49,7 +49,8 @@ class InvoiceFactory
$invoice->user_id = $user_id;
$invoice->company_id = $company_id;
$invoice->recurring_id = null;
$invoice->exchange_rate = 1;
return $invoice;
}
}

View File

@ -181,6 +181,7 @@ class MigrationController extends BaseController
$company->tasks()->forceDelete();
$company->vendors()->forceDelete();
$company->expenses()->forceDelete();
$company->purchase_orders()->forceDelete();
$settings = $company->settings;
@ -198,6 +199,7 @@ class MigrationController extends BaseController
$settings->ticket_number_counter = 1;
$settings->payment_number_counter = 1;
$settings->project_number_counter = 1;
$settings->purchase_order_number_counter = 1;
$company->settings = $settings;

View File

@ -262,10 +262,7 @@ class SelfUpdateController extends BaseController
continue;
}
//nlog($file->getPathname());
if ($file->isFile() && ! $file->isWritable()) {
// throw new FilePermissionsFailure($file);
nlog("Cannot update system because {$file->getFileName()} is not writable");
throw new FilePermissionsFailure("Cannot update system because {$file->getFileName()} is not writable");

View File

@ -115,7 +115,7 @@ class StripeConnectController extends BaseController
$company_gateway->setConfig($payload);
$company_gateway->save();
StripeWebhook::dispatch($company->company_key, $company_gateway->id);
// StripeWebhook::dispatch($company->company_key, $company_gateway->id);
//response here
return view('auth.connect.completed');

View File

@ -61,10 +61,6 @@ class StoreCompanyRequest extends Request
{
$input = $this->all();
//https not sure i should be forcing this.
// if(array_key_exists('portal_domain', $input) && strlen($input['portal_domain']) > 1)
// $input['portal_domain'] = str_replace("http:", "https:", $input['portal_domain']);
if (array_key_exists('google_analytics_url', $input)) {
$input['google_analytics_key'] = $input['google_analytics_url'];
}

View File

@ -458,7 +458,7 @@ class CompanyImport implements ShouldQueue
$settings->ticket_number_counter = 1;
$settings->payment_number_counter = 1;
$settings->project_number_counter = 1;
$settings->purchase_order_counter = 1;
$settings->purchase_order_number_counter = 1;
$this->company->settings = $co->settings;
// $this->company->settings = $this->backup_file->company->settings;
$this->company->save();

View File

@ -21,8 +21,8 @@ class InvoiceArchivedActivity implements ShouldQueue
{
protected $activity_repo;
public $delay = 5;
public $delay = 15;
/**
* Create the event listener.
*
@ -42,7 +42,7 @@ class InvoiceArchivedActivity implements ShouldQueue
public function handle($event)
{
MultiDB::setDb($event->company->db);
$fields = new stdClass;
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->invoice->user_id;

View File

@ -21,8 +21,8 @@ class InvoicePaidActivity implements ShouldQueue
{
protected $activity_repo;
public $delay = 5;
public $delay = 10;
/**
* Create the event listener.
*
@ -41,6 +41,7 @@ class InvoicePaidActivity implements ShouldQueue
*/
public function handle($event)
{
MultiDB::setDb($event->company->db);
$fields = new stdClass;
@ -52,10 +53,11 @@ class InvoicePaidActivity implements ShouldQueue
$fields->company_id = $event->invoice->company_id;
$fields->activity_type_id = Activity::PAID_INVOICE;
$fields->payment_id = $event->payment->id;
$this->activity_repo->save($fields, $event->invoice, $event->event_vars);
if ($event->invoice->subscription()->exists()) {
if($event->invoice->subscription()->exists())
{
$event->invoice->subscription->service()->planPaid($event->invoice);
}

View File

@ -17,12 +17,15 @@ use App\Events\Invoice\InvoiceWasUpdated;
use App\Helpers\Invoice\InvoiceSum;
use App\Helpers\Invoice\InvoiceSumInclusive;
use App\Jobs\Entity\CreateEntityPdf;
use App\Models\Expense;
use App\Models\Presenters\InvoicePresenter;
use App\Models\Task;
use App\Services\Invoice\InvoiceService;
use App\Services\Ledger\LedgerService;
use App\Utils\Ninja;
use App\Utils\Traits\Invoice\ActionsInvoice;
use App\Utils\Traits\MakesDates;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\MakesInvoiceValues;
use App\Utils\Traits\MakesReminders;
use App\Utils\Traits\NumberFormatter;
@ -565,6 +568,56 @@ class Invoice extends BaseModel
];
}
public function expense_documents()
{
$line_items = $this->line_items;
$expense_ids = [];
foreach($line_items as $item)
{
if(property_exists($item, 'expense_id'))
{
$expense_ids[] = $item->expense_id;
}
}
return Expense::whereIn('id', $this->transformKeys($expense_ids))
->where('invoice_documents', 1)
->where('company_id', $this->company_id)
->cursor();
}
public function task_documents()
{
$line_items = $this->line_items;
$task_ids = [];
foreach($line_items as $item)
{
if(property_exists($item, 'task_id'))
{
$task_ids[] = $item->task_id;
}
}
return Task::whereIn('id', $this->transformKeys($task_ids))
->whereHas('company', function($query){
$query->where('invoice_task_documents', 1);
})
->where('company_id', $this->company_id)
->cursor();
}
public function translate_entity()
{
return ctrans('texts.invoice');

View File

@ -71,22 +71,22 @@ class Task extends BaseModel
public function client()
{
return $this->belongsTo(Client::class);
return $this->belongsTo(Client::class)->withTrashed();
}
public function status()
{
return $this->belongsTo(TaskStatus::class);
return $this->belongsTo(TaskStatus::class)->withTrashed();
}
public function invoice()
{
return $this->belongsTo(Invoice::class);
return $this->belongsTo(Invoice::class)->withTrashed();
}
public function project()
{
return $this->belongsTo(Project::class);
return $this->belongsTo(Project::class)->withTrashed();
}
public function calcStartTime()

View File

@ -59,7 +59,7 @@ class Alipay
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
$this->stripe->payment_hash->save();
if ($request->redirect_status == 'succeeded') {
if (in_array($request->redirect_status, ['succeeded', 'pending'])) {
return $this->processSuccesfulRedirect($request->source);
}

View File

@ -81,7 +81,7 @@ class Bancontact
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
$this->stripe->payment_hash->save();
if ($request->redirect_status == 'succeeded') {
if (in_array($request->redirect_status, ['succeeded','pending'])) {
return $this->processSuccessfulPayment($request->payment_intent);
}

View File

@ -80,7 +80,7 @@ class EPS
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
$this->stripe->payment_hash->save();
if ($request->redirect_status == 'succeeded') {
if (in_array($request->redirect_status, ['succeeded','pending'])) {
return $this->processSuccessfulPayment($request->payment_intent);
}

View File

@ -81,7 +81,7 @@ class FPX
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
$this->stripe->payment_hash->save();
if ($request->redirect_status == 'succeeded') {
if (in_array($request->redirect_status, ['succeeded','pending'])) {
return $this->processSuccessfulPayment($request->payment_intent);
}

View File

@ -80,7 +80,7 @@ class GIROPAY
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
$this->stripe->payment_hash->save();
if ($request->redirect_status == 'succeeded') {
if (in_array($request->redirect_status, ['succeeded','pending'])) {
return $this->processSuccessfulPayment($request->payment_intent);
}

View File

@ -80,7 +80,7 @@ class PRZELEWY24
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
$this->stripe->payment_hash->save();
if ($request->redirect_status == 'succeeded') {
if (in_array($request->redirect_status, ['succeeded','pending'])) {
return $this->processSuccessfulPayment($request->payment_intent);
}

View File

@ -77,10 +77,11 @@ class SOFORT
public function paymentResponse($request)
{
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
$this->stripe->payment_hash->save();
if ($request->redirect_status == 'succeeded') {
if (in_array($request->redirect_status, ['succeeded','pending'])) {
return $this->processSuccessfulPayment($request->payment_intent);
}

View File

@ -80,7 +80,7 @@ class iDeal
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
$this->stripe->payment_hash->save();
if ($request->redirect_status == 'succeeded') {
if (in_array($request->redirect_status, ['succeeded','pending'])) {
return $this->processSuccessfulPayment($request->payment_intent);
}

View File

@ -309,6 +309,9 @@ class InvoiceService
} elseif ($this->invoice->balance > 0 && $this->invoice->balance < $this->invoice->amount) {
$this->invoice->status_id = Invoice::STATUS_PARTIAL;
}
elseif ($this->invoice->balance < 0) {
$this->invoice->status_id = Invoice::STATUS_SENT;
}
return $this;
}

View File

@ -60,9 +60,9 @@ class HtmlEngine
$this->company = $invitation->company;
$this->contact = $invitation->contact->load('client');
$this->client = $this->contact->client->load('company', 'country');
$this->client = $this->contact->client->load('company','country');
$this->entity->load('client');
$this->settings = $this->client->getMergedSettings();
@ -72,25 +72,26 @@ class HtmlEngine
$this->helpers = new Helpers();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private function resolveEntityString()
{
switch ($this->invitation) {
case $this->invitation instanceof InvoiceInvitation:
case ($this->invitation instanceof InvoiceInvitation):
return 'invoice';
break;
case $this->invitation instanceof CreditInvitation:
case ($this->invitation instanceof CreditInvitation):
return 'credit';
break;
case $this->invitation instanceof QuoteInvitation:
case ($this->invitation instanceof QuoteInvitation):
return 'quote';
break;
case $this->invitation instanceof RecurringInvoiceInvitation:
case ($this->invitation instanceof RecurringInvoiceInvitation):
return 'recurring_invoice';
break;
default:
// code...
# code...
break;
}
}
@ -124,7 +125,7 @@ class HtmlEngine
$data['$due_date'] = ['value' => $this->translateDate($this->entity->due_date, $this->client->date_format(), $this->client->locale()) ?: '&nbsp;', 'label' => ctrans('texts.'.$this->entity_string.'_due_date')];
$data['$partial_due_date'] = ['value' => $this->translateDate($this->entity->partial_due_date, $this->client->date_format(), $this->client->locale()) ?: '&nbsp;', 'label' => ctrans('texts.'.$this->entity_string.'_due_date')];
$data['$dueDate'] = &$data['$due_date'];
$data['$payment_due'] = ['value' => $this->translateDate($this->entity->due_date, $this->client->date_format(), $this->client->locale()) ?: '&nbsp;', 'label' => ctrans('texts.payment_due')];
@ -139,6 +140,7 @@ class HtmlEngine
$data['$payment_button'] = ['value' => '<a class="button" href="'.$this->invitation->getPaymentLink().'">'.ctrans('texts.pay_now').'</a>', 'label' => ctrans('texts.pay_now')];
$data['$payment_link'] = ['value' => $this->invitation->getPaymentLink(), 'label' => ctrans('texts.pay_now')];
if ($this->entity_string == 'invoice' || $this->entity_string == 'recurring_invoice') {
$data['$entity'] = ['value' => '', 'label' => ctrans('texts.invoice')];
$data['$number'] = ['value' => $this->entity->number ?: '&nbsp;', 'label' => ctrans('texts.invoice_number')];
@ -153,12 +155,12 @@ class HtmlEngine
$data['$view_url'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_invoice')];
$data['$date'] = ['value' => $this->translateDate($this->entity->date, $this->client->date_format(), $this->client->locale()) ?: '&nbsp;', 'label' => ctrans('texts.invoice_date')];
if ($this->entity->project) {
if($this->entity->project) {
$data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project_name')];
$data['$invoice.project'] = &$data['$project.name'];
}
if ($this->entity->vendor) {
if($this->entity->vendor) {
$data['$invoice.vendor'] = ['value' => $this->entity->vendor->present()->name(), 'label' => ctrans('texts.vendor_name')];
}
@ -188,14 +190,15 @@ class HtmlEngine
$data['$view_url'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_quote')];
$data['$date'] = ['value' => $this->translateDate($this->entity->date, $this->client->date_format(), $this->client->locale()) ?: '&nbsp;', 'label' => ctrans('texts.quote_date')];
if ($this->entity->project) {
if($this->entity->project) {
$data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project_name')];
$data['$invoice.project'] = &$data['$project.name'];
}
if ($this->entity->vendor) {
if($this->entity->vendor) {
$data['$invoice.vendor'] = ['value' => $this->entity->vendor->present()->name(), 'label' => ctrans('texts.vendor_name')];
}
}
if ($this->entity_string == 'credit') {
@ -221,11 +224,10 @@ class HtmlEngine
$data['$subtotal'] = ['value' => Number::formatMoney($this->entity_calc->getSubTotal(), $this->client) ?: '&nbsp;', 'label' => ctrans('texts.subtotal')];
$data['$gross_subtotal'] = ['value' => Number::formatMoney($this->entity_calc->getGrossSubTotal(), $this->client) ?: '&nbsp;', 'label' => ctrans('texts.subtotal')];
if ($this->entity->uses_inclusive_taxes) {
if($this->entity->uses_inclusive_taxes)
$data['$net_subtotal'] = ['value' => Number::formatMoney(($this->entity_calc->getSubTotal() - $this->entity->total_taxes - $this->entity_calc->getTotalDiscount()), $this->client) ?: '&nbsp;', 'label' => ctrans('texts.net_subtotal')];
} else {
else
$data['$net_subtotal'] = ['value' => Number::formatMoney($this->entity_calc->getSubTotal() - $this->entity_calc->getTotalDiscount(), $this->client) ?: '&nbsp;', 'label' => ctrans('texts.net_subtotal')];
}
$data['$invoice.subtotal'] = &$data['$subtotal'];
@ -234,12 +236,15 @@ class HtmlEngine
$data['$balance_due_raw'] = ['value' => $this->entity->partial, 'label' => ctrans('texts.partial_due')];
$data['$amount_raw'] = ['value' => $this->entity->partial, 'label' => ctrans('texts.partial_due')];
$data['$due_date'] = ['value' => $this->translateDate($this->entity->partial_due_date, $this->client->date_format(), $this->client->locale()) ?: '&nbsp;', 'label' => ctrans('texts.'.$this->entity_string.'_due_date')];
} else {
if ($this->entity->status_id == 1) {
if($this->entity->status_id == 1){
$data['$balance_due'] = ['value' => Number::formatMoney($this->entity->amount, $this->client) ?: '&nbsp;', 'label' => ctrans('texts.balance_due')];
$data['$balance_due_raw'] = ['value' => $this->entity->amount, 'label' => ctrans('texts.balance_due')];
$data['$amount_raw'] = ['value' => $this->entity->amount, 'label' => ctrans('texts.amount')];
} else {
}
else{
$data['$balance_due'] = ['value' => Number::formatMoney($this->entity->balance, $this->client) ?: '&nbsp;', 'label' => ctrans('texts.balance_due')];
$data['$balance_due_raw'] = ['value' => $this->entity->balance, 'label' => ctrans('texts.balance_due')];
$data['$amount_raw'] = ['value' => $this->entity->amount, 'label' => ctrans('texts.amount')];
@ -249,10 +254,11 @@ class HtmlEngine
$data['$quote.balance_due'] = &$data['$balance_due'];
$data['$invoice.balance_due'] = &$data['$balance_due'];
if ($this->entity_string == 'credit') {
$data['$balance_due'] = ['value' => Number::formatMoney($this->entity->balance, $this->client) ?: '&nbsp;', 'label' => ctrans('texts.credit_balance')];
$data['$balance_due_raw'] = ['value' => $this->entity->balance, 'label' => ctrans('texts.credit_balance')];
$data['$amount_raw'] = ['value' => $this->entity->amount, 'label' => ctrans('texts.amount')];
$data['$amount_raw'] = ['value' => $this->entity->amount, 'label' => ctrans('texts.amount')];
}
// $data['$balance_due'] = $data['$balance_due'];
@ -292,7 +298,7 @@ class HtmlEngine
$data['$invoice.custom2'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'invoice2', $this->entity->custom_value2, $this->client) ?: '&nbsp;', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'invoice2')];
$data['$invoice.custom3'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'invoice3', $this->entity->custom_value3, $this->client) ?: '&nbsp;', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'invoice3')];
$data['$invoice.custom4'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'invoice4', $this->entity->custom_value4, $this->client) ?: '&nbsp;', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'invoice4')];
$data['$invoice.public_notes'] = ['value' => Helpers::processReservedKeywords(\nl2br($this->entity->public_notes ?: ''), $this->client) ?: '', 'label' => ctrans('texts.public_notes')];
$data['$invoice.public_notes'] = ['value' => Helpers::processReservedKeywords(\nl2br($this->entity->public_notes), $this->client) ?: '', 'label' => ctrans('texts.public_notes')];
$data['$entity.public_notes'] = &$data['$invoice.public_notes'];
$data['$public_notes'] = &$data['$invoice.public_notes'];
$data['$notes'] = &$data['$public_notes'];
@ -336,13 +342,12 @@ class HtmlEngine
$data['$vat_number'] = ['value' => $this->client->vat_number ?: '&nbsp;', 'label' => ctrans('texts.vat_number')];
$data['$website'] = ['value' => $this->client->present()->website() ?: '&nbsp;', 'label' => ctrans('texts.website')];
$data['$phone'] = ['value' => $this->client->present()->phone() ?: '&nbsp;', 'label' => ctrans('texts.phone')];
$data['$country'] = ['value' => isset($this->client->country->name) ? ctrans('texts.country_'.$this->client->country->name) : '', 'label' => ctrans('texts.country')];
$data['$country'] = ['value' => isset($this->client->country->name) ? ctrans('texts.country_' . $this->client->country->name) : '', 'label' => ctrans('texts.country')];
$data['$country_2'] = ['value' => isset($this->client->country) ? $this->client->country->iso_3166_2 : '', 'label' => ctrans('texts.country')];
$data['$email'] = ['value' => isset($this->contact) ? $this->contact->email : 'no contact email on record', 'label' => ctrans('texts.email')];
if (str_contains($data['$email']['value'], 'example.com')) {
if(str_contains($data['$email']['value'], 'example.com'))
$data['$email'] = ['value' => '', 'label' => ctrans('texts.email')];
}
$data['$client_name'] = ['value' => $this->entity->present()->clientName() ?: '&nbsp;', 'label' => ctrans('texts.client_name')];
$data['$client.name'] = &$data['$client_name'];
@ -366,7 +371,7 @@ class HtmlEngine
$data['$client.postal_city_state'] = &$data['$postal_city_state'];
$data['$client.country'] = &$data['$country'];
$data['$client.email'] = &$data['$email'];
$data['$client.billing_address'] = &$data['$client_address'];
$data['$client.billing_address1'] = &$data['$client.address1'];
$data['$client.billing_address2'] = &$data['$client.address2'];
@ -381,11 +386,11 @@ class HtmlEngine
$data['$client.shipping_city'] = ['value' => $this->client->shipping_city ?: '&nbsp;', 'label' => ctrans('texts.shipping_city')];
$data['$client.shipping_state'] = ['value' => $this->client->shipping_state ?: '&nbsp;', 'label' => ctrans('texts.shipping_state')];
$data['$client.shipping_postal_code'] = ['value' => $this->client->shipping_postal_code ?: '&nbsp;', 'label' => ctrans('texts.shipping_postal_code')];
$data['$client.shipping_country'] = ['value' => isset($this->client->shipping_country->name) ? ctrans('texts.country_'.$this->client->shipping_country->name) : '', 'label' => ctrans('texts.shipping_country')];
$data['$client.shipping_country'] = ['value' => isset($this->client->shipping_country->name) ? ctrans('texts.country_' . $this->client->shipping_country->name) : '', 'label' => ctrans('texts.shipping_country')];
$data['$client.currency'] = ['value' => $this->client->currency()->code, 'label' => ''];
$data['$client.lang_2'] = ['value' => $this->client->language()?->locale, 'label' => ''];
$data['$client.lang_2'] = ['value' => optional($this->client->language())->locale, 'label' => ''];
$data['$client.balance'] = ['value' => Number::formatMoney($this->client->balance, $this->client), 'label' => ctrans('texts.account_balance')];
$data['$client_balance'] = ['value' => Number::formatMoney($this->client->balance, $this->client), 'label' => ctrans('texts.account_balance')];
@ -403,6 +408,9 @@ class HtmlEngine
$data['$contact.last_name'] = ['value' => isset($this->contact) ? $this->contact->last_name : '', 'label' => ctrans('texts.last_name')];
$data['$portal_button'] = ['value' => '<a class="button" href="'.$this->contact->getLoginLink().'?client_hash='.$this->client->client_hash.'">'.ctrans('texts.view_client_portal').'</a>', 'label' => ctrans('view_client_portal')];
$data['$contact.portal_button'] = &$data['$portal_button'];
$data['$contact.custom1'] = ['value' => isset($this->contact) ? $this->contact->custom_value1 : '&nbsp;', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'contact1')];
$data['$contact.custom2'] = ['value' => isset($this->contact) ? $this->contact->custom_value2 : '&nbsp;', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'contact2')];
$data['$contact.custom3'] = ['value' => isset($this->contact) ? $this->contact->custom_value3 : '&nbsp;', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'contact3')];
@ -505,7 +513,7 @@ class HtmlEngine
$data['_rate2'] = ['value' => '', 'label' => ctrans('texts.tax')];
$data['_rate3'] = ['value' => '', 'label' => ctrans('texts.tax')];
$data['$font_size'] = ['value' => $this->settings->font_size.'px', 'label' => ''];
$data['$font_size'] = ['value' => $this->settings->font_size . 'px', 'label' => ''];
$data['$font_name'] = ['value' => Helpers::resolveFont($this->settings->primary_font)['name'], 'label' => ''];
$data['$font_url'] = ['value' => Helpers::resolveFont($this->settings->primary_font)['url'], 'label' => ''];
@ -520,7 +528,7 @@ class HtmlEngine
//$data['$entity_footer'] = ['value' => $this->client->getSetting("{$this->entity_string}_footer"), 'label' => ''];
$data['$entity_footer'] = ['value' => Helpers::processReservedKeywords(\nl2br($this->entity->footer), $this->client), 'label' => ''];
$data['$footer'] = &$data['$entity_footer'];
$data['$page_size'] = ['value' => $this->settings->page_size, 'label' => ''];
$data['$page_layout'] = ['value' => property_exists($this->settings, 'page_layout') ? $this->settings->page_layout : 'Portrait', 'label' => ''];
@ -533,8 +541,8 @@ class HtmlEngine
$data['$payment_url'] = &$data['$payment_link'];
$data['$portalButton'] = &$data['$paymentLink'];
$data['$dir'] = ['value' => $this->client->language()?->locale === 'ar' ? 'rtl' : 'ltr', 'label' => ''];
$data['$dir_text_align'] = ['value' => $this->client->language()?->locale === 'ar' ? 'right' : 'left', 'label' => ''];
$data['$dir'] = ['value' => optional($this->client->language())->locale === 'ar' ? 'rtl' : 'ltr', 'label' => ''];
$data['$dir_text_align'] = ['value' => optional($this->client->language())->locale === 'ar' ? 'right' : 'left', 'label' => ''];
$data['$payment.date'] = ['value' => '&nbsp;', 'label' => ctrans('texts.payment_date')];
$data['$method'] = ['value' => '&nbsp;', 'label' => ctrans('texts.method')];
@ -547,10 +555,11 @@ class HtmlEngine
$data['$payments'] = ['value' => '', 'label' => ctrans('texts.payments')];
if ($this->entity_string == 'invoice' && $this->entity->payments()->exists()) {
$payment_list = '<br><br>';
foreach ($this->entity->payments as $payment) {
$payment_list .= ctrans('texts.payment_subject').': '.$this->formatDate($payment->date, $this->client->date_format()).' :: '.Number::formatMoney($payment->amount, $this->client).' :: '.GatewayType::getAlias($payment->gateway_type_id).'<br>';
$payment_list .= ctrans('texts.payment_subject') . ": " . $this->formatDate($payment->date, $this->client->date_format()) . " :: " . Number::formatMoney($payment->amount, $this->client) ." :: ". GatewayType::getAlias($payment->gateway_type_id) . "<br>";
}
$data['$payments'] = ['value' => $payment_list, 'label' => ctrans('texts.payments')];
@ -637,26 +646,25 @@ class HtmlEngine
$country = Country::find($this->settings->country_id);
if ($country) {
return ctrans('texts.country_'.$country->name);
return ctrans('texts.country_' . $country->name);
}
return '&nbsp;';
}
private function getCountryCode() :string
{
$country = Country::find($this->settings->country_id);
if ($country) {
if($country)
return $country->iso_3166_2;
}
// if ($country) {
// return ctrans('texts.country_' . $country->iso_3166_2);
// }
return '&nbsp;';
}
/**
* Due to the way we are compiling the blade template we
* have no ability to iterate, so in the case
@ -829,8 +837,8 @@ html {
/**
* Generate markup for HTML images on entity.
*
* @return string|void
*
* @return string|void
*/
protected function generateEntityImagesMarkup()
{
@ -840,11 +848,11 @@ html {
$dom = new \DOMDocument('1.0', 'UTF-8');
$container = $dom->createElement('div');
$container = $dom->createElement('div');
$container->setAttribute('style', 'display:grid; grid-auto-flow: row; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr);');
foreach ($this->entity->documents as $document) {
if (! $document->isImage()) {
if (!$document->isImage()) {
continue;
}

View File

@ -90,8 +90,9 @@ trait ClientGroupSettingsSaver
unset($settings->translations);
}
//18-07-2022 removed || empty($settings->{$key}) from this check to allow "0" values to persist
foreach ($settings as $key => $value) {
if (! isset($settings->{$key}) || empty($settings->{$key}) || (! is_object($settings->{$key}) && strlen($settings->{$key}) == 0)) {
if (! isset($settings->{$key}) || (! is_object($settings->{$key}) && strlen($settings->{$key}) == 0)) {
unset($settings->{$key});
}
}

View File

@ -155,6 +155,7 @@ class VendorHtmlEngine
$data['$purchase_order.date'] = &$data['$date'];
$data['$purchase_order.po_number'] = &$data['$poNumber'];
$data['$purchase_order.due_date'] = &$data['$due_date'];
$data['$entity_issued_to'] = ['value' => '', 'label' => ctrans("texts.purchase_order_issued_to")];
$data['$portal_url'] = ['value' => $this->invitation->getPortalLink(), 'label' =>''];

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.4.10',
'app_tag' => '5.4.10',
'app_version' => '5.4.11',
'app_tag' => '5.4.11',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

View File

@ -4712,6 +4712,10 @@ $LANG = array(
'view_map' => 'View Map',
'set_default_design' => 'Set Default Design',
'add_gateway_help_message' => 'Add a payment gateway (ie. Stripe, WePay or PayPal) to accept online payments',
'purchase_order_issued_to' => 'Purchase Order issued to',
'archive_task_status' => 'Archive Task Status',
'delete_task_status' => 'Delete Task Status',
'restore_task_status' => 'Restore Task Status',
);
return $LANG;

2
public/css/app.css vendored

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/*! For license information please see payment.js.LICENSE.txt */
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplayTerms=e,this.shouldDisplaySignature=n,this.termsAccepted=!1,this.submitting=!1}var n,i,a;return n=t,(i=[{key:"handleMethodSelect",value:function(e){var t=this;document.getElementById("company_gateway_id").value=e.dataset.companyGatewayId,document.getElementById("payment_method_id").value=e.dataset.gatewayTypeId,this.shouldDisplaySignature&&!this.shouldDisplayTerms&&(this.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))),!this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.submitForm()}))),this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.termsAccepted=!0,t.submitForm()}))}))),this.shouldDisplaySignature||this.shouldDisplayTerms||this.submitForm()}},{key:"submitForm",value:function(){this.submitting=!0,document.getElementById("payment-form").submit()}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});this.signaturePad=e}},{key:"handle",value:function(){var e=this;document.querySelectorAll(".dropdown-gateway-button").forEach((function(t){t.addEventListener("click",(function(){e.submitting||e.handleMethodSelect(t)}))}))}}])&&e(n.prototype,i),a&&e(n,a),Object.defineProperty(n,"prototype",{writable:!1}),t}(),n=document.querySelector('meta[name="require-invoice-signature"]').content,i=document.querySelector('meta[name="show-invoice-terms"]').content;new t(Boolean(+n),Boolean(+i)).handle()})();
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplayTerms=e,this.shouldDisplaySignature=n,this.termsAccepted=!1,this.submitting=!1}var n,i,a;return n=t,(i=[{key:"handleMethodSelect",value:function(e){var t=this;document.getElementById("company_gateway_id").value=e.dataset.companyGatewayId,document.getElementById("payment_method_id").value=e.dataset.gatewayTypeId,this.shouldDisplaySignature&&!this.shouldDisplayTerms&&(this.signaturePad.isEmpty()&&alert("Please sign"),this.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))),!this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.submitForm()}))),this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.termsAccepted=!0,t.submitForm()}))}))),this.shouldDisplaySignature||this.shouldDisplayTerms||this.submitForm()}},{key:"submitForm",value:function(){this.submitting=!0,document.getElementById("payment-form").submit()}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});e.onEnd=function(){document.getElementById("signature-next-step").disabled=!1},this.signaturePad=e}},{key:"handle",value:function(){var e=this;document.getElementById("signature-next-step").disabled=!0,document.querySelectorAll(".dropdown-gateway-button").forEach((function(t){t.addEventListener("click",(function(){e.submitting||e.handleMethodSelect(t)}))}))}}])&&e(n.prototype,i),a&&e(n,a),Object.defineProperty(n,"prototype",{writable:!1}),t}(),n=document.querySelector('meta[name="require-invoice-signature"]').content,i=document.querySelector('meta[name="show-invoice-terms"]').content;new t(Boolean(+n),Boolean(+i)).handle()})();

View File

@ -1,81 +1,2 @@
/******/ (() => { // webpackBootstrap
var __webpack_exports__ = {};
/*!************************************************************!*\
!*** ./resources/js/clients/payments/forte-ach-payment.js ***!
\************************************************************/
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
var ForteAuthorizeACH = function ForteAuthorizeACH(apiLoginId) {
var _this = this;
_classCallCheck(this, ForteAuthorizeACH);
_defineProperty(this, "handleAuthorization", function () {
var account_number = document.getElementById('account-number').value;
var routing_number = document.getElementById('routing-number').value;
var data = {
api_login_id: _this.apiLoginId,
account_number: account_number,
routing_number: routing_number,
account_type: 'checking'
};
var payNowButton = document.getElementById('pay-now');
if (payNowButton) {
document.getElementById('pay-now').disabled = true;
document.querySelector('#pay-now > svg').classList.remove('hidden');
document.querySelector('#pay-now > span').classList.add('hidden');
} // console.log(data);
forte.createToken(data).success(_this.successResponseHandler).error(_this.failedResponseHandler);
return false;
});
_defineProperty(this, "successResponseHandler", function (response) {
document.getElementById('payment_token').value = response.onetime_token;
document.getElementById('server_response').submit();
return false;
});
_defineProperty(this, "failedResponseHandler", function (response) {
var errors = '<div class="alert alert-failure mb-4"><ul><li>' + response.response_description + '</li></ul></div>';
document.getElementById('forte_errors').innerHTML = errors;
document.getElementById('pay-now').disabled = false;
document.querySelector('#pay-now > svg').classList.add('hidden');
document.querySelector('#pay-now > span').classList.remove('hidden');
return false;
});
_defineProperty(this, "handle", function () {
var payNowButton = document.getElementById('pay-now');
if (payNowButton) {
payNowButton.addEventListener('click', function (e) {
_this.handleAuthorization();
});
}
return _this;
});
this.apiLoginId = apiLoginId;
};
var apiLoginId = document.querySelector('meta[name="forte-api-login-id"]').content;
/** @handle */
new ForteAuthorizeACH(apiLoginId).handle();
/******/ })()
;
/*! For license information please see forte-ach-payment.js.LICENSE.txt */
(()=>{function e(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function n(n,t,o){return t&&e(n.prototype,t),o&&e(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n}function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var o=n((function e(n){var o=this;!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),t(this,"handleAuthorization",(function(){var e=document.getElementById("account-number").value,n=document.getElementById("routing-number").value,t={api_login_id:o.apiLoginId,account_number:e,routing_number:n,account_type:"checking"};return document.getElementById("pay-now")&&(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden")),forte.createToken(t).success(o.successResponseHandler).error(o.failedResponseHandler),!1})),t(this,"successResponseHandler",(function(e){return document.getElementById("payment_token").value=e.onetime_token,document.getElementById("server_response").submit(),!1})),t(this,"failedResponseHandler",(function(e){var n='<div class="alert alert-failure mb-4"><ul><li>'+e.response_description+"</li></ul></div>";return document.getElementById("forte_errors").innerHTML=n,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden"),!1})),t(this,"handle",(function(){var e=document.getElementById("pay-now");return e&&e.addEventListener("click",(function(e){o.handleAuthorization()})),o})),this.apiLoginId=n}));new o(document.querySelector('meta[name="forte-api-login-id"]').content).handle()})();

View File

@ -1,82 +1,2 @@
/******/ (() => { // webpackBootstrap
var __webpack_exports__ = {};
/*!********************************************************************!*\
!*** ./resources/js/clients/payments/forte-credit-card-payment.js ***!
\********************************************************************/
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
var ForteAuthorizeCard = function ForteAuthorizeCard(apiLoginId) {
var _this = this;
_classCallCheck(this, ForteAuthorizeCard);
_defineProperty(this, "handleAuthorization", function () {
var myCard = $('#my-card');
var data = {
api_login_id: _this.apiLoginId,
card_number: myCard.CardJs('cardNumber').replace(/[^\d]/g, ''),
expire_year: myCard.CardJs('expiryYear').replace(/[^\d]/g, ''),
expire_month: myCard.CardJs('expiryMonth').replace(/[^\d]/g, ''),
cvv: document.getElementById('cvv').value.replace(/[^\d]/g, '')
};
var payNowButton = document.getElementById('pay-now');
if (payNowButton) {
document.getElementById('pay-now').disabled = true;
document.querySelector('#pay-now > svg').classList.remove('hidden');
document.querySelector('#pay-now > span').classList.add('hidden');
}
forte.createToken(data).success(_this.successResponseHandler).error(_this.failedResponseHandler);
return false;
});
_defineProperty(this, "successResponseHandler", function (response) {
document.getElementById('payment_token').value = response.onetime_token;
document.getElementById('card_brand').value = response.card_type;
document.getElementById('server_response').submit();
return false;
});
_defineProperty(this, "failedResponseHandler", function (response) {
var errors = '<div class="alert alert-failure mb-4"><ul><li>' + response.response_description + '</li></ul></div>';
document.getElementById('forte_errors').innerHTML = errors;
document.getElementById('pay-now').disabled = false;
document.querySelector('#pay-now > svg').classList.add('hidden');
document.querySelector('#pay-now > span').classList.remove('hidden');
return false;
});
_defineProperty(this, "handle", function () {
var payNowButton = document.getElementById('pay-now');
if (payNowButton) {
payNowButton.addEventListener('click', function (e) {
_this.handleAuthorization();
});
}
return _this;
});
this.apiLoginId = apiLoginId;
this.cardHolderName = document.getElementById('cardholder_name');
};
var apiLoginId = document.querySelector('meta[name="forte-api-login-id"]').content;
/** @handle */
new ForteAuthorizeCard(apiLoginId).handle();
/******/ })()
;
/*! For license information please see forte-credit-card-payment.js.LICENSE.txt */
(()=>{function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n}function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var r=n((function e(n){var r=this;!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),t(this,"handleAuthorization",(function(){var e=$("#my-card"),n={api_login_id:r.apiLoginId,card_number:e.CardJs("cardNumber").replace(/[^\d]/g,""),expire_year:e.CardJs("expiryYear").replace(/[^\d]/g,""),expire_month:e.CardJs("expiryMonth").replace(/[^\d]/g,""),cvv:document.getElementById("cvv").value.replace(/[^\d]/g,"")};return document.getElementById("pay-now")&&(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden")),forte.createToken(n).success(r.successResponseHandler).error(r.failedResponseHandler),!1})),t(this,"successResponseHandler",(function(e){return document.getElementById("payment_token").value=e.onetime_token,document.getElementById("card_brand").value=e.card_type,document.getElementById("server_response").submit(),!1})),t(this,"failedResponseHandler",(function(e){var n='<div class="alert alert-failure mb-4"><ul><li>'+e.response_description+"</li></ul></div>";return document.getElementById("forte_errors").innerHTML=n,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden"),!1})),t(this,"handle",(function(){var e=document.getElementById("pay-now");return e&&e.addEventListener("click",(function(e){r.handleAuthorization()})),r})),this.apiLoginId=n,this.cardHolderName=document.getElementById("cardholder_name")}));new r(document.querySelector('meta[name="forte-api-login-id"]').content).handle()})();

View File

@ -1,2 +1,2 @@
/*! For license information please see accept.js.LICENSE.txt */
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplaySignature=e,this.shouldDisplayTerms=n,this.termsAccepted=!1}var n,a,r;return n=t,(a=[{key:"submitForm",value:function(){document.getElementById("approve-form").submit()}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});this.signaturePad=e}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"handle",value:function(){var e=this;document.getElementById("approve-button").addEventListener("click",(function(){e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.termsAccepted=!0,e.submitForm()}))}))),e.shouldDisplaySignature&&!e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.submitForm()}))),!e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){e.termsAccepted=!0,e.submitForm()}))),e.shouldDisplaySignature||e.shouldDisplayTerms||e.submitForm()}))}}])&&e(n.prototype,a),r&&e(n,r),Object.defineProperty(n,"prototype",{writable:!1}),t}(),n=document.querySelector('meta[name="require-purchase_order-signature"]').content,a=document.querySelector('meta[name="show-purchase_order-terms"]').content;new t(Boolean(+n),Boolean(+a)).handle()})();
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplaySignature=e,this.shouldDisplayTerms=n,this.termsAccepted=!1}var n,a,r;return n=t,(a=[{key:"submitForm",value:function(){document.getElementById("approve-form").submit()}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});e.onEnd=function(){document.getElementById("signature-next-step").disabled=!1},this.signaturePad=e}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"handle",value:function(){var e=this;document.getElementById("signature-next-step").disabled=!0,document.getElementById("approve-button").addEventListener("click",(function(){e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.termsAccepted=!0,e.submitForm()}))}))),e.shouldDisplaySignature&&!e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.submitForm()}))),!e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){e.termsAccepted=!0,e.submitForm()}))),e.shouldDisplaySignature||e.shouldDisplayTerms||e.submitForm()}))}}])&&e(n.prototype,a),r&&e(n,r),Object.defineProperty(n,"prototype",{writable:!1}),t}(),n=document.querySelector('meta[name="require-purchase_order-signature"]').content,a=document.querySelector('meta[name="show-purchase_order-terms"]').content;new t(Boolean(+n),Boolean(+a)).handle()})();

View File

@ -1,2 +1,2 @@
/*! For license information please see approve.js.LICENSE.txt */
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplaySignature=e,this.shouldDisplayTerms=n,this.termsAccepted=!1}var n,a,r;return n=t,(a=[{key:"submitForm",value:function(){document.getElementById("approve-form").submit()}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});this.signaturePad=e}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"handle",value:function(){var e=this;document.getElementById("approve-button").addEventListener("click",(function(){e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.termsAccepted=!0,e.submitForm()}))}))),e.shouldDisplaySignature&&!e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.submitForm()}))),!e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){e.termsAccepted=!0,e.submitForm()}))),e.shouldDisplaySignature||e.shouldDisplayTerms||e.submitForm()}))}}])&&e(n.prototype,a),r&&e(n,r),Object.defineProperty(n,"prototype",{writable:!1}),t}(),n=document.querySelector('meta[name="require-quote-signature"]').content,a=document.querySelector('meta[name="show-quote-terms"]').content;new t(Boolean(+n),Boolean(+a)).handle()})();
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplaySignature=e,this.shouldDisplayTerms=n,this.termsAccepted=!1}var n,a,u;return n=t,(a=[{key:"submitForm",value:function(){document.getElementById("approve-form").submit()}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});e.onEnd=function(){document.getElementById("signature-next-step").disabled=!1},this.signaturePad=e}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"handle",value:function(){var e=this;document.getElementById("signature-next-step").disabled=!0,document.getElementById("close_button").addEventListener("click",(function(){var e=document.getElementById("approve-button");e&&(e.disabled=!1)})),document.getElementById("approve-button").addEventListener("click",(function(){e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.termsAccepted=!0,e.submitForm()}))}))),e.shouldDisplaySignature&&!e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.submitForm()}))),!e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){e.termsAccepted=!0,e.submitForm()}))),e.shouldDisplaySignature||e.shouldDisplayTerms||e.submitForm()}))}}])&&e(n.prototype,a),u&&e(n,u),Object.defineProperty(n,"prototype",{writable:!1}),t}(),n=document.querySelector('meta[name="require-quote-signature"]').content,a=document.querySelector('meta[name="show-quote-terms"]').content;new t(Boolean(+n),Boolean(+a)).handle()})();

View File

@ -2,16 +2,18 @@
"/js/app.js": "/js/app.js?id=384185bf9d293949134d09b890c81369",
"/js/clients/payment_methods/authorize-authorize-card.js": "/js/clients/payment_methods/authorize-authorize-card.js?id=9fb77e87fe0f85a367050e08f79ec9df",
"/js/clients/payments/authorize-credit-card-payment.js": "/js/clients/payments/authorize-credit-card-payment.js?id=803182f668c39d631ca5c55437876da4",
"/js/clients/payments/forte-credit-card-payment.js": "/js/clients/payments/forte-credit-card-payment.js?id=6e9f466c5504d3753f9b4ffc6f947095",
"/js/clients/payments/forte-ach-payment.js": "/js/clients/payments/forte-ach-payment.js?id=1d10fcc52a1f15858e5da216f1df45ec",
"/js/clients/payments/stripe-ach.js": "/js/clients/payments/stripe-ach.js?id=7bed15f51bca764378d9a3aa605b8664",
"/js/clients/invoices/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=d4f86ddee4e8a1d6e9719010aa0fe62b",
"/js/clients/purchase_orders/action-selectors.js": "/js/clients/purchase_orders/action-selectors.js?id=160b8161599fc2429b449b0970d3ba6c",
"/js/clients/purchase_orders/accept.js": "/js/clients/purchase_orders/accept.js?id=2b5fed3ae34a6fd4db171a77ba72496e",
"/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=b88ad7c8881cc87df07b129c5a7c76df",
"/js/clients/purchase_orders/accept.js": "/js/clients/purchase_orders/accept.js?id=ddd4aa4069ea79411eeec367b7d5986d",
"/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=ada766ace95b727ecdbb6d3a09bf5a8e",
"/js/clients/payments/stripe-sofort.js": "/js/clients/payments/stripe-sofort.js?id=1c5493a4c53a5b862d07ee1818179ea9",
"/js/clients/payments/stripe-alipay.js": "/js/clients/payments/stripe-alipay.js?id=0274ab4f8d2b411f2a2fe5142301e7af",
"/js/clients/payments/checkout-credit-card.js": "/js/clients/payments/checkout-credit-card.js?id=4bd34a0b160f6f29b3096d870ac4d308",
"/js/clients/quotes/action-selectors.js": "/js/clients/quotes/action-selectors.js?id=6fb63bae43d077b5061f4dadfe8dffc8",
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=02d55a65841106a2e9309468c83879a9",
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=cdc76607aaf0b47a5a4e554e4177713d",
"/js/clients/payments/stripe-credit-card.js": "/js/clients/payments/stripe-credit-card.js?id=62871ea440059c401bdc9458a41cfa3f",
"/js/setup/setup.js": "/js/setup/setup.js?id=87367cce4927b42a92defdbae7a64711",
"/js/clients/payments/card-js.min.js": "/js/clients/payments/card-js.min.js?id=8ce33c3deae058ad314fb8357e5be63b",
@ -40,7 +42,7 @@
"/js/clients/payments/stripe-przelewy24.js": "/js/clients/payments/stripe-przelewy24.js?id=3d53d2f7d0291d9f92cf7414dd2d351c",
"/js/clients/payments/stripe-browserpay.js": "/js/clients/payments/stripe-browserpay.js?id=db71055862995fd6ae21becfc587a3de",
"/js/clients/payments/stripe-fpx.js": "/js/clients/payments/stripe-fpx.js?id=914a6846ad1e5584635e7430fef76875",
"/css/app.css": "/css/app.css?id=6419fb85c22d562d4ec14800980801e7",
"/css/app.css": "/css/app.css?id=9cae1171423003d13f5880afe40d3ede",
"/css/card-js.min.css": "/css/card-js.min.css?id=62afeb675235451543ada60afcedcb7c",
"/vendor/clipboard.min.js": "/vendor/clipboard.min.js?id=15f52a1ee547f2bdd46e56747332ca2d"
}

View File

@ -17,12 +17,17 @@ class Payment {
}
handleMethodSelect(element) {
document.getElementById("company_gateway_id").value =
element.dataset.companyGatewayId;
document.getElementById("payment_method_id").value =
element.dataset.gatewayTypeId;
if (this.shouldDisplaySignature && !this.shouldDisplayTerms) {
if(this.signaturePad.isEmpty())
alert("Please sign");
this.displayTerms();
document
@ -91,10 +96,16 @@ class Payment {
}
);
signaturePad.onEnd = function(){
document.getElementById("signature-next-step").disabled = false;
};
this.signaturePad = signaturePad;
}
handle() {
document.getElementById("signature-next-step").disabled = true;
document
.querySelectorAll(".dropdown-gateway-button")
.forEach(element => {

View File

@ -32,6 +32,10 @@ class Accept {
}
);
signaturePad.onEnd = function(){
document.getElementById("signature-next-step").disabled = false;
};
this.signaturePad = signaturePad;
}
@ -41,6 +45,9 @@ class Accept {
}
handle() {
document.getElementById("signature-next-step").disabled = true;
document
.getElementById('approve-button')
.addEventListener('click', () => {

View File

@ -32,6 +32,11 @@ class Approve {
}
);
signaturePad.onEnd = function(){
document.getElementById("signature-next-step").disabled = false;
};
this.signaturePad = signaturePad;
}
@ -41,6 +46,16 @@ class Approve {
}
handle() {
document.getElementById("signature-next-step").disabled = true;
document.getElementById("close_button").addEventListener('click', () => {
const approveButton = document.getElementById("approve-button");
if(approveButton)
approveButton.disabled = false;
});
document
.getElementById('approve-button')
.addEventListener('click', () => {

View File

@ -42,45 +42,49 @@
</div>
@endforeach
@if($entity->expense && $entity->expense->invoice_documents)
@foreach ($entity->expense->documents as $document)
<div class="inline-flex items-center space-x-1">
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
@if($entity instanceof App\Models\Invoice)
@foreach ($entity->expense_documents() as $expense)
@foreach($expense->documents as $document)
<div class="inline-flex items-center space-x-1">
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="text-primary h-6 w-4">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
<polyline points="15 3 21 3 21 9"></polyline>
<line x1="10" y1="14" x2="21" y2="3"></line>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="text-primary h-6 w-4">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
<polyline points="15 3 21 3 21 9"></polyline>
<line x1="10" y1="14" x2="21" y2="3"></line>
</svg>
@if (!$loop->last)
<span>&mdash;</span>
@endif
</div>
@if (!$loop->last)
<span>&mdash;</span>
@endif
</div>
@endforeach
@endforeach
@endif
@if($entity->task && $entity->company->invoice_task_documents)
@foreach ($entity->task->documents as $document)
<div class="inline-flex items-center space-x-1">
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
@if($entity instanceof App\Models\Invoice)
@foreach ($entity->task_documents() as $task)
@foreach($task->documents as $document)
<div class="inline-flex items-center space-x-1">
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="text-primary h-6 w-4">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
<polyline points="15 3 21 3 21 9"></polyline>
<line x1="10" y1="14" x2="21" y2="3"></line>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="text-primary h-6 w-4">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
<polyline points="15 3 21 3 21 9"></polyline>
<line x1="10" y1="14" x2="21" y2="3"></line>
</svg>
@if (!$loop->last)
<span>&mdash;</span>
@endif
</div>
@if (!$loop->last)
<span>&mdash;</span>
@endif
</div>
@endforeach
@endforeach
@endif
</div>

View File

@ -28,7 +28,7 @@
</button>
</div>
<div class="mt-3 flex w-full rounded-md shadow-sm sm:mt-0 sm:w-auto">
<button onclick="document.getElementById('displaySignatureModal').style.display = 'none'; setTimeout(() => this.disabled = true, 0); setTimeout(() => this.disabled = false, 5000); return true;" type="button" class="button button-secondary">
<button id="close_button" onclick="document.getElementById('displaySignatureModal').style.display = 'none'; return true;" type="button" class="button button-secondary">
{{ ctrans('texts.close') }}
</button>
</div>