chore: added stauts_history
This commit is contained in:
@@ -9,7 +9,8 @@ export const ApplicationStatus = Object.freeze({
|
||||
Ignore: 2,
|
||||
ApplyedButSaidNo: 3,
|
||||
Applyed: 4,
|
||||
Expired: 5
|
||||
Expired: 5,
|
||||
TasksToDo: 6,
|
||||
});
|
||||
|
||||
export const ApplicationStatusMaping: Record<
|
||||
@@ -21,7 +22,8 @@ export const ApplicationStatusMaping: Record<
|
||||
2: 'Ignore',
|
||||
3: 'Applyed But Said No',
|
||||
4: 'Applyed',
|
||||
5: 'Expired'
|
||||
5: 'Expired',
|
||||
6: 'Tasks To Do',
|
||||
});
|
||||
|
||||
export type View = {
|
||||
@@ -51,9 +53,12 @@ export type Application = {
|
||||
function createApplicationStore() {
|
||||
let applications: Application[] = $state([]);
|
||||
let applyed: Application[] = $state([]);
|
||||
let tasksToDo: Application[] = $state([]);
|
||||
|
||||
let dragApplication: Application | undefined = $state(undefined);
|
||||
|
||||
let loadItem: Application | undefined = $state(undefined);
|
||||
|
||||
return {
|
||||
/**
|
||||
* @throws {Error}
|
||||
@@ -69,12 +74,22 @@ function createApplicationStore() {
|
||||
* @throws {Error}
|
||||
*/
|
||||
async loadAplyed(force = false) {
|
||||
if (!force && applications.length > 1) {
|
||||
if (!force && applyed.length > 1) {
|
||||
return;
|
||||
}
|
||||
applyed = await post('application/list', { status: ApplicationStatus.Applyed });
|
||||
},
|
||||
|
||||
/**
|
||||
* @throws {Error}
|
||||
*/
|
||||
async loadTasksToDo(force = false) {
|
||||
if (!force && tasksToDo.length > 1) {
|
||||
return;
|
||||
}
|
||||
tasksToDo = await post('application/list', { status: ApplicationStatus.TasksToDo });
|
||||
},
|
||||
|
||||
clear() {
|
||||
applications = [];
|
||||
},
|
||||
@@ -97,7 +112,19 @@ function createApplicationStore() {
|
||||
|
||||
get applyed() {
|
||||
return applyed;
|
||||
}
|
||||
},
|
||||
|
||||
get tasksToDo() {
|
||||
return tasksToDo;
|
||||
},
|
||||
|
||||
get loadItem() {
|
||||
return loadItem;
|
||||
},
|
||||
|
||||
set loadItem(item: Application | undefined) {
|
||||
loadItem = item;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import ApplicationsList from './ApplicationsList.svelte';
|
||||
import WorkArea from './work-area/WorkArea.svelte';
|
||||
import AppliyedList from './AppliyedList.svelte';
|
||||
import TasksToDoList from './TasksToDoList.svelte';
|
||||
</script>
|
||||
|
||||
<HasUser redirect="/cv">
|
||||
@@ -14,6 +15,7 @@
|
||||
<ApplicationsList />
|
||||
<WorkArea />
|
||||
</div>
|
||||
<TasksToDoList />
|
||||
<AppliyedList />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,18 +11,17 @@
|
||||
<h1>Applied</h1>
|
||||
<div class="overflow-auto flex-grow">
|
||||
{#each applicationStore.applyed as item}
|
||||
<div
|
||||
class="card p-2 my-2 bg-slate-100"
|
||||
draggable="true"
|
||||
ondragstart={() => applicationStore.dragStart(item)}
|
||||
ondragend={() => {
|
||||
window.requestAnimationFrame(() => {
|
||||
applicationStore.dragEnd();
|
||||
<button
|
||||
class="card p-2 my-2 bg-slate-100 w-full text-left"
|
||||
onclick={() => {
|
||||
applicationStore.loadItem = item;
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}}
|
||||
role="none"
|
||||
>
|
||||
<div class:animate-pulse={applicationStore.dragging?.id === item.id}>
|
||||
<div>
|
||||
<h2 class="text-lg text-blue-500">
|
||||
{item.title}
|
||||
{#if item.company}
|
||||
@@ -38,7 +37,7 @@
|
||||
{item.url}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
45
site/src/routes/TasksToDoList.svelte
Normal file
45
site/src/routes/TasksToDoList.svelte
Normal file
@@ -0,0 +1,45 @@
|
||||
<script lang="ts">
|
||||
import { applicationStore } from '$lib/ApplicationsStore.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
onMount(() => {
|
||||
applicationStore.loadTasksToDo();
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if applicationStore.tasksToDo.length > 0}
|
||||
<div class="card p-3 rounded-lg flex flex-col">
|
||||
<h1>Tasks To Do</h1>
|
||||
<div class="overflow-auto flex-grow">
|
||||
{#each applicationStore.tasksToDo as item}
|
||||
<button
|
||||
class="card p-2 my-2 bg-slate-100 w-full text-left"
|
||||
onclick={() => {
|
||||
applicationStore.loadItem = item;
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
<h2 class="text-lg text-blue-500">
|
||||
{item.title}
|
||||
{#if item.company}
|
||||
<div class="text-violet-800">
|
||||
@ {item.company}
|
||||
</div>
|
||||
{/if}
|
||||
</h2>
|
||||
<a
|
||||
href={item.url}
|
||||
class="text-violet-600 overflow-hidden whitespace-nowrap block"
|
||||
>
|
||||
{item.url}
|
||||
</a>
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -31,6 +31,7 @@
|
||||
[ApplicationStatus.ApplyedButSaidNo]: 0,
|
||||
[ApplicationStatus.Expired]: 0,
|
||||
[ApplicationStatus.Applyed]: 0,
|
||||
[ApplicationStatus.TasksToDo]: 0,
|
||||
Linkedin: 0,
|
||||
Glassdoor: 0,
|
||||
'Unknown Source': 0,
|
||||
@@ -51,6 +52,11 @@
|
||||
source: ApplicationStatus.Applyed,
|
||||
target: ApplicationStatus.ApplyedButSaidNo,
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
source: ApplicationStatus.Applyed,
|
||||
target: ApplicationStatus.TasksToDo,
|
||||
value: 1
|
||||
}
|
||||
];
|
||||
|
||||
@@ -63,7 +69,7 @@
|
||||
nodeTypes['Unknown Source'] += 1;
|
||||
}
|
||||
nodeTypes[a.status] += 1;
|
||||
if (a.status === ApplicationStatus.ApplyedButSaidNo) {
|
||||
if ([ApplicationStatus.ApplyedButSaidNo, ApplicationStatus.TasksToDo].includes(a.status) ) {
|
||||
nodeTypes[ApplicationStatus.Applyed] += 1;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
import DropZone from './DropZone.svelte';
|
||||
import { userStore } from '$lib/UserStore.svelte';
|
||||
import LinkApplication from './LinkApplication.svelte';
|
||||
import ApplicationsList from '../ApplicationsList.svelte';
|
||||
|
||||
let activeItem: Application | undefined = $state();
|
||||
|
||||
@@ -148,6 +149,14 @@
|
||||
loadActive();
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (!applicationStore.loadItem) {
|
||||
return;
|
||||
}
|
||||
activeItem = applicationStore.loadItem;
|
||||
applicationStore.loadItem = undefined;
|
||||
});
|
||||
|
||||
async function moveStatus(status: number) {
|
||||
if (!activeItem) return;
|
||||
// Deactivate active item
|
||||
@@ -372,7 +381,13 @@
|
||||
{#if activeItem.original_url != null}
|
||||
<button class="btn-danger" onclick={resetUrl}> Reset Url </button>
|
||||
{/if}
|
||||
<button class:btn-primary={drag} class:btn-danger={!drag} onclick={() => (drag = !drag)}> 👋 </button>
|
||||
<button
|
||||
class:btn-primary={drag}
|
||||
class:btn-danger={!drag}
|
||||
onclick={() => (drag = !drag)}
|
||||
>
|
||||
👋
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{#if applicationStore.dragging}
|
||||
@@ -384,48 +399,69 @@
|
||||
icon="box-arrow-down"
|
||||
ondrop={() => {
|
||||
moveStatus(ApplicationStatus.ToApply);
|
||||
applicationStore.loadAplyed(true);
|
||||
applicationStore.loadTasksToDo(true);
|
||||
}}
|
||||
>
|
||||
To apply
|
||||
</DropZone>
|
||||
|
||||
<!-- Ignore -->
|
||||
<DropZone
|
||||
icon="trash-fill"
|
||||
ondrop={() => {
|
||||
moveStatus(ApplicationStatus.Ignore);
|
||||
}}
|
||||
>
|
||||
Ignore it
|
||||
</DropZone>
|
||||
{#if activeItem.status === ApplicationStatus.WorkingOnIt}
|
||||
<!-- Ignore -->
|
||||
<DropZone
|
||||
icon="trash-fill"
|
||||
ondrop={() => {
|
||||
moveStatus(ApplicationStatus.Ignore);
|
||||
}}
|
||||
>
|
||||
Ignore it
|
||||
</DropZone>
|
||||
|
||||
<!-- Expired -->
|
||||
<DropZone
|
||||
icon="clock-fill text-orange-500"
|
||||
ondrop={() => {
|
||||
if (activeItem && activeItem.status === ApplicationStatus.Expired) {
|
||||
moveStatus(ApplicationStatus.ToApply);
|
||||
} else {
|
||||
moveStatus(ApplicationStatus.Expired);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Mark as expired
|
||||
</DropZone>
|
||||
<!-- Expired -->
|
||||
<DropZone
|
||||
icon="clock-fill text-orange-500"
|
||||
ondrop={() => {
|
||||
if (activeItem && activeItem.status === ApplicationStatus.Expired) {
|
||||
moveStatus(ApplicationStatus.ToApply);
|
||||
} else {
|
||||
moveStatus(ApplicationStatus.Expired);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Mark as expired
|
||||
</DropZone>
|
||||
|
||||
<!-- Repeated -->
|
||||
<DropZone icon="trash-fill text-danger" ondrop={() => remove()}>Delete it</DropZone>
|
||||
<!-- Repeated -->
|
||||
<DropZone icon="trash-fill text-danger" ondrop={() => remove()}
|
||||
>Delete it</DropZone
|
||||
>
|
||||
|
||||
<!-- Applyed -->
|
||||
<DropZone
|
||||
icon="server text-confirm"
|
||||
ondrop={async () => {
|
||||
await moveStatus(ApplicationStatus.Applyed);
|
||||
applicationStore.loadAplyed(true);
|
||||
}}
|
||||
>
|
||||
Apply
|
||||
</DropZone>
|
||||
<!-- Applyed -->
|
||||
<DropZone
|
||||
icon="server text-confirm"
|
||||
ondrop={async () => {
|
||||
await moveStatus(ApplicationStatus.Applyed);
|
||||
applicationStore.loadAplyed(true);
|
||||
applicationStore.loadTasksToDo(true);
|
||||
}}
|
||||
>
|
||||
Apply
|
||||
</DropZone>
|
||||
{/if}
|
||||
|
||||
{#if activeItem.status === ApplicationStatus.Applyed}
|
||||
<!-- Tasks to do -->
|
||||
<DropZone
|
||||
icon="server text-confirm"
|
||||
ondrop={async () => {
|
||||
await moveStatus(ApplicationStatus.TasksToDo);
|
||||
applicationStore.loadTasksToDo(true);
|
||||
applicationStore.loadAplyed(true);
|
||||
}}
|
||||
>
|
||||
Tasks To Do
|
||||
</DropZone>
|
||||
{/if}
|
||||
|
||||
<!-- Rejected -->
|
||||
<DropZone
|
||||
|
||||
Reference in New Issue
Block a user