handle disable button if no data include in page add doctor

This commit is contained in:
Ehsan
2024-10-11 23:54:01 +03:30
parent 2f49c9e8c7
commit aecba57176
5 changed files with 29 additions and 6 deletions
+20
View File
@@ -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;
};