chore: added stauts_history
This commit is contained in:
parent
5ff8fc1d83
commit
9f9b335557
@ -33,6 +33,7 @@ data class Application(
|
||||
var recruiter: String,
|
||||
var message: String,
|
||||
var linked_application: String,
|
||||
var status_history: String,
|
||||
var flairs: List<Flair>,
|
||||
var views: List<View>,
|
||||
) {
|
||||
@ -52,6 +53,7 @@ data class Application(
|
||||
rs.getString("recruiter"),
|
||||
rs.getString("message"),
|
||||
rs.getString("linked_application"),
|
||||
rs.getString("status_history"),
|
||||
emptyList(),
|
||||
emptyList(),
|
||||
)
|
||||
@ -182,6 +184,7 @@ class ApplicationsController(
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
emptyList(),
|
||||
emptyList(),
|
||||
)
|
||||
@ -259,6 +262,13 @@ class ApplicationsController(
|
||||
}
|
||||
|
||||
application.status = info.status
|
||||
val status_string = "${info.status}";
|
||||
var status_history = application.status_history.split(",").filter { it.length >= 1 }
|
||||
if (status_history.indexOf(status_string) == -1) {
|
||||
status_history = status_history.plus("${info.status}");
|
||||
}
|
||||
|
||||
application.status_history = status_history.joinToString(",") { it }
|
||||
|
||||
applicationService.update(application)
|
||||
|
||||
@ -466,7 +476,7 @@ class ApplicationService(
|
||||
}
|
||||
|
||||
db.update(
|
||||
"insert into applications (id, url, original_url, unique_url, title, user_id, extra_data, payrange, status, company, recruiter, message, linked_application) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);",
|
||||
"insert into applications (id, url, original_url, unique_url, title, user_id, extra_data, payrange, status, company, recruiter, message, linked_application, status_history) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);",
|
||||
application.id,
|
||||
application.url,
|
||||
application.original_url,
|
||||
@ -480,6 +490,7 @@ class ApplicationService(
|
||||
application.recruiter,
|
||||
application.message,
|
||||
application.linked_application,
|
||||
application.status_history,
|
||||
)
|
||||
|
||||
return true
|
||||
@ -516,7 +527,7 @@ class ApplicationService(
|
||||
|
||||
public fun update(application: Application): Application {
|
||||
db.update(
|
||||
"update applications set url=?, original_url=?, unique_url=?, title=?, user_id=?, extra_data=?, payrange=?, status=?, company=?, recruiter=?, message=?, linked_application=? where id=?",
|
||||
"update applications set url=?, original_url=?, unique_url=?, title=?, user_id=?, extra_data=?, payrange=?, status=?, company=?, recruiter=?, message=?, linked_application=?, status_history=? where id=?",
|
||||
application.url,
|
||||
application.original_url,
|
||||
application.unique_url,
|
||||
@ -529,6 +540,7 @@ class ApplicationService(
|
||||
application.recruiter,
|
||||
application.message,
|
||||
application.linked_application,
|
||||
application.status_history,
|
||||
application.id,
|
||||
)
|
||||
return application
|
||||
|
@ -20,6 +20,7 @@ create table if not exists applications (
|
||||
recruiter text,
|
||||
title text,
|
||||
mesasge text default '',
|
||||
status_history text default '',
|
||||
user_id text,
|
||||
extra_data text,
|
||||
status integer,
|
||||
|
@ -80,6 +80,7 @@ async function startup() {
|
||||
});
|
||||
|
||||
browser.menus.onClicked.addListener(async function (e, tab) {
|
||||
console.log("here")
|
||||
if (e.menuItemId === "mark-page") {
|
||||
console.log("set mark-page", tab.id)
|
||||
await browser.storage.local.set({
|
||||
@ -90,4 +91,4 @@ async function startup() {
|
||||
}
|
||||
|
||||
browser.runtime.onInstalled.addListener(startup);
|
||||
browser.runtime.onStartup.addListener(startup);
|
||||
browser.runtime.onConnect.addListener(startup);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user