UNPKG

seti-ramesesv1

Version:

Reusable components and context for Next.js apps

215 lines (213 loc) 6.93 kB
const appnew = [ // Building Permit - "BP" { trackno: "154-12357TD6S", type: "TSC", particulars: "Temporary Service Construction", applicant: "Dela Cruz, Juan", dtsubmitted: "March 10, 2016", elapsed: "5 days", bldgno: "", // Building Permit Number location: "123 Main St, City", // Location for the building }, // Electrical Permit - "EP" linked to BLD-001 { trackno: "154-124569", type: "EP", particulars: "Electrical Permit", applicant: "Reyes, Maria", dtsubmitted: "April 15, 2017", elapsed: "7 days", bldgno: "BLD-001", // Link to Building Permit BLD-001 location: "123 Main St, City", // Same location as the building }, // Sanitary Permit - "SP" linked to BLD-001 { trackno: "154-124570", type: "TSC", particulars: "Temporary Service Construction", applicant: "Santos, Pedro", dtsubmitted: "May 20, 2018", elapsed: "4 days", bldgno: "BLD-005", // Link to Building Permit BLD-001 location: "123 Main St, City", // Same location as the building }, // Fire Safety Permit - "FP" linked to BLD-001 { trackno: "154-124571", type: "FP", particulars: "Fire Safety Permit", applicant: "Gonzales, Anna", dtsubmitted: "June 5, 2019", elapsed: "6 days", bldgno: "BLD-001", // Link to Building Permit BLD-001 location: "123 Main St, City", // Same location as the building }, // Zoning Permit - "ZP" linked to BLD-001 { trackno: "154-124572", type: "ZP", particulars: "Zoning Permit", applicant: "Torres, Luis", dtsubmitted: "July 12, 2020", elapsed: "3 days", bldgno: "BLD-003", // Link to Building Permit BLD-001 location: "123 Main St, City", // Same location as the building }, // Water Plumbing Permit - "WP" linked to BLD-001 { trackno: "154-124573", type: "TSC", particulars: "Temporary Service Construction", applicant: "Fernandez, Carla", dtsubmitted: "August 18, 2021", elapsed: "8 days", bldgno: "BLD-001", // Link to Building Permit BLD-001 location: "123 Main St, City", // Same location as the building }, // Demolition Permit - "DP" linked to BLD-001 { trackno: "154-124574", type: "DP", particulars: "Demolition Permit", applicant: "Mendoza, Eric", dtsubmitted: "September 25, 2022", elapsed: "2 days", bldgno: "BLD-003", // Link to Building Permit BLD-001 location: "123 Main St, City", // Same location as the building }, // Fencing Permit - "PP" linked to BLD-001 { trackno: "154-124575", type: "PP", particulars: "Fencing Permit", applicant: "Bautista, Jose", dtsubmitted: "October 30, 2023", elapsed: "5 days", bldgno: "BLD-001", // Link to Building Permit BLD-001 location: "123 Main St, City", // Same location as the building }, // Sign Permit - "SPP" linked to BLD-001 { trackno: "154-124576", type: "SPP", particulars: "Sign Permit", applicant: "Lopez, Adrian", dtsubmitted: "November 10, 2023", elapsed: "4 days", bldgno: "BLD-002", // Link to Building Permit BLD-001 location: "123 Main St, City", // Same location as the building }, // Occupancy Permit - "TSC" linked to BLD-001 { trackno: "154-124577", type: "TSC", particulars: "Temporary Service Construction", applicant: "Garcia, Michelle", dtsubmitted: "December 15, 2023", elapsed: "7 days", bldgno: "BLD-002", // Link to Building Permit BLD-001 location: "123 Main St, City", // Same location as the building }, ]; const appcancelled = [ { trackno: "154-224567", type: "TSC", particulars: "Temporary Service Construction", applicant: "Villanueva, Mark", dtsubmitted: "January 10, 2022", elapsed: "7 days", }, { trackno: "154-224568", type: "BP", particulars: "Building Permit", applicant: "Dela Cruz, Juan", dtsubmitted: "March 5, 2022", elapsed: "7 days", }, { trackno: "154-224569", type: "EP", particulars: "Electrical Permit", applicant: "Santos, Maria", dtsubmitted: "April 20, 2022", elapsed: "7 days", }, { trackno: "154-224570", type: "SP", particulars: "Sanitary Permit", applicant: "Torres, Luis", dtsubmitted: "May 15, 2022", elapsed: "7 days", }, { trackno: "154-224571", type: "FP", particulars: "Fire Safety Permit", applicant: "Reyes, Angela", dtsubmitted: "June 18, 2022", elapsed: "7 days", }, { trackno: "154-224574", type: "DP", particulars: "Demolition Permit", applicant: "Bautista, Jose", dtsubmitted: "September 5, 2022", elapsed: "7 days", }, { trackno: "154-224575", type: "PP", particulars: "Fencing Permit", applicant: "Lopez, Adrian", dtsubmitted: "October 15, 2022", elapsed: "7 days", }, { trackno: "154-224576", type: "TSC", particulars: "Occupancy Permit", applicant: "Garcia, Michelle", dtsubmitted: "November 20, 2022", elapsed: "7 days", }, ]; const emptydata = []; const getApplicationList = (params) => { const { start = 0, limit, tag, searchtext = "", searchfields = [], filters = {} } = params; let list = []; switch (tag) { case "new": list = appnew; break; case "cancelled": list = appcancelled; break; case "returned": case "draft": default: list = emptydata; break; } if (searchtext.trim() !== "" && Array.isArray(searchfields) && searchfields.length > 0) { const text = searchtext.toLowerCase(); list = list.filter((item) => searchfields.some((field) => item[field]?.toString().toLowerCase().includes(text))); } if (filters && typeof filters === "object") { list = list.filter((item) => Object.entries(filters).every(([field, value]) => { if (value === "") return true; return item[field]?.toString() === value; })); } return list.slice(start, start + limit + 1); }; const getApplicationByTrackNo = (trackno) => { return appnew.find((item) => item.trackno === trackno); }; export { getApplicationByTrackNo, getApplicationList }; //# sourceMappingURL=applications.js.map