Required info binding with required client info

This commit is contained in:
David Bomba 2023-02-02 14:56:05 +11:00
parent 568c0aa028
commit 5b0c63cb39
6 changed files with 57 additions and 5 deletions

View File

@ -15,12 +15,31 @@ namespace App\Http\Livewire;
use App\Libraries\MultiDB; use App\Libraries\MultiDB;
use App\Models\ClientContact; use App\Models\ClientContact;
use App\Models\CompanyGateway; use App\Models\CompanyGateway;
use App\Models\Invoice;
use App\Utils\Traits\MakesHash;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Livewire\Component; use Livewire\Component;
class RequiredClientInfo extends Component class RequiredClientInfo extends Component
{ {
use MakesHash;
/**
* @var bool
*/
public $show_terms = false;
/**
* @var array
*/
public $invoice;
/**
* @var array
*/
public $fields = []; public $fields = [];
/** /**
@ -28,6 +47,9 @@ class RequiredClientInfo extends Component
*/ */
public $contact; public $contact;
/**
* @var Client
*/
public $client; public $client;
/** /**
@ -117,6 +139,18 @@ class RequiredClientInfo extends Component
count($this->fields) > 0 count($this->fields) > 0
? $this->checkFields() ? $this->checkFields()
: $this->show_form = false; : $this->show_form = false;
if($this->company->settings->show_accept_invoice_terms && request()->has('hash'))
{
$this->show_terms = true;
$hash = Cache::get(request()->input('hash'));
$this->invoice = Invoice::find($this->decodePrimaryKey($hash['invoice_id']));
}
} }
public function handleSubmit(array $data): bool public function handleSubmit(array $data): bool
@ -215,6 +249,10 @@ class RequiredClientInfo extends Component
} }
} }
} }
if($this->show_terms)
$this->show_form = true;
} }
public function showCopyBillingCheckbox(): bool public function showCopyBillingCheckbox(): bool

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"/livewire.js":"/livewire.js?id=de3fca26689cb5a39af4"} {"/livewire.js":"/livewire.js?id=fe747446aa84856d8b66"}

View File

@ -45,6 +45,20 @@
@endcomponent @endcomponent
@endif @endif
@if($show_terms)
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.terms_of_service') ])
<input
id="terms"
name="terms"
type="checkbox"
class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
/>
@endcomponent
@endif
@component('portal.ninja2020.components.general.card-element-single') @component('portal.ninja2020.components.general.card-element-single')
<div class="flex flex-col items-end"> <div class="flex flex-col items-end">
<button class="button button-primary bg-primary"> <button class="button button-primary bg-primary">

View File

@ -33,7 +33,7 @@
{{ ctrans('texts.i_agree') }} {{ ctrans('texts.i_agree') }}
</button> </button>
</div> </div>
<div class="mt-3 flex w-full rounded-md shadow-sm sm:mt-0 sm:w-auto"> <div class="mt-3 flex w-full rounded-md shadow-sm sm:mt-0 sm:w-auto" id="hide_close">
<button @click="document.getElementById('displayTermsModal').style.display = 'none';" type="button" class="button button-secondary"> <button @click="document.getElementById('displayTermsModal').style.display = 'none';" type="button" class="button button-secondary">
{{ ctrans('texts.close') }} {{ ctrans('texts.close') }}
</button> </button>