Skip to main content

Overview

Special event permits are required for organizing events in public or municipal spaces. These permits track the event type, authorized services (food, beverages, confectionery, etc.), and event-specific details.

Event Types

The system supports the following event classifications:

Deportivo

Sports events and competitions

Cultural

Cultural activities and exhibitions

Benéfico

Charitable and fundraising events

Educativo

Educational events and workshops

Religioso

Religious ceremonies and gatherings

Otros

Other event types (custom description)

Service Types

Events can be authorized to offer the following services:

Comida

Food service

Bebidas

Beverage service

Confitería

Confectionery and sweets

Artículos Varios

Miscellaneous items sales

Heladería

Ice cream service

Otros

Other services (requires description)

Required Fields

Event Information

nombre_evento
string
required
Name of the event
tipo_evento
string
required
Event type: “Deportivo”, “Cultural”, “Benéfico”, “Educativo”, “Religioso”, or custom type

Applicant Information

nombre
string
required
Organizer’s first name
apellido
string
required
Organizer’s last name
idDocument
string
required
Organizer’s identification document number
tlf
string
required
Organizer’s phone number
habitacion
string
required
Organizer’s address or location

Permit Details

habilitacion
date
required
Event start date
vencimiento
date
required
Event end date or permit expiration
horario
string
required
Authorized event schedule (e.g., “9:00 AM - 6:00 PM”)
sector
string
required
Location or sector where the event will take place

Authorized Services

servicio_comida
boolean
Food service authorized (true/false or “true”/“false”)
servicio_bebidas
boolean
Beverage service authorized (true/false or “true”/“false”)
servicio_confiteria
boolean
Confectionery service authorized (true/false or “true”/“false”)
servicio_varios
boolean
Miscellaneous items sales authorized (true/false or “true”/“false”)
servicio_heladeria
boolean
Ice cream service authorized (true/false or “true”/“false”)
servicio_otros
string
Description of other authorized services

Additional Fields

comprobante
file
Payment receipt file upload (optional)
today
string
required
Current date in YYYY-MM-DD format for validation

Creating a Permit

To create a new special event permit, send a POST request with multipart form data:
POST /eventos_especiales/add
Content-Type: multipart/form-data

Request Example

const formData = new FormData();

// Event information
formData.append('nombre_evento', 'Festival de Primavera 2026');
formData.append('tipo_evento', 'Cultural');

// Basic information
formData.append('habilitacion', '2026-04-15');
formData.append('vencimiento', '2026-04-17');
formData.append('horario', '9:00 AM - 10:00 PM');
formData.append('nombre', 'Carlos');
formData.append('apellido', 'Rodríguez');
formData.append('idDocument', 'V-34567890');
formData.append('tlf', '0412-3456789');
formData.append('habitacion', 'Calle 5 #789');
formData.append('sector', 'Plaza Central');

// Authorized services (boolean values converted to 1 or 0)
formData.append('servicio_comida', 'true');
formData.append('servicio_bebidas', 'true');
formData.append('servicio_confiteria', 'true');
formData.append('servicio_varios', 'false');
formData.append('servicio_heladeria', 'true');
formData.append('servicio_otros', 'Artesanías locales');

// Additional
formData.append('comprobante', fileInput.files[0]); // Optional
formData.append('today', '2026-03-04');
Boolean service fields are automatically converted using the converToBooleanService function:
  • true or "true" → 1 (authorized)
  • Any other value → 0 (not authorized)

Response

{
  "success": "¡Se ha registrado correctamente el permiso!",
  "permiso": "2026-001"
}

Editing a Permit

Update an existing event permit:
POST /eventos_especiales/edit
Content-Type: multipart/form-data

Request Body

All fields from creation plus:
permiso
integer
required
ID of the permit to edit
needPermiso
string
Set to “true” if updating the payment receipt, “false” otherwise

Example

const formData = new FormData();
formData.append('permiso', '9');
formData.append('nombre_evento', 'Festival de Primavera 2026 - Extendido');
formData.append('tipo_evento', 'Cultural');
formData.append('habilitacion', '2026-04-15');
formData.append('vencimiento', '2026-04-18'); // Extended
formData.append('horario', '8:00 AM - 11:00 PM'); // Updated
formData.append('nombre', 'Carlos');
formData.append('apellido', 'Rodríguez');
formData.append('idDocument', 'V-34567890');
formData.append('tlf', '0412-3456789');
formData.append('habitacion', 'Calle 5 #789');
formData.append('sector', 'Plaza Central');
formData.append('servicio_comida', 'true');
formData.append('servicio_bebidas', 'true');
formData.append('servicio_confiteria', 'true');
formData.append('servicio_varios', 'true'); // Added
formData.append('servicio_heladeria', 'true');
formData.append('servicio_otros', 'Artesanías locales y souvenirs');
formData.append('needPermiso', 'false');
formData.append('today', '2026-03-04');

Response

{
  "success": "¡Se ha editado correctamente el permiso!",
  "permiso": 9
}

Approving a Permit

Approve a permit by uploading the authorized permit document:
POST /eventos_especiales/aprobate
Content-Type: multipart/form-data

Request Body

permiso
integer
required
ID of the permit to approve
permiso_aprobado
file
required
Authorized permit document file

Response

{
  "success": "¡Se ha aprobado correctamente el permiso!",
  "permiso": 9
}

Canceling a Permit

