<style>
	a.woocommerce-button.button {
		padding: 0 0.5rem !important;
		font-size: small !important;
	}

	a.woocommerce-button.button:hover {
		transform: none !important;
		transition: none !important;
		color: inherit !important;
		border: 2px solid !important;
		border-radius: 3px !important;
		background: inherit !important;
		background-color: #f5f5f5 !important;
	}

	a.woocommerce-button.button:after {
		content: none !important;
	}

	td[data-title="Acciones"] {
		display: flex !important;
		justify-content: center !important;
		align-items: center !important;
		gap: 0.5rem !important;
	}

	/* Modal Styles */
	.payment-document-modal {
		display: none;
		position: fixed;
		z-index: 9999;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.5);
	}

	.payment-document-modal-content {
		background-color: #fefefe;
		position: fixed;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		padding: 20px;
		border: none;
		border-radius: 8px;
		width: 90%;
		max-width: 500px;
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	}

	.payment-document-modal-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 20px;
		padding-bottom: 10px;
		border-bottom: 1px solid #eee;
	}

	.payment-document-modal-title {
		margin: 0;
		font-size: 1.5rem;
		color: #333;
	}

	.payment-document-modal-close {
		background: none;
		border: none;
		font-size: 24px;
		cursor: pointer;
		padding: 0;
		width: 30px;
		height: 30px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 50%;
		transition: background-color 0.2s;
	}

	.payment-document-modal-close:hover {
		background-color: #f0f0f0;
	}

	.payment-document-form {
		display: flex;
		flex-direction: column;
		gap: 15px;
	}

	.payment-document-form label {
		font-weight: bold;
		margin-bottom: 5px;
	}

	.payment-document-form input[type="file"] {
		padding: 10px;
		border: 2px dashed #ddd;
		border-radius: 4px;
		transition: border-color 0.2s;
	}

	.payment-document-form input[type="file"]:hover {
		border-color: #999;
	}

	.payment-document-form textarea {
		padding: 10px;
		border: 1px solid #ddd;
		border-radius: 4px;
		resize: vertical;
		min-height: 80px;
	}

	.payment-document-form-buttons {
		display: flex;
		gap: 10px;
		justify-content: flex-end;
		margin-top: 20px;
	}

	.payment-document-btn {
		padding: 10px 20px;
		border: none;
		border-radius: 4px;
		cursor: pointer;
		font-size: 14px;
		transition: background-color 0.2s;
	}

	.payment-document-btn-primary {
		background-color: #0073aa;
		color: white;
	}

	.payment-document-btn-primary:hover {
		background-color: #005a87;
	}

	.payment-document-btn-secondary {
		background-color: #f7f7f7;
		color: #333;
		border: 1px solid #ddd;
	}

	.payment-document-btn-secondary:hover {
		background-color: #e9e9e9;
	}

	.file-info {
		margin-top: 10px;
		padding: 10px;
		background-color: #f9f9f9;
		border-radius: 4px;
		font-size: 12px;
		color: #666;
	}

	.upload-progress {
		margin-top: 10px;
		display: none;
	}

	.progress-bar {
		width: 100%;
		height: 6px;
		background-color: #f0f0f0;
		border-radius: 3px;
		overflow: hidden;
	}

	.progress-bar-fill {
		height: 100%;
		background-color: #0073aa;
		width: 0%;
		transition: width 0.3s ease;
	}

	/* Modal de notificación */
	.notification-modal {
		display: none;
		position: fixed;
		z-index: 10000;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.5);
		animation: fadeIn 0.3s ease;
	}

	.notification-modal-content {
		background-color: #fff;
		position: fixed;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		padding: 30px;
		border: none;
		border-radius: 12px;
		width: 90%;
		max-width: 400px;
		box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
		text-align: center;
		animation: slideIn 0.3s ease;
	}

	.notification-modal.success .notification-modal-content {
		border-top: 4px solid #28a745;
	}

	.notification-modal.error .notification-modal-content {
		border-top: 4px solid #dc3545;
	}

	.notification-icon {
		font-size: 48px;
		margin-bottom: 20px;
		display: block;
	}

	.notification-modal.success .notification-icon {
		color: #28a745;
	}

	.notification-modal.error .notification-icon {
		color: #dc3545;
	}

	.notification-title {
		font-size: 1.4rem;
		font-weight: bold;
		margin-bottom: 15px;
		color: #333;
	}

	.notification-modal.success .notification-title {
		color: #155724;
	}

	.notification-modal.error .notification-title {
		color: #721c24;
	}

	.notification-message {
		font-size: 1rem;
		line-height: 1.5;
		margin-bottom: 25px;
		color: #666;
	}

	.notification-modal.success .notification-message {
		color: #155724;
	}

	.notification-modal.error .notification-message {
		color: #721c24;
	}

	.notification-btn {
		background-color: #007cba;
		color: white;
		border: none;
		padding: 12px 30px;
		border-radius: 6px;
		font-size: 1rem;
		cursor: pointer;
		transition: background-color 0.2s;
		min-width: 100px;
	}

	.notification-modal.success .notification-btn {
		background-color: #28a745;
	}

	.notification-modal.error .notification-btn {
		background-color: #dc3545;
	}

	.notification-btn:hover {
		opacity: 0.9;
	}

	@keyframes fadeIn {
		from {
			opacity: 0;
		}

		to {
			opacity: 1;
		}
	}

	@keyframes slideIn {
		from {
			opacity: 0;
			transform: translate(-50%, -60%);
		}

		to {
			opacity: 1;
			transform: translate(-50%, -50%);
		}
	}
