Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/emmanueljarquin-sys/GrupoMecsaCMS/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Employee Management module allows you to maintain a comprehensive directory of all employees in your organization. Each employee profile includes personal information, professional details, contact data, and a photo.
Employee photos are stored in Supabase Storage and must be in image format (JPG, PNG, etc.).

Key Features

Employee Directory

View and search all employees with their photos, names, positions, and departments.

Contact Information

Store phone numbers and email addresses for easy communication.

Department Assignment

Link employees to specific departments for organizational structure.

Photo Management

Upload and display employee photos in the directory.

CRUD Operations

Create New Employee

1

Open the New Employee Modal

Click the “Añadir nuevo” button in the top-right corner of the employee directory.
2

Fill in Employee Details

Complete the following required and optional fields:Required Fields:
  • Nombre completo - Full name of the employee
  • Fotografía - Employee photo (image file)
  • Departamento - Select from existing departments
Optional Fields:
  • Puesto / Descripción - Job title or role description
  • Celular - Mobile phone number
  • Correo electrónico - Email address
3

Submit the Form

Click “Añadir Empleado” to create the employee record. The photo will be uploaded to Supabase Storage and the employee data will be saved to the database.
The system automatically generates a unique ID for each new employee and stores the creation timestamp.

Read/View Employees

The employee directory displays:
  • ID - Unique employee identifier
  • Foto - Employee photo thumbnail (120px)
  • Nombre - Full name
  • Descripción - Job title or position
  • Departamento - Department badge
  • Acciones - Edit and delete buttons

Update Employee Information

1

Click the Edit Button

In the employee table, click the edit icon (pen) in the Actions column for the employee you want to modify.
2

Modify the Information

Update any of the following fields:
  • Full name
  • Photo (optional - only if you want to change the current photo)
  • Job description
  • Department assignment
  • Mobile phone number
  • Email address
3

Save Changes

Click “Guardar Cambios” to update the employee record. The form processes at functions/editarEmpleado.php.
When editing, the current photo is displayed as a preview. You only need to upload a new file if you want to replace it.

Delete Employee

Click the delete icon (trash) in the Actions column for any employee. A confirmation prompt will appear before permanently removing the employee from the system.
Deleting an employee is permanent and cannot be undone. Ensure you have the correct employee selected before confirming deletion.

Form Fields and Validation

Field NameTypeRequiredValidationStorage
nombreTextYesNon-empty stringDatabase
fotoFileYes (create)Image formatSupabase Storage (empleados bucket)
descripcionTextareaNoNoneDatabase
departamentoSelectYesMust match existing departmentDatabase
celularTextNoNoneDatabase
correoEmailNoValid email formatDatabase

Data Structure

Database Table: empleados

{
  "id": "auto-incremented integer",
  "nombre": "string",
  "foto": "string (file path in storage)",
  "descripcion": "string",
  "departamento": "string",
  "celular": "string",
  "correo": "string",
  "created_at": "timestamp (Y-m-d H:i:s)"
}

Photo Storage

Employee photos are stored in the Supabase Storage bucket empleados with the path pattern:
fotos/{sanitized_filename}
The public URL format is:
https://awhuzekjpoapamijlvua.supabase.co/storage/v1/object/public/empleados/{foto_path}

Role-Based Access

Access to the Employee Management module requires an active session with a valid authentication token. Users without a valid $_SESSION['token'] will be redirected to the login page.

Required Permissions

  • View Employees - Authenticated users with valid session
  • Create Employee - Users with write permissions
  • Edit Employee - Users with write permissions
  • Delete Employee - Users with delete permissions

Integration with Other Modules

The Employee Management module integrates with:

Departments

Employee records pull department names from the departamento table for the dropdown selector.

Supabase Storage

Photos are stored and retrieved from the Supabase Storage empleados bucket.

Technical Details

API Endpoints

  • GET /empleados?select=*&order=id.desc&limit={perPage}&offset={offset} - Fetch paginated employees
  • GET /empleados?select=id - Get total count for pagination
  • POST /empleados - Create new employee
  • POST /functions/editarEmpleado.php - Update employee
  • Storage PUT /storage/v1/object/empleados/{path} - Upload photo

JavaScript Files

  • main.js - Core CMS functionality
  • mainempleados.js - Employee-specific interactions (edit modal population, delete confirmation)

User Workflows

Adding a New Team Member

1

Ensure Department Exists

Before adding an employee, make sure their department is already created in the Departments module.
2

Prepare Employee Photo

Have a professional photo ready in JPG or PNG format.
3

Create Employee Record

Click “Añadir nuevo” and fill in all relevant information including name, photo, department, description, phone, and email.
4

Verify the Entry

After creation, the employee will appear in the directory table with their photo and information visible.

Updating Contact Information

1

Locate the Employee

Use pagination or scroll through the employee directory to find the person whose information needs updating.
2

Open Edit Modal

Click the edit icon (pen) in the Actions column.
3

Update Fields

Modify the phone number, email, or any other field that needs to be updated.
4

Save

Click “Guardar Cambios” to commit the updates.

Build docs developers (and LLMs) love