import React from "react"; import './PhoneMenu.scss'; import {PatientState, OccupationState as OS, TaskState as TS} from "../share/BedProps" import {SetState} from "../share/NetSetState"; export interface PhoneMenuState { ind: number, elem: number; open: boolean } interface Props { state: PhoneMenuState; s: PatientState; onStateChange: (state: SetState, arg?: any) => void; onClose: () => void; } export class PhoneMenu extends React.Component { render() { let options; if (this.props.s.occupation === OS.UNOCCUPIED || this.props.s.occupation === OS.TO_CLEAN) { options = (<>
this.props.onStateChange(SetState.MESSAGE)}>

Message

); } else if (this.props.s.occupation === OS.DISABLED) { options = (<>
this.props.onStateChange(SetState.DISABLE, false)}>

Enable

); } else { options = (<> {( this.props.s.bloodwork === TS.RETURNED || this.props.s.imaging === TS.RETURNED || this.props.s.consult === TS.RETURNED) && <> {/*Clear Bloodwork*/} {this.props.s.bloodwork === TS.RETURNED &&
this.props.onStateChange(SetState.RECV_BLOODWORK, false)}>

Clear Bloodwork

} {/*Clear Imaging*/} {this.props.s.imaging === TS.RETURNED &&
this.props.onStateChange(SetState.RECV_IMAGING, false)}>

Clear Imaging

} {/*Clear Consult*/} {this.props.s.consult === TS.RETURNED &&
this.props.onStateChange(SetState.RECV_CONSULT, false)}>

Clear Consult

}
} {/*Send Bloodwork*/} {this.props.s.bloodwork !== TS.RETURNED &&
this.props.onStateChange(SetState.SENT_BLOODWORK, this.props.s.bloodwork !== TS.SENT)}> {this.props.s.bloodwork === TS.SENT &&
}

{(this.props.s.bloodwork === TS.SENT ? "Sent" : "Send") + " for Bloodwork"}

} {/*Send Imaging*/} {this.props.s.imaging !== TS.RETURNED &&
this.props.onStateChange(SetState.SENT_IMAGING, this.props.s.imaging !== TS.SENT)}> {this.props.s.imaging === TS.SENT &&
}

{(this.props.s.imaging === TS.SENT ? "Sent" : "Send") + " for Imaging"}

} {/*Send Consult*/} {this.props.s.consult !== TS.RETURNED &&
this.props.onStateChange(SetState.SENT_CONSULT, this.props.s.consult !== TS.SENT)}> {this.props.s.consult === TS.SENT &&
}

{(this.props.s.consult === TS.SENT ? "Sent" : "Send") + " for Consult"}

} {( this.props.s.bloodwork !== TS.RETURNED || this.props.s.imaging !== TS.RETURNED || this.props.s.consult !== TS.RETURNED) &&
} {/*Pending Discharge*/} {(this.props.s.consult === TS.RETURNED || this.props.s.bloodwork === TS.RETURNED || this.props.s.imaging === TS.RETURNED || this.props.s.occupation === OS.PENDING_DISCHARGE) && <>
this.props.onStateChange((this.props.s.occupation === OS.PENDING_DISCHARGE) ? SetState.ASSIGN_PATIENT : SetState.PATIENT_PENDING_DISCHARGE)}>

Pending Discharge

}
this.props.onStateChange(SetState.MESSAGE)}>

Message

this.props.onStateChange(SetState.DISCHARGE_PATIENT, true)}>

Discharge

); } return (
{options}
); } }