mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando
This commit is contained in:
@ -313,6 +313,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
$data_input = $this->request->getGet();
|
||||
$result = $this->papelService->getTiposPalelGenerico((object)$data_input);
|
||||
|
||||
foreach ($result as $key => $value) {
|
||||
$result[$key]->texto = strtoupper(lang('PapelGenerico.' . $value->nombre));
|
||||
}
|
||||
|
||||
return $this->respond($result);
|
||||
} else {
|
||||
@ -325,110 +328,13 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null;
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
$tapa_dura = goSanitize($this->request->getGet('tapa_dura'))[0] ?? null;
|
||||
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
|
||||
$guardas = goSanitize($this->request->getGet('guardas'))[0] ?? 0;
|
||||
|
||||
$ancho = floatval($this->request->getGet('ancho') ?? 0);
|
||||
$alto = floatval($this->request->getGet('alto') ?? 0);
|
||||
$solapas = floatval($this->request->getGet('solapas') ?? 0);
|
||||
$lomo = floatval($this->request->getGet('lomo') ?? 0);
|
||||
|
||||
$forSelect2 = intval($this->request->getGet('forSelect2') ?? 0);
|
||||
|
||||
$anchoLibro = $ancho;
|
||||
|
||||
if(intval($cubierta) == 1 || intval($sobrecubierta) == 1){
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
}
|
||||
|
||||
$menu = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $guardas, $selected_papel, $tapa_dura, false, $POD, $anchoLibro, $alto, $tirada);
|
||||
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $guardas, $selected_papel, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
|
||||
if ($forSelect2) {
|
||||
$menu = array_map(function ($item) {
|
||||
if (isset($item->id)) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'name' => $item->nombre
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'id' => $item->gramaje,
|
||||
'name' => $item->gramaje
|
||||
];
|
||||
}
|
||||
}, $menu);
|
||||
|
||||
return $this->respond($menu);
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'papeles' => $menu,
|
||||
'papeles_especiales' => $menu2,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
$data_input = $this->request->getGet();
|
||||
$result = $this->papelService->getPapelGenerico((object)$data_input);
|
||||
|
||||
return $this->respond($result);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function selectPapelEspecial()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
|
||||
|
||||
$ancho = floatval($this->request->getGet('ancho') ?? 0);
|
||||
$alto = floatval($this->request->getGet('alto') ?? 0);
|
||||
$solapas = floatval($this->request->getGet('solapas') ?? 0);
|
||||
$lomo = floatval($this->request->getGet('lomo') ?? 0);
|
||||
|
||||
$tapa_dura = $this->request->getGet('tapa_dura') ?? 0;
|
||||
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
|
||||
$items = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, false, null, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
$items = array_map(function ($item) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'name' => $item->nombre
|
||||
];
|
||||
}, $items);
|
||||
return $this->response->setJSON($items);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,6 +72,8 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
$this->tpModel = new PapelImpresionTipologiaModel();
|
||||
$this->validation = service("validation");
|
||||
|
||||
$this->papelService = service('papel');
|
||||
|
||||
// Breadcrumbs
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
@ -473,6 +475,22 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getGramajeCliente(){
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$data_input = $this->request->getGet();
|
||||
$result = $this->papelService->getGramajes((object)$data_input);
|
||||
|
||||
return $this->respond($result);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function papel_impresion_select()
|
||||
{
|
||||
$q = $this->request->getGet('q');
|
||||
|
||||
@ -3452,31 +3452,37 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$return_data['interior']['negro']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
|
||||
$return_data['interior']['negro']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['interior']['negro']['gramaje'] = $linea->gramaje;
|
||||
$return_data['interior']['negro']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_color' || $linea->tipo == 'lp_colorhq' || $linea->tipo == 'lp_rot_color') {
|
||||
$return_data['interior']['color']['tipo'] = $linea->tipo == 'lp_color' || $linea->tipo == 'lp_rot_color' ? 'colorEstandar' : 'colorPremium';
|
||||
$return_data['interior']['color']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
|
||||
$return_data['interior']['color']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['interior']['color']['gramaje'] = $linea->gramaje;
|
||||
$return_data['interior']['color']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_cubierta') {
|
||||
$return_data['cubierta']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
|
||||
$return_data['cubierta']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['cubierta']['gramaje'] = $linea->gramaje;
|
||||
$return_data['cubierta']['paginas'] = $linea->paginas;
|
||||
$return_data['cubierta']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_sobrecubierta') {
|
||||
$return_data['sobrecubierta']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
|
||||
$return_data['sobrecubierta']['papel_id'] = $linea->papel_id;
|
||||
$return_data['sobrecubierta']['gramaje'] = $linea->gramaje;
|
||||
$return_data['sobrecubierta']['paginas'] = $linea->paginas;
|
||||
$return_data['sobrecubierta']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_faja') {
|
||||
$return_data['faja']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
|
||||
$return_data['faja']['papel_id'] = $linea->papel_id;
|
||||
$return_data['faja']['gramaje'] = $linea->gramaje;
|
||||
$return_data['faja']['paginas'] = $linea->paginas;
|
||||
$return_data['faja']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_guardas') {
|
||||
$return_data['guardas']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
|
||||
$return_data['guardas']['papel_id'] = $linea->papel_id;
|
||||
$return_data['guardas']['gramaje'] = $linea->gramaje;
|
||||
$return_data['guardas']['paginas'] = $linea->paginas;
|
||||
$return_data['guardas']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user