mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando tabla tiradas para el editor
This commit is contained in:
@ -8,6 +8,8 @@ use App\Models\Collection;
|
||||
use App\Entities\Tarifas\TarifaEncuadernacionTirada;
|
||||
|
||||
use App\Models\Tarifas\TarifaEncuadernacionTiradaModel;
|
||||
use App\Models\Compras\ProveedorModel;
|
||||
use App\Models\Compras\ProveedorTipoModel;
|
||||
|
||||
use
|
||||
DataTables\Editor,
|
||||
@ -34,42 +36,28 @@ class Tarifaencuadernaciontiradas extends \App\Controllers\GoBaseResourceControl
|
||||
// Build our Editor instance and process the data coming from _POST
|
||||
$response = Editor::inst($db, 'tarifa_encuadernacion_tiradas')
|
||||
->fields(
|
||||
Field::inst('paginas_min')
|
||||
Field::inst('tirada_min')
|
||||
->validator('Validate::numeric', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_min.decimal'))
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_min.required'))
|
||||
),
|
||||
Field::inst('paginas_max')
|
||||
Field::inst('tirada_max')
|
||||
->validator('Validate::numeric', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_max.decimal'))
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_max.required'))
|
||||
),
|
||||
Field::inst('precio_min')
|
||||
->validator('Validate::numeric', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal'))
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required'))
|
||||
),
|
||||
Field::inst('precio_max')
|
||||
->validator('Validate::numeric', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_max.decimal'))
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.precio_max.required'))
|
||||
),
|
||||
Field::inst('margen')
|
||||
->validator('Validate::numeric', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal'))
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.margen.required'))
|
||||
),
|
||||
Field::inst('tirada_encuadernacion_id'),
|
||||
Field::inst('proveedor')
|
||||
->options( Options::inst()
|
||||
->table( 'lg_proveedores' )
|
||||
->value( 'id' )
|
||||
->label( 'nombre' )
|
||||
),
|
||||
Field::inst('tarifa_encuadernacion_id'),
|
||||
Field::inst('proveedor_id'),
|
||||
Field::inst('user_created_id'),
|
||||
Field::inst('created_at'),
|
||||
Field::inst('user_updated_id'),
|
||||
@ -78,7 +66,7 @@ class Tarifaencuadernaciontiradas extends \App\Controllers\GoBaseResourceControl
|
||||
Field::inst('deleted_at'),
|
||||
|
||||
)
|
||||
->validator(function ($editor, $action, $data) {
|
||||
/*->validator(function ($editor, $action, $data) {
|
||||
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) {
|
||||
foreach ($data['data'] as $pkey => $values) {
|
||||
// Si no se quiere borrar...
|
||||
@ -93,7 +81,7 @@ class Tarifaencuadernaciontiradas extends \App\Controllers\GoBaseResourceControl
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})*/
|
||||
->on('preCreate', function ($editor, &$values) {
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
@ -162,5 +150,29 @@ class Tarifaencuadernaciontiradas extends \App\Controllers\GoBaseResourceControl
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function menuItems()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$provTipoModel = new ProveedorTipoModel();
|
||||
$provModel = new ProveedorModel();
|
||||
|
||||
$tipoId = $provTipoModel->getTipoId("Encuadernacion");
|
||||
$provList = $provModel->getProvList($tipoId);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'data' => $provList,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user