The Factus Challenge frontend lives in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tutosrive/factus_challenge/llms.txt
Use this file to discover all available pages before exploring further.
fr-v1/ directory and is a fully static HTML application built with ES modules. There is no build step, no bundler, and no framework — you can open index.html directly in a browser or serve the folder from any static host. All JavaScript is loaded as native ES modules via <script type="module">, and each page controller is a class of pure static methods.
Technology Stack
HTML5 + Bootstrap 5.3.3
Uses the Bootstrap 5.3.3 Vapor dark theme, loaded from
resources/utils/bootstrap-5.3.3/. The entire layout relies on Bootstrap utility classes — no custom CSS grid.Vanilla JS ES Modules
All logic lives in
.mjs files under resources/js/. Each view is an exported default class with only static methods; the classes throw on construction.Tabulator 6.3
Tabulator 6.3 powers every data table. Progressive-scroll loading, column tooltips, custom cell formatters, and footer action buttons are used throughout.
Luxon 3
Luxon 3 handles all date parsing and formatting. Dates from the API arrive as
dd-MM-yyyy hh:mm:ss a and are displayed in a long Spanish locale format.- Bootstrap Popper (
resources/utils/popper/) — powers dropdowns and tooltips - Custom utilities in
resources/utils/own/:helpers.js—Helpersclasstoast.js—Toastclasspopup.js—Popup/Modalclassicons.js—iconsobject of SVG stringsdialog.js— baseDialogclass extended byPopup
Directory Structure
Configuration
The only thing you need to change to point the frontend at a different backend is the single-fieldconfig.json file. On startup, index.mjs fetches this file and writes the URL to window.urlAPI, which every module then reads as a global.
resources/assets/config.json
Change
url to the address of your deployed backend (e.g. https://api.myserver.com) and the entire frontend will switch targets without any other modification.How the Router Works
index.mjs defines a single App class. When the page loads, App.main():
Fetch config
Reads
config.json and stores config.url in window.urlAPI. Also registers shared globals (window.Tabulator, window.Toast, window.Modal, window.Helpers, window.icons, window.DateTime, etc.).Verify backend connection
Calls
GET ${urlAPI}/. If the response status is 200 the router continues; otherwise a danger Toast is shown.Read current page
Extracts the trailing filename from
window.location.href using the regex /[^/]+\.html$/ — e.g. factus.html.resources/js/index.mjs (router excerpt)
Custom Utility Classes
All utility classes are exposed as window globals byindex.mjs so every lazily-loaded module can use them without additional imports.
Helpers — HTTP fetching and form validation
Helpers — HTTP fetching and form validation
Defined in
resources/utils/own/helpers.js. Exposes common operations needed by all page controllers.| Method | Signature | Description |
|---|---|---|
fetchJSON | fetchJSON(url, data?) | Wraps fetch, auto-serialises an Object body to JSON, returns parsed JSON. Always resolves (errors returned as plain objects). |
fetchText | fetchText(url, container?) | Fetches an HTML partial. If container (CSS selector) is provided, injects the HTML there; otherwise returns the raw string. |
toOptionList | toOptionList({ items, value, text, selected?, firstOption? }) | Builds a string of <option> elements from an array of objects. Used to populate every <select> in the app. |
okForm | okForm(formSelector, callBack?) | Triggers native HTML5 form validation; returns true if valid. Accepts an optional extra validation callback. |
selectOptionByText | selectOptionByText(select, text) | Finds and selects a <select> option by its visible text — used when pre-filling edit forms. |
idRandom | idRandom(prefix?) | Returns a zero-padded 14-digit random numeric string (used for unique modal/popover IDs). |
flat / flatten | flat(data) / flatten(obj, final?) | Recursively flattens nested objects — useful for working with joined API responses. |
Toast — Bootstrap toast notifications
Toast — Bootstrap toast notifications
Defined in Each
resources/utils/own/toast.js. Displays a slide-in notification anchored to a <dialog> element appended to <body>.mode maps to a Bootstrap icon: checkCircleFill (success), infoCircleFill (info), exclamationCircleFill2 (warning), xCircleFill (danger).Modal (Popup) — Bootstrap-style dialog
Modal (Popup) — Bootstrap-style dialog
Defined in The
resources/utils/own/popup.js, extends the base Dialog class in dialog.js. Used for all CRUD forms.doSomething callback receives the auto-generated idModal string so downstream code can scope document.querySelector to that specific modal instance.The
Dialog base class always sets this.modal = false regardless of the value passed to the constructor, so the native <dialog>.showModal() path is never taken. Every Modal instance uses non-blocking .show() and relies on the blur filter applied to the rest of the page body.Customs — Shared UI helpers
Customs — Shared UI helpers
Icons — SVG string constants
Icons — SVG string constants
Defined in
resources/utils/own/icons.js. A plain export default object where each key is a descriptive name and each value is an SVG string. Used inline in button HTML. Exposed as window.icons.Key icons used by the UI: icons.plusSquare (add row), icons.edit (edit row), icons.delete (delete row), icons.deleteWhite / icons.editWhite (modal submit buttons), icons.xLg (cancel), icons.pdf_icon1 (PDF download).