diff --git a/bun.lockb b/bun.lockb
index e7f248c..a8bbfdd 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/package.json b/package.json
index d4f94f3..3f8f3ed 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,7 @@
"@types/cookie": "^0.6.0",
"@types/qs": "^6.9.15",
"axios": "^1.7.4",
+ "chrono-node": "^1.4.9",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"cmdk": "1.0.0",
diff --git a/src/components/people/PeopleList.tsx b/src/components/people/PeopleList.tsx
index c0ce3e6..392fb0d 100644
--- a/src/components/people/PeopleList.tsx
+++ b/src/components/people/PeopleList.tsx
@@ -54,7 +54,7 @@ export default function PeopleList() {
if (errorMessage) return
{errorMessage}
;
return (
-
+
{people.map((person) => (
))}
diff --git a/src/components/people/PersonBirthdayCell.tsx b/src/components/people/PersonBirthdayCell.tsx
index 2004952..4909bee 100644
--- a/src/components/people/PersonBirthdayCell.tsx
+++ b/src/components/people/PersonBirthdayCell.tsx
@@ -3,6 +3,12 @@ import React, { useState } from 'react'
import { DatePicker } from '../ui/datepicker'
import { updatePerson } from '@/handlers/api/people.handler';
import { formatDate } from '@/helpers/date.helper';
+import { Input } from '../ui/input';
+import { useToast } from '../ui/use-toast';
+// @ts-ignore
+import chrono from 'chrono-node'
+
+
interface IProps {
person: IPerson
@@ -11,19 +17,22 @@ interface IProps {
export default function PersonBirthdayCell(
{ person }: IProps
) {
- const [formData, setFormData] = useState(person);
const [loading, setLoading] = useState(false);
+ const { toast } = useToast();
const [errorMessage, setErrorMessage] = useState(null);
+ const [textDate, setTextDate] = useState(person.birthDate ? formatDate(person.birthDate?.toString(), 'PPP'): "");
const handleEdit = (date?: Date | null) => {
- if (!date) return;
- const formatedDate = formatDate(date.toString(), 'yyyy-MM-dd');
+ const formatedDate = date ? formatDate(date.toString(), 'yyyy-MM-dd') : null;
setLoading(true);
return updatePerson(person.id, {
birthDate: formatedDate,
})
.then(() => {
-
+ toast({
+ title: "Success",
+ description: "Person updated successfully",
+ })
})
.catch(() => {})
.finally(() => {
@@ -33,5 +42,27 @@ export default function PersonBirthdayCell(
- return
+ return (
+
+ {
+ if (e.key === 'Enter') {
+ const parsedDate = chrono.parseDate(textDate || "");
+ if (parsedDate) {
+ handleEdit(parsedDate);
+ setTextDate(formatDate(parsedDate.toString(), 'PPP'));
+ } else {
+ handleEdit(null);
+ }
+ }
+ }}
+ disabled={loading}
+ onChange={(e) => setTextDate(e.target.value)}
+ />
+
+
+ )
}
diff --git a/src/components/people/PersonItem.tsx b/src/components/people/PersonItem.tsx
index fc04f64..95e3faa 100644
--- a/src/components/people/PersonItem.tsx
+++ b/src/components/people/PersonItem.tsx
@@ -86,7 +86,7 @@ export default function PersonItem({ person, onRemove }: IProps) {
}}
>
diff --git a/src/components/ui/datepicker.tsx b/src/components/ui/datepicker.tsx
index 3053e3e..090993f 100644
--- a/src/components/ui/datepicker.tsx
+++ b/src/components/ui/datepicker.tsx
@@ -16,9 +16,10 @@ import {
interface IProps {
date?: Date | null
onSelect?: (date?: Date | null) => any
+ iconOnly?: boolean
}
export function DatePicker(
- { date: _date, onSelect }: IProps
+ { date: _date, onSelect, iconOnly }: IProps
) {
const [date, setDate] = React.useState(_date || null)
@@ -32,12 +33,12 @@ export function DatePicker(
diff --git a/src/handlers/api/people.handler.ts b/src/handlers/api/people.handler.ts
index 4fd5ecc..a295e58 100644
--- a/src/handlers/api/people.handler.ts
+++ b/src/handlers/api/people.handler.ts
@@ -26,7 +26,7 @@ export const listPeople = (filters: IPersonListFilters): Promise) => {
return API.put(UPDATE_PERSON_PATH(id), data)
diff --git a/src/pages/assets/missing-locations.tsx b/src/pages/assets/missing-locations.tsx
index ea5def3..c299609 100644
--- a/src/pages/assets/missing-locations.tsx
+++ b/src/pages/assets/missing-locations.tsx
@@ -49,7 +49,6 @@ export default function MissingLocations() {
leftComponent="Missing Location"
rightComponent={
<>
-
{config.selectedIds.length} Selected