</style>



	
	<div class="woocommerce-info" role="status">
		No se ha hecho ningún pedido todavía. <a class="woocommerce-Button wc-forward button" href="https://www.busleader.es/?page_id=244">Explorar los productos</a>	</div>



<!-- Modal para adjuntar documentos de pago -->
<div id="paymentDocumentModal" class="payment-document-modal">
	<div class="payment-document-modal-content">
		<div class="payment-document-modal-header">
			<h3 class="payment-document-modal-title">Adjuntar justificante bancario</h3>
			<button type="button" class="payment-document-modal-close" aria-label="Cerrar">&times;</button>
		</div>

		<form id="paymentDocumentForm" class="payment-document-form" enctype="multipart/form-data">
			<input type="hidden" id="order_id" name="order_id" value="">
			<input type="hidden" id="estimate_id" name="estimate_id" value="">

			<div>
				<label for="payment_document">Selecciona un documento *</label>
				<input type="file" id="payment_document" name="payment_document" accept=".pdf,.jpg,.jpeg,.png" required>
				<div class="file-info">
					Formatos permitidos: PDF, JPG, PNG Tamaño máximo: 5MB				</div>
			</div>

			<div class="upload-progress">
				<div class="progress-bar">
					<div class="progress-bar-fill"></div>
				</div>
				<div class="progress-text">0%</div>
			</div>

			<div class="payment-document-form-buttons">
				<button type="button" class="payment-document-btn payment-document-btn-secondary" id="cancelUpload">
				Cancelar			</button>
			<button type="submit" class="payment-document-btn payment-document-btn-primary" id="submitUpload">
				Subir documento				</button>
			</div>
		</form>
	</div>
</div>

<!-- Modal de notificación -->
<div id="notificationModal" class="notification-modal">
	<div class="notification-modal-content">
		<div class="notification-icon">&#10004;</div>
		<div class="notification-title">Título</div>
		<div class="notification-message">Mensaje</div>
		<button type="button" class="notification-btn" id="notificationBtn">Aceptar</button>
	</div>
</div>