Cancel a permit with an observation note:
POST /eventos_especiales/cancel
Content-Type: multipart/form-data

Request Body

permiso
integer
required
ID of the permit to cancel
observacion
string
required
Reason for cancellation

Example

const formData = new FormData();
formData.append('permiso', '9');
formData.append('observacion', 'Evento pospuesto por condiciones climáticas');

Response

{
  "success": "¡Se ha cancelado la emisión del permiso correctamente!",
  "permiso": 9
}

Searching and Filtering

Search for event permits:
POST /eventos_especiales/search
Content-Type: multipart/form-data

Request Body

busqueda
string
Search term (searches across permit code, dates, organizer name, document, phone, sector)
estado
string
required
Filter by status: “Todos” (all), “Emitido” (approved), or “No Emitido” (not approved)

Response

Returns HTML template with search results:
{
  "plantilla": "<button class='item aproved' id='itemResult1'>...</button>..."
}

Getting Permit Details

Retrieve details for a specific permit:
POST /eventos_especiales/get
Content-Type: multipart/form-data

Request Body

id
integer
required
Permit ID

Response

{
  "result": {
    "id": 9,
    "codigo_permiso": "2026-001",
    "habilitacion": "2026-04-15",
    "vencimiento": "2026-04-17",
    "horario": "9:00 AM - 10:00 PM",
    "dat_confirmacion": 1,
    "requisitor_nombre": "Carlos",
    "requisitor_apellido": "Rodríguez",
    "requisitor_doc": "V-34567890",
    "requisitor_tlf": "0412-3456789",
    "requisitor_habitacion": "Calle 5 #789",
    "sector_permisado": "Plaza Central",
    "nombre_evento": "Festival de Primavera 2026",
    "tipo_evento": "Cultural",
    "servicio_comida": 1,
    "servicio_bebidas": 1,
    "servicio_confiteria": 1,
    "servicio_articulos_varios": 0,
    "servicio_heladeria": 1,
    "servicio_otros": "Artesanías locales",
    "comprobante_de_pago": "comprobante_de_pago_1234567890.pdf",
    "permiso_autorizado": "permiso_autorizado1234567890.pdf",
    "creador": "Admin User",
    "editor": "Admin User",
    "emitido": 1,
    "cancelado": 0,
    "observacion": ""
  },
  "usuario": { /* current session user */ }
}

PDF Generation

Generate a PDF document for a specific permit:
GET /eventos_especiales/permiso/eventos-especiales_2026-001
The URL pattern is: eventos-especiales_{codigo_permiso}

Response

Returns a PDF document with:
  • Content-Type: application/pdf
  • Event details with checkboxes for event type
  • Service authorizations marked with “x” for enabled services
  • Formatted using the template at views/templates/permisos/eventos.html

PDF Template Logic

The PDF generation includes special handling:
// Event type detection (case-insensitive, accent-removed)
if (tipo_evento.toLowerCase() === 'deportivo') {
  // Mark deportivo checkbox
} else if (tipo_evento.toLowerCase() === 'cultural') {
  // Mark cultural checkbox
} // ... etc

// Service validation
if (servicio_comida === true || servicio_comida === 1) {
  // Mark comidas checkbox with 'x'
}

Real-Time Updates with Socket.io

The system supports real-time synchronization for event permits using Socket.io:

Socket Events

// Client emits when editing
socket.emit('eventos:edit-permiso', {
  permiso: permitId,
  id: permitId
});

// Server broadcasts to other clients
socket.on('eventos:edit-permiso', (data) => {
  // Refresh permit data in UI
});
The Socket.io implementation (from src/index.js:181-187) ensures that all connected clients receive updates when permits are modified, approved, or canceled.

Deleting a Permit

Only users with “Administrador” or “Desarrollador” roles can delete permits.
Delete a permit (only if not approved):
DELETE /eventos_especiales/
Content-Type: multipart/form-data

Request Body

id
integer
required
ID of the permit to delete

Response

{
  "message": "¡El permiso ha sido eliminado!"
}
Same restrictions apply as with other permit types.

Report Generation

Generate a comprehensive PDF report:
GET /eventos_especiales/reporte
The report includes statistics and detailed tables for all special event permits.

Database Schema

The permisos_eventos table includes event-specific fields:
FieldTypeDescription
nombre_eventovarcharEvent name
tipo_eventovarcharEvent type classification
servicio_comidatinyintFood service (0 or 1)
servicio_bebidastinyintBeverage service (0 or 1)
servicio_confiteriatinyintConfectionery service (0 or 1)
servicio_articulos_variostinyintMisc. items sales (0 or 1)
servicio_heladeriatinyintIce cream service (0 or 1)
servicio_otrostextOther services description
Plus all standard permit fields (id, codigo_permiso, dates, organizer info, etc.)

File Storage

Files are stored in:
../public/server-files/asuntos_publicos/permisos_municipales/eventos/

Integration Points

Frontend Integration

The frontend JavaScript (src/public/JS/eventos.js) handles:
  • Form submissions for add/edit operations
  • Search and filtering with real-time updates
  • PDF generation links
  • Delete operations with confirmation
  • Socket.io event listeners for multi-user synchronization

Route Mounting

From src/index.js:55:
app.use('/eventos_especiales', require('./routes/eventos.js'));
All event permit routes are mounted at the /eventos_especiales base path.

Build docs developers (and LLMs) love