Spaces:
Paused
Paused
Download src/firebase.js from dimensionalpulsar/caja: direct link, hf CLI and curl.
- Browser
- Download file 4.1 kB
-
https://huggingface.co/spaces/dimensionalpulsar/caja/resolve/main/src/firebase.js
- Command line
-
hf download hf://spaces/dimensionalpulsar/caja/src/firebase.js
-
curl -L -o firebase.js https://huggingface.co/spaces/dimensionalpulsar/caja/resolve/main/src/firebase.js
4.1 kB
| import { initializeApp } from "firebase/app"; | |
| import { getDatabase } from "firebase/database"; | |
| const firebaseConfig = { | |
| apiKey: "AIzaSyDEHS1jJRVF1_UWpvZymM4y3Bw2P93s-BA", | |
| authDomain: "caja-f2d3a.firebaseapp.com", | |
| databaseURL: "https://caja-f2d3a-default-rtdb.firebaseio.com", | |
| projectId: "caja-f2d3a", | |
| storageBucket: "caja-f2d3a.firebasestorage.app", | |
| messagingSenderId: "320783018594", | |
| appId: "1:320783018594:web:a6e17e4cda5d7a03847f3b", | |
| measurementId: "G-9V1SB7CTVD" | |
| }; | |
| const app = initializeApp(firebaseConfig); | |
| export const database = getDatabase(app); | |
| // Seed exact sample clients & box opening data to Firebase directly from frontend if database is fresh | |
| export const seedInitialFirebaseData = async () => { | |
| try { | |
| const res = await fetch("https://caja-f2d3a-default-rtdb.firebaseio.com/clients.json"); | |
| const data = await res.json(); | |
| if (!data) { | |
| const clientsData = { | |
| "c1": { id: "CRMDN97100230M800", curp: "CRMDN97100230M800", name: "DIANA DE LA CRUZ RAMIREZ", phone: "2322613408", address: "BENITO JUAREZ NUM. 418", municipio: "MARTINEZ DE LA TORRE", colonia: "VILLA INDEPENDENCIA", asesor: "RICARDO MARTINEZ ARRAZOLA", status: "Activo" }, | |
| "c2": { id: "UTSNDG98032030M200", curp: "UTSNDG98032030M200", name: "DIOGENES ADRIANA UTRERA SANTIAGO", phone: "2321486541", address: "SALVADOR ALLENDE NUM. 1009", municipio: "MARTINEZ DE LA TORRE", colonia: "EJIDAL", asesor: "RICARDO MARTINEZ ARRAZOLA", status: "Activo" }, | |
| "c3": { id: "PEAGJN90011614M600", curp: "PEAGJN90011614M600", name: "JOANA JAZMIN PEÑA AGUILERA", phone: "2321183247", address: "JUAN DE DIOS PEZA NUM 711, COL. SOLEDAD", municipio: "MARTINEZ DE LA TORRE", colonia: "SOLEDAD", asesor: "RUBEN ZAMUDIO ORTIZ", status: "Activo" }, | |
| "c4": { id: "HRCRJN97061430H800", curp: "HRCRJN97061430H800", name: "JUAN CARLOS HERNANDEZ CRUZ", phone: "2283061266", address: "AVENIDA C. ANTONIO SOTO Y GAMA COL EJIDAL", municipio: "MARTINEZ DE LA TORRE", colonia: "CONGRESO DE LA UNION", asesor: "RICARDO MARTINEZ ARRAZOLA", status: "Activo" }, | |
| "c5": { id: "FLHRLL89092830M900", curp: "FLHRLL89092830M900", name: "LLUNERY MARGARITA FLORES HERRERA", phone: "2321722088", address: "AVENIDA 2 DE OCTUBRE NUM 508", municipio: "MARTINEZ DE LA TORRE", colonia: "EJIDAL", asesor: "RICARDO MARTINEZ ARRAZOLA", status: "Activo" }, | |
| "c6": { id: "GMHDLC88021821M300", curp: "GMHDLC88021821M300", name: "LUCIA GOMEZ HIDALGO", phone: "2321258210", address: "20 DE NOVIEMBRE NUM. 16", municipio: "MARTINEZ DE LA TORRE", colonia: "VILLA INDEPENDENCIA", asesor: "RICARDO MARTINEZ ARRAZOLA", status: "Activo" }, | |
| "c7": { id: "HRPESN97081530M700", curp: "HRPESN97081530M700", name: "SENYAZET HERNANDEZ PEÑA", phone: "2322272117", address: "JUVENTINO ROSAS NUM. 200 VILLA INDEPENDENCIA", municipio: "MARTINEZ DE LA TORRE", colonia: "VILLA INDEPENDENCIA", asesor: "RUBEN ZAMUDIO ORTIZ", status: "Activo" } | |
| }; | |
| await fetch("https://caja-f2d3a-default-rtdb.firebaseio.com/clients.json", { | |
| method: "PUT", | |
| body: JSON.stringify(clientsData) | |
| }); | |
| } | |
| const resApertura = await fetch("https://caja-f2d3a-default-rtdb.firebaseio.com/apertura_caja.json"); | |
| const dataApertura = await resApertura.json(); | |
| if (!dataApertura) { | |
| const boxOpeningData = { | |
| "b3": { id: "b3", concepto: "APERTURA DE CAJA", descripcion: "APERTURA DE CAJA DEL DIA 15 DE AGOSTO DE 2026", monto: 1.00, fecha: "15/08/2026 13:13" }, | |
| "b2": { id: "b2", concepto: "APERTURA DE CAJA", descripcion: "APERTURA DE CAJA DEL DIA 24 DE JUNIO DE 2026", monto: 11134.00, fecha: "24/06/2026 11:09" }, | |
| "b1": { id: "b1", concepto: "APERTURA DE CAJA", descripcion: "APERTURA DE CAJA DEL DIA 22 DE JUNIO DE 2026", monto: 18904.00, fecha: "22/06/2026 00:52" } | |
| }; | |
| await fetch("https://caja-f2d3a-default-rtdb.firebaseio.com/apertura_caja.json", { | |
| method: "PUT", | |
| body: JSON.stringify(boxOpeningData) | |
| }); | |
| } | |
| } catch (e) { | |
| console.error("Auto seeding error:", e); | |
| } | |
| }; | |
| seedInitialFirebaseData(); | |
| export default app; | |