Subscription table view client portal

This commit is contained in:
David Bomba 2023-03-22 12:36:28 +11:00
parent 0e80303033
commit 67a7f823e2
5 changed files with 64 additions and 40 deletions

View File

@ -505,7 +505,6 @@ class CompanySettings extends BaseSettings
'purchase_order_design_id' => 'string',
'purchase_order_footer' => 'string',
'purchase_order_number_pattern' => 'string',
'purchase_order_number_counter' => 'int',
'page_numbering_alignment' => 'string',
'page_numbering' => 'bool',
'auto_archive_invoice_cancelled' => 'bool',
@ -537,7 +536,6 @@ class CompanySettings extends BaseSettings
'reminder_send_time' => 'int',
'email_sending_method' => 'string',
'gmail_sending_user_id' => 'string',
'currency_id' => 'string',
'counter_number_applied' => 'string',
'quote_number_applied' => 'string',
'email_subject_custom1' => 'string',

View File

@ -38,11 +38,16 @@ class PrePaymentController extends Controller
*/
public function index()
{
$client = auth()->guard('contact')->user()->client;
$minimum = $client->getSetting('client_initiated_payments_minimum');
$minimum_amount = $minimum == 0 ? "" : Number::formatMoney($minimum, $client);
$data = [
'title' => ctrans('texts.amount'). " " .auth()->guard('contact')->user()->client->currency()->code." (".auth()->guard('contact')->user()->client->currency()->symbol . ")",
'title' => ctrans('texts.amount'). " " .$client->currency()->code." (".auth()->guard('contact')->user()->client->currency()->symbol . ")",
// 'allows_recurring' => auth()->guard('contact')->user()->client->getSetting('client_initiated_payments_recurring'),
// 'allows_recurring' => true,
'minimum_amount' => auth()->guard('contact')->user()->client->getSetting('client_initiated_payments_minimum'),
'allows_recurring' => true,
'minimum' => $minimum,
'minimum_amount' => $minimum_amount,
];
return $this->render('pre_payments.index', $data);

View File

@ -26,7 +26,17 @@ class StorePrePaymentRequest extends FormRequest
{
return [
'notes' => 'required|bail|',
'amount' => 'required|bail|',
'amount' => 'required|bail|gte:minimum_amount',
'minimum_amount' => '',
];
}
public function prepareForValidation()
{
$input = $this->all();
$this->replace($input);
}
}

View File

@ -132,11 +132,11 @@ class PortalComposer
$data[] = ['title' => ctrans('texts.statement'), 'url' => 'client.statement', 'icon' => 'activity'];
if (Ninja::isHosted() && auth()->guard('contact')->user()->company->id == config('ninja.ninja_default_company_id')) {
$data[] = ['title' => ctrans('texts.plan'), 'url' => 'client.plan', 'icon' => 'credit-card'];
} else {
// if (Ninja::isHosted() && auth()->guard('contact')->user()->company->id == config('ninja.ninja_default_company_id')) {
// $data[] = ['title' => ctrans('texts.plan'), 'url' => 'client.plan', 'icon' => 'credit-card'];
// } else {
$data[] = ['title' => ctrans('texts.subscriptions'), 'url' => 'client.subscriptions.index', 'icon' => 'calendar'];
}
// }
if (auth()->guard('contact')->user()->client->getSetting('client_initiated_payments')) {
$data[] = ['title' => ctrans('texts.pre_payment'), 'url' => 'client.pre_payments.index', 'icon' => 'dollar-sign'];

View File

@ -34,17 +34,17 @@
@endif
@endcomponent
<input type="hidden" name="minimum_amount" value="{{ $minimum }}">
@component('portal.ninja2020.components.general.card-element', ['title' => $title])
<input
type="text"
class="input mt-0 mr-4 relative"
name="amount"
placeholder=""
min="{{ $minimum_amount }}"/>
placeholder=""/>
@if($minimum_amount > 0)
<p class="text-gray-900">{{ ctrans('texts.minimum_required_payment', ['amount' => $minimum_amount])}}</p>
@if($minimum > 0)
<p>{{ ctrans('texts.minimum_required_payment', ['amount' => $minimum_amount])}}</p>
@endif
@if($errors->has('amount'))
@ -53,34 +53,45 @@
@endcomponent
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.number_of_payments')])
<select name="remaining_cycles" class="form-select input w-full bg-white">
<option value="-1">{{ ctrans('texts.pre_payment_indefinitely')}}</option>
@for($i = 1; $i < 60; $i++)
<option value={{$i}} @if($i == 1) selected @endif>{{$i}}</option>
@endfor
</select>
<span class="py-2">
<label for="remaining_cycles" class="col-form-label text-center col-lg-3 text-gray-900">{{ ctrans ('texts.number_of_payments_helper')}}</label>
</span>
@if($allows_recurring)
<div x-data="{ show: false }">
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.enable_recurring')])
<input x-on:click="show = !show" id="is_recurring" aria-describedby="recurring-description" name="is_recurring" type="checkbox" class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600">
@endcomponent
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.frequency')])
<select name="frequency_id" class="form-select input w-full bg-white">
<option value="1">{{ ctrans('texts.freq_daily') }}</option>
<option value="2">{{ ctrans('texts.freq_weekly') }}</option>
<option value="3">{{ ctrans('texts.freq_two_weeks') }}</option>
<option value="4">{{ ctrans('texts.freq_four_weeks') }}</option>
<option value="5" selected>{{ ctrans('texts.freq_monthly') }}</option>
<option value="6">{{ ctrans('texts.freq_two_months') }}</option>
<option value="7">{{ ctrans('texts.freq_three_months') }}</option>
<option value="8">{{ ctrans('texts.freq_four_months') }}</option>
<option value="9">{{ ctrans('texts.freq_six_months') }}</option>
<option value="10">{{ ctrans('texts.freq_annually') }}</option>
<option value="11">{{ ctrans('texts.freq_two_years') }}</option>
<option value="12">{{ ctrans('texts.freq_three_years') }}</option>
</select>
@endcomponent
<div x-cloak x-show="show">
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.number_of_payments')])
<select name="remaining_cycles" class="form-select input w-full bg-white">
<option value="-1">{{ ctrans('texts.pre_payment_indefinitely')}}</option>
@for($i = 1; $i < 60; $i++)
<option value={{$i}} @if($i == 1) selected @endif>{{$i}}</option>
@endfor
</select>
<span class="py-2">
<label for="remaining_cycles" class="col-form-label text-center col-lg-3 text-gray-900">{{ ctrans ('texts.number_of_payments_helper')}}</label>
</span>
@endcomponent
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.frequency')])
<select name="frequency_id" class="form-select input w-full bg-white">
<option value="1">{{ ctrans('texts.freq_daily') }}</option>
<option value="2">{{ ctrans('texts.freq_weekly') }}</option>
<option value="3">{{ ctrans('texts.freq_two_weeks') }}</option>
<option value="4">{{ ctrans('texts.freq_four_weeks') }}</option>
<option value="5" selected>{{ ctrans('texts.freq_monthly') }}</option>
<option value="6">{{ ctrans('texts.freq_two_months') }}</option>
<option value="7">{{ ctrans('texts.freq_three_months') }}</option>
<option value="8">{{ ctrans('texts.freq_four_months') }}</option>
<option value="9">{{ ctrans('texts.freq_six_months') }}</option>
<option value="10">{{ ctrans('texts.freq_annually') }}</option>
<option value="11">{{ ctrans('texts.freq_two_years') }}</option>
<option value="12">{{ ctrans('texts.freq_three_years') }}</option>
</select>
@endcomponent
</div>
</div>
@endif
<div class="px-4 py-3 bg-gray-50 text-right sm:px-6" x-data="{ buttonDisabled: false }">
<button class="button button-primary bg-primary"x-on:click="buttonDisabled = true" x-bind:disabled="buttonDisabled">{{ ctrans('texts.pay_now') }}</button>