<script>
	jQuery(document).ready(function($) {

		// Función para mostrar notificaciones
		function showNotification(type, title, message, callback) {
			const modal = $('#notificationModal');
			const icon = modal.find('.notification-icon');
			const titleElement = modal.find('.notification-title');
			const messageElement = modal.find('.notification-message');
			const btn = modal.find('.notification-btn');

			// Configurar el tipo (success o error)
			modal.removeClass('success error').addClass(type);

			// Configurar contenido
			if (type === 'success') {
				icon.html('&#10004;'); // Checkmark
				titleElement.text(title || 'Éxito');
			} else {
				icon.html('&#10006;'); // X mark
				titleElement.text(title || 'Error');
			}

			messageElement.text(message);

			// Mostrar modal
			modal.show();

			// Configurar evento del botón
			btn.off('click').on('click', function() {
				modal.hide();
				if (callback && typeof callback === 'function') {
					callback();
				}
			});

			// Cerrar con tecla Escape
			$(document).off('keydown.notification').on('keydown.notification', function(e) {
				if (e.key === 'Escape' && modal.is(':visible')) {
					modal.hide();
					$(document).off('keydown.notification');
					if (callback && typeof callback === 'function') {
						callback();
					}
				}
			});
		}

		// Referencia al modal y elementos
		const modal = $('#paymentDocumentModal');
		const modalContent = $('.payment-document-modal-content');
		const closeBtn = $('.payment-document-modal-close');
		const cancelBtn = $('#cancelUpload');
		const form = $('#paymentDocumentForm');
		const fileInput = $('#payment_document');
		const progressContainer = $('.upload-progress');
		const progressFill = $('.progress-bar-fill');
		const progressText = $('.progress-text');
		let currentEstimateId = null;

		// Abrir modal cuando se hace click en "Attach payment documentation"
		$('a.attach_payment_documentation, a.woocommerce-button.button.cancel, a.download').on('click', function(e) {
			e.preventDefault();

			// Extraer el order ID del enlace o del contexto
			const orderId = $(this).data('orderId')

			if (!orderId) {
				showNotification('error', 'Error', 'No se pudo encontrar el pedido');
				return;
			}

			currentEstimateId = $(this).data('estimateId') || null;
			// Establecer el order ID en el formulario
			$('#paymentDocumentModal #order_id').val(orderId);
			$('#paymentDocumentModal #estimate_id').val(currentEstimateId);

			if ($(this).data('action') === 'attach_payment_documentation') {
				// Acción específica si es necesario
				// Mostrar el modal
				modal.show();

				// Focus en el input de archivo
				setTimeout(() => {
					fileInput.focus();
				}, 100);
			} else if ($(this).data('action') === 'cancel_estimate_request') {

				// Crear FormData para el envío
				const formData = new FormData();
				formData.append('action', 'cancel_estimate_request');
				formData.append('order_id', $('#paymentDocumentModal #order_id').val());
				formData.append('estimate_id', $('#paymentDocumentModal #estimate_id').val());

				// Realizar la llamada fetch
				fetch('https://wf.nn.b2bit.es/webhook/ba55eabc-8d7e-4583-8089-d1f3b73a104c', {
						method: 'POST',
						body: formData
					})
					.then(response => {
						if (!response.ok) {
							throw new Error('Network response was not ok');
						}
						return response.json();
					})
					.then(data => {
						// Verificar respuesta del servidor
						if (data.success) {
							setTimeout(() => {
								showNotification('success', 'Operación exitosa', data.message || '¡Operación completada!', function() {
									window.location.reload();
								});
							}, 500);
						} else {
							showNotification('error', 'Operación fallida', data.message || 'Error en la petición');
						}
					})
					.catch(error => {
						console.error('Error:', error);
						showNotification('error', 'Error de conexión', 'Error en la petición. Inténtalo de nuevo más tarde');
					});
			} else if ($(this).data('action') === 'download_estimate') {
				const estimateId = $(this).data('estimateId');

				if (!estimateId) {
					showNotification('error', 'Error', 'No se pudo encontrar el presupuesto');
					return;
				}

				// Realizar la llamada fetch para descargar el presupuesto
				fetch('https://wf.nn.b2bit.es/webhook/download_estimate', {
						method: 'POST',
						body: JSON.stringify({
							estimate_id: estimateId
						}),
						headers: {
							'Content-Type': 'application/json'
						}
					})
					.then(response => {
						if (!response.ok) {
							throw new Error('Network response was not ok');
						}
						return response.blob();
					})
					.then(blob => {
						// Crear URL del blob y iniciar la descarga
						const url = window.URL.createObjectURL(blob);
						const link = document.createElement('a');
						link.href = url;
						link.download = 'Presupuesto-#' + estimateId + '.pdf';
						document.body.appendChild(link);
						link.click();
						document.body.removeChild(link);
						window.URL.revokeObjectURL(url);
					})
					.catch(error => {
						console.error('Error:', error);
						showNotification('error', 'Error de conexión', 'Error en la petición. Inténtalo de nuevo más tarde');
					});
			}
		});

		// Cerrar modal
		function closeModal() {
			modal.hide();
			resetForm();
		}

		// Eventos para cerrar modal
		closeBtn.on('click', closeModal);
		cancelBtn.on('click', closeModal);

		// Cerrar modal al hacer click fuera del contenido
		modal.on('click', function(e) {
			if (e.target === modal[0]) {
				closeModal();
			}
		});

		// Cerrar modal con tecla Escape
		$(document).on('keydown', function(e) {
			if (e.key === 'Escape' && modal.is(':visible')) {
				closeModal();
			}
		});

		// Validación de archivo
		fileInput.on('change', function() {
			const file = this.files[0];
			if (!file) return;

			// Validar tamaño (5MB)
			const maxSize = 5 * 1024 * 1024; // 5MB en bytes
			if (file.size > maxSize) {
				showNotification('error', 'Documento muy grande', 'Documento muy grande. El tamaño máximo permitido son 5MB');
				this.value = '';
				return;
			}

			// Validar tipo de archivo
			const allowedTypes = ['application/pdf', 'image/jpeg', 'image/jpg', 'image/png'];
			if (!allowedTypes.includes(file.type)) {
				showNotification('error', 'Tipo de documento inválido', 'Tipo de documento inválido. Por favor, selecciona un documento PDF, JPG o PNG');
				this.value = '';
				return;
			}
		});

		// Envío del formulario
		form.on('submit', function(e) {
			e.preventDefault();

			const file = fileInput[0].files[0];

			// Create a new File object with the desired name
			const newFileName = 'Justificante-de-pago-Presupuesto-#' + currentEstimateId + '.' + file.name.split('.').pop();
			const renamedFile = new File([file], newFileName, {
				type: file.type
			});

			if (!file) {
				showNotification('error', 'No se han seleccionado ningún documento', 'Por favor, selecciona un documento');
				return;
			}

			const orderId = $('#order_id').val();
			const notes = $('#payment_notes').val();

			// Crear FormData para el envío
			const formData = new FormData();
			formData.append('action', 'attach_payment_documentation');
			formData.append('order_id', orderId);
			formData.append('payment_document', renamedFile);
			formData.append('payment_notes', notes);
			formData.append('nonce', 'c127208ab4');
			formData.append('estimate_id', $('#estimate_id').val());


			// Mostrar progreso
			progressContainer.show();
			$('#submitUpload').prop('disabled', true).text('Subiendo');

			// Realizar la llamada fetch
			fetch('https://n8n.cool.b2bit.es/webhook/save_payment_document', {
					method: 'POST',
					body: formData
				})
				.then(response => {
					if (!response.ok) {
						throw new Error('Network response was not ok');
					}
					return response.json();
				})
				.then(data => {
					// Éxito
					progressFill.css('width', '100%');
					progressText.text('100%');

					// Verificar respuesta del servidor
					if (data.success) {
						setTimeout(() => {
							showNotification('success', 'Subida exitosa', data.message || '¡Justificante subido!', function() {
								closeModal();
								window.location.reload();
							});
						}, 500);
					} else {
						showNotification('error', 'Subida fallida', data.message || 'Error subiendo justificante');
						resetForm();
					}
				})
				.catch(error => {
					console.error('Error:', error);
					showNotification('error', 'Error de conexión', 'Error subiendo justificante. Inténtalo de nuevo más tarde');
					resetForm();
				});
		});

		// Función para resetear el formulario
		function resetForm() {
			form[0].reset();
			progressContainer.hide();
			progressFill.css('width', '0%');
			progressText.text('0%');
			$('#submitUpload').prop('disabled', false).text('Subir documento');
		}
	});
</script><?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//www.busleader.es/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://www.busleader.es/post-sitemap.xml</loc>
		<lastmod>2025-03-27T14:51:42+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.busleader.es/page-sitemap.xml</loc>
		<lastmod>2026-06-22T08:33:26+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.busleader.es/product-sitemap.xml</loc>
		<lastmod>2025-09-29T14:18:21+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.busleader.es/category-sitemap.xml</loc>
		<lastmod>2025-03-27T14:51:42+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.busleader.es/product_cat-sitemap.xml</loc>
		<lastmod>2025-09-29T14:18:21+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.busleader.es/author-sitemap.xml</loc>
		<lastmod>2026-03-17T14:32:23+00:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Yoast SEO -->