Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
7ada423
created the navbar
sylee212 Dec 14, 2025
f47f242
created navbar with user profile click drop down menu
sylee212 Dec 14, 2025
20ef6a9
finished dashboard 5 stats
sylee212 Dec 14, 2025
982c189
pending the recent activities for dashboard
sylee212 Dec 15, 2025
b7a1d8f
finished dashboard frontend
sylee212 Dec 15, 2025
f4cf422
made changes to their hyperlinks
sylee212 Dec 15, 2025
a01f136
organization activity page almost done, pending overlays
sylee212 Dec 15, 2025
5f15013
just added more comments
sylee212 Dec 15, 2025
d0957a0
an example of simple overlay
sylee212 Dec 18, 2025
3eb9666
rough version of a overlay, pending refinement and data transfer to s…
sylee212 Dec 18, 2025
c748c97
Created a mock generator and modified the code to use the mock generator
sylee212 Dec 19, 2025
9aec133
added id field to the mocks
sylee212 Dec 19, 2025
a62923b
Rename the component for dashboard
sylee212 Dec 19, 2025
7c32b05
added SWR for polling from backend
sylee212 Dec 19, 2025
aafb495
manage to get the mock data, now working on transferring the data to …
sylee212 Dec 27, 2025
214baad
fixed some error with the type in the interface
sylee212 Dec 27, 2025
87c3474
managed to produce data, send the data to the overlays and works, als…
sylee212 Dec 28, 2025
0a3a224
finished testing the minutes ago
sylee212 Dec 30, 2025
00c55ee
rename some variables
sylee212 Dec 30, 2025
16a40f9
renamed
sylee212 Dec 30, 2025
2dcacb5
minor changes to path dependencies
sylee212 Dec 30, 2025
cb5b3df
added paths to the new pages
sylee212 Dec 30, 2025
cb63bd9
added new page for adding new products
sylee212 Dec 30, 2025
feaf0ba
added more comments
sylee212 Dec 31, 2025
efdf4ff
added new data to the overlay
sylee212 Jan 1, 2026
4e2f478
changed some field to optional
sylee212 Jan 1, 2026
ecfed2b
finished add products
sylee212 Jan 1, 2026
5682cb8
added error control
sylee212 Jan 2, 2026
e0342cd
rename
sylee212 Jan 2, 2026
ed34b68
created the base of the whole inventory
sylee212 Jan 2, 2026
88afc83
added the link to the inventory page for the quick actions panel
sylee212 Jan 2, 2026
a091a70
the base
sylee212 Jan 3, 2026
a02b844
added overlay
sylee212 Jan 3, 2026
7c46274
made slight fix on the position of the button
sylee212 Jan 3, 2026
37743f9
finished creating the member management page, mock and overlays, full…
sylee212 Jan 4, 2026
dfbbd16
renamed item to member
sylee212 Jan 5, 2026
c463775
created the base for the item activity
sylee212 Jan 5, 2026
66f83c8
updated time calculation formulas, refactored code. created a new fol…
sylee212 Jan 5, 2026
8d0e1eb
added some hover effects
sylee212 Jan 5, 2026
6aad93c
changed some fields to show more data
sylee212 Jan 5, 2026
f79e2dd
added partial to add more fields in the add product page
sylee212 Jan 5, 2026
61e8d67
push
sylee212 Jan 6, 2026
f9961c1
added more css, added buttons for modify and returned on items
sylee212 Jan 6, 2026
d1945f1
refactored code directory
sylee212 Jan 6, 2026
4722181
just some p rephrasing
sylee212 Jan 6, 2026
cf99bbf
fixed the mode
sylee212 Jan 6, 2026
71dbdbf
refactored code directory
sylee212 Jan 6, 2026
a563666
added create, modify member
sylee212 Jan 6, 2026
0756243
aded an update and delete
sylee212 Jan 6, 2026
cc9d112
added delete to modals, pending new getFunctions for the dashboard f…
sylee212 Jan 6, 2026
b60e55d
init commit for backend, just created some basic things
sylee212 Jan 7, 2026
27e4ca6
added the required fields for the models, but the borrower stuff may …
sylee212 Jan 8, 2026
fe26e4a
renamed some fields
sylee212 Jan 8, 2026
565c8cf
rename data_added
sylee212 Jan 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"next": "15.4.7",
"react": "19.1.0",
"react-dom": "19.1.0",
"swr": "^2.3.8",
"tailwind-merge": "^3.3.1",
"tailwindcss-animate": "^1.0.7"
},
Expand Down
159 changes: 159 additions & 0 deletions client/src/components/ui/backend/organization_call_backend.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// src/hooks/organization_call_backend.ts
// Change this URL to match your backend API endpoint

