export function isWesternRxDrug(drug) { return drug && drug.type == 2 && (drug.is_otc === 0 || drug.is_otc === '0'); } export function isHealthFood(drug) { return drug && (drug.type == 3 || drug.category_type === 'health_food'); } export function canShowFunction(drug, prescriptionApproved) { if (isHealthFood(drug)) return false; if (isWesternRxDrug(drug)) return !!prescriptionApproved; return true; } export function canShowUsage(drug, prescriptionApproved) { if (isHealthFood(drug)) return false; if (isWesternRxDrug(drug)) return !!prescriptionApproved; return drug && drug.type != 3; } export function canShowInstruction(drug, prescriptionApproved) { if (isWesternRxDrug(drug)) return !!prescriptionApproved; return true; } export function isPrescriptionApprovedStatus(data) { if (!data) return false; const ps = data.prescription_status ?? data.status; return data.status === true || ps === 1 || ps === '1' || ps === 3 || ps === '3' || ps === 4 || ps === '4'; }