setForm(); } /** * Return form elements. * * @return array. */ public function form($element = 'fields', $grouped = true) { $item = collect($this->form->get($element)); if ($element == 'fields' && $grouped == true) { return $item->groupBy(['group', 'section']); } return $item; } /** * Sets the form and form elements. * @return null. */ public function setForm() { $this->form = collect([ 'form' => [ 'store' => [], 'update' => [], ], 'groups' => [ 'main' => 'Main', ], 'fields' => [ 'purchase_order_id' => [ "type" => 'numeric', "label" => trans('purchase::item.label.purchase_order_id'), "placeholder" => trans('purchase::item.placeholder.purchase_order_id'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'item_id' => [ "type" => 'numeric', "label" => trans('purchase::item.label.item_id'), "placeholder" => trans('purchase::item.placeholder.item_id'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'code' => [ "type" => 'text', "label" => trans('purchase::item.label.code'), "placeholder" => trans('purchase::item.placeholder.code'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'uom' => [ "type" => 'text', "label" => trans('purchase::item.label.uom'), "placeholder" => trans('purchase::item.placeholder.uom'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'tax_id' => [ "type" => 'numeric', "label" => trans('purchase::item.label.tax_id'), "placeholder" => trans('purchase::item.placeholder.tax_id'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'date' => [ "type" => 'numeric', "label" => trans('purchase::item.label.date'), "placeholder" => trans('purchase::item.placeholder.date'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'qty' => [ "type" => 'numeric', "label" => trans('purchase::item.label.qty'), "placeholder" => trans('purchase::item.placeholder.qty'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'unit_price' => [ "type" => 'decimal', "label" => trans('purchase::item.label.unit_price'), "placeholder" => trans('purchase::item.placeholder.unit_price'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'discount' => [ "type" => 'decimal', "label" => trans('purchase::item.label.discount'), "placeholder" => trans('purchase::item.placeholder.discount'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], 'subtotal' => [ "type" => 'decimal', "label" => trans('purchase::item.label.subtotal'), "placeholder" => trans('purchase::item.placeholder.subtotal'), "rules" => '', "group" => "main", "section" => "first", "attributes" => [ 'wrapper' => [], "label" => [], "input" => [], ], ], ] ); } }