diff --git a/app/Abstracts/View/Components/DocumentForm.php b/app/Abstracts/View/Components/DocumentForm.php
index 81c0b5363..81a01bcb6 100644
--- a/app/Abstracts/View/Components/DocumentForm.php
+++ b/app/Abstracts/View/Components/DocumentForm.php
@@ -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)) {
diff --git a/resources/views/components/documents/form/content.blade.php b/resources/views/components/documents/form/content.blade.php
index bcc3f1c40..aad23eb79 100644
--- a/resources/views/components/documents/form/content.blade.php
+++ b/resources/views/components/documents/form/content.blade.php
@@ -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)
-
+
@endif
@if (!$hideAdvanced)
diff --git a/resources/views/components/documents/form/main.blade.php b/resources/views/components/documents/form/main.blade.php
index a1b3c3773..867ddd220 100644
--- a/resources/views/components/documents/form/main.blade.php
+++ b/resources/views/components/documents/form/main.blade.php
@@ -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 }}"
/>
@if (!$hideContact)
-
+
@endif