fix: allow origin colors to be edited and display correctly in dashboard

- Fixed database initialization where default origins were seeded without color_classes.

- Added a visual color picker to the Origens admin page to allow users to assign colors to origin tags.

- Updated Dashboard Pie Chart to read the color classes correctly and display them.
This commit is contained in:
Cauê Faleiros
2026-03-18 13:43:43 -03:00
parent 1d3315a1d0
commit f11db95a2f
5 changed files with 79 additions and 19 deletions

View File

@@ -230,7 +230,7 @@ export const deleteOriginGroup = async (id: string): Promise<boolean> => {
}
};
export const createOriginItem = async (groupId: string, data: { name: string }): Promise<any> => {
export const createOriginItem = async (groupId: string, data: { name: string, color_class?: string }): Promise<any> => {
const response = await fetch(`${API_URL}/origins/${groupId}/items`, {
method: 'POST',
headers: getHeaders(),
@@ -243,7 +243,7 @@ export const createOriginItem = async (groupId: string, data: { name: string }):
return await response.json();
};
export const updateOriginItem = async (id: string, data: { name: string }): Promise<boolean> => {
export const updateOriginItem = async (id: string, data: { name: string, color_class?: string }): Promise<boolean> => {
try {
const response = await fetch(`${API_URL}/origin_items/${id}`, {
method: 'PUT',