mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Compare commits
39 Commits
feat/tipos
...
7bb6329783
| Author | SHA1 | Date | |
|---|---|---|---|
| 7bb6329783 | |||
| ad8e0ac75b | |||
| df21b5ba05 | |||
| 2639fe705e | |||
| 3f65c9e92a | |||
| e804aa3768 | |||
| f73472c729 | |||
| 4ffd280302 | |||
| d1cbb8eb24 | |||
| 3f6037de76 | |||
| 619fd9beba | |||
| e69503c273 | |||
| 6a3a825b26 | |||
| 1ef6d476fe | |||
| 2f6e27d4ca | |||
| 38f6656842 | |||
| d31830cf1a | |||
| f40e88ed6e | |||
| 7e7b39fc38 | |||
| 6c94858d8c | |||
| c79ae6245c | |||
| 107e66a2be | |||
| be3e9a47c2 | |||
| 45ec831f8f | |||
| 9aa7d2e0cb | |||
| 40391405eb | |||
| 7bfe9c002a | |||
| d5c51f2063 | |||
| 61d8dca583 | |||
| e257a3516e | |||
| 18b96f020b | |||
| 8a32e13eb4 | |||
| 813e5b1980 | |||
| ee9e3eb143 | |||
| 5c34316bc2 | |||
| 91f22fd3fb | |||
| bdb1d1aaec | |||
| bdc0252c72 | |||
| 47eafa75ec |
274
ci4/app/Commands/ClienteImportar.php
Normal file
274
ci4/app/Commands/ClienteImportar.php
Normal file
@ -0,0 +1,274 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use CodeIgniter\CLI\BaseCommand;
|
||||
use CodeIgniter\CLI\CLI;
|
||||
|
||||
class ClienteImportar extends BaseCommand
|
||||
{
|
||||
protected $group = 'Safekat';
|
||||
protected $name = 'cliente:importar';
|
||||
protected $description = 'Importa registros desde customers a clientes solo si no existen por ID';
|
||||
|
||||
public function run(array $params)
|
||||
{
|
||||
$db = \Config\Database::connect();
|
||||
$accion = $params[0] ?? 'todo';
|
||||
|
||||
// Mapeo de provincias
|
||||
$provincias = $db->table('lg_provincias')
|
||||
->select('id, nombre')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
$provinciaMap = [];
|
||||
foreach ($provincias as $provincia) {
|
||||
$clave = trim(mb_strtolower($provincia['nombre']));
|
||||
$provinciaMap[$clave] = $provincia['id'];
|
||||
}
|
||||
|
||||
if (in_array($accion, ['clientes', 'todo'])) {
|
||||
// ⬅️ aquí va tu bloque actual de importación de clientes
|
||||
$insertados = 0;
|
||||
$omitidos = 0;
|
||||
|
||||
CLI::write("Iniciando importación de clientes por ID...", 'yellow');
|
||||
|
||||
$clientes = $db->table('customers')
|
||||
->where('deleted_at', null)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if (empty($clientes)) {
|
||||
CLI::write('No se encontraron registros en "customers".', 'red');
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($clientes as $cliente) {
|
||||
$id = (int) $cliente['id'];
|
||||
|
||||
// Verifica si ya existe en la tabla destino
|
||||
$yaExiste = $db->table('clientes')->where('id', $id)->countAllResults();
|
||||
|
||||
if ($yaExiste) {
|
||||
$omitidos++;
|
||||
CLI::write("Cliente ID $id ya existe. Omitido.", 'blue');
|
||||
continue;
|
||||
}
|
||||
|
||||
$datos = [
|
||||
'id' => $id,
|
||||
'nombre' => $cliente['name'],
|
||||
'alias' => $cliente['alias'],
|
||||
'cif' => $cliente['cif'],
|
||||
'direccion' => $cliente['direccion'],
|
||||
'ciudad' => $cliente['ciudad'],
|
||||
'comunidad_autonoma_id' => $cliente['comunidad_autonoma_id'],
|
||||
'provincia_id' => $this->getProvinciaId($cliente['provincia'], $provinciaMap),
|
||||
'cp' => $cliente['cp'],
|
||||
'pais_id' => $cliente['pais_id'],
|
||||
'telefono' => $cliente['telefono'],
|
||||
'email' => $cliente['email'],
|
||||
'comercial_id' => 122,
|
||||
'soporte_id' => 122,
|
||||
'forma_pago_id' => ($cliente['forma_pago_id'] > 6) ? 1 : $cliente['forma_pago_id'], // Si no se reconoce fijar a transferencias
|
||||
'vencimiento' => $cliente['vencimiento'],
|
||||
'fecha_vencimiento' => $cliente['fechaVencimiento'],
|
||||
'margen' => $cliente['margen'],
|
||||
'descuento' => $cliente['descuento'],
|
||||
'limite_credito' => $cliente['limite_credito'],
|
||||
'limite_credito_user_id' => $cliente['limite_credito_user_id'],
|
||||
'limite_credito_change_at' => $cliente['limite_credito_change_at'],
|
||||
'credito_asegurado' => $cliente['creditoAsegurado'],
|
||||
'ccc' => $cliente['ccc'],
|
||||
'ccc_cliente' => $cliente['ccc_customer'],
|
||||
'num_cuenta' => $cliente['num_cuenta'],
|
||||
'message_tracking' => $cliente['message_tracking'],
|
||||
'message_production_start' => $cliente['message_production_start'],
|
||||
'tirada_flexible' => $cliente['tirada_flexible'],
|
||||
'descuento_tirada_flexible' => $cliente['descuento_tirada_flexible'],
|
||||
'comentarios_tirada_flexible' => $cliente['comentarios_tirada_flexible'],
|
||||
'margen_plantilla_id' => $cliente['margen_plantilla_id'],
|
||||
'comentarios' => $cliente['comentarios'],
|
||||
'deleted_at' => null,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
'user_created_id' => 10,
|
||||
'user_update_id' => 10,
|
||||
'no_envio_base' => 0,
|
||||
'forzar_rotativa_pod' => 0,
|
||||
];
|
||||
|
||||
try {
|
||||
$db->table('clientes')->insert($datos);
|
||||
$insertados++;
|
||||
CLI::write("Cliente ID $id insertado correctamente.", 'green');
|
||||
} catch (\Throwable $e) {
|
||||
CLI::error("❌ Error al insertar cliente ID $id: " . $e->getMessage());
|
||||
CLI::error("📦 Datos del cliente: " . json_encode($datos, JSON_PRETTY_PRINT));
|
||||
$omitidos++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
CLI::write("Importación completada.", 'green');
|
||||
CLI::write("Clientes insertados: $insertados", 'green');
|
||||
CLI::write("Clientes ya existentes: $omitidos", 'blue');
|
||||
|
||||
}
|
||||
|
||||
if (in_array($accion, ['direcciones', 'todo'])) {
|
||||
// ⬅️ aquí va tu bloque actual de importación de direcciones
|
||||
CLI::write("Iniciando importación de direcciones...", 'yellow');
|
||||
|
||||
$direcciones = $db->table('customers_address')
|
||||
->where('deleted_at', null)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
$direccionesInsertadas = 0;
|
||||
$direccionesOmitidas = 0;
|
||||
|
||||
foreach ($direcciones as $dir) {
|
||||
$clienteId = (int) $dir['customer_id'];
|
||||
|
||||
$clienteExiste = $db->table('clientes')
|
||||
->where('id', $clienteId)
|
||||
->countAllResults();
|
||||
|
||||
if (!$clienteExiste) {
|
||||
CLI::write("⚠️ Dirección ID {$dir['id']} omitida: cliente_id $clienteId no existe.", 'blue');
|
||||
$direccionesOmitidas++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$direccionExiste = $db->table('cliente_direcciones')
|
||||
->where([
|
||||
'cliente_id' => $clienteId,
|
||||
'direccion' => $dir['direccion'] ?? '',
|
||||
'cp' => $dir['cp'] ?? '0',
|
||||
'municipio' => $dir['ciudad'] ?? '',
|
||||
'provincia' => $dir['provincia'],
|
||||
])
|
||||
->countAllResults();
|
||||
|
||||
if ($direccionExiste) {
|
||||
CLI::write("⚠️ Dirección ID {$dir['id']} ya existe para cliente $clienteId. Omitida.", 'blue');
|
||||
$direccionesOmitidas++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$nuevaDir = [
|
||||
'cliente_id' => $clienteId,
|
||||
'alias' => $dir['nombre'] ?? '',
|
||||
'att' => $dir['persona_contacto'] ?? '',
|
||||
'email' => $dir['email'],
|
||||
'direccion' => $dir['direccion'] ?? '',
|
||||
'pais_id' => is_numeric($dir['pais_id']) ? (int) $dir['pais_id'] : null,
|
||||
'provincia' => $dir['provincia'],
|
||||
'municipio' => $dir['ciudad'] ?? '',
|
||||
'cp' => $dir['cp'] ?? '0',
|
||||
'telefono' => $dir['telefono'],
|
||||
];
|
||||
|
||||
try {
|
||||
$db->table('cliente_direcciones')->insert($nuevaDir);
|
||||
$direccionesInsertadas++;
|
||||
CLI::write("✅ Dirección ID {$dir['id']} insertada para cliente $clienteId", 'green');
|
||||
} catch (\Throwable $e) {
|
||||
CLI::error("❌ Error al insertar dirección ID {$dir['id']} (cliente_id $clienteId): " . $e->getMessage());
|
||||
$direccionesOmitidas++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CLI::write("Importación de direcciones finalizada.", 'green');
|
||||
CLI::write("Direcciones insertadas: $direccionesInsertadas", 'green');
|
||||
CLI::write("Direcciones omitidas: $direccionesOmitidas", 'blue');
|
||||
}
|
||||
|
||||
if (in_array($accion, ['contactos', 'todo'])) {
|
||||
CLI::write("Iniciando importación de contactos...", 'yellow');
|
||||
|
||||
$contactos = $db->table('customers_contact')
|
||||
->where('deleted_at', null)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
$contactosInsertados = 0;
|
||||
$contactosOmitidos = 0;
|
||||
|
||||
foreach ($contactos as $contacto) {
|
||||
$clienteId = (int) $contacto['customer_id'];
|
||||
|
||||
// Verificar si cliente existe
|
||||
$clienteExiste = $db->table('clientes')
|
||||
->where('id', $clienteId)
|
||||
->countAllResults();
|
||||
|
||||
if (!$clienteExiste) {
|
||||
CLI::write("⚠️ Contacto ID {$contacto['id']} omitido: cliente_id $clienteId no existe.", 'blue');
|
||||
$contactosOmitidos++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Validación para evitar duplicados básicos
|
||||
$yaExiste = $db->table('cliente_contactos')
|
||||
->where([
|
||||
'cliente_id' => $clienteId,
|
||||
'email' => $contacto['email'],
|
||||
'nombre' => $contacto['nombre']
|
||||
])
|
||||
->countAllResults();
|
||||
|
||||
if ($yaExiste) {
|
||||
CLI::write("⚠️ Contacto ID {$contacto['id']} ya existe para cliente $clienteId. Omitido.", 'blue');
|
||||
$contactosOmitidos++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$nuevoContacto = [
|
||||
'cliente_id' => $clienteId,
|
||||
'cargo' => $contacto['cargo'],
|
||||
'nombre' => $contacto['nombre'],
|
||||
'apellidos' => $contacto['apellidos'],
|
||||
'telefono' => $contacto['telefono'],
|
||||
'email' => $contacto['email'],
|
||||
'deleted_at' => null,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
|
||||
try {
|
||||
$db->table('cliente_contactos')->insert($nuevoContacto);
|
||||
$contactosInsertados++;
|
||||
CLI::write("✅ Contacto ID {$contacto['id']} insertado para cliente $clienteId", 'green');
|
||||
} catch (\Throwable $e) {
|
||||
CLI::error("❌ Error al insertar contacto ID {$contacto['id']}: " . $e->getMessage());
|
||||
$contactosOmitidos++;
|
||||
}
|
||||
}
|
||||
|
||||
CLI::write("Importación de contactos finalizada.", 'green');
|
||||
CLI::write("Contactos insertados: $contactosInsertados", 'green');
|
||||
CLI::write("Contactos omitidos: $contactosOmitidos", 'blue');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function getProvinciaId(?string $nombre, array $map): ?int
|
||||
{
|
||||
if ($nombre === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$clave = trim(mb_strtolower($nombre));
|
||||
return $map[$clave] ?? null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -37,6 +37,7 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
$routes->post('menuitems', 'Papelesgenericos::menuItems', ['as' => 'menuItemsOfPapelesGenericos']);
|
||||
$routes->get('getpapelcliente', 'Papelesgenericos::getPapelCliente', ['as' => 'getPapelCliente']);
|
||||
$routes->get('selectpapelespecial', 'Papelesgenericos::selectPapelEspecial', ['as' => 'selectPapelEspecial']);
|
||||
$routes->get('gettipopapel', 'Papelesgenericos::getTipoPapelCliente');
|
||||
});
|
||||
|
||||
/* Papeles impresion */
|
||||
|
||||
@ -11,6 +11,7 @@ use App\Services\PapelImpresionService;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use App\Services\ProductionService;
|
||||
use App\Services\TarifaMaquinaService;
|
||||
use App\Services\PapelService;
|
||||
use CodeIgniter\Email\Email;
|
||||
|
||||
/**
|
||||
@ -39,6 +40,9 @@ class Services extends BaseService
|
||||
* }
|
||||
*/
|
||||
|
||||
public static function papel(){
|
||||
return new PapelService();
|
||||
}
|
||||
public static function production(){
|
||||
return new ProductionService();
|
||||
}
|
||||
|
||||
@ -61,11 +61,13 @@ class ChatController extends BaseController
|
||||
$this->chatService = service("chat");
|
||||
|
||||
}
|
||||
public function index() {}
|
||||
public function get_chat_departments(string $model,int $modelId)
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
public function get_chat_departments(string $model, int $modelId)
|
||||
{
|
||||
|
||||
$data = $this->chatService->getChatDepartments($model,$modelId);
|
||||
$data = $this->chatService->getChatDepartments($model, $modelId);
|
||||
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
@ -250,7 +252,7 @@ class ChatController extends BaseController
|
||||
public function store_message($model)
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
$chatMessageEntity = $this->chatService->storeChatMessage($data["chat_department_id"],$model,$data["model_id"],$data);
|
||||
$chatMessageEntity = $this->chatService->storeChatMessage($data["chat_department_id"], $model, $data["model_id"], $data);
|
||||
return $this->response->setJSON($chatMessageEntity);
|
||||
|
||||
}
|
||||
@ -341,22 +343,26 @@ class ChatController extends BaseController
|
||||
}
|
||||
public function get_chat_users_internal()
|
||||
{
|
||||
$query = $this->userModel->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"CONCAT(first_name,' ',last_name,'(',username,')') as name"
|
||||
]
|
||||
)->where("cliente_id", null)
|
||||
->where("deleted_at", null)
|
||||
->whereNotIn("id", [auth()->user()->id]);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("users.username", $this->request->getGet("q"))
|
||||
->orLike("CONCAT(first_name,' ',last_name)", $this->request->getGet("q"))
|
||||
$builder = $this->userModel->builder();
|
||||
|
||||
$builder->select([
|
||||
'users.id',
|
||||
"CONCAT(first_name, ' ', last_name, ' (', auth_identities.secret, ')') AS name"
|
||||
])
|
||||
->join('auth_identities', 'auth_identities.user_id = users.id AND auth_identities.type = "email_password"')
|
||||
->where('cliente_id', null)
|
||||
->where('deleted_at', null)
|
||||
->whereNotIn('users.id', [auth()->user()->id]);
|
||||
|
||||
if ($this->request->getGet('q')) {
|
||||
$q = $this->request->getGet('q');
|
||||
$builder->groupStart()
|
||||
->orLike('auth_identities.secret', $q)
|
||||
->orLike("CONCAT(first_name, ' ', last_name)", $q)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
return $this->response->setJSON($builder->get()->getResultObject());
|
||||
}
|
||||
public function get_chat_users_all()
|
||||
{
|
||||
@ -381,7 +387,7 @@ class ChatController extends BaseController
|
||||
$pm = model(PresupuestoModel::class);
|
||||
$p = $pm->find($presupuesto_id);
|
||||
$cm = model(ClienteModel::class);
|
||||
$clienteContactos = $cm->querySelectClienteContacto($p->cliente_id,$this->request->getGet('q'));
|
||||
$clienteContactos = $cm->querySelectClienteContacto($p->cliente_id, $this->request->getGet('q'));
|
||||
return $this->response->setJSON($clienteContactos);
|
||||
}
|
||||
public function get_pedido_client_users(int $pedido_id)
|
||||
@ -389,7 +395,7 @@ class ChatController extends BaseController
|
||||
$pm = model(PedidoModel::class);
|
||||
$p = $pm->find($pedido_id);
|
||||
$cm = model(ClienteModel::class);
|
||||
$clienteContactos = $cm->querySelectClienteContacto($p->cliente()->id,$this->request->getGet('q'));
|
||||
$clienteContactos = $cm->querySelectClienteContacto($p->cliente()->id, $this->request->getGet('q'));
|
||||
return $this->response->setJSON($clienteContactos);
|
||||
}
|
||||
public function get_factura_client_users(int $factura_id)
|
||||
@ -397,7 +403,7 @@ class ChatController extends BaseController
|
||||
$fm = model(FacturaModel::class);
|
||||
$f = $fm->find($factura_id);
|
||||
$cm = model(ClienteModel::class);
|
||||
$clienteContactos = $cm->querySelectClienteContacto($f->cliente_id,$this->request->getGet('q'));
|
||||
$clienteContactos = $cm->querySelectClienteContacto($f->cliente_id, $this->request->getGet('q'));
|
||||
return $this->response->setJSON($clienteContactos);
|
||||
}
|
||||
public function get_orden_trabajo_client_users(int $orden_trabajo_id)
|
||||
@ -406,21 +412,21 @@ class ChatController extends BaseController
|
||||
$ot = $otm->find($orden_trabajo_id);
|
||||
$cm = model(ClienteModel::class);
|
||||
$cliente = $ot->pedido()->cliente();
|
||||
$clienteContactos = $cm->querySelectClienteContacto($cliente->id,$this->request->getGet('q'));
|
||||
$clienteContactos = $cm->querySelectClienteContacto($cliente->id, $this->request->getGet('q'));
|
||||
return $this->response->setJSON($clienteContactos);
|
||||
}
|
||||
public function store_hebra(string $model)
|
||||
{
|
||||
$auth_user = auth()->user();
|
||||
$bodyData = $this->request->getPost();
|
||||
$status = $this->chatService->storeHebra($model,$bodyData['modelId'],$bodyData);
|
||||
$status = $this->chatService->storeHebra($model, $bodyData['modelId'], $bodyData);
|
||||
return $this->response->setJSON(["message" => "Hebra creada correctamente", "status" => $status]);
|
||||
}
|
||||
|
||||
public function update_hebra($chat_id)
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$chatMessageId = $this->chatMessageModel->insert([
|
||||
$chatMessageId = $this->chatMessageModel->insert([
|
||||
"chat_id" => $chat_id,
|
||||
"message" => $bodyData["message"],
|
||||
"sender_id" => auth()->user()->id
|
||||
@ -441,9 +447,9 @@ class ChatController extends BaseController
|
||||
}
|
||||
return $this->response->setJSON(["message" => "Hebra actualizada correctamente", "status" => true]);
|
||||
}
|
||||
public function get_hebra(string $model,int $modelId)
|
||||
public function get_hebra(string $model, int $modelId)
|
||||
{
|
||||
$data = $this->chatService->getHebras($model,$modelId);
|
||||
$data = $this->chatService->getHebras($model, $modelId);
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
|
||||
@ -456,8 +462,8 @@ class ChatController extends BaseController
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i"))
|
||||
->edit('updated_at', fn($q) => Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i"))
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->id, $auth_user_id))
|
||||
->edit("creator", fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">' . lang("App.me") . '</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->id, $auth_user_id))
|
||||
->add("action", fn($q) => [
|
||||
"type" => "direct",
|
||||
"modelId" => $q->id,
|
||||
@ -478,12 +484,18 @@ class ChatController extends BaseController
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("action", fn($q) => ["type" => "presupuesto", "modelId" => $q->id, "isAdmin" => $isAdmin,"chatMessageId" => $q->chatMessageId, "lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]])
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->edit("creator", fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">' . lang("App.me") . '</span>' : $q->creator)
|
||||
->add("action", fn($q) => [
|
||||
"type" => "presupuesto",
|
||||
"modelId" => $q->id,
|
||||
"isAdmin" => $isAdmin,
|
||||
"chatMessageId" => $q->chatMessageId,
|
||||
"lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]
|
||||
])
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_pedido_messages()
|
||||
@ -494,12 +506,18 @@ class ChatController extends BaseController
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => ["type" => "pedido", "modelId" => $q->id, "isAdmin" => $isAdmin,"chatMessageId" => $q->chatMessageId, "lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]])
|
||||
->edit("creator", fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">' . lang("App.me") . '</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => [
|
||||
"type" => "pedido",
|
||||
"modelId" => $q->id,
|
||||
"isAdmin" => $isAdmin,
|
||||
"chatMessageId" => $q->chatMessageId,
|
||||
"lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]
|
||||
])
|
||||
|
||||
->toJson(true);
|
||||
}
|
||||
@ -511,12 +529,18 @@ class ChatController extends BaseController
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => ["type" => "factura", "modelId" => $q->id, "isAdmin" => $isAdmin,"chatMessageId" => $q->chatMessageId, "lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]])
|
||||
->edit("creator", fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">' . lang("App.me") . '</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => [
|
||||
"type" => "factura",
|
||||
"modelId" => $q->id,
|
||||
"isAdmin" => $isAdmin,
|
||||
"chatMessageId" => $q->chatMessageId,
|
||||
"lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]
|
||||
])
|
||||
|
||||
->toJson(true);
|
||||
}
|
||||
@ -528,29 +552,41 @@ class ChatController extends BaseController
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => ["type" => "ot", "modelId" => $q->id, "isAdmin" => $isAdmin,"chatMessageId" => $q->chatMessageId, "lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]])
|
||||
->edit("creator", fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">' . lang("App.me") . '</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => [
|
||||
"type" => "ot",
|
||||
"modelId" => $q->id,
|
||||
"isAdmin" => $isAdmin,
|
||||
"chatMessageId" => $q->chatMessageId,
|
||||
"lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]
|
||||
])
|
||||
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_direct_messages()
|
||||
{
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$isAdmin = auth()->user()->inGroup('admin');
|
||||
$query = $this->chatModel->getQueryDatatableDirectMessages($auth_user_id);
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => ["type" => "direct", "modelId" => $q->id, "isAdmin" => $isAdmin,"chatMessageId" => $q->chatMessageId, "lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]])
|
||||
->edit("creator", fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">' . lang("App.me") . '</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => [
|
||||
"type" => "direct",
|
||||
"modelId" => $q->id,
|
||||
"isAdmin" => $isAdmin,
|
||||
"chatMessageId" => $q->chatMessageId,
|
||||
"lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]
|
||||
])
|
||||
|
||||
->toJson(true);
|
||||
}
|
||||
@ -651,14 +687,15 @@ class ChatController extends BaseController
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$auth_user = auth()->user();
|
||||
$bodyData["sender_id"] = $auth_user->id;
|
||||
$bodyData["sender_id"] = $auth_user->id;
|
||||
$chat_message_id = $this->chatMessageModel->insert($bodyData);
|
||||
$users_id = $this->chatUserModel->getChatUserArrayId($chat_id);
|
||||
foreach ($users_id as $user_id) {
|
||||
if ($user_id != $auth_user->id) {
|
||||
$this->chatNotificationModel->insert(["chat_message_id" => $chat_message_id, "user_id" => $user_id]);
|
||||
}
|
||||
};
|
||||
}
|
||||
;
|
||||
$message = $this->chatMessageModel->get_chat_message($chat_message_id);
|
||||
return $this->response->setJSON($message);
|
||||
}
|
||||
@ -747,7 +784,7 @@ class ChatController extends BaseController
|
||||
}
|
||||
public function chat_department_edit($chat_department_id)
|
||||
{
|
||||
$chatDepartment = $this->chatDeparmentModel->find($chat_department_id);
|
||||
$chatDepartment = $this->chatDeparmentModel->find($chat_department_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => 'javascript:void(0);', 'active' => false],
|
||||
['title' => lang("App.menu_config_messages"), 'route' => route_to("configMessagesIndex"), 'active' => false],
|
||||
|
||||
@ -40,6 +40,8 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
// Se indica el flag para los ficheros borrados
|
||||
$this->delete_flag = 1;
|
||||
|
||||
$this->papelService = service('papel');
|
||||
|
||||
// Breadcrumbs (IMN)
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
@ -70,10 +72,6 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
@ -120,9 +118,11 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
endif; // $noException && $successfulResult
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
|
||||
$this->viewData['papelGenerico'] = isset($sanitizedData) ? new PapelGenerico($sanitizedData) : new PapelGenerico();
|
||||
|
||||
$this->viewData['tipoPapelGenericoList'] = $this->papelService->getTipoPapelGenerico();
|
||||
|
||||
$this->viewData['formAction'] = route_to('createPapelGenerico');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('PapelGenerico.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
@ -145,7 +145,6 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
@ -211,6 +210,8 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
$this->viewData['papelGenerico'] = $papelGenerico;
|
||||
|
||||
$this->viewData['tipoPapelGenericoList'] = $this->papelService->getTipoPapelGenerico();
|
||||
|
||||
$this->viewData['formAction'] = route_to('updatePapelGenerico', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('PapelGenerico.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
@ -300,6 +301,53 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getTipoPapelCliente(){
|
||||
|
||||
if($this->request->isAJAX()) {
|
||||
|
||||
$data_input = $this->request->getGet();
|
||||
$result = $this->papelService->getTiposPalelGenerico((object)$data_input);
|
||||
/*
|
||||
|
||||
$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);
|
||||
|
||||
$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);
|
||||
*/
|
||||
|
||||
return $this->respond($result);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getPapelCliente()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
@ -448,7 +448,9 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
'retractilado' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_retractilado')->value,
|
||||
'retractilado5' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_retractilado5')->value,
|
||||
'ferro' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_ferro')->value,
|
||||
'ferro_2' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_ferro_2')->value,
|
||||
'prototipo' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_prototipo')->value,
|
||||
'prototipo_2' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_prototipo_2')->value,
|
||||
'solapas_grandes_cubierta' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_cubierta')->value,
|
||||
'solapas_grandes_sobrecubierta' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_sobrecubierta')->value,
|
||||
'solapas_grandes_faja' => model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_plegado_exceso_solapas_faja')->value,
|
||||
@ -565,7 +567,6 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
$modelCliente = new ClienteModel();
|
||||
$modelPapelGenerico = new PapelGenericoModel();
|
||||
|
||||
|
||||
$presupuesto = $this->model->find($id);
|
||||
$data = [];
|
||||
if ($presupuesto) {
|
||||
@ -630,7 +631,9 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
$data['datosLibro']['acabadoFaja']['text'] = $modelAcabado->find($presupuesto->acabado_faja_id)->nombre;
|
||||
}
|
||||
$data['datosLibro']['prototipo'] = $presupuesto->prototipo;
|
||||
$data['datosLibro']['prototipo2'] = $this->hasPrototipo2($id);
|
||||
$data['datosLibro']['ferro'] = $presupuesto->ferro;
|
||||
$data['datosLibro']['ferro2'] = $this->hasFerro2($id);
|
||||
$data['datosLibro']['ferroDigital'] = $presupuesto->ferro_digital;
|
||||
$data['datosLibro']['marcapaginas'] = $presupuesto->marcapaginas;
|
||||
$data['datosLibro']['retractilado'] = $presupuesto->retractilado;
|
||||
@ -659,6 +662,21 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
$data['direcciones'] = $this->obtenerDireccionesEnvio($id, $presupuesto->cliente_id);
|
||||
}
|
||||
|
||||
$data['direccionesFP'] = [];
|
||||
$direccionFP1 = $this->obtenerDireccionesEnvio($id, $presupuesto->cliente_id, true, 1);
|
||||
if(count($direccionFP1) > 0){
|
||||
$data['direccionesFP']['fp1'] = $direccionFP1;
|
||||
} else {
|
||||
$data['direccionesFP']['fp1'] = [];
|
||||
}
|
||||
$direccionFP2 = $this->obtenerDireccionesEnvio($id, $presupuesto->cliente_id, true, 2);
|
||||
if(count($direccionFP2) > 0){
|
||||
$data['direccionesFP']['fp2'] = $direccionFP2;
|
||||
} else {
|
||||
$data['direccionesFP']['fp2'] = [];
|
||||
}
|
||||
$data['direccionesFP']['checkboxes'] = json_decode($presupuesto->getDireccionFPChecks());
|
||||
|
||||
$data['comentarios_cliente'] = $presupuesto->comentarios_cliente;
|
||||
$data['comentarios_safekat'] = $presupuesto->comentarios_safekat;
|
||||
$data['comentarios_pdf'] = $presupuesto->comentarios_pdf;
|
||||
@ -1951,7 +1969,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
return PresupuestoService::checkLineasEnvios($direccionesEnvio);
|
||||
}
|
||||
|
||||
protected function obtenerDireccionesEnvio($id, $cliente_id)
|
||||
protected function obtenerDireccionesEnvio($id, $cliente_id, $is_fp = false, $num_fp = 0)
|
||||
{
|
||||
$model = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
||||
$model_direcciones = model('App\Models\Clientes\ClienteDireccionesModel');
|
||||
@ -1959,10 +1977,38 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
->join('lg_proveedores', 'presupuesto_direcciones.proveedor_id = lg_proveedores.id')
|
||||
->join('lg_paises', 'presupuesto_direcciones.pais_id = lg_paises.id')
|
||||
->select('presupuesto_direcciones.*, lg_proveedores.nombre AS proveedor, lg_paises.nombre AS pais')
|
||||
->where('presupuesto_id', $id)->findAll();
|
||||
->where('presupuesto_id', $id)
|
||||
->where('is_ferro_prototipo', $is_fp);
|
||||
if ($is_fp) {
|
||||
$direcciones = $direcciones
|
||||
->where('num_ferro_prototipo', $num_fp);
|
||||
}
|
||||
|
||||
return $direcciones;
|
||||
|
||||
return $direcciones->findAll();
|
||||
}
|
||||
|
||||
protected function hasPrototipo2($presupuestoId){
|
||||
|
||||
$servicios = (new PresupuestoServiciosExtraModel())->getResource($presupuestoId)->get()->getResultObject();
|
||||
$id_servicio = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_prototipo_2')->value;
|
||||
foreach ($servicios as $servicio) {
|
||||
if ($servicio->tarifa_extra_id == $id_servicio) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function hasFerro2($presupuestoId)
|
||||
{
|
||||
$servicios = (new PresupuestoServiciosExtraModel())->getResource($presupuestoId)->get()->getResultObject();
|
||||
$id_servicio = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('id_servicio_ferro_2')->value;
|
||||
foreach ($servicios as $servicio) {
|
||||
if ($servicio->tarifa_extra_id == $id_servicio) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,6 +412,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$lomo = round($lomo, 2);
|
||||
$errors = [
|
||||
'status' => 0,
|
||||
@ -611,6 +612,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
if (array_key_exists('exception', $return_data)) {
|
||||
|
||||
return $this->failServerError(
|
||||
$return_data['exception'] . ' - ' .
|
||||
$return_data['file'] . ' - ' . $return_data['line']
|
||||
@ -719,7 +721,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Se suma el coste de envío a cada precio unidad
|
||||
for ($i = 0; $i < count($tirada); $i++) {
|
||||
if ($return_data['coste_envio'] && isset($return_data['coste_envio'][$i]) && $return_data['coste_envio'][$i] > 0)
|
||||
$return_data['precio_u'][$i] = round(floatval($return_data['precio_u'][$i]) + $return_data['coste_envio'][$i] / $tirada[$i], 4);
|
||||
}
|
||||
|
||||
if ($this->request) {
|
||||
if ($this->request->isAJAX())
|
||||
@ -1381,6 +1387,13 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
$datos_presupuesto['faja'] = $faja;
|
||||
|
||||
$reqData['datosCabecera'] ?? [];
|
||||
$datos_presupuesto['direcciones_fp_checks'] = $reqData['direcciones_fp_checks'] ?? (object) [
|
||||
'addFP1isAddMain' => "false",
|
||||
'addFP2isAddMain' => "false",
|
||||
'addFP2isaddFP1' => "false"
|
||||
];
|
||||
|
||||
$id = $model_presupuesto->insertarPresupuestoCliente(
|
||||
$id,
|
||||
$selected_tirada,
|
||||
@ -1561,11 +1574,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
if (count($direccionesFP1) > 0) {
|
||||
$this->guardarLineaEnvio($id, $direccionesFP1, $peso_libro, true);
|
||||
$this->guardarLineaEnvio($id, $direccionesFP1, $peso_libro, true, true, 1);
|
||||
|
||||
}
|
||||
if (count($direccionesFP2) > 0) {
|
||||
$this->guardarLineaEnvio($id, $direccionesFP2, $peso_libro, true);
|
||||
$this->guardarLineaEnvio($id, $direccionesFP2, $peso_libro, true, true, 2);
|
||||
}
|
||||
|
||||
if ($confirmar) {
|
||||
@ -1708,6 +1721,13 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$data['direcciones'] = $this->obtenerDireccionesEnvio($id);
|
||||
}
|
||||
|
||||
$direccionesFerroPrototipo = $this->obtenerDireccionesEnvioFerro($id);
|
||||
if ($direccionesFerroPrototipo && count($direccionesFerroPrototipo) > 0) {
|
||||
$data['direccionesFerroPrototipo'] = $direccionesFerroPrototipo;
|
||||
}
|
||||
|
||||
$data['direccionesFPChecks'] = $presupuesto->getDireccionFPChecks();
|
||||
|
||||
if (intval($presupuesto->estado_id) == 2) {
|
||||
$data['resumen']['base'] = $presupuesto->total_antes_descuento;
|
||||
$data['resumen']['total_envio'] = round(
|
||||
@ -1871,7 +1891,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
|
||||
protected function guardarLineaEnvio($presupuestoId, $direccion, $peso_libro, $coste_cero = false)
|
||||
protected function guardarLineaEnvio($presupuestoId, $direccion, $peso_libro, $coste_cero = false, $is_ferro_prototipo = false, $num_ferro_prototipo = 0)
|
||||
{
|
||||
|
||||
$unidades = intval($direccion['unidades']);
|
||||
@ -1891,8 +1911,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$data->presupuesto_id = $presupuestoId;
|
||||
$data->tarifa_id = $data->id;
|
||||
unset($data->id);
|
||||
if($coste_cero) {
|
||||
if ($coste_cero) {
|
||||
$data->coste = 0;
|
||||
if ($is_ferro_prototipo) {
|
||||
$data->is_ferro_prototipo = 1;
|
||||
$data->num_ferro_prototipo = $num_ferro_prototipo;
|
||||
}
|
||||
} else {
|
||||
$data->precio = $data->coste;
|
||||
}
|
||||
@ -2097,18 +2121,17 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
for ($t = 0; $t < count($tirada); $t++) {
|
||||
|
||||
// Inicialización para los totalizadores
|
||||
if ($extra_info) {
|
||||
$totalPapel = 0.0;
|
||||
$margenPapel = 0.0;
|
||||
$totalImpresion = 0.0;
|
||||
$margenImpresion = 0.0;
|
||||
$totalPapel = 0.0;
|
||||
$margenPapel = 0.0;
|
||||
$totalImpresion = 0.0;
|
||||
$margenImpresion = 0.0;
|
||||
|
||||
$sumForFactor = 0.0;
|
||||
$sumForFactorPonderado = 0.0;
|
||||
$sumForFactor = 0.0;
|
||||
$sumForFactorPonderado = 0.0;
|
||||
|
||||
$totalServicios = 0.0;
|
||||
$margenServicios = 0.0;
|
||||
|
||||
$totalServicios = 0.0;
|
||||
$margenServicios = 0.0;
|
||||
}
|
||||
$tirada[$t] = intval($tirada[$t]);
|
||||
|
||||
$is_cosido = (new TipoPresupuestoModel())->get_isCosido($tipo_impresion_id);
|
||||
@ -3426,7 +3449,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
$model = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
||||
$direcciones = $model->where('presupuesto_id', $id)
|
||||
->where('is_ferro_prototipo', 0)->asArray()->findAll();
|
||||
->where('is_ferro_prototipo', 1)->get()->getResultArray();
|
||||
|
||||
return $direcciones;
|
||||
}
|
||||
@ -3663,21 +3686,30 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
public function download_zip()
|
||||
{
|
||||
$presupuesto_id = $this->request->getPost('presupuesto_id');
|
||||
$ot_id = $this->request->getPost('ot_id');
|
||||
|
||||
if (!$presupuesto_id) {
|
||||
return $this->response->setStatusCode(400)->setBody('Presupuesto ID requerido');
|
||||
}
|
||||
|
||||
// Definir prefijo si se recibió un ot_id válido
|
||||
$prefijo = (!empty($ot_id) && is_numeric($ot_id)) ? "OT_{$ot_id}" : null;
|
||||
|
||||
$ftpClient = new \App\Libraries\SafekatFtpClient();
|
||||
try {
|
||||
$zipPath = $ftpClient->downloadZipPresupuesto((int) $presupuesto_id);
|
||||
$zipPath = $ftpClient->downloadZipPresupuesto((int) $presupuesto_id, $prefijo);
|
||||
|
||||
if ($zipPath === null || !file_exists($zipPath)) {
|
||||
return $this->response->setStatusCode(404)->setBody('No se encontraron archivos');
|
||||
}
|
||||
|
||||
$nombreArchivo = $prefijo
|
||||
? "{$prefijo}_PRESUPUESTO_{$presupuesto_id}.zip"
|
||||
: "archivos_presupuesto_{$presupuesto_id}.zip";
|
||||
|
||||
return $this->response
|
||||
->download($zipPath, null) // null = usar nombre original del archivo
|
||||
->setFileName('archivos_presupuesto_' . $presupuesto_id . '.zip');
|
||||
->download($zipPath, null)
|
||||
->setFileName($nombreArchivo);
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', $e->getMessage());
|
||||
return $this->response->setStatusCode(500)->setBody('Error interno');
|
||||
@ -3685,4 +3717,5 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ class Presupuestodirecciones extends \App\Controllers\BaseResourceController
|
||||
$proveedor_id = $reqData['proveedor_id'] ?? "";
|
||||
$entregaPieCalle = $reqData['entregaPieCalle'] ?? 0;
|
||||
$is_ferro_prototipo = $reqData['is_ferro_prototipo'] ?? 0;
|
||||
$num_ferro_prototipo = $reqData['num_ferro_prototipo'] ?? 0;
|
||||
|
||||
$data = [
|
||||
"presupuesto_id" => $presupuesto_id,
|
||||
@ -74,7 +75,8 @@ class Presupuestodirecciones extends \App\Controllers\BaseResourceController
|
||||
"proveedor" => $proveedor,
|
||||
"proveedor_id" => $proveedor_id,
|
||||
"entregaPieCalle" => $entregaPieCalle,
|
||||
"is_ferro_prototipo" => $is_ferro_prototipo
|
||||
"is_ferro_prototipo" => $is_ferro_prototipo,
|
||||
"num_ferro_prototipo" => $num_ferro_prototipo
|
||||
];
|
||||
$response = $this->model->insert($data);
|
||||
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Produccion;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class Ordenmaquina extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo 'Orden maquina';
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Produccion;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class Ordentrabajomaquetacion extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo 'Orden maquetación';
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Produccion;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class Pedidoproduccion extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo 'Pedido produccion';
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -54,10 +54,10 @@ class Backups extends BaseController
|
||||
}
|
||||
|
||||
// === 2. Backups remotos en SFTP ===
|
||||
$sftpHost = getenv('HIDRIVE_HOST');
|
||||
$sftpUser = getenv('HIDRIVE_USER');
|
||||
$sftpPass = getenv('HIDRIVE_PASS');
|
||||
$remoteDir = '/users/erp2019/backups_erp/';
|
||||
$sftpHost = getenv('HIDRIVE_BK_HOST');
|
||||
$sftpUser = getenv('HIDRIVE_BK_USER');
|
||||
$sftpPass = getenv('HIDRIVE_BK_PASS');
|
||||
$remoteDir = getenv('HIDRIVE_BK_PATH_ROOT');
|
||||
|
||||
$sftp = new SFTP($sftpHost);
|
||||
if ($sftp->login($sftpUser, $sftpPass)) {
|
||||
@ -269,9 +269,10 @@ class Backups extends BaseController
|
||||
}
|
||||
|
||||
if (!empty($remotePath)) {
|
||||
$sftpHost = getenv('HIDRIVE_HOST');
|
||||
$sftpUser = getenv('HIDRIVE_USER');
|
||||
$sftpPass = getenv('HIDRIVE_PASS');
|
||||
$sftpHost = getenv('HIDRIVE_BK_HOST');
|
||||
$sftpUser = getenv('HIDRIVE_BK_USER');
|
||||
$sftpPass = getenv('HIDRIVE_BK_PASS');
|
||||
|
||||
|
||||
$sftp = new SFTP($sftpHost);
|
||||
|
||||
@ -307,10 +308,10 @@ class Backups extends BaseController
|
||||
}
|
||||
|
||||
// También se puede intentar buscar en el SFTP si quieres
|
||||
$sftpHost = getenv('HIDRIVE_HOST');
|
||||
$sftpUser = getenv('HIDRIVE_USER');
|
||||
$sftpPass = getenv('HIDRIVE_PASS');
|
||||
$remotePath = '/users/erp2019/backups_erp/' . $filename;
|
||||
$sftpHost = getenv('HIDRIVE_BK_HOST');
|
||||
$sftpUser = getenv('HIDRIVE_BK_USER');
|
||||
$sftpPass = getenv('HIDRIVE_BK_PASS');
|
||||
$remotePath = getenv('HIDRIVE_BK_PATH_ROOT') . $filename;
|
||||
|
||||
$sftp = new SFTP($sftpHost);
|
||||
if ($sftp->login($sftpUser, $sftpPass)) {
|
||||
@ -379,6 +380,7 @@ class Backups extends BaseController
|
||||
public function restoreLocal($file)
|
||||
{
|
||||
$path = WRITEPATH . 'backups/' . $file;
|
||||
|
||||
if (!file_exists($path)) {
|
||||
throw new \CodeIgniter\Exceptions\PageNotFoundException("Backup no encontrado.");
|
||||
}
|
||||
@ -399,21 +401,37 @@ class Backups extends BaseController
|
||||
|
||||
$sqlFile = $sqlFiles[0];
|
||||
|
||||
$dbConfig = config('Database')->default;
|
||||
$host = $dbConfig['hostname'];
|
||||
$username = $dbConfig['username'];
|
||||
$password = $dbConfig['password'];
|
||||
$database = $dbConfig['database'];
|
||||
|
||||
$cmd = "mysql -h {$host} -u{$username} -p'{$password}' {$database} < {$sqlFile}";
|
||||
system($cmd, $retval);
|
||||
|
||||
if ($retval !== 0) {
|
||||
throw new \RuntimeException("Error al restaurar la base de datos. Código: $retval");
|
||||
// === Verificar que el archivo SQL existe y tiene contenido
|
||||
if (!file_exists($sqlFile)) {
|
||||
throw new \RuntimeException("Archivo SQL no encontrado.");
|
||||
}
|
||||
|
||||
array_map('unlink', glob($extractPath . '*'));
|
||||
rmdir($extractPath);
|
||||
if (filesize($sqlFile) === 0) {
|
||||
throw new \RuntimeException("El archivo SQL está vacío.");
|
||||
}
|
||||
|
||||
// === Configuración de base de datos
|
||||
$dbConfig = config('Database')->default;
|
||||
$host = escapeshellarg($dbConfig['hostname']);
|
||||
$username = escapeshellarg($dbConfig['username']);
|
||||
$password = escapeshellarg($dbConfig['password']);
|
||||
$database = escapeshellarg($dbConfig['database']);
|
||||
|
||||
// === Construcción del comando con stderr redirigido
|
||||
$cmd = "mysql -h $host -u $username -p$password $database -e \"source $sqlFile\" 2>&1";
|
||||
|
||||
// === Ejecutar y capturar la salida
|
||||
exec($cmd, $output, $retval);
|
||||
|
||||
// === Verificar resultado
|
||||
if ($retval !== 0) {
|
||||
throw new \RuntimeException("Error al restaurar la base de datos:\n" . implode("\n", $output));
|
||||
}
|
||||
|
||||
// === Limpieza
|
||||
helper('filesystem');
|
||||
delete_files($extractPath, true); // elimina contenido
|
||||
rmdir($extractPath); // elimina el directorio
|
||||
|
||||
return redirect()->to(route_to('backupsList'))->with('message', 'Backup restaurado correctamente (vía sistema).');
|
||||
} else {
|
||||
@ -424,60 +442,82 @@ class Backups extends BaseController
|
||||
|
||||
|
||||
|
||||
|
||||
public function restoreRemote($filename)
|
||||
{
|
||||
helper('filesystem');
|
||||
|
||||
// Buscar el backup en la base de datos
|
||||
$entorno = getenv('SK_ENVIRONMENT');
|
||||
|
||||
if ($entorno === 'development') {
|
||||
// Construir ruta remota directamente
|
||||
$remotePath = '/users/erp2019/backups_erp/' . $filename;
|
||||
$localPath = WRITEPATH . 'backups/' . $filename;
|
||||
|
||||
$sftpHost = getenv('HIDRIVE_BK_HOST');
|
||||
$sftpUser = getenv('HIDRIVE_BK_USER');
|
||||
$sftpPass = getenv('HIDRIVE_BK_PASS');
|
||||
|
||||
$sftp = new SFTP($sftpHost);
|
||||
if (!$sftp->login($sftpUser, $sftpPass)) {
|
||||
return redirect()->to(route_to('backupsList'))->with('error', 'No se pudo autenticar en el servidor SFTP.');
|
||||
}
|
||||
|
||||
$fileContents = $sftp->get($remotePath);
|
||||
if ($fileContents === false) {
|
||||
return redirect()->to(route_to('backupsList'))->with('error', 'No se pudo descargar el archivo remoto.');
|
||||
}
|
||||
|
||||
if (write_file($localPath, $fileContents) === false) {
|
||||
return redirect()->to(route_to('backupsList'))->with('error', 'No se pudo guardar el archivo localmente.');
|
||||
}
|
||||
|
||||
// Restaurar directamente
|
||||
return $this->restoreLocal($filename);
|
||||
}
|
||||
|
||||
// Producción: flujo normal con base de datos
|
||||
$backup = $this->backupModel->where('filename', $filename)->first();
|
||||
|
||||
if (!$backup || empty($backup['path_remote'])) {
|
||||
return redirect()->to(route_to('backupsList'))->with('error', 'Backup remoto no encontrado en la base de datos.');
|
||||
}
|
||||
|
||||
// Parámetros SFTP
|
||||
$sftpHost = getenv('HIDRIVE_HOST');
|
||||
$sftpUser = getenv('HIDRIVE_USER');
|
||||
$sftpPass = getenv('HIDRIVE_PASS');
|
||||
$remotePath = $backup['path_remote'];
|
||||
$localPath = WRITEPATH . 'backups/' . $filename;
|
||||
|
||||
// Conectar al SFTP
|
||||
$sftp = new SFTP($sftpHost);
|
||||
$sftpHost = getenv('HIDRIVE_BK_HOST');
|
||||
$sftpUser = getenv('HIDRIVE_BK_USER');
|
||||
$sftpPass = getenv('HIDRIVE_BK_PASS');
|
||||
|
||||
$sftp = new SFTP($sftpHost);
|
||||
if (!$sftp->login($sftpUser, $sftpPass)) {
|
||||
return redirect()->to(route_to('backupsList'))->with('error', 'No se pudo autenticar en el servidor SFTP.');
|
||||
}
|
||||
|
||||
// Descargar el archivo
|
||||
$fileContents = $sftp->get($remotePath);
|
||||
|
||||
if ($fileContents === false) {
|
||||
return redirect()->to(route_to('backupsList'))->with('error', 'No se pudo descargar el archivo remoto.');
|
||||
}
|
||||
|
||||
// Guardar localmente
|
||||
if (write_file($localPath, $fileContents) === false) {
|
||||
return redirect()->to(route_to('backupsList'))->with('error', 'No se pudo guardar el archivo localmente.');
|
||||
}
|
||||
|
||||
// Actualizar la base de datos para marcar el archivo como local
|
||||
$this->backupModel->update($backup['id'], [
|
||||
'path_local' => $localPath,
|
||||
]);
|
||||
$this->backupModel->update($backup['id'], ['path_local' => $localPath]);
|
||||
|
||||
// Restaurar usando el método local
|
||||
return $this->restoreLocal($filename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function sendToSFTP($localPath, $remoteFilename)
|
||||
{
|
||||
$sftpHost = getenv('HIDRIVE_HOST');
|
||||
$sftpUser = getenv('HIDRIVE_USER');
|
||||
$sftpPass = getenv('HIDRIVE_PASS');
|
||||
$remotePath = '/users/erp2019/backups_erp/' . $remoteFilename;
|
||||
$sftpHost = getenv('HIDRIVE_BK_HOST');
|
||||
$sftpUser = getenv('HIDRIVE_BK_USER');
|
||||
$sftpPass = getenv('HIDRIVE_BK_PASS');
|
||||
$remotePath = getenv('HIDRIVE_BK_PATH_ROOT') . $remoteFilename;
|
||||
|
||||
$sftp = new SFTP($sftpHost);
|
||||
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class ConfigDireccionesFerroPrototipo extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addColumn('presupuestos', [
|
||||
'direcciones_fp_checks' => [
|
||||
'type' => 'JSON',
|
||||
'null' => false,
|
||||
'default' => '{"addFP1isAddMain": "0", "addFP2isAddMain": "0", "addFP2isaddFP1": "0"}',
|
||||
'comment' => 'valores de los checks de las direcciones ferro/prototipo',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('presupuestos', 'direcciones_fp_checks');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AumentoLomoFijo extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->db->table('config_variables_app')->insert([
|
||||
'name' => 'aumento_fijo_lomo_interior',
|
||||
'value' => '1.3',
|
||||
'description' => 'Aumento fijo del lomo interior por cola (se añade en el interior)',
|
||||
'created_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
// Borrar los nuevos campos
|
||||
$this->db->table('config_variables_app')->whereIn('name', [
|
||||
'aumento_fijo_lomo_interior'
|
||||
])->delete();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class FerroPrototipo2 extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->db->table('config_variables_app')->insert([
|
||||
'name' => 'id_servicio_ferro_2',
|
||||
'value' => '31',
|
||||
'description' => 'D del servicio extra "ferro (2 unidades)" que aparece en los presupuestos',
|
||||
'created_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
$this->db->table('config_variables_app')->insert([
|
||||
'name' => 'id_servicio_prototipo_2',
|
||||
'value' => '28',
|
||||
'description' => 'D del servicio extra "Prototipo (2 unidades)" que aparece en los presupuestos',
|
||||
'created_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
// Borrar los nuevos campos
|
||||
$this->db->table('config_variables_app')->whereIn('name', [
|
||||
'id_servicio_ferro_2',
|
||||
'id_servicio_prototipo_2'
|
||||
])->delete();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreateTiposPapelGenerico extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
// Crear tabla tipos_papel_generico
|
||||
$this->forge->addField([
|
||||
'id' => [
|
||||
'type' => 'INT',
|
||||
'unsigned' => true,
|
||||
'auto_increment' => true,
|
||||
],
|
||||
'clave' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '50',
|
||||
'unique' => true,
|
||||
],
|
||||
]);
|
||||
$this->forge->addKey('id', true);
|
||||
$this->forge->createTable('tipos_papel_generico');
|
||||
|
||||
// Insertar claves
|
||||
$data = [
|
||||
['clave' => 'offset_blanco'],
|
||||
['clave' => 'offset_ahuesado'],
|
||||
['clave' => 'estucados'],
|
||||
['clave' => 'volumen'],
|
||||
['clave' => 'especiales'],
|
||||
['clave' => 'reciclados'],
|
||||
['clave' => 'cartulinas'],
|
||||
['clave' => 'verjurados'],
|
||||
];
|
||||
$this->db->table('tipos_papel_generico')->insertBatch($data);
|
||||
|
||||
// Añadir columna tipo_papel_generico_id a lg_papel_generico
|
||||
$this->forge->addColumn('lg_papel_generico', [
|
||||
'tipo_papel_generico_id' => [
|
||||
'type' => 'INT',
|
||||
'unsigned' => true,
|
||||
'null' => true,
|
||||
'after' => 'id', // Ajusta si deseas colocarla en otro lugar
|
||||
]
|
||||
]);
|
||||
|
||||
// Agregar constraint foreign key
|
||||
$this->db->query(
|
||||
'ALTER TABLE lg_papel_generico
|
||||
ADD CONSTRAINT fk_tipo_papel_generico
|
||||
FOREIGN KEY (tipo_papel_generico_id)
|
||||
REFERENCES tipos_papel_generico(id)
|
||||
ON DELETE SET NULL
|
||||
ON UPDATE CASCADE'
|
||||
);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
// Eliminar foreign key primero
|
||||
$this->db->query('ALTER TABLE lg_papel_generico DROP FOREIGN KEY fk_tipo_papel_generico');
|
||||
$this->forge->dropColumn('lg_papel_generico', 'tipo_papel_generico_id');
|
||||
$this->forge->dropTable('tipos_papel_generico');
|
||||
}
|
||||
}
|
||||
@ -16,11 +16,13 @@ class PapelGenerico extends \CodeIgniter\Entity\Entity
|
||||
"activo" => false,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
"tipo_papel_generico_id" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"show_in_client" => "boolean",
|
||||
"activo" => "boolean",
|
||||
"show_in_client_special" => "boolean",
|
||||
"is_deleted" => "int",
|
||||
"tipo_papel_generico_id" => "int",
|
||||
];
|
||||
}
|
||||
|
||||
11
ci4/app/Entities/Configuracion/TipoPapelGenerico.php
Executable file
11
ci4/app/Entities/Configuracion/TipoPapelGenerico.php
Executable file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace App\Entities\Configuracion;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class TipoPapelGenerico extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"clave" => null,
|
||||
];
|
||||
}
|
||||
@ -117,6 +117,12 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
||||
'lomo_redondo' => null,
|
||||
'cabezada' => null,
|
||||
'envio_base' => null,
|
||||
'direcciones_fp_checks' => [
|
||||
'addFP1isAddMain' => "false",
|
||||
'addFP2isAddMain' => "false",
|
||||
'addFP2isaddFP1' => "false"
|
||||
],
|
||||
|
||||
];
|
||||
protected $casts = [
|
||||
"cliente_id" => "int",
|
||||
@ -190,6 +196,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
||||
'papel_interior_diferente' => "boolean",
|
||||
'paginasCuadernillo' => "int",
|
||||
'lomo_redondo' => "boolean",
|
||||
'direcciones_fp_checks' => 'json',
|
||||
];
|
||||
/**
|
||||
* Devuelve la entity con un campo `presupuesto_lineas` con las lineas de presupuesto asociadas
|
||||
@ -326,4 +333,15 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
||||
}
|
||||
return $tipo_presupuesto;
|
||||
}
|
||||
|
||||
public function getDireccionFPChecks()
|
||||
{
|
||||
return $this->attributes['direcciones_fp_checks'] ?? [];
|
||||
}
|
||||
|
||||
public function setDireccionFPChecks($value)
|
||||
{
|
||||
$this->attributes['direcciones_fp_checks'] = is_array($value) ? json_encode($value) : $value;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,6 +101,20 @@ function getGravatarURL(int $size = 30)
|
||||
{
|
||||
return "https://gravatar.com/avatar/".md5(auth()->user()->getEmail())."?s=".$size;
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('gravatar_url')) {
|
||||
function gravatar_url(?string $email, int $size = 40): string
|
||||
{
|
||||
if (!$email) {
|
||||
return "https://www.gravatar.com/avatar/?s={$size}&d=mp";
|
||||
}
|
||||
|
||||
return "https://www.gravatar.com/avatar/" . md5(strtolower(trim($email))) . "?s={$size}&d=identicon";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getAllClassFolder($folder = null){
|
||||
try {
|
||||
helper('filesystem');
|
||||
|
||||
@ -757,7 +757,7 @@ return [
|
||||
"menu_tarifaextra" => "Serv. Extra",
|
||||
"menu_tarifamanipulado" => "Manipulado",
|
||||
"menu_tarifaencuadernacion" => "Encuadernación",
|
||||
"menu_tarifapapelcompra" => "Papel compra",
|
||||
"menu_tarifapapelcompra" => "Papel impresión",
|
||||
"menu_servicioAcabado" => "Servicios acabado",
|
||||
"menu_tarifaacabado" => "Acabado",
|
||||
"menu_tarifapapeldefecto" => "Papel defecto",
|
||||
|
||||
@ -6,6 +6,7 @@ return [
|
||||
'code' => 'Código',
|
||||
'codeOt' => 'Código Ot',
|
||||
'createdAt' => 'Creado el',
|
||||
'tipo_papel_generico_id' => 'Tipo Papel Genérico',
|
||||
'deletedAt' => 'Deleted At',
|
||||
'id' => 'ID',
|
||||
'activo' => 'Activo',
|
||||
@ -21,6 +22,16 @@ return [
|
||||
'updatedAt' => 'Actualizado el',
|
||||
'form_acordion_title' => 'Propiedades Papel Genérico',
|
||||
|
||||
// Tipos de papel genérico
|
||||
'offset_blanco' => 'Offset Blanco',
|
||||
'offset_ahuesado' => 'Offset Ahuesado',
|
||||
'estucados' => 'Estucados',
|
||||
'volumen' => 'Volumen',
|
||||
'especiales' => 'Especiales',
|
||||
'reciclados' => 'Reciclados',
|
||||
'cartulinas' => 'Cartulinas',
|
||||
'verdujados' => 'Verdujados',
|
||||
|
||||
'validation' => [
|
||||
'code' => [
|
||||
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
||||
|
||||
@ -80,8 +80,10 @@ return [
|
||||
'acabadoFaja' => 'Acabado Faja',
|
||||
'cosido' => 'Cosido',
|
||||
'ferro' => 'Ferro',
|
||||
'ferro_2' => 'Ferro (2 uds.)',
|
||||
'ferroDigital' => 'Ferro Digital',
|
||||
'prototipo' => 'Prototipo',
|
||||
'prototipo_2' => 'Prototipo (2 uds.)',
|
||||
'imagenesBnInterior' => 'Imágenes B/N interior',
|
||||
'recogerEnTaller' => 'Recoger en taller',
|
||||
'marcapaginas' => 'Marcapáginas',
|
||||
@ -305,7 +307,7 @@ return [
|
||||
'previewSobrecubierta' => 'Configuración del papel: Sobrecubierta',
|
||||
'previewFaja' => 'Configuración del papel: Faja',
|
||||
'previewPapelGenerico' => 'Papel Genérico',
|
||||
'previewPapelCompra' => 'Papel de Compra',
|
||||
'previewPapelCompra' => 'Papel Impresión',
|
||||
'previewAreaImpresion' => 'Área de Impresión',
|
||||
'previewPosicionFormas' => 'Posición de Formas',
|
||||
'previewDetalles' => 'Detalles del trabajo',
|
||||
@ -436,6 +438,9 @@ return [
|
||||
'paginas_multiplo_4' => 'El número total de páginas para <b>cosido</b> y <b>grapado</b> debe ser múltiplo de 4',
|
||||
'paginas_pares' => 'El número de páginas debe ser par',
|
||||
'extras_cubierta' => 'Rellene todos los campos',
|
||||
|
||||
'error_sameAddPrincipal_FP' => 'Debe añadir al menos una dirección en el envío para usarla',
|
||||
'error_sameAddFP1' => 'Debe añadir al menos una dirección en el envío del primer ferro para usarla.'
|
||||
],
|
||||
|
||||
'errores' => [
|
||||
@ -463,6 +468,7 @@ return [
|
||||
Por favor, disminuya el número de páginas o el gramaje del papel para que sea encuadernable.",
|
||||
'error_lomo_minimo' => "No se pueden encuadernar libros {0} con un lomo interior inferior a {1} mm. El lomo actual es de {2} mm. <br>
|
||||
Por favor, aumente el número de páginas o el gramaje del papel para que sea encuadernable.",
|
||||
'error_direccion_principal_no_encontrada' => 'No se ha encontrado la dirección en las direcciones del cliente. Por favor, añádala antes de marcar esta opción.',
|
||||
],
|
||||
'resize_preview' => 'Refrescar vista esquema'
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ class SafekatFtpClient
|
||||
return implode('/', [$this->base_dir, 'pedidos_files', $rootIdExtern]);
|
||||
}
|
||||
|
||||
public function downloadZipPresupuesto(int $presupuesto_id): ?string
|
||||
public function downloadZipPresupuesto(int $presupuesto_id, ?string $prefijo = null): ?string
|
||||
{
|
||||
$modelPedidoLinea = model(PedidoLineaModel::class);
|
||||
$model = model(PresupuestoFicheroModel::class);
|
||||
@ -143,8 +143,11 @@ class SafekatFtpClient
|
||||
|
||||
foreach ($files as $file) {
|
||||
$originalName = $file->nombre ?? basename($file->file_path);
|
||||
$localFile = $localTempDir . '/' . $originalName;
|
||||
$prefixedName = $prefijo ? $prefijo . '_' . $originalName : $originalName;
|
||||
|
||||
$localFile = $localTempDir . '/' . $prefixedName;
|
||||
$remoteFile = $remotePath . '/' . basename($file->file_path);
|
||||
|
||||
$this->ftp->get($remoteFile, $localFile);
|
||||
}
|
||||
|
||||
@ -167,4 +170,5 @@ class SafekatFtpClient
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -22,7 +22,18 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
4 => "t1.show_in_client_special",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "show_in_client_special", "deleted_at", "is_deleted", "activo"];
|
||||
protected $allowedFields =
|
||||
[
|
||||
"nombre",
|
||||
"code",
|
||||
"code_ot",
|
||||
"show_in_client",
|
||||
"show_in_client_special",
|
||||
"deleted_at",
|
||||
"is_deleted",
|
||||
"activo",
|
||||
"tipo_papel_generico_id",
|
||||
];
|
||||
protected $returnType = "App\Entities\Configuracion\PapelGenerico";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
@ -132,16 +143,16 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->groupEnd();
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
|
||||
|
||||
74
ci4/app/Models/Configuracion/TipoPapelGenericoModel.php
Executable file
74
ci4/app/Models/Configuracion/TipoPapelGenericoModel.php
Executable file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class TipoPapelGenericoModel extends \App\Models\BaseModel
|
||||
{
|
||||
protected $table = "tipos_papel_generico";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
protected $allowedFields = [
|
||||
"clave",
|
||||
];
|
||||
protected $returnType = "App\Entities\Configuracion\TipoPapelGenerico";
|
||||
|
||||
public function getTiposPapel($data)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id as id, t1.clave AS nombre",
|
||||
// for debug, t2.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
|
||||
)
|
||||
->join("lg_papel_generico t2", "t2.tipo_papel_generico_id = t1.id", "inner")
|
||||
->join("lg_papel_impresion t3", "t3.papel_generico_id = t2.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t4", "t4.papel_impresion_id = t3.id", "inner")
|
||||
->join("lg_maquinas t5", "t4.maquina_id = t5.id", "inner")
|
||||
->join("lg_maquinas_tarifas_impresion t6", "t6.maquina_id = t5.id", "inner")
|
||||
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t2.show_in_client", 1)
|
||||
->where("t3.is_deleted", 0)
|
||||
->where("t3.isActivo", 1)
|
||||
->where("t3.use_in_client", 1)
|
||||
->where("t4.active", 1)
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.min <= ", $data['tirada'] ?? 0)
|
||||
->where("t5.max >= ", $data['tirada'] ?? 0)
|
||||
->where("t5.tipo", "impresion")
|
||||
->where("t6.is_deleted", 0)
|
||||
->where("t6.tipo", $data['tipo'] ?? null)
|
||||
->distinct('t1.id');
|
||||
|
||||
// Validación adicional para asegurar que t1.id esté presente en las combinaciones con t3.active = 1
|
||||
$builder->whereIn("t2.id", function ($subQuery) {
|
||||
$subQuery->select("t1_inner.id")
|
||||
->from("lg_papel_generico t1_inner")
|
||||
->join("lg_papel_impresion t2_inner", "t2_inner.papel_generico_id = t1_inner.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3_inner", "t3_inner.papel_impresion_id = t2_inner.id", "inner")
|
||||
->where("t3_inner.active", 1);
|
||||
});
|
||||
|
||||
$builder->groupStart()
|
||||
->groupStart()
|
||||
->where("t5.ancho_impresion >", $data['ancho'] ?? 0)
|
||||
->where("t5.alto_impresion >", $data['alto'] ?? 0)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t5.ancho_impresion >", $data['alto'] ?? 0)
|
||||
->where("t5.alto_impresion >", $data['ancho'] ?? 0)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t5.ancho_impresion >", $data['alto'] ?? 0)
|
||||
->where("t5.is_rotativa", 1)
|
||||
->groupEnd()
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
}
|
||||
@ -139,6 +139,7 @@ class PresupuestoModel extends \App\Models\BaseModel
|
||||
'lomo_redondo',
|
||||
'cabezada',
|
||||
'envio_base',
|
||||
'direcciones_fp_checks',
|
||||
];
|
||||
protected $returnType = "App\Entities\Presupuestos\PresupuestoEntity";
|
||||
|
||||
@ -535,6 +536,8 @@ class PresupuestoModel extends \App\Models\BaseModel
|
||||
'iva_reducido' => $iva_reducido,
|
||||
'excluir_rotativa' => $excluir_rotativa,
|
||||
|
||||
'direcciones_fp_checks' => $data['direcciones_fp_checks'] ? json_encode($data['direcciones_fp_checks']) : null,
|
||||
|
||||
];
|
||||
/* Actualizacion */
|
||||
if ($id != 0) {
|
||||
|
||||
@ -100,6 +100,18 @@ class GroupModel extends \App\Models\BaseModel
|
||||
->countAllResults();
|
||||
}
|
||||
|
||||
public function getUsersByRol(string $groupKeyWord)
|
||||
{
|
||||
return $this->db
|
||||
->table('auth_groups_users agu')
|
||||
->select('u.id, ai.secret as email, u.first_name, u.last_name')
|
||||
->join('users u', 'u.id = agu.user_id')
|
||||
->join('auth_identities ai', 'ai.user_id = u.id AND ai.type = "email_password"', 'left')
|
||||
->where('agu.group', $groupKeyWord)
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
|
||||
public function getUsersRoles($userId)
|
||||
{
|
||||
|
||||
53
ci4/app/Services/PapelService.php
Normal file
53
ci4/app/Services/PapelService.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use App\Models\Configuracion\TipoPapelGenericoModel;
|
||||
use App\Models\Configuracion\PapelGenericoModel;
|
||||
|
||||
class PapelService extends BaseService
|
||||
{
|
||||
protected TipoPapelGenericoModel $tipoPapelGenericoModel;
|
||||
protected PapelGenericoModel $papelGenericoModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->tipoPapelGenericoModel = model(TipoPapelGenericoModel::class);
|
||||
$this->papelGenericoModel = model(PapelGenericoModel::class);
|
||||
}
|
||||
|
||||
public function getTipoPapelGenerico()
|
||||
{
|
||||
$values = $this->tipoPapelGenericoModel->findAll();
|
||||
$tipoPapelGenericoList = [];
|
||||
foreach ($values as $value) {
|
||||
$tipoPapelGenericoList[$value->id] = lang('PapelGenerico.' . $value->clave);
|
||||
}
|
||||
|
||||
return $tipoPapelGenericoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtencion de los tipos de papel genérico dependiendo del uso
|
||||
* @param object $data
|
||||
* @return array
|
||||
*/
|
||||
public function getTiposPalelGenerico($data){
|
||||
|
||||
if(!isset($data) || empty($data)){
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->papelGenericoModel->where('tipo_papel_generico_id !=', null)->findAll();
|
||||
/*
|
||||
$values = $this->papelGenericoModel->where('uso', $uso)->findAll();
|
||||
$tipoPapelGenericoList = [];
|
||||
foreach ($values as $value) {
|
||||
$tipoPapelGenericoList[$value->id] = lang('PapelGenerico.' . $value->clave);
|
||||
}
|
||||
|
||||
return $tipoPapelGenericoList;
|
||||
*/
|
||||
}
|
||||
}
|
||||
@ -386,6 +386,7 @@ class PresupuestoService extends BaseService
|
||||
$precio_pedido = $precio_libro * ($datosPedido->tirada + $datosPedido->merma);
|
||||
|
||||
$mano = PresupuestoService::computeLomoInterior($datosPedido->paginas, $papel_impresion->espesor);
|
||||
$mano += floatval(model('App\Models\Configuracion\ConfigVariableModel')->getVariable('aumento_fijo_lomo_interior')->value);
|
||||
|
||||
// peso
|
||||
$peso = PresupuestoService::computePeso(
|
||||
@ -515,6 +516,7 @@ class PresupuestoService extends BaseService
|
||||
$data['total_corte'] = round(($data['tiempo_corte'] / 60.0) * $maquina->precio_hora_corte, 2);
|
||||
|
||||
$data['mano'] = PresupuestoService::computeLomoInterior($datosPedido->paginas, $papel_impresion->espesor);
|
||||
$data['mano'] += floatval(model('App\Models\Configuracion\ConfigVariableModel')->getVariable('aumento_fijo_lomo_interior')->value);
|
||||
// ($paginas / 2.0) * (($gramaje / 1000.0) * $papel_compra->mano);
|
||||
|
||||
// peso
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
data-bs-parent="#accordionPresupuestoFiles">
|
||||
<div class="accordion-body">
|
||||
<div class="col-12">
|
||||
<div class="dropzone needsclick" id="<?= $id ?>" data-id="<?= $modelId ?>">
|
||||
<div class="dropzone needsclick" id="<?= $id ?>" data-id="<?= $modelId ?>" data-ot-id="<?= $otId ?? '' ?>">
|
||||
|
||||
<div class="dz-message needsclick">
|
||||
Arrastre aquí los ficheros o haga click
|
||||
|
||||
@ -8,6 +8,23 @@
|
||||
value="<?= old('nombre', $papelGenerico->nombre) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="tipo_papel_generico_id" class="form-label">
|
||||
<?= lang('PapelGenerico.tipo_papel_generico_id') ?>
|
||||
</label>
|
||||
<select id="tipo_papel_generico_id" name="tipo_papel_generico_id" class="form-control select2" data-placeholder="">
|
||||
<option value="" <?= is_null($papelGenerico->tipo_papel_generico_id) ? 'selected' : '' ?>></option>
|
||||
<?php if (isset($tipoPapelGenericoList) && is_array($tipoPapelGenericoList) && !empty($tipoPapelGenericoList)):
|
||||
foreach ($tipoPapelGenericoList as $k => $v): ?>
|
||||
<option value="<?= $k ?>" <?= $k == $papelGenerico->tipo_papel_generico_id ? 'selected' : '' ?>>
|
||||
<?= esc($v) ?>
|
||||
</option>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
</select>
|
||||
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="code" class="form-label">
|
||||
<?= lang('PapelGenerico.code') ?>
|
||||
@ -28,8 +45,8 @@
|
||||
<label for="activo_papel_generico" class="form-check-label">
|
||||
<?= lang('PapelGenerico.activo') ?>
|
||||
</label>
|
||||
<input type="checkbox" id="activo_papel_generico" name="activo" value="1"
|
||||
class="form-check-input" <?= $papelGenerico->activo == true ? 'checked' : ''; ?>>
|
||||
<input type="checkbox" id="activo_papel_generico" name="activo" value="1" class="form-check-input"
|
||||
<?= $papelGenerico->activo == true ? 'checked' : ''; ?>>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
|
||||
@ -1,82 +1,94 @@
|
||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section('content'); ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card card-info">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><?= lang('RolesPermisos.pageTitle') ?></h3>
|
||||
</div><!--//.card-header -->
|
||||
<div class="card-body">
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<!-- Role cards -->
|
||||
<div class="row g-4">
|
||||
<div class="col-xl-4 col-lg-6 col-md-6">
|
||||
<div class="card h-100">
|
||||
<div class="row h-100">
|
||||
<div class="col-sm-5">
|
||||
<div class="d-flex align-items-end h-100 justify-content-center mt-sm-0 mt-3">
|
||||
<img
|
||||
src="<?= site_url('themes/vuexy/img/illustrations/add-new-roles.png') ?>"
|
||||
class="img-fluid mt-sm-4 mt-md-0"
|
||||
alt="add-new-roles"
|
||||
width="83"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card card-info">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><?= lang('RolesPermisos.pageTitle') ?></h3>
|
||||
</div><!--//.card-header -->
|
||||
<div class="card-body">
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<!-- Role cards -->
|
||||
<div class="row g-4">
|
||||
<div class="col-xl-4 col-lg-6 col-md-6">
|
||||
<div class="card h-100">
|
||||
<div class="row h-100">
|
||||
<div class="col-sm-5">
|
||||
<div class="d-flex align-items-end h-100 justify-content-center mt-sm-0 mt-3">
|
||||
<img src="<?= site_url('themes/vuexy/img/illustrations/add-new-roles.png') ?>"
|
||||
class="img-fluid mt-sm-4 mt-md-0" alt="add-new-roles" width="83" />
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="card-body text-sm-end text-center ps-sm-0">
|
||||
<button
|
||||
onclick="window.location='<?= route_to('newGroup') ?>'"
|
||||
class="btn btn-primary mb-2 text-nowrap add-new-role"
|
||||
>
|
||||
<?= lang('Basic.global.addNew') ?>
|
||||
</button>
|
||||
<p class="mb-0 mt-1"><?= lang("RolesPermisos.addRol") ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="card-body text-sm-end text-center ps-sm-0">
|
||||
<button onclick="window.location='<?= route_to('newGroup') ?>'"
|
||||
class="btn btn-primary mb-2 text-nowrap add-new-role">
|
||||
<?= lang('Basic.global.addNew') ?>
|
||||
</button>
|
||||
<p class="mb-0 mt-1"><?= lang("RolesPermisos.addRol") ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php foreach ($userGroupList as $item) : ?>
|
||||
<div class="col-xl-4 col-lg-6 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h6 class="fw-normal mb-2"><?= $model->getUsersWithRol($item->keyword); ?><?= lang("RolesPermisos.totalUsers") ?></h6>
|
||||
<?php foreach ($userGroupList as $item): ?>
|
||||
<?php $item->users = $model->getUsersByRol($item->keyword); ?>
|
||||
<div class="col-xl-4 col-lg-6 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h6 class="fw-normal mb-2">
|
||||
<?= $model->getUsersWithRol($item->keyword); ?>
|
||||
<?= lang("RolesPermisos.totalUsers") ?>
|
||||
</h6>
|
||||
<ul class="list-unstyled d-flex align-items-center avatar-group mb-0">
|
||||
<?php foreach ($item->users as $user): ?>
|
||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top"
|
||||
title="<?= esc($user->first_name . ' ' . $user->last_name) ?>"
|
||||
class="avatar avatar-sm pull-up">
|
||||
<img class="rounded-circle" src="<?= gravatar_url($user->email, 30) ?>"
|
||||
alt="<?= esc($user->email) ?>" />
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-end mt-1">
|
||||
<div class="role-heading">
|
||||
<h4 class="mb-1"><?= esc($item->title) ?></h4>
|
||||
<a href="<?= route_to('editGroup', $item->id) ?>">
|
||||
<span><?= lang('Basic.global.edit') ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-end mt-1">
|
||||
<div class="role-heading">
|
||||
<h4 class="mb-1"><?= esc($item->title) ?></h4>
|
||||
<a href="<?= route_to('editGroup', $item->id) ?>">
|
||||
<span><?= lang('Basic.global.edit') ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?=
|
||||
anchor('#confirm2delete', "<i class='ti ti-trash ti-md'></i>",
|
||||
<?=
|
||||
anchor(
|
||||
'#confirm2delete',
|
||||
"<i class='ti ti-trash ti-md'></i>",
|
||||
[
|
||||
'class' => 'text-muted',
|
||||
'data-href' => route_to('deleteGroup', $item->id),
|
||||
'data-bs-toggle' => 'modal',
|
||||
'data-bs-target' => '#confirm2delete'
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
]
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<!--/ Role cards -->
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
<!--/ Role cards -->
|
||||
</div>
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
|
||||
</div><!--//.card-body -->
|
||||
<div class="card-footer">
|
||||
</div><!--//.card-body -->
|
||||
<div class="card-footer">
|
||||
|
||||
</div><!--//.card-footer -->
|
||||
</div><!--//.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
</div><!--//.card-footer -->
|
||||
</div><!--//.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,69 +1,207 @@
|
||||
<div class="accordion accordion-bordered mt-3" id="accordionEnvios">
|
||||
<div class="card accordion-item active">
|
||||
<h2 class="accordion-header" id="headingOne">
|
||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionEnviosTip" aria-expanded="false" aria-controls="accordionEnviosTip">
|
||||
<button type="button" class="accordion-button" data-bs-toggle="collapse"
|
||||
data-bs-target="#accordionEnviosTip" aria-expanded="false" aria-controls="accordionEnviosTip">
|
||||
<h4><?= lang("Presupuestos.envios") ?></h4>
|
||||
</button>
|
||||
</h2>
|
||||
|
||||
<div id="accordionEnviosTip" class="accordion-collapse collapse show" data-bs-parent="#accordionEnvios">
|
||||
<div id="accordionEnviosTip" class="accordion-collapse collapse show" data-bs-parent="#accordionEnvios">
|
||||
<div class="accordion-body">
|
||||
<div id='alert-envios'></div>
|
||||
<?= view("themes/vuexy/form/presupuestos/admin/_presupuestoDireccionesForm") ?>
|
||||
<div class='row'>
|
||||
<div class='col-md-12 col-lg-4 px-4 py-2'>
|
||||
<label for='envio_base' class='form-label'>
|
||||
Envio base
|
||||
</label>
|
||||
<input readonly type='text' class='form-control' id='envio_base' name='envio_base' value='<?= $presupuestoEntity->envio_base ?>' />
|
||||
<div> <!-- Direcciones envio -->
|
||||
<div id='alert-envios'></div>
|
||||
<?= view("themes/vuexy/form/presupuestos/admin/_presupuestoDireccionesForm") ?>
|
||||
<div class='row'>
|
||||
<div class='col-md-12 col-lg-4 px-4 py-2'>
|
||||
<label for='envio_base' class='form-label'>
|
||||
Envio base
|
||||
</label>
|
||||
<input readonly type='text' class='form-control' id='envio_base' name='envio_base'
|
||||
value='<?= $presupuestoEntity->envio_base ?>' />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id='rowTable' class='row'>
|
||||
<table id="tableOfDireccionesEnvio"
|
||||
class="table comparator-table dt-responsive dataTable px-2 update-resumen-presupuesto"
|
||||
style="width: 95%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="lp-header">TARIFA ID</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.cantidad') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.peso') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.att') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.email') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.direccion') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.cp') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.municipio') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.pais') ?></th>
|
||||
<th class="lp-header">pais_id</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.telefono') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.proveedor') ?></th>
|
||||
<th class="lp-header">Proveedor_id</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.costePrecio') ?></th>
|
||||
<th class="lp-header"><?= lang('Tarifaacabado.margen') ?></th>
|
||||
<th class="lp-header">Pallets?</th>
|
||||
<th style="min-width:120px !important;" class="lp-header">
|
||||
<?= lang('Basic.global.Action') ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id='rowTable' class='row'>
|
||||
<table id="tableOfDireccionesEnvio" class="table comparator-table dt-responsive dataTable px-2 update-resumen-presupuesto" style="width: 95%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="lp-header">TARIFA ID</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.cantidad') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.peso') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.att') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.email') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.direccion') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.cp') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.municipio') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.pais') ?></th>
|
||||
<th class="lp-header">pais_id</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.telefono') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.proveedor') ?></th>
|
||||
<th class="lp-header">Proveedor_id</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.costePrecio') ?></th>
|
||||
<th class="lp-header"><?= lang('Tarifaacabado.margen') ?></th>
|
||||
<th class="lp-header">Pallets?</th>
|
||||
<th class="lp-header">Ferro o Prototipo?</th>
|
||||
<th style="min-width:120px !important;" class="lp-header"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-4 px-4 py-2">
|
||||
<input class="form-check-input" type="checkbox" id="recoger_en_taller" name="recoger_en_taller" value="1" <?= $presupuestoEntity->recoger_en_taller == true ? 'checked' : ''; ?> >
|
||||
<label class="form-check-label" for="recoger_en_taller"><?= lang('Presupuestos.recogerEnTaller') ?></label>
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-4 px-4 py-2">
|
||||
<input class="form-check-input" type="checkbox" id="recoger_en_taller"
|
||||
name="recoger_en_taller" value="1" <?= $presupuestoEntity->recoger_en_taller == true ? 'checked' : ''; ?>>
|
||||
<label class="form-check-label"
|
||||
for="recoger_en_taller"><?= lang('Presupuestos.recogerEnTaller') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="rowInsertar" class="row">
|
||||
<div class="col-md-12 col-lg-4 px-4 py-2">
|
||||
<button id="insertar_direccion" type="button" class="btn btn-secondary waves-effect waves-light float-start"><?= lang("Presupuestos.insertar")?></button>
|
||||
<div id="rowInsertar" class="row">
|
||||
<div class="col-md-12 col-lg-4 px-4 py-2">
|
||||
<button id="insertar_direccion" type="button"
|
||||
class="btn btn-secondary waves-effect waves-light float-start"><?= lang("Presupuestos.insertar") ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- //.Direcciones envio -->
|
||||
|
||||
<div id="div-envio-fp-1" class="mt-3 datos-envio-fp-1"> <!-- Direcciones envio fp 1 -->
|
||||
<div class="divider divider-dark text-start mb-1">
|
||||
<div class="divider-text">
|
||||
<h6>
|
||||
Dirección de envío ferro/prototipo
|
||||
</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div id='alert-envio-fp1'></div>
|
||||
|
||||
<div id='rowTable' class='row'>
|
||||
<table id="tableOfDireccionesEnvioFP1"
|
||||
class="table comparator-table dt-responsive dataTable px-2 update-resumen-presupuesto"
|
||||
style="width: 95%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="lp-header">TARIFA ID</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.cantidad') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.peso') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.att') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.email') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.direccion') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.cp') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.municipio') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.pais') ?></th>
|
||||
<th class="lp-header">pais_id</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.telefono') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.proveedor') ?></th>
|
||||
<th class="lp-header">Proveedor_id</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.costePrecio') ?></th>
|
||||
<th class="lp-header"><?= lang('Tarifaacabado.margen') ?></th>
|
||||
<th class="lp-header">Pallets?</th>
|
||||
<th style="min-width:120px !important;" class="lp-header">
|
||||
<?= lang('Basic.global.Action') ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-4 px-4 py-2">
|
||||
<input class="form-check-input check-direccion-fp" type="checkbox" id="sameAddPrincipalFP1"
|
||||
name="sameAddPrincipalFP1" value="1" >
|
||||
<label class="form-check-label"
|
||||
for="sameAddPrincipalFP1"><?= lang('PresupuestosDirecciones.sameAddPrincipal') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="rowInsertarEnvioFP1" class="row datos-envio-fp-1">
|
||||
<div class="col-md-12 col-lg-4 px-4 py-2">
|
||||
<button id="insertar_direccion_fp1" type="button"
|
||||
class="btn btn-secondary waves-effect waves-light float-start"><?= lang("Presupuestos.insertar") ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- //.Direcciones envio fp1-->
|
||||
|
||||
<div id="div-envio-fp-2" class="mt-3 datos-envio-fp-2"> <!-- Direcciones envio fp 2 -->
|
||||
<div class="divider divider-dark text-start mb-1">
|
||||
<div class="divider-text">
|
||||
<h6>
|
||||
Dirección de envío ferro/prototipo 2
|
||||
</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div id='alert-envio-fp2'></div>
|
||||
|
||||
<div id='rowTable' class='row'>
|
||||
<table id="tableOfDireccionesEnvioFP2"
|
||||
class="table comparator-table dt-responsive dataTable px-2 update-resumen-presupuesto"
|
||||
style="width: 95%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="lp-header">TARIFA ID</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.cantidad') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.peso') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.att') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.email') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.direccion') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.cp') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.municipio') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.pais') ?></th>
|
||||
<th class="lp-header">pais_id</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.telefono') ?></th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.proveedor') ?></th>
|
||||
<th class="lp-header">Proveedor_id</th>
|
||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.costePrecio') ?></th>
|
||||
<th class="lp-header"><?= lang('Tarifaacabado.margen') ?></th>
|
||||
<th class="lp-header">Pallets?</th>
|
||||
<th style="min-width:120px !important;" class="lp-header">
|
||||
<?= lang('Basic.global.Action') ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="row d-flex justify-content-start">
|
||||
<div class="col-auto px-2 py-2">
|
||||
<input class="form-check-input check-direccion-fp-2" type="checkbox" id="sameAddPrincipalFP2"
|
||||
name="sameAddPrincipalFP2" value="1" >
|
||||
<label class="form-check-label"
|
||||
for="sameAddPrincipalFP2"><?= lang('PresupuestosDirecciones.sameAddPrincipal') ?></label>
|
||||
</div>
|
||||
<div class="col-auto px-2 py-2">
|
||||
<input class="form-check-input check-direccion-fp-2" type="checkbox" id="sameAddFP1" name="sameAddFP1" value="1"
|
||||
>
|
||||
<label class="form-check-label"
|
||||
for="sameAddFP1"><?= lang('PresupuestosDirecciones.sameAddFP1') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="rowInsertarEnvioFP2" class="row datos-envio-fp-2">
|
||||
<div class="col-md-12 col-lg-4 px-4 py-2">
|
||||
<button id="insertar_direccion_fp2" type="button"
|
||||
class="btn btn-secondary waves-effect waves-light float-start"><?= lang("Presupuestos.insertar") ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- //.Direcciones envio fp2-->
|
||||
|
||||
</div> <!-- //.accordion-body -->
|
||||
</div> <!-- //.accordion-collapse -->
|
||||
</div> <!-- //.accordion-item -->
|
||||
</div> <!-- //.accordion -->
|
||||
|
||||
</div> <!-- //.accordion -->
|
||||
@ -303,11 +303,20 @@
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-md-12 col-lg-3 px-4">
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="prototipo_2" class="form-check-label">
|
||||
<input type="checkbox" id="prototipo_2" name="prototipo_2" value="1"
|
||||
class="form-check-input" service="extra"
|
||||
service-id=<?= $serviciosAutomaticos['prototipo_2'] ?>>
|
||||
<?= lang('Presupuestos.prototipo_2') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
</div>
|
||||
|
||||
@ -326,6 +335,18 @@
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-md-12 col-lg-3 px-4">
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="ferro_2" class="form-check-label">
|
||||
<input type="checkbox" id="ferro_2" name="ferro_2" value="1" class="form-check-input"
|
||||
service="extra" service-id=<?= $serviciosAutomaticos['ferro_2'] ?>>
|
||||
<?= lang('Presupuestos.ferro_2') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
|
||||
<div class="col-md-12 col-lg-3 px-4">
|
||||
<div class="mb-3">
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div id="addressForm" action='create' class="modal fade addModal">
|
||||
<div id="addressForm" action='create' data-table="" class="modal fade addModal">
|
||||
<div class="modal-dialog modal-lg modal-simple">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -9,14 +9,6 @@
|
||||
|
||||
<div id='error-tarifa'></div>
|
||||
|
||||
<div class="mb-3" id="direccionFerroProto">
|
||||
<label for="dirFerroProto" class="form-label">
|
||||
Dirección Ferro o Prototipo
|
||||
</label>
|
||||
<input type="checkbox" id="dirFerroProto" class="form-check-input">
|
||||
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="add_clientedAdd" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.clientedAdd') ?>*
|
||||
|
||||
@ -155,7 +155,7 @@
|
||||
<!-- Configuraciones -->
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12">
|
||||
<a id="pv_bn_pg" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<a id="pv_bn_pg" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelGenerico") ?>
|
||||
@ -164,7 +164,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_bn_pi" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<a id="pv_bn_pi" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelCompra") ?>
|
||||
@ -173,7 +173,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_bn_mi" href="#" sk-url="<?= str_replace('/0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<a id="pv_bn_mi" href="#" sk-url="<?= str_replace('0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewAreaImpresion") ?>
|
||||
@ -237,7 +237,7 @@
|
||||
<!-- Configuraciones -->
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12">
|
||||
<a id="pv_bnhq_pg" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<a id="pv_bnhq_pg" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelGenerico") ?>
|
||||
@ -246,7 +246,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_bnhq_pi" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<a id="pv_bnhq_pi" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelCompra") ?>
|
||||
@ -255,7 +255,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_bnhq_mi" href="#" sk-url="<?= str_replace('/0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<a id="pv_bnhq_mi" href="#" sk-url="<?= str_replace('0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewAreaImpresion") ?>
|
||||
@ -319,7 +319,7 @@
|
||||
<!-- Configuraciones -->
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12">
|
||||
<a id="pv_color_pg" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<a id="pv_color_pg" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelGenerico") ?>
|
||||
@ -328,7 +328,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_color_pi" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<a id="pv_color_pi" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelCompra") ?>
|
||||
@ -337,7 +337,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_color_mi" href="#" sk-url="<?= str_replace('/0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<a id="pv_color_mi" href="#" sk-url="<?= str_replace('0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewAreaImpresion") ?>
|
||||
@ -401,7 +401,7 @@
|
||||
<!-- Configuraciones -->
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12">
|
||||
<a id="pv_colorhq_pg" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<a id="pv_colorhq_pg" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelGenerico") ?>
|
||||
@ -410,7 +410,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_colorhq_pi" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<a id="pv_colorhq_pi" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelCompra") ?>
|
||||
@ -419,7 +419,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_colorhq_mi" href="#" sk-url="<?= str_replace('/0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<a id="pv_colorhq_mi" href="#" sk-url="<?= str_replace('0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewAreaImpresion") ?>
|
||||
@ -485,7 +485,7 @@
|
||||
<!-- Configuraciones -->
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12">
|
||||
<a id="pv_rot_bn_pg" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<a id="pv_rot_bn_pg" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelGenerico") ?>
|
||||
@ -494,7 +494,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_rot_bn_pi" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<a id="pv_rot_bn_pi" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelCompra") ?>
|
||||
@ -503,7 +503,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_rot_bn_mi" href="#" sk-url="<?= str_replace('/0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<a id="pv_rot_bn_mi" href="#" sk-url="<?= str_replace('0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewAreaImpresion") ?>
|
||||
@ -565,7 +565,7 @@
|
||||
<!-- Configuraciones -->
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12">
|
||||
<a id="pv_rot_color_pg" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<a id="pv_rot_color_pg" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelGenerico") ?>
|
||||
@ -574,7 +574,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_rot_color_pi" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<a id="pv_rot_color_pi" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelCompra") ?>
|
||||
@ -583,7 +583,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_rot_color_mi" href="#" sk-url="<?= str_replace('/0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<a id="pv_rot_color_mi" href="#" sk-url="<?= str_replace('0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button"
|
||||
class="btn btn-label-primary">
|
||||
@ -646,7 +646,7 @@
|
||||
<!-- Configuraciones -->
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12">
|
||||
<a id="pv_guardas_pg" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<a id="pv_guardas_pg" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelGenerico") ?>
|
||||
@ -655,7 +655,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_guardas_pi" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<a id="pv_guardas_pi" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelCompra") ?>
|
||||
@ -664,7 +664,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_guardas_mi" href="#" sk-url="<?= str_replace('/0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<a id="pv_guardas_mi" href="#" sk-url="<?= str_replace('0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewAreaImpresion") ?>
|
||||
@ -728,7 +728,7 @@
|
||||
<!-- Configuraciones -->
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12">
|
||||
<a id="pv_cubierta_pg" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<a id="pv_cubierta_pg" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelGenerico") ?>
|
||||
@ -737,7 +737,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_cubierta_pi" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<a id="pv_cubierta_pi" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelCompra") ?>
|
||||
@ -746,7 +746,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_cubierta_mi" href="#" sk-url="<?= str_replace('/0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<a id="pv_cubierta_mi" href="#" sk-url="<?= str_replace('0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewAreaImpresion") ?>
|
||||
@ -813,7 +813,7 @@
|
||||
<!-- Configuraciones -->
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12">
|
||||
<a id="pv_ec_pg" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<a id="pv_ec_pg" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelGenerico") ?>
|
||||
@ -822,7 +822,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_ec_pi" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<a id="pv_ec_pi" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelCompra") ?>
|
||||
@ -831,7 +831,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_ec_mi" href="#" sk-url="<?= str_replace('/0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<a id="pv_ec_mi" href="#" sk-url="<?= str_replace('0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewAreaImpresion") ?>
|
||||
@ -882,7 +882,7 @@
|
||||
<!-- Configuraciones -->
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12">
|
||||
<a id="pv_sobrecubierta_pg" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<a id="pv_sobrecubierta_pg" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelGenerico") ?>
|
||||
@ -891,7 +891,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_sobrecubierta_pi" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<a id="pv_sobrecubierta_pi" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelCompra") ?>
|
||||
@ -900,7 +900,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_sobrecubierta_mi" href="#" sk-url="<?= str_replace('/0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<a id="pv_sobrecubierta_mi" href="#" sk-url="<?= str_replace('0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewAreaImpresion") ?>
|
||||
@ -963,7 +963,7 @@
|
||||
<!-- Configuraciones -->
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-12">
|
||||
<a id="pv_faja_pg" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<a id="pv_faja_pg" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelGenerico', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelGenerico") ?>
|
||||
@ -972,7 +972,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_faja_pi" href="#" sk-url="<?= str_replace('/0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<a id="pv_faja_pi" href="#" sk-url="<?= str_replace('0', '', route_to('updatePapelImpresion', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewPapelCompra") ?>
|
||||
@ -981,7 +981,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a id="pv_faja_mi" href="#" sk-url="<?= str_replace('/0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<a id="pv_faja_mi" href="#" sk-url="<?= str_replace('0', '', route_to('updateMaquina', 0)); ?>" target="_blank">
|
||||
<div class="d-grid">
|
||||
<button type="button" class="btn btn-label-primary">
|
||||
<?= lang("Presupuestos.previewAreaImpresion") ?>
|
||||
|
||||
@ -13,92 +13,110 @@
|
||||
<div class="col-xl-12">
|
||||
<div class="border rounded p-4 mb-3 pb-3">
|
||||
|
||||
<!-- Price Details -->
|
||||
<dl class="row mb-0">
|
||||
<dt class="col-5 py-1 fw-normal text-end">Coste papel</dt>
|
||||
<dd class="py-1 col-6 text-end"><span id="totalCostePapel"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 py-1 fw-normal text-end">Margen papel</dt>
|
||||
<dd class="col-3 text-end py-1"><span id="porcentajeMargenPapel"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1"><span id="margenPapel"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h5 class="mb-0">Costes detallados</h5>
|
||||
<button class="btn btn-sm btn-link p-0" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#detallesCostes" aria-expanded="true"
|
||||
aria-controls="detallesCostes" title="Mostrar/ocultar detalle de precios">
|
||||
<i class="ti ti-chevron-down"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<dt class="col-5 fw-normal text-end">
|
||||
<a href="javascript:void(0);" data-bs-toggle="collapse" data-bs-target=".costes-impresion" aria-expanded="false" aria-controls="costes-impresion">
|
||||
<i class="ti ti-list ti-sm mx-2"></i>
|
||||
</a>
|
||||
Coste impresión
|
||||
</dt>
|
||||
<dd class="col-6 text-end py-1"><span id="totalCosteImpresion"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<!-- Bloque colapsable, sin <div>, solo usando clases -->
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste clicks</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteClicks" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<div id="detallesCostes" class="collapse">
|
||||
<!-- Price Details -->
|
||||
<dl class="row mb-0">
|
||||
<dt class="col-5 py-1 fw-normal text-end">Coste papel</dt>
|
||||
<dd class="py-1 col-6 text-end"><span id="totalCostePapel"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 py-1 fw-normal text-end">Margen papel</dt>
|
||||
<dd class="col-3 text-end py-1"><span id="porcentajeMargenPapel"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1"><span id="margenPapel"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste horas</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteHoras" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end">
|
||||
<a href="javascript:void(0);" data-bs-toggle="collapse"
|
||||
data-bs-target=".costes-impresion" aria-expanded="false"
|
||||
aria-controls="costes-impresion">
|
||||
<i class="ti ti-list ti-sm mx-2"></i>
|
||||
</a>
|
||||
Coste impresión
|
||||
</dt>
|
||||
<dd class="col-6 text-end py-1"><span id="totalCosteImpresion"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<!-- Bloque colapsable, sin <div>, solo usando clases -->
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste clicks</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteClicks" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste tinta</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteTinta" class="autonumeric-resumen-currency" ></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste horas</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteHoras" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste corte</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteCorte" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 py-1 fw-normal text-end">
|
||||
<a href="javascript:void(0);" data-bs-toggle="collapse" data-bs-target=".margen-impresion" aria-expanded="false" aria-controls="margen-impresion">
|
||||
<i class="ti ti-list ti-sm mx-2"></i>
|
||||
</a>
|
||||
Margen impresión
|
||||
</dt>
|
||||
<dd class="col-3 text-end py-1"><span id="porcentajeMargenImpresion"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1"><span id="margenImpresion"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<!-- Bloque colapsable, sin <div>, solo usando clases -->
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen clicks</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenClicks" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste tinta</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteTinta" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen horas</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenHoras" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end collapse costes-impresion">Coste corte</dt>
|
||||
<dd class="col-6 text-end py-1 collapse costes-impresion">
|
||||
<span id="totalCosteCorte" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 py-1 fw-normal text-end">
|
||||
<a href="javascript:void(0);" data-bs-toggle="collapse"
|
||||
data-bs-target=".margen-impresion" aria-expanded="false"
|
||||
aria-controls="margen-impresion">
|
||||
<i class="ti ti-list ti-sm mx-2"></i>
|
||||
</a>
|
||||
Margen impresión
|
||||
</dt>
|
||||
<dd class="col-3 text-end py-1"><span id="porcentajeMargenImpresion"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1"><span id="margenImpresion"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<!-- Bloque colapsable, sin <div>, solo usando clases -->
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen clicks</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenClicks" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen tinta</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenTinta" class="autonumeric-resumen-currency" ></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen horas</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenHoras" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen corte</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenCorte" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen tinta</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenTinta" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end collapse margen-impresion">Margen corte</dt>
|
||||
<dd class="col-6 text-end py-1 collapse margen-impresion">
|
||||
<span id="totalMargenCorte" class="autonumeric-resumen-currency"></span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end">Coste servicios</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="totalServicios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 fw-normal text-end">Margen servicios</dt>
|
||||
<dd class="col-3 text-end py-1 "><span id="porcentajeMargenServicios"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1 "><span id="margenServicios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end">Coste de envío</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="costeEnvios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 fw-normal text-end">Margen envío</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="margenEnvios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
|
||||
<dt class="col-5 fw-normal text-end">Coste servicios</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="totalServicios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 fw-normal text-end">Margen servicios</dt>
|
||||
<dd class="col-3 text-end py-1 "><span id="porcentajeMargenServicios"
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1 "><span id="margenServicios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
|
||||
<dt class="col-5 fw-normal text-end">Coste de envío</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="costeEnvios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 fw-normal text-end">Margen envío</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="margenEnvios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
</dl>
|
||||
|
||||
<hr class="mx-n4">
|
||||
|
||||
@ -111,7 +129,7 @@
|
||||
class="autonumeric-resumen-percent"></span></dd>
|
||||
<dd class="col-3 text-end py-1"><span id="totalMargenes"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
<dt class="col-5 fw-normal text-end">Total envío base</dt>
|
||||
<dt class="col-5 fw-normal text-end">Total envío base</dt>
|
||||
<dd class="col-6 text-end py-1 "><span id="precioEnvios"
|
||||
class="autonumeric-resumen-currency"></span></dd>
|
||||
</dl>
|
||||
@ -168,7 +186,8 @@
|
||||
<div class="col-xl-12 mt-3">
|
||||
<div class="card border border-secondary-subtle rounded-3">
|
||||
<div class="card-body">
|
||||
<div id="div_ajustar_error" class="alert alert-danger d-flex align-items-baseline d-none" role="alert">
|
||||
<div id="div_ajustar_error" class="alert alert-danger d-flex align-items-baseline d-none"
|
||||
role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-ban ti-sm"></i>
|
||||
</span>
|
||||
@ -194,15 +213,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php /*if ($presupuestoEntity->estado_id == 2): ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 mb-1">
|
||||
<label for="totalAceptado"
|
||||
class="form-label"><?= lang('Presupuestos.totalAceptado') ?></label>
|
||||
<input disabled type="text" id="totalAceptado" name="totalAceptado"
|
||||
class="form-control text-center fs-5 autonumeric-resumen-currency" value="" <?php echo ($tipo_impresion_id == 21) ? ' max=80' : '' ?>>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; */ ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 mb-1">
|
||||
<label for="totalAceptado"
|
||||
class="form-label"><?= lang('Presupuestos.totalAceptado') ?></label>
|
||||
<input disabled type="text" id="totalAceptado" name="totalAceptado"
|
||||
class="form-control text-center fs-5 autonumeric-resumen-currency" value="" <?php echo ($tipo_impresion_id == 21) ? ' max=80' : '' ?>>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; */ ?>
|
||||
<div class="row">
|
||||
<p>
|
||||
<span id="aprobado_by_at"></span>
|
||||
|
||||
@ -228,6 +228,7 @@
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
|
||||
$(document).keypress(function(e) {
|
||||
var key = e.which;
|
||||
if (key == 13) // the enter key code
|
||||
|
||||
@ -68,6 +68,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="sk-alert-ferro-prototipo1">
|
||||
</div>
|
||||
<div id="direccionesFerroPrototipo" class="row col-sm-12 mb-5 justify-content-center d-none">
|
||||
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
|
||||
<h3 class="mb-1 fw-bold"> Dirección de envío ferro/prototipo</h3>
|
||||
@ -101,11 +104,14 @@
|
||||
</div>
|
||||
|
||||
<div id="divDireccionesFerroPrototipo"
|
||||
class="calcular-presupuesto col-sm-12 d-flex flex-column align-items-center div-direcciones-ferro-prototipo">
|
||||
class="col-sm-12 d-flex flex-column align-items-center div-direcciones-ferro-prototipo">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="sk-alert-ferro-prototipo2">
|
||||
</div>
|
||||
<div id="direccionesFerroPrototipo2" class="row col-sm-12 mb-5 justify-content-center d-none">
|
||||
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
|
||||
<h3 class="mb-1 fw-bold"> Dirección de envío ferro/prototipo 2</h3>
|
||||
@ -146,7 +152,7 @@
|
||||
</div>
|
||||
|
||||
<div id="divDireccionesFerroPrototipo2"
|
||||
class="calcular-presupuesto col-sm-12 d-flex flex-column align-items-center div-direcciones-ferro-prototipo">
|
||||
class="col-sm-12 d-flex flex-column align-items-center div-direcciones-ferro-prototipo">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?= view("themes/vuexy/components/dropzone",data: ['id' => 'dropzone-ot-files','modelId' => $presupuesto->id]) ?>
|
||||
<?= view("themes/vuexy/components/dropzone", data: [
|
||||
'id' => 'dropzone-ot-files',
|
||||
'modelId' => $presupuesto->id,
|
||||
'otId' => $ot->id
|
||||
]) ?>
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
@ -59,6 +59,7 @@ class Ajax {
|
||||
error: this.error
|
||||
})
|
||||
}
|
||||
|
||||
getPromise() {
|
||||
if (this.jqXHR) {
|
||||
this.jqXHR.abort();
|
||||
@ -71,7 +72,7 @@ class Ajax {
|
||||
data: this.data,
|
||||
headers: this.headers,
|
||||
success: (response) => {
|
||||
if (this.success) this.success(response);
|
||||
if (this.success) this.success(response);
|
||||
resolve(response);
|
||||
},
|
||||
error: (xhr) => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
import Ajax from '../ajax.js';
|
||||
import { alertSuccessMessage } from '../alerts/sweetAlert.js'
|
||||
import { alertSuccessMessage, alertWarningMessage } from '../alerts/sweetAlert.js'
|
||||
|
||||
const PREVIEW_TEMPLATE = `
|
||||
<div class="dz-preview dz-file-preview">
|
||||
@ -25,7 +25,7 @@ const PREVIEW_TEMPLATE = `
|
||||
class FileUploadDropzone {
|
||||
|
||||
|
||||
constructor({ domElement, nameId = "presupuesto_id", getUri = null, postUri = null, resourcePath = "presupuestos" }) {
|
||||
constructor({ domElement, nameId = "presupuesto_id", getUri = null, postUri = null, resourcePath = "presupuestos", otId = null }) {
|
||||
Dropzone.autoDiscover = false;
|
||||
this.domElement = domElement
|
||||
this.jqElement = $(domElement)
|
||||
@ -35,6 +35,7 @@ class FileUploadDropzone {
|
||||
this.btnDownloadFiles = $(`#${domElement.replace('#', '')}_btnDownloadFiles`);
|
||||
this.dataPost = {}
|
||||
this.nameId = nameId;
|
||||
this.otId = otId;
|
||||
this.getUri = getUri
|
||||
this.postUri = postUri
|
||||
this.dataPost[nameId] = this.modelId;
|
||||
@ -160,7 +161,8 @@ class FileUploadDropzone {
|
||||
url: `/presupuestoadmin/download_zip`,
|
||||
type: 'POST',
|
||||
data: {
|
||||
[this.nameId]: this.modelId
|
||||
[this.nameId]: this.modelId,
|
||||
'ot_id': this.otId
|
||||
},
|
||||
xhrFields: {
|
||||
responseType: 'blob'
|
||||
@ -185,7 +187,7 @@ class FileUploadDropzone {
|
||||
window.URL.revokeObjectURL(url);
|
||||
},
|
||||
error: () => {
|
||||
alertWarningMessage("Error al descargar el archivo ZIP.");
|
||||
alertWarningMessage("Error", "Error al descargar el archivo ZIP.");
|
||||
},
|
||||
complete: () => {
|
||||
$("#loader").modal('hide');
|
||||
|
||||
@ -325,6 +325,12 @@ class PresupuestoAdminEdit {
|
||||
|
||||
datos.tirada_alternativa_json_data = this.tiradasAlternativas.generate_json_tiradas();
|
||||
|
||||
datos.direcciones_fp_checks = JSON.stringify({
|
||||
"addFP1isAddMain": $('#sameAddPrincipalFP1').prop('checked')? "1":"0",
|
||||
"addFP2isAddMain": $('#sameAddPrincipalFP2').prop('checked')? "1":"0",
|
||||
"addFP2isaddFP1": $('#sameAddFP1').prop('checked')? "1":"0",
|
||||
});
|
||||
|
||||
return datos;
|
||||
}
|
||||
|
||||
@ -404,7 +410,9 @@ class PresupuestoAdminEdit {
|
||||
|
||||
const totalAceptadoRevisado = response.data.total_aceptado_revisado != null ?
|
||||
response.data.total_aceptado_revisado : response.data.resumen.total_aceptado;
|
||||
AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]).set(totalAceptadoRevisado);
|
||||
if((!isNaN(totalAceptadoRevisado) && totalAceptadoRevisado !== null) || totalAceptadoRevisado === 0) {
|
||||
AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]).set(totalAceptadoRevisado);
|
||||
}
|
||||
|
||||
$('#aprobado_by_at').html(response.data.aprobado_by_at);
|
||||
|
||||
@ -421,7 +429,7 @@ class PresupuestoAdminEdit {
|
||||
self.lineasPresupuesto.cargarDatos(response.data.lineasPresupuesto);
|
||||
|
||||
self.servicios.cargar(response.data.servicios);
|
||||
self.envios.cargar(response.data.direcciones);
|
||||
self.envios.cargar(response.data.direcciones, response.data.direccionesFP);
|
||||
|
||||
self.comparador.cargarDatos(response.data.comparador);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import ClassSelect from '../../../components/select2.js';
|
||||
import { getToken } from '../../../common/common.js';
|
||||
import ClassSelect from '../../../components/select2.js';
|
||||
|
||||
class DatosLibro {
|
||||
|
||||
@ -63,7 +63,9 @@ class DatosLibro {
|
||||
this.retractilado = this.domItem.find('#retractilado');
|
||||
this.retractilado5 = this.domItem.find('#retractilado5');
|
||||
this.prototipo = this.domItem.find('#prototipo');
|
||||
this.prototipo_2 = this.domItem.find('#prototipo_2');
|
||||
this.ferro = this.domItem.find('#ferro');
|
||||
this.ferro_2 = this.domItem.find('#ferro_2');
|
||||
this.ferroDigital = this.domItem.find('#ferroDigital');
|
||||
this.marcapaginas = this.domItem.find('#marcapaginas');
|
||||
|
||||
@ -157,7 +159,9 @@ class DatosLibro {
|
||||
this.retractilado.on('change', this.checkRetractilado.bind(this));
|
||||
this.retractilado5.on('change', this.checkRetractilado.bind(this));
|
||||
this.ferro.on('change', this.changeFerro.bind(this));
|
||||
this.ferro_2.on('change', this.changeFerro2.bind(this));
|
||||
this.prototipo.on('change', this.changePrototipo.bind(this));
|
||||
this.prototipo_2.on('change', this.changePrototipo2.bind(this));
|
||||
this.ferroDigital.on('change', this.changeFerroDigital.bind(this));
|
||||
|
||||
this.tamanio.item.on('select2:select', this.changeFormato.bind(this));
|
||||
@ -190,7 +194,7 @@ class DatosLibro {
|
||||
changeFaja() {
|
||||
|
||||
if (this._bloqueoCambioFaja) return;
|
||||
this._bloqueoCambioFaja = true;
|
||||
this._bloqueoCambioFaja = true;
|
||||
|
||||
if (this.faja.prop('checked')) {
|
||||
this.div_faja.removeClass('d-none');
|
||||
@ -246,6 +250,20 @@ class DatosLibro {
|
||||
|
||||
if (this.ferro.prop('checked')) {
|
||||
$(document).trigger('add-servicio-lineas', 'ferro');
|
||||
this.ferro_2.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'ferro_2');
|
||||
this.prototipo.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'prototipo_2');
|
||||
this.prototipo_2.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'prototipo');
|
||||
$('.datos-envio-fp-1').removeClass('d-none');
|
||||
$('.datos-envio-fp-2').addClass('d-none');
|
||||
$('.check-direccion-fp').prop('checked', false);
|
||||
$('.check-direccion-fp-2').prop('checked', false);
|
||||
const table_2 = $('#tableOfDireccionesEnvioFP2').DataTable();
|
||||
table_2.clear().draw();
|
||||
const table = $('#tableOfDireccionesEnvioFP1').DataTable();
|
||||
table.columns.adjust().draw();
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
@ -256,25 +274,63 @@ class DatosLibro {
|
||||
}
|
||||
else {
|
||||
$(document).trigger('remove-servicio-lineas', 'ferro');
|
||||
if (!this.prototipo.prop('checked')) {
|
||||
const table = $('#tableOfDireccionesEnvio').DataTable();
|
||||
const rows = table.rows().data();
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
const rowData = rows[i];
|
||||
if (rowData.is_ferro_prototipo == 1) {
|
||||
table.rows(i).remove();
|
||||
table.draw();
|
||||
break;
|
||||
}
|
||||
}
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
});
|
||||
}
|
||||
const table = $('#tableOfDireccionesEnvioFP1').DataTable();
|
||||
table.clear().draw();
|
||||
$('.datos-envio-fp-1').addClass('d-none');
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
changeFerro2() {
|
||||
|
||||
if (this.cargando)
|
||||
return;
|
||||
|
||||
if (this.ferro_2.prop('checked')) {
|
||||
$(document).trigger('add-servicio-lineas', 'ferro_2');
|
||||
this.ferro.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'ferro');
|
||||
this.prototipo.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'prototipo_2');
|
||||
this.prototipo_2.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'prototipo');
|
||||
$('.datos-envio-fp-1').removeClass('d-none');
|
||||
$('.datos-envio-fp-2').removeClass('d-none');
|
||||
$('.check-direccion-fp').prop('checked', false);
|
||||
$('.check-direccion-fp-2').prop('checked', false);
|
||||
const table = $('#tableOfDireccionesEnvioFP1').DataTable();
|
||||
table.columns.adjust().draw();
|
||||
const table_2 = $('#tableOfDireccionesEnvioFP2').DataTable();
|
||||
table_2.columns.adjust().draw();
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: true,
|
||||
update_resumen: false,
|
||||
update_tiradas_alternativas: false
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(document).trigger('remove-servicio-lineas', 'ferro_2');
|
||||
const table = $('#tableOfDireccionesEnvioFP1').DataTable();
|
||||
table.clear().draw();
|
||||
const table_2 = $('#tableOfDireccionesEnvioFP2').DataTable();
|
||||
table_2.clear().draw();
|
||||
$('.datos-envio-fp-1').addClass('d-none');
|
||||
$('.datos-envio-fp-2').addClass('d-none');
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,6 +354,21 @@ class DatosLibro {
|
||||
|
||||
if (this.prototipo.prop('checked')) {
|
||||
$(document).trigger('add-servicio-lineas', 'prototipo');
|
||||
this.ferro.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'ferro');
|
||||
this.ferro_2.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'ferro_2');
|
||||
this.prototipo_2.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'prototipo_2');
|
||||
$('.datos-envio-fp-1').removeClass('d-none');
|
||||
$('.datos-envio-fp-2').addClass('d-none');
|
||||
$('.check-direccion-fp').prop('checked', false);
|
||||
$('.check-direccion-fp-2').prop('checked', false);
|
||||
const table = $('#tableOfDireccionesEnvioFP1').DataTable();
|
||||
table.columns.adjust().draw();
|
||||
const table_2 = $('#tableOfDireccionesEnvioFP2').DataTable();
|
||||
table_2.clear().draw();
|
||||
table_2.columns.adjust().draw();
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
@ -308,28 +379,64 @@ class DatosLibro {
|
||||
}
|
||||
else {
|
||||
$(document).trigger('remove-servicio-lineas', 'prototipo');
|
||||
if (!this.ferro.prop('checked')) {
|
||||
const table = $('#tableOfDireccionesEnvio').DataTable();
|
||||
const rows = table.rows().data();
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
const rowData = rows[i];
|
||||
if (rowData.is_ferro_prototipo == 1) {
|
||||
table.rows(i).remove();
|
||||
table.draw();
|
||||
break;
|
||||
}
|
||||
}
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
});
|
||||
}
|
||||
const table = $('#tableOfDireccionesEnvioFP1').DataTable();
|
||||
table.clear().draw();
|
||||
$('.datos-envio-fp-1').addClass('d-none');
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
changePrototipo2() {
|
||||
|
||||
if (this.cargando)
|
||||
return;
|
||||
|
||||
if (this.prototipo_2.prop('checked')) {
|
||||
$(document).trigger('add-servicio-lineas', 'prototipo_2');
|
||||
this.ferro.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'ferro');
|
||||
this.ferro_2.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'ferro_2');
|
||||
this.prototipo.prop('checked', false);
|
||||
$(document).trigger('remove-servicio-lineas', 'prototipo');
|
||||
$('.datos-envio-fp-1').removeClass('d-none');
|
||||
$('.datos-envio-fp-2').removeClass('d-none');
|
||||
const table = $('#tableOfDireccionesEnvioFP1').DataTable();
|
||||
table.columns.adjust().draw();
|
||||
const table_2 = $('#tableOfDireccionesEnvioFP2').DataTable();
|
||||
table_2.columns.adjust().draw();
|
||||
$('.check-direccion-fp-2').prop('checked', false);
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: true,
|
||||
update_resumen: false,
|
||||
update_tiradas_alternativas: false
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(document).trigger('remove-servicio-lineas', 'prototipo_2');
|
||||
const table = $('#tableOfDireccionesEnvioFP1').DataTable();
|
||||
table.clear().draw();
|
||||
const table_2 = $('#tableOfDireccionesEnvioFP2').DataTable();
|
||||
table_2.clear().draw();
|
||||
$('.datos-envio-fp-1').addClass('d-none');
|
||||
$('.datos-envio-fp-2').addClass('d-none');
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
checkRetractilado(event) {
|
||||
|
||||
@ -587,6 +694,8 @@ class DatosLibro {
|
||||
this.actualizarLimitesPaginas();
|
||||
|
||||
}
|
||||
|
||||
this.calcularSolapas();
|
||||
}
|
||||
|
||||
updateComparador() {
|
||||
@ -763,7 +872,9 @@ class DatosLibro {
|
||||
this.retractilado.prop('checked', datos.retractilado);
|
||||
this.retractilado5.prop('checked', datos.retractilado5);
|
||||
this.prototipo.prop('checked', datos.prototipo);
|
||||
this.prototipo_2.prop('checked', datos.prototipo2);
|
||||
this.ferro.prop('checked', datos.ferro);
|
||||
this.ferro_2.prop('checked', datos.ferro2);
|
||||
this.ferroDigital.prop('checked', datos.ferroDigital);
|
||||
this.marcapaginas.prop('checked', datos.marcapaginas);
|
||||
}
|
||||
|
||||
@ -14,11 +14,15 @@ class Envios {
|
||||
this.recogerTaller = $('#recoger_en_taller');
|
||||
|
||||
this.table = null;
|
||||
this.tableFP1 = null;
|
||||
this.tableFP2 = null;
|
||||
this.direccionesClienteForm = new ClassSelect($('#add_clientedAdd'), '/misdirecciones/getSelect2', 'Seleccione una direccion', false, {});
|
||||
this.paisesClienteForm = new ClassSelect($('#add_pais_id'), '/configuracion/paises/menuitems2', 'Seleccione país', false, {});
|
||||
this.modalYesNo = null;
|
||||
|
||||
this.insertarEnvio = $('#insertar_direccion');
|
||||
this.insertarEnvioFP1 = $('#insertar_direccion_fp1');
|
||||
this.insertarEnvioFP2 = $('#insertar_direccion_fp2');
|
||||
|
||||
this.actionBtns_direcciones = function (data) {
|
||||
return `
|
||||
@ -71,7 +75,6 @@ class Envios {
|
||||
},
|
||||
{ 'data': 'margen', render: function (data, type, row) { return Math.round(data) } },
|
||||
{ 'data': 'entregaPieCalle' },
|
||||
{ 'data': 'is_ferro_prototipo' },
|
||||
{
|
||||
data: function (row, type, set, meta) {
|
||||
return `
|
||||
@ -79,7 +82,7 @@ class Envios {
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas btn-delete-envio mx-2"></i></a>
|
||||
`;
|
||||
},
|
||||
className: 'row-edit dt-center'
|
||||
className: 'row-edit'
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
@ -87,10 +90,12 @@ class Envios {
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
// all columns
|
||||
targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
|
||||
//targets: [$('#tableOfDireccionesEnvio').find("tr:first th").length - 1]
|
||||
},
|
||||
{
|
||||
targets: '_all', // Targets all columns
|
||||
className: 'dt-center' // Adds the 'dt-center' class
|
||||
}
|
||||
],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
@ -98,7 +103,7 @@ class Envios {
|
||||
|
||||
drawCallback: function (settings) {
|
||||
|
||||
const boolCols = [15, 16];
|
||||
const boolCols = [15];
|
||||
for (let coln of boolCols) {
|
||||
self.table.column(coln, { page: 'current' }).nodes().each(function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
@ -115,20 +120,188 @@ class Envios {
|
||||
$("#costeEnvios").text(total.toFixed(2) + "€" || "0€");
|
||||
|
||||
self.check_unidades_enviadas(null, self.recogerTaller.prop('checked'));
|
||||
this.api().columns.adjust();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.tableFP1 = $('#tableOfDireccionesEnvioFP1').DataTable({
|
||||
draw: 5,
|
||||
serverSide: false,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
pageLength: 20,
|
||||
lengthChange: false,
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
scrollX: true,
|
||||
ordering: false,
|
||||
columns: [
|
||||
{ 'data': 'tarifa_id' },
|
||||
{ 'data': 'cantidad' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'att' },
|
||||
{ 'data': 'email' },
|
||||
{ 'data': 'direccion' },
|
||||
{ 'data': 'cp' },
|
||||
{ 'data': 'municipio' },
|
||||
{ 'data': 'pais' },
|
||||
{ 'data': 'pais_id', visible: false },
|
||||
{ 'data': 'telefono' },
|
||||
{ 'data': 'proveedor' },
|
||||
{ 'data': 'proveedor_id', visible: false },
|
||||
{
|
||||
'data': 'precio', render: function (data, type, row) {
|
||||
let coste = parseFloat(data).toFixed(2);
|
||||
let precio = parseFloat(data * (1 + row.margen / 100.0)).toFixed(2);
|
||||
return coste + "/" + precio;
|
||||
}
|
||||
},
|
||||
{ 'data': 'margen', render: function (data, type, row) { return Math.round(data) } },
|
||||
{ 'data': 'entregaPieCalle' },
|
||||
{
|
||||
data: function (row, type, set, meta) {
|
||||
return `
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas btn-delete-envio mx-2"></i></a>
|
||||
`;
|
||||
},
|
||||
className: 'row-edit'
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
|
||||
},
|
||||
{
|
||||
targets: '_all', // Targets all columns
|
||||
className: 'dt-center' // Adds the 'dt-center' class
|
||||
}
|
||||
],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
|
||||
drawCallback: function (settings) {
|
||||
|
||||
const boolCols = [15];
|
||||
for (let coln of boolCols) {
|
||||
self.tableFP1.column(coln, { page: 'current' }).nodes().each(function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
});
|
||||
}
|
||||
this.api().columns.adjust();
|
||||
if (self.tableFP1.rows().count() > 0) {
|
||||
$('#rowInsertarEnvioFP1').addClass('d-none');
|
||||
} else {
|
||||
$('#rowInsertarEnvioFP1').removeClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.tableFP2 = $('#tableOfDireccionesEnvioFP2').DataTable({
|
||||
draw: 5,
|
||||
serverSide: false,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
pageLength: 20,
|
||||
lengthChange: false,
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
scrollX: true,
|
||||
ordering: false,
|
||||
columns: [
|
||||
{ 'data': 'tarifa_id' },
|
||||
{ 'data': 'cantidad' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'att' },
|
||||
{ 'data': 'email' },
|
||||
{ 'data': 'direccion' },
|
||||
{ 'data': 'cp' },
|
||||
{ 'data': 'municipio' },
|
||||
{ 'data': 'pais' },
|
||||
{ 'data': 'pais_id', visible: false },
|
||||
{ 'data': 'telefono' },
|
||||
{ 'data': 'proveedor' },
|
||||
{ 'data': 'proveedor_id', visible: false },
|
||||
{
|
||||
'data': 'precio', render: function (data, type, row) {
|
||||
let coste = parseFloat(data).toFixed(2);
|
||||
let precio = parseFloat(data * (1 + row.margen / 100.0)).toFixed(2);
|
||||
return coste + "/" + precio;
|
||||
}
|
||||
},
|
||||
{ 'data': 'margen', render: function (data, type, row) { return Math.round(data) } },
|
||||
{ 'data': 'entregaPieCalle' },
|
||||
{
|
||||
data: function (row, type, set, meta) {
|
||||
return `
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas btn-delete-envio mx-2"></i></a>
|
||||
`;
|
||||
},
|
||||
className: 'row-edit dt-center'
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
|
||||
},
|
||||
{
|
||||
targets: '_all', // Targets all columns
|
||||
className: 'dt-center' // Adds the 'dt-center' class
|
||||
}
|
||||
],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
|
||||
drawCallback: function (settings) {
|
||||
|
||||
const boolCols = [15];
|
||||
for (let coln of boolCols) {
|
||||
self.tableFP2.column(coln, { page: 'current' }).nodes().each(function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
});
|
||||
}
|
||||
this.api().columns.adjust();
|
||||
if (self.tableFP2.rows().count() > 0) {
|
||||
$('#rowInsertarEnvioFP2').addClass('d-none');
|
||||
} else {
|
||||
$('#rowInsertarEnvioFP2').removeClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-delete-envio', function () {
|
||||
const rowId = $(this).closest('td').parent()[0].sectionRowIndex;
|
||||
self.table.row(rowId).remove().draw();
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
});
|
||||
const table = $(this).closest('table').DataTable();
|
||||
table.row(rowId).remove().draw();
|
||||
if (table.table().node().id == 'tableOfDireccionesEnvios') {
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
});
|
||||
}
|
||||
else if (table.table().node().id == 'tableOfDireccionesEnvioFP1') {
|
||||
$('#rowInsertarEnvioFP1').removeClass('d-none');
|
||||
}
|
||||
else if (table.table().node().id == 'tableOfDireccionesEnvioFP2') {
|
||||
$('#rowInsertarEnvioFP2').removeClass('d-none');
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-edit-envio', function () {
|
||||
@ -165,19 +338,7 @@ class Envios {
|
||||
$('#add_telefono').val(data.telefono)
|
||||
$('#add_cantidad').val(data.cantidad)
|
||||
$('#add_entregaPieCalle').prop('checked', data.entregaPieCalle == 1 ? true : false)
|
||||
$('#dirFerroProto').prop('checked', data.is_ferro_prototipo == 1 ? true : false)
|
||||
|
||||
if (data.is_ferro_prototipo == 1) {
|
||||
$('#add_cantidad').val(1);
|
||||
$('#add_cantidad').attr('disabled', true);
|
||||
$('#dirFerroProto').prop('disabled', true);
|
||||
$('#direccionFerroProto').removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
$('#add_cantidad').attr('disabled', false);
|
||||
$('#dirFerroProto').prop('disabled', false);
|
||||
$('#direccionFerroProto').addClass('d-none');
|
||||
}
|
||||
|
||||
self.direccionesClienteForm.setParams({ 'cliente_id': () => $("#clienteId").select2('data')[0].id });
|
||||
self.direccionesClienteForm.init();
|
||||
@ -215,6 +376,8 @@ class Envios {
|
||||
|
||||
|
||||
this.insertarEnvio.on('click', this.addEnvio.bind(this));
|
||||
this.insertarEnvioFP1.on('click', this.addEnvio.bind(this, 'fp1'));
|
||||
this.insertarEnvioFP2.on('click', this.addEnvio.bind(this, 'fp2'));
|
||||
|
||||
this.initFormularioDireccionEnvio();
|
||||
|
||||
@ -225,12 +388,17 @@ class Envios {
|
||||
$(document).trigger('update-envios-completed');
|
||||
|
||||
});
|
||||
|
||||
$(document).on('ckeck-lineas-envios', this.check_unidades_enviadas.bind(this));
|
||||
$('#sameAddPrincipalFP1').on('change', this.sameAddPrincipalFP1.bind(this));
|
||||
$('#sameAddPrincipalFP2').on('change', this.sameAddPrincipalFP2.bind(this));
|
||||
$('#sameAddFP1').on('change', this.sameAddFP1.bind(this));
|
||||
}
|
||||
|
||||
addEnvio() {
|
||||
addEnvio(table = '') {
|
||||
|
||||
$("#addressForm").attr('action', 'create');
|
||||
|
||||
let newAddDialog = $("#addressForm");
|
||||
this.direccionesClienteForm.setParams({ 'cliente_id': () => $("#clienteId").select2('data')[0].id });
|
||||
this.direccionesClienteForm.init();
|
||||
@ -243,34 +411,27 @@ class Envios {
|
||||
})
|
||||
|
||||
let cantidad_total = 0;
|
||||
let hasFerroPrototipo = false;
|
||||
$('#tableOfDireccionesEnvio').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
let data = this.data();
|
||||
if (data.is_ferro_prototipo == 0)
|
||||
cantidad_total += parseInt(data.cantidad);
|
||||
else
|
||||
hasFerroPrototipo = true;
|
||||
cantidad_total += parseInt(data.cantidad);
|
||||
});
|
||||
const restante = parseInt($('#tirada').val()) - cantidad_total;
|
||||
$('#add_cantidad').attr('max-value', restante);
|
||||
$('#add_cantidad').val(restante > 0 ? restante : 0);
|
||||
|
||||
if (hasFerroPrototipo) {
|
||||
$('#dirFerroProto').prop('checked', false);
|
||||
$('#direccionFerroProto').addClass('d-none');
|
||||
$('#add_cantidad').attr('disabled', false);
|
||||
|
||||
if (table != '') {
|
||||
$("#addressForm").attr('data-table', table);
|
||||
$('#add_entregaPieCalle').prop('disabled', true);
|
||||
$('#add_cantidad').val(1);
|
||||
$('#add_cantidad').prop('disabled', true);
|
||||
}
|
||||
else {
|
||||
if (restante == 0) {
|
||||
$('#direccionFerroProto').removeClass('d-none');
|
||||
$('#dirFerroProto').prop('checked', true);
|
||||
$('#dirFerroProto').prop('disabled', true);
|
||||
$('#add_cantidad').attr('disabled', true);
|
||||
$('#add_cantidad').val(1);
|
||||
}
|
||||
$("#addressForm").attr('data-table', '');
|
||||
$('#add_entregaPieCalle').prop('disabled', false);
|
||||
$('#add_cantidad').prop('disabled', false);
|
||||
}
|
||||
|
||||
|
||||
newAddDialog.modal('show');
|
||||
}
|
||||
|
||||
@ -316,18 +477,66 @@ class Envios {
|
||||
proveedor: data.proveedor,
|
||||
proveedor_id: data.proveedor_id,
|
||||
entregaPieCalle: data.entregaPieCalle,
|
||||
is_ferro_prototipo: data.is_ferro_prototipo,
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
await $('#tableOfDireccionesEnvioFP1').DataTable().rows().every(async function (rowIdx, tableLoop, rowLoop) {
|
||||
var data = this.data();
|
||||
await $.post('/presupuestos/presupuestodirecciones/add',
|
||||
{
|
||||
presupuesto_id: id,
|
||||
tarifa_id: data.tarifa_id,
|
||||
cantidad: data.cantidad,
|
||||
peso: data.peso,
|
||||
att: data.att,
|
||||
email: data.email,
|
||||
direccion: data.direccion,
|
||||
pais_id: data.pais_id,
|
||||
provincia: data.provincia,
|
||||
municipio: data.municipio,
|
||||
cp: data.cp,
|
||||
telefono: data.telefono,
|
||||
precio: data.precio,
|
||||
margen: data.margen,
|
||||
proveedor: data.proveedor,
|
||||
proveedor_id: data.proveedor_id,
|
||||
entregaPieCalle: data.entregaPieCalle,
|
||||
is_ferro_prototipo: 1,
|
||||
num_ferro_prototipo: 1
|
||||
})
|
||||
});
|
||||
await $('#tableOfDireccionesEnvioFP2').DataTable().rows().every(async function (rowIdx, tableLoop, rowLoop) {
|
||||
var data = this.data();
|
||||
await $.post('/presupuestos/presupuestodirecciones/add',
|
||||
{
|
||||
presupuesto_id: id,
|
||||
tarifa_id: data.tarifa_id,
|
||||
cantidad: data.cantidad,
|
||||
peso: data.peso,
|
||||
att: data.att,
|
||||
email: data.email,
|
||||
direccion: data.direccion,
|
||||
pais_id: data.pais_id,
|
||||
provincia: data.provincia,
|
||||
municipio: data.municipio,
|
||||
cp: data.cp,
|
||||
telefono: data.telefono,
|
||||
precio: data.precio,
|
||||
margen: data.margen,
|
||||
proveedor: data.proveedor,
|
||||
proveedor_id: data.proveedor_id,
|
||||
entregaPieCalle: data.entregaPieCalle,
|
||||
is_ferro_prototipo: 1,
|
||||
num_ferro_prototipo: 2
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async updateTiradaBase() {
|
||||
|
||||
if($('#noEnvioBase').val() == 1)
|
||||
if ($('#noEnvioBase').val() == 1)
|
||||
return;
|
||||
|
||||
const self = this;
|
||||
@ -421,13 +630,12 @@ class Envios {
|
||||
'precio': datos_tarifa.precio.toFixed(2),
|
||||
'margen': datos_tarifa.margen,
|
||||
'entregaPieCalle': rowData.entregaPieCalle,
|
||||
'is_ferro_prototipo': rowData.is_ferro_prototipo,
|
||||
'actionBtns_direcciones': self.actionBtns_direcciones,
|
||||
})
|
||||
.draw();
|
||||
|
||||
|
||||
self.check_unidades_enviadas(null,null);
|
||||
self.check_unidades_enviadas(null, null);
|
||||
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas: false,
|
||||
@ -528,6 +736,7 @@ class Envios {
|
||||
$('#add_telefono').val("");
|
||||
$('#add_saveDirection').prop('checked', false)
|
||||
$('#add_entregaPieCalle').prop('checked', false)
|
||||
$('#addressForm').attr('data-table', '');
|
||||
});
|
||||
|
||||
$('#cancelAdd').on('click', function () {
|
||||
@ -591,34 +800,86 @@ class Envios {
|
||||
tarifa_final.cantidad = parseInt($('#add_cantidad').val())
|
||||
tarifa_final.peso = peso_envio
|
||||
|
||||
|
||||
self.table.row
|
||||
.add({
|
||||
'tarifa_id': tarifa_final.id,
|
||||
'cantidad': tarifa_final.cantidad,
|
||||
'peso': tarifa_final.peso.toFixed(3),
|
||||
'att': $('#add_att').val(),
|
||||
'email': $('#add_email').val(),
|
||||
'direccion': $('#add_direccion').val(),
|
||||
'cp': $('#add_cp').val(),
|
||||
'municipio': $('#add_municipio').val(),
|
||||
'provincia': $('#add_provincia').val(),
|
||||
'pais_id': $('#add_pais_id').select2('data')[0].id,
|
||||
'pais': $('#add_pais_id').select2('data')[0].text,
|
||||
'telefono': $('#add_telefono').val(),
|
||||
'proveedor': tarifa_final.proveedor,
|
||||
'proveedor_id': tarifa_final.proveedor_id,
|
||||
'precio': tarifa_final.precio,
|
||||
'margen': tarifa_final.margen,
|
||||
'entregaPieCalle': $('#add_entregaPieCalle').is(":checked") ? 1 : 0,
|
||||
'is_ferro_prototipo': $('#dirFerroProto').is(":checked") ? 1 : 0,
|
||||
'actionBtns_direcciones': `
|
||||
const sourceTable = $('#addressForm').attr('data-table');
|
||||
if (sourceTable === '') {
|
||||
self.table.row
|
||||
.add({
|
||||
'tarifa_id': tarifa_final.id,
|
||||
'cantidad': tarifa_final.cantidad,
|
||||
'peso': tarifa_final.peso.toFixed(3),
|
||||
'att': $('#add_att').val(),
|
||||
'email': $('#add_email').val(),
|
||||
'direccion': $('#add_direccion').val(),
|
||||
'cp': $('#add_cp').val(),
|
||||
'municipio': $('#add_municipio').val(),
|
||||
'provincia': $('#add_provincia').val(),
|
||||
'pais_id': $('#add_pais_id').select2('data')[0].id,
|
||||
'pais': $('#add_pais_id').select2('data')[0].text,
|
||||
'telefono': $('#add_telefono').val(),
|
||||
'proveedor': tarifa_final.proveedor,
|
||||
'proveedor_id': tarifa_final.proveedor_id,
|
||||
'precio': tarifa_final.precio,
|
||||
'margen': tarifa_final.margen,
|
||||
'entregaPieCalle': $('#add_entregaPieCalle').is(":checked") ? 1 : 0,
|
||||
'actionBtns_direcciones': `
|
||||
<span class="edit-add"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit-envio mx-2"></i></a></span>
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas btn-delete-envio mx-2"></i></a>
|
||||
`,
|
||||
})
|
||||
.draw();
|
||||
|
||||
})
|
||||
.draw();
|
||||
}
|
||||
else if (sourceTable === 'fp1') {
|
||||
self.tableFP1.row
|
||||
.add({
|
||||
'tarifa_id': tarifa_final.id,
|
||||
'cantidad': tarifa_final.cantidad,
|
||||
'peso': tarifa_final.peso.toFixed(3),
|
||||
'att': $('#add_att').val(),
|
||||
'email': $('#add_email').val(),
|
||||
'direccion': $('#add_direccion').val(),
|
||||
'cp': $('#add_cp').val(),
|
||||
'municipio': $('#add_municipio').val(),
|
||||
'provincia': $('#add_provincia').val(),
|
||||
'pais_id': $('#add_pais_id').select2('data')[0].id,
|
||||
'pais': $('#add_pais_id').select2('data')[0].text,
|
||||
'telefono': $('#add_telefono').val(),
|
||||
'proveedor': tarifa_final.proveedor,
|
||||
'proveedor_id': tarifa_final.proveedor_id,
|
||||
'precio': 0,
|
||||
'margen': 0,
|
||||
'entregaPieCalle': 0,
|
||||
'actionBtns_direcciones': `
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas btn-delete-envio mx-2"></i></a>
|
||||
`,
|
||||
})
|
||||
.draw();
|
||||
}
|
||||
else {
|
||||
self.tableFP2.row
|
||||
.add({
|
||||
'tarifa_id': tarifa_final.id,
|
||||
'cantidad': tarifa_final.cantidad,
|
||||
'peso': tarifa_final.peso.toFixed(3),
|
||||
'att': $('#add_att').val(),
|
||||
'email': $('#add_email').val(),
|
||||
'direccion': $('#add_direccion').val(),
|
||||
'cp': $('#add_cp').val(),
|
||||
'municipio': $('#add_municipio').val(),
|
||||
'provincia': $('#add_provincia').val(),
|
||||
'pais_id': $('#add_pais_id').select2('data')[0].id,
|
||||
'pais': $('#add_pais_id').select2('data')[0].text,
|
||||
'telefono': $('#add_telefono').val(),
|
||||
'proveedor': tarifa_final.proveedor,
|
||||
'proveedor_id': tarifa_final.proveedor_id,
|
||||
'precio': 0,
|
||||
'margen': 0,
|
||||
'entregaPieCalle': 0,
|
||||
'actionBtns_direcciones': `
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas btn-delete-envio mx-2"></i></a>
|
||||
`,
|
||||
})
|
||||
.draw();
|
||||
}
|
||||
|
||||
// Se guarda la dirección
|
||||
if ($('#add_saveDirection').is(":checked") &&
|
||||
@ -703,13 +964,26 @@ class Envios {
|
||||
return returnValue
|
||||
}
|
||||
|
||||
cargar(datos) {
|
||||
cargar(datos, datosFP) {
|
||||
if (datos.entrega_taller) {
|
||||
this.recogerTaller.prop('checked', true);
|
||||
}
|
||||
else {
|
||||
this.table.rows.add(datos).draw();
|
||||
}
|
||||
if (datosFP.fp1.length > 0) {
|
||||
this.tableFP1.rows.add(datosFP.fp1).draw();
|
||||
$('#rowInsertarEnvioFP1').addClass('d-none');
|
||||
}
|
||||
if (datosFP.fp2.length > 0) {
|
||||
this.tableFP2.rows.add(datosFP.fp2).draw();
|
||||
$('#rowInsertarEnvioFP2').addClass('d-none');
|
||||
}
|
||||
if(datosFP.checkboxes){
|
||||
$('#sameAddPrincipalFP1').prop('checked', datosFP.checkboxes.addFP1isAddMain == "1"? true: false);
|
||||
$('#sameAddPrincipalFP2').prop('checked', datosFP.checkboxes.addFP2isAddMain == "1"? true: false);
|
||||
$('#sameAddFP1').prop('checked', datosFP.checkboxes.addFP2isaddFP1 == "1"? true: false);
|
||||
}
|
||||
}
|
||||
|
||||
check_unidades_enviadas(event, recogerTaller = null) {
|
||||
@ -719,12 +993,8 @@ class Envios {
|
||||
}
|
||||
|
||||
let cantidad_total = 0
|
||||
let hasFerroPrototipo = false
|
||||
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
if (this.data().is_ferro_prototipo == 0)
|
||||
cantidad_total += parseInt(this.data().cantidad);
|
||||
else
|
||||
hasFerroPrototipo = true;
|
||||
cantidad_total += parseInt(this.data().cantidad);
|
||||
});
|
||||
|
||||
const tirada = parseInt($('#tirada').val());
|
||||
@ -745,14 +1015,59 @@ class Envios {
|
||||
this.insertarEnvio.removeClass('d-none');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (($('#ferro').is(':checked') || $('#prototipo').is(':checked')) && !hasFerroPrototipo)
|
||||
this.insertarEnvio.removeClass('d-none');
|
||||
else
|
||||
this.insertarEnvio.addClass('d-none');
|
||||
$('#alert-envios').html(htmlString);
|
||||
return true;
|
||||
}
|
||||
|
||||
sameAddPrincipalFP1() {
|
||||
|
||||
this.tableFP1.clear().draw();
|
||||
if ($('#sameAddPrincipalFP1').prop('checked')) {
|
||||
if (this.table.rows().count() > 0) {
|
||||
let data = this.table.row(0).data();
|
||||
data.cantidad = 1; // Set unidades to 1
|
||||
data.precio = 0;
|
||||
data.margen = 0;
|
||||
data.peso = this.get_peso_libro() / 1000;
|
||||
this.tableFP1.row.add(data).draw();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sameAddPrincipalFP2() {
|
||||
|
||||
$('#sameAddFP1').prop('checked', false);
|
||||
this.tableFP2.clear().draw();
|
||||
if ($('#sameAddPrincipalFP2').prop('checked')) {
|
||||
if (this.table.rows().count() > 0) {
|
||||
let data = this.table.row(0).data();
|
||||
data.cantidad = 1; // Set unidades to 1
|
||||
data.precio = 0;
|
||||
data.margen = 0;
|
||||
data.peso = this.get_peso_libro() / 1000;
|
||||
this.tableFP2.row.add(data).draw();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sameAddFP1() {
|
||||
|
||||
this.tableFP2.clear().draw();
|
||||
$('#sameAddPrincipalFP2').prop('checked', false);
|
||||
if ($('#sameAddFP1').prop('checked')) {
|
||||
if (this.tableFP1.rows().count() > 0) {
|
||||
let data = this.tableFP1.row(0).data();
|
||||
data.cantidad = 1; // Set unidades to 1
|
||||
data.precio = 0;
|
||||
data.margen = 0;
|
||||
data.peso = this.get_peso_libro() / 1000;
|
||||
this.tableFP2.row.add(data).draw();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Envios;
|
||||
@ -119,6 +119,11 @@ class Servicios {
|
||||
if (!this.checkServiceInTable(this.serviciosExtra.table, id))
|
||||
this.serviciosExtra.getPresupuestoExtra(id);
|
||||
}
|
||||
else if (servicio == 'ferro_2') {
|
||||
const id = $('#ferro_2').attr('service-id');
|
||||
if (!this.checkServiceInTable(this.serviciosExtra.table, id))
|
||||
this.serviciosExtra.getPresupuestoExtra(id);
|
||||
}
|
||||
else if (servicio == 'ferroDigital') {
|
||||
const id = $('#ferroDigital').attr('service-id');
|
||||
if (!this.checkServiceInTable(this.serviciosExtra.table, id))
|
||||
@ -129,6 +134,11 @@ class Servicios {
|
||||
if (!this.checkServiceInTable(this.serviciosExtra.table, id))
|
||||
this.serviciosExtra.getPresupuestoExtra(id);
|
||||
}
|
||||
else if (servicio == 'prototipo_2') {
|
||||
const id = $('#prototipo_2').attr('service-id');
|
||||
if (!this.checkServiceInTable(this.serviciosExtra.table, id))
|
||||
this.serviciosExtra.getPresupuestoExtra(id);
|
||||
}
|
||||
else if (servicio == 'retractilado') {
|
||||
const id = $('#retractilado').attr('service-id');
|
||||
if (!this.checkServiceInTable(this.serviciosAcabado.table, id))
|
||||
@ -201,8 +211,18 @@ class Servicios {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (servicio == 'ferroDigital') {
|
||||
else if (servicio == 'ferro_2') {
|
||||
const id = $('#ferro_2').attr('service-id');
|
||||
this.serviciosExtra.table.rows().every(function () {
|
||||
let data = this.data();
|
||||
if (data.tarifa_id == id) {
|
||||
this.remove();
|
||||
self.serviciosExtra.table.draw();
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (servicio == 'ferroDigital') {
|
||||
const id = $('#ferroDigital').attr('service-id');
|
||||
this.serviciosExtra.table.rows().every(function () {
|
||||
let data = this.data();
|
||||
@ -225,6 +245,17 @@ class Servicios {
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (servicio == 'prototipo_2') {
|
||||
const id = $('#prototipo_2').attr('service-id');
|
||||
this.serviciosExtra.table.rows().every(function () {
|
||||
var data = this.data();
|
||||
if (data.tarifa_id == id) {
|
||||
this.remove();
|
||||
self.serviciosExtra.table.draw();
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (servicio == 'retractilado') {
|
||||
const id = $('#retractilado').attr('service-id');
|
||||
for (let i = this.serviciosAcabado.table.rows().count(); i >= 0; i--) {
|
||||
|
||||
@ -105,27 +105,26 @@ class DatosGenerales {
|
||||
|
||||
// check ferro y prototipo
|
||||
this.domItem.on('change', 'input[type="checkbox"][data-tarifa-extra-excluyente="1"]', (e) => {
|
||||
if (!this.cargando) {
|
||||
const current = $(e.target);
|
||||
|
||||
if (current.is(':checked')) {
|
||||
this.domItem.find('input[type="checkbox"][data-tarifa-extra-excluyente="1"]')
|
||||
.not(current)
|
||||
.prop('checked', false);
|
||||
const current = $(e.target);
|
||||
|
||||
if ((current.data('tarifa-nombre')?.toString().toLowerCase() || '').includes('2')) {
|
||||
$('#direccionesFerroPrototipo2').removeClass('d-none');
|
||||
}
|
||||
$('#direccionesFerroPrototipo').removeClass('d-none');
|
||||
if (current.is(':checked')) {
|
||||
this.domItem.find('input[type="checkbox"][data-tarifa-extra-excluyente="1"]')
|
||||
.not(current)
|
||||
.prop('checked', false);
|
||||
|
||||
if ((current.data('tarifa-nombre')?.toString().toLowerCase() || '').includes('2')) {
|
||||
$('#direccionesFerroPrototipo2').removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
if (this.domItem.find('input[type="checkbox"][data-tarifa-extra-excluyente="1"]').prop('checked').length === 0) {
|
||||
$('#direccionesFerroPrototipo').removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
if (this.domItem.find('input[type="checkbox"][data-tarifa-extra-excluyente="1"]').prop('checked').length === 0) {
|
||||
|
||||
$('#direccionesFerroPrototipo').addClass('d-none');
|
||||
$('#divDireccionesFerroPrototipo').empty();
|
||||
$('#direccionesFerroPrototipo2').addClass('d-none');
|
||||
$('#divDireccionesFerroPrototipo2').empty();
|
||||
}
|
||||
$('#direccionesFerroPrototipo').addClass('d-none');
|
||||
$('#divDireccionesFerroPrototipo').empty();
|
||||
$('#direccionesFerroPrototipo2').addClass('d-none');
|
||||
$('#divDireccionesFerroPrototipo2').empty();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -597,6 +596,7 @@ class DatosGenerales {
|
||||
|
||||
if (datos.serviciosExtra.includes(tarifaId)) {
|
||||
$(this).prop('checked', true);
|
||||
$(this).trigger('change');
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -769,7 +769,7 @@ class DatosGenerales {
|
||||
}
|
||||
|
||||
// Para recalcular el presupuesto
|
||||
$('#paginas').trigger('change');
|
||||
$('.input-paginas').trigger('change');
|
||||
}
|
||||
|
||||
#handlePaginas() {
|
||||
|
||||
@ -105,7 +105,7 @@ class Direcciones {
|
||||
|
||||
|
||||
|
||||
cargarDatos(datos, datosGenerales) {
|
||||
cargarDatos(datos, datosGenerales, direccionesFP = [], direccionesFPChecks = {}) {
|
||||
|
||||
self = this;
|
||||
|
||||
@ -130,7 +130,6 @@ class Direcciones {
|
||||
});
|
||||
}, 0);
|
||||
|
||||
|
||||
$('#tiradaEnvios-' + datosGenerales.selectedTirada).trigger('click');
|
||||
|
||||
if (datos.entrega_taller == 1) {
|
||||
@ -174,6 +173,41 @@ class Direcciones {
|
||||
this.direcciones.push(tarjeta);
|
||||
}
|
||||
}
|
||||
|
||||
if (direccionesFP.length > 0) {
|
||||
direccionesFP.forEach(element => {
|
||||
let divId = "dirEnvio-fp-" + element.num_ferro_prototipo;
|
||||
let containerId = element.num_ferro_prototipo == 1 ? "#divDireccionesFerroPrototipo" : "#divDireccionesFerroPrototipo2";
|
||||
let tarjeta = new tarjetaDireccion(containerId,
|
||||
divId, element, true, element.num_ferro_prototipo);
|
||||
tarjeta.setUnidades(1);
|
||||
tarjeta.setEntregaPalets(0);
|
||||
tarjeta.card.find('.direccion-eliminar').on('click', (event) => {
|
||||
this.#deleteDireccionFP(event, element.num_ferro_prototipo);
|
||||
$('.div-direcciones-fp' + element.num_ferro_prototipo).removeClass('d-none');
|
||||
});
|
||||
$(containerId).append(tarjeta.card);
|
||||
if (element.num_ferro_prototipo == 1) {
|
||||
this.direccionesFP1.push(tarjeta);
|
||||
}
|
||||
else {
|
||||
this.direccionesFP2.push(tarjeta);
|
||||
}
|
||||
$('.div-direcciones-fp' + element.num_ferro_prototipo).addClass('d-none');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
if (direccionesFPChecks.addFP1isAddMain && direccionesFPChecks.addFP1isAddMain === "true") {
|
||||
this.sameAddPrincipalFP1.prop('checked', true);
|
||||
}
|
||||
|
||||
if (direccionesFPChecks.addFP2isFP1 && direccionesFPChecks.addFP2isFP1 === "true") {
|
||||
this.sameAddFP1.prop('checked', true);
|
||||
}
|
||||
else if (direccionesFPChecks.addFP2isAddMain && direccionesFPChecks.addFP2isAddMain === "true") {
|
||||
this.sameAddPrincipalFP2.prop('checked', true);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
$('#loader').modal('hide');
|
||||
@ -342,6 +376,10 @@ class Direcciones {
|
||||
}
|
||||
}
|
||||
this.#addTarjetaDireccion(this.divDirecciones, this.direcciones, divId, id, unidades, entregaPalets);
|
||||
|
||||
this.calcularPresupuesto = true;
|
||||
this.divDirecciones.trigger('change');
|
||||
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@ -356,10 +394,10 @@ class Direcciones {
|
||||
try {
|
||||
|
||||
let id = 0;
|
||||
if( num_ferroPrototipo === 1) {
|
||||
if (num_ferroPrototipo === 1) {
|
||||
id = this.direccionesClienteFP1.getVal();
|
||||
}
|
||||
if( num_ferroPrototipo === 2) {
|
||||
if (num_ferroPrototipo === 2) {
|
||||
id = this.direccionesClienteFP2.getVal();
|
||||
}
|
||||
let unidades = 1;
|
||||
@ -369,16 +407,23 @@ class Direcciones {
|
||||
|
||||
let divId = "dirEnvio-FP-" + num_ferroPrototipo;
|
||||
let containerId = num_ferroPrototipo === 1 ? "#divDireccionesFerroPrototipo" : "#divDireccionesFerroPrototipo2";
|
||||
let arrayName = num_ferroPrototipo === 1 ? this.direccionesFP1 : this.direccionesFP2;
|
||||
|
||||
|
||||
if (num_ferroPrototipo === 1) {
|
||||
this.direccionesFP1 = [];
|
||||
}
|
||||
if (num_ferroPrototipo === 2) {
|
||||
this.direccionesFP2 = [];
|
||||
}
|
||||
|
||||
this.#addTarjetaDireccion(
|
||||
$(containerId),
|
||||
arrayName,
|
||||
divId,
|
||||
id,
|
||||
1, false, true, num_ferroPrototipo);
|
||||
$(containerId),
|
||||
num_ferroPrototipo === 1 ? this.direccionesFP1 : this.direccionesFP2,
|
||||
divId,
|
||||
id,
|
||||
1, false, true, num_ferroPrototipo);
|
||||
|
||||
$('.div-direcciones-fp' + num_ferroPrototipo).addClass('d-none');
|
||||
$('#loader').modal('hide');
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@ -403,6 +448,31 @@ class Direcciones {
|
||||
|
||||
$('#loader').modal('show');
|
||||
|
||||
if (id == null || id <= 0 || id == undefined || id === 'undefined' || id === '') {
|
||||
$('#loader').modal('hide');
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
text: window.translations["errores"].error_direccion_principal_no_encontrada,
|
||||
icon: 'error',
|
||||
showCancelButton: false,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ok',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
},
|
||||
buttonsStyling: false
|
||||
});
|
||||
if(numFerroPrototipo === 1) {
|
||||
this.sameAddPrincipalFP1.prop('checked', false);
|
||||
this.sameAddPrincipalFP1.trigger('change');
|
||||
}
|
||||
if(numFerroPrototipo === 2) {
|
||||
this.sameAddPrincipalFP2.prop('checked', false);
|
||||
this.sameAddPrincipalFP2.trigger('change');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const ajaxGetDireccion = new Ajax('/misdirecciones/get/' + id, {}, {}, null, null);
|
||||
const response = await ajaxGetDireccion.getPromise();
|
||||
|
||||
@ -432,6 +502,7 @@ class Direcciones {
|
||||
container.append(tarjeta.card);
|
||||
addArray.push(tarjeta);
|
||||
container.trigger('change');
|
||||
$('#loader').modal('hide');
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error en petición Ajax:', err);
|
||||
@ -500,6 +571,21 @@ class Direcciones {
|
||||
|
||||
tarjeta.remove();
|
||||
this.divDirecciones.trigger('change');
|
||||
|
||||
if (this.direcciones.length === 0) {
|
||||
if (this.sameAddPrincipalFP1.is(':checked')) {
|
||||
this.sameAddPrincipalFP1.prop('checked', false);
|
||||
this.sameAddPrincipalFP1.trigger('change');
|
||||
}
|
||||
if (this.sameAddPrincipalFP2.is(':checked')) {
|
||||
this.sameAddPrincipalFP2.prop('checked', false);
|
||||
this.sameAddPrincipalFP2.trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
this.calcularPresupuesto = true;
|
||||
this.divDirecciones.trigger('change');
|
||||
|
||||
}
|
||||
|
||||
#deleteDireccionFP(event, num_ferroPrototipo = 1) {
|
||||
@ -512,12 +598,18 @@ class Direcciones {
|
||||
this.direccionesFP1 = [];
|
||||
this.sameAddPrincipalFP1.prop('checked', false);
|
||||
$('#divDireccionesFerroPrototipo1').trigger('change');
|
||||
if (this.sameAddFP1.is(':checked')) {
|
||||
this.sameAddFP1.prop('checked', false);
|
||||
this.sameAddFP1.trigger('change');
|
||||
}
|
||||
$('.div-direcciones-fp1').removeClass('d-none');
|
||||
}
|
||||
if (num_ferroPrototipo === 2) {
|
||||
this.direccionesFP2 = [];
|
||||
this.sameAddPrincipalFP2.prop('checked', false);
|
||||
this.sameAddFP1.prop('checked', false);
|
||||
$('#divDireccionesFerroPrototipo2').trigger('change');
|
||||
$('.div-direcciones-fp2').removeClass('d-none');
|
||||
}
|
||||
|
||||
tarjeta.remove();
|
||||
@ -542,7 +634,10 @@ class Direcciones {
|
||||
$('#divDireccionesFerroPrototipo').removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
// mostrar alerta de que no hay direcciones
|
||||
popErrorAlert(window.translations["validation"].error_sameAddPrincipal_FP,
|
||||
'sk-alert-ferro-prototipo1', true);
|
||||
this.sameAddPrincipalFP1.prop('checked', false);
|
||||
$('#divDireccionesFerroPrototipo').empty();
|
||||
}
|
||||
|
||||
}
|
||||
@ -556,13 +651,13 @@ class Direcciones {
|
||||
#handleSameAddPrincipalFP2() {
|
||||
|
||||
if (this.sameAddPrincipalFP2.is(':checked')) {
|
||||
if(this.sameAddFP1.is(':checked')) {
|
||||
if (this.sameAddFP1.is(':checked')) {
|
||||
this.sameAddFP1.prop('checked', false);
|
||||
}
|
||||
$('.div-direcciones-fp2').addClass('d-none');
|
||||
$('#divDireccionesFerroPrototipo2').empty();
|
||||
if (this.direcciones.length > 0) {
|
||||
|
||||
|
||||
let data = this.direcciones[0].getDireccion();
|
||||
this.direccionesFP2 = [];
|
||||
this.#addTarjetaDireccion(
|
||||
@ -574,7 +669,10 @@ class Direcciones {
|
||||
$('#divDireccionesFerroPrototipo2').removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
// mostrar alerta de que no hay direcciones
|
||||
popErrorAlert(window.translations["validation"].error_sameAddPrincipal_FP,
|
||||
'sk-alert-ferro-prototipo2', true);
|
||||
this.sameAddPrincipalFP2.prop('checked', false);
|
||||
$('#divDireccionesFerroPrototipo2').empty();
|
||||
}
|
||||
|
||||
}
|
||||
@ -588,7 +686,7 @@ class Direcciones {
|
||||
#handleSameAddFP1() {
|
||||
|
||||
if (this.sameAddFP1.is(':checked')) {
|
||||
if(this.sameAddPrincipalFP2.is(':checked')) {
|
||||
if (this.sameAddPrincipalFP2.is(':checked')) {
|
||||
this.sameAddPrincipalFP2.prop('checked', false);
|
||||
}
|
||||
$('.div-direcciones-fp2').addClass('d-none');
|
||||
@ -597,7 +695,7 @@ class Direcciones {
|
||||
|
||||
let data = this.direccionesFP1[0].getDireccion();
|
||||
|
||||
this.direccionesFP1 = [];
|
||||
this.direccionesFP2 = [];
|
||||
this.#addTarjetaDireccion(
|
||||
$("#divDireccionesFerroPrototipo2"),
|
||||
this.direccionesFP2,
|
||||
@ -608,7 +706,10 @@ class Direcciones {
|
||||
$('#divDireccionesFerroPrototipo2').removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
// mostrar alerta de que no hay direcciones
|
||||
popErrorAlert(window.translations["validation"].error_sameAddFP1,
|
||||
'sk-alert-ferro-prototipo2', true);
|
||||
this.sameAddFP1.prop('checked', false);
|
||||
$('#divDireccionesFerroPrototipo2').empty();
|
||||
}
|
||||
|
||||
}
|
||||
@ -626,6 +727,14 @@ class Direcciones {
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
getDireccionesFPChecks() {
|
||||
return {
|
||||
addFP1isAddMain: this.sameAddPrincipalFP1.is(':checked'),
|
||||
addFP2isAddMain: this.sameAddPrincipalFP2.is(':checked'),
|
||||
addFP2isFP1: this.sameAddFP1.is(':checked')
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -111,6 +111,29 @@ class DisenioInterior {
|
||||
this.disenioInterior.on('click', this.#handleDisenioInterior.bind(this));
|
||||
this.disenioInterior_color.on('click', this.#handleDisenioInterior.bind(this));
|
||||
|
||||
// test
|
||||
$(document).on('keydown', function (e) {
|
||||
if (e.ctrlKey && e.key === '.') {
|
||||
e.preventDefault(); // Evita comportamiento por defecto si es necesario
|
||||
console.log('Se pulsó Control + .');
|
||||
new Ajax('/configuracion/papelesgenericos/gettipopapel',
|
||||
{
|
||||
[self.csrf_token]: self.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => self.getTipoImpresion(),
|
||||
ancho: self.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: self.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { console.log(response); },
|
||||
(response) => { console.error(response); }
|
||||
).get();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -135,10 +135,10 @@ class PresupuestoCliente {
|
||||
}
|
||||
|
||||
|
||||
calcularSolapas() {
|
||||
calcularSolapas(exclude_guardas = false) {
|
||||
|
||||
/* Solapas Max */
|
||||
this.#getDatos(false, true);
|
||||
this.#getDatos(false, true, exclude_guardas);
|
||||
if (Object.values(this.datos).every(this.#isValidDataForm)) {
|
||||
new Ajax('/presupuestocliente/calcularsolapas',
|
||||
this.datos,
|
||||
@ -199,6 +199,7 @@ class PresupuestoCliente {
|
||||
if(!this.datosGenerales.validate(false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'interior-libro':
|
||||
@ -372,6 +373,14 @@ class PresupuestoCliente {
|
||||
break;
|
||||
|
||||
case 'interior-libro':
|
||||
this.calcularSolapas(true);
|
||||
this.btnPrev.removeClass('d-none');
|
||||
this.btnNext.removeClass('d-none');
|
||||
this.btnSave.removeClass('d-none');
|
||||
this.btnDuplicate.addClass('d-none');
|
||||
this.btnPrint.addClass('d-none');
|
||||
this.btnConfirm.addClass('d-none');
|
||||
break;
|
||||
case 'cubierta-libro':
|
||||
case 'direcciones-libro':
|
||||
this.btnPrev.removeClass('d-none');
|
||||
@ -623,9 +632,9 @@ class PresupuestoCliente {
|
||||
|
||||
case 1:
|
||||
this.disenioInterior.validate();
|
||||
this.calcularSolapas(true);
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
this.disenioCubierta.validate();
|
||||
break;
|
||||
@ -675,6 +684,12 @@ class PresupuestoCliente {
|
||||
if (datos_to_check.direcciones) {
|
||||
delete datos_to_check.direcciones;
|
||||
}
|
||||
if (datos_to_check.direccionesFP1) {
|
||||
delete datos_to_check.direccionesFP1;
|
||||
}
|
||||
if (datos_to_check.direccionesFP2) {
|
||||
delete datos_to_check.direccionesFP2;
|
||||
}
|
||||
if (datos_to_check.posPaginasColor == "" || datos_to_check.posPaginasColor == null) {
|
||||
delete datos_to_check.posPaginasColor;
|
||||
}
|
||||
@ -689,7 +704,7 @@ class PresupuestoCliente {
|
||||
}
|
||||
|
||||
|
||||
#getDatos(save = false, calcularSolapas = false) {
|
||||
#getDatos(save = false, calcularSolapas = false, exclude_guardas = false) {
|
||||
|
||||
this.datos = {
|
||||
|
||||
@ -719,7 +734,8 @@ class PresupuestoCliente {
|
||||
this.datos.selectedTirada = this.direcciones.getSelectedTirada();
|
||||
}
|
||||
|
||||
this.datos.guardas = this.disenioCubierta.getGuardas();
|
||||
if(!exclude_guardas)
|
||||
this.datos.guardas = this.disenioCubierta.getGuardas();
|
||||
|
||||
if (calcularSolapas) {
|
||||
return;
|
||||
@ -795,17 +811,15 @@ class PresupuestoCliente {
|
||||
}
|
||||
|
||||
if( this.direcciones.direccionesFP1.length > 0) {
|
||||
this.datos.direccionesFP1 = this.direcciones.direccionesFP1.map((direccion) => {
|
||||
return direccion.getFormData();
|
||||
});
|
||||
this.datos.direccionesFP1 = this.direcciones.direccionesFP1[0].getFormData();
|
||||
}
|
||||
|
||||
if( this.direcciones.direccionesFP2.length > 0) {
|
||||
this.datos.direccionesFP2 = this.direcciones.direccionesFP2.map((direccion) => {
|
||||
return direccion.getFormData();
|
||||
});
|
||||
this.datos.direccionesFP2 = this.direcciones.direccionesFP2[0].getFormData();
|
||||
}
|
||||
|
||||
this.datos.direcciones_fp_checks = this.direcciones.getDireccionesFPChecks();
|
||||
|
||||
if (save) {
|
||||
this.datos.datosCabecera = {
|
||||
titulo: this.datosGenerales.titulo.val(),
|
||||
@ -844,7 +858,11 @@ class PresupuestoCliente {
|
||||
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||
self.direcciones.handleChangeCliente();
|
||||
|
||||
self.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
||||
self.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales,
|
||||
(response.data.direccionesFerroPrototipo && response.data.direccionesFerroPrototipo.length > 0) ?
|
||||
response.data.direccionesFerroPrototipo : [] ,
|
||||
response.data.direccionesFPChecks && response.data.direccionesFPChecks.length > 0 ? JSON.parse(response.data.direccionesFPChecks) : {}
|
||||
);
|
||||
|
||||
try {
|
||||
self.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente);
|
||||
|
||||
@ -20,7 +20,7 @@ $(function () {
|
||||
try {
|
||||
|
||||
// Create hidden iframe
|
||||
Notiflix.Block.circle('.section-block',{opacity : 1});
|
||||
Notiflix.Block.circle('.section-block', { opacity: 1 });
|
||||
const response = await getPdf(element);
|
||||
var opt = {
|
||||
margin: 2,
|
||||
@ -40,8 +40,16 @@ $(function () {
|
||||
zip.generateAsync({ type: "blob" }).then(function (blob) {
|
||||
const now = new Date();
|
||||
const pad = (n) => String(n).padStart(2, '0');
|
||||
const timestamp = `${now.getFullYear()}_${pad(now.getMonth() + 1)}_${pad(now.getDate())}_${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
||||
const filename = `ordenes_trabajo_${timestamp}.zip`;
|
||||
const fecha = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}`;
|
||||
const hora = `${pad(now.getHours())}${pad(now.getMinutes())}`;
|
||||
|
||||
let filename;
|
||||
if (ordenesTrabajo.length === 1) {
|
||||
const otId = ordenesTrabajo[0];
|
||||
filename = `OT_${otId}_${fecha}_${hora}.zip`;
|
||||
} else {
|
||||
filename = `OrdenesTrabajo_${fecha}_${hora}.zip`;
|
||||
}
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = URL.createObjectURL(blob);
|
||||
@ -50,14 +58,10 @@ $(function () {
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
});
|
||||
}else{
|
||||
} else {
|
||||
alertError('Seleccione una OT para descargar').fire()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ class OrdenTrabajo {
|
||||
this.otForm = this.item.find("#ot-edit-form")
|
||||
this.block = document.querySelector('.section-block');
|
||||
this.modelId = this.item.data("id");
|
||||
this.otId = parseInt($("#dropzone-ot-files").data("ot-id")) || null;
|
||||
this.tareasTableItem = this.item.find("#ot-task-table");
|
||||
this.tareasId = []
|
||||
this.summaryData = {}
|
||||
@ -70,6 +71,7 @@ class OrdenTrabajo {
|
||||
this.configUploadDropzone = {
|
||||
domElement: '#dropzone-ot-files',
|
||||
nameId: "presupuesto_id",
|
||||
otId: this.otId,
|
||||
getUri: '/presupuestos/presupuestocliente/get_files',
|
||||
postUri: '/presupuestos/presupuestocliente/upload_files'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user