mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -1,14 +1,6 @@
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
|
||||
function formatDate(iso) {
|
||||
if (!iso) return "—";
|
||||
return new Date(iso).toLocaleDateString("en-PH", {
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
});
|
||||
}
|
||||
import { useDateFormat } from "@/hooks/useDateFormat";
|
||||
|
||||
function InfoRow({ label, value }) {
|
||||
return (
|
||||
@@ -20,6 +12,7 @@ function InfoRow({ label, value }) {
|
||||
}
|
||||
|
||||
export default function MemberDetailTabs({ member }) {
|
||||
const { fmtDate } = useDateFormat();
|
||||
const info = member.personal_info ?? {};
|
||||
const name = info.name ?? {};
|
||||
const phones = info.phone_number ?? [];
|
||||
@@ -39,7 +32,7 @@ export default function MemberDetailTabs({ member }) {
|
||||
<InfoRow label="Last name" value={name.last_name} />
|
||||
<InfoRow label="Middle name" value={name.middle_name} />
|
||||
<InfoRow label="Extension" value={name.extension_name} />
|
||||
<InfoRow label="Date of birth" value={formatDate(info.date_of_birth)} />
|
||||
<InfoRow label="Date of birth" value={fmtDate(info.date_of_birth)} />
|
||||
<InfoRow label="Occupation" value={info.occupation} />
|
||||
<InfoRow
|
||||
label="Phone"
|
||||
@@ -74,7 +67,7 @@ export default function MemberDetailTabs({ member }) {
|
||||
{member.is_active ? "Active" : "Inactive"}
|
||||
</span>
|
||||
</div>
|
||||
<InfoRow label="Joined group" value={formatDate(member.UserGroupMember?.joined_at)} />
|
||||
<InfoRow label="Joined group" value={fmtDate(member.UserGroupMember?.joined_at)} />
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
|
||||
@@ -18,14 +18,7 @@ const STATUS_LABEL = {
|
||||
not_started: "Not started",
|
||||
};
|
||||
|
||||
function formatDate(iso) {
|
||||
if (!iso) return "—";
|
||||
return new Date(iso).toLocaleDateString("en-PH", {
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
});
|
||||
}
|
||||
import { useDateFormat } from "@/hooks/useDateFormat";
|
||||
|
||||
function StatusBadge({ status }) {
|
||||
const map = {
|
||||
@@ -45,6 +38,7 @@ export default function TaskListDetail({ taskList }) {
|
||||
const tasks = taskList.tasks ?? [];
|
||||
const [search, setSearch] = useState("");
|
||||
const [page, setPage] = useState(1);
|
||||
const { fmtDate } = useDateFormat();
|
||||
|
||||
// ── Derived stats ───────────────────────────────────────────────────────
|
||||
const counts = useMemo(() => {
|
||||
@@ -151,8 +145,8 @@ export default function TaskListDetail({ taskList }) {
|
||||
|
||||
{/* Meta */}
|
||||
<div className="text-xs text-muted-foreground space-y-1 pt-2 border-t">
|
||||
<p>Created: <span className="text-foreground">{formatDate(taskList.createdAt)}</span></p>
|
||||
<p>Assigned: <span className="text-foreground">{formatDate(taskList.TaskListGroup?.assignedAt)}</span></p>
|
||||
<p>Created: <span className="text-foreground">{fmtDate(taskList.createdAt)}</span></p>
|
||||
<p>Assigned: <span className="text-foreground">{fmtDate(taskList.TaskListGroup?.assignedAt)}</span></p>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
@@ -195,7 +189,7 @@ export default function TaskListDetail({ taskList }) {
|
||||
<StatusBadge status={task.status} />
|
||||
</TableCell>
|
||||
<TableCell className="text-sm text-muted-foreground">
|
||||
{formatDate(task.due_date)}
|
||||
{fmtDate(task.due_date)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))
|
||||
|
||||
@@ -19,17 +19,11 @@ import { PieBreakdown } from "@/components/generic/Dashboard/PieBreakdown";
|
||||
import { BarBreakdown } from "@/components/generic/Dashboard/BarBreakdown";
|
||||
import TaskListDetail from "./TaskListDetail";
|
||||
|
||||
function formatDate(iso) {
|
||||
if (!iso) return "—";
|
||||
return new Date(iso).toLocaleDateString("en-PH", {
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
});
|
||||
}
|
||||
import { useDateFormat } from "@/hooks/useDateFormat";
|
||||
|
||||
export default function TaskListsTab({ taskLists = [] }) {
|
||||
const [selected, setSelected] = useState(null);
|
||||
const { fmtDate } = useDateFormat();
|
||||
|
||||
// PieBreakdown: overall task completion status across all lists
|
||||
const completionPieData = useMemo(() => {
|
||||
@@ -127,7 +121,7 @@ export default function TaskListsTab({ taskLists = [] }) {
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="text-sm text-muted-foreground">
|
||||
{formatDate(tl.TaskListGroup?.assignedAt)}
|
||||
{fmtDate(tl.TaskListGroup?.assignedAt)}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button
|
||||
|
||||
@@ -7,15 +7,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { useStaffGroups } from "@/contexts/StaffGroupContext";
|
||||
import MembersTable from "../components/members/MembersTable";
|
||||
import TaskListsTab from "../components/TaskListsTab";
|
||||
|
||||
function formatDate(iso) {
|
||||
if (!iso) return "—";
|
||||
return new Date(iso).toLocaleDateString("en-PH", {
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
});
|
||||
}
|
||||
import { useDateFormat } from "@/hooks/useDateFormat";
|
||||
|
||||
function getInitials(name = "") {
|
||||
const parts = name.trim().split(/\s+/);
|
||||
@@ -27,6 +19,7 @@ function getInitials(name = "") {
|
||||
export default function GroupDetailPage() {
|
||||
const { groupId } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const { fmtDate } = useDateFormat();
|
||||
|
||||
const {
|
||||
fetchGroupById,
|
||||
@@ -128,8 +121,8 @@ export default function GroupDetailPage() {
|
||||
</div>
|
||||
|
||||
<div className="text-xs text-muted-foreground text-right space-y-0.5">
|
||||
<p>Created <span className="text-foreground">{formatDate(group.createdAt)}</span></p>
|
||||
<p>Updated <span className="text-foreground">{formatDate(group.updatedAt)}</span></p>
|
||||
<p>Created <span className="text-foreground">{fmtDate(group.createdAt)}</span></p>
|
||||
<p>Updated <span className="text-foreground">{fmtDate(group.updatedAt)}</span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user