-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from manuelcanepa/13_tipos_editables
#13 Tipos de documentos administrables
- Loading branch information
Showing
41 changed files
with
2,741 additions
and
14 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,62 @@ | ||
<?php | ||
/** | ||
* Customer Identification Document | ||
* | ||
* @category Mugar | ||
* @package Mugar_CustomerIdentificationDocument | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Mugar (https://www.mugar.io/) | ||
* | ||
*/ | ||
|
||
namespace Mugar\CustomerIdentificationDocument\Api; | ||
|
||
use Magento\Framework\Api\SearchCriteriaInterface; | ||
use Mugar\CustomerIdentificationDocument\Api\Data\CidTypeInterface; | ||
|
||
/** | ||
* @api | ||
*/ | ||
interface CidTypesRepositoryInterface | ||
{ | ||
/** | ||
* @param CidTypeInterface $cidType | ||
* @return CidTypeInterface | ||
*/ | ||
public function save(CidTypeInterface $cidType); | ||
|
||
/** | ||
* @param $id | ||
* @return CidTypeInterface | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
*/ | ||
public function get($id); | ||
|
||
/** | ||
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria | ||
* @return \Mugar\CustomerIdentificationDocument\Api\Data\CidTypeSearchResultInterface | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
*/ | ||
public function getList(SearchCriteriaInterface $searchCriteria); | ||
|
||
/** | ||
* @param CidTypeInterface $cidType | ||
* @return bool true on success | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
*/ | ||
public function delete(CidTypeInterface $cidType); | ||
|
||
/** | ||
* @param int $cidTypeId | ||
* @return bool true on success | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
*/ | ||
public function deleteById($cidTypeId); | ||
|
||
/** | ||
* clear caches instances | ||
* @return void | ||
*/ | ||
public function clear(); | ||
} |
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,55 @@ | ||
<?php | ||
/** | ||
* Customer Identification Document | ||
* | ||
* @category Mugar | ||
* @package Mugar_CustomerIdentificationDocument | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Mugar (https://www.mugar.io/) | ||
* | ||
*/ | ||
|
||
namespace Mugar\CustomerIdentificationDocument\Api\Data; | ||
|
||
/** | ||
* @api | ||
*/ | ||
interface CidTypeInterface | ||
{ | ||
const ID = 'cid_type_id'; | ||
const NAME = 'name'; | ||
const ACTIVE = 'active'; | ||
|
||
/** | ||
* @param int $id | ||
* @return CidTypeInterface | ||
*/ | ||
public function setCidTypeId($id); | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getCidTypeId(); | ||
|
||
/** | ||
* @param string $name | ||
* @return CidTypeInterface | ||
*/ | ||
public function setName($name); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName(); | ||
|
||
/** | ||
* @param int $active | ||
* @return CidTypeInterface | ||
*/ | ||
public function setActive($active); | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function getActive(); | ||
} |
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,47 @@ | ||
<?php | ||
/** | ||
* Customer Identification Document | ||
* | ||
* @category Mugar | ||
* @package Mugar_CustomerIdentificationDocument | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Mugar (https://www.mugar.io/) | ||
* | ||
*/ | ||
|
||
namespace Mugar\CustomerIdentificationDocument\Api\Data; | ||
|
||
use Magento\Framework\Api\SearchCriteriaInterface; | ||
|
||
/** | ||
* @api | ||
*/ | ||
interface CidTypeSearchResultInterface | ||
{ | ||
/** | ||
* get items | ||
* | ||
* @return \Mugar\CustomerIdentificationDocument\Api\Data\CidTypeInterface[] | ||
*/ | ||
public function getItems(); | ||
|
||
/** | ||
* Set items | ||
* | ||
* @param \Mugar\CustomerIdentificationDocument\Api\Data\CidTypeInterface[] $items | ||
* @return $this | ||
*/ | ||
public function setItems(array $items); | ||
|
||
/** | ||
* @param SearchCriteriaInterface $searchCriteria | ||
* @return $this | ||
*/ | ||
public function setSearchCriteria(SearchCriteriaInterface $searchCriteria); | ||
|
||
/** | ||
* @param int $count | ||
* @return $this | ||
*/ | ||
public function setTotalCount($count); | ||
} |
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,24 @@ | ||
<?php | ||
/** | ||
* Customer Identification Document | ||
* | ||
* @category Mugar | ||
* @package Mugar_CustomerIdentificationDocument | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Mugar (https://www.mugar.io/) | ||
* | ||
*/ | ||
|
||
namespace Mugar\CustomerIdentificationDocument\Api; | ||
|
||
/** | ||
* @api | ||
*/ | ||
interface ExecutorInterface | ||
{ | ||
/** | ||
* execute | ||
* @param int $id | ||
*/ | ||
public function execute($id); | ||
} |
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,48 @@ | ||
<?php | ||
/** | ||
* Customer Identification Document | ||
* | ||
* @category Mugar | ||
* @package Mugar_CustomerIdentificationDocument | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Mugar (https://www.mugar.io/) | ||
* | ||
*/ | ||
|
||
namespace Mugar\CustomerIdentificationDocument\Block\Adminhtml\Button; | ||
|
||
use Magento\Framework\UrlInterface; | ||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class Back implements ButtonProviderInterface | ||
{ | ||
/** | ||
* @var UrlInterface | ||
*/ | ||
private $url; | ||
|
||
/** | ||
* Back constructor. | ||
* @param UrlInterface $url | ||
*/ | ||
public function __construct( | ||
UrlInterface $url | ||
) { | ||
$this->url = $url; | ||
} | ||
|
||
/** | ||
* get button data | ||
* | ||
* @return array | ||
*/ | ||
public function getButtonData() | ||
{ | ||
return [ | ||
'label' => __('Back'), | ||
'on_click' => sprintf("location.href = '%s';", $this->url->getUrl('*/*/')), | ||
'class' => 'back', | ||
'sort_order' => 10, | ||
]; | ||
} | ||
} |
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,94 @@ | ||
<?php | ||
/** | ||
* Customer Identification Document | ||
* | ||
* @category Mugar | ||
* @package Mugar_CustomerIdentificationDocument | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Mugar (https://www.mugar.io/) | ||
* | ||
*/ | ||
|
||
namespace Mugar\CustomerIdentificationDocument\Block\Adminhtml\Button\CidType; | ||
|
||
use Magento\Framework\UrlInterface; | ||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
use Mugar\CustomerIdentificationDocument\Api\Data\CidTypeInterface; | ||
use Mugar\CustomerIdentificationDocument\Registry\CidType as CidTypeRegistry; | ||
|
||
class Delete implements ButtonProviderInterface | ||
{ | ||
/** | ||
* @var CidTypeRegistry | ||
*/ | ||
private $registry; | ||
|
||
/** | ||
* @var UrlInterface | ||
*/ | ||
private $url; | ||
|
||
/** | ||
* Delete constructor. | ||
* @param CidTypeRegistry $registry | ||
* @param UrlInterface $url | ||
*/ | ||
public function __construct( | ||
CidTypeRegistry $registry, | ||
UrlInterface $url | ||
) { | ||
$this->registry = $registry; | ||
$this->url = $url; | ||
} | ||
|
||
/** | ||
* get button data | ||
* | ||
* @return array | ||
*/ | ||
public function getButtonData() | ||
{ | ||
$data = []; | ||
if ($this->getCidTypeId()) { | ||
$data = [ | ||
'label' => __('Delete Document Type'), | ||
'class' => 'delete', | ||
'on_click' => 'deleteConfirm(\'' . __( | ||
'Are you sure you want to do this?' | ||
) . '\', \'' . $this->getDeleteUrl() . '\')', | ||
'sort_order' => 20, | ||
]; | ||
} | ||
return $data; | ||
} | ||
|
||
/** | ||
* @return CidTypeInterface | null | ||
*/ | ||
private function getCidType() | ||
{ | ||
return $this->registry->get(); | ||
} | ||
|
||
/** | ||
* @return int|null | ||
*/ | ||
private function getCidTypeId() | ||
{ | ||
$item = $this->getCidType(); | ||
return ($item) ? $item->getId() : null; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDeleteUrl() | ||
{ | ||
return $this->url->getUrl( | ||
'*/*/delete', | ||
[ | ||
'cid_type_id' => $this->getCidTypeId(), | ||
] | ||
); | ||
} | ||
} |
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,32 @@ | ||
<?php | ||
/** | ||
* Customer Identification Document | ||
* | ||
* @category Mugar | ||
* @package Mugar_CustomerIdentificationDocument | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Mugar (https://www.mugar.io/) | ||
* | ||
*/ | ||
|
||
namespace Mugar\CustomerIdentificationDocument\Block\Adminhtml\Button; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class Reset implements ButtonProviderInterface | ||
{ | ||
/** | ||
* get button data | ||
* | ||
* @return array | ||
*/ | ||
public function getButtonData() | ||
{ | ||
return [ | ||
'label' => __('Reset'), | ||
'class' => 'reset', | ||
'on_click' => 'location.reload();', | ||
'sort_order' => 30 | ||
]; | ||
} | ||
} |
Oops, something went wrong.