mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 05:27:33 -05:00 
			
		
		
		
	Change Pre Payments to be always available as recurring
This commit is contained in:
		
							parent
							
								
									d451bfcb0a
								
							
						
					
					
						commit
						6e6019feaf
					
				@ -471,12 +471,12 @@ class CompanySettings extends BaseSettings
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public $client_initiated_payments_minimum = 0;
 | 
					    public $client_initiated_payments_minimum = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public $client_initiated_payments_recurring = false;
 | 
					    // public $client_initiated_payments_recurring = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public $sync_invoice_quote_columns = true;
 | 
					    public $sync_invoice_quote_columns = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static $casts = [
 | 
					    public static $casts = [
 | 
				
			||||||
        'client_initiated_payments_recurring'=> 'bool',
 | 
					        // 'client_initiated_payments_recurring'=> 'bool',
 | 
				
			||||||
        'client_initiated_payments'          => 'bool',
 | 
					        'client_initiated_payments'          => 'bool',
 | 
				
			||||||
        'client_initiated_payments_minimum'  => 'float',
 | 
					        'client_initiated_payments_minimum'  => 'float',
 | 
				
			||||||
        'sync_invoice_quote_columns'         => 'bool',
 | 
					        'sync_invoice_quote_columns'         => 'bool',
 | 
				
			||||||
 | 
				
			|||||||
@ -34,6 +34,8 @@ class InvoiceItemExport extends BaseExport
 | 
				
			|||||||
        'amount' => 'amount',
 | 
					        'amount' => 'amount',
 | 
				
			||||||
        'balance' => 'balance',
 | 
					        'balance' => 'balance',
 | 
				
			||||||
        'client' => 'client_id',
 | 
					        'client' => 'client_id',
 | 
				
			||||||
 | 
					        'client_number' => 'client.number',
 | 
				
			||||||
 | 
					        'client_id_number' => 'client.id_number',
 | 
				
			||||||
        'custom_surcharge1' => 'custom_surcharge1',
 | 
					        'custom_surcharge1' => 'custom_surcharge1',
 | 
				
			||||||
        'custom_surcharge2' => 'custom_surcharge2',
 | 
					        'custom_surcharge2' => 'custom_surcharge2',
 | 
				
			||||||
        'custom_surcharge3' => 'custom_surcharge3',
 | 
					        'custom_surcharge3' => 'custom_surcharge3',
 | 
				
			||||||
@ -198,6 +200,8 @@ class InvoiceItemExport extends BaseExport
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // if(in_array('client_id', $this->input['report_keys']))
 | 
					        // if(in_array('client_id', $this->input['report_keys']))
 | 
				
			||||||
        $entity['client'] = $invoice->client->present()->name();
 | 
					        $entity['client'] = $invoice->client->present()->name();
 | 
				
			||||||
 | 
					        $entity['client_id_number'] = $invoice->client->id_number;
 | 
				
			||||||
 | 
					        $entity['client_number'] = $invoice->client->number;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // if(in_array('status_id', $this->input['report_keys']))
 | 
					        // if(in_array('status_id', $this->input['report_keys']))
 | 
				
			||||||
        $entity['status'] = $invoice->stringStatus($invoice->status_id);
 | 
					        $entity['status'] = $invoice->stringStatus($invoice->status_id);
 | 
				
			||||||
 | 
				
			|||||||
@ -40,8 +40,8 @@ class PrePaymentController extends Controller
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $data = [
 | 
					        $data = [
 | 
				
			||||||
            'title' => ctrans('texts.amount'). " " .auth()->guard('contact')->user()->client->currency()->code." (".auth()->guard('contact')->user()->client->currency()->symbol . ")",
 | 
					            'title' => ctrans('texts.amount'). " " .auth()->guard('contact')->user()->client->currency()->code." (".auth()->guard('contact')->user()->client->currency()->symbol . ")",
 | 
				
			||||||
            'allows_recurring' => auth()->guard('contact')->user()->client->getSetting('client_initiated_payments_recurring'),
 | 
					            // 'allows_recurring' => auth()->guard('contact')->user()->client->getSetting('client_initiated_payments_recurring'),
 | 
				
			||||||
            'allows_recurring' => true,
 | 
					            // 'allows_recurring' => true,
 | 
				
			||||||
            'minimum_amount' => auth()->guard('contact')->user()->client->getSetting('client_initiated_payments_minimum'),
 | 
					            'minimum_amount' => auth()->guard('contact')->user()->client->getSetting('client_initiated_payments_minimum'),
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -138,9 +138,9 @@ class PortalComposer
 | 
				
			|||||||
            $data[] = ['title' => ctrans('texts.subscriptions'), 'url' => 'client.subscriptions.index', 'icon' => 'calendar'];
 | 
					            $data[] = ['title' => ctrans('texts.subscriptions'), 'url' => 'client.subscriptions.index', 'icon' => 'calendar'];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // if (property_exists($this->settings, 'client_initiated_payments') && $this->settings->client_initiated_payments) {
 | 
					        if (auth()->guard('contact')->user()->client->getSetting('client_initiated_payments')) {
 | 
				
			||||||
            $data[] = ['title' => ctrans('texts.pre_payment'), 'url' => 'client.pre_payments.index', 'icon' => 'dollar-sign'];
 | 
					            $data[] = ['title' => ctrans('texts.pre_payment'), 'url' => 'client.pre_payments.index', 'icon' => 'dollar-sign'];
 | 
				
			||||||
        // }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        return $data;
 | 
					        return $data;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -44,7 +44,7 @@
 | 
				
			|||||||
                        min="{{ $minimum_amount }}"/>
 | 
					                        min="{{ $minimum_amount }}"/>
 | 
				
			||||||
                        
 | 
					                        
 | 
				
			||||||
                        @if($minimum_amount > 0) 
 | 
					                        @if($minimum_amount > 0) 
 | 
				
			||||||
                        <p>{{ ctrans('texts.minimum_required_payment', ['amount' => $minimum_amount])}}</p>
 | 
					                        <p class="text-gray-900">{{ ctrans('texts.minimum_required_payment', ['amount' => $minimum_amount])}}</p>
 | 
				
			||||||
                        @endif
 | 
					                        @endif
 | 
				
			||||||
                        
 | 
					                        
 | 
				
			||||||
                        @if($errors->has('amount'))
 | 
					                        @if($errors->has('amount'))
 | 
				
			||||||
@ -53,24 +53,18 @@
 | 
				
			|||||||
                        
 | 
					                        
 | 
				
			||||||
                    @endcomponent
 | 
					                    @endcomponent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    @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
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                        <div x-cloak x-show="show">
 | 
					 | 
				
			||||||
                    @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.number_of_payments')])
 | 
					                    @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">
 | 
					                        <select name="remaining_cycles" class="form-select input w-full bg-white">
 | 
				
			||||||
                                    <option value="-1" selected>{{ ctrans('texts.pre_payment_indefinitely')}}</option>
 | 
					                            <option value="-1">{{ ctrans('texts.pre_payment_indefinitely')}}</option>
 | 
				
			||||||
                            @for($i = 1; $i < 60; $i++)
 | 
					                            @for($i = 1; $i < 60; $i++)
 | 
				
			||||||
                                    <option value={{$i}}>{{$i}}</option>
 | 
					                            <option value={{$i}} @if($i == 1) selected @endif>{{$i}}</option>
 | 
				
			||||||
                            @endfor
 | 
					                            @endfor
 | 
				
			||||||
                        </select>
 | 
					                        </select>
 | 
				
			||||||
                        <span class="py-2">
 | 
					                        <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>
 | 
					                        <label for="remaining_cycles" class="col-form-label text-center col-lg-3 text-gray-900">{{ ctrans ('texts.number_of_payments_helper')}}</label>
 | 
				
			||||||
                        </span>
 | 
					                        </span>
 | 
				
			||||||
                    @endcomponent
 | 
					                    @endcomponent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.frequency')])
 | 
					                    @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.frequency')])
 | 
				
			||||||
                        <select name="frequency_id" class="form-select input w-full bg-white">
 | 
					                        <select name="frequency_id" class="form-select input w-full bg-white">
 | 
				
			||||||
                            <option value="1">{{ ctrans('texts.freq_daily') }}</option>
 | 
					                            <option value="1">{{ ctrans('texts.freq_daily') }}</option>
 | 
				
			||||||
@ -87,11 +81,6 @@
 | 
				
			|||||||
                            <option value="12">{{ ctrans('texts.freq_three_years') }}</option>
 | 
					                            <option value="12">{{ ctrans('texts.freq_three_years') }}</option>
 | 
				
			||||||
                        </select>
 | 
					                        </select>
 | 
				
			||||||
                    @endcomponent
 | 
					                    @endcomponent
 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    </div>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    @endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    <div class="px-4 py-3 bg-gray-50 text-right sm:px-6" x-data="{ buttonDisabled: false }">
 | 
					                    <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>
 | 
					                        <button class="button button-primary bg-primary"x-on:click="buttonDisabled = true" x-bind:disabled="buttonDisabled">{{ ctrans('texts.pay_now') }}</button>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user