diff --git a/app/control/contato/CityForm.php b/app/control/contato/CityForm.php new file mode 100644 index 0000000..c0b6440 --- /dev/null +++ b/app/control/contato/CityForm.php @@ -0,0 +1,21 @@ +panel->addCustomActionLink([ContatoList::class], 'fa:bars', 'Listagem'); + } +} diff --git a/app/control/contato/ContatoList.php b/app/control/contato/ContatoList.php new file mode 100644 index 0000000..3a28546 --- /dev/null +++ b/app/control/contato/ContatoList.php @@ -0,0 +1,40 @@ +panel->addRow([new DGridColumn($name)]); + } + + protected function createDatagridColumns($showId = false) + { + $this->datagrid->useDeleteAction(self::class); + + parent::createDatagridColumns($showId); + + $this->datagrid->useEditAction(ContatoForm::class); + } +} diff --git a/app/model/contato/City.php b/app/model/contato/City.php new file mode 100644 index 0000000..92a365d --- /dev/null +++ b/app/model/contato/City.php @@ -0,0 +1,29 @@ +addVarchar('name', 150, true, 'nome'); + } + + protected function buildStructureForm() + { + parent::setStructureForm([[$this->field_name]]); + } +} diff --git a/app/model/contato/Contato.php b/app/model/contato/Contato.php new file mode 100644 index 0000000..8aff722 --- /dev/null +++ b/app/model/contato/Contato.php @@ -0,0 +1,39 @@ +addVarchar('name', 150, true, 'nome'); + $this->addVarchar('cpf', 14)->mask('999.999.999-99'); + $this->addVarchar('rg', 12); + $this->addDate('birthday', 'data de nascimento'); + $this->addText('observation', 0, 80, false, 'observações'); + $this->addCombo('city_id', 'cidade')->model(City::class); + } + + protected function buildStructureForm() + { + $form_structure = [ + [$this->field_name], + [$this->field_cpf, $this->field_rg, $this->field_birthday, $this->field_city_id], + [$this->field_observation] + ]; + parent::setStructureForm($form_structure); + } +} diff --git a/menu.xml b/menu.xml index 6a3ed58..67c6b18 100755 --- a/menu.xml +++ b/menu.xml @@ -112,11 +112,15 @@ - + fa:bars fa-fw - - HumanForm + + ContatoForm + fa:bars fa-fw + + + CityForm fa:bars fa-fw