type = $type; $this->document = $document; $this->formRoute = ($formRoute) ? $formRoute : $this->getRoute($type, $document); $this->formId = $formId; $this->formSubmit = $formSubmit; $this->hideCompany = $hideCompany; $this->hideAdvanced = $hideAdvanced; $this->hideFooter = $hideFooter; $this->hideButtons = $hideButtons; // Company component fields status $this->hideLogo = $hideLogo; $this->hideDocumentTitle = $hideDocumentTitle; $this->hideDocumentSubheading = $hideDocumentSubheading; $this->hideCompanyEdit = $hideCompanyEdit; // Main.Header fields $this->contactType = $contactType; $this->documentNumber = $documentNumber; $this->textIssuedAt = $textIssuedAt; $this->textDocumentNumber = $textDocumentNumber; $this->textDueAt = $textDueAt; $this->textOrderNumber = $textOrderNumber; // Main.Header component fields status $this->hideContact = $hideContact; $this->hideIssuedAt = $hideIssuedAt; $this->hideDocumentNumber = $hideDocumentNumber; $this->hideDueAt = $hideDueAt; $this->hideOrderNumber = $hideOrderNumber; // Advanced component fields status $this->hideRecurring = $hideRecurring; $this->hideCategory = $hideCategory; $this->hideAttachment = $hideAttachment; } /** * Get the view / contents that represent the component. * * @return \Illuminate\Contracts\View\View|string */ public function render() { return view('components.documents.form.content'); } protected function getRoute($type, $document, $parameters = []) { $page = Str::plural($type, 2); $route = $page . '.store'; if ($document) { $parameters = [ Str::replaceFirst('-', '_', $type) => $document->id ]; $route = $page . '.update'; } try { route($route, $parameters); } catch (\Exception $e) { $route = ''; } return $route; } }