Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AndresLopezCorrales/La-casa-del-bordadito/llms.txt
Use this file to discover all available pages before exploring further.
Admins manage the entire café menu from the Admin tab inside the Cuenta section. Every change — adding a new drink, updating a price, or disabling a seasonal item — is reflected in real time across all customer devices via a Firestore snapshot listener.
Data model
Each café item is stored as a document in the cafes Firestore collection and maps to the following Kotlin data class:
data class Cafe(
var id: String = "",
var nombre: String = "",
var descripcion: String = "",
var imagenUrl: String = "",
var categoria: String = "",
var tamano: Map<String, Double> = mapOf(),
@get:PropertyName("isActive")
@set:PropertyName("isActive")
var isActive: Boolean = false
)
The tamano map holds size-to-price pairs (e.g., "Chico" → 35.0). The isActive flag controls whether the item is visible to customers.
Adding a new item
Open the Admin tab
In Cuenta, tap the Admin tab, then tap the Agregar Café button at the top of the café section.
Fill in the item details
AgregarCafeActivity opens with an empty form. Complete all required fields:| Field | Description |
|---|
| Nombre | Display name of the drink or food item |
| Descripción | Short description shown to customers |
| Categoría | One of: Calientes, Fríos, Especiales |
| Imagen | Tap Seleccionar Imagen to pick from the gallery |
| Chico / Mediano / Grande | Enter a price (Double) for each available size; leave blank to omit that size |
At least one size price must be greater than zero before saving.Upload and save
Tap Guardar. If a new image was selected, it is first uploaded to Firebase Storage at Cafes/foto_cafe_{timestamp}. Once the download URL is obtained, the full item is written as a new document in the cafes collection with isActive = false.
New items are saved with isActive = false by default. Toggle the item active (see below) once you are ready for customers to see it.
Editing an existing item
Tap the edit button on any row in the admin café list. The app launches AgregarCafeActivity with isEditing = true and pre-fills the form from Firestore:
val intent = Intent(mContext, AgregarCafeActivity::class.java).apply {
putExtra("cafeId", cafe.id)
putExtra("isEditing", true)
}
startActivity(intent)
The activity loads the existing data (including current image URL), lets you modify any field, and writes back to the same Firestore document via update(). If no new image is chosen, the existing imagenUrl is preserved.
Toggling availability
Each item in the admin list has a toggle button. Tapping it flips isActive in Firestore:
private fun toggleCafeStatus(cafe: Cafe) {
val newStatus = !cafe.isActive
FirebaseFirestore.getInstance().collection("cafes").document(cafe.id)
.update("isActive", newStatus)
.addOnSuccessListener {
Toast.makeText(mContext, if (newStatus) "Café habilitado" else "Café deshabilitado", Toast.LENGTH_SHORT).show()
}
}
isActive = true — the item is visible in the customer menu and shown with a green Activo label.
isActive = false — the item is hidden from customers and shown with a red Deshabilitado label.
Use isActive = false to temporarily hide seasonal drinks or items that are out of stock. The item and all its data remain in Firestore and can be re-enabled instantly when it becomes available again.
The admin café list displays 5 items per page. Use the ← and → buttons to navigate, and the “Página X de Y” indicator to track your position. The list refreshes automatically whenever Firestore reports a change via its snapshot listener.
private val itemsPorPagina = 5
private fun actualizarPaginaAdminCafes() {
val totalPaginas = Math.ceil(listaCafesAdminFull.size.toDouble() / itemsPorPagina).toInt()
if (paginaActualCafe >= totalPaginas && totalPaginas > 0) paginaActualCafe = totalPaginas - 1
val inicio = paginaActualCafe * itemsPorPagina
val fin = Math.min(inicio + itemsPorPagina, listaCafesAdminFull.size)
val nuevaPagina = if (inicio < listaCafesAdminFull.size)
listaCafesAdminFull.subList(inicio, fin).toList() else emptyList()
cafeAdminAdapter.updateList(nuevaPagina)
val total = if (totalPaginas == 0) 1 else totalPaginas
binding.layoutAdmin.txtAdminPageInfo.text = "Página ${paginaActualCafe + 1} de $total"
}