How asistente-informatica-enec/sgp works
Purpose and Runtime
This is a Laravel/PHP asset-management platform built on Orchid’s server-rendered admin UI. It manages institutional assets, civil servants, positions, responsibility cards, assignments/removals, condition tracking, and reports. The README is Laravel boilerplate; the domain is defined by the application tree.
HTTP boots through public/index.php and Laravel bootstrap in bootstrap/app.php. The primary authenticated application surface is Orchid, configured through app/Orchid/PlatformProvider.php and routed in routes/platform.php.
Core Domain Persistence
Eloquent models represent the business graph: assets, people, organizational positions, custody/responsibility documents, assignment history, removals, and audit records.
• app/Models/Asset.php
• app/Models/CivilServant.php
• app/Models/ResponsabilityCard.php
• app/Models/Assignment.php
• app/Models/AssetRemoval.php
• app/Models/ActivityLog.php
The relational schema is versioned under database/migrations/, notably 2026_03_10_193952_create_assets_table.php, 2026_03_10_193952_create_responsability_cards_table.php, and 2026_03_10_193953_create_assignments_table.php. Later migrations enforce responsibility-card and globally unique assignment-code constraints.
Orchid Application Boundary
Orchid Screens are the application controllers/use-case layer: they query models, render layouts, and process form actions. Layouts define the actual administrative UI composition, keeping CRUD workflow logic screen-centered rather than in conventional HTTP controllers.
Representative entry points:
• app/Orchid/Screens/Asset/AssetListScreen.php
• app/Orchid/Screens/Asset/AssetEditScreen.php
• app/Orchid/Screens/ResponsabilityCard/ResponsabilityCardEditScreen.php
• app/Orchid/Screens/BadConditionCard/BadConditionCardEditScreen.php
• app/Orchid/Screens/Report/ReportBuilderScreen.php
Generic app/Http/Controllers/Controller.php is present, but the tree indicates Orchid is the material UI/control-plane boundary.
Asset Lifecycle and Custody Flows
Assets are created, edited, listed, and reviewed through Asset screens/layouts. Asset history is explicitly represented in the UI, likely drawing from assignments/removals/activity records.
• app/Orchid/Layouts/Asset/AssetEditLayout.php
• app/Orchid/Layouts/Asset/AssetHistoryLayout.php
• app/Orchid/Layouts/Asset/AssetSelection.php
Responsibility-card workflows select multiple assets through listener-driven layouts, then persist a card and associated assignments. Bad-condition cards implement a parallel flow for assets discharged due to condition, including staged/batch UI partials and a dedicated selector script.
• app/Orchid/Layouts/ResponsabilityCard/AssetSelectionListener.php
• app/Orchid/Layouts/BadConditionCard/AssetSelectionListener.php
• resources/views/orchid/batch-discharge-stepper.blade.php
• public/js/asset-batch-selector.js
Personnel, Access, and Audit
Civil servants and positions provide the personnel/organization side of asset custody. Kardex screens expose an employee-centric history of assets and bad-condition activity.
• app/Orchid/Screens/CivilServant/CivilServantKardexScreen.php
• app/Orchid/Layouts/CivilServant/KardexAssetsListLayout.php
• app/Orchid/Layouts/CivilServant/KardexBadConditionLayout.php
• app/Orchid/Screens/Position/PositionEditScreen.php
User, role, and permission administration use Orchid’s role system. EnsurePasswordChanged is an application-specific security gate, and the users schema includes a mandatory-password-change field.
• app/Http/Middleware/EnsurePasswordChanged.php
• app/Orchid/Screens/Role/RoleEditScreen.php
• app/Orchid/Screens/User/UserProfileScreen.php
Imports, Exports, and Reports
Spreadsheet imports ingest assets and civil-servant records; corresponding templates guide source data. Report generation has a generic report export plus domain exports for assets, personnel, and responsibility cards, backed by PDF Blade templates.
• app/Imports/AssetImport.php
• app/Imports/CivilServantImport.php
• app/Exports/GenericReportExport.php
• app/Exports/ResponsabilityCardExport.php
• resources/views/pdf/dynamic_report.blade.php
Infrastructure and External Dependencies
Laravel supplies routing, authentication, Eloquent persistence, queues, caching, sessions, filesystem storage, mail, and logging via config/. Orchid is the principal external application framework. Database, queue, cache, filesystem, and service providers are environment-configured rather than fixed in the repository.
• config/database.php
• config/queue.php
• config/filesystems.php
• config/platform.php
Vite compiles the limited frontend assets (resources/js/app.js, resources/css/app.css); server-rendered Orchid/Blade remains the dominant presentation model.
Main entry points: Asset.php Asset domain models · EnsurePasswordChanged.php Password-change gate · AssetEditScreen.php Asset screens · ResponsabilityCardEditScreen.php Custody card screens
Components 18
Laravel Runtime
- HTTP entry
public/index.php - Laravel bootstrap
bootstrap/app.php - Password-change gate · Blocks users required to change their password.
app/Http/Middleware/EnsurePasswordChanged.php
Orchid Admin
- Platform provider
app/Orchid/PlatformProvider.php - Admin routes
routes/platform.php - Asset screens · Asset CRUD and history workflows.
app/Orchid/Screens/Asset/AssetEditScreen.php - Asset layouts · Forms, history, and asset selection UI.
app/Orchid/Layouts/Asset/AssetHistoryLayout.php - Custody card screens · Creates responsibility cards and assignments.
app/Orchid/Screens/ResponsabilityCard/ResponsabilityCardEditScreen.php - Custody asset selector
app/Orchid/Layouts/ResponsabilityCard/AssetSelectionListener.php - Bad-condition screens · Discharges assets due to condition.
app/Orchid/Screens/BadConditionCard/BadConditionCardEditScreen.php - Batch discharge selector · Supports staged selection for condition discharges.
app/Orchid/Layouts/BadConditionCard/AssetSelectionListener.php - Personnel and kardex · Manages positions and employee asset history.
app/Orchid/Screens/CivilServant/CivilServantKardexScreen.php - Users and roles · Orchid role, permission, and profile administration.
app/Orchid/Screens/Role/RoleEditScreen.php
Asset Domain
- Asset domain models · Assets, people, cards, assignments, removals, and activity logs.
app/Models/Asset.php - Relational schema · Defines asset, responsibility-card, and assignment constraints.
database/migrations/2026_03_10_193952_create_assets_table.php
Data Exchange
- Spreadsheet imports · Ingests asset and civil-servant records.
app/Imports/AssetImport.php - Reports and exports · Generates generic and domain report exports.
app/Exports/GenericReportExport.php - PDF report template
resources/views/pdf/dynamic_report.blade.php
Connections 20
- HTTP entry → Laravel bootstrap: boots
- Laravel bootstrap → Platform provider: loads providers
- Platform provider → Admin routes: registers
- Admin routes → Password-change gate: authenticated access
- Password-change gate → Asset screens: permits
- Password-change gate → Custody card screens: permits
- Password-change gate → Bad-condition screens: permits
- Password-change gate → Personnel and kardex: permits
- Asset screens → Asset layouts: renders
- Asset screens → Asset domain models: queries and updates
- Custody card screens → Custody asset selector: selects assets
- Custody card screens → Asset domain models: persists cards and assignments
- Bad-condition screens → Batch discharge selector: selects batch
- Bad-condition screens → Asset domain models: records removals
- Personnel and kardex → Asset domain models: reads custody history
- Users and roles → Admin routes: admin surface
- Asset domain models → Relational schema: persists through
- Spreadsheet imports → Asset domain models: ingests records
- Reports and exports → Asset domain models: reads report data
- Reports and exports → PDF report template: renders PDF