| [700e2f9] | 1 | import { type Component, For } from "solid-js";
|
|---|
| 2 | import ConsultationRow from "@/components/ConsultationRow";
|
|---|
| 3 | import type { Consultation } from "@/api/consultation";
|
|---|
| 4 |
|
|---|
| 5 | interface ConsultationTableProps {
|
|---|
| 6 | consultations: Consultation[];
|
|---|
| 7 | onEdit: (consultation: Consultation) => void;
|
|---|
| 8 | onDelete: (id: number) => void;
|
|---|
| 9 | onTogglePayment: (consultation: Consultation) => void;
|
|---|
| 10 | readOnly?: boolean;
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | const ConsultationTable: Component<ConsultationTableProps> = (props) => (
|
|---|
| 14 | <div class="bg-white rounded-lg shadow overflow-hidden">
|
|---|
| 15 | <table class="min-w-full divide-y divide-gray-200">
|
|---|
| 16 | <thead class="bg-gray-50">
|
|---|
| 17 | <tr>
|
|---|
| 18 | <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|---|
| 19 | Date
|
|---|
| 20 | </th>
|
|---|
| 21 | <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|---|
| 22 | {props.readOnly ? "Therapist" : "Patient"}
|
|---|
| 23 | </th>
|
|---|
| 24 | <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|---|
| 25 | Price
|
|---|
| 26 | </th>
|
|---|
| 27 | <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|---|
| 28 | Payment Status
|
|---|
| 29 | </th>
|
|---|
| 30 | <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|---|
| 31 | {props.readOnly ? "Details" : "Actions"}
|
|---|
| 32 | </th>
|
|---|
| 33 | </tr>
|
|---|
| 34 | </thead>
|
|---|
| 35 | <tbody class="bg-white divide-y divide-gray-200">
|
|---|
| 36 | <For each={props.consultations}>
|
|---|
| 37 | {(consultation) => (
|
|---|
| 38 | <ConsultationRow
|
|---|
| 39 | consultation={consultation}
|
|---|
| 40 | onEdit={props.onEdit}
|
|---|
| 41 | onDelete={props.onDelete}
|
|---|
| 42 | onTogglePayment={props.onTogglePayment}
|
|---|
| 43 | readOnly={props.readOnly}
|
|---|
| 44 | />
|
|---|
| 45 | )}
|
|---|
| 46 | </For>
|
|---|
| 47 | </tbody>
|
|---|
| 48 | </table>
|
|---|
| 49 | </div>
|
|---|
| 50 | );
|
|---|
| 51 |
|
|---|
| 52 | export default ConsultationTable;
|
|---|