mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Allow prefilling the client/contact fields over query parameters
This commit is contained in:
parent
368ed459f1
commit
b230680e8f
@ -15,6 +15,7 @@ use App\Factory\ClientFactory;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Mail\ContactPasswordlessLogin;
|
||||
use App\Models\Client;
|
||||
use App\Models\Subscription;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Invoice;
|
||||
@ -220,6 +221,16 @@ class BillingPortalPurchase extends Component
|
||||
'settings' => [],
|
||||
];
|
||||
|
||||
foreach ($this->request_data as $field => $value) {
|
||||
if (in_array($field, Client::$subscriptions_fillable)) {
|
||||
$data[$field] = $value;
|
||||
}
|
||||
|
||||
if (in_array($field, ClientContact::$subscription_fillable)) {
|
||||
$data['contacts'][0][$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('locale', $this->request_data)) {
|
||||
$request = $this->request_data;
|
||||
|
||||
@ -391,6 +402,10 @@ class BillingPortalPurchase extends Component
|
||||
|
||||
public function render()
|
||||
{
|
||||
if (array_key_exists('email', $this->request_data)) {
|
||||
$this->email = $this->request_data['email'];
|
||||
}
|
||||
|
||||
if ($this->contact instanceof ClientContact) {
|
||||
$this->getPaymentMethods($this->contact);
|
||||
}
|
||||
|
@ -99,6 +99,36 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
|
||||
protected $touches = [];
|
||||
|
||||
/**
|
||||
* Whitelisted fields for using from query parameters on subscriptions request.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public static $subscriptions_fillable = [
|
||||
'assigned_user_id',
|
||||
'address1',
|
||||
'address2',
|
||||
'city',
|
||||
'state',
|
||||
'postal_code',
|
||||
'country_id',
|
||||
'custom_value1',
|
||||
'custom_value2',
|
||||
'custom_value3',
|
||||
'custom_value4',
|
||||
'shipping_address1',
|
||||
'shipping_address2',
|
||||
'shipping_city',
|
||||
'shipping_state',
|
||||
'shipping_postal_code',
|
||||
'shipping_country_id',
|
||||
'payment_terms',
|
||||
'vat_number',
|
||||
'id_number',
|
||||
'public_notes',
|
||||
'phone',
|
||||
];
|
||||
|
||||
public function getEntityType()
|
||||
{
|
||||
return self::class;
|
||||
@ -614,7 +644,7 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
|
||||
public function recurring_invoice_filepath()
|
||||
{
|
||||
return $this->company->company_key.'/'.$this->client_hash.'/recurring_invoices/';
|
||||
return $this->company->company_key.'/'.$this->client_hash.'/recurring_invoices/';
|
||||
}
|
||||
|
||||
public function company_filepath()
|
||||
|
@ -95,6 +95,21 @@ class ClientContact extends Authenticatable implements HasLocalePreference
|
||||
'client_id',
|
||||
];
|
||||
|
||||
/**
|
||||
* Whitelisted fields for using from query parameters on subscriptions request.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public static $subscription_fillable = [
|
||||
'first_name',
|
||||
'last_name',
|
||||
'phone',
|
||||
'custom_value1',
|
||||
'custom_value2',
|
||||
'custom_value3',
|
||||
'custom_value4',
|
||||
'email',
|
||||
];
|
||||
|
||||
/*
|
||||
V2 type of scope
|
||||
|
@ -57,8 +57,7 @@
|
||||
|
||||
<div class="relative flex justify-center text-sm leading-5">
|
||||
<h1 class="text-2xl font-bold tracking-wide bg-gray-50 px-6 py-0">
|
||||
{{ ctrans('texts.total') }}
|
||||
: {{ \App\Utils\Number::formatMoney($price, $subscription->company) }}
|
||||
{{ ctrans('texts.total') }}: {{ \App\Utils\Number::formatMoney($price, $subscription->company) }}
|
||||
|
||||
@if($steps['discount_applied'])
|
||||
<small class="ml-1 line-through text-gray-500">{{ \App\Utils\Number::formatMoney($subscription->price, $subscription->company) }}</small>
|
||||
|
Loading…
x
Reference in New Issue
Block a user