1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Support updating plan price

This commit is contained in:
Hillel Coren 2017-05-08 11:18:35 +03:00
parent f25cbbc6ea
commit 65b7556070
5 changed files with 17 additions and 7 deletions

View File

@ -21,6 +21,18 @@ class Company extends Eloquent
*/ */
protected $presenter = 'App\Ninja\Presenters\CompanyPresenter'; protected $presenter = 'App\Ninja\Presenters\CompanyPresenter';
/**
* @var array
*/
protected $fillable = [
'plan',
'plan_term',
'plan_price',
'plan_paid',
'plan_started',
'plan_expires',
];
/** /**
* @var array * @var array
*/ */

View File

@ -15,12 +15,7 @@ class NinjaRepository
} }
$company = $account->company; $company = $account->company;
$company->plan = ! empty($data['plan']) && $data['plan'] != PLAN_FREE ? $data['plan'] : null; $company->fill($data);
$company->plan_term = ! empty($data['plan_term']) ? $data['plan_term'] : null;
$company->plan_paid = ! empty($data['plan_paid']) ? $data['plan_paid'] : null;
$company->plan_started = ! empty($data['plan_started']) ? $data['plan_started'] : null;
$company->plan_expires = ! empty($data['plan_expires']) ? $data['plan_expires'] : null;
$company->save(); $company->save();
} }
} }

View File

@ -2492,6 +2492,7 @@ $LANG = array(
'add_documents_to_invoice' => 'Add documents to invoice', 'add_documents_to_invoice' => 'Add documents to invoice',
'mark_expense_paid' => 'Mark paid', 'mark_expense_paid' => 'Mark paid',
'white_label_license_error' => 'Failed to validate the license, check storage/logs/laravel-error.log for more details.', 'white_label_license_error' => 'Failed to validate the license, check storage/logs/laravel-error.log for more details.',
'plan_price' => 'Plan Price'
); );

View File

@ -166,6 +166,7 @@
@if (isset($planDetails)) @if (isset($planDetails))
{!! Former::populateField('plan', $planDetails['plan']) !!} {!! Former::populateField('plan', $planDetails['plan']) !!}
{!! Former::populateField('plan_term', $planDetails['term']) !!} {!! Former::populateField('plan_term', $planDetails['term']) !!}
{!! Former::populateField('plan_price', $planDetails['plan_price']) !!}
@if (!empty($planDetails['paid'])) @if (!empty($planDetails['paid']))
{!! Former::populateField('plan_paid', $planDetails['paid']->format('Y-m-d')) !!} {!! Former::populateField('plan_paid', $planDetails['paid']->format('Y-m-d')) !!}
@endif @endif
@ -184,6 +185,7 @@
->addOption() ->addOption()
->addOption(trans('texts.plan_term_yearly'), PLAN_TERM_YEARLY) ->addOption(trans('texts.plan_term_yearly'), PLAN_TERM_YEARLY)
->addOption(trans('texts.plan_term_monthly'), PLAN_TERM_MONTHLY)!!} ->addOption(trans('texts.plan_term_monthly'), PLAN_TERM_MONTHLY)!!}
{!! Former::text('plan_price') !!}
{!! Former::text('plan_started') {!! Former::text('plan_started')
->data_date_format('yyyy-mm-dd') ->data_date_format('yyyy-mm-dd')
->addGroupClass('plan_start_date') ->addGroupClass('plan_start_date')

View File

@ -1268,7 +1268,7 @@
if (!design) return; if (!design) return;
var doc = generatePDF(invoice, design, true); var doc = generatePDF(invoice, design, true);
var type = invoice.is_quote ? '{{ trans('texts.'.ENTITY_QUOTE) }}' : '{{ trans('texts.'.ENTITY_INVOICE) }}'; var type = invoice.is_quote ? '{{ trans('texts.'.ENTITY_QUOTE) }}' : '{{ trans('texts.'.ENTITY_INVOICE) }}';
doc.save(type +'-' + $('#invoice_number').val() + '.pdf'); doc.save(type + '-' + $('#invoice_number').val() + '.pdf');
} }
function onRecurrClick() { function onRecurrClick() {