refactor: remove unused components and files related to date filtering and doctor search

- Deleted Date.js and FilterDate.js components as they are no longer needed.
- Removed SearchDoctor.js component which was responsible for searching doctors.
- Cleaned up the Head component by removing references to the deleted Date and SearchDoctor components.
- Removed TurnsPage component and its associated List component, which were not utilized.
- Deleted Cards and Table components from the list directory as they were not in use.
- Removed user account related components including Tab, Head, and Form components.
- Cleaned up bank account components including List, Item, and modal components.
- Removed representation adapters and related functions that were not in use.
This commit is contained in:
hamed
2026-06-25 18:14:27 +03:30
parent 537f3e47d5
commit f87110c277
70 changed files with 8 additions and 2911 deletions
-6
View File
@@ -1,5 +1,4 @@
import { AbilityBuilder, createMongoAbility } from "@casl/ability";
import { safeJsonParse } from "./sanitize";
export function defineAbilitiesFor(user) {
const { can, cannot, build } = new AbilityBuilder(createMongoAbility);
@@ -7,11 +6,6 @@ export function defineAbilitiesFor(user) {
if (user) {
can("access", "Dashboard");
cannot("access", "Login");
const parsedData = safeJsonParse(user.value);
const roles = parsedData?.roles;
if (roles && Array.isArray(Object.values(roles)) && Object.values(roles).includes("representation")) {
can("access", "Panel");
}
} else {
can("access", "Login");
cannot("access", "Dashboard");
-67
View File
@@ -1,56 +1,3 @@
import moment from "moment-jalaali";
const DEFAULT_AVATAR = "/assets/images/doctor.png";
function toJalali(date) {
if (!date) return "--";
return moment(date).format("jYYYY/jM/jD");
}
export function adaptRepresentationInfo(representationInfo) {
const data = representationInfo?.data ?? representationInfo ?? {};
return {
name: data.full_name ?? "",
src: data.avatar ?? DEFAULT_AVATAR,
detail: data.city_name ? `نماینده شهر ${data.city_name}` : "نماینده",
mobile_number: data.mobile_number ?? "",
commission_percent: data.commission_percent ?? null,
bank_account: data.bank_account ?? null,
city: { label: data.city_name ?? "" },
all_patients: null,
total_turns: null,
number_of_patients: null,
today_turns: null,
payments: null,
todays_activities: [],
list_of_doctors_appointments: [],
chart_amount_income: [],
};
}
export function adaptRepresentationDashboard(dashboard) {
const stats = dashboard?.data?.stats ?? dashboard?.stats ?? {};
const daily = Array.isArray(stats.daily) ? stats.daily : [];
return {
number_of_patients: stats.total_appointments ?? 0,
today_turns: daily.length ? daily[daily.length - 1].appointments ?? 0 : 0,
payments: stats.total_revenue_rials ?? 0,
commission_rials: stats.commission_rials ?? 0,
chart_amount_income: daily.map((d) => d.revenue ?? 0),
list_of_doctors_appointments: daily.map((d) => ({
name: "",
expertise: "",
image: DEFAULT_AVATAR,
date: toJalali(d.date),
hour: "",
number_of_turns: d.appointments ?? 0,
})),
todays_activities: [],
};
}
export function buildPatientUser(profile, extras = {}) {
// GET /user-profile is double-nested: { data: { data: {...} } } (after fetchReq → response.data)
const data = profile?.data?.data ?? profile?.data ?? profile ?? {};
@@ -81,17 +28,3 @@ export function buildPatientUser(profile, extras = {}) {
messages: [],
};
}
export function adaptBankAccount(bankAccount) {
if (!bankAccount) return [];
return [
{
id: 1,
card_number: bankAccount.account_number ?? "",
shaba_number: bankAccount.iban ?? "",
bank: bankAccount.bank_name ?? "",
owner_name: bankAccount.owner_name ?? "",
status: true,
},
];
}