Ajustar companies_products_delete.php
This commit is contained in:
parent
95af5dbd6e
commit
8f5136e602
1 changed files with 12 additions and 12 deletions
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
/** Importação de classes */
|
||||
use vendor\model\ClientProducts;
|
||||
use vendor\controller\client_products\ClientProductsValidate;
|
||||
use vendor\model\ProductsCompanies;
|
||||
use vendor\controller\companies_products\CompaniesProductsValidate;
|
||||
|
||||
try{
|
||||
|
||||
|
|
@ -10,33 +10,33 @@ try{
|
|||
if($Main->verifyToken()){
|
||||
|
||||
/** Instânciamento de classes */
|
||||
$ClientProducts = new ClientProducts();
|
||||
$ClientProductsValidate = new ClientProductsValidate();
|
||||
$ProductsCompanies = new ProductsCompanies();
|
||||
$CompaniesProductsValidate = new CompaniesProductsValidate();
|
||||
|
||||
/** Parametros de entrada */
|
||||
$ClientProductsId = isset($_POST['client_product_id']) ? (int)filter_input(INPUT_POST,'client_product_id', FILTER_SANITIZE_NUMBER_INT) : 0;
|
||||
$clientsId = isset($_POST['clients_id']) ? (int)filter_input(INPUT_POST, 'clients_id', FILTER_SANITIZE_NUMBER_INT) : 0;
|
||||
$CompanyProductId = isset($_POST['company_product_id']) ? (int)filter_input(INPUT_POST,'company_product_id', FILTER_SANITIZE_NUMBER_INT) : 0;
|
||||
$CompanyId = isset($_POST['company_id']) ? (int)filter_input(INPUT_POST, 'company_id', FILTER_SANITIZE_NUMBER_INT) : 0;
|
||||
|
||||
/** Validando os campos de entrada */
|
||||
$ClientProductsValidate->setClientProductId($ClientProductsId);
|
||||
$ClientProductsValidate->setClientsId($clientsId);
|
||||
$CompaniesProductsValidate->setCompanyProductId($CompanyProductId);
|
||||
$CompaniesProductsValidate->setCompanyId($CompanyId);
|
||||
|
||||
/** Verifico a existência de erros */
|
||||
if (!empty($ClientProductsValidate->getErrors())) {
|
||||
if (!empty($CompaniesProductsValidate->getErrors())) {
|
||||
|
||||
/** Informo */
|
||||
throw new InvalidArgumentException($ClientProductsValidate->getErrors(), 0);
|
||||
throw new InvalidArgumentException($CompaniesProductsValidate->getErrors(), 0);
|
||||
|
||||
} else {
|
||||
|
||||
/** Salva as alterações ou cadastra um novo registro */
|
||||
if($ClientProducts->Delete($ClientProductsValidate->getClientProductId())){
|
||||
if($ProductsCompanies->Delete($CompaniesProductsValidate->getCompanyProductId())){
|
||||
|
||||
|
||||
$procedure = '<script type="text/javascript">';
|
||||
$procedure .= '$(document).ready(function(e) {';
|
||||
$procedure .= ' setTimeout(() => {';
|
||||
$procedure .= ' request(\'FOLDER=view&TABLE=client_products&ACTION=client_products_datagrid&clients_id='.$ClientProductsValidate->getClientsId().'\', \'\', true, \'\', \'\', \'#loadProducts\', \'Carregando produtos...\', \'blue\', \'circle\', \'sm\', true);';
|
||||
$procedure .= ' request(\'FOLDER=view&TABLE=products_company&ACTION=products_company_datagrid&company_id='.$CompaniesProductsValidate->getCompanyId().'\', \'\', true, \'\', \'\', \'#loadProducts\', \'Carregando produtos...\', \'blue\', \'circle\', \'sm\', true);';
|
||||
$procedure .= ' }, "2000");';
|
||||
$procedure .= '});';
|
||||
$procedure .= '</script>';
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue