mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Show credit payment amounts in the client portal
This commit is contained in:
parent
d43e915dfb
commit
e0170dbecf
@ -1 +1 @@
|
||||
5.5.56
|
||||
5.5.57
|
@ -108,17 +108,17 @@ class ClientFilters extends QueryFilters
|
||||
}
|
||||
|
||||
return $this->builder->where(function ($query) use ($filter) {
|
||||
$query->where('clients.name', 'like', '%'.$filter.'%')
|
||||
->orWhere('clients.id_number', 'like', '%'.$filter.'%')
|
||||
$query->where('name', 'like', '%'.$filter.'%')
|
||||
->orWhere('id_number', 'like', '%'.$filter.'%')
|
||||
->orWhereHas('contacts', function ($query) use ($filter) {
|
||||
$query->where('first_name', 'like', '%'.$filter.'%');
|
||||
$query->orWhere('last_name', 'like', '%'.$filter.'%');
|
||||
$query->orWhere('email', 'like', '%'.$filter.'%');
|
||||
})
|
||||
->orWhere('clients.custom_value1', 'like', '%'.$filter.'%')
|
||||
->orWhere('clients.custom_value2', 'like', '%'.$filter.'%')
|
||||
->orWhere('clients.custom_value3', 'like', '%'.$filter.'%')
|
||||
->orWhere('clients.custom_value4', 'like', '%'.$filter.'%');
|
||||
->orWhere('custom_value1', 'like', '%'.$filter.'%')
|
||||
->orWhere('custom_value2', 'like', '%'.$filter.'%')
|
||||
->orWhere('custom_value3', 'like', '%'.$filter.'%')
|
||||
->orWhere('custom_value4', 'like', '%'.$filter.'%');
|
||||
});
|
||||
}
|
||||
|
||||
@ -147,4 +147,14 @@ class ClientFilters extends QueryFilters
|
||||
{
|
||||
return $this->builder->company();
|
||||
}
|
||||
|
||||
public function filter_details(string $filter = '')
|
||||
{
|
||||
|
||||
if($filter == 'true')
|
||||
return $this->builder->select('id', 'name', 'number', 'id_number');
|
||||
|
||||
return $this->builder;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class PaymentsTable extends Component
|
||||
public function render()
|
||||
{
|
||||
$query = Payment::query()
|
||||
->with('type', 'client')
|
||||
->with('type', 'client', 'invoices')
|
||||
->where('company_id', $this->company->id)
|
||||
->where('client_id', auth()->guard('contact')->user()->client_id)
|
||||
->whereIn('status_id', [Payment::STATUS_FAILED, Payment::STATUS_COMPLETED, Payment::STATUS_PENDING, Payment::STATUS_REFUNDED, Payment::STATUS_PARTIALLY_REFUNDED])
|
||||
|
@ -78,8 +78,6 @@ class StoreShopClientRequest extends Request
|
||||
|
||||
$input = $this->all();
|
||||
|
||||
//@todo implement feature permissions for > 100 clients
|
||||
//
|
||||
$settings = ClientSettings::defaults();
|
||||
|
||||
if (array_key_exists('settings', $input) && ! empty($input['settings'])) {
|
||||
|
@ -63,8 +63,6 @@ class StoreUserRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
//unique user rule - check company_user table for user_id / company_id / account_id if none exist we can add the user. ELSE return false
|
||||
|
||||
if (array_key_exists('email', $input)) {
|
||||
$input['email'] = trim($input['email']);
|
||||
}
|
||||
@ -79,12 +77,10 @@ class StoreUserRequest extends Request
|
||||
}
|
||||
|
||||
if (! isset($input['company_user']['settings'])) {
|
||||
//$input['company_user']['settings'] = DefaultSettings::userSettings();
|
||||
$input['company_user']['settings'] = null;
|
||||
}
|
||||
} else {
|
||||
$input['company_user'] = [
|
||||
//'settings' => DefaultSettings::userSettings(),
|
||||
'settings' => null,
|
||||
'permissions' => '',
|
||||
];
|
||||
|
@ -56,12 +56,5 @@ class InvoiceWorkflowSettings implements ShouldQueue
|
||||
/* Throws: Payment amount xxx does not match invoice totals. */
|
||||
$this->base_repository->archive($this->invoice);
|
||||
}
|
||||
|
||||
//@TODO this setting should only fire for recurring invoices
|
||||
// if ($this->client->getSetting('auto_email_invoice')) {
|
||||
// $this->invoice->invitations->each(function ($invitation, $key) {
|
||||
// $this->invoice->service()->sendEmail($invitation->contact);
|
||||
// });
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -212,6 +212,11 @@ class Payment extends BaseModel
|
||||
return Number::formatMoney($this->amount, $this->client);
|
||||
}
|
||||
|
||||
public function formatAmount(float $amount): string
|
||||
{
|
||||
return Number::formatMoney($amount, $this->client);
|
||||
}
|
||||
|
||||
public function clientPaymentDate()
|
||||
{
|
||||
if (! $this->date) {
|
||||
|
@ -43,4 +43,5 @@ class Paymentable extends Pivot
|
||||
{
|
||||
return $this->belongsTo(Payment::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ class ClientPresenter extends EntityPresenter
|
||||
return $this->entity->name;
|
||||
}
|
||||
|
||||
//$contact = $this->entity->primary_contact->first();
|
||||
$contact = $this->entity->contacts->whereNotNull('email')->first();
|
||||
|
||||
$contact_name = 'No Contact Set';
|
||||
|
@ -370,11 +370,6 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
(is_int(stripos($this->token()->cu->permissions, $all_permission))) ||
|
||||
(is_int(stripos($this->token()->cu->permissions, $permission)));
|
||||
|
||||
//23-03-2021 - stripos return an int if true and bool false, but 0 is also interpreted as false, so we simply use is_int() to verify state
|
||||
// return $this->isOwner() ||
|
||||
// $this->isAdmin() ||
|
||||
// (stripos($this->company_user->permissions, $all_permission) !== false) ||
|
||||
// (stripos($this->company_user->permissions, $permission) !== false);
|
||||
}
|
||||
|
||||
public function documents()
|
||||
|
@ -52,7 +52,6 @@ class ClientRepository extends BaseRepository
|
||||
* @return Client|Client|null Client Object
|
||||
*
|
||||
* @throws \Laracasts\Presenter\Exceptions\PresenterException
|
||||
* @todo Write tests to make sure that custom client numbers work as expected.
|
||||
*/
|
||||
public function save(array $data, Client $client) : ?Client
|
||||
{
|
||||
|
@ -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.5.56',
|
||||
'app_tag' => '5.5.56',
|
||||
'app_version' => '5.5.57',
|
||||
'app_tag' => '5.5.57',
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', ''),
|
||||
|
@ -60,7 +60,7 @@
|
||||
{{ $payment->translatedType() }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||
{!! \App\Utils\Number::formatMoney($payment->amount, $payment->client) !!}
|
||||
{!! \App\Utils\Number::formatMoney($payment->amount > 0 ? $payment->amount : $payment->credits->sum('pivot.amount'), $payment->client) !!}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
|
||||
{{ \Illuminate\Support\Str::limit($payment->transaction_reference, 35) }}
|
||||
|
@ -66,7 +66,7 @@
|
||||
{{ ctrans('texts.amount') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $payment->formattedAmount() }}
|
||||
{{ $payment->formatAmount($payment->amount > 0 ? $payment->amount : $payment?->invoices->sum('pivot.amount')) }}
|
||||
</dd>
|
||||
</div>
|
||||
@endif
|
||||
@ -116,6 +116,7 @@
|
||||
href="{{ route('client.invoice.show', ['invoice' => $invoice->hashed_id])}}">
|
||||
{{ $invoice->number }}
|
||||
</a>
|
||||
- {{ \App\Utils\Number::formatMoney($payment->invoices->where('id', $invoice->id)->sum('pivot.amount') - $payment->invoices->where('id', $invoice->id)->sum('pivot.refunded'), $payment->client) }}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
Loading…
x
Reference in New Issue
Block a user