mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en datoslibro
This commit is contained in:
@ -570,6 +570,7 @@ $routes->group('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos
|
||||
$routes->get('list/(:num)', 'Presupuestoadmin::list/$1', ['as' => 'presupuestoAdminList']); // HOMOGENIZAR CON ARGS DINAMICOS!!!
|
||||
$routes->get('add/(:num)', 'Presupuestoadmin::add/$1', ['as' => 'newPresupuestoAdmin']);
|
||||
$routes->get('edit/(:any)', 'Presupuestoadmin::edit/$1', ['as' => 'editarPresupuestoAdmin']);
|
||||
$routes->get('cargar/(:any)', 'Presupuestoadmin::cargar/$1');
|
||||
$routes->post('add/(:num)', 'Presupuestoadmin::add/$1', ['as' => 'createPresupuestoAdmin']);
|
||||
$routes->post('create', 'Presupuestoadmin::create', ['as' => 'ajaxCreatePresupuestoAdmin']);
|
||||
$routes->put('(:num)/update', 'Presupuestoadmin::update/$1', ['as' => 'ajaxUpdatePresupuestoAdmin']);
|
||||
|
||||
@ -6,6 +6,8 @@ use App\Entities\Presupuestos\PresupuestoEntity;
|
||||
use App\Models\Collection;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Models\Configuracion\PapelGenericoModel;
|
||||
use App\Models\Configuracion\PapelFormatoModel;
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Configuracion\PapelImpresionModel;
|
||||
use App\Models\Configuracion\TipoPresupuestoModel;
|
||||
use App\Models\Presupuestos\PresupuestoAcabadosModel;
|
||||
@ -468,6 +470,123 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function cargar($id){
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$modelPapelFormato = new PapelFormatoModel();
|
||||
$modelCliente = new ClienteModel();
|
||||
|
||||
|
||||
$presupuesto = $this->model->find($id);
|
||||
$data = [];
|
||||
if ($presupuesto) {
|
||||
|
||||
$data['lc'] = $presupuesto->lomo_cubierta;
|
||||
$data['lsc'] = $presupuesto->lomo_sobrecubierta;
|
||||
$data['tipo_impresion'] = $presupuesto->tipo_impresion_id;
|
||||
$data['cosido'] = $presupuesto->cosido;
|
||||
|
||||
$data['datosGenerales']['id'] = $presupuesto->id;
|
||||
$data['datosGenerales']['state'] = intval($presupuesto->estado_id);
|
||||
$data['datosGenerales']['updated_at'] = date('d/m/Y', strtotime($presupuesto->updated_at));
|
||||
$data['datosGenerales']['created_at'] = date('d/m/Y', strtotime($presupuesto->created_at));
|
||||
$data['datosGenerales']['inc_rei'] = $presupuesto->inc_rei == null ? 0 : $presupuesto->inc_rei;
|
||||
$data['datosGenerales']['titulo'] = $presupuesto->titulo;
|
||||
$data['datosGenerales']['autor'] = $presupuesto->autor;
|
||||
$data['datosGenerales']['coleccion'] = $presupuesto->coleccion;
|
||||
$data['datosGenerales']['numero_edicion'] = $presupuesto->numero_edicion;
|
||||
$data['datosGenerales']['isbn'] = $presupuesto->isbn;
|
||||
$data['datosGenerales']['pais'] = $presupuesto->pais_id;
|
||||
$data['datosGenerales']['cliente']['id'] = $presupuesto->cliente_id;
|
||||
$data['datosGenerales']['cliente']['nombre'] = $modelCliente->getNombre($presupuesto->cliente_id);
|
||||
$data['datosGenerales']['referenciaCliente'] = $presupuesto->referencia_cliente;
|
||||
|
||||
/*
|
||||
model('App\Models\Clientes\ClienteModel')
|
||||
->find($presupuesto->cliente_id)->nombre;
|
||||
$data['datosGenerales']['papelFormatoId'] = $presupuesto->papel_formato_id;
|
||||
$data['datosGenerales']['papelFormatoNombre'] = $modelPapelFormato->getNombre($presupuesto->papel_formato_id);
|
||||
$data['datosGenerales']['papelFormatoPersonalizado'] = $presupuesto->papel_formato_personalizado;
|
||||
$data['datosGenerales']['papelFormatoAncho'] = $presupuesto->papel_formato_ancho;
|
||||
$data['datosGenerales']['papelFormatoAlto'] = $presupuesto->papel_formato_alto;
|
||||
|
||||
$data['datosGenerales']['posPaginasColor'] = $presupuesto->comp_pos_paginas_color;
|
||||
$data['datosGenerales']['papelInteriorDiferente'] = $presupuesto->papel_interior_diferente;
|
||||
$data['datosGenerales']['paginasColorConsecutivas'] = $presupuesto->paginas_color_consecutivas;
|
||||
|
||||
$data['datosGenerales']['tipo'] = $this->getTipoLibro($presupuesto->tipo_impresion_id ?? null);
|
||||
$data['datosGenerales']['prototipo'] = $presupuesto->prototipo;
|
||||
$data['datosGenerales']['ferro'] = $presupuesto->ferro;
|
||||
$data['datosGenerales']['ferroDigital'] = $presupuesto->ferro_digital;
|
||||
$data['datosGenerales']['marcapaginas'] = $presupuesto->marcapaginas;
|
||||
$data['datosGenerales']['retractilado'] = $presupuesto->retractilado;
|
||||
$data['datosGenerales']['retractilado5'] = $presupuesto->retractilado5;
|
||||
|
||||
$datos_papel = $this->obtenerDatosPapel($presupuesto->id);
|
||||
$data['interior'] = $datos_papel['interior'] ? $datos_papel['interior'] : [];
|
||||
|
||||
$data['cubierta'] = $datos_papel['cubierta'] ? $datos_papel['cubierta'] : [];
|
||||
$data['cubierta']['tapa'] = $this->obtenerTipoTapa($presupuesto->tipo_impresion_id ?? null);
|
||||
$data['cubierta']['lomoRedondo'] = $presupuesto->lomo_redondo ? 1 : 0;
|
||||
$data['cubierta']['solapas'] = $presupuesto->solapas ? 1 : 0;
|
||||
$data['cubierta']['solapas_ancho'] = $presupuesto->solapas_ancho;
|
||||
$data['cubierta']['cabezada'] = $presupuesto->cabezada;
|
||||
$modelAcabado = model("App\Models\Tarifas\Acabados\TarifaAcabadoModel");
|
||||
$data['cubierta']['acabado']['id'] = $presupuesto->acabado_cubierta_id;
|
||||
if ($presupuesto->acabado_cubierta_id == 0) {
|
||||
$data['cubierta']['acabado']['text'] = "Ninguno";
|
||||
} else {
|
||||
$data['cubierta']['acabado']['text'] = $modelAcabado->find($presupuesto->acabado_cubierta_id)->nombre;
|
||||
}
|
||||
$data['cubierta']['retractilado'] = $presupuesto->retractilado ? 1 : 0;
|
||||
|
||||
$data['sobrecubierta'] = array_key_exists('sobrecubierta', $datos_papel) ? $datos_papel['sobrecubierta'] : [];
|
||||
$data['sobrecubierta']['solapas'] = $presupuesto->solapas_sobrecubierta ? 1 : 0;
|
||||
$data['sobrecubierta']['solapas_ancho'] = $presupuesto->solapas_ancho_sobrecubierta;
|
||||
$data['sobrecubierta']['acabado']['id'] = $presupuesto->acabado_sobrecubierta_id;
|
||||
if ($presupuesto->acabado_sobrecubierta_id == 0) {
|
||||
$data['sobrecubierta']['acabado']['text'] = "Ninguno";
|
||||
} else {
|
||||
$data['sobrecubierta']['acabado']['text'] = $modelAcabado->find($presupuesto->acabado_sobrecubierta_id)->nombre;
|
||||
}
|
||||
|
||||
$data['guardas'] = array_key_exists('guardas', $datos_papel) ? $datos_papel['guardas'] : [];
|
||||
|
||||
$modelLinea = new PresupuestoLineaModel();
|
||||
$lineas = $modelLinea->where('presupuesto_id', $id)->findAll();
|
||||
|
||||
[$data['datosGenerales']['paginasNegro'], $data['datosGenerales']['paginasColor']] =
|
||||
$this->getPaginas($lineas);
|
||||
|
||||
if (intval($presupuesto->envios_recoge_cliente) == 1) {
|
||||
$data['direcciones']['entrega_taller'] = 1;
|
||||
} else {
|
||||
$data['direcciones']['entrega_taller'] = 0;
|
||||
$data['direcciones'] = $this->obtenerDireccionesEnvio($id, $presupuesto->cliente_id);
|
||||
}
|
||||
|
||||
if (intval($presupuesto->estado_id) == 2) {
|
||||
$data['resumen']['base'] = $presupuesto->total_aceptado;
|
||||
$data['resumen']['precio_unidad'] = $presupuesto->total_precio_unidad;
|
||||
}
|
||||
|
||||
$tiradas_alternativas = json_decode($presupuesto->tirada_alternativa_json_data);
|
||||
if (!is_null($tiradas_alternativas)) {
|
||||
for ($i = 0; $i < count($tiradas_alternativas); $i++) {
|
||||
$tirada = $tiradas_alternativas[$i];
|
||||
$data['datosGenerales']['tirada' . ($i + 2)] = $tirada->tirada;
|
||||
}
|
||||
}*/
|
||||
|
||||
return $this->respond([
|
||||
'status' => 1,
|
||||
'data' => $data
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
<label for="paginas" class="form-label">
|
||||
<?= lang('Presupuestos.paginas') ?>*
|
||||
</label>
|
||||
<input type="number" id="paginas" name="paginas" tabindex="1" maxLength="11" class="form-control" value="<?= old('paginas', $presupuestoEntity->paginas) ?>" <?php echo ($tipo_impresion_id == 21)?' max=80':'' ?>>
|
||||
<input type="number" id="paginas" name="paginas" tabindex="1" maxLength="11" class="form-control" value="" <?php echo ($tipo_impresion_id == 21)?' max=80':'' ?>>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div>
|
||||
@ -30,7 +30,7 @@
|
||||
<label for="tirada" class="form-label">
|
||||
<?= lang('Presupuestos.tirada') ?>*
|
||||
</label>
|
||||
<input type="number" id="tirada" name="tirada" tabindex="2" maxLength="11" class="form-control" value="<?= old('tirada', $presupuestoEntity->tirada) ?>">
|
||||
<input type="number" id="tirada" name="tirada" tabindex="2" maxLength="11" class="form-control" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div><!--//.col -->
|
||||
@ -42,27 +42,19 @@
|
||||
<?= lang('Presupuestos.papelFormatoId') ?>*
|
||||
</label>
|
||||
|
||||
<select id="papelFormatoId" <?= $presupuestoEntity->papel_formato_personalizado == false ? '' : 'style="display: none"'; ?> name="papel_formato_id" tabindex="3" class="form-control select2bs2" style="width: 100%;">
|
||||
|
||||
<?php if (isset($papelFormatoList) && is_array($papelFormatoList) && !empty($papelFormatoList)) :
|
||||
foreach ($papelFormatoList as $formato) : ?>
|
||||
<option value="<?= $formato->id ?>" <?= $formato->id == $presupuestoEntity->papel_formato_id ? ' selected' : '' ?>>
|
||||
<?= $formato->tamanio ?>
|
||||
</option>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
<select id="papelFormatoId" name="papel_formato_id" tabindex="3" class="form-control select2bs2" style="width: 100%;">
|
||||
</select>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="mb-1">
|
||||
<input <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?> type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="0.01" class="form-control formato_libro" value="<?= old('papel_formato_ancho', $presupuestoEntity->papel_formato_ancho) ?>">
|
||||
<input type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="0.01" class="form-control formato_libro" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="mb-1">
|
||||
<input <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?> type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="0.01" class="form-control formato_libro" value="<?= old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
|
||||
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="0.01" class="form-control formato_libro" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
</div>
|
||||
@ -76,7 +68,7 @@
|
||||
<label for="merma" class="form-label">
|
||||
<?= lang('Presupuestos.merma') ?>*
|
||||
</label>
|
||||
<input readonly style="background: #E8E8E8;" id="merma" name="merma" maxLength="8" tabindex="4" step="1" placeholder="10" class="form-control" value="<?= old('merma', $presupuestoEntity->merma) ?>">
|
||||
<input readonly style="background: #E8E8E8;" id="merma" name="merma" maxLength="8" tabindex="4" step="1" placeholder="10" class="form-control" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -85,7 +77,7 @@
|
||||
<label for="mermacubierta" class="form-label">
|
||||
<?= lang('Presupuestos.mermacubierta') ?>*
|
||||
</label>
|
||||
<input readonly style="background: #E8E8E8;" id="mermacubierta" name="merma_cubierta" tabindex="5" placeholder="10" maxLength="8" step="1" class="form-control" value="<?= old('merma_cubierta', $presupuestoEntity->merma_cubierta) ?>">
|
||||
<input readonly style="background: #E8E8E8;" id="mermacubierta" name="merma_cubierta" tabindex="5" placeholder="10" maxLength="8" step="1" class="form-control" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -96,37 +88,33 @@
|
||||
<!-- Fila 2 -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<?php if($tipo_impresion_id != 1 && $tipo_impresion_id != 3 && $tipo_impresion_id != 5 && $tipo_impresion_id != 7): ?>
|
||||
<div class="row">
|
||||
<div class="row impresion-con-solapas">
|
||||
<div class="mb-1">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input solapas_cubierta" type="checkbox" id="solapas" name="solapas" tabindex="6" value="1" <?= $presupuestoEntity->solapas == true ? 'checked' : ''; ?>>
|
||||
<input class="form-check-input solapas_cubierta" type="checkbox" id="solapas" name="solapas" tabindex="6" value="1">
|
||||
<label class="form-check-label" for="solapas"><?= lang('Presupuestos.solapasCubierta') ?></label>
|
||||
</div>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<?php if ($tipo_impresion_id != 5 && $tipo_impresion_id != 6 && $tipo_impresion_id != 7 && $tipo_impresion_id != 8 && $tipo_impresion_id != 21) : ?>
|
||||
<div class="row">
|
||||
<div class="mb-1">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input solapas_sobrecubierta" type="checkbox" id="solapas_sobrecubierta" name="solapas_sobrecubierta" tabindex="6" value="1" <?= $presupuestoEntity->solapas_sobrecubierta == true ? 'checked' : ''; ?>>
|
||||
<label class="form-check-label" for="solapas_sobrecubierta"><?= lang('Presupuestos.solapasSobrecubierta') ?></label>
|
||||
</div>
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="row impresion-con-solapas">
|
||||
<div class="mb-1">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input solapas_sobrecubierta" type="checkbox" id="solapas_sobrecubierta" name="solapas_sobrecubierta" tabindex="6" value="1">
|
||||
<label class="form-check-label" for="solapas_sobrecubierta"><?= lang('Presupuestos.solapasSobrecubierta') ?></label>
|
||||
</div>
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<div class="row">
|
||||
<div class="mb-1">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="papelFormatoPersonalizado" name="papel_formato_personalizado" value="1" <?= $presupuestoEntity->papel_formato_personalizado == true ? 'checked' : ''; ?>>
|
||||
<input class="form-check-input" type="checkbox" id="papelFormatoPersonalizado" name="papel_formato_personalizado" value="1">
|
||||
<label class="form-check-label" for="papelFormatoPersonalizado"><?= lang('Presupuestos.papelFormatoPersonalizado') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
@ -136,35 +124,24 @@
|
||||
|
||||
<!-- Fila 3 -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<?php if($tipo_impresion_id != 1 && $tipo_impresion_id != 3 && $tipo_impresion_id != 5 && $tipo_impresion_id != 7): ?>
|
||||
<?php if($presupuestoEntity->solapas == true): ?>
|
||||
<div class="mb-1" id="div_solapas_ancho">
|
||||
<?php else: ?>
|
||||
<div class="mb-1" id="div_solapas_ancho" style="display:none;">
|
||||
<?php endif; ?>
|
||||
|
||||
<label for="solapas_ancho" class="form-label">
|
||||
<?= lang('Presupuestos.solapasAnchoCubierta') ?>*
|
||||
</label>
|
||||
<input type="number" id="solapas_ancho" name="solapas_ancho" placeholder="0" maxLength="8" step="1" class="form-control solapas_cubierta" value="<?= old('solapas_ancho', $presupuestoEntity->solapas_ancho) ?>">
|
||||
</div><!--//.mb-1 -->
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<?php if ($tipo_impresion_id != 5 && $tipo_impresion_id != 6 && $tipo_impresion_id != 7 && $tipo_impresion_id != 8 && $tipo_impresion_id != 21) : ?>
|
||||
<?php if($presupuestoEntity->solapas_sobrecubierta == true): ?>
|
||||
<div class="mb-1" id="div_solapas_ancho_sobrecubierta">
|
||||
<?php else: ?>
|
||||
<div class="mb-1" id="div_solapas_ancho_sobrecubierta" style="display:none;">
|
||||
<?php endif; ?>
|
||||
<label for="solapas_ancho_sobrecubierta" class="form-label">
|
||||
<?= lang('Presupuestos.solapasAnchoSobrecubierta') ?>*
|
||||
</label>
|
||||
<input type="number" id="solapas_ancho_sobrecubierta" name="solapas_ancho_sobrecubierta" placeholder="0" maxLength="8" step="1" class="form-control solapas_sobrecubierta" value="<?= old('solapas_ancho', $presupuestoEntity->solapas_ancho_sobrecubierta) ?>">
|
||||
</div><!--//.mb-1 -->
|
||||
<?php endif; ?>
|
||||
<div class="mb-1 impresion-con-solapas" id="div_solapas_ancho">
|
||||
<label for="solapas_ancho" class="form-label">
|
||||
<?= lang('Presupuestos.solapasAnchoCubierta') ?>*
|
||||
</label>
|
||||
<input type="number" id="solapas_ancho" name="solapas_ancho" placeholder="0" maxLength="8" step="1" class="form-control solapas_cubierta" value="">
|
||||
</div><!--//.mb-1 -->
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<div class="mb-1 impresion-con-solapas" id="div_solapas_ancho_sobrecubierta">
|
||||
<label for="solapas_ancho_sobrecubierta" class="form-label">
|
||||
<?= lang('Presupuestos.solapasAnchoSobrecubierta') ?>*
|
||||
</label>
|
||||
<input type="number" id="solapas_ancho_sobrecubierta" name="solapas_ancho_sobrecubierta" placeholder="0" maxLength="8" step="1" class="form-control solapas_sobrecubierta" value="">
|
||||
</div><!--//.mb-1 -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -187,44 +164,24 @@
|
||||
<?= lang('Presupuestos.acabadoCubierta') ?>*
|
||||
</label>
|
||||
<select id="acabado_cubierta_id" name="acabado_cubierta_id" tabindex="3" class="form-control select2bs2" style="width: 100%;">
|
||||
<?php if (isset($acabadosCubierta) && is_array($acabadosCubierta) && !empty($acabadosCubierta)) :
|
||||
foreach ($acabadosCubierta as $acabado) : ?>
|
||||
<option value="<?= $acabado->id ?>" <?= $acabado->id == $presupuestoEntity->acabado_cubierta_id ? ' selected' : '' ?>>
|
||||
<?= $acabado->label ?>
|
||||
</option>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<?php if ($tipo_impresion_id != 5 && $tipo_impresion_id != 6 && $tipo_impresion_id != 7 && $tipo_impresion_id != 8 && $tipo_impresion_id != 21) : ?>
|
||||
<div class="row">
|
||||
<div class="mb-1">
|
||||
<label id="label_acabado_cubierta_id" for="acabado_sobrecubierta_id" class="form-label">
|
||||
<?= lang('Presupuestos.acabadoSobrecubierta') ?>*
|
||||
</label>
|
||||
<select id="acabado_sobrecubierta_id" name="acabado_sobrecubierta_id" tabindex="3" class="form-control select2bs2" style="width: 100%;">
|
||||
<?php if (isset($acabadosSobrecubierta) && is_array($acabadosSobrecubierta) && !empty($acabadosSobrecubierta)) :
|
||||
foreach ($acabadosSobrecubierta as $acabado) : ?>
|
||||
<option value="<?= $acabado->id ?>" <?= $acabado->id == $presupuestoEntity->acabado_sobrecubierta_id ? ' selected' : '' ?>>
|
||||
<?= $acabado->label ?>
|
||||
</option>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row impresion-con-sobrecubierta">
|
||||
<div class="mb-1">
|
||||
<label id="label_acabado_cubierta_id" for="acabado_sobrecubierta_id" class="form-label">
|
||||
<?= lang('Presupuestos.acabadoSobrecubierta') ?>*
|
||||
</label>
|
||||
<select id="acabado_sobrecubierta_id" name="acabado_sobrecubierta_id" tabindex="3" class="form-control select2bs2" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!----------------------------------------------------------------------------->
|
||||
<div class="divider divider-dark text-start mb-1">
|
||||
<div class="divider-text">
|
||||
@ -237,7 +194,7 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="retractilado" class="form-check-label">
|
||||
<input type="checkbox" id="retractilado" name="retractilado" value="1" class="form-check-input" <?= $presupuestoEntity->retractilado == true ? 'checked' : ''; ?>>
|
||||
<input type="checkbox" id="retractilado" name="retractilado" value="1" class="form-check-input" >
|
||||
<?= lang('Presupuestos.retractilado') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
@ -248,7 +205,7 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="retractilado5" class="form-check-label">
|
||||
<input type="checkbox" id="retractilado5" name="retractilado_5" value="1" class="form-check-input" <?= $presupuestoEntity->retractilado5 == true ? 'checked' : ''; ?>>
|
||||
<input type="checkbox" id="retractilado5" name="retractilado_5" value="1" class="form-check-input" >
|
||||
<?= lang('Presupuestos.retractilado5') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
@ -260,7 +217,7 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="fajaColor" class="form-check-label">
|
||||
<input type="checkbox" id="fajaColor" name="faja_color" value="1" class="form-check-input" <?= $presupuestoEntity->faja_color == true ? 'checked' : ''; ?>>
|
||||
<input type="checkbox" id="fajaColor" name="faja_color" value="1" class="form-check-input">
|
||||
<?= lang('Presupuestos.fajaColor') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
@ -271,7 +228,7 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="prototipo" class="form-check-label">
|
||||
<input type="checkbox" id="prototipo" name="prototipo" value="1" class="form-check-input" <?= $presupuestoEntity->prototipo == true ? 'checked' : ''; ?>>
|
||||
<input type="checkbox" id="prototipo" name="prototipo" value="1" class="form-check-input" >
|
||||
<?= lang('Presupuestos.prototipo') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
@ -291,7 +248,7 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="ferro" class="form-check-label">
|
||||
<input type="checkbox" id="ferro" name="ferro" value="1" class="form-check-input" <?= $presupuestoEntity->ferro == true ? 'checked' : ''; ?>>
|
||||
<input type="checkbox" id="ferro" name="ferro" value="1" class="form-check-input" >
|
||||
<?= lang('Presupuestos.ferro') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
@ -303,7 +260,7 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="ferroDigital" class="form-check-label">
|
||||
<input type="checkbox" id="ferroDigital" name="ferro_digital" value="1" class="form-check-input" <?= $presupuestoEntity->ferro_digital == true ? 'checked' : ''; ?>>
|
||||
<input type="checkbox" id="ferroDigital" name="ferro_digital" value="1" class="form-check-input">
|
||||
<?= lang('Presupuestos.ferroDigital') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
@ -314,7 +271,7 @@
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="marcapaginas" class="form-check-label">
|
||||
<input type="checkbox" id="marcapaginas" name="marcapaginas" value="1" class="form-check-input" <?= $presupuestoEntity->marcapaginas == true ? 'checked' : ''; ?>>
|
||||
<input type="checkbox" id="marcapaginas" name="marcapaginas" value="1" class="form-check-input" >
|
||||
<?= lang('Presupuestos.marcapaginas') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<label for="id" class="form-label">
|
||||
<?= lang('Presupuestos.id') ?>
|
||||
</label>
|
||||
<input readonly style="background: #E8E8E8;" id="id" name="id" maxLength="12" class="form-control" value="<?= old('id', $presupuestoEntity->id) ?>">
|
||||
<input readonly style="background: #E8E8E8;" id="id" name="id" maxLength="12" class="form-control" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
<?= lang('Presupuestos.created_at') ?>
|
||||
</label>
|
||||
<?php if(str_contains($formAction,'edit')): ?>
|
||||
<input readonly style="background: #E8E8E8;" id="updated_at" name="updated_at" maxLength="12" class="form-control" value="<?= old('created_at', (isset($presupuestoEntity->updated_at)) ? date ('d/m/Y', strtotime($presupuestoEntity->updated_at)) : "") ?>">
|
||||
<input readonly style="background: #E8E8E8;" id="updated_at" name="updated_at" maxLength="12" class="form-control" value="">
|
||||
<?php else: ?>
|
||||
<input readonly style="background: #E8E8E8;" id="created_at" name="created_at" maxLength="12" class="form-control" value="<?= old('created_at', (isset($presupuestoEntity->created_at)) ? date ('d/m/Y', strtotime($presupuestoEntity->created_at)) : "") ?>">
|
||||
<input readonly style="background: #E8E8E8;" id="created_at" name="created_at" maxLength="12" class="form-control" value="">
|
||||
<?php endif; ?>
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
@ -38,11 +38,11 @@
|
||||
<label for="estado_id" class="form-label">
|
||||
<?= lang('Presupuestos.presupuestoEstado') ?>
|
||||
</label>
|
||||
<select disabled id="estado_id" name="estado_id" maxLength="11" style="background-color: #E8E8E8;" class="form-control" value="<?= old(1, $presupuestoEntity->estado_id) ?>">
|
||||
<option value=1 <?= $presupuestoEntity->estado_id==1? ' selected':''?>>
|
||||
<select disabled id="estado_id" name="estado_id" maxLength="11" style="background-color: #E8E8E8;" class="form-control select2bs" value="">
|
||||
<option value=1 >
|
||||
<?=lang('Presupuestos.presupuestoEstadoBorrador') ?>
|
||||
</option>
|
||||
<option value=2 <?= $presupuestoEntity->estado_id==2? ' selected':''?>>
|
||||
<option value=2 >
|
||||
<?=lang('Presupuestos.presupuestoEstadoAceptado') ?>
|
||||
</option>
|
||||
</select>
|
||||
@ -54,15 +54,11 @@
|
||||
<label for="incRei" class="form-label">
|
||||
<?= lang('Presupuestos.incRei') ?>
|
||||
</label>
|
||||
<select id="incRei" name="inc_rei" maxLength="11" class="form-control" value="<?= old('inc_rei', $presupuestoEntity->inc_rei) ?>">
|
||||
<?php if (isset($incReiList) && is_array($incReiList) && !empty($incReiList)) : ?>
|
||||
<option> </option>
|
||||
<?php foreach ($incReiList as $k => $v) : ?>
|
||||
<option value="<?= $k ?>" <?= $k == $presupuestoEntity->inc_rei ? ' selected' : '' ?>>
|
||||
<?= $v ?>
|
||||
</option>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
<select id="incRei" name="inc_rei" maxLength="11" class="form-control select2bs" value="">
|
||||
<option value="0">No</option>
|
||||
<option value="incidencia">Incidencia</option>
|
||||
<option value="reimpresion">Reimpresion</option>
|
||||
<option value="sin_cargo">Sin cargo</option>
|
||||
</select>
|
||||
|
||||
</div><!--//.mb-3 -->
|
||||
@ -77,7 +73,7 @@
|
||||
<label for="titulo" class="form-label">
|
||||
<?=lang('Presupuestos.titulo') ?>*
|
||||
</label>
|
||||
<input type="text" id="titulo" name="titulo" maxLength="300" class="form-control" value="<?=old('titulo', $presupuestoEntity->titulo) ?>">
|
||||
<input type="text" id="titulo" name="titulo" maxLength="300" class="form-control" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -87,7 +83,7 @@
|
||||
<label for="autor" class="form-label">
|
||||
<?=lang('Presupuestos.autor') ?>
|
||||
</label>
|
||||
<input type="text" id="autor" name="autor" maxLength="150" class="form-control" value="<?=old('autor', $presupuestoEntity->autor) ?>">
|
||||
<input type="text" id="autor" name="autor" maxLength="150" class="form-control" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -101,7 +97,7 @@
|
||||
<label for="coleccion" class="form-label">
|
||||
<?=lang('Presupuestos.coleccion') ?>
|
||||
</label>
|
||||
<input type="text" id="coleccion" name="coleccion" maxLength="255" class="form-control" value="<?=old('coleccion', $presupuestoEntity->coleccion) ?>">
|
||||
<input type="text" id="coleccion" name="coleccion" maxLength="255" class="form-control" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
@ -110,7 +106,7 @@
|
||||
<label for="numeroEdicion" class="form-label">
|
||||
<?=lang('Presupuestos.numeroEdicion') ?>
|
||||
</label>
|
||||
<input type="text" id="numeroEdicion" name="numero_edicion" maxLength="50" class="form-control" value="<?=old('numero_edicion', $presupuestoEntity->numero_edicion) ?>">
|
||||
<input type="text" id="numeroEdicion" name="numero_edicion" maxLength="50" class="form-control" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
@ -119,7 +115,7 @@
|
||||
<label for="isbn" class="form-label">
|
||||
<?=lang('Presupuestos.isbn') ?>
|
||||
</label>
|
||||
<input type="text" id="isbn" name="isbn" maxLength="50" class="form-control" value="<?=old('isbn', $presupuestoEntity->isbn) ?>">
|
||||
<input type="text" id="isbn" name="isbn" maxLength="50" class="form-control" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
@ -131,7 +127,7 @@
|
||||
<select id="paisId" name="pais_id" class="form-control select2bs" style="width: 100%;" >
|
||||
<option value=""><?=lang('Basic.global.pleaseSelectA', [lang('Presupuestos.paisId')]) ?></option>
|
||||
<?php foreach ($paisList as $item) : ?>
|
||||
<option value="<?=$item->id ?>"<?=$item->id==$presupuestoEntity->pais_id ? ' selected':'' ?>>
|
||||
<option value="<?=$item->id ?>">
|
||||
<?=$item->nombre ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
@ -150,14 +146,6 @@
|
||||
<?= lang('Presupuestos.clienteId') ?>*
|
||||
</label>
|
||||
<select id="clienteId" name="cliente_id" class="form-control select2bs2" style="width: 100%;">
|
||||
|
||||
<?php if (isset($clienteList) && is_array($clienteList) && !empty($clienteList)) :
|
||||
foreach ($clienteList as $k => $v) : ?>
|
||||
<option value="<?= $k ?>" <?= $k == $presupuestoEntity->cliente_id ? ' selected' : '' ?>>
|
||||
<?= $v ?>
|
||||
</option>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
</select>
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
@ -167,7 +155,7 @@
|
||||
<label for="referenciaCliente" class="form-label">
|
||||
<?=lang('Presupuestos.referenciaCliente') ?>
|
||||
</label>
|
||||
<input type="text" id="referenciaCliente" name="referencia_cliente" maxLength="100" class="form-control" value="<?=old('referencia_cliente', $presupuestoEntity->referencia_cliente) ?>">
|
||||
<input type="text" id="referenciaCliente" name="referencia_cliente" maxLength="100" class="form-control" value="">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
|
||||
@ -10,21 +10,27 @@
|
||||
<div class="col-12">
|
||||
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
||||
<form id="presupuestoForm" class="card-body" method="post" action="<?= $formAction ?>">
|
||||
|
||||
<?= csrf_field() ?>
|
||||
|
||||
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
||||
<?= view("themes/vuexy/form/presupuestos/cliente/loader") ?>
|
||||
|
||||
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||
<input type="hidden" name="presupuesto_id" id="presupuesto_id" class="form-control"
|
||||
value="<?= $presupuestoEntity->id ?>"></input>
|
||||
<input type="hidden" name="tipo_impresion_id" id="tipo_impresion_id" class="form-control"
|
||||
value="<?= $tipo_impresion_id ?>"></input>
|
||||
<input type="hidden" name="lomo_cubierta" id="lomo_cubierta" class="form-control"
|
||||
value="<?= is_null($presupuestoEntity->lomo_cubierta)?0:$presupuestoEntity->lomo_cubierta ?>"></input>
|
||||
<input type="hidden" name="lomo_cubierta" id="lomo_cubierta" class="form-control" value=""></input>
|
||||
<input type="hidden" name="lomo_sobrecubierta" id="lomo_sobrecubierta" class="form-control"
|
||||
value="<?= is_null($presupuestoEntity->lomo_sobrecubierta)?0:$presupuestoEntity->lomo_sobrecubierta ?>"></input>
|
||||
<input type="hidden" name="isCosido" id="isCosido" class="form-control"
|
||||
value="<?= $isCosido ?>"></input>
|
||||
|
||||
<input type="hidden" name="presupuesto_id" id="presupuesto_id" class="form-control"
|
||||
value="<?= $presupuestoEntity->id ?>"></input>
|
||||
|
||||
<input type="hidden" name="POD" id="POD" class="form-control"
|
||||
value="<?= $POD ?>"></input>
|
||||
|
||||
<?= view("themes/vuexy/form/presupuestos/admin/_datosPresupuestoItems") ?>
|
||||
<?= view("themes/vuexy/form/presupuestos/admin/_datosLibroItems") ?>
|
||||
<?php if (str_contains($formAction, 'edit')): ?>
|
||||
@ -168,98 +174,13 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#clienteId').select2({
|
||||
allowClear: false,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfClientes") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
|
||||
data: function(params) {
|
||||
return {
|
||||
id: 'id',
|
||||
text: 'nombre',
|
||||
searchTerm: params.term,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
},
|
||||
delay: 60,
|
||||
processResults: function(response) {
|
||||
yeniden(response.<?= csrf_token() ?>);
|
||||
return {
|
||||
results: response.menu
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
}
|
||||
});
|
||||
|
||||
/*******************************
|
||||
* Inicialización de los Select2
|
||||
*******************************/
|
||||
$('#incRei').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
$('#paisId').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<!------------------------------------------------------->
|
||||
<!-- Código JS para detectar cambios en el presupuesto -->
|
||||
<!------------------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
$(window).on('load', function() {
|
||||
|
||||
// Detectar cambios en inputs de texto
|
||||
$('input[type="text"]').on('input', function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en inputs de texto
|
||||
$('input[type="number"]').on('input', function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en select
|
||||
$('select').change(function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en checkboxes
|
||||
$('input[type="checkbox"]').change(function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en textareas
|
||||
$('textarea').on('input', function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en otros tipos de input
|
||||
$('input[type="radio"]').change(function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en otros tipos de input
|
||||
$('input:not([type])').on('input', function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#bc-save').on( "click", function() {
|
||||
showBreadCrumbSaveButton(false);
|
||||
$('#saveForm').click()
|
||||
} );
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Acciones antes de submit... -->
|
||||
@ -370,6 +291,7 @@ $('#bc-save').on( "click", function() {
|
||||
<link rel="stylesheet" href="<?= site_url("themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/pages/app-chat.css') ?>">
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/sk-datatables.css') ?>">
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/presupuestoCliente.css') ?>">
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
@ -393,5 +315,9 @@ $('#bc-save').on( "click", function() {
|
||||
<script src="<?= site_url('js_loader/datosServicios_js') ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
|
||||
|
||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js') ?>"></script>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -0,0 +1,162 @@
|
||||
import { getToken } from '../../common/common.js';
|
||||
import Ajax from '../../components/ajax.js';
|
||||
|
||||
import DatosGenerales from './sections/datosGenerales.js';
|
||||
import DatosLibro from './sections/datosLibro.js';
|
||||
|
||||
class PresupuestoAdminEdit {
|
||||
|
||||
constructor() {
|
||||
|
||||
this.domItem = $('#presupuestoForm');
|
||||
|
||||
this.csrf_token = getToken();
|
||||
this.csrf_hash = $('#presupuestoForm').find('input[name="' + this.csrf_token + '"]').val();
|
||||
|
||||
this.lc = $("#lomo_cubierta");
|
||||
this.lsc = $("#lomo_sobrecubierta");
|
||||
this.cosido = $("#isCosido");
|
||||
this.tipo_impresion = $("#tipo_impresion_id");
|
||||
this.cosido = $("#isCosido");
|
||||
|
||||
this.datosGenerales = new DatosGenerales(this.domItem.find('#accordionDatosPresupuestoTip'));
|
||||
this.datosLibro = new DatosLibro(this.domItem.find('#accordionDatosPresupuestoTip'));
|
||||
|
||||
this.calcularPresupuesto = false;
|
||||
}
|
||||
|
||||
init() {
|
||||
|
||||
// Fuerza el foco en el campo de búsqueda de select2
|
||||
$(document).on('select2:open', () => {
|
||||
document.querySelector('.select2-search__field').focus();
|
||||
});
|
||||
|
||||
this.datosGenerales.init();
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
|
||||
setTimeout(() => {
|
||||
this.#cargarPresupuesto();
|
||||
}, 0);
|
||||
|
||||
const successMessage = sessionStorage.getItem('message');
|
||||
if (successMessage) {
|
||||
popSuccessAlert(successMessage);
|
||||
sessionStorage.removeItem('message');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#cargarPresupuesto() {
|
||||
|
||||
const self = this;
|
||||
|
||||
$('#loader').modal('show');
|
||||
let id = window.location.href.split("/").pop()
|
||||
new Ajax('/presupuestoadmin/cargar/' + id,
|
||||
{},
|
||||
{},
|
||||
(response) => {
|
||||
|
||||
if (response.status === 1) {
|
||||
|
||||
self.lc.val(parseFloat(response.data.lc).toFixed(2));
|
||||
self.lsc.val(parseFloat(response.data.lsc).toFixed(2));
|
||||
self.cosido.val(response.data.cosido);
|
||||
self.tipo_impresion.val(response.data.tipo_impresion);
|
||||
|
||||
self.calcularPresupuesto = false;
|
||||
|
||||
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||
|
||||
/*self.direcciones.handleChangeCliente();
|
||||
|
||||
self.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
||||
|
||||
self.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente);
|
||||
self.disenioCubierta.cargarDatos(response.data.cubierta, response.data.guardas, response.data.sobrecubierta);
|
||||
*/
|
||||
setTimeout(() => {
|
||||
|
||||
$('#loader').modal('hide');
|
||||
|
||||
if (response.data.state != 2) {
|
||||
|
||||
self.calcularPresupuesto = true;
|
||||
}
|
||||
|
||||
}, 0);
|
||||
|
||||
// Funciones para detectar cambios en el formulario
|
||||
this.#checkChangesPresupuesto();
|
||||
$('#bc-save').on("click", function () {
|
||||
showBreadCrumbSaveButton(false);
|
||||
$('#saveForm').trigger('click');
|
||||
});
|
||||
}
|
||||
},
|
||||
() => {
|
||||
$('#loader').modal('hide');
|
||||
this.calcularPresupuesto = true;
|
||||
}
|
||||
).get();
|
||||
}
|
||||
|
||||
#checkChangesPresupuesto() {
|
||||
// Detectar cambios en inputs de texto
|
||||
$('input[type="text"]').on('change', function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en inputs de texto
|
||||
$('input[type="number"]').on('change', function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en select
|
||||
$('select').on('change', function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
$('.select2bs').on('change', function (e) {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en checkboxes
|
||||
$('input[type="checkbox"]').change(function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en textareas
|
||||
$('textarea').on('input', function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en otros tipos de input
|
||||
$('input[type="radio"]').change(function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en otros tipos de input
|
||||
$('input:not([type])').on('input', function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
||||
|
||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Maquinas'] }, {},
|
||||
function (translations) {
|
||||
window.language = JSON.parse(translations);
|
||||
new PresupuestoAdminEdit().init();
|
||||
},
|
||||
function (error) {
|
||||
console.log("Error getting translations:", error);
|
||||
}
|
||||
).post();
|
||||
});
|
||||
@ -0,0 +1,56 @@
|
||||
import ClassSelect from '../../../components/select2.js';
|
||||
|
||||
class DatosGenerales{
|
||||
|
||||
constructor(domItem){
|
||||
|
||||
this.domItem = domItem;
|
||||
|
||||
this.id = this.domItem.find('#id');
|
||||
this.fecha = this.domItem.find('#updated_at');
|
||||
this.estado = this.domItem.find('#estado_id');
|
||||
this.inc_rei = this.domItem.find('#incRei');
|
||||
this.titulo = this.domItem.find('#titulo');
|
||||
this.autor = this.domItem.find('#autor');
|
||||
this.coleccion = this.domItem.find('#coleccion');
|
||||
this.numeroEdicion = this.domItem.find('#numeroEdicion');
|
||||
this.isbn = this.domItem.find('#isbn');
|
||||
this.pais = this.domItem.find('#paisId');
|
||||
|
||||
this.cliente = new ClassSelect($('#clienteId'), '/clientes/cliente/getSelect2', 'Seleccione cliente');
|
||||
this.referenciaCliente = this.domItem.find('#referenciaCliente');
|
||||
|
||||
}
|
||||
|
||||
init(){
|
||||
|
||||
this.cliente.init();
|
||||
|
||||
this.inc_rei.select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
this.pais.select2({
|
||||
allowClear: false,
|
||||
});
|
||||
}
|
||||
|
||||
cargarDatos(datos){
|
||||
|
||||
this.id.val(datos.id);
|
||||
this.fecha.val(datos.updated_at);
|
||||
this.estado.val(datos.state);
|
||||
this.inc_rei.val(datos.inc_rei).trigger('change');
|
||||
this.titulo.val(datos.titulo);
|
||||
this.autor.val(datos.autor);
|
||||
this.coleccion.val(datos.coleccion);
|
||||
this.numeroEdicion.val(datos.numero_edicion);
|
||||
this.isbn.val(datos.isbn);
|
||||
this.pais.val(datos.pais).trigger('change');
|
||||
|
||||
this.cliente.setOption(datos.cliente.id, datos.cliente.nombre);
|
||||
this.referenciaCliente.val(datos.referenciaCliente);
|
||||
}
|
||||
}
|
||||
|
||||
export default DatosGenerales;
|
||||
@ -0,0 +1,55 @@
|
||||
class DatosLibro {
|
||||
|
||||
constructor(domItem) {
|
||||
|
||||
this.domItem = domItem;
|
||||
|
||||
this.paginas = this.domItem.find('#paginas');
|
||||
this.tirada = this.domItem.find('#tirada');
|
||||
this.tamanio = this.domItem.find('#papelFormatoId');
|
||||
this.tamanioPersonalizado = this.domItem.find('#papelFormatoPersonalizado');
|
||||
this.anchoPersonalizado = this.domItem.find('#papelFormatoAncho');
|
||||
this.altoPersonalizado = this.domItem.find('#papelFormatoAlto');
|
||||
this.merma = this.domItem.find('#merma');
|
||||
this.mermaCubierta = this.domItem.find('#mermaCubierta');
|
||||
this.solapasCubierta = this.domItem.find('#solapas');
|
||||
this.solapasSobrecubierta = this.domItem.find('#solapas_sobrecubierta');
|
||||
this.anchoSolapasCubierta = this.domItem.find('#anchoSolapasCubierta');
|
||||
this.anchoSolapasSobrecubierta = this.domItem.find('#anchoSolapasSobrecubierta');
|
||||
|
||||
this.divSolapasCubierta = this.domItem.find('#div_solapas_ancho');
|
||||
this.divSolapasSobrecubierta = this.domItem.find('#div_solapas_ancho_sobrecubierta');
|
||||
|
||||
this.acabadoCubierta = this.domItem.find('#acabado_cubierta_id');
|
||||
this.acabadoSobrecubierta = this.domItem.find('#acabado_sobrecubierta_id');
|
||||
|
||||
this.retractilado = this.domItem.find('#retractilado');
|
||||
this.retractilado5 = this.domItem.find('#retractilado5');
|
||||
this.imprimirFajaColor = this.domItem.find('#imprimirFajaColor');
|
||||
this.prototipo = this.domItem.find('#prototipo');
|
||||
this.ferro = this.domItem.find('#ferro');
|
||||
this.ferroDigital = this.domItem.find('#ferroDigital');
|
||||
this.marcapaginas = this.domItem.find('#marcapaginas');
|
||||
|
||||
}
|
||||
|
||||
init() {
|
||||
|
||||
}
|
||||
|
||||
cargarDatos(datos) {
|
||||
|
||||
if ($('#tipo_impresion_id').val() == 1 || $('#tipo_impresion_id').val() == 3 ||
|
||||
$('#tipo_impresion_id').val() == 5 || $('#tipo_impresion_id').val() == 7) {
|
||||
$(".impresion-con-solapas").addClass('d-none');
|
||||
}
|
||||
|
||||
if ($('#tipo_impresion_id').val() == 5 || $('#tipo_impresion_id').val() == 6 ||
|
||||
$('#tipo_impresion_id').val() == 7 || $('#tipo_impresion_id').val() == 8
|
||||
|| $('#tipo_impresion_id').val() == 21) {
|
||||
$(".impresion-con-sobrecubierta").addClass('d-none');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default DatosLibro;
|
||||
Reference in New Issue
Block a user