handle download poster and qrcode, fix to show timestamp, add pagination to doctors page
This commit is contained in:
+54
-48
@@ -260,6 +260,14 @@ export const degreeVal = [
|
||||
{ name: "پزشک فوق تخصص", val: "subspecialistplus" },
|
||||
];
|
||||
|
||||
export const addLabelToList = (list) =>
|
||||
list.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
label: item.name,
|
||||
};
|
||||
});
|
||||
|
||||
export const QueryForDoctorsFilter = (newFilter) => {
|
||||
const query = {};
|
||||
|
||||
@@ -355,50 +363,6 @@ export const QueryForDoctorsReq = (newFilter) => {
|
||||
return params;
|
||||
};
|
||||
|
||||
export const addLabelToList = (list) =>
|
||||
list.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
label: item.name,
|
||||
};
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// 🔹 page
|
||||
if (searchParams.page) params.page = searchParams.page;
|
||||
|
||||
// 🔹 limit
|
||||
if (searchParams.limit) params.limit = searchParams.limit;
|
||||
|
||||
return params;
|
||||
};
|
||||
|
||||
export const buildDoctorParams = (searchParams) => {
|
||||
const params = {};
|
||||
|
||||
@@ -469,6 +433,48 @@ export const buildDoctorParams = (searchParams) => {
|
||||
else if ([4, 5].includes(sortNum)) params.sort = "DESC";
|
||||
}
|
||||
|
||||
// 🔹 page
|
||||
params.page = searchParams.page || 1;
|
||||
|
||||
// 🔹 limit
|
||||
params.limit = 12;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// 🔹 page
|
||||
params.page = searchParams.page || 1;
|
||||
|
||||
// 🔹 limit
|
||||
params.limit = 12;
|
||||
|
||||
return params;
|
||||
};
|
||||
|
||||
@@ -500,10 +506,10 @@ export const buildClinicParams = (searchParams) => {
|
||||
}
|
||||
|
||||
// 🔹 page
|
||||
if (searchParams.page) {
|
||||
params.page = searchParams.page;
|
||||
params.limit = 12;
|
||||
}
|
||||
params.page = searchParams.page || 1;
|
||||
|
||||
// 🔹 limit
|
||||
params.limit = 12;
|
||||
|
||||
return params;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user