Document form missing value controller add..
This commit is contained in:
parent
2c673f9ed6
commit
db0d424de2
@ -67,9 +67,17 @@ abstract class DocumentForm extends Component
|
||||
/** Metadata Component Start */
|
||||
public $contacts;
|
||||
|
||||
public $contact;
|
||||
|
||||
/** @var string */
|
||||
public $contactType;
|
||||
|
||||
/** @var string */
|
||||
public $contactSearchRoute;
|
||||
|
||||
/** @var string */
|
||||
public $contactCreateRoute;
|
||||
|
||||
/** @var bool */
|
||||
public $hideContact;
|
||||
|
||||
@ -166,7 +174,7 @@ abstract class DocumentForm extends Component
|
||||
bool $hideCompany = false, bool $hideAdvanced = false, bool $hideFooter = false, bool $hideButtons = false,
|
||||
/** Content Component End */
|
||||
/** Metadata Component Start */
|
||||
$contacts = [], string $contactType = '',
|
||||
$contacts = [], $contact = false, string $contactType = '', string $contactSearchRoute = '', string $contactCreateRoute = '',
|
||||
bool $hideContact = false, bool $hideIssuedAt = false, bool $hideDocumentNumber = false, bool $hideDueAt = false, bool $hideOrderNumber = false,
|
||||
string $textDocumentNumber = '', string $textOrderNumber = '', string $textIssuedAt = '', string $textDueAt = '',
|
||||
string $issuedAt = '', string $documentNumber = '', string $dueAt = '', string $orderNumber = '',
|
||||
@ -207,6 +215,7 @@ abstract class DocumentForm extends Component
|
||||
|
||||
/** Metadata Component Start */
|
||||
$this->contacts = $this->getContacts($type, $contacts);
|
||||
$this->contact = $this->getContact($contact, $document);
|
||||
$this->contactType = $this->getContactType($type, $contactType);
|
||||
|
||||
$this->hideContact = $hideContact;
|
||||
@ -283,6 +292,21 @@ abstract class DocumentForm extends Component
|
||||
return $contacts;
|
||||
}
|
||||
|
||||
protected function getContact($contact, $document)
|
||||
{
|
||||
if (!empty($contact)) {
|
||||
return $contact;
|
||||
}
|
||||
|
||||
$contact = new \stdClass();
|
||||
|
||||
if (!empty($document) && !empty($document->contact)) {
|
||||
$contact = $document->contact;
|
||||
}
|
||||
|
||||
return $contact;
|
||||
}
|
||||
|
||||
protected function getContactType($type, $contact_type)
|
||||
{
|
||||
if (!empty($contact_type)) {
|
||||
|
@ -37,16 +37,26 @@
|
||||
:document="$document"
|
||||
hide-contact="{{ $hideContact }}"
|
||||
contact-type="{{ $contactType }}"
|
||||
:contact="$contact"
|
||||
:contacts="$contacts"
|
||||
:search_route="$contactSearchRoute"
|
||||
:create_route="$contactCreateRoute"
|
||||
hide-issue-at="{{ $hideIssuedAt }}"
|
||||
text-issue-at="{{ $textIssuedAt }}"
|
||||
issue-at="{{ $issuedAt }}"
|
||||
hide-document-number="{{ $hideDocumentNumber }}"
|
||||
text-document-number="{{ $textDocumentNumber }}"
|
||||
document-number="{{ $documentNumber }}"
|
||||
hide-due-at="{{ $hideDueAt }}"
|
||||
text-due-at="{{ $textDueAt }}"
|
||||
due-at="{{ $dueAt }}"
|
||||
hide-order-number="{{ $hideOrderNumber }}"
|
||||
text-order-number="{{ $textOrderNumber }}"
|
||||
order-number="{{ $orderNumber }}"
|
||||
hide-edit-item-columns="{{ $hideEditItemColumns }}"
|
||||
hide-items="{{ $hideItems }}"
|
||||
hide-name="{{ $hideName }}"
|
||||
hide-description="{{ $hideDescription }}"
|
||||
text-items="{{ $textItems }}"
|
||||
hide-quantity="{{ $hideQuantity }}"
|
||||
text-quantity="{{ $textQuantity }}"
|
||||
@ -58,7 +68,10 @@
|
||||
/>
|
||||
|
||||
@if (!$hideFooter)
|
||||
<x-documents.form.footer type="{{ $type }}" :document="$document" />
|
||||
<x-documents.form.footer
|
||||
type="{{ $type }}"
|
||||
:document="$document"
|
||||
/>
|
||||
@endif
|
||||
|
||||
@if (!$hideAdvanced)
|
||||
|
@ -5,14 +5,22 @@
|
||||
:document="$document"
|
||||
hide-contact="{{ $hideContact }}"
|
||||
contact-type="{{ $contactType }}"
|
||||
:contact="$contact"
|
||||
:contacts="$contacts"
|
||||
:search_route="$contactSearchRoute"
|
||||
:create_route="$contactCreateRoute"
|
||||
hide-issue-at="{{ $hideIssuedAt }}"
|
||||
text-issue-at="{{ $textIssuedAt }}"
|
||||
issue-at="{{ $issuedAt }}"
|
||||
hide-document-number="{{ $hideDocumentNumber }}"
|
||||
text-document-number="{{ $textDocumentNumber }}"
|
||||
document-number="{{ $documentNumber }}"
|
||||
hide-due-at="{{ $hideDueAt }}"
|
||||
text-due-at="{{ $textDueAt }}"
|
||||
due-at="{{ $dueAt }}"
|
||||
hide-order-number="{{ $hideOrderNumber }}"
|
||||
text-order-number="{{ $textOrderNumber }}"
|
||||
order-number="{{ $orderNumber }}"
|
||||
/>
|
||||
|
||||
<x-documents.form.items
|
||||
@ -20,6 +28,8 @@
|
||||
:document="$document"
|
||||
hide-edit-item-columns="{{ $hideEditItemColumns }}"
|
||||
hide-items="{{ $hideItems }}"
|
||||
hide-name="{{ $hideName }}"
|
||||
hide-description="{{ $hideDescription }}"
|
||||
text-items="{{ $textItems }}"
|
||||
hide-quantity="{{ $hideQuantity }}"
|
||||
text-quantity="{{ $textQuantity }}"
|
||||
|
@ -2,7 +2,13 @@
|
||||
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
||||
@if (!$hideContact)
|
||||
<div class="row">
|
||||
<x-select-contact-card type="{{ $contactType }}" :contact="($document) ? $document->contact : new stdClass()"/>
|
||||
<x-select-contact-card
|
||||
type="{{ $contactType }}"
|
||||
:contact="$contact"
|
||||
:contacts="$contacts"
|
||||
:search_route="$contactSearchRoute"
|
||||
:create_route="$contactCreateRoute"
|
||||
/>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user