> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/CKoldo/Vacaciones-front/llms.txt
> Use this file to discover all available pages before exploring further.

# Rescheduling Vacations

> Move future vacation ranges to new dates when the original schedule can no longer be honored.

The Rescheduling module lets you move vacation ranges that are approaching expiry — or that need to change for any reason — to a new set of dates. Only future ranges (those with a start date after today) can be rescheduled.

Navigate to this module at `/reprogramaciones`.

## How rescheduling works

When a range is rescheduled:

1. The **original range** is marked as `reprogramado` and archived. It is no longer counted as active.
2. A **new range** is created with the new dates, referencing the original ranges it replaced via the `reprogramadoDesde` field.
3. The schedule's day counters are updated to reflect the new allocation.

The original ranges remain visible in the schedule history for audit purposes.

## How to reschedule vacation ranges

<Steps>
  <Step title="Select an employee">
    Use the **Personal** dropdown to choose the employee whose vacations you want to reschedule. The system loads all their vacation schedules.
  </Step>

  <Step title="Review available ranges">
    Each schedule period is shown as a card. Within each card, a table lists the **future active ranges** eligible for rescheduling — only ranges whose start date is after today are shown.

    Ranges that are already in the past or already rescheduled are excluded from the table.
  </Step>

  <Step title="Select ranges to reschedule">
    Check the checkbox next to one or more ranges in the same schedule period. A summary panel appears at the bottom of the page showing how many ranges are selected and the total days available.

    <Warning>
      You can only select ranges from a single schedule period at a time. Selecting a range from a different period clears the current selection.
    </Warning>
  </Step>

  <Step title="Click Reprogramar seleccionados">
    Click the **Reprogramar seleccionados** button in the summary panel. A dialog opens where you choose the rescheduling mode and enter the new dates.
  </Step>

  <Step title="Choose a mode and enter new dates">
    Select one of two modes (described below), enter the new dates, and click **Confirmar reprogramación**.
  </Step>
</Steps>

## Rescheduling modes

<Tabs>
  <Tab title="Combinar en una sola vacación (uno)">
    All selected ranges are consolidated into a **single new range**. You enter one start date and one end date that covers the total days from all selected ranges.

    * The new range can be shorter than the total days available — any remaining days are returned to the appropriate pool (flexible or block).
    * If any of the original ranges were of type **bloque**, the new consolidated range is also treated as a bloque regardless of its length.
    * The Friday rule applies: selecting a Friday as start or end date extends the range to Sunday automatically.
  </Tab>

  <Tab title="Mantener cantidad seleccionada (mantener)">
    Each selected range is replaced **individually** with a new range. You set new start and end dates for each original range separately.

    * Each new range inherits the `reprogramadoDesde` reference pointing to its original range.
    * The total days across all new ranges cannot exceed the total days of the original ranges.
    * Any unused days are returned to the appropriate pool.
  </Tab>
</Tabs>

## Validation and overlap detection

Before saving a reschedule, the system checks:

* New dates must fall within the employee's vacation period (between `fechaInicioAnio` and `fechaFinAnio`)
* Start date cannot be after end date
* The total days in the new ranges cannot exceed the total days of the original ranges
* New ranges must not overlap with other active ranges in the same schedule (the original ranges being replaced are excluded from this check)

If any check fails, the confirmation button is blocked and an error message is shown.

<Warning>
  The Friday rule applies during rescheduling: if you pick a Friday as the new start date, the end date is automatically pushed to Sunday. Review the resulting date range before confirming.
</Warning>

## What happens to the original ranges

Once a reschedule is confirmed:

* Each original range receives `estado: "reprogramado"` and a `reprogramadoPor` value pointing to the new range's ID.
* The new range stores `reprogramadoDesde` — a list of the original range IDs it replaced.
* The schedule's `diasFlexiblesUsados` and `diasBloqueUsados` counters are recalculated to reflect the change.

You can see the archived original ranges in the [Vacation Overview](/modules/vacation-overview) module under **Historial de Reprogramaciones**.

## Related modules

<CardGroup>
  <Card title="Vacation Scheduling" icon="calendar-plus" href="/modules/vacation-scheduling">
    Create the vacation ranges that can later be rescheduled.
  </Card>

  <Card title="Vacation Overview" icon="calendar" href="/modules/vacation-overview">
    Review rescheduling history for any employee.
  </Card>

  <Card title="Administration" icon="settings" href="/modules/administration">
    Assign ESINAD IDs to rescheduled records.
  </Card>
</CardGroup>
