chore: update the workarea page

This commit is contained in:
Andre Henriques 2024-10-15 13:28:37 +01:00
parent bbc02e5fda
commit 62961363f3
2 changed files with 104 additions and 104 deletions

View File

@ -4,138 +4,135 @@ import { post } from './utils';
export type AsEnum<T> = T[keyof T]; export type AsEnum<T> = T[keyof T];
export const ApplicationStatus = Object.freeze({ export const ApplicationStatus = Object.freeze({
ToApply: 0, ToApply: 0,
WorkingOnIt: 1, WorkingOnIt: 1,
Ignore: 2, Ignore: 2,
ApplyedButSaidNo: 3, ApplyedButSaidNo: 3,
Applyed: 4, Applyed: 4,
Expired: 5, Expired: 5,
TasksToDo: 6, TasksToDo: 6,
LinkedApplication: 7, LinkedApplication: 7,
InterviewStep1: 8 InterviewStep1: 8
}); });
export const ApplicationStatusMaping: Record< export const ApplicationStatusMaping: Record<AsEnum<typeof ApplicationStatus>, string> = Object.freeze({
(typeof ApplicationStatus)[keyof typeof ApplicationStatus], 0: 'To Apply',
string 1: 'Working On It',
> = Object.freeze({ 2: 'Ignore',
0: 'To Apply', 3: 'Applyed But Said No',
1: 'Working On It', 4: 'Applyed',
2: 'Ignore', 5: 'Expired',
3: 'Applyed But Said No', 6: 'Tasks To Do',
4: 'Applyed', 7: 'Linked Application',
5: 'Expired', 8: 'Interview 1'
6: 'Tasks To Do',
7: 'Linked Application',
8: 'Interview 1'
}); });
export type View = { export type View = {
id: string; id: string;
application_id: string; application_id: string;
time: string; time: string;
}; };
export type Application = { export type Application = {
id: string; id: string;
url: string; url: string;
original_url: string | null; original_url: string | null;
unique_url: string | null; unique_url: string | null;
title: string; title: string;
user_id: string; user_id: string;
extra_data: string; extra_data: string;
payrange: string; payrange: string;
status: AsEnum<typeof ApplicationStatus>; status: AsEnum<typeof ApplicationStatus>;
recruiter: string; recruiter: string;
company: string; company: string;
message: string; message: string;
linked_application: string; linked_application: string;
application_time: string; application_time: string;
create_time: string; create_time: string;
status_history: string; status_history: string;
flairs: Flair[]; flairs: Flair[];
views: View[]; views: View[];
}; };
function createApplicationStore() { function createApplicationStore() {
let applications: Application[] = $state([]); let applications: Application[] = $state([]);
let applyed: Application[] = $state([]); let applyed: Application[] = $state([]);
let all: Application[] = $state([]); let all: Application[] = $state([]);
let dragApplication: Application | undefined = $state(undefined); let dragApplication: Application | undefined = $state(undefined);
let loadItem: Application | undefined = $state(undefined); let loadItem: Application | undefined = $state(undefined);
return { return {
/** /**
* @throws {Error} * @throws {Error}
*/ */
async loadApplications(force = false) { async loadApplications(force = false) {
if (!force && applications.length > 1) { if (!force && applications.length > 1) {
return; return;
} }
applications = await post('application/list', { status: 0 }); applications = await post('application/list', { status: 0 });
}, },
/** /**
* @throws {Error} * @throws {Error}
*/ */
async loadAplyed(force = false) { async loadAplyed(force = false) {
if (!force && applyed.length > 1) { if (!force && applyed.length > 1) {
return; return;
} }
applyed = await post('application/list', { status: ApplicationStatus.Applyed, views: true }); applyed = await post('application/list', { status: ApplicationStatus.Applyed, views: true });
}, },
/** /**
* @throws {Error} * @throws {Error}
*/ */
async loadAll(force = false) { async loadAll(force = false) {
if (!force && all.length > 1) { if (!force && all.length > 1) {
return; return;
} }
all = await post('application/list', {}); all = await post('application/list', {});
}, },
clear() { clear() {
applications = []; applications = [];
}, },
dragStart(application: Application | undefined) { dragStart(application: Application | undefined) {
if (!application) { if (!application) {
return; return;
} }
dragApplication = application; dragApplication = application;
}, },
dragEnd() { dragEnd() {
dragApplication = undefined; dragApplication = undefined;
}, },
get dragging() { get dragging() {
return dragApplication; return dragApplication;
}, },
get applications() { get applications() {
return applications; return applications;
}, },
get applyed() { get applyed() {
return applyed; return applyed;
}, },
get all() { get all() {
return all; return all;
}, },
get loadItem() { get loadItem() {
return loadItem; return loadItem;
}, },
set loadItem(item: Application | undefined) { set loadItem(item: Application | undefined) {
loadItem = item; loadItem = item;
} }
}; };
} }
export const applicationStore = createApplicationStore(); export const applicationStore = createApplicationStore();

View File

@ -487,6 +487,9 @@
> >
Tasks To Do Tasks To Do
</DropZone> </DropZone>
{/if}
{#if [ApplicationStatus.TasksToDo, ApplicationStatus.Applyed].includes(activeItem.status)}
<!-- Tasks to do --> <!-- Tasks to do -->
<DropZone <DropZone