This commit is contained in:
James Cole 2018-04-22 11:29:20 +02:00
parent 8f3e4a2dee
commit c2e8a67330
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
2 changed files with 14 additions and 6 deletions

View File

@ -83,7 +83,9 @@ class RuleController extends Controller
$this->createDefaultRule(); $this->createDefaultRule();
$bill = null; $bill = null;
$billId = (int)$request->get('fromBill'); $billId = (int)$request->get('fromBill');
$preFilled = []; $preFilled = [
'strict' => true,
];
$groups = ExpandedForm::makeSelectList($ruleGroupRepository->get()); $groups = ExpandedForm::makeSelectList($ruleGroupRepository->get());
$oldTriggers = []; $oldTriggers = [];
$oldActions = []; $oldActions = [];

View File

@ -169,11 +169,17 @@ class ExpandedForm
*/ */
public function checkbox(string $name, $value = 1, $checked = null, $options = []): string public function checkbox(string $name, $value = 1, $checked = null, $options = []): string
{ {
$options['checked'] = true === $checked ? true : null; $options['checked'] = true === $checked ? true : false;
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options); if (Session::has('preFilled')) {
$classes = $this->getHolderClasses($name); $preFilled = session('preFilled');
$value = $this->fillFieldValue($name, $value); $options['checked'] = $preFilled[$name] ?? $options['checked'];
}
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value);
unset($options['placeholder'], $options['autocomplete'], $options['class']); unset($options['placeholder'], $options['autocomplete'], $options['class']);