1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Accept user input from approve quote flow

This commit is contained in:
David Bomba 2023-02-02 19:10:41 +11:00
parent 4c76107526
commit 2b8779be46
3 changed files with 15 additions and 7 deletions

View File

@ -461,8 +461,11 @@ class CompanySettings extends BaseSettings
public $show_shipping_address = false;
public $accept_client_input_quote_approval = false;
public static $casts = [
'custom_sending_email' => 'string',
'accept_client_input_quote_approval' => 'bool',
'custom_sending_email' => 'string',
'show_paid_stamp' => 'bool',
'show_shipping_address' => 'bool',
'company_logo_size' => 'string',

View File

@ -9,9 +9,10 @@
*/
class Approve {
constructor(displaySignature, displayTerms) {
constructor(displaySignature, displayTerms, userInput) {
this.shouldDisplaySignature = displaySignature;
this.shouldDisplayTerms = displayTerms;
this.shouldDisplayUserInput = userInput;
this.termsAccepted = false;
}
@ -59,7 +60,7 @@ class Approve {
document
.getElementById('approve-button')
.addEventListener('click', () => {
if (this.shouldDisplaySignature && this.shouldDisplayTerms) {
if (this.shouldDisplaySignature && this.shouldDisplayTerms && !this.shouldDisplayUserInput) {
this.displaySignature();
document
@ -76,10 +77,11 @@ class Approve {
this.termsAccepted = true;
this.submitForm();
});
});
}
if (this.shouldDisplaySignature && !this.shouldDisplayTerms) {
if (this.shouldDisplaySignature && !this.shouldDisplayTerms && !this.shouldDisplayUserInput) {
this.displaySignature();
document
@ -92,7 +94,7 @@ class Approve {
});
}
if (!this.shouldDisplaySignature && this.shouldDisplayTerms) {
if (!this.shouldDisplaySignature && this.shouldDisplayTerms && !this->this.shouldDisplayUserInput) {
this.displayTerms();
document
@ -103,7 +105,7 @@ class Approve {
});
}
if (!this.shouldDisplaySignature && !this.shouldDisplayTerms) {
if (!this.shouldDisplaySignature && !this.shouldDisplayTerms && !this.shouldDisplayUserInput) {
this.submitForm();
}
});
@ -115,4 +117,6 @@ const signature = document.querySelector('meta[name="require-quote-signature"]')
const terms = document.querySelector('meta[name="show-quote-terms"]').content;
new Approve(Boolean(+signature), Boolean(+terms)).handle();
const user_input = document.querySelector('meta[name="accept-user-input"]').content;
new Approve(Boolean(+signature), Boolean(+terms), Boolean(+user_input)).handle();

View File

@ -7,6 +7,7 @@
<meta name="show-quote-terms" content="{{ $settings->show_accept_quote_terms ? true : false }}">
<meta name="require-quote-signature" content="{{ $client->company->account->hasFeature(\App\Models\Account::FEATURE_INVOICE_SETTINGS) && $settings->require_quote_signature }}">
<meta name="accept-user-input" content="{{ $client->getSetting('accept_client_input_quote_approval') }}">
@include('portal.ninja2020.components.no-cache')