mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on portal
This commit is contained in:
parent
4ed52645d6
commit
9e6b7905ac
@ -978,19 +978,50 @@ class ClientPortalController extends BaseController
|
||||
return view('invited.details', $data);
|
||||
}
|
||||
|
||||
public function updateDetails()
|
||||
public function updateDetails(\Illuminate\Http\Request $request)
|
||||
{
|
||||
if (! $contact = $this->getContact()) {
|
||||
return $this->returnError();
|
||||
}
|
||||
|
||||
$client = $contact->client;
|
||||
$account = $contact->account;
|
||||
|
||||
if (! $account->enable_client_portal || ! $account->enable_client_portal_dashboard) {
|
||||
return $this->returnError();
|
||||
}
|
||||
|
||||
$rules = [
|
||||
'address1' => 'required',
|
||||
'city' => 'required',
|
||||
'state' => 'required',
|
||||
'postal_code' => 'required',
|
||||
'country_id' => 'required',
|
||||
];
|
||||
|
||||
if ($client->name) {
|
||||
$rules['name'] = 'required';
|
||||
} else {
|
||||
$rules['first_name'] = 'required';
|
||||
$rules['last_name'] = 'required';
|
||||
}
|
||||
if (! $contact->email) {
|
||||
$rules['email'] = 'required';
|
||||
}
|
||||
if ($account->vat_number) {
|
||||
$rules['vat_number'] = 'required';
|
||||
}
|
||||
|
||||
$this->validate($request, $rules);
|
||||
|
||||
$contact->fill(request()->all());
|
||||
$contact->save();
|
||||
|
||||
$client = $contact->client;
|
||||
$client->fill(request()->all());
|
||||
$client->save();
|
||||
|
||||
return redirect('/client/dashboard');
|
||||
event(new \App\Events\ClientWasUpdated($client));
|
||||
|
||||
return redirect('/client/dashboard')->withMessage(trans('texts.updated_client_details'));
|
||||
}
|
||||
}
|
||||
|
@ -2653,6 +2653,7 @@ $LANG = array(
|
||||
'amount_greater_than_balance' => 'The amount is greater than the invoice balance, a credit will be created with the remaining amount.',
|
||||
'custom_fields_tip' => 'Use <code>Label|Option1,Option2</code> to show a select box.',
|
||||
'client_information' => 'Client Information',
|
||||
'updated_client_details' => 'Successfully updated client details',
|
||||
|
||||
);
|
||||
|
||||
|
@ -352,7 +352,7 @@
|
||||
@if ($client->hasRecurringInvoices())
|
||||
{!! Button::primary(strtoupper(trans("texts.recurring")))->asLinkTo(URL::to('/client/invoices/recurring')) !!}
|
||||
@endif
|
||||
{!! Button::success(strtoupper(trans("texts.edit_details")))->asLinkTo(URL::to('/client/details')) !!}
|
||||
{!! Button::success(strtoupper(trans("texts.edit_details")))->asLinkTo(URL::to('/client/details'))->withAttributes(['id' => 'editDetailsButton']) !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -30,7 +30,6 @@
|
||||
'country_id' => 'required',
|
||||
)) !!}
|
||||
|
||||
|
||||
@if ($client)
|
||||
{{ Former::populate($client) }}
|
||||
{{ Former::populateField('first_name', $contact->first_name) }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user