import { Inventory_Details_Interface } from "@/components/ui/card_organization_inventory_details_modal";
import { Member_Details_Interface } from "@/components/ui/card_organization_member_details_modal";
import { generateRandomMockInventoryDetails } from "@/mocks/Inventory_Details_Interface_Mocks";
import { generateMockMember } from "@/mocks/Members_Details_Interface_Mocks";

// tha main URL
export const BASE_URL = "http://localhost:8000/api/activities/";

// change when backend is ready
const isDev: boolean = true;

// --- GET: Fetch all items ---
export const getItems = async (
filterType: string,
): Promise<Inventory_Details_Interface[]> => {
if (isDev) {
// Mock data for development
const mockData: Inventory_Details_Interface[] = [];
for (let i = 0; i < 10; i++) {
mockData.push(generateRandomMockInventoryDetails());
}
console.log("Mock data generated:", mockData);
return mockData;
} else {
// 1. Fetch from Django
// fetch() is used to get the data from backend using URL
const response = await fetch(`${BASE_URL}?type=${filterType}`);

// 2. Check if the request was successful
if (!response.ok) throw new Error("Failed to fetch");

// 3. Parse the JSON data
// because fetcah returns a response, it isnt the data yet,
// its just the response header,
// you will need to use .json() to get the data
// it converts raw bytes to Javascript objects
return await response.json(); // Returns the list from Django
}
};

// --- POST: Create a new item ---
// .stringify, flattens the object
// headers: { 'Content-Type': 'application/json' } determine, how the data will be dealt with by the server
// possible types: text/plain, text/html application/json, images/jpeg, application/x-www-form-urlencoded ( form data ),
// if you dont have this, might get error 400
export const createItem = async (
newData: Inventory_Details_Interface,
): Promise<boolean> => {
if (isDev) {
console.log("Mock create item called with data:", newData);
return true; // Simulate successful creation
} else {
const response = await fetch(BASE_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(newData),
});

// must return true when coding backend
return await response.json();
}
};

// --- PATCH/PUT: Update an existing item ---
export const updateItem = async (
id: number,
newData: Inventory_Details_Interface,
) => {
// Django usually expects a trailing slash after the ID
const response = await fetch(`${BASE_URL}${id}/`, {
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(newData),
});
return await response.json();
};

// --- DELETE: Remove an item ---
export const deleteItem = async (id: number) => {
const response = await fetch(`${BASE_URL}${id}/`, {
method: "DELETE",
});
// DELETE usually returns a 204 No Content status, so we don't always .json() it
return response.ok;
};

// MEMBERS SECTION

export const getMembers = async (
filterType: string,
): Promise<Member_Details_Interface[]> => {
if (isDev) {
// Mock data for development
const mockData: Member_Details_Interface[] = [];
for (let i = 0; i < 10; i++) {
mockData.push(generateMockMember());
}
console.log("Mock data generated:", mockData);
return mockData;
} else {
// 1. Fetch from Django
// fetch() is used to get the data from backend using URL
const response = await fetch(`${BASE_URL}?type=${filterType}`);

// 2. Check if the request was successful
if (!response.ok) throw new Error("Failed to fetch");

// 3. Parse the JSON data
// because fetcah returns a response, it isnt the data yet,
// its just the response header,
// you will need to use .json() to get the data
// it converts raw bytes to Javascript objects
return await response.json(); // Returns the list from Django
}
};

export const createMember = async (
newData: Member_Details_Interface,
): Promise<boolean> => {
if (isDev) {
console.log("Mock create Member called with data:", newData);
return true; // Simulate successful creation
} else {
const response = await fetch(BASE_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(newData),
});

// must return true when coding backend
return await response.json();
}
};

// --- PATCH/PUT: Update an existing Member ---
export const updateMember = async (
id: number,
newData: Member_Details_Interface,
) => {
// Django usually expects a trailing slash after the ID
const response = await fetch(`${BASE_URL}${id}/`, {
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(newData),
});
return await response.json();
};

// --- DELETE: Remove an Member ---
export const deleteMember = async (id: number) => {
const response = await fetch(`${BASE_URL}${id}/`, {
method: "DELETE",
});
// DELETE usually returns a 204 No Content status, so we don't always .json() it
return response.ok;
};
Loading
Loading