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';
/**
* @var array
*/
protected $fillable = [
'plan',
'plan_term',
'plan_price',
'plan_paid',
'plan_started',
'plan_expires',
];
/**
* @var array
*/

View File

@ -15,12 +15,7 @@ class NinjaRepository
}
$company = $account->company;
$company->plan = ! empty($data['plan']) && $data['plan'] != PLAN_FREE ? $data['plan'] : null;
$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->fill($data);
$company->save();
}
}

View File

@ -2492,6 +2492,7 @@ $LANG = array(
'add_documents_to_invoice' => 'Add documents to invoice',
'mark_expense_paid' => 'Mark paid',
'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))
{!! Former::populateField('plan', $planDetails['plan']) !!}
{!! Former::populateField('plan_term', $planDetails['term']) !!}
{!! Former::populateField('plan_price', $planDetails['plan_price']) !!}
@if (!empty($planDetails['paid']))
{!! Former::populateField('plan_paid', $planDetails['paid']->format('Y-m-d')) !!}
@endif
@ -184,6 +185,7 @@
->addOption()
->addOption(trans('texts.plan_term_yearly'), PLAN_TERM_YEARLY)
->addOption(trans('texts.plan_term_monthly'), PLAN_TERM_MONTHLY)!!}
{!! Former::text('plan_price') !!}
{!! Former::text('plan_started')
->data_date_format('yyyy-mm-dd')
->addGroupClass('plan_start_date')