feat: update SMS settings review functionality

- Changed the tab name from 'post-visit-review' to 'post-visit-approved' in SmsPage.
- Introduced a new query for fetching approved post-visit texts.
- Updated the UI to display approved post-visit texts and their details.
- Enhanced the API endpoint to filter SMS settings based on status (pending/approved).
- Added entity name resolution for doctors and clinics in the SMS settings.
- Updated the SmsWalletPage to include new post-visit text variables for SMS templates.
- Improved type definitions in index.ts for better clarity and consistency.
This commit is contained in:
hamed
2026-06-22 10:30:46 +03:30
parent 8ed119e12a
commit 3c103bc51e
8 changed files with 1831 additions and 1011 deletions
+342 -324
View File
@@ -1,438 +1,456 @@
export interface User {
uuid: string;
id: number;
mobile_number: string;
name?: string | null;
first_name?: string | null;
last_name?: string | null;
email: string | null;
roles: string[];
is_active: boolean;
created_at: string;
updated_at?: string;
uuid: string;
id: number;
mobile_number: string;
name?: string | null;
first_name?: string | null;
last_name?: string | null;
email: string | null;
roles: string[];
is_active: boolean;
created_at: string;
updated_at?: string;
}
export interface UserProfile {
uuid: string;
blood_group: string | null;
weight: number | null;
height: number | null;
diseases: string | null;
medications: string | null;
allergies: string | null;
insurance_type: string | null;
uuid: string;
blood_group: string | null;
weight: number | null;
height: number | null;
diseases: string | null;
medications: string | null;
allergies: string | null;
insurance_type: string | null;
}
export interface Doctor {
uuid: string;
first_name: string;
last_name: string;
medical_code: string;
gender: 'male' | 'female';
degree: string;
bio: string | null;
profile_image: string | null;
is_active: boolean;
specialties: Specialty[];
created_at: string;
uuid: string;
first_name: string;
last_name: string;
medical_code: string;
gender: "male" | "female";
degree: string;
bio: string | null;
profile_image: string | null;
is_active: boolean;
specialties: Specialty[];
created_at: string;
}
export interface Clinic {
uuid: string;
name: string;
phone: string | null;
logo: string | null;
is_active: boolean;
doctors_count: number;
created_at: number;
owner_mobile: string | null;
uuid: string;
name: string;
phone: string | null;
logo: string | null;
is_active: boolean;
doctors_count: number;
created_at: number;
owner_mobile: string | null;
}
export interface ClinicDetail {
id: string;
uuid: string;
name: string | null;
title: string | null;
is_active: boolean;
phone: string | null;
phone_number: string | null;
logo: string | null;
clinic_logo: string | null;
caption: string | null;
images_clinic: { url: string; fid?: number }[];
social_media: {
instagram: string | null;
telegram: string | null;
aparat: string | null;
youtube: string | null;
linkedin: string | null;
} | null;
specialties: { id: string; uuid: string; name: string }[];
services: { id: string; uuid: string; name: string }[];
list_bime: { id: string; uuid: string; name: string }[];
doctors: number;
city: { id: string; name: string }[];
state: { id: string; name: string }[];
location: string | null;
map: { latitude: string | null; longitude: string | null };
'24_7': boolean;
field_working_days: string | null;
id: string;
uuid: string;
name: string | null;
title: string | null;
is_active: boolean;
phone: string | null;
phone_number: string | null;
logo: string | null;
clinic_logo: string | null;
caption: string | null;
images_clinic: { url: string; fid?: number }[];
social_media: {
instagram: string | null;
telegram: string | null;
aparat: string | null;
youtube: string | null;
linkedin: string | null;
} | null;
specialties: { id: string; uuid: string; name: string }[];
services: { id: string; uuid: string; name: string }[];
list_bime: { id: string; uuid: string; name: string }[];
doctors: number;
city: { id: string; name: string }[];
state: { id: string; name: string }[];
location: string | null;
map: { latitude: string | null; longitude: string | null };
"24_7": boolean;
field_working_days: string | null;
}
export type AppointmentStatus =
| 'pending'
| 'confirmed'
| 'completed'
| 'cancelled_by_doctor'
| 'cancelled_by_user'
| 'no_show'
| 'expired';
| "pending"
| "confirmed"
| "completed"
| "cancelled_by_doctor"
| "cancelled_by_user"
| "no_show"
| "expired";
export interface Appointment {
uuid: string;
patient_name: string;
patient_mobile: string;
doctor_uuid: string;
doctor_name: string;
slot_start: number;
slot_end: number;
appointment_date: string;
appointment_time: string;
end_time: string;
status: AppointmentStatus;
version: number;
created_at: string;
uuid: string;
patient_name: string;
patient_mobile: string;
doctor_uuid: string;
doctor_name: string;
slot_start: number;
slot_end: number;
appointment_date: string;
appointment_time: string;
end_time: string;
status: AppointmentStatus;
version: number;
created_at: string;
}
export type PaymentStatus = 'pending' | 'success' | 'failed' | 'canceled' | 'refunded';
export type PaymentGateway = 'mellat' | 'sep';
export type PaymentStatus =
| "pending"
| "success"
| "failed"
| "canceled"
| "refunded";
export type PaymentGateway = "mellat" | "sep";
export interface Payment {
uuid: string;
amount: number;
status: PaymentStatus;
gateway: PaymentGateway;
ref_id: string | null;
patient_mobile: string;
appointment_uuid: string | null;
paid_at: string | null;
created_at: string;
uuid: string;
amount: number;
status: PaymentStatus;
gateway: PaymentGateway;
ref_id: string | null;
patient_mobile: string;
appointment_uuid: string | null;
paid_at: string | null;
created_at: string;
}
export type SettlementStatus = 'pending' | 'approved' | 'rejected';
export type SettlementStatus = "pending" | "approved" | "rejected";
export interface Settlement {
uuid: string;
representation_name: string;
amount: number;
status: SettlementStatus;
bank_card: string | null;
bank_name: string | null;
reject_reason: string | null;
requested_at: string;
processed_at: string | null;
uuid: string;
representation_name: string;
amount: number;
status: SettlementStatus;
bank_card: string | null;
bank_name: string | null;
reject_reason: string | null;
requested_at: string;
processed_at: string | null;
}
export interface Representation {
id: number;
uuid: string;
full_name: string;
domain?: string;
mobile_number: string | null;
city_id: number | null;
city: string | null;
commission_percent: number;
bank_account: { card?: string; bank_name?: string; iban?: string } | null;
wallet_balance?: number;
active?: boolean;
is_active?: boolean;
created_at: string;
id: number;
uuid: string;
full_name: string;
domain?: string;
mobile_number: string | null;
city_id: number | null;
city: string | null;
commission_percent: number;
bank_account: { card?: string; bank_name?: string; iban?: string } | null;
wallet_balance?: number;
active?: boolean;
is_active?: boolean;
created_at: string;
}
export interface Comment {
uuid: string;
patient_name: string;
doctor_name: string;
title: string;
body: string;
is_approved: boolean;
created_at: string;
uuid: string;
patient_name: string;
doctor_name: string;
title: string;
body: string;
is_approved: boolean;
created_at: string;
}
export interface Rating {
uuid: string;
patient_name: string;
doctor_name: string;
diagnosis_accuracy: number;
skill: number;
behavior: number;
cleanliness: number;
waiting_time: number;
overall: number;
created_at: string;
uuid: string;
patient_name: string;
doctor_name: string;
diagnosis_accuracy: number;
skill: number;
behavior: number;
cleanliness: number;
waiting_time: number;
overall: number;
created_at: string;
}
export type SmsTemplateStatus = 'draft' | 'pending' | 'approved' | 'rejected';
export type SmsTemplateStatus = "draft" | "pending" | "approved" | "rejected";
export interface SmsTemplate {
uuid: string;
name: string;
body: string;
provider_code: string | null;
status: SmsTemplateStatus;
admin_note: string | null;
created_at: string;
uuid: string;
name: string;
body: string;
provider_code: string | null;
status: SmsTemplateStatus;
admin_note: string | null;
created_at: string;
}
export interface SmsLog {
uuid: string;
recipient: string;
message: string;
status: 'queued' | 'sent' | 'failed';
provider: string;
tag: string;
sent_at: string | null;
created_at: string;
uuid: string;
recipient: string;
message: string;
status: "queued" | "sent" | "failed";
provider: string;
tag: string;
sent_at: string | null;
created_at: string;
}
export interface SmsMessageText {
tag: string;
title: string;
body: string;
variables: string[];
updated_at: number | null;
tag: string;
title: string;
body: string;
variables: string[];
updated_at: number | null;
}
export interface Province {
id: number;
uuid: string;
name: string;
status: number;
weight: number;
id: number;
uuid: string;
name: string;
status: number;
weight: number;
}
export interface City {
id: number;
uuid: string;
name: string;
status: number;
weight: number;
province_id: number | null;
representation_id?: number | null;
contact_phone?: string | null;
email?: string | null;
description?: string | null;
slogan?: string | null;
domain?: string | null;
keywords?: string | null;
footer_description?: string | null;
social_media?: Record<string, string> | null;
logo_url?: string | null;
id: number;
uuid: string;
name: string;
status: number;
weight: number;
province_id: number | null;
representation_id?: number | null;
contact_phone?: string | null;
email?: string | null;
description?: string | null;
slogan?: string | null;
domain?: string | null;
keywords?: string | null;
footer_description?: string | null;
social_media?: Record<string, string> | null;
logo_url?: string | null;
}
export interface SpecialtyFull {
id: number;
uuid: string;
name: string;
slug: string;
status: number;
weight: number;
parent_id: number | null;
id: number;
uuid: string;
name: string;
slug: string;
status: number;
weight: number;
parent_id: number | null;
}
export interface DoctorService {
id: number;
uuid: string;
name: string;
slug: string;
status: number;
weight: number;
specialty_id: number | null;
id: number;
uuid: string;
name: string;
slug: string;
status: number;
weight: number;
specialty_id: number | null;
}
export interface Insurance {
id: number;
uuid: string;
name: string;
type: 'basic' | 'supplementary';
logo_url: string | null;
status: number;
id: number;
uuid: string;
name: string;
type: "basic" | "supplementary";
logo_url: string | null;
status: number;
}
export interface Tag {
id: number;
uuid: string;
name: string;
slug: string;
status: number;
id: number;
uuid: string;
name: string;
slug: string;
status: number;
}
export interface Blog {
uuid: string;
title: string;
slug: string;
summary: string | null;
body: string;
image_url: string | null;
status: 'draft' | 'published';
author?: { uuid: string; name: string } | null;
tags: string[];
created_at: string;
updated_at?: string;
uuid: string;
title: string;
slug: string;
summary: string | null;
body: string;
image_url: string | null;
status: "draft" | "published";
author?: { uuid: string; name: string } | null;
tags: string[];
created_at: string;
updated_at?: string;
}
export interface Secretary {
uuid: string;
user_name: string;
mobile_number: string;
doctor_name: string;
doctor_uuid: string;
is_active: boolean;
permissions: SecretaryPermissions;
created_at: string;
uuid: string;
user_name: string;
mobile_number: string;
doctor_name: string;
doctor_uuid: string;
is_active: boolean;
permissions: SecretaryPermissions;
created_at: string;
}
export interface SecretaryPermissions {
appointments: {
view: boolean;
create: boolean;
cancel: boolean;
update_status: boolean;
};
addresses: {
view: boolean;
create: boolean;
update: boolean;
delete: boolean;
};
clinic_info: {
view: boolean;
update: boolean;
};
insurances: {
view: boolean;
create: boolean;
update: boolean;
delete: boolean;
};
appointments: {
view: boolean;
create: boolean;
cancel: boolean;
update_status: boolean;
};
addresses: {
view: boolean;
create: boolean;
update: boolean;
delete: boolean;
};
clinic_info: {
view: boolean;
update: boolean;
};
insurances: {
view: boolean;
create: boolean;
update: boolean;
delete: boolean;
};
}
export interface Specialty {
id?: number;
uuid: string;
name: string;
slug?: string;
id?: number;
uuid: string;
name: string;
slug?: string;
}
export interface ClinicStaff {
uuid: string;
full_name: string;
phone: string | null;
job_title: string | null;
address: string | null;
national_code: string | null;
active: boolean;
created_at: number;
uuid: string;
full_name: string;
phone: string | null;
job_title: string | null;
address: string | null;
national_code: string | null;
active: boolean;
created_at: number;
}
export interface SubscriptionPlan {
uuid: string;
name: string;
level: number;
max_secretaries: number;
features: Record<string, boolean>;
periods: SubscriptionPeriod[];
uuid: string;
name: string;
level: number;
max_secretaries: number;
features: Record<string, boolean>;
periods: SubscriptionPeriod[];
}
export interface SubscriptionPeriod {
uuid: string;
label: string;
duration_months: number;
price_rials: number;
is_trial: boolean;
uuid: string;
label: string;
duration_months: number;
price_rials: number;
is_trial: boolean;
}
export interface MySubscriptionData {
subscription: {
plan: { name: string; level: number; max_secretaries: number; features: Record<string, boolean> };
subscription: {
plan: {
name: string;
level: number;
max_secretaries: number;
features: Record<string, boolean>;
};
period?: { label: string; duration_months: number };
is_trial: boolean;
starts_at?: number;
expires_at?: number | null;
days_remaining?: number;
} | null;
used_trial: boolean;
}
/** @deprecated use MySubscriptionData */
export interface MySubscription {
plan: { name: string; level: number; features: Record<string, boolean> };
period?: { label: string; duration_months: number };
is_trial: boolean;
starts_at?: number;
expires_at?: number | null;
used_trial: boolean;
days_remaining?: number;
} | null;
used_trial: boolean;
}
/** @deprecated use MySubscriptionData */
export interface MySubscription {
plan: { name: string; level: number; features: Record<string, boolean> };
period?: { label: string; duration_months: number };
is_trial: boolean;
starts_at?: number;
expires_at?: number | null;
used_trial: boolean;
days_remaining?: number;
}
export interface ServiceSection {
uuid: string;
name: string;
active: boolean;
uuid: string;
name: string;
active: boolean;
}
export interface ServiceItem {
uuid: string;
name: string;
price_rials: number;
staff: { uuid: string; full_name: string } | null;
active: boolean;
uuid: string;
name: string;
price_rials: number;
staff: { uuid: string; full_name: string } | null;
active: boolean;
}
export interface SmsWalletBalance {
balance_rials: number;
sms_price_rials: number;
estimated_sms_count: number;
balance_rials: number;
sms_price_rials: number;
estimated_sms_count: number;
}
export interface SmsWalletLog {
uuid: string;
type: 'credit' | 'debit';
amount_rials: number;
description: string;
created_at: number;
uuid: string;
type: "credit" | "debit";
amount_rials: number;
description: string;
created_at: number;
}
export interface SmsSettings {
reminder_enabled: boolean;
reminder_hours_before: number;
post_visit_enabled: boolean;
post_visit_text: string | null;
post_visit_text_pending?: string | null;
post_visit_text_status?: 'none' | 'pending' | 'approved' | 'rejected';
post_visit_text_reject_reason?: string | null;
reminder_enabled: boolean;
reminder_hours_before: number;
post_visit_enabled: boolean;
post_visit_text: string | null;
post_visit_text_pending?: string | null;
post_visit_text_status?: "none" | "pending" | "approved" | "rejected";
post_visit_text_reject_reason?: string | null;
}
export interface PatientRecord {
uuid: string;
entity_type: string;
entity_id: number;
user: { uuid: string; fullName: string; phone: string };
created_at: number;
uuid: string;
entity_type: string;
entity_id: number;
user?: {
uuid?: string;
fullName?: string;
name?: string;
phone?: string;
} | null;
user_uuid?: string;
user_name?: string | null;
user_mobile?: string | null;
created_at: number;
}
export interface PatientSession {
uuid: string;
record_uuid: string;
appointment_uuid: string | null;
insurance_base_id: number | null;
insurance_supplementary_id: number | null;
visit_price_rials: number;
base_insurance_discount_percent: string;
supplementary_discount_percent: string;
services_total_rials: number;
final_price_rials: number;
payment_method: string;
notes: string | null;
created_at: number;
updated_at: number;
uuid: string;
record_uuid: string;
appointment_uuid: string | null;
insurance_base_id: number | null;
insurance_supplementary_id: number | null;
visit_price_rials: number;
base_insurance_discount_percent: string;
supplementary_discount_percent: string;
services_total_rials: number;
final_price_rials: number;
payment_method: string;
notes: string | null;
created_at: number;
updated_at: number;
}