improvement: all demo bugs fixed. give me more baby.
This commit is contained in:
@@ -51,13 +51,11 @@ export default function TasksPage() {
|
||||
const [page, setPage] = useState(1);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [updatingTaskId, setUpdatingTaskId] = useState<string | null>(null);
|
||||
const [expandedCommentsCaseId, setExpandedCommentsCaseId] = useState<string | null>(null);
|
||||
const [expandedCommentsTaskId, setExpandedCommentsTaskId] = useState<string | null>(null);
|
||||
|
||||
const [search, setSearch] = useState('');
|
||||
const [clinicId, setClinicId] = useState('');
|
||||
const [statusFilter, setStatusFilter] = useState<'' | LabTaskStatus>('');
|
||||
const [showCompleted, setShowCompleted] = useState(false);
|
||||
const [importantOnly, setImportantOnly] = useState(false);
|
||||
const [statusFilter, setStatusFilter] = useState<'' | LabTaskStatus>('IN_PROGRESS');
|
||||
const [sentFrom, setSentFrom] = useState('');
|
||||
const [sentTo, setSentTo] = useState('');
|
||||
const [sortBy, setSortBy] = useState<TaskSortField>('date');
|
||||
@@ -87,18 +85,11 @@ export default function TasksPage() {
|
||||
};
|
||||
if (search.trim()) params.q = search.trim();
|
||||
if (clinicId) params.clinicOrganizationId = clinicId;
|
||||
if (statusFilter) {
|
||||
params.status = statusFilter;
|
||||
} else if (showCompleted) {
|
||||
params.completed = undefined;
|
||||
} else {
|
||||
params.completed = false;
|
||||
}
|
||||
if (importantOnly) params.important = true;
|
||||
if (statusFilter) params.status = statusFilter;
|
||||
if (sentFrom) params.sentFrom = sentFrom;
|
||||
if (sentTo) params.sentTo = sentTo;
|
||||
return params;
|
||||
}, [page, search, clinicId, statusFilter, showCompleted, importantOnly, sentFrom, sentTo, sortBy, sortDir]);
|
||||
}, [page, search, clinicId, statusFilter, sentFrom, sentTo, sortBy, sortDir]);
|
||||
|
||||
const clinicOptions = useMemo(() => {
|
||||
const map = new Map<string, string>();
|
||||
@@ -228,10 +219,10 @@ export default function TasksPage() {
|
||||
className={`${filterSelectClass} min-w-0 flex-1`}
|
||||
>
|
||||
<option value="date">{t('sortDate')}</option>
|
||||
<option value="status">{t('sortStatus')}</option>
|
||||
<option value="clinic">{t('sortClinic')}</option>
|
||||
<option value="patient">{t('sortPatient')}</option>
|
||||
<option value="important">{t('sortImportant')}</option>
|
||||
<option value="prosthesis">{t('sortProsthesis')}</option>
|
||||
<option value="taskType">{t('sortTaskType')}</option>
|
||||
</select>
|
||||
<select
|
||||
value={sortDir}
|
||||
@@ -245,30 +236,6 @@ export default function TasksPage() {
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-4 text-sm">
|
||||
<label className="flex items-center gap-2 cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={showCompleted}
|
||||
onChange={(e) => {
|
||||
setShowCompleted(e.target.checked);
|
||||
setPage(1);
|
||||
}}
|
||||
/>
|
||||
{t('showCompleted')}
|
||||
</label>
|
||||
<label className="flex items-center gap-2 cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={importantOnly}
|
||||
onChange={(e) => {
|
||||
setImportantOnly(e.target.checked);
|
||||
setPage(1);
|
||||
}}
|
||||
/>
|
||||
{t('importantOnly')}
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="surface-card min-h-[280px]">
|
||||
@@ -279,7 +246,7 @@ export default function TasksPage() {
|
||||
) : (
|
||||
<ul className="divide-y divide-border">
|
||||
{tasks.map((task, index) => {
|
||||
const commentsOpen = expandedCommentsCaseId === task.labCaseId;
|
||||
const commentsOpen = expandedCommentsTaskId === task.id;
|
||||
|
||||
return (
|
||||
<li key={task.id}>
|
||||
@@ -343,7 +310,7 @@ export default function TasksPage() {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
setExpandedCommentsCaseId(commentsOpen ? null : task.labCaseId)
|
||||
setExpandedCommentsTaskId(commentsOpen ? null : task.id)
|
||||
}
|
||||
className={`p-1.5 rounded border ${
|
||||
commentsOpen
|
||||
|
||||
Reference in New Issue
Block a user