This repository has been archived by the owner on May 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5637ec0
commit 426a133
Showing
6 changed files
with
164 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App\Control\Contato; | ||
|
||
use App\Model\Contato\City; | ||
use Dvi\Adianti\Control\DviSearchFormList; | ||
|
||
/** | ||
* Contato CityForm | ||
* | ||
* @package Contato | ||
* @subpackage Dvi | ||
* @author Davi Menezes | ||
* @copyright Copyright (c) 2018. ([email protected]) | ||
* @link https://github.com/DaviMenezes | ||
*/ | ||
class CityForm extends DviSearchFormList | ||
{ | ||
protected $objectClass = City::class; | ||
protected $pageTitle = 'Cidades'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Control\Contato; | ||
|
||
use App\Model\Contato\Contato; | ||
use Dvi\Adianti\Control\DviStandardForm; | ||
|
||
/** | ||
* Contato ContatoForm | ||
* | ||
* @package Contato | ||
* @subpackage Dvi | ||
* @author Davi Menezes | ||
* @copyright Copyright (c) 2018. ([email protected]) | ||
* @link https://github.com/DaviMenezes | ||
*/ | ||
class ContatoForm extends DviStandardForm | ||
{ | ||
protected $objectClass = Contato::class; | ||
protected $pageTitle = 'Contato'; | ||
|
||
protected function createActions() | ||
{ | ||
parent::createActions(); | ||
|
||
$this->panel->addCustomActionLink([ContatoList::class], 'fa:bars', 'Listagem'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace App\Control\Contato; | ||
|
||
use Adianti\Base\Lib\Control\TAction; | ||
use Adianti\Base\Lib\Widget\Datagrid\TDataGridAction; | ||
use App\Model\Contato\Contato; | ||
use Dvi\Adianti\Control\DviSearchList; | ||
use Dvi\Adianti\Widget\Base\DGridColumn; | ||
use Dvi\Adianti\Widget\Form\DEntry; | ||
|
||
/** | ||
* Contato ContatoList | ||
* | ||
* @package Contato | ||
* @subpackage Dvi | ||
* @author Davi Menezes | ||
* @copyright Copyright (c) 2018. ([email protected]) | ||
* @link https://github.com/DaviMenezes | ||
*/ | ||
class ContatoList extends DviSearchList | ||
{ | ||
protected $objectClass = Contato::class; | ||
protected $pageTitle = 'Contatos'; | ||
|
||
protected function mountModelFields() | ||
{ | ||
$name = new DEntry('Entity_name', 'nome', 150); | ||
$this->panel->addRow([new DGridColumn($name)]); | ||
} | ||
|
||
protected function createDatagridColumns($showId = false) | ||
{ | ||
$this->datagrid->useDeleteAction(self::class); | ||
|
||
parent::createDatagridColumns($showId); | ||
|
||
$this->datagrid->useEditAction(ContatoForm::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace App\Model\Contato; | ||
|
||
use Dvi\Adianti\Model\DviModel; | ||
|
||
/** | ||
* Contato City | ||
* | ||
* @package Contato | ||
* @subpackage Dvi | ||
* @author Davi Menezes | ||
* @copyright Copyright (c) 2018. ([email protected]) | ||
* @link https://github.com/DaviMenezes | ||
*/ | ||
class City extends DviModel | ||
{ | ||
const TABLENAME = 'ctt_city'; | ||
|
||
public function buildFieldTypes() | ||
{ | ||
$this->addVarchar('name', 150, true, 'nome'); | ||
} | ||
|
||
protected function buildStructureForm() | ||
{ | ||
parent::setStructureForm([[$this->field_name]]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace App\Model\Contato; | ||
|
||
use Dvi\Adianti\Model\DviModel; | ||
|
||
/** | ||
* Contato Contato | ||
* | ||
* @package Contato | ||
* @subpackage Dvi | ||
* @author Davi Menezes | ||
* @copyright Copyright (c) 2018. ([email protected]) | ||
* @link https://github.com/DaviMenezes | ||
*/ | ||
class Contato extends DviModel | ||
{ | ||
const TABLENAME = 'ctt_contact'; | ||
|
||
public function buildFieldTypes() | ||
{ | ||
$this->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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters