mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado editar cliente
This commit is contained in:
@ -545,6 +545,7 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest
|
||||
$routes->post('getDatosDireccion', 'Presupuestocliente::getDatosDireccion', ['as' => 'getDatosDireccion']);
|
||||
$routes->post('getNuevaDireccion', 'Presupuestocliente::getNuevaDireccion', ['as' => 'nuevaDireccion']);
|
||||
$routes->post('guardarPresupuesto', 'Presupuestocliente::guardarPresupuesto', ['as' => 'guardarPresupuesto']);
|
||||
$routes->post('duplicarPresupuesto', 'Presupuestocliente::duplicarPresupuesto', ['as' => 'duplicarPresupuesto']);
|
||||
});
|
||||
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
@ -861,6 +861,7 @@ class Cosidotapablanda extends \App\Controllers\BaseResourceController
|
||||
$presupuesto = $this->model->find($id);
|
||||
$presupuesto->titulo = $presupuesto->titulo .' - ' . lang('Presupuestos.duplicado');
|
||||
$presupuesto->is_duplicado = 1;
|
||||
$presupuesto->estado_id = 1;
|
||||
$new_id = $this->model->insert($presupuesto);
|
||||
|
||||
$presupuestoAcabadosModel = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
|
||||
|
||||
@ -169,6 +169,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$this->obtenerPaginasColor($presupuestoEntity);
|
||||
$this->obtenerDireccionesEnvio($presupuestoEntity);
|
||||
|
||||
// Si el presupuesto está confirmado, se generan los datos del resumen
|
||||
if($presupuestoEntity->estado_id == 2){
|
||||
$this->generarResumen($presupuestoEntity);
|
||||
}
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateCosidotapablanda', $id);
|
||||
|
||||
$this->viewData['paisList'] = $this->getPaisListItems();
|
||||
@ -473,6 +478,91 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function duplicarPresupuesto(){
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$id = $reqData['id'] ?? 0;
|
||||
|
||||
if($id > 0){
|
||||
try{
|
||||
|
||||
$presupuesto = $this->model->find($id);
|
||||
$presupuesto->titulo = $presupuesto->titulo .' - ' . lang('Presupuestos.duplicado');
|
||||
$presupuesto->is_duplicado = 1;
|
||||
$presupuesto->estado_id = 1;
|
||||
$new_id = $this->model->insert($presupuesto);
|
||||
|
||||
$presupuestoAcabadosModel = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
|
||||
foreach ($presupuestoAcabadosModel->where('presupuesto_id', $presupuesto->id)->findAll() as $acabado) {
|
||||
$acabado->presupuesto_id = $new_id;
|
||||
$presupuestoAcabadosModel->insert($acabado);
|
||||
}
|
||||
|
||||
$presupuestoEncuadernacionesModel = model('App\Models\Presupuestos\PresupuestoEncuadernacionesModel');
|
||||
foreach ($presupuestoEncuadernacionesModel->where('presupuesto_id', $presupuesto->id)->findAll() as $encuadernacion) {
|
||||
$encuadernacion->presupuesto_id = $new_id;
|
||||
$presupuestoEncuadernacionesModel->insert($encuadernacion);
|
||||
}
|
||||
|
||||
$presupuestoManipuladosModel = model('App\Models\Presupuestos\PresupuestoManipuladosModel');
|
||||
foreach ($presupuestoManipuladosModel->where('presupuesto_id', $presupuesto->id)->findAll() as $manipulado) {
|
||||
$manipulado->presupuesto_id = $new_id;
|
||||
$presupuestoManipuladosModel->insert($manipulado);
|
||||
}
|
||||
|
||||
$presupuestoPreimpresionesModel = model('App\Models\Presupuestos\PresupuestoPreimpresionesModel');
|
||||
foreach ($presupuestoPreimpresionesModel->where('presupuesto_id', $presupuesto->id)->findAll() as $preimpresion) {
|
||||
$preimpresion->presupuesto_id = $new_id;
|
||||
$presupuestoPreimpresionesModel->insert($preimpresion);
|
||||
}
|
||||
|
||||
$presupuestoServiciosExtraModel = model('App\Models\Presupuestos\PresupuestoServiciosExtraModel');
|
||||
foreach ($presupuestoServiciosExtraModel->where('presupuesto_id', $presupuesto->id)->findAll() as $servicioExtra) {
|
||||
$servicioExtra->presupuesto_id = $new_id;
|
||||
$presupuestoServiciosExtraModel->insert($preimpresion);
|
||||
}
|
||||
|
||||
$presupuestoDireccionesModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
||||
foreach ($presupuestoDireccionesModel->where('presupuesto_id', $presupuesto->id)->findAll() as $direccion) {
|
||||
$direccion->presupuesto_id = $new_id;
|
||||
$presupuestoDireccionesModel->insert($direccion);
|
||||
}
|
||||
|
||||
$presupuestoLineaModel = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||
$presupuestoLineaModel->duplicateLineasPresupuesto($presupuesto->id, $new_id);
|
||||
|
||||
return $this->respond([
|
||||
'success' => true,
|
||||
'id' => $new_id,
|
||||
$csrfTokenName => $newTokenHash
|
||||
]);
|
||||
|
||||
}catch(\Exception $e){
|
||||
return $this->respond([
|
||||
'success' => false,
|
||||
'message' => $e->getMessage(),
|
||||
$csrfTokenName => $newTokenHash
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
'success' => false,
|
||||
'message' => "No existe el presupuesto",
|
||||
$csrfTokenName => $newTokenHash
|
||||
|
||||
]);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function guardarPresupuesto()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
@ -1621,6 +1711,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
$model = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
||||
$model_direcciones = model('App\Models\Clientes\ClienteDireccionesModel');
|
||||
$model_pais = model('App\Models\Configuracion\PaisModel');
|
||||
$direcciones = $model->where('presupuesto_id', $presupuestoEntity->id)->findAll();
|
||||
|
||||
$result = [];
|
||||
@ -1636,6 +1727,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$direcciones[$i]->telefono);
|
||||
if(count($direccion_id) > 0) {
|
||||
$temp = $direcciones[$i]->toArray();
|
||||
$temp['pais'] = $model_pais->where('id', $direcciones[$i]->pais_id)->first()->nombre;
|
||||
$temp['direccion_id'] = $direccion_id[0]->id;
|
||||
array_push($result, $temp);
|
||||
}
|
||||
@ -1679,4 +1771,91 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function generarResumen($presupuestoEntity){
|
||||
|
||||
$presupuestoEntity->resumen = (object)[
|
||||
'titulo' => $this->generarTitulo($presupuestoEntity),
|
||||
'tamanio' => $this->obtenerTamanio($presupuestoEntity),
|
||||
'tipo_impresion' => $this->obtenerTipoImpresion($presupuestoEntity)
|
||||
];
|
||||
|
||||
$model_papelGenerico = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
if(!is_null($presupuestoEntity->papel_interior)){
|
||||
$nombre = $model_papelGenerico->where('id', $presupuestoEntity->papel_interior)->first()->nombre;
|
||||
if($nombre != null)
|
||||
$presupuestoEntity->papel_interior_nombre = $nombre;
|
||||
}
|
||||
if(!is_null($presupuestoEntity->papel_cubierta)){
|
||||
$nombre = $model_papelGenerico->where('id', $presupuestoEntity->papel_interior)->first()->nombre;
|
||||
if($nombre != null)
|
||||
$presupuestoEntity->papel_cubierta_nombre = $nombre;
|
||||
}
|
||||
if(!is_null($presupuestoEntity->papel_sobrecubierta)){
|
||||
$nombre = $model_papelGenerico->where('id', $presupuestoEntity->papel_sobrecubierta)->first()->nombre;
|
||||
if($nombre != null)
|
||||
$presupuestoEntity->papel_sobrecubierta_nombre = $nombre;
|
||||
}
|
||||
if(!is_null($presupuestoEntity->papel_guardas)){
|
||||
$nombre = $model_papelGenerico->where('id', $presupuestoEntity->papel_guardas)->first()->nombre;
|
||||
if($nombre != null)
|
||||
$presupuestoEntity->papel_guardas_nombre = $nombre;
|
||||
}
|
||||
}
|
||||
|
||||
protected function generarTitulo($presupuestoEntity){
|
||||
|
||||
$model = model('App\Models\Configuracion\TipoPresupuestoModel');
|
||||
$codigo = $model->where('id', $presupuestoEntity->tipo_impresion_id)->first()->codigo;
|
||||
$titulo = lang('Presupuestos.titulos.'.$codigo);
|
||||
return $titulo;
|
||||
}
|
||||
|
||||
protected function obtenerTamanio($presupuestoEntity){
|
||||
|
||||
$ancho = 0;
|
||||
$alto = 0;
|
||||
|
||||
$model = model('App\Models\Presupuestos\PresupuestoModel');
|
||||
$data = $model->where('id', $presupuestoEntity->id)->first();
|
||||
|
||||
if($data != null){
|
||||
if($data->papel_formato_personalizado == 0){
|
||||
|
||||
$model_papel_formato = model('App\Models\Configuracion\PapelFormatoModel');
|
||||
$data_papel_formato = $model_papel_formato->where('id', $data->papel_formato_id)->first();
|
||||
$ancho = $data_papel_formato->ancho;
|
||||
$alto = $data_papel_formato->alto;
|
||||
}
|
||||
else{
|
||||
$ancho = $data->papel_formato_ancho;
|
||||
$alto = $data->papel_formato_alto;
|
||||
}
|
||||
}
|
||||
|
||||
return $ancho . "x" . $alto;
|
||||
}
|
||||
|
||||
protected function obtenerTipoImpresion($presupuestoEntity){
|
||||
|
||||
$id = $presupuestoEntity->id;
|
||||
|
||||
$isColor = false;
|
||||
$isHq = false;
|
||||
|
||||
$model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||
$data = $model->where('presupuesto_id', $id)->findAll();
|
||||
if (count($data) > 0) {
|
||||
foreach ($data as $linea) {
|
||||
if (strpos($linea->tipo, "hq") !== false) {
|
||||
$isHq = true;
|
||||
}
|
||||
if (strpos($linea->tipo, "color") !== false) {
|
||||
$isColor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
$tipo = "" . ($isColor ? "Color" : "Negro") . " " . ($isHq ? "premium" : "estándar");
|
||||
return $tipo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,6 +276,17 @@ return [
|
||||
'actualizacionSolapasCubierta' => 'El tamaño de las solapas de la cubierta se ha actualizado debido a que supera el máximo permitido (este valor depende del ancho del libro y del número de páginas).',
|
||||
'actualizacionSolapasSobrecubierta' => 'El tamaño de las solapas de la sobrecubierta se ha actualizado debido a que supera el máximo permitido (este valor depende del ancho del libro y del número de páginas).',
|
||||
|
||||
'titulos' => [
|
||||
'libroFresadoTapaDura' => 'Rústica Fresado tapa dura',
|
||||
'libroFresadoTapaBlanda' => 'Rústica Fresado tapa blanda',
|
||||
'libroCosidoTapaDura' => 'Rústica Cosido tapa dura',
|
||||
'libroCosidoTapaBlanda' => 'Rústica Cosido tapa blanda',
|
||||
'libroEspiralTapaDura' => 'Espiral tapa dura',
|
||||
'libroEspiralTapaBlanda' => 'Espiral tapa blanda',
|
||||
'libroWireoTapaDura' => 'Wire-o tapa dura',
|
||||
'libroWireoTapaBlanda' => 'Wire-o tapa blanda',
|
||||
'libroGrapado' => 'Grapado',
|
||||
],
|
||||
|
||||
'validation' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
|
||||
@ -7,47 +7,141 @@
|
||||
<h3>Resumen</h3>
|
||||
<div class="col-sm-6">
|
||||
<h5 class="mb-1">Libro</h5>
|
||||
<p class="mb-0"><small id="tipoLibro">Rústica cosido tapa blanda</small></p>
|
||||
<p class="mb-0"><small id="resumenTamanio">Tamaño: 100x100</small></p>
|
||||
<p class="mb-0"><small id="resumenPaginas">Número de páginas: 200</small></p>
|
||||
<p class="mb-0"><small id="resumenTirada">Tirada: 200</small></p>
|
||||
<p class="mb-0"><small id="resumenPrototipo">Prototipo: NO</small></p>
|
||||
<p class="mb-3"><small id="resumenFerro">Ferro: NO</small></p>
|
||||
<p class="mb-0"><small id="tipoLibro"><?php echo (isset($presupuestoEntity->resumen->titulo)?$presupuestoEntity->resumen->titulo:'') ?></small></p>
|
||||
<p class="mb-0"><small id="resumenTamanio">Tamaño: <?php echo (isset($presupuestoEntity->resumen->tamanio)?$presupuestoEntity->resumen->tamanio:'') ?></small></p>
|
||||
<p class="mb-0"><small id="resumenPaginas">Número de páginas: <?php echo $presupuestoEntity->paginas ?></small></p>
|
||||
<p class="mb-0"><small id="resumenTirada">Tirada: <?php echo $presupuestoEntity->tirada ?></small></p>
|
||||
<p class="mb-0"><small id="resumenPrototipo">Prototipo: <?php echo ($presupuestoEntity->prototipo?'SI':'NO') ?></small></p>
|
||||
<p class="mb-3"><small id="resumenFerro">Ferro: <?php echo ($presupuestoEntity->ferro?'SI':'NO') ?></small></p>
|
||||
|
||||
<h5 class="mb-1">Interior</h5>
|
||||
<p class="mb-0"><small id="tipoImpresion">Impresion: Negro premium</small></p>
|
||||
<p id="pResumenPaginasColor" class="mb-0" style="display:none"><small id="resumenPaginasColor">Páginas a color: 100</small></p>
|
||||
<p class="mb-3"><small id="resumenPapelInterior">Papel: Blanco Offset 70gr/m²</small></p>
|
||||
<p class="mb-0"><small id="tipoImpresion">Impresion:
|
||||
<?php echo (isset($presupuestoEntity->resumen->tipo_impresion)?$presupuestoEntity->resumen->tipo_impresion:'') ?>
|
||||
</small></p>
|
||||
<p id="pResumenPaginasColor" class="mb-0" <?php echo ($presupuestoEntity->paginasColor==0?'style="display:none"':'')?>>
|
||||
<small id="resumenPaginasColor">Páginas a color: <?php echo $presupuestoEntity->paginasColor?></small></p>
|
||||
<p class="mb-3"><small id="resumenPapelInterior">Papel:
|
||||
<?php echo (isset($presupuestoEntity->papel_interior_nombre)?$presupuestoEntity->papel_interior_nombre:'') ?>
|
||||
<?php echo (isset($presupuestoEntity->gramaje_interior)?$presupuestoEntity->gramaje_interior:'') ?>gr/m²</small></p>
|
||||
|
||||
<h5 class="mb-1">Cubierta</h5>
|
||||
<p class="mb-0"><small id="resumenPapelCubierta">Papel: Blanco Offset 70gr/m²</small></p>
|
||||
<p class="mb-0"><small id="resumenCarasCubierta">Impresión: 1 cara</small></p>
|
||||
<p class="mb-0"><small id="resumenSolapasCubierta">Solapas: 25mm</small></p>
|
||||
<p class="mb-3"><small id="resumenAcabadoCubierta">Acabado: Ninguno</small></p>
|
||||
<p class="mb-0"><small id="resumenPapelCubierta">Papel:
|
||||
<?php echo (isset($presupuestoEntity->papel_cubierta_nombre)?$presupuestoEntity->papel_cubierta_nombre:''); ?>
|
||||
<?php echo (isset($presupuestoEntity->gramaje_cubierta)?$presupuestoEntity->gramaje_cubierta:''); ?>gr/m²</small></p>
|
||||
<p class="mb-0"><small id="resumenCarasCubierta">Impresión: <?php echo ($presupuestoEntity->paginas_cubierta==2?"1 cara":"2 caras");?></small></p>
|
||||
<?php if($presupuestoEntity->solapas_ancho>0 || $presupuestoEntity->estado_id==1): ?>
|
||||
<p class="mb-0"><small id="resumenSolapasCubierta">Solapas: <?php echo $presupuestoEntity->solapas_ancho;?>mm</small></p>
|
||||
<?php endif; ?>
|
||||
<?php if($presupuestoEntity->acabado_cubierta_id>0 || $presupuestoEntity->estado_id==1): ?>
|
||||
<p class="mb-3"><small id="resumenAcabadoCubierta">Acabado:
|
||||
<?php if (isset($datosPresupuesto->acabadosCubierta) && is_array($datosPresupuesto->acabadosCubierta) && !empty($datosPresupuesto->acabadosCubierta)) :
|
||||
foreach ($datosPresupuesto->acabadosCubierta as $acabado) :
|
||||
if ($acabado->id == $presupuestoEntity->acabado_cubierta_id):
|
||||
echo $acabado->label;
|
||||
endif;
|
||||
endforeach;
|
||||
endif; ?>
|
||||
</small></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<h5 class="mb-1 resumen-sobrecubierta">Sobrecubierta</h5>
|
||||
<p class="mb-0 resumen-sobrecubierta"><small id="resumenPapelSobrecubierta">Papel: Blanco Offset 70gr/m²</small></p>
|
||||
<p class="mb-0 resumen-sobrecubierta"><small id="resumenSolapasCubierta">Ancho solapas: 25mm</small></p>
|
||||
<p class="mb-3 resumen-sobrecubierta"><small id="resumenAcabadoCubierta">Acabado: Ninguno</small></p>
|
||||
<?php if($presupuestoEntity->papel_sobrecubierta || $presupuestoEntity->estado_id==1): ?>
|
||||
<h5 class="mb-1 resumen-sobrecubierta">Sobrecubierta</h5>
|
||||
<p class="mb-0 resumen-sobrecubierta"><small id="resumenPapelSobrecubierta">Papel:
|
||||
<?php echo (isset($presupuestoEntity->papel_sobrecubierta_nombre)?$presupuestoEntity->papel_sobrecubierta_nombre:'') ?>
|
||||
<?php echo (isset($presupuestoEntity->gramaje_sobrecubierta)?$presupuestoEntity->gramaje_sobrecubierta:'') ?>gr/m²</small></p>
|
||||
<?php if($presupuestoEntity->solapas_ancho_sobrecubierta>0 || $presupuestoEntity->estado_id==1): ?>
|
||||
<p class="mb-0 resumen-sobrecubierta"><small id="resumenSolapasCubierta">Ancho solapas: <?php echo $presupuestoEntity->solapas_ancho_sobrecubierta;?>mm</small></p>
|
||||
<?php endif; ?>
|
||||
<p class="mb-3 resumen-sobrecubierta"><small id="resumenAcabadoSobrecubierta">Acabado:
|
||||
<?php if (isset($datosPresupuesto->acabadosSobrecubierta) && is_array($datosPresupuesto->acabadosSobrecubierta) && !empty($datosPresupuesto->acabadosSobrecubierta)) :
|
||||
foreach ($datosPresupuesto->acabadosSobrecubierta as $acabado) :
|
||||
if ($acabado->id == $presupuestoEntity->acabado_sobrecubierta_id):
|
||||
echo $acabado->label;
|
||||
endif;
|
||||
endforeach;
|
||||
endif; ?>
|
||||
</small></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<h5 class="mb-1 resumen-guardas">Guardas</h5>
|
||||
<p class="mb-0 resumen-guardas"><small id="resumenGuardasPapel">Papel: Blanco Offset 70gr/m²</small></p>
|
||||
<p class="mb-3 resumen-guardas"><small id="resumenGuardasCaras">Impresión: 1 cara</small></p>
|
||||
<?php if($presupuestoEntity->papel_guardas || $presupuestoEntity->estado_id==1): ?>
|
||||
<h5 class="mb-1 resumen-guardas">Guardas</h5>
|
||||
<p class="mb-0 resumen-guardas"><small id="resumenGuardasPapel">Papel:
|
||||
<?php echo (isset($presupuestoEntity->papel_guardas_nombre)?$presupuestoEntity->papel_guardas_nombre:''); ?>
|
||||
170gr/m²</small></p>
|
||||
<p class="mb-3 resumen-guardas"><small id="resumenGuardasCaras">Impresión:
|
||||
<?php if(!isset($presupuestoEntity->paginas_guardas) || $presupuestoEntity->paginas_guardas==0):
|
||||
echo "Sin impresion";
|
||||
elseif($presupuestoEntity->paginas_guardas==4):
|
||||
echo "1 cara";
|
||||
else:
|
||||
echo "2 caras";
|
||||
endif; ?></small></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<h5 class="mb-1 resumen-extras">Extras</h5>
|
||||
<p class="mb-0 resumen-extras" id="resumenRetractilado1"><small>Retractilado individual</small></p>
|
||||
<p class="mb-0 resumen-extras" id="resumenRetractilado5"><small>Retractilado de 5</small></p>
|
||||
<p class="mb-0 resumen-extras" id="resumenFajaColor"><small>Imprimir faja a color</small></p>
|
||||
<?php if($presupuestoEntity->retractiladol || $presupuestoEntity->retractilado5 || $presupuestoEntity->faja_color || $presupuestoEntity->estado_id==1): ?>
|
||||
<h5 class="mb-1 resumen-extras">Extras</h5>
|
||||
<?php endif; ?>
|
||||
<?php if($presupuestoEntity->retractiladol): ?>
|
||||
<p class="mb-0 resumen-extras" id="resumenRetractilado1"><small>Retractilado individual</small></p>
|
||||
<?php elseif ($presupuestoEntity->retractilado5): ?>
|
||||
<p class="mb-0 resumen-extras" id="resumenRetractilado5"><small>Retractilado de 5</small></p>
|
||||
<?php elseif ($presupuestoEntity->faja_color): ?>
|
||||
<p class="mb-0 resumen-extras" id="resumenFajaColor"><small>Imprimir faja a color</small></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<h4 id="resumenTotalIVA" class="mb-1">Total: 100€</h4>
|
||||
<h6 id="resumenPrecioU" class="mb-0">10.4€/ud</h6>
|
||||
|
||||
<?php if($presupuestoEntity->estado_id==2):
|
||||
$total = $presupuestoEntity->total_aceptado;
|
||||
$iva = $presupuestoEntity->iva_reducido?1.04:1.21;
|
||||
$total *= $iva;
|
||||
$total_unidad = $total / $presupuestoEntity->tirada;
|
||||
echo '<h4 id="resumenTotalIVA" class="mb-1">Total: ' . round($total, 2) . '€</h4>';
|
||||
echo '<h6 id="resumenPrecioU" class="mb-0">' . round($total_unidad, 4) . '€/ud</h6>'
|
||||
?>
|
||||
<?php else: ?>
|
||||
<h4 id="resumenTotalIVA" class="mb-1">Total: 100€</h4>
|
||||
<h6 id="resumenPrecioU" class="mb-0">10.4€/ud</h6>
|
||||
<?php endif; ?>
|
||||
<div id="shape-container">
|
||||
<div id="pv_ec_shape" style="width:95%;height:550px;margin:2.5% auto;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($presupuestoEntity->estado_id==2):
|
||||
echo '<div class="row mb-3">';
|
||||
echo '<h3>Direcciones de envío</h3>';
|
||||
echo '<div class="col-sm-6">';
|
||||
if(isset($presupuestoEntity->direcciones_envio)):
|
||||
foreach ($presupuestoEntity->direcciones_envio as $direccion):
|
||||
echo '<div class="row mb-3">';
|
||||
echo '<div class="col-sm-5 form-check custom-option custom-option-basic checked">';
|
||||
echo '<label class="form-check-label custom-option-content">';
|
||||
echo '<span class="custom-option-header mb-2">';
|
||||
echo '<h6 class="fw-semibold mb-0">' . $direccion['att'] . '</h6>';
|
||||
echo '<span class="badge bg-label-primary">' . $direccion['cantidad'] . ' unidades</span>';
|
||||
echo '</span>';
|
||||
echo '<span class="custom-option-body">';
|
||||
echo '<small>' . $direccion['direccion'] . '</small><br>';
|
||||
echo '<small>' . $direccion['cp'] . '</small><br>';
|
||||
echo '<small>' . $direccion['municipio'] .', ' . $direccion['pais'] . '</small><br>';
|
||||
echo '<small>' . $direccion['telefono'] . '</small><br>';
|
||||
echo '<small>' . $direccion['email'] . '</small><br>';
|
||||
if($direccion['entregaPieCalle'] == 1){
|
||||
echo '<small><i>Envío en palets</i></small><br>';
|
||||
}
|
||||
echo '<hr class="my-2">';
|
||||
echo '</span>';
|
||||
echo '</label>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
@ -59,5 +153,6 @@ window.total_unidad = <?= $presupuestoEntity->total_precio_unidad ?>;
|
||||
window.iva_reducido= <?= $presupuestoEntity->iva_reducido ?>;
|
||||
window.routes_resumen = {
|
||||
guardarPresupuesto: "<?= route_to('guardarPresupuesto') ?>",
|
||||
duplicarPresupuesto: "<?= route_to('duplicarPresupuesto') ?>",
|
||||
}
|
||||
<?= $this->endSection() ?>
|
||||
@ -44,7 +44,7 @@ function generarResumen(){
|
||||
$('#resumenSolapasCubierta').text('Solapas: No')
|
||||
}
|
||||
|
||||
if ($('.enable-sobrecubierta').is(':visible')) {
|
||||
if ($('#enableSobrecubierta').is(':checked')) {
|
||||
$(".resumen-sobrecubierta").show();
|
||||
$('#resumenPapelCubierta').text($('#papelSobrecubierta option:selected').text().trim() + ' ' +
|
||||
$('#gramajeSobrecubierta option:selected').text() + 'gr/m²');
|
||||
@ -56,7 +56,8 @@ function generarResumen(){
|
||||
$(".resumen-sobrecubierta").hide();
|
||||
}
|
||||
|
||||
if ($('.guardas').is(':visible')) {
|
||||
if ($('#divGuardas').css('display') != 'none') {
|
||||
|
||||
$(".resumen-guardas").show();
|
||||
$('#resumenGuardasPapel').text($('#papelGuardas option:selected').text().trim() + ' ' + '170gr/m²');
|
||||
$('#resumenGuardasCaras').text('Impresión: ' + $('#impresionGuardas option:selected').text())
|
||||
@ -145,6 +146,41 @@ $('#btnConfirm').on('click', function() {
|
||||
|
||||
});
|
||||
|
||||
$('#btnDuplicar').on('click', function() {
|
||||
|
||||
const paths = window.location.pathname.split("/").filter(path => path !== "");
|
||||
let id=0;
|
||||
if(paths.length > 0 && paths[paths.length - 2] == 'edit'){
|
||||
id=paths[paths.length - 1];
|
||||
}
|
||||
datos = {
|
||||
id: id,
|
||||
}
|
||||
datos = Object.assign(datos, window.token_ajax)
|
||||
|
||||
$('#loader').show();
|
||||
|
||||
$.ajax({
|
||||
url: window.routes_resumen.duplicarPresupuesto,
|
||||
type: 'POST',
|
||||
data: datos,
|
||||
success: function(response) {
|
||||
|
||||
if(Object.keys(response).length > 0) {
|
||||
if(response.success){
|
||||
$('#loader').hide();
|
||||
window.location.href = document.location.origin + '/presupuestos/presupuestocliente/edit/' + response.id;
|
||||
}
|
||||
}
|
||||
$('#loader').hide();
|
||||
|
||||
},
|
||||
error: function() {
|
||||
$('#loader').hide();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#btnBack').on('click', function() {
|
||||
window.location.href = document.location.origin + '/presupuestocliente/list';
|
||||
@ -241,7 +277,7 @@ function finalizarPresupuesto(confirmar){
|
||||
tirada: tirada,
|
||||
peso: peso_libro,
|
||||
iva_reducido: $('#ivaReducido').val()==1?1:0,
|
||||
confirmar: confirmar,
|
||||
confirmar: confirmar?1:0,
|
||||
},
|
||||
|
||||
datos = Object.assign(datos, window.token_ajax)
|
||||
|
||||
@ -172,7 +172,7 @@ theTable = $('#tableOfPresupuestos').DataTable({
|
||||
}
|
||||
],
|
||||
stateSave: false,
|
||||
order: [[1, 'asc']],
|
||||
order: [[1, 'desc']],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
|
||||
@ -22,9 +22,6 @@
|
||||
|
||||
<?php if($presupuestoEntity->estado_id==1): ?>
|
||||
<div class="step active" data-target="#tipo-libro">
|
||||
<?php else: ?>
|
||||
<div class="step" data-target="#tipo-libro">
|
||||
<?php endif; ?>
|
||||
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
||||
<span class="bs-stepper-circle"><i class="ti ti-book ti-sm"></i></span>
|
||||
<span class="bs-stepper-label">
|
||||
@ -56,13 +53,9 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if($presupuestoEntity->estado_id==1): ?>
|
||||
<div class="step" data-target="#resumen-libro">
|
||||
<?php else: ?>
|
||||
<div class="step active" data-target="#resumen-libro">
|
||||
<?php endif; ?>
|
||||
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
||||
<span class="bs-stepper-circle"><i class="ti ti-checkbox ti-sm"></i></span>
|
||||
<span class="bs-stepper-label">
|
||||
@ -91,9 +84,6 @@
|
||||
<!-- Tipo Libro -->
|
||||
<?php if($presupuestoEntity->estado_id==1): ?>
|
||||
<div id="tipo-libro" class="content active dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
<?php else: ?>
|
||||
<div id="tipo-libro" class="content dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="row g-3">
|
||||
|
||||
@ -149,14 +139,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Review & Complete -->
|
||||
<?php if($presupuestoEntity->estado_id==1): ?>
|
||||
<div id="resumen-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
<?php else: ?>
|
||||
<div id="resumen-libro" class="content active fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
<?php endif; ?>
|
||||
<div class="row g-3">
|
||||
|
||||
<?= view("themes/vuexy/form/presupuestos/cliente/_resumenItems") ?>
|
||||
@ -177,7 +163,7 @@
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Guardar</span>
|
||||
<i class="ti ti-arrow-right ti-xs"></i>
|
||||
</button>
|
||||
<button id="btnConfirm" class="btn btn-success btn-submit btn-next mx-2 waves-effect waves-light">
|
||||
<button id="btnConfirm" class="btn btn-success btn-submit btn-next mx-2 waves-effect waves-light ml-2">
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Confirmar</span><i class="ti ti-check ti-xs"></i>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
@ -185,6 +171,11 @@
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Volver</span><i class="ti ti-check ti-xs"></i>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<button id="btnDuplicar" class="btn btn-primary btn-submit waves-effect waves-light ml-2">
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Duplicar</span>
|
||||
<i class="ti ti-copy ti-xs"></i>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
13857
xdebug.log
13857
xdebug.log
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user