handle disable button if no data include in page add doctor
This commit is contained in:
@@ -21,3 +21,23 @@ export const convertToJalali = (date) => {
|
||||
|
||||
export const handleTwoLength = (value) =>
|
||||
String(value).length === 1 ? `0${value}` : value;
|
||||
|
||||
export const checkAllValues = (data) => {
|
||||
for (let key in data) {
|
||||
if (typeof data[key] === "object" && data[key] !== null) {
|
||||
if ("value" in data[key]) {
|
||||
if (!data[key].value) {
|
||||
console.log(false);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!checkAllValues(data[key])) {
|
||||
console.log(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(true);
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user