The loans (préstamos) module lets you record when a fixed asset leaves your facility in someone else’s care. Each loan entry tracks the asset, how many units were taken, who authorized the loan, the external recipient, and the expected return date. Registering a loan automatically updates the asset’s availability status so the rest of the inventory reflects the correct state.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ChrisCore1/inventario_sud/llms.txt
Use this file to discover all available pages before exploring further.
Loan fields
Each record in theMovimiento_Prestamos table stores the following fields:
| Field | Type | Description |
|---|---|---|
id_articulo | integer | The asset being loaned (FK to Articulo) |
cantidad_prestada | integer | Number of units being loaned out (default: 1) |
autorizado_por | varchar(100) | Name of the person who authorized the loan |
destino | varchar(150) | Destination or purpose of the loan |
fecha_inicio | timestamp | Date the loan starts |
fecha_retorno | timestamp | Expected return date |
responsable_externo | varchar(100) | Name of the external person responsible for the asset |
id_usuario | integer | The logged-in user who registered the loan (FK to Usuario) |
cantidad_prestada cannot exceed the asset’s recorded cantidad. If you attempt to loan more units than are registered, the registrarPrestamo action returns an error and the loan is not saved.Register a new loan
Open the loans page
Navigate to Préstamos from the sidebar. The table lists all active (non-deleted) loan records.
Click Register
Click Registrar préstamo to open
RegisterLoanModal. The asset selector only shows assets whose estado_disponibilidad is "Disponible".Select the asset
Choose the asset from the dropdown. The list is pre-filtered to available assets only.
Fill in loan details
Enter the quantity being loaned, the authorizing person, the destination, the external responsible person, the loan start date, and the expected return date.
Close or cancel a loan
When an asset is returned or a loan is cancelled, use the delete/close action on the loan row. TheeliminarPrestamo server action:
- Sets
is_deleted = trueon theMovimiento_Prestamosrecord (soft-delete). - Sets the associated asset’s
estado_disponibilidadback to"Disponible". - Logs the closure to the audit trail.
- Revalidates both
/prestamosand/activosso both pages reflect the updated state immediately.
