|
@@ -5,6 +5,8 @@ namespace Dcat\Admin\Widgets;
|
|
use Closure;
|
|
use Closure;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Form\Concerns\HandleCascadeFields;
|
|
use Dcat\Admin\Form\Concerns\HandleCascadeFields;
|
|
|
|
+use Dcat\Admin\Form\Concerns\HasRows;
|
|
|
|
+use Dcat\Admin\Form\Concerns\HasTabs;
|
|
use Dcat\Admin\Form\Field;
|
|
use Dcat\Admin\Form\Field;
|
|
use Dcat\Admin\Support\Helper;
|
|
use Dcat\Admin\Support\Helper;
|
|
use Dcat\Admin\Traits\HasAuthorization;
|
|
use Dcat\Admin\Traits\HasAuthorization;
|
|
@@ -82,6 +84,8 @@ class Form implements Renderable
|
|
HasFormResponse,
|
|
HasFormResponse,
|
|
HasAuthorization,
|
|
HasAuthorization,
|
|
HandleCascadeFields,
|
|
HandleCascadeFields,
|
|
|
|
+ HasRows,
|
|
|
|
+ HasTabs,
|
|
Macroable {
|
|
Macroable {
|
|
__call as macroCall;
|
|
__call as macroCall;
|
|
}
|
|
}
|
|
@@ -98,6 +102,11 @@ class Form implements Renderable
|
|
*/
|
|
*/
|
|
protected $fields;
|
|
protected $fields;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @var array
|
|
|
|
+ */
|
|
|
|
+ protected $variables = [];
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @var bool
|
|
* @var bool
|
|
*/
|
|
*/
|
|
@@ -485,13 +494,21 @@ class Form implements Renderable
|
|
|
|
|
|
$this->fillFields($this->model()->toArray());
|
|
$this->fillFields($this->model()->toArray());
|
|
|
|
|
|
- return [
|
|
|
|
|
|
+ return array_merge([
|
|
'start' => $this->open(),
|
|
'start' => $this->open(),
|
|
'end' => $this->close(),
|
|
'end' => $this->close(),
|
|
'fields' => $this->fields,
|
|
'fields' => $this->fields,
|
|
'method' => $this->getHtmlAttribute('method'),
|
|
'method' => $this->getHtmlAttribute('method'),
|
|
'buttons' => $this->buttons,
|
|
'buttons' => $this->buttons,
|
|
- ];
|
|
|
|
|
|
+ 'rows' => $this->rows(),
|
|
|
|
+ ], $this->variables);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function addVariables(array $variables)
|
|
|
|
+ {
|
|
|
|
+ $this->variables = array_merge($this->variables, $variables);
|
|
|
|
+
|
|
|
|
+ return $this;
|
|
}
|
|
}
|
|
|
|
|
|
public function fillFields(array $data)
|
|
public function fillFields(array $data)
|
|
@@ -690,6 +707,14 @@ JS
|
|
$this->setupSubmitScript();
|
|
$this->setupSubmitScript();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ $tabObj = $this->getTab();
|
|
|
|
+
|
|
|
|
+ if (! $tabObj->isEmpty()) {
|
|
|
|
+ $tabObj->addScript();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $this->addVariables(['tabObj' => $tabObj]);
|
|
|
|
+
|
|
return view($this->view, $this->variables())->render();
|
|
return view($this->view, $this->variables())->render();
|
|
}
|
|
}
|
|
|
|
|