builder = $builder; } /** * Disable reset button. * * @return $this */ public function disableReset(bool $disable = true) { if ($disable) { array_delete($this->buttons, 'reset'); } elseif (!in_array('reset', $this->buttons)) { array_push($this->buttons, 'reset'); } return $this; } /** * Disable submit button. * * @return $this */ public function disableSubmit(bool $disable = true) { if ($disable) { array_delete($this->buttons, 'submit'); } elseif (!in_array('submit', $this->buttons)) { array_push($this->buttons, 'submit'); } return $this; } /** * Disable View Checkbox. * * @return $this */ public function disableViewCheck(bool $disable = true) { if ($disable) { array_delete($this->checkboxes, 'view'); } elseif (!in_array('view', $this->checkboxes)) { array_push($this->checkboxes, 'view'); } return $this; } /** * Disable Editing Checkbox. * * @return $this */ public function disableEditingCheck(bool $disable = true) { if ($disable) { array_delete($this->checkboxes, 'continue_editing'); } elseif (!in_array('continue_editing', $this->checkboxes)) { array_push($this->checkboxes, 'continue_editing'); } return $this; } /** * Disable Creating Checkbox. * * @return $this */ public function disableCreatingCheck(bool $disable = true) { if ($disable) { array_delete($this->checkboxes, 'continue_creating'); } elseif (!in_array('continue_creating', $this->checkboxes)) { array_push($this->checkboxes, 'continue_creating'); } return $this; } /** * Setup scripts. */ protected function setupScript() { $script = <<<'EOT' $('.after-submit').iCheck({checkboxClass:'icheckbox_minimal-blue'}).on('ifChecked', function () { $('.after-submit').not(this).iCheck('uncheck'); }); EOT; Admin::script($script); } /** * Render footer. * * @return string */ public function render() { $this->setupScript(); $data = [ 'buttons' => $this->buttons, 'checkboxes' => $this->checkboxes, 'width' => $this->builder->getWidth(), ]; return view($this->view, $data)->render(); } }