round img of doctors && fix remove 'nobat724' value in city data for all pages && handle send req for filter clinics && filter list clinic for first time on load page && add component loading and handle it in page clinics
This commit is contained in:
+60
-8
@@ -104,14 +104,6 @@ export const alert = (type, text, prop) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const addLabelToList = (list) =>
|
||||
list.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
label: item.name,
|
||||
};
|
||||
});
|
||||
|
||||
export const formatPhoneNumber = (input) => {
|
||||
if (typeof input !== "string") input = String(input);
|
||||
|
||||
@@ -363,6 +355,36 @@ export const QueryForDoctorsReq = (newFilter) => {
|
||||
return params;
|
||||
};
|
||||
|
||||
export const QueryForClinicsFilter = (searchParams) => {
|
||||
const params = {};
|
||||
|
||||
// 🔹 specialty (find by name in specialties.json)
|
||||
if (searchParams.specialty) {
|
||||
const spec = specialties.find((s) => s.name === searchParams.specialty);
|
||||
if (spec) {
|
||||
params.specialty = spec.id;
|
||||
}
|
||||
}
|
||||
|
||||
// 🔹 city (find by name in city.json)
|
||||
if (searchParams.city) {
|
||||
const cityObj = cities.find((c) => c.name === searchParams.city.name);
|
||||
if (cityObj) {
|
||||
params.city = cityObj.id;
|
||||
}
|
||||
}
|
||||
|
||||
// 🔹 state (find by name in state.json)
|
||||
if (searchParams.province) {
|
||||
const stateObj = states.find((s) => s.name === searchParams.province.name);
|
||||
if (stateObj) {
|
||||
params.state = stateObj.id;
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
};
|
||||
|
||||
export const buildDoctorParams = (searchParams) => {
|
||||
const params = {};
|
||||
|
||||
@@ -436,6 +458,36 @@ export const buildDoctorParams = (searchParams) => {
|
||||
return params;
|
||||
};
|
||||
|
||||
export const buildClinicParams = (searchParams) => {
|
||||
const params = {};
|
||||
|
||||
// 🔹 city (find by name in city.json)
|
||||
if (searchParams.city) {
|
||||
const cityObj = cities.find((c) => c.name === searchParams.city);
|
||||
if (cityObj) {
|
||||
params.city = cityObj.id;
|
||||
}
|
||||
}
|
||||
|
||||
// 🔹 state (find by name in state.json)
|
||||
if (searchParams.state) {
|
||||
const stateObj = states.find((s) => s.name === searchParams.state);
|
||||
if (stateObj) {
|
||||
params.state = stateObj.id;
|
||||
}
|
||||
}
|
||||
|
||||
// 🔹 specialty (find by name in specialties.json)
|
||||
if (searchParams.specialty) {
|
||||
const spec = specialties.find((s) => s.name === searchParams.specialty);
|
||||
if (spec) {
|
||||
params.specialty = spec.id;
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
};
|
||||
|
||||
export function timeAgo(timestamp) {
|
||||
const now = moment();
|
||||
const then = moment.unix(timestamp);
|
||||
|
||||
Reference in New Issue
Block a user