{"version":3,"file":"index-BU9d_81H.js","sources":["../../lib/lodash/lodash-4.6.1.min.js","../../lib/legacyJS/Add.js","../../lib/legacyJS/Common/ChecksDialog.js","../../lib/legacyJS/Common/JustificationDialog.js","../../lib/legacyJS/Detail.js","../../lib/legacyJS/Invoicing/OverviewPayments.js","../../lib/legacyJS/main.js","../../lib/legacyJS/OrderProductsShared.js","../../lib/legacyJS/OrderReportWorklistShared.js","../../lib/legacyJS/OrderShared.js","../../lib/legacyJS/OrderWorklistShared.js","../../lib/legacyJS/patients.js","../../lib/legacyJS/PatientShared.js","../../lib/legacyJS/MainShared.js","../../lib/legacyJS/Reporting/OrderDetail.js","../../lib/legacyJS/Reporting/OrderDetailV2.js","../../lib/legacyJS/Reporting/ProcedureCombination.js","../../lib/legacyJS/Reporting/ProcedureCombinationV2.js","../../lib/legacyJS/Reporting/ReportShared.js","../../lib/legacyJS/Reporting/Transcription.js","../../lib/legacyJS/ReportWorklistShared.js","../../lib/legacyJS/System/Procedure.js","../../lib/reactComponentsLoader/comp/Components.js","../../lib/reactComponentsLoader/reactComponentsLoader.js","../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../node_modules/react/jsx-runtime.js","../../node_modules/scheduler/cjs/scheduler.production.min.js","../../node_modules/scheduler/index.js","../../node_modules/react-dom/cjs/react-dom.production.min.js","../../node_modules/react-dom/index.js","../../node_modules/react-dom/client.js","../../node_modules/@remix-run/router/dist/router.js","../../node_modules/react-router/dist/index.js","../../node_modules/react-router-dom/dist/index.js","../../node_modules/@mui/material/colors/common.js","../../node_modules/@mui/material/colors/red.js","../../node_modules/@mui/material/colors/purple.js","../../node_modules/@mui/material/colors/blue.js","../../node_modules/@mui/material/colors/lightBlue.js","../../node_modules/@mui/material/colors/green.js","../../node_modules/@mui/material/colors/orange.js","../../node_modules/@mui/material/colors/grey.js","../../node_modules/@mui/utils/esm/formatMuiErrorMessage/formatMuiErrorMessage.js","../../node_modules/@mui/material/styles/identifier.js","../../node_modules/@babel/runtime/helpers/esm/extends.js","../../node_modules/@emotion/memoize/dist/emotion-memoize.esm.js","../../node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js","../../node_modules/@emotion/sheet/dist/emotion-sheet.esm.js","../../node_modules/stylis/src/Enum.js","../../node_modules/stylis/src/Utility.js","../../node_modules/stylis/src/Tokenizer.js","../../node_modules/stylis/src/Parser.js","../../node_modules/stylis/src/Serializer.js","../../node_modules/stylis/src/Middleware.js","../../node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js","../../node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/hoist-non-react-statics/node_modules/react-is/index.js","../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js","../../node_modules/@emotion/hash/dist/emotion-hash.esm.js","../../node_modules/@emotion/unitless/dist/emotion-unitless.esm.js","../../node_modules/@emotion/serialize/dist/emotion-serialize.esm.js","../../node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js","../../node_modules/@emotion/react/dist/emotion-element-5486c51c.browser.esm.js","../../node_modules/@emotion/react/dist/emotion-react.browser.esm.js","../../node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js","../../node_modules/@emotion/styled/dist/emotion-styled.browser.esm.js","../../node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles.js","../../node_modules/@mui/styled-engine/index.js","../../node_modules/@mui/utils/esm/deepmerge/deepmerge.js","../../node_modules/@mui/system/esm/createBreakpoints/createBreakpoints.js","../../node_modules/@mui/system/esm/cssContainerQueries/cssContainerQueries.js","../../node_modules/@mui/system/esm/createTheme/shape.js","../../node_modules/@mui/system/esm/merge/merge.js","../../node_modules/@mui/system/esm/breakpoints/breakpoints.js","../../node_modules/@mui/utils/esm/capitalize/capitalize.js","../../node_modules/@mui/system/esm/style/style.js","../../node_modules/@mui/system/esm/memoize/memoize.js","../../node_modules/@mui/system/esm/spacing/spacing.js","../../node_modules/@mui/system/esm/createTheme/createSpacing.js","../../node_modules/@mui/system/esm/compose/compose.js","../../node_modules/@mui/system/esm/borders/borders.js","../../node_modules/@mui/system/esm/cssGrid/cssGrid.js","../../node_modules/@mui/system/esm/palette/palette.js","../../node_modules/@mui/system/esm/sizing/sizing.js","../../node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js","../../node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js","../../node_modules/@mui/system/esm/createTheme/applyStyles.js","../../node_modules/@mui/system/esm/createTheme/createTheme.js","../../node_modules/@mui/system/esm/useThemeWithoutDefault/useThemeWithoutDefault.js","../../node_modules/@mui/system/esm/useTheme/useTheme.js","../../node_modules/@mui/system/esm/GlobalStyles/GlobalStyles.js","../../node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js","../../node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js","../../node_modules/@mui/system/node_modules/clsx/dist/clsx.mjs","../../node_modules/@mui/system/esm/createBox/createBox.js","../../node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js","../../node_modules/@mui/utils/esm/generateUtilityClasses/generateUtilityClasses.js","../../node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/@mui/system/esm/preprocessStyles.js","../../node_modules/@mui/system/esm/createStyled/createStyled.js","../../node_modules/@mui/system/esm/styled/styled.js","../../node_modules/@mui/utils/esm/resolveProps/resolveProps.js","../../node_modules/@mui/system/esm/useThemeProps/getThemeProps.js","../../node_modules/@mui/system/esm/useThemeProps/useThemeProps.js","../../node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js","../../node_modules/@mui/utils/esm/clamp/clamp.js","../../node_modules/@mui/system/esm/colorManipulator/colorManipulator.js","../../node_modules/@mui/utils/esm/createChainedFunction/createChainedFunction.js","../../node_modules/@mui/utils/esm/debounce/debounce.js","../../node_modules/@mui/utils/esm/isMuiElement/isMuiElement.js","../../node_modules/@mui/utils/esm/ownerDocument/ownerDocument.js","../../node_modules/@mui/utils/esm/ownerWindow/ownerWindow.js","../../node_modules/@mui/utils/esm/setRef/setRef.js","../../node_modules/@mui/utils/esm/useId/useId.js","../../node_modules/@mui/utils/esm/useControlled/useControlled.js","../../node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js","../../node_modules/@mui/utils/esm/useForkRef/useForkRef.js","../../node_modules/@mui/utils/esm/useLazyRef/useLazyRef.js","../../node_modules/@mui/utils/esm/useOnMount/useOnMount.js","../../node_modules/@mui/utils/esm/useTimeout/useTimeout.js","../../node_modules/@mui/utils/esm/isFocusVisible/isFocusVisible.js","../../node_modules/@mui/utils/esm/getScrollbarSize/getScrollbarSize.js","../../node_modules/@mui/utils/esm/usePreviousProps/usePreviousProps.js","../../node_modules/@mui/utils/esm/composeClasses/composeClasses.js","../../node_modules/@mui/utils/esm/isHostComponent/isHostComponent.js","../../node_modules/@mui/utils/esm/appendOwnerState/appendOwnerState.js","../../node_modules/@mui/utils/node_modules/clsx/dist/clsx.mjs","../../node_modules/@mui/utils/esm/extractEventHandlers/extractEventHandlers.js","../../node_modules/@mui/utils/esm/omitEventHandlers/omitEventHandlers.js","../../node_modules/@mui/utils/esm/mergeSlotProps/mergeSlotProps.js","../../node_modules/@mui/utils/esm/resolveComponentProps/resolveComponentProps.js","../../node_modules/@mui/utils/esm/useSlotProps/useSlotProps.js","../../node_modules/@mui/utils/esm/getReactElementRef/getReactElementRef.js","../../node_modules/@mui/private-theming/useTheme/ThemeContext.js","../../node_modules/@mui/private-theming/useTheme/useTheme.js","../../node_modules/@mui/private-theming/ThemeProvider/nested.js","../../node_modules/@mui/private-theming/ThemeProvider/ThemeProvider.js","../../node_modules/@mui/system/esm/RtlProvider/index.js","../../node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider.js","../../node_modules/@mui/system/esm/ThemeProvider/ThemeProvider.js","../../node_modules/@mui/system/esm/memoTheme.js","../../node_modules/@mui/system/esm/InitColorSchemeScript/InitColorSchemeScript.js","../../node_modules/@mui/system/esm/cssVars/useCurrentColorScheme.js","../../node_modules/@mui/system/esm/cssVars/createCssVarsProvider.js","../../node_modules/@mui/system/esm/cssVars/createGetCssVar.js","../../node_modules/@mui/system/esm/cssVars/cssVarsParser.js","../../node_modules/@mui/system/esm/cssVars/prepareCssVars.js","../../node_modules/@mui/system/esm/cssVars/getColorSchemeSelector.js","../../node_modules/@mui/system/esm/Container/createContainer.js","../../node_modules/@mui/system/esm/Grid/traverseBreakpoints.js","../../node_modules/@mui/system/esm/Grid/gridGenerator.js","../../node_modules/@mui/system/esm/Grid/createGrid.js","../../node_modules/@mui/system/esm/Stack/createStack.js","../../node_modules/@mui/material/styles/createPalette.js","../../node_modules/@mui/system/esm/cssVars/prepareTypographyVars.js","../../node_modules/@mui/material/styles/createMixins.js","../../node_modules/@mui/material/styles/createTypography.js","../../node_modules/@mui/material/styles/shadows.js","../../node_modules/@mui/material/styles/createTransitions.js","../../node_modules/@mui/material/styles/zIndex.js","../../node_modules/@mui/material/styles/stringifyTheme.js","../../node_modules/@mui/material/styles/createThemeNoVars.js","../../node_modules/@mui/material/styles/getOverlayAlpha.js","../../node_modules/@mui/material/styles/createColorScheme.js","../../node_modules/@mui/material/styles/shouldSkipGeneratingVar.js","../../node_modules/@mui/material/styles/excludeVariablesFromRoot.js","../../node_modules/@mui/material/styles/createGetSelector.js","../../node_modules/@mui/material/styles/createThemeWithVars.js","../../node_modules/@mui/material/styles/createTheme.js","../../node_modules/@mui/material/styles/defaultTheme.js","../../node_modules/@mui/material/styles/useTheme.js","../../node_modules/@mui/material/styles/useThemeProps.js","../../node_modules/@mui/material/styles/slotShouldForwardProp.js","../../node_modules/@mui/material/styles/rootShouldForwardProp.js","../../node_modules/@mui/material/styles/styled.js","../../node_modules/@mui/material/styles/ThemeProviderNoVars.js","../../node_modules/@mui/material/InitColorSchemeScript/InitColorSchemeScript.js","../../node_modules/@mui/material/styles/ThemeProviderWithVars.js","../../node_modules/@mui/material/styles/ThemeProvider.js","../../node_modules/@mui/material/node_modules/clsx/dist/clsx.mjs","../../node_modules/@mui/material/GlobalStyles/GlobalStyles.js","../../node_modules/@mui/material/zero-styled/index.js","../../node_modules/@mui/material/utils/memoTheme.js","../../node_modules/@mui/material/DefaultPropsProvider/DefaultPropsProvider.js","../../node_modules/@mui/material/SvgIcon/svgIconClasses.js","../../node_modules/@mui/material/SvgIcon/SvgIcon.js","../../node_modules/@mui/material/utils/createSvgIcon.js","../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","../../node_modules/react-transition-group/esm/config.js","../../node_modules/react-transition-group/esm/TransitionGroupContext.js","../../node_modules/react-transition-group/esm/utils/reflow.js","../../node_modules/react-transition-group/esm/Transition.js","../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../node_modules/react-transition-group/esm/utils/ChildMapping.js","../../node_modules/react-transition-group/esm/TransitionGroup.js","../../node_modules/@mui/material/transitions/utils.js","../../node_modules/@mui/material/Collapse/collapseClasses.js","../../node_modules/@mui/material/Collapse/Collapse.js","../../node_modules/@mui/material/Paper/paperClasses.js","../../node_modules/@mui/material/Paper/Paper.js","../../node_modules/@mui/material/utils/useSlot.js","../../node_modules/@mui/material/useLazyRipple/useLazyRipple.js","../../node_modules/@mui/material/ButtonBase/Ripple.js","../../node_modules/@mui/material/ButtonBase/touchRippleClasses.js","../../node_modules/@mui/material/ButtonBase/TouchRipple.js","../../node_modules/@mui/material/ButtonBase/buttonBaseClasses.js","../../node_modules/@mui/material/ButtonBase/ButtonBase.js","../../node_modules/@mui/material/utils/createSimplePaletteValueFilter.js","../../node_modules/@mui/material/Alert/alertClasses.js","../../node_modules/@mui/material/IconButton/iconButtonClasses.js","../../node_modules/@mui/material/IconButton/IconButton.js","../../node_modules/@mui/material/internal/svg-icons/SuccessOutlined.js","../../node_modules/@mui/material/internal/svg-icons/ReportProblemOutlined.js","../../node_modules/@mui/material/internal/svg-icons/ErrorOutline.js","../../node_modules/@mui/material/internal/svg-icons/InfoOutlined.js","../../node_modules/@mui/material/internal/svg-icons/Close.js","../../node_modules/@mui/material/Alert/Alert.js","../../node_modules/@mui/material/Typography/typographyClasses.js","../../node_modules/@mui/material/Typography/Typography.js","../../node_modules/@mui/material/useAutocomplete/useAutocomplete.js","../../node_modules/@popperjs/core/lib/enums.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../node_modules/@popperjs/core/lib/utils/math.js","../../node_modules/@popperjs/core/lib/utils/userAgent.js","../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../node_modules/@popperjs/core/lib/dom-utils/contains.js","../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../node_modules/@popperjs/core/lib/utils/within.js","../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../node_modules/@popperjs/core/lib/modifiers/arrow.js","../../node_modules/@popperjs/core/lib/utils/getVariation.js","../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../node_modules/@popperjs/core/lib/modifiers/flip.js","../../node_modules/@popperjs/core/lib/modifiers/hide.js","../../node_modules/@popperjs/core/lib/modifiers/offset.js","../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../node_modules/@popperjs/core/lib/utils/debounce.js","../../node_modules/@popperjs/core/lib/utils/mergeByName.js","../../node_modules/@popperjs/core/lib/createPopper.js","../../node_modules/@popperjs/core/lib/popper.js","../../node_modules/@mui/material/Portal/Portal.js","../../node_modules/@mui/material/Popper/popperClasses.js","../../node_modules/@mui/material/Popper/BasePopper.js","../../node_modules/@mui/material/Popper/Popper.js","../../node_modules/@mui/material/ListSubheader/listSubheaderClasses.js","../../node_modules/@mui/material/ListSubheader/ListSubheader.js","../../node_modules/@mui/material/internal/svg-icons/Cancel.js","../../node_modules/@mui/material/Chip/chipClasses.js","../../node_modules/@mui/material/Chip/Chip.js","../../node_modules/@mui/material/TextareaAutosize/TextareaAutosize.js","../../node_modules/@mui/material/utils/isHostComponent.js","../../node_modules/@mui/material/FormControl/formControlState.js","../../node_modules/@mui/material/FormControl/FormControlContext.js","../../node_modules/@mui/material/FormControl/useFormControl.js","../../node_modules/@mui/material/InputBase/utils.js","../../node_modules/@mui/material/InputBase/inputBaseClasses.js","../../node_modules/@mui/material/InputBase/InputBase.js","../../node_modules/@mui/material/Input/inputClasses.js","../../node_modules/@mui/material/OutlinedInput/outlinedInputClasses.js","../../node_modules/@mui/material/FilledInput/filledInputClasses.js","../../node_modules/@mui/material/internal/svg-icons/ArrowDropDown.js","../../node_modules/@mui/material/Autocomplete/autocompleteClasses.js","../../node_modules/@mui/material/Autocomplete/Autocomplete.js","../../node_modules/@mui/material/Fade/Fade.js","../../node_modules/@mui/material/Backdrop/backdropClasses.js","../../node_modules/@mui/material/Backdrop/Backdrop.js","../../node_modules/@mui/material/Box/boxClasses.js","../../node_modules/@mui/material/Box/Box.js","../../node_modules/@mui/material/Button/buttonClasses.js","../../node_modules/@mui/material/ButtonGroup/ButtonGroupContext.js","../../node_modules/@mui/material/ButtonGroup/ButtonGroupButtonContext.js","../../node_modules/@mui/material/Button/Button.js","../../node_modules/@mui/material/internal/switchBaseClasses.js","../../node_modules/@mui/material/internal/SwitchBase.js","../../node_modules/@mui/material/internal/svg-icons/CheckBoxOutlineBlank.js","../../node_modules/@mui/material/internal/svg-icons/CheckBox.js","../../node_modules/@mui/material/internal/svg-icons/IndeterminateCheckBox.js","../../node_modules/@mui/material/Checkbox/checkboxClasses.js","../../node_modules/@mui/material/Checkbox/Checkbox.js","../../node_modules/@mui/material/CircularProgress/circularProgressClasses.js","../../node_modules/@mui/material/CircularProgress/CircularProgress.js","../../node_modules/@mui/material/Container/Container.js","../../node_modules/@mui/material/CssBaseline/CssBaseline.js","../../node_modules/@mui/material/Modal/ModalManager.js","../../node_modules/@mui/material/Unstable_TrapFocus/FocusTrap.js","../../node_modules/@mui/material/Modal/useModal.js","../../node_modules/@mui/material/Modal/modalClasses.js","../../node_modules/@mui/material/Modal/Modal.js","../../node_modules/@mui/material/Dialog/dialogClasses.js","../../node_modules/@mui/material/Dialog/DialogContext.js","../../node_modules/@mui/material/Dialog/Dialog.js","../../node_modules/@mui/material/DialogActions/dialogActionsClasses.js","../../node_modules/@mui/material/DialogActions/DialogActions.js","../../node_modules/@mui/material/DialogContent/dialogContentClasses.js","../../node_modules/@mui/material/DialogTitle/dialogTitleClasses.js","../../node_modules/@mui/material/DialogContent/DialogContent.js","../../node_modules/@mui/material/DialogContentText/dialogContentTextClasses.js","../../node_modules/@mui/material/DialogContentText/DialogContentText.js","../../node_modules/@mui/material/DialogTitle/DialogTitle.js","../../node_modules/@mui/material/Divider/dividerClasses.js","../../node_modules/@mui/material/FilledInput/FilledInput.js","../../node_modules/@mui/material/FormControl/formControlClasses.js","../../node_modules/@mui/material/FormControl/FormControl.js","../../node_modules/@mui/material/FormControlLabel/formControlLabelClasses.js","../../node_modules/@mui/material/FormControlLabel/FormControlLabel.js","../../node_modules/@mui/material/FormGroup/formGroupClasses.js","../../node_modules/@mui/material/FormGroup/FormGroup.js","../../node_modules/@mui/material/FormHelperText/formHelperTextClasses.js","../../node_modules/@mui/material/FormHelperText/FormHelperText.js","../../node_modules/@mui/material/FormLabel/formLabelClasses.js","../../node_modules/@mui/material/FormLabel/FormLabel.js","../../node_modules/@mui/material/Grid2/Grid2.js","../../node_modules/@mui/material/Grow/Grow.js","../../node_modules/@mui/material/Input/Input.js","../../node_modules/@mui/material/InputAdornment/inputAdornmentClasses.js","../../node_modules/@mui/material/InputAdornment/InputAdornment.js","../../node_modules/@mui/material/InputLabel/inputLabelClasses.js","../../node_modules/@mui/material/InputLabel/InputLabel.js","../../node_modules/@mui/material/List/ListContext.js","../../node_modules/@mui/material/List/listClasses.js","../../node_modules/@mui/material/List/List.js","../../node_modules/@mui/material/ListItem/listItemClasses.js","../../node_modules/@mui/material/ListItemButton/listItemButtonClasses.js","../../node_modules/@mui/material/ListItemButton/ListItemButton.js","../../node_modules/@mui/material/ListItemSecondaryAction/listItemSecondaryActionClasses.js","../../node_modules/@mui/material/ListItemSecondaryAction/ListItemSecondaryAction.js","../../node_modules/@mui/material/ListItem/ListItem.js","../../node_modules/@mui/material/ListItemIcon/listItemIconClasses.js","../../node_modules/@mui/material/ListItemIcon/ListItemIcon.js","../../node_modules/@mui/material/ListItemText/listItemTextClasses.js","../../node_modules/@mui/material/ListItemText/ListItemText.js","../../node_modules/@mui/material/MenuList/MenuList.js","../../node_modules/@mui/material/Popover/popoverClasses.js","../../node_modules/@mui/material/Popover/Popover.js","../../node_modules/@mui/material/Menu/menuClasses.js","../../node_modules/@mui/material/Menu/Menu.js","../../node_modules/@mui/material/MenuItem/menuItemClasses.js","../../node_modules/@mui/material/MenuItem/MenuItem.js","../../node_modules/@mui/material/NativeSelect/nativeSelectClasses.js","../../node_modules/@mui/material/NativeSelect/NativeSelectInput.js","../../node_modules/@mui/material/OutlinedInput/NotchedOutline.js","../../node_modules/@mui/material/OutlinedInput/OutlinedInput.js","../../node_modules/@mui/material/Select/selectClasses.js","../../node_modules/@mui/material/Select/SelectInput.js","../../node_modules/@mui/material/Select/Select.js","../../node_modules/@mui/material/Stack/Stack.js","../../node_modules/@mui/material/Table/TableContext.js","../../node_modules/@mui/material/Table/tableClasses.js","../../node_modules/@mui/material/Table/Table.js","../../node_modules/@mui/material/Table/Tablelvl2Context.js","../../node_modules/@mui/material/TableBody/tableBodyClasses.js","../../node_modules/@mui/material/TableBody/TableBody.js","../../node_modules/@mui/material/TableCell/tableCellClasses.js","../../node_modules/@mui/material/TableCell/TableCell.js","../../node_modules/@mui/material/TableContainer/tableContainerClasses.js","../../node_modules/@mui/material/TableContainer/TableContainer.js","../../node_modules/@mui/material/TableHead/tableHeadClasses.js","../../node_modules/@mui/material/TableHead/TableHead.js","../../node_modules/@mui/material/TableRow/tableRowClasses.js","../../node_modules/@mui/material/TableRow/TableRow.js","../../node_modules/@mui/material/TextField/textFieldClasses.js","../../node_modules/@mui/material/TextField/TextField.js","../../src/Components/ProductLogo/ProductLogo.tsx","../../src/Components/LoadingFullPage/LoadingFullPage.tsx","../../src/Style/MUI/Theming.ts","../../src/Contexts/App/ThemeContext.tsx","../../node_modules/i18next/dist/esm/i18next.js","../../src/Models/User.ts","../../src/Models/SystemSettings.ts","../../src/Models/GeneralSearch.ts","../../node_modules/moment/dist/moment.js","../../src/API.ts","../../src/Hooks/UseProvidedContext.ts","../../src/Models/Entity.ts","../../src/Models/LockType.ts","../../src/Scripts/PACSDriven.ts","../../src/Contexts/App/AuthenticationContext.tsx","../../src/Contexts/App/index.tsx","../../node_modules/react-i18next/dist/es/utils.js","../../node_modules/react-i18next/dist/es/unescape.js","../../node_modules/react-i18next/dist/es/defaults.js","../../node_modules/react-i18next/dist/es/i18nInstance.js","../../node_modules/react-i18next/dist/es/initReactI18next.js","../../node_modules/react-i18next/dist/es/context.js","../../node_modules/react-i18next/dist/es/useTranslation.js","../../node_modules/lodash.debounce/index.js","../../node_modules/usehooks-ts/dist/index.js","../../src/Hooks/UseFilingCabinetBackend.ts","../../src/Scripts/FilingCabinetLocks.ts","../../node_modules/clsx/dist/clsx.m.js","../../node_modules/react-draggable/build/cjs/utils/shims.js","../../node_modules/react-draggable/build/cjs/utils/getPrefix.js","../../node_modules/react-draggable/build/cjs/utils/domFns.js","../../node_modules/react-draggable/build/cjs/utils/positionFns.js","../../node_modules/react-draggable/build/cjs/utils/log.js","../../node_modules/react-draggable/build/cjs/DraggableCore.js","../../node_modules/react-draggable/build/cjs/Draggable.js","../../node_modules/react-draggable/build/cjs/cjs.js","../../src/Components/CloseLockedFilesDialog/CloseLockedFilesDialog.tsx","../../src/Contexts/Authenticated/ROW2Link.ts","../../src/Helpers/BulkSession.ts","../../src/Contexts/Authenticated/FilingCabinetContext.tsx","../../src/Contexts/Authenticated/UserContext.tsx","../../src/Components/Header/AboutDialog/AboutDialog.tsx","../../src/Components/Header/HeaderRight/HeaderMenu/HeaderMenu.tsx","../../src/Components/Header/HeaderRight/HeaderRight.tsx","../../src/Components/Header/Header.tsx","../../node_modules/classnames/index.js","../../src/Components/FilingCabinetItemLink/FilingCabinetItemLink.tsx","../../src/Components/FilingCabinet/FilingCabinet.tsx","../../src/Components/Procedure/Procedure.tsx","../../src/Components/Button/Button.tsx","../../src/Components/Dialog/Dialog.tsx","../../src/Components/EIDButton/EIDButton.tsx","../../src/Hooks/UseFavoritesState.ts","../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../node_modules/@babel/runtime/helpers/esm/objectSpread2.js","../../node_modules/redux/es/redux.js","../../node_modules/react-redux/es/components/Context.js","../../node_modules/react-redux/es/utils/batch.js","../../node_modules/react-redux/es/utils/Subscription.js","../../node_modules/react-redux/es/utils/useIsomorphicLayoutEffect.js","../../node_modules/react-redux/es/components/Provider.js","../../node_modules/react-redux/node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/react-redux/node_modules/react-is/index.js","../../node_modules/react-redux/es/components/connectAdvanced.js","../../node_modules/react-redux/es/utils/shallowEqual.js","../../node_modules/react-redux/es/utils/bindActionCreators.js","../../node_modules/react-redux/es/connect/wrapMapToProps.js","../../node_modules/react-redux/es/connect/mapDispatchToProps.js","../../node_modules/react-redux/es/connect/mapStateToProps.js","../../node_modules/react-redux/es/connect/mergeProps.js","../../node_modules/react-redux/es/connect/selectorFactory.js","../../node_modules/react-redux/es/connect/connect.js","../../node_modules/react-redux/es/index.js","../../node_modules/use-memo-one/dist/use-memo-one.esm.js","../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js","../../node_modules/css-box-model/dist/css-box-model.esm.js","../../node_modules/memoize-one/dist/memoize-one.esm.js","../../node_modules/raf-schd/dist/raf-schd.esm.js","../../node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js","../../src/Components/StrictModeDroppable/StrictModeDroppable.tsx","../../lib/legacyCss/img/MenuIcons/radiologistAdd.png","../../lib/legacyCss/img/MenuIcons/radiologistAdd_black.png","../../lib/legacyCss/img/MenuIcons/technicianAdd.png","../../lib/legacyCss/img/MenuIcons/technicianAdd_black.png","../../lib/legacyCss/img/MenuIcons/radiologistOverview.png","../../lib/legacyCss/img/MenuIcons/radiologistOverview_black.png","../../lib/legacyCss/img/MenuIcons/technicianOverview.png","../../lib/legacyCss/img/MenuIcons/technicianOverview_black.png","../../lib/legacyCss/img/MenuIcons/invoiceConfirmed.png","../../lib/legacyCss/img/MenuIcons/invoiceConfirmed_black.png","../../lib/legacyCss/img/MenuIcons/invoicePrePayment.png","../../lib/legacyCss/img/MenuIcons/invoicePrePayment_black.png","../../lib/legacyCss/img/MenuIcons/overviewPayments.png","../../lib/legacyCss/img/MenuIcons/overviewPayments_black.png","../../lib/legacyCss/img/MenuIcons/supplement.png","../../lib/legacyCss/img/MenuIcons/supplement_black.png","../../lib/legacyCss/img/MenuIcons/orderWorklist.png","../../lib/legacyCss/img/MenuIcons/orderWorklist_black.png","../../lib/legacyCss/img/MenuIcons/physicianAdd.png","../../lib/legacyCss/img/MenuIcons/physicianAdd_black.png","../../lib/legacyCss/img/MenuIcons/physicianOverview.png","../../lib/legacyCss/img/MenuIcons/physicianOverview_black.png","../../lib/legacyCss/img/MenuIcons/products.png","../../lib/legacyCss/img/MenuIcons/products_black.png","../../lib/legacyCss/img/MenuIcons/myReports.png","../../lib/legacyCss/img/MenuIcons/myReports_black.png","../../lib/legacyCss/img/MenuIcons/reportOverview.png","../../lib/legacyCss/img/MenuIcons/reportOverview_black.png","../../lib/legacyCss/img/MenuIcons/reportOverviewDictate.png","../../lib/legacyCss/img/MenuIcons/reportOverviewDictate_black.png","../../lib/legacyCss/img/MenuIcons/reportOverviewValidate.png","../../lib/legacyCss/img/MenuIcons/reportOverviewValidate_black.png","../../lib/legacyCss/img/MenuIcons/visitOverview.png","../../lib/legacyCss/img/MenuIcons/visitOverview_black.png","../../src/Components/Menu/MenuIcons.tsx","../../src/Components/Menu/ROW2Mapping.ts","../../src/Components/MenuFavoriteItemLink/MenuFavoriteItemLink.tsx","../../src/Components/FavoritesMenu/FavoritesMenu.tsx","../../src/Components/MenuListItemLink/MenuListItemLink.tsx","../../src/Components/MenuUIItem/MenuUIItem.tsx","../../src/Components/FullMenu/FullMenu.tsx","../../src/Scripts/WorkAtHomeIdentifier.ts","../../src/Contexts/App/SystemSettingsContext.tsx","../../src/Components/Menu/Menu.tsx","../../src/Contexts/Authenticated/index.tsx","../../public/icons/iconRemarks.png","../../src/Hooks/UseFilingCabinet.ts","../../node_modules/@tanstack/table-core/build/lib/index.mjs","../../node_modules/@tanstack/react-table/build/lib/index.mjs","../../src/Pages/GenericWorklist/Components/NoResults.tsx","../../src/Assets/Icons/loading-circle.svg","../../src/Components/CircularProgress/CircularProgress.tsx","../../src/Pages/GeneralSearch/GeneralSearch.tsx","../../src/Routes/Authenticated/RouteKeyGenerator.ts","../../src/Pages/ROW2View/ROW2View.tsx","../../src/Routes/Authenticated/ROW2/ROW2Route.tsx","../../src/Routes/Authenticated/ROW2/ROW2Routes.tsx","../../src/Pages/Helper/LoadingPage/LoadingPage.tsx","../../src/Pages/RazorView/RazorView.tsx","../../src/Components/FileLockDialog/FileLockDialog.tsx","../../node_modules/lodash/lodash.js","../../src/Components/NotAllowedDialog/NotAllowedDialog.tsx","../../src/Pages/RazorView/FilingCabinetRazorView.tsx","../../src/Pages/RazorView/NonFilingCabinetRazorView.tsx","../../src/Hooks/UseFilingCabinetKeyInCurrentUrl.ts","../../src/Routes/Authenticated/Razor/RazorRoute.tsx","../../src/Routes/Authenticated/Razor/RazorRoutes.tsx","../../src/Components/PureTextButton/PureTextButton.tsx","../../src/Hooks/Helper/UseLastNonNullValue.ts","../../lib/legacyCss/img/icnArrowLeftWhite.png","../../lib/legacyCss/img/icnArrowRightWhite.png","../../src/Pages/GenericWorklist/Logic/pageSelectorCalculator.ts","../../src/Pages/GenericWorklist/Components/WorklistFooter.tsx","../../src/Pages/GenericWorklist/Components/WorklistGrid.tsx","../../src/Components/Input/Input.tsx","../../src/Pages/GenericWorklist/Components/SavedFilterSelect.tsx","../../node_modules/mobx/dist/mobx.esm.js","../../src/Pages/GenericWorklist/Components/WorklistSidebarStore.ts","../../node_modules/mobx-react-lite/es/utils/assertEnvironment.js","../../node_modules/mobx-react-lite/es/utils/observerBatching.js","../../node_modules/mobx-react-lite/es/utils/printDebugValue.js","../../node_modules/mobx-react-lite/es/utils/UniversalFinalizationRegistry.js","../../node_modules/mobx-react-lite/es/utils/observerFinalizationRegistry.js","../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../../node_modules/use-sync-external-store/shim/index.js","../../node_modules/mobx-react-lite/es/useObserver.js","../../node_modules/mobx-react-lite/es/observer.js","../../node_modules/mobx-react-lite/es/index.js","../../src/Components/FilledInput/FilledInput.tsx","../../public/icons/icnClose.png","../../src/Components/MultiSelect/MultiSelect.tsx","../../src/Pages/GenericWorklist/Components/WorklistSidebar.tsx","../../src/Pages/GenericWorklist/Components/SaveWorklistDialog.tsx","../../src/Components/DraggableList/DraggableList.tsx","../../src/Components/TabGroup/TabGroup.tsx","../../src/Pages/GenericWorklist/Components/ColumnsSetupModal.tsx","../../src/Stores/FilingCabinetStore.ts","../../src/Pages/GenericWorklist/WorklistStore.ts","../../src/Pages/GenericWorklist/GenericWorklist.tsx","../../src/Components/Prescriptions/CreatePrescriptions.tsx","../../src/Stores/TextBlockOverviewStore.ts","../../src/Pages/TextBlockOverview/TextBlockOverview.tsx","../../src/Components/Header/HeaderTitle/HeaderTitle.tsx","../../src/Stores/TextBlockDetailStore.ts","../../src/Pages/TextBlockDetail/TextBlockDetail.tsx","../../src/Helpers/FilingCabinetPage.tsx","../../src/Pages/EFactTool/EFactTool.tsx","../../src/Routes/Authenticated/index.tsx","../../src/Models/LoginResult.ts","../../src/Pages/Login/Login.tsx","../../src/Routes/LoginRouteRoot.tsx","../../src/Pages/ErrorPage/ErrorPage.tsx","../../src/Routes/Routes.tsx","../../src/App.tsx","../../node_modules/i18next-http-backend/esm/utils.js","../../node_modules/cross-fetch/dist/browser-ponyfill.js","../../node_modules/i18next-http-backend/esm/getFetch.cjs","../../node_modules/i18next-http-backend/esm/request.js","../../node_modules/i18next-http-backend/esm/index.js","../../src/i18n.ts","../../src/main.tsx"],"sourcesContent":["/**\r\n * @license\r\n * lodash 4.6.1 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE\r\n * Build: `lodash -o ./dist/lodash.js`\r\n */\r\n;(function(){function n(n,t){return n.set(t[0],t[1]),n}function t(n,t){return n.add(t),n}function r(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function e(n,t,r,e){for(var u=-1,o=n.length;++u '\r\n + '' + proc.ProcedureModality + ' '\r\n + proc.ProcedureCode + ' (' + proc.ProcedureFullCode + ') '\r\n + proc.ProcedureDescription\r\n + ' ');\r\n });\r\n } else {\r\n $('#gridFindApplicant' + viewbagUniquePrefix).append('' + this.ID + ' ' + this.FullName + ' ' + this.ContactInformationID + ' ' + this.ContactInformation + ' ' + this.Type + ' ' + this.Department + ' ' + this.RIZIV + ' ');\r\n }\r\n }\r\n });\r\n }\r\n\r\n var findApplicantCC = function (e) {\r\n $.ajax({\r\n type: 'POST',\r\n url: '/legacy/Orders/FindPhysiciansForGrid',\r\n data: {\r\n Name: $('#txtFindAppCCName' + viewbagUniquePrefix).val(),\r\n Address: $('#txtFindAppCCAddress' + viewbagUniquePrefix).val(),\r\n RIZIV: $('#txtFindAppCCRIZIV' + viewbagUniquePrefix).val(),\r\n except: $('#Applicant_UID').val() + \"-\" + $('#Applicant_CC_2_UID').val(),\r\n Type: $('#dropFindAppCCType').val(),\r\n Department: $('#dropFindAppCCDepartment').val()\r\n },\r\n dataType: 'json',\r\n success:\r\n function (data) {\r\n $('#gridFindApplicantCC' + viewbagUniquePrefix + ' tr:not(.tableHeader)').remove();\r\n $(\"#btnLoadSelectedAppCC\" + viewbagUniquePrefix).attr(\"disabled\", true);\r\n if (data.items.length > 0) {\r\n $.each(data.items, function (e) {\r\n $('#gridFindApplicantCC' + viewbagUniquePrefix).append('' + resourceNoPhysiciansFound + ' ');\r\n });\r\n } else {\r\n $('#gridFindApplicantCC' + viewbagUniquePrefix).append('' + this.ID + ' ' + this.FullName + ' ' + this.ContactInformationID + ' ' + this.ContactInformation + ' ' + this.Type + ' ' + this.Department + ' ' + this.RIZIV + ' ');\r\n }\r\n }\r\n });\r\n }\r\n\r\n var findApplicantCC2 = function (e) {\r\n $.ajax({\r\n type: 'POST',\r\n url: '/legacy/Orders/FindPhysiciansForGrid',\r\n data: {\r\n Name: $('#txtFindAppCC2Name' + viewbagUniquePrefix).val(),\r\n Address: $('#txtFindAppCC2Address' + viewbagUniquePrefix).val(),\r\n RIZIV: $('#txtFindAppCC2RIZIV' + viewbagUniquePrefix).val(),\r\n except: $('#Applicant_CC_UID').val() + \"-\" + $('#Applicant_UID').val(),\r\n Type: $('#dropFindAppCC2Type').val(),\r\n Department: $('#dropFindAppCC2Department').val()\r\n },\r\n dataType: 'json',\r\n success:\r\n function (data) {\r\n $('#gridFindApplicantCC2' + viewbagUniquePrefix + ' tr:not(.tableHeader)').remove();\r\n $(\"#btnLoadSelectedAppCC2\" + viewbagUniquePrefix).attr(\"disabled\", true);\r\n if (data.items.length > 0) {\r\n $.each(data.items, function (e) {\r\n $('#gridFindApplicantCC2' + viewbagUniquePrefix).append('' + resourceNoPhysiciansFound + ' ');\r\n });\r\n } else {\r\n $('#gridFindApplicantCC2' + viewbagUniquePrefix).append('' + this.ID + ' ' + this.FullName + ' ' + this.ContactInformationID + ' ' + this.ContactInformation + ' ' + this.Type + ' ' + this.Department + ' ' + this.RIZIV + ' ');\r\n }\r\n }\r\n });\r\n }\r\n\r\n $('#gridFindApplicant' + viewbagUniquePrefix).on('click', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedApp\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n });\r\n\r\n $('#gridFindApplicantCC' + viewbagUniquePrefix).on('click', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedAppCC\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n });\r\n\r\n $('#gridFindApplicantCC2' + viewbagUniquePrefix).on('click', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedAppCC2\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n });\r\n\r\n $('#gridFindApplicant' + viewbagUniquePrefix).on('dblclick', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedApp\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n SharedOrderFunctions.LoadSelectedApplicant(viewbagUniquePrefix);\r\n });\r\n\r\n $('#gridFindApplicantCC' + viewbagUniquePrefix).on('dblclick', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedAppCC\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n SharedOrderFunctions.LoadSelectedAppCC(viewbagUniquePrefix);\r\n });\r\n\r\n $('#gridFindApplicantCC2' + viewbagUniquePrefix).on('dblclick', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedAppCC2\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n SharedOrderFunctions.LoadSelectedAppCC2(viewbagUniquePrefix);\r\n });\r\n\r\n $('#btnLoadSelectedApp' + viewbagUniquePrefix).on('click', function (e) {\r\n SharedOrderFunctions.LoadSelectedApplicant(viewbagUniquePrefix);\r\n });\r\n\r\n $('#btnLoadSelectedAppCC' + viewbagUniquePrefix).on('click', function (e) {\r\n SharedOrderFunctions.LoadSelectedAppCC(viewbagUniquePrefix);\r\n });\r\n\r\n $('#btnLoadSelectedAppCC2' + viewbagUniquePrefix).on('click', function (e) {\r\n SharedOrderFunctions.LoadSelectedAppCC2(viewbagUniquePrefix);\r\n });\r\n\r\n $('a#showAppDetail' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n var id = $('input#Applicant_UID').val();\r\n useFilingCabinet('/Physicians/Detail/' + id);\r\n }\r\n });\r\n\r\n $('a#showAppCCDetail' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n var id = $('input#Applicant_CC_UID').val();\r\n useFilingCabinet('/Physicians/Detail/' + id);\r\n }\r\n });\r\n\r\n $('a#showAppCC2Detail' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n var id = $('input#Applicant_CC_2_UID').val();\r\n useFilingCabinet('/Physicians/Detail/' + id);\r\n }\r\n });\r\n\r\n $('#Applicant_Text').autocomplete({\r\n autoFocus: true,\r\n source: function (request, response) {\r\n SharedOrderFunctions.resetAndSetLoadingApplicantForAutocomplete(\"App\", viewbagUniquePrefix);\r\n\r\n const applicantValue = $('#Applicant_UID').val();\r\n const applicantID = applicantValue === '0' ? null : parseInt(applicantValue);\r\n const applicantCCValue = $('#Applicant_CC_UID').val();\r\n const applicantCCID = applicantCCValue === '0' ? null : parseInt(applicantCCValue);\r\n const applicantCC2Value = $('#Applicant_CC_2_UID').val();\r\n const applicantCC2ID = applicantCC2Value === '0' ? null : parseInt(applicantCC2Value);\r\n\r\n const exclusionIDs = [applicantCCID, applicantCC2ID].filter(id => id !== null);\r\n\r\n const params = new URLSearchParams( { term: request.term } );\r\n exclusionIDs.forEach(exclusionID => {\r\n params.append(\"except\", exclusionID);\r\n });\r\n\r\n fetch('/core/physician/autocomplete?' +\r\n params, {\r\n method: 'GET',\r\n headers: {\r\n 'Accept': 'application/json',\r\n \"X-Requested-With\": \"XMLHttpRequest\"\r\n }})\r\n .then(res => res.json())\r\n .then(data => {\r\n SharedOrderFunctions.setAutocompleteApplicantLoading(false, \"App\", data, response);\r\n });\r\n },\r\n minLength: 2,\r\n delay: 500,\r\n select: function (event, ui) {\r\n event.preventDefault();\r\n\r\n const appId = ui.item.id;\r\n SharedOrderFunctions.LoadApplicantWithID(appId, \"App\", viewbagUniquePrefix);\r\n }\r\n });\r\n\r\n $('#Applicant_ContactID').on('change' , function () {\r\n SharedOrderFunctions.LoadPhyscianExportFormatsForApplicantType('App');\r\n });\r\n\r\n $('#Applicant_CC_Text').autocomplete({\r\n autoFocus: true,\r\n source: function (request, response) {\r\n SharedOrderFunctions.resetAndSetLoadingApplicantForAutocomplete(\"AppCC\", viewbagUniquePrefix);\r\n\r\n const applicantValue = $('#Applicant_UID').val();\r\n const applicantID = applicantValue === '0' ? null : parseInt(applicantValue);\r\n const applicantCCValue = $('#Applicant_CC_UID').val();\r\n const applicantCCID = applicantCCValue === '0' ? null : parseInt(applicantCCValue);\r\n const applicantCC2Value = $('#Applicant_CC_2_UID').val();\r\n const applicantCC2ID = applicantCC2Value === '0' ? null : parseInt(applicantCC2Value);\r\n\r\n const exclusionIDs = [applicantID, applicantCC2ID].filter(id => id !== null);\r\n\r\n const params = new URLSearchParams( { term: request.term } );\r\n exclusionIDs.forEach(exclusionID => {\r\n params.append(\"except\", exclusionID);\r\n });\r\n\r\n fetch('/core/physician/autocomplete?' +\r\n params, {\r\n method: 'GET',\r\n headers: {\r\n 'Accept': 'application/json',\r\n \"X-Requested-With\": \"XMLHttpRequest\"\r\n }})\r\n .then(res => res.json())\r\n .then(data => {\r\n SharedOrderFunctions.setAutocompleteApplicantLoading(false, \"AppCC\", data, response);\r\n });\r\n },\r\n minLength: 2,\r\n delay: 500,\r\n select: function (event, ui) {\r\n event.preventDefault();\r\n\r\n var appCCId = ui.item.id;\r\n SharedOrderFunctions.LoadApplicantWithID(appCCId, \"AppCC\", viewbagUniquePrefix);\r\n }\r\n });\r\n\r\n\r\n $('#Applicant_CC_ContactID').on('change' , function () {\r\n SharedOrderFunctions.LoadPhyscianExportFormatsForApplicantType('AppCC');\r\n });\r\n\r\n $('#Applicant_CC_2_Text').autocomplete({\r\n autoFocus: true,\r\n source: function (request, response) {\r\n SharedOrderFunctions.resetAndSetLoadingApplicantForAutocomplete(\"AppCC2\", viewbagUniquePrefix);\r\n\r\n const applicantValue = $('#Applicant_UID').val();\r\n const applicantID = applicantValue === '0' ? null : parseInt(applicantValue);\r\n const applicantCCValue = $('#Applicant_CC_UID').val();\r\n const applicantCCID = applicantCCValue === '0' ? null : parseInt(applicantCCValue);\r\n const applicantCC2Value = $('#Applicant_CC_2_UID').val();\r\n const applicantCC2ID = applicantCC2Value === '0' ? null : parseInt(applicantCC2Value);\r\n\r\n const exclusionIDs = [applicantID, applicantCCID].filter(id => id !== null);\r\n\r\n const params = new URLSearchParams( { term: request.term } );\r\n exclusionIDs.forEach(exclusionID => {\r\n params.append(\"except\", exclusionID);\r\n });\r\n\r\n fetch('/core/physician/autocomplete?' +\r\n params, {\r\n method: 'GET',\r\n headers: {\r\n 'Accept': 'application/json',\r\n \"X-Requested-With\": \"XMLHttpRequest\"\r\n }})\r\n .then(res => res.json())\r\n .then(data => {\r\n SharedOrderFunctions.setAutocompleteApplicantLoading(false, \"AppCC2\", data, response);\r\n });\r\n },\r\n minLength: 2,\r\n delay: 500,\r\n select: function (event, ui) {\r\n event.preventDefault();\r\n\r\n var appCC2Id = ui.item.id;\r\n SharedOrderFunctions.LoadApplicantWithID(appCC2Id, \"AppCC2\", viewbagUniquePrefix);\r\n }\r\n });\r\n\r\n $('#Applicant_CC_2_ContactID').on('change' , function () {\r\n SharedOrderFunctions.LoadPhyscianExportFormatsForApplicantType('AppCC2');\r\n });\r\n\r\n var m = moment($('#age').html(), \"DD/MM/YYYY\");\r\n if (m.isValid()) {\r\n $('#age').html('(' + moment().diff(m, 'years') + ')');\r\n }\r\n\r\n $('a[href=\"#\"]').on('click', function (e) {\r\n e.preventDefault();\r\n });\r\n\r\n $('div#subPageContent').height($('div#content').height() - 20 - $('div#submitBottom').height());\r\n\r\n $('select').each(function (e) {\r\n if ($(this).attr('value') != null) {\r\n $(this).val($(this).attr('value'));\r\n }\r\n });\r\n\r\n $('textarea').each(function (e) {\r\n if ($(this).attr('value') != null) {\r\n $(this).val($(this).attr('value'));\r\n }\r\n });\r\n\r\n $(\"body\").keydown(function (e) {\r\n if (!$(e.target).is('input')) {\r\n if (e.keyCode == 37) { // left\r\n ScrollLeft();\r\n return false;\r\n } else if (e.keyCode == 39) { // right\r\n ScrollRight();\r\n return false;\r\n }\r\n }\r\n });\r\n\r\n\r\n var filterProcedures = function (e) {\r\n var filter = $('input#searchProcedure').val();\r\n if (filter) {\r\n filter = filter.toLowerCase();\r\n var matches = viewbagListProcedureItems.filter(function (obj) {\r\n return obj.Code.toLowerCase().includes(filter) || obj.FullCode.toLowerCase().includes(filter) || obj.Description.toLowerCase().includes(filter)\r\n || obj.Modality_Text.toLowerCase().includes(filter)\r\n });\r\n $('#emptyProcedures').text(matches.length + $(\"\").html(' ' + resourceProceduresFound).text());\r\n } else {\r\n $('#emptyProcedures').text(viewbagListProcedureItems.length + $(\"\").html(' ' + resourceProceduresFound).text());\r\n }\r\n return false;\r\n }\r\n\r\n $('#searchProcedure')\r\n .change(function () {\r\n filterProcedures();\r\n })\r\n .keyup(function () {\r\n $(this).change();\r\n });\r\n\r\n var onAutoCompleteEnter = false;\r\n $('input#searchProcedure').on('keypress', function (e) {\r\n e.stopImmediatePropagation();\r\n if (e.keyCode == 13 && $(this).val() != \"\") {\r\n if (!onAutoCompleteEnter) {\r\n e.preventDefault();\r\n\r\n var filter = $(this).val().toLowerCase();\r\n var matches = viewbagListProcedureItems.filter(function (obj) {\r\n return obj.Code.toLowerCase().includes(filter) || obj.FullCode.toLowerCase().includes(filter) || obj.Description.toLowerCase().includes(filter)\r\n || obj.Modality_Text.toLowerCase().includes(filter)\r\n });\r\n\r\n if (matches.length > 0) {\r\n\r\n selectProcedure(matches[0].ID);\r\n\r\n $('input#searchProcedure').val(\"\");\r\n $('input#searchProcedure').attr(\"value\", \"\");\r\n filterProcedures();\r\n $('input#searchProcedure').autocomplete(\"close\");\r\n onAutoCompleteEnter = false;\r\n }\r\n } else {\r\n onAutoCompleteEnter = false;\r\n }\r\n return false;\r\n }\r\n });\r\n\r\n\r\n $('input#searchProcedure').autocomplete({\r\n autoFocus: false,\r\n source: function (request, response) {\r\n setAutocompleteInputLoading(true, $('input#searchProcedure'));\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteProcedures\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term,\r\n date: $('#DateOfImplementation').val(),\r\n patientID: modelPatientID,\r\n includeGroups: true\r\n },\r\n success: function (data) {\r\n setAutocompleteInputLoading(false, $('input#searchProcedure'));\r\n if (data.length == 0) {\r\n }\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.Modality_Text + ' ' + item.Code + \" (\" + item.Description + \")\",\r\n value: item.Code,\r\n id: item.IDString\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 1,\r\n select: function (event, ui) {\r\n event.stopPropagation();\r\n onAutoCompleteEnter = true;\r\n if (ui.item.id.indexOf('_') > 0) {\r\n $.each(ui.item.id.split('_'), function (i, y) {\r\n if (y != \"\") {\r\n selectProcedure(y);\r\n }\r\n });\r\n } else {\r\n selectProcedure(ui.item.id);\r\n }\r\n $('input#searchProcedure').val(\"\");\r\n $('input#searchProcedure').attr(\"value\", \"\");\r\n filterProcedures();\r\n event.preventDefault();\r\n },\r\n close: function (event, ui) {\r\n if (event.originalEvent !== undefined) {\r\n if (event.originalEvent.type == \"blur\") {\r\n onAutoCompleteEnter = false;\r\n }\r\n }\r\n }\r\n });\r\n\r\n var selectProcedure = function (procedureID) {\r\n const procedure = _.find(viewbagListProcedureItems, function (obj) {\r\n return obj.ID === parseInt(procedureID)\r\n });\r\n\r\n const id = procedure.ID;\r\n const fullCode = procedure.Description;\r\n const code = procedure.Code;\r\n const color = procedure.Color;\r\n const modality = procedure.Modality_Text;\r\n const useOnDuty = procedure.UseOnDuty;\r\n const procedureTemplateUID = procedure.TemplateUID;\r\n const screeningsTemplateUID = procedure.ScreeningTemplateUID;\r\n const justificationType = procedure.JustificationType;\r\n\r\n let statusToUse = 1;\r\n const existingStatusArr = new Array();\r\n try {\r\n $('.statusDrop').each(function () {\r\n existingStatusArr.push(parseInt($(this).val()));\r\n });\r\n } catch (e) {\r\n }\r\n\r\n const orderStatus = $('#statusList').find('li.default').attr('id');\r\n if (orderStatus != 1) {\r\n statusToUse = parseInt(viewbagDefaultProcedureStatus);\r\n }\r\n\r\n let toAppend = '' + resourceNoPhysiciansFound + ' ';\r\n toAppend += ' ';\r\n\r\n $('table#selectedProcedures').append($(toAppend));\r\n $('.radText').autocomplete(autocompleteRadiologists);\r\n $('.tecText').autocomplete(autocompleteTechnicians);\r\n $('.roomText').autocomplete(autocompleteRooms);\r\n\r\n SetDefaultRadiologist($('table#selectedProcedures').find('tr#' + id).find('td.radiologist'));\r\n SetDefaultTechnician($('table#selectedProcedures').find('tr#' + id).find('td.technician'));\r\n SharedOrderFunctions.SetDefaultRoom($('table#selectedProcedures').find('tr#' + id), true, viewbagDefaultRoomUID, viewbagDefaultRoomText);\r\n\r\n $(this).css('opacity', '0.3');\r\n $('table#selectedProcedures tr#emptyTable').hide();\r\n\r\n SortSelectedProcedures();\r\n SharedOrderFunctions.GetAndSetProcedureExportFormatsForProcedureWithID(id);\r\n\r\n var ul = $tabs.find('ul#tabSource');\r\n\r\n if (procedureTemplateUID == 4 && !ul.find('#openRequestFormTab').length) {\r\n containsRequestForm = true;\r\n showRequestFormTab();\r\n }\r\n\r\n if (viewbagUseMotivationLetters && viewbagUseMotivationLetters === 'True') {\r\n SharedOrderFunctions.checkMotivationLetters();\r\n }\r\n checkPatientProcedureHistory(id);\r\n }\r\n\r\n var index = 0;\r\n\r\n var containsRequestForm = false;\r\n\r\n\r\n $('body').off('click', '#tblProcedureExportFormat td.delete');\r\n $('body').on('click', '#tblProcedureExportFormat td.delete', function (e) {\r\n e.stopImmediatePropagation();\r\n $(this).parent().remove();\r\n SharedOrderFunctions.SortProceduresExportFormats();\r\n });\r\n\r\n $('body').off('click', 'table#selectedProcedures td.delete');\r\n $('body').on('click', 'table#selectedProcedures td.delete', function (e) {\r\n //e.stopImmediatePropagation();\r\n var id = $(this).parent().attr('id');\r\n\r\n var procedureTemplateUID = $(this).parent().find('td.procedure').find('input.template').val();\r\n var procedurecount = 0;\r\n $.each($('table#selectedProcedures').find('tr.selectedProcedureItem').find('td.procedure'), function (index, obj) {\r\n if ($(this).find('input.template').val() == 4) {\r\n procedurecount++;\r\n }\r\n })\r\n\r\n if (procedureTemplateUID == 4 && procedurecount == 1) {\r\n $tabs.find('#openRequestFormTab').remove();\r\n $tabs.tabs(\"refresh\");\r\n containsRequestForm = false;\r\n }\r\n\r\n var totalOfThis = $('table#selectedProcedures').find('tr#' + id).length;\r\n $(this).parent().remove();\r\n var total = $('table#selectedProcedures').find('tr.selectedProcedureItem').length;\r\n if (total == 0) {\r\n $('table#selectedProcedures tr#emptyTable').show();\r\n }\r\n\r\n SortSelectedProcedures();\r\n\r\n if (totalOfThis == 1) {\r\n $('table#tblProcedureExportFormat').find('input.procedureEFProcedureID[value=' + id + ']').parent().parent().remove();\r\n SharedOrderFunctions.SortProceduresExportFormats();\r\n }\r\n\r\n if (useProducts) {\r\n DeleteProductsByDeletingProcedure(id);\r\n }\r\n\r\n if (useChecks) {\r\n DeleteChecksByDeletingProcedure(id);\r\n }\r\n\r\n GetInvoiceInformation(true);\r\n\r\n SharedOrderFunctions.checkOnDuty();\r\n });\r\n\r\n var SortSelectedProcedures = function (e) {\r\n var selected = $('table#selectedProcedures').find('tr.selectedProcedureItem');\r\n $('span#nrSelectedProcedures').text(selected.length);\r\n if (selected.length == 0) {\r\n $('span#nrSelectedProcedures').css('color', '#CD0A0A');\r\n } else {\r\n $('span#nrSelectedProcedures').css('color', '#666');\r\n }\r\n $.each(selected, function (index, obj) {\r\n $(selected[index]).find('input.id').attr('name', 'ListProcedureItems[' + index + '].ID');\r\n $(selected[index]).find('input.modality').attr('name', 'ListProcedureItems[' + index + '].Modality_Text');\r\n $(selected[index]).find('input.color').attr('name', 'ListProcedureItems[' + index + '].Color');\r\n $(selected[index]).find('input.code').attr('name', 'ListProcedureItems[' + index + '].Code');\r\n $(selected[index]).find('input.fullCode').attr('name', 'ListProcedureItems[' + index + '].FullCode');\r\n $(selected[index]).find('input.radUid').attr('name', 'ListProcedureItems[' + index + '].Radiologist_UID');\r\n $(selected[index]).find('input.tecUid').attr('name', 'ListProcedureItems[' + index + '].Technician_UID');\r\n $(selected[index]).find('input.radText').attr('name', 'ListProcedureItems[' + index + '].Radiologist_Text');\r\n $(selected[index]).find('input.tecText').attr('name', 'ListProcedureItems[' + index + '].Technician_Text');\r\n $(selected[index]).find('input.roomUID').attr('name', 'ListProcedureItems[' + index + '].Room_UID');\r\n $(selected[index]).find('input.roomText').attr('name', 'ListProcedureItems[' + index + '].Room_Text');\r\n $(selected[index]).find('input.description').attr('name', 'ListProcedureItems[' + index + '].Description');\r\n $(selected[index]).find('input.useOnDuty').attr('name', 'ListProcedureItems[' + index + '].UseOnDuty');\r\n $(selected[index]).find('input.template').attr('name', 'ListProcedureItems[' + index + '].TemplateUID');\r\n $(selected[index]).find('input.screeningTemplate').attr('name', 'ListProcedureItems[' + index + '].ScreeningTemplateUID');\r\n $(selected[index]).find('input.justificationType').attr('name', 'ListProcedureItems[' + index + '].JustificationType');\r\n $(selected[index]).find('select.statusDrop').attr('name', 'ListProcedureItems[' + index + '].Status_UID');\r\n $(selected[index]).find('input.substitution').attr('id', 'ListProcedureItems_' + index + '__Substitution');\r\n $(selected[index]).find('input.substitution').attr('name', 'ListProcedureItems[' + index + '].Substitution');\r\n $(selected[index]).find('td.substitution').find('input[type=\"hidden\"]').attr('name', 'ListProcedureItems[' + index + '].Substitution');\r\n $(selected[index]).find('input.procImplementation').attr('name', 'ListProcedureItems[' + index + '].Implementation');\r\n $(selected[index]).find('input.procPlanned').attr('name', 'ListProcedureItems[' + index + '].DateTimePlanned');\r\n });\r\n }\r\n\r\n var autocompleteRadiologists = {\r\n autoFocus: true,\r\n source: function (request, response) {\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteRadiologists\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term\r\n },\r\n success: function (data) {\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.FullText,\r\n value: item.FullText,\r\n id: item.ID\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 1,\r\n select: function (event, ui) {\r\n $(this).parent().find('input.radUid').val(ui.item.id);\r\n $(this).parent().find('input.radText').attr('value', ui.item.value);\r\n if ($('input#CheckRadiologist').is(':checked')) {\r\n var selectedProcedures = $('table#selectedProcedures tr.selectedProcedureItem');\r\n if (selectedProcedures.first().get(0) === $(this).parent().parent().get(0)) {\r\n selectedProcedures.each(function (e) {\r\n $(this).find('.radUid').val(ui.item.id);\r\n $(this).find('.radUid').attr('value', ui.item.id);\r\n $(this).find('.radText').val(ui.item.value);\r\n $(this).find('.radText').attr('value', ui.item.value);\r\n });\r\n }\r\n }\r\n GetInvoiceInformation(false, true);\r\n }\r\n };\r\n\r\n var autocompleteRooms = {\r\n autoFocus: true,\r\n source: function (request, response) {\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteRooms\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term,\r\n Site_UID: $('#Site_UID').val()\r\n },\r\n success: function (data) {\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.FullText,\r\n value: item.FullText,\r\n id: item.ID\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 1,\r\n select: function (event, ui) {\r\n $(this).parent().find('input.roomUID').val(ui.item.id);\r\n $(this).parent().find('input.roomText').attr('value', ui.item.value);\r\n\r\n var row = $(this).parent().parent();\r\n\r\n $.ajax({\r\n url: \"/legacy/Json/GetDefaultRadiologistForRoom\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n Room_UID: ui.item.id\r\n },\r\n success: function (data) {\r\n var radUid = data.RadUID;\r\n var radText = data.RadText;\r\n\r\n if ($.trim(radText) != \"\") {\r\n row.find('td.radiologist').find('input.radUid').val(radUid);\r\n row.find('td.radiologist').find('input.radUid').attr('value', radUid);\r\n row.find('td.radiologist').find('input.radText').val(radText);\r\n row.find('td.radiologist').find('input.radText').attr('value', radText);\r\n }\r\n if (useChecks) {\r\n if ($('#GroupChecks').is(':checked')) {\r\n deGroupChecks();\r\n groupChecks();\r\n }\r\n }\r\n }\r\n })\r\n\r\n if ($('input#CheckRoom').is(':checked')) {\r\n var selectedProcedures = $('table#selectedProcedures tr.selectedProcedureItem');\r\n if (selectedProcedures.first().get(0) === $(this).parent().parent().get(0)) {\r\n selectedProcedures.each(function (e) {\r\n $(this).find('.roomUID').val(ui.item.id);\r\n $(this).find('.roomUID').attr('value', ui.item.id);\r\n $(this).find('.roomText').val(ui.item.value);\r\n $(this).find('.roomText').attr('value', ui.item.value);\r\n });\r\n }\r\n }\r\n },\r\n change: function (event, ui) {\r\n if (!ui.item) {\r\n $(this).parent().find('input.roomUID').val(\"\");\r\n $(this).parent().find('input.roomText').val(\"\");\r\n }\r\n }\r\n };\r\n\r\n var autocompleteTechnicians = {\r\n autoFocus: true,\r\n source: function (request, response) {\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteTechnicians\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term\r\n },\r\n success: function (data) {\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.FullText,\r\n value: item.FullText,\r\n id: item.ID\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 1,\r\n select: function (event, ui) {\r\n $(this).parent().find('input.tecUid').val(ui.item.id);\r\n $(this).parent().find('input.tecText').attr('value', ui.item.value);\r\n if ($('input#CheckTechnician').is(':checked')) {\r\n var selectedProcedures = $('table#selectedProcedures tr.selectedProcedureItem');\r\n if (selectedProcedures.first().get(0) === $(this).parent().parent().get(0)) {\r\n selectedProcedures.each(function (e) {\r\n $(this).find('.tecUid').val(ui.item.id);\r\n $(this).find('.tecUid').attr('value', ui.item.id);\r\n $(this).find('.tecText').val(ui.item.value);\r\n $(this).find('.tecText').attr('value', ui.item.value);\r\n });\r\n }\r\n }\r\n },\r\n change: function (event, ui) {\r\n if (!ui.item) {\r\n $(this).parent().find('input.tecUid').val(\"\");\r\n $(this).parent().find('input.tecText').val(\"\");\r\n }\r\n }\r\n };\r\n\r\n $('input#CheckRadiologist').on('change', function (e) {\r\n if ($('input#CheckRadiologist').is(':checked')) {\r\n $('table#selectedProcedures tr.selectedProcedureItem').each(function (e) {\r\n SetDefaultRadiologist($(this));\r\n });\r\n }\r\n\r\n GetInvoiceInformation();\r\n\r\n });\r\n\r\n $('input#CheckTechnician').on('change', function (e) {\r\n if ($('input#CheckTechnician').is(':checked')) {\r\n $('table#selectedProcedures tr.selectedProcedureItem').each(function (e) {\r\n SetDefaultTechnician($(this));\r\n });\r\n }\r\n });\r\n\r\n $('input#CheckRoom').on('change', function (e) {\r\n if ($('input#CheckRoom').is(':checked')) {\r\n $('table#selectedProcedures tr.selectedProcedureItem').each(function (e) {\r\n SharedOrderFunctions.SetDefaultRoom($(this), false, viewbagDefaultRoomUID, viewbagDefaultRoomText);\r\n });\r\n }\r\n });\r\n\r\n var defaultRadUid = viewbagDefaultRadiologistUID;\r\n var defaultRadText = viewbagDefaultRadiologistText;\r\n var SetDefaultRadiologist = function (row) {\r\n var radUid;\r\n var radText;\r\n\r\n if ($('input#CheckRadiologist').is(':checked')) {\r\n radUid = $('table#selectedProcedures tr.selectedProcedureItem').first().find('input.radUid').val();\r\n radText = $('table#selectedProcedures tr.selectedProcedureItem').first().find('input.radText').val();\r\n if (radUid == \"\") {\r\n radUid = defaultRadUid;\r\n radText = defaultRadText;\r\n }\r\n } else {\r\n radUid = defaultRadUid;\r\n radText = defaultRadText;\r\n }\r\n\r\n row.find('.radUid').val(radUid);\r\n row.find('.radUid').attr('value', radUid);\r\n row.find('.radText').val(radText);\r\n row.find('.radText').attr('value', radText);\r\n }\r\n\r\n var defaultTecUid = viewbagDefaultTechnicianUID;\r\n var defaultTecText = viewbagDefaultTechnicianText;\r\n var SetDefaultTechnician = function (row, uid, text) {\r\n var tecUid;\r\n var tecText;\r\n\r\n if ($('input#CheckTechnician').is(':checked')) {\r\n tecUid = $('table#selectedProcedures tr.selectedProcedureItem').first().find('input.tecUid').val();\r\n tecText = $('table#selectedProcedures tr.selectedProcedureItem').first().find('input.tecText').val();\r\n if (tecUid == \"\") {\r\n tecUid = defaultTecUid;\r\n tecText = defaultTecText;\r\n }\r\n } else {\r\n tecUid = defaultTecUid;\r\n tecText = defaultTecText;\r\n }\r\n\r\n row.find('.tecUid').val(tecUid);\r\n row.find('.tecUid').attr('value', tecUid);\r\n row.find('.tecText').val(tecText);\r\n row.find('.tecText').attr('value', tecText);\r\n }\r\n\r\n var SetLabels = function () {\r\n if ($('#Site_UID').length > 0) {\r\n $.ajax({\r\n url: \"/legacy/Orders/GetLabelsAddForSite\",\r\n type: \"GET\",\r\n dataType: \"html\",\r\n data: {\r\n Site_UID: $('#Site_UID').val()\r\n },\r\n async: true,\r\n success: function (data) {\r\n if (data) {\r\n $('div#labelsDiv').html(data);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n var SetME = function () {\r\n if ($('#Site_UID').length > 0) {\r\n $.ajax({\r\n url: \"/legacy/Json/GetMEForSite\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n Site_UID: $('#Site_UID').val()\r\n },\r\n async: true,\r\n success: function (data) {\r\n if (data) {\r\n $('#Idgkb').val(data.ME);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n $('#Site_UID').on('change', function (e) {\r\n $('table#selectedProcedures tr.selectedProcedureItem').each(function (e) {\r\n SharedOrderFunctions.SetDefaultRoom($(this), false, viewbagDefaultRoomUID, viewbagDefaultRoomText);\r\n });\r\n SetME();\r\n SetLabels();\r\n });\r\n\r\n $('#subFieldProcedures').keypress(function (e) {\r\n if (e.keyCode == 13) {\r\n return false;\r\n }\r\n });\r\n\r\n $('#tblOrderExportFormats').on('click', 'td.delete', function (e) {\r\n $(this).parent().remove();\r\n $('#DropOrderExportFormats').append($('').val($(this).parent().find('input.orderEFID').val() + \"_\" + $(this).parent().find('input.orderEFOrderTriggerStatus').val() + \"_\" + $(this).parent().find('input.orderEFReportTriggerStatus').val()).html( $(this).parent().find('input.orderEFName').val() + ' | ' + $(this).parent().find('input.triggerStatus').val()));\r\n SharedOrderFunctions.sortOrderExportFormats();\r\n });\r\n\r\n $('#tblOrderExportFormatsAdd td.add').on('click', function (e) {\r\n var val = $('#DropOrderExportFormats').val();\r\n if (val != \"-1\") {\r\n var text = $('#DropOrderExportFormats option:selected').text();\r\n var amount = $(this).parent().find('input.orderEFAmount').spinner(\"value\");\r\n var triggerStatus = text.substring(text.indexOf(\"|\")+1);\r\n\r\n var efID = val.split(\"_\")[0];\r\n var orderTriggerStatusID = val.split(\"_\")[1];\r\n var reportTriggerStatusID = val.split(\"_\")[2];\r\n\r\n var toAppend = '' + modality + ' ' + code + '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += ' ';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += ' ';\r\n toAppend += ' ';\r\n toAppend += ' ';\r\n toAppend += ' ';\r\n toAppend += ' ';\r\n toAppend += ' Delete ';\r\n $('#tblOrderExportFormats').append(toAppend);\r\n $('.spinner').spinner(spinnerOptions);\r\n $('.spinner').ForceNumericOnly();\r\n $('#DropOrderExportFormats option[value=\"' + val + '\"]').remove();\r\n SharedOrderFunctions.sortOrderExportFormats();\r\n }\r\n });\r\n\r\n $('#tblPhysExportFormatsApp').on('click', 'td.delete', function (e) {\r\n $(this).parent().remove();\r\n SharedOrderFunctions.SortPhysExportFormats('App');\r\n });\r\n\r\n $('#tblPhysExportFormatsAppCC').on('click', 'td.delete', function (e) {\r\n $(this).parent().remove();\r\n SharedOrderFunctions.SortPhysExportFormats('AppCC');\r\n });\r\n\r\n $('#tblPhysExportFormatsAppCC2').on('click', 'td.delete', function (e) {\r\n $(this).parent().remove();\r\n SharedOrderFunctions.SortPhysExportFormats('AppCC2');\r\n });\r\n\r\n if ($('input#Applicant_UID').val() != \"0\") {\r\n SharedOrderFunctions.setActiveApplicantDetailAndRemoveMenuOptions(true, \"App\", viewbagUniquePrefix);\r\n }\r\n\r\n if ($('input#Applicant_CC_UID').val() != \"0\") {\r\n SharedOrderFunctions.setActiveApplicantDetailAndRemoveMenuOptions(true, \"AppCC\", viewbagUniquePrefix);\r\n }\r\n\r\n if ($('input#Applicant_CC_2_UID').val() != \"0\") {\r\n SharedOrderFunctions.setActiveApplicantDetailAndRemoveMenuOptions(true, \"AppCC2\", viewbagUniquePrefix);\r\n }\r\n\r\n $('.spinner').spinner(spinnerOptions);\r\n $('.spinner').ForceNumericOnly();\r\n $('.spinner2').spinner(spinnerOptions2);\r\n $('.spinner2').ForceNumericOnly();\r\n $('.tecText').autocomplete(autocompleteTechnicians);\r\n $('.radText').autocomplete(autocompleteRadiologists);\r\n $('.roomText').autocomplete(autocompleteRooms);\r\n\r\n SortSelectedProcedures();\r\n SharedOrderFunctions.SortPhysExportFormats('App');\r\n SharedOrderFunctions.SortPhysExportFormats('AppCC');\r\n SharedOrderFunctions.SortPhysExportFormats('AppCC2');\r\n SharedOrderFunctions.SortProceduresExportFormats();\r\n\r\n $(\"#PopupPatientHealthInsuranceSpecificSearch\").change(function () {\r\n\r\n $('#PopupPatientHealthInsuranceText').autocomplete(\"search\");\r\n });\r\n\r\n $('#PopupPatientHealthInsuranceText').autocomplete({\r\n autoFocus: false,\r\n source: function (request, response) {\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteHealthInsurances\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term,\r\n specific: $('#PopupPatientHealthInsuranceSpecificSearch').is(':checked')\r\n },\r\n success: function (data) {\r\n if (data.length == 0) {\r\n $('#PopupPatientHealthInsuranceID').val(\"0\");\r\n $('#PopupPatientHealthInsuranceText').css('border-color', '#CD0A0A');\r\n }\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.FullText,\r\n value: item.FullText,\r\n id: item.ID\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 2,\r\n select: function (event, ui) {\r\n $('#PopupPatientHealthInsuranceID').val(ui.item.id);\r\n $('#PopupPatientHealthInsuranceText').attr('value', ui.item.value);\r\n $('#PopupPatientHealthInsuranceText').css('border-color', '#999');\r\n }\r\n });\r\n\r\n if (!BelgianLayout) {\r\n $tabs.find('#openInvoiceTab').remove();\r\n $tabs.tabs(\"refresh\");\r\n }\r\n\r\n $('div#invoiceTab').on('change', 'input#OnDuty, ' +\r\n 'input#WIGW,' +\r\n ' input#AmbulantHospitalized,' +\r\n ' input#FreeOfContribution,' +\r\n ' input#FreeOfCharge,' +\r\n ' input#InvoiceCumulRules,' +\r\n ' input#InvoiceSupplement,' +\r\n ' input#InvoiceClaustrophobia,' +\r\n ' input#InvoiceCertificate'\r\n , function (e) {\r\n e.stopImmediatePropagation();\r\n\r\n GetInvoiceInformation(true);\r\n }\r\n );\r\n\r\n var SetInvoiceSituationParameters = function (value) {\r\n switch (value) {\r\n default:\r\n //NORMAL\r\n case \"1\":\r\n $('div#invoiceTab div#invoiceCompany').hide();\r\n $('div#invoiceTab div#invoiceEmployer').hide();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceFreeOfCharge label, div#invoiceTab div#invoiceFreeOfCharge input').show();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', true);\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').hide();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules input').prop('checked', true);\r\n companyFilled = false;\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').hide();\r\n\r\n break;\r\n //MISC\r\n case \"2\":\r\n $('div#invoiceTab div#invoiceCompany').hide();\r\n $('div#invoiceTab div#invoiceEmployer').hide();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceFreeOfCharge label, div#invoiceTab div#invoiceFreeOfCharge input').hide();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').hide();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').prop('checked', true).parent().show();\r\n invoiceMethod = 1;\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', false);\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').hide();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules input').prop('checked', true);\r\n companyFilled = false;\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').hide();\r\n\r\n break;\r\n //SOCIAL WELFARE\r\n case \"3\":\r\n $('div#invoiceTab div#invoiceCompany').show();\r\n $('div#invoiceTab div#invoiceEmployer').hide();\r\n $('div#invoiceTab div#invoiceCompany span.required').show();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceFreeOfCharge label, div#invoiceTab div#invoiceFreeOfCharge input').hide();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').hide();\r\n if (invoiceMethod > 2) {\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').prop('checked', true);\r\n invoiceMethod = 1;\r\n }\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').parent().show();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"2\"]').parent().show();\r\n\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', true);\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').hide();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules input').prop('checked', true);\r\n companyFilled = false;\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').hide();\r\n\r\n break;\r\n //EXPERTISE\r\n case \"4\":\r\n $('div#invoiceTab div#invoiceCompany').show();\r\n $('div#invoiceTab div#invoiceEmployer').show();\r\n $('div#invoiceTab div#invoiceCompany span.required').show();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', false);\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').hide();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').prop('checked', true).parent().show();\r\n invoiceMethod = 1;\r\n $('div#invoiceTab div#invoiceFreeOfCharge label, div#invoiceTab div#invoiceFreeOfCharge input').show();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').show();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules input').prop('checked', false);\r\n companyFilled = false;\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').hide();\r\n\r\n break;\r\n //INSURANCE COMPANY\r\n case \"5\":\r\n $('div#invoiceTab div#invoiceCompany').show();\r\n $('div#invoiceTab div#invoiceEmployer').show();\r\n $('div#invoiceTab div#invoiceCompany span.required').show();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', false);\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').hide();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').prop('checked', true).parent().show();\r\n invoiceMethod = 1;\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').show();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').show();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules input').prop('checked', true);\r\n companyFilled = false;\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').hide();\r\n\r\n break;\r\n //OTHER\r\n case \"6\":\r\n $('div#invoiceTab div#invoiceCompany').show();\r\n $('div#invoiceTab div#invoiceCompany span.required').hide();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', true);\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').hide();\r\n if (invoiceMethod > 2) {\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').prop('checked', true);\r\n invoiceMethod = 1;\r\n }\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').parent().show();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"2\"]').parent().show();\r\n\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').hide();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').show();\r\n\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').show();\r\n\r\n break;\r\n }\r\n }\r\n\r\n SetInvoiceSituationParameters($('select#InvoiceSituation_UID').val());\r\n\r\n $('div#invoiceTab').on('change', 'select#InvoiceSituation_UID', function (e) {\r\n SetInvoiceSituationParameters($(this).val());\r\n invoiceMethod = $('input[name=\"InvoicePaymentMethod\"]:checked').val();\r\n if (invoiceMethod == 2 || invoiceMethod == 4) {\r\n $('input#InvoiceCertificate').prop('checked', true);\r\n $('div#invoiceInvoiceCertificate').hide();\r\n } else {\r\n if ($(this).val() == \"3\" || $(this).val() == \"6\") {\r\n $('input#InvoiceCertificate').prop('checked', true);\r\n $('div#invoiceInvoiceCertificate').show();\r\n }\r\n }\r\n SetHealthInsuranceParameters(invoiceMethod);\r\n $('input#InvoiceCompany_Text').val(\"\");\r\n $('input#InvoiceCompany_UID').val(\"0\");\r\n\r\n GetInvoiceInformation(true);\r\n });\r\n\r\n $('div#invoiceTab').on('click', 'span.refreshAmountPatient', function (e) {\r\n GetInvoiceInformation(true);\r\n });\r\n\r\n $('div#invoiceTab').on('click', 'span.refreshTotalAmount', function (e) {\r\n GetInvoiceInformation(true);\r\n });\r\n\r\n $('form#addOrderForm').on('submit', function (e) {\r\n if ($('div#invoiceTab input.cleanInput').is(':focus')) {\r\n e.preventDefault();\r\n return false;\r\n }\r\n });\r\n\r\n $('#scanOrder').tooltip({\r\n tooltipClass: 'jqueryTooltip',\r\n content: function () {\r\n return resourceScanOrderValidationMessage.toUpperCase();\r\n },\r\n disabled: true,\r\n position: {\r\n my: \"left top\",\r\n at: \"left bottom\"\r\n },\r\n close: function (event, ui) {\r\n $('.jqueryTooltip').remove();\r\n },\r\n show: function (event, ui) {\r\n $('.jqueryTooltip').remove();\r\n }\r\n });\r\n\r\n let validateOrderImplementationAddAjax;\r\n $('input#DateOfImplementation').bind('input', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n\r\n SharedOrderFunctions.validateOrderImplementationDate($(this), validateOrderImplementationAddAjax, useProducts, modelPatientID);\r\n });\r\n\r\n\r\n\r\n let validateProcImplementationAddAjax;\r\n $('body').on('keyup', '.procImplementation', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n\r\n SharedOrderFunctions.validateProcedureImplementationDate($(this), validateProcImplementationAddAjax);\r\n });\r\n\r\n $('div#invoiceTab').on('change', 'input[name=InvoicePaymentMethod]:radio', function (e) {\r\n e.stopImmediatePropagation();\r\n $('input[type=radio][name=InvoicePaymentMethod]').removeAttr('checked');\r\n $('input[type=radio][name=InvoicePaymentMethod]').removeProp('checked');\r\n $(this).attr('checked', 'checked');\r\n $(this).prop('checked', true);\r\n\r\n invoiceMethod = $('input[name=\"InvoicePaymentMethod\"]:checked').val();\r\n if (invoiceMethod == 2 || invoiceMethod == 4) {\r\n $('input#InvoiceCertificate').prop('checked', false);\r\n $('div#invoiceInvoiceCertificate').hide();\r\n } else {\r\n var selectedInvoice = $('select#InvoiceSituation_UID').val();\r\n if (selectedInvoice == \"3\" || selectedInvoice == \"6\") {\r\n $('input#InvoiceCertificate').prop('checked', true);\r\n $('div#invoiceInvoiceCertificate').show();\r\n }\r\n }\r\n SetHealthInsuranceParameters(invoiceMethod);\r\n GetInvoiceInformation(true);\r\n });\r\n\r\n $('#InvoiceCompany_Text').autocomplete({\r\n autoFocus: false,\r\n source: function (request, response) {\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteCompany\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term,\r\n invoiceSituation_UID: $('select#InvoiceSituation_UID').val()\r\n },\r\n success: function (data) {\r\n if (data.length == 0) {\r\n $('#InvoiceCompany_UID').val(\"0\");\r\n $('a#showCompanyDetail' + viewbagUniquePrefix).addClass('inActive');\r\n $('a#removeCompany' + viewbagUniquePrefix).addClass('inActive');\r\n $('#InvoiceCompany_Text').css('border-color', '#CD0A0A');\r\n }\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.FullText,\r\n value: item.FullText,\r\n id: item.ID\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 1,\r\n select: function (event, ui) {\r\n $('#InvoiceCompany_UID').val(ui.item.id);\r\n $('a#showCompanyDetail' + viewbagUniquePrefix).removeClass('inActive');\r\n $('a#removeCompany' + viewbagUniquePrefix).removeClass('inActive');\r\n $('#InvoiceCompany_Text').attr('value', ui.item.value);\r\n $('#InvoiceCompany_Text').css('border-color', '#999');\r\n if ($('select#InvoiceSituation_UID').val() == 6) {\r\n companyFilled = true;\r\n\r\n GetInvoiceInformation();\r\n }\r\n }\r\n });\r\n\r\n $('#divFindCompany' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n modal: true,\r\n appendTo: \"#contentView\",\r\n title: $(\"\").html(resourcedialogFindCompany).text()\r\n });\r\n\r\n $('a#showCompanyDialog' + viewbagUniquePrefix).on('click', function (e) {\r\n $('#divFindCompany' + viewbagUniquePrefix).dialog(\"open\");\r\n });\r\n\r\n $('button#btnCloseCompanyDialog' + viewbagUniquePrefix).on('click', function (e) {\r\n $('#divFindCompany' + viewbagUniquePrefix).dialog(\"close\");\r\n });\r\n\r\n $('#txtFindCompanyName' + viewbagUniquePrefix).on('keyup', function (e) {\r\n findCompanies();\r\n });\r\n $('#txtFindCompanyAddress' + viewbagUniquePrefix).on('keyup', function (e) {\r\n findCompanies();\r\n });\r\n\r\n var findCompanies = function (e) {\r\n $.ajax({\r\n type: 'POST',\r\n url: '/legacy/Orders/FindCompaniesForGrid',\r\n data: {\r\n Name: $('#txtFindCompanyName' + viewbagUniquePrefix).val(),\r\n Address: $('#txtFindCompanyAddress' + viewbagUniquePrefix).val(),\r\n InvoiceSituation_UID: $('select#InvoiceSituation_UID').val()\r\n },\r\n dataType: 'json',\r\n success:\r\n function (data) {\r\n $('#gridFindCompany' + viewbagUniquePrefix + ' tr:not(.tableHeader)').remove();\r\n $(\"#btnLoadSelectedCompany\" + viewbagUniquePrefix).attr(\"disabled\", true);\r\n if (data.items.length > 0) {\r\n $.each(data.items, function (e) {\r\n $('#gridFindCompany' + viewbagUniquePrefix).append('' + text.substring(0, text.indexOf(\"|\")-1);\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += ' ';\r\n toAppend += ' ' + triggerStatus + '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += ' resourceDelete ');\r\n });\r\n } else {\r\n $('#gridFindCompany' + viewbagUniquePrefix).append('' + this.ID + ' ' + this.FullName + ' ' + this.Address + ' ');\r\n }\r\n }\r\n });\r\n }\r\n\r\n $('#gridFindCompany' + viewbagUniquePrefix).on('click', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedCompany\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n });\r\n\r\n $('#gridFindCompany' + viewbagUniquePrefix).on('dblclick', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedCompany\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n LoadSelectedCompany();\r\n });\r\n\r\n $('#btnLoadSelectedCompany' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($('select#InvoiceSituation_UID').val() == 6) {\r\n companyFilled = true;\r\n\r\n GetInvoiceInformation();\r\n }\r\n LoadSelectedCompany();\r\n });\r\n\r\n var LoadSelectedCompany = function (e) {\r\n var id = $('#gridFindCompany' + viewbagUniquePrefix).find('tr.focus').find('td.rowId').html();\r\n var name = $('#gridFindCompany' + viewbagUniquePrefix).find('tr.focus').find('td.rowName').html();\r\n var address = $('#gridFindCompany' + viewbagUniquePrefix).find('tr.focus').find('td.rowAddress').html();\r\n $('#divFindCompany' + viewbagUniquePrefix).dialog(\"close\");\r\n $('input#InvoiceCompany_Text').attr('value', name + \" - \" + address);\r\n $('input#InvoiceCompany_Text').val(name + \" - \" + address);\r\n $('input#InvoiceCompany_UID').attr('value', id);\r\n $('a#showCompanyDetail' + viewbagUniquePrefix).removeClass('inActive');\r\n $('a#removeCompany' + viewbagUniquePrefix).removeClass('inActive');\r\n $('#InvoiceCompany_Text').css('border-color', '#999');\r\n }\r\n\r\n $('a#removeCompany' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n $('input#InvoiceCompany_UID').val(\"0\");\r\n $('input#InvoiceCompany_Text').val(\"\");\r\n $('input#InvoiceCompany_Text').attr('value', \"\");\r\n $(this).addClass('inActive');\r\n $('a#showCompanyDetail' + viewbagUniquePrefix).addClass('inActive');\r\n }\r\n if ($('select#InvoiceSituation_UID').val() == 6) {\r\n companyFilled = false;\r\n\r\n GetInvoiceInformation();\r\n }\r\n });\r\n\r\n $('a#showCompanyDetail' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n var id = $('input#InvoiceCompany_UID').val();\r\n useFilingCabinet('/Companies/Detail/' + id);\r\n }\r\n });\r\n\r\n $('#InvoiceCompany_Text').on('keyup', function (e) {\r\n if ($('select#InvoiceSituation_UID').val() == 6) {\r\n if ($(this).val() == \"\") {\r\n companyFilled = false;\r\n\r\n GetInvoiceInformation();\r\n }\r\n }\r\n });\r\n\r\n var SetHealthInsuranceParameters = function (paymentMethod) {\r\n if (paymentMethod == 2 || paymentMethod == 4) {\r\n $('#healthInsuranceParams span.none').addClass('noneRequired');\r\n } else {\r\n $('#healthInsuranceParams span.none').removeClass('noneRequired');\r\n }\r\n }\r\n\r\n\r\n $('.infoHoverPopup').hide();\r\n\r\n $('#dialogConfirmInvoice' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n modal: true,\r\n appendTo: '#addOrderForm',\r\n beforeClose: function () {\r\n var close = SharedOrderFunctions.ValidatePaymentPlan();\r\n if (!close) {\r\n var validation = $('#dialogConfirmInvoice' + viewbagUniquePrefix).find('span.validation');\r\n validation.text(resourceInvalidPaymentPlan);\r\n validation.show();\r\n }\r\n else\r\n $('.newPaymentRow').remove();\r\n return close;\r\n },\r\n title: $(\"\").html(resourceConfirmInvoice).text()\r\n });\r\n\r\n $('input#AddPaymentInput').ForcePositiveNegativeNumericOnly();\r\n $('input#AddPaymentPlanInput').ForcePositiveNegativeNumericOnly();\r\n\r\n var SortPaymentItems = function () {\r\n var payments = $('#donePayments table.donePayment').find('.paymentRow');\r\n $.each(payments, function (index, obj) {\r\n $(payments[index]).find('input.hiddenDonePaymentValue').attr('name', 'ListPaymentItem[' + index + '].Amount');\r\n $(payments[index]).find('input.hiddenDonePaymentMethod').attr('name', 'ListPaymentItem[' + index + '].Method');\r\n });\r\n }\r\n\r\n $('input#confirmInvoiceButton').on('click', function (e) {\r\n SharedOrderFunctions.ShowConfirmInvoiceDialog();\r\n });\r\n\r\n $('#btnCloseConfirmInvoice' + viewbagUniquePrefix).on('click', function (e) {\r\n if (SharedOrderFunctions.ValidatePaymentPlan()) {\r\n $('#dialogConfirmInvoice' + viewbagUniquePrefix).dialog('close');\r\n $('.newPaymentRow').remove();\r\n } else {\r\n var validation = $('#dialogConfirmInvoice' + viewbagUniquePrefix).find('span.validation');\r\n validation.text(resourceInvalidPaymentPlan);\r\n validation.show();\r\n return false;\r\n }\r\n });\r\n\r\n $('input#AddPaymentInput').on('keypress', function (e) {\r\n if (e.keyCode == 13) {\r\n $('span#btnAddPayment').trigger('click');\r\n return false;\r\n }\r\n });\r\n\r\n $('input#AddPaymentPlanInput').on('keypress', function (e) {\r\n if (e.keyCode == 13) {\r\n $('span#btnAddPaymentPlan').trigger('click');\r\n return false;\r\n }\r\n });\r\n\r\n $('input#AddPaymentPlanDate').on('keypress', function (e) {\r\n if (e.keyCode == 13) {\r\n $('span#btnAddPaymentPlan').trigger('click');\r\n return false;\r\n }\r\n });\r\n\r\n $('select#PayedByMethod').on('keypress', function (e) {\r\n if (e.keyCode == 13) {\r\n $('span#btnAddPayment').trigger('click');\r\n return false;\r\n }\r\n });\r\n\r\n $('dd#donePayments table.donePayment').on('click', 'td.delete', function (e) {\r\n $(this).parent().remove();\r\n SharedOrderFunctions.CalculateInvoiceAmounts();\r\n SortPaymentItems();\r\n });\r\n\r\n $('span#btnAddPayment').on('click', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n var dialog = $('#dialogConfirmInvoice' + viewbagUniquePrefix);\r\n var validation = dialog.find('span.validation');\r\n var amount = $('input#AddPaymentInput').val();\r\n var amountToPay = dialog.find('#stillToPay span').text();\r\n\r\n if (!$.isNumeric(amount)) {\r\n validation.text(resourceErrorValidAmount);\r\n validation.show();\r\n return false;\r\n } else if (parseFloat(amount, 10) > parseFloat(amountToPay, 10)) {\r\n validation.text(resourceErrorValidAmount);\r\n validation.show();\r\n return false;\r\n }\r\n\r\n var amountNumber = parseFloat(amount, 10);\r\n\r\n var selectedMethod = $(\"#PayedByMethod option:selected\").text();\r\n var selectedMethodID = $(\"#PayedByMethod\").val();\r\n\r\n var donePayments = $('dd#donePayments table.donePayment');\r\n\r\n var lineToAdd = 'resourceNoCompaniesFound ';\r\n\r\n donePayments.append(lineToAdd);\r\n\r\n SharedOrderFunctions.CalculateInvoiceAmounts();\r\n SortPaymentItems();\r\n });\r\n\r\n $('dd#donePaymentsPlan table.donePaymentPlan').on('click', 'td.delete', function (e) {\r\n var dialog = $('#dialogConfirmInvoice' + viewbagUniquePrefix);\r\n $(this).parent().remove();\r\n dialog.find('.toAddPaymentPlan').show();\r\n SharedOrderFunctions.CalculateInvoiceAmounts();\r\n SharedOrderFunctions.SortPaymentPlanItems();\r\n });\r\n\r\n $('span#btnAddPaymentPlan').on('click', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n var dialog = $('#dialogConfirmInvoice' + viewbagUniquePrefix);\r\n var validation = dialog.find('span.validation');\r\n var amount = parseFloat($('input#AddPaymentPlanInput').val());\r\n var dueDate = $('input#AddPaymentPlanDate').val();\r\n var amountPaymentPlan = parseFloat(dialog.find('#totalDonePaymentsPlan span').text());\r\n var totalAmount = parseFloat(dialog.find('dd#totalAmount span').text());\r\n\r\n if (!$.isNumeric(amount) || amount <= 0) {\r\n validation.text(htmlDecode(resourceErrorValidAmount));\r\n validation.show();\r\n return false;\r\n } else if (parseFloat((amount + amountPaymentPlan).toFixed(2)) > parseFloat(totalAmount.toFixed(2))) {\r\n validation.text(htmlDecode(resourceErrorValidAmount));\r\n validation.show();\r\n return false;\r\n }\r\n\r\n var dueDateMoment = moment(dueDate, \"DD/MM/YYYY\", true);\r\n if (dueDateMoment == null || !dueDateMoment.isValid()) {\r\n validation.text(resourceInvalidDueDate);\r\n validation.show();\r\n return false;\r\n }\r\n\r\n var donePayments = $('dd#donePaymentsPlan table.donePaymentPlan');\r\n\r\n var paymentPlanLength = $(\".donePaymentPlan tr\").length - 1;\r\n var lineToAdd = '€ ' + amountNumber.toFixed(2).toString();\r\n lineToAdd += ' ';\r\n lineToAdd += '' + selectedMethod + ' ';\r\n lineToAdd += ' ';\r\n\r\n donePayments.append(lineToAdd);\r\n\r\n SharedOrderFunctions.CalculateInvoiceAmounts();\r\n SharedOrderFunctions.SortPaymentPlanItems();\r\n });\r\n\r\n $('#btnConfirmInvoice' + viewbagUniquePrefix).on('click', function (e) {\r\n SharedOrderFunctions.ConfirmInvoice(viewbagUniquePrefix);\r\n });\r\n\r\n $('#btnConfirmPrepayment' + viewbagUniquePrefix).on('click', function (e) {\r\n if (SharedOrderFunctions.ValidatePaymentPlan()) {\r\n $('input#ConfirmInvoice').val(\"false\");\r\n $('input#ConfirmInvoice').attr('value', \"false\");\r\n $('input#ConfirmPrepayment').val(\"true\");\r\n $('input#ConfirmPrepayment').attr('value', \"true\");\r\n\r\n $('#btnConfirmPrepayment' + viewbagUniquePrefix).prop('disabled', true);\r\n\r\n SharedOrderFunctions.ConfirmInvoiceFunctionality();\r\n } else {\r\n var validation = $('#dialogConfirmInvoice' + viewbagUniquePrefix).find('span.validation');\r\n validation.text(resourceInvalidPaymentPlan);\r\n validation.show();\r\n return false;\r\n }\r\n });\r\n\r\n\r\n // TODO\r\n var checkIfOkToSave = function (confirmInvoice) {\r\n $('#loading').show();\r\n\r\n if(!SharedOrderFunctions.saveChecker.canBeSaved())\r\n return;\r\n\r\n const amountScans = $('.scannedOrderHolder' + '').length;\r\n\r\n if (viewbagShowScanWarning == 'True' && amountScans == 0) {\r\n gConfirmInvoice = confirmInvoice;\r\n $('#dialogScanWarning' + viewbagUniquePrefix).dialog('open');\r\n } else {\r\n saveOrder(confirmInvoice);\r\n }\r\n }\r\n\r\n var saveOrder = function (confirmInvoice) {\r\n if (confirmInvoice) {\r\n var dialog = $('#dialogConfirmInvoice' + viewbagUniquePrefix);\r\n var validation = dialog.find('span.validation');\r\n validation.hide();\r\n validation.text(\"\");\r\n\r\n if ($('.invoiceCertificateNumber').is(':visible')) {\r\n var number = $('input#InvoiceCertificateNumber').val();\r\n if (!$.isNumeric(number)) {\r\n validation.text(resourceErrorValidNumber);\r\n validation.show();\r\n\r\n $('#btnConfirmInvoice' + viewbagUniquePrefix).prop('disabled', false);\r\n $('#btnConfirmPrepayment' + viewbagUniquePrefix).prop('disabled', false);\r\n\r\n return false;\r\n }\r\n }\r\n\r\n $('form#addOrderForm').submit();\r\n } else {\r\n if (containsRequestForm) {\r\n if (viewbagEnforceValidateRequestform == 'True') {\r\n if (!ValidateRequestFormInputFields(false)) {\r\n $('a[href=\"#requestFormTabContent\"]').trigger('click');\r\n $(\"#request #validationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n } else {\r\n if (!ValidateRequestFormInputFieldsNonRequired()) {\r\n $('a[href=\"#requestFormTabContent\"]').trigger('click');\r\n $(\"#request #validationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n }\r\n }\r\n\r\n $('input#ConfirmInvoice').val(\"false\");\r\n $('input#ConfirmInvoice').attr('value', \"false\");\r\n $('input#ConfirmPrepayment').val(\"false\");\r\n $('input#ConfirmPrepayment').attr('value', \"false\");\r\n\r\n if (modelPatientTemporary == \"True\") {\r\n SharedOrderFunctions.FindPatientsToMergeForOrder(viewbagUniquePrefix, modelPatientID);\r\n $('#divMergePatient' + viewbagUniquePrefix).dialog('open');\r\n } else {\r\n $('form#addOrderForm').submit();\r\n }\r\n }\r\n }\r\n\r\n\r\n $('#btnAddOrder').on('click', function (e) {\r\n SharedOrderFunctions.saveChecker.queueSave(() => checkIfOkToSave(false));\r\n });\r\n\r\n SortPaymentItems();\r\n SharedOrderFunctions.SortPaymentPlanItems();\r\n\r\n $('.initialFocus').focus();\r\n\r\n var SwitchTabs = function (e) {\r\n if ($tabs !== undefined) {\r\n var activeTab = 0;\r\n $(\".ui-tabs-panel\").each(function (i, tab) {\r\n if ($(tab).attr('aria-expanded') == \"true\") {\r\n activeTab = i;\r\n }\r\n });\r\n var toActivateTab = activeTab + 1;\r\n if (toActivateTab > totalTabs) {\r\n toActivateTab = 0;\r\n }\r\n $tabs.tabs('option', 'active', toActivateTab);\r\n }\r\n }\r\n\r\n $('body').on('keypress', function (e) {\r\n if (e.which == 178) {\r\n if ($(':focus').hasClass('auto')) {\r\n $(':focus').autocomplete('close');\r\n $(':focus').autocomplete('disable');\r\n e.preventDefault();\r\n SwitchTabs();\r\n return false;\r\n } else if ($(':focus').length == 0) {\r\n SwitchTabs();\r\n return false;\r\n } else {\r\n e.preventDefault();\r\n SwitchTabs();\r\n return false;\r\n }\r\n } else {\r\n if ($(':focus').hasClass('auto')) {\r\n $(':focus').autocomplete('enable');\r\n }\r\n }\r\n });\r\n\r\n $('input.numeric').ForceNumericOnly();\r\n\r\n var previousOPStatus;\r\n $('body').on('focus', 'select.statusDrop', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n previousOPStatus = $(this).val();\r\n\r\n if ($(this).find('option.lock').length > 0) {\r\n $(this).find('option').each(function (i, y) {\r\n if (!$(y).hasClass('lock')) {\r\n $(y).prop('disabled', 'disabled');\r\n }\r\n });\r\n }\r\n }).on('change', 'select.statusDrop', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n var statusID = $(this).val();\r\n if ((statusID == 4 || statusID == 5 || statusID == 6) && (previousOPStatus < 4)) {\r\n var time = moment().format(\"DD/MM/YYYY HH:mm\");\r\n var inputImplementation = $(this).parent().parent().find('td.implementation').find('input.procImplementation');\r\n inputImplementation.val(time);\r\n inputImplementation.attr('value', time);\r\n inputImplementation.removeClass('original');\r\n inputImplementation.addClass('changed');\r\n\r\n var removeChangedFromDateTimeProcedures = function () {\r\n inputImplementation.removeClass('changed');\r\n inputImplementation.addClass('original');\r\n };\r\n setTimeout(removeChangedFromDateTimeProcedures, 1500);\r\n\r\n SharedOrderFunctions.checkDatesWhenProcedureDateChangedInOrder(inputImplementation);\r\n }\r\n previousOPStatus = statusID;\r\n\r\n GetInvoiceInformation();\r\n });\r\n\r\n $('body').on('click', \".radText, .tecText, .roomText\", function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n $(this).select();\r\n });\r\n\r\n $('.switchRequestingAndCC').on('click', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n\r\n SharedOrderFunctions.SwitchRequestingAndCCApplicant(viewbagUniquePrefix);\r\n });\r\n\r\n if (patientModel.GeneralPractitionerID) {\r\n $('#addGeneralPractitionerAsApp' + viewbagUniquePrefix).removeClass('inActive');\r\n $('#addGeneralPractitionerAsAppCC' + viewbagUniquePrefix).removeClass('inActive');\r\n $('#addGeneralPractitionerAsAppCC2' + viewbagUniquePrefix).removeClass('inActive');\r\n\r\n $('#addGeneralPractitionerAsApp' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n SharedOrderFunctions.LoadApplicantWithID(patientModel.GeneralPractitionerID, \"App\", viewbagUniquePrefix);\r\n LoadRequestForm('App', patientModel.GeneralPractitionerID, htmlDecode(patientModel.GeneralPractitionerText));\r\n }\r\n });\r\n\r\n $('#addGeneralPractitionerAsAppCC' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n SharedOrderFunctions.LoadApplicantWithID(patientModel.GeneralPractitionerID, \"AppCC\", viewbagUniquePrefix);\r\n LoadRequestForm('AppCC', patientModel.GeneralPractitionerID, htmlDecode(patientModel.GeneralPractitionerText));\r\n }\r\n });\r\n\r\n $('#addGeneralPractitionerAsAppCC2' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n SharedOrderFunctions.LoadApplicantWithID(patientModel.GeneralPractitionerID, \"AppCC2\", viewbagUniquePrefix);\r\n LoadRequestForm('AppCC2', patientModel.GeneralPractitionerID, htmlDecode(patientModel.GeneralPractitionerText));\r\n }\r\n });\r\n }\r\n\r\n $('#MergeWithPatient_UID').val(\"\");\r\n\r\n $('table#mergePatientTable' + viewbagUniquePrefix + ' tbody').on('dblclick', 'tr.record', function (e) {\r\n var id = $(this).find('td.id').text();\r\n if (id) {\r\n useFilingCabinet('/Patients/Detail/' + id);\r\n }\r\n });\r\n\r\n $('input#searchMergePatient' + viewbagUniquePrefix).bind('keydown', function (e) {\r\n if (e.keyCode == 13) {\r\n SharedOrderFunctions.FindPatientsToMergeForOrder(viewbagUniquePrefix, modelPatientID);\r\n return false;\r\n }\r\n });\r\n\r\n $('table#mergePatientTable' + viewbagUniquePrefix + ' tbody').on('click', 'tr.record', function (e) {\r\n $('table#mergePatientTable' + viewbagUniquePrefix + ' tbody tr.record').removeClass('activeRecord');\r\n $(this).addClass('activeRecord');\r\n $('button#btnConfirmMerge' + viewbagUniquePrefix).removeAttr('disabled');\r\n\r\n });\r\n\r\n $('#divMergePatient' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n modal: true,\r\n dialogClass: 'no-close',\r\n appendTo: \"#contentView\",\r\n title: $(\"\").html(resourceTemporaryPatient + ' - ' + resourceMergeTitle).text()\r\n });\r\n\r\n $('#btnCancelMerge' + viewbagUniquePrefix).on('click', function (e) {\r\n $('#divMergePatient' + viewbagUniquePrefix).dialog('close');\r\n $('form#addOrderForm').submit();\r\n });\r\n\r\n $('#btnConfirmMerge' + viewbagUniquePrefix).on('click', function (e) {\r\n $('#divMergePatient' + viewbagUniquePrefix).dialog('close');\r\n var row = $('table#mergePatientTable' + viewbagUniquePrefix + ' tbody').find('tr.activeRecord');\r\n\r\n var id = row.find('td.id').text();\r\n if (id) {\r\n $('#MergeWithPatient_UID').val(id);\r\n $('form#addOrderForm').submit();\r\n } else {\r\n $('form#addOrderForm').submit();\r\n }\r\n });\r\n\r\n $('#divEditWeight' + viewbagUniquePrefix + ' input').ForceNumericOnly();\r\n $('#divEditLength' + viewbagUniquePrefix + ' input').ForceNumericWithoutPunctuation();\r\n\r\n if (viewbagVisitRequiredError) {\r\n $('div#fullVisitContainer span.visitValidation').text(viewbagVisitRequiredError);\r\n $('div#fullVisitContainer span.visitValidation').show();\r\n $('a[href=\"#visitTab\"]').trigger('click');\r\n $('#openVisitTab').trigger('click');\r\n } else {\r\n $('div#fullVisitContainer span.visitValidation').hide();\r\n }\r\n\r\n if (viewbagErrorPaymentPlan) {\r\n $('#errorPaymentPlanDialog').dialog('open');\r\n }\r\n\r\n if (viewbagGeneralPractitionerCC && viewbagGeneralPractitionerCC == 'True') {\r\n SharedOrderFunctions.LoadPhyscianExportFormatsForApplicantType('AppCC');\r\n }\r\n\r\n if (viewbagApplicantFromVisitMovement && viewbagApplicantFromVisitMovement == 'True') {\r\n\r\n var promise = Promise.all([\r\n SharedOrderFunctions.LoadPhyscianExportFormatsForApplicantType('App'),\r\n new Promise(function(resolve) {\r\n LoadRequestForm('App', $('input#Applicant_UID').attr('value'), $('input#Applicant_Text').attr('value'));\r\n SharedOrderFunctions.setActiveApplicantDetailAndRemoveMenuOptions(true, \"App\", viewbagUniquePrefix);\r\n resolve();\r\n })\r\n ])\r\n\r\n SharedOrderFunctions.saveChecker.queueSaveBlockingPromise(promise);\r\n }\r\n\r\n if (modelInvoiceCertificate && modelInvoiceCertificate == 'True') {\r\n $('input#InvoiceCertificate').prop('checked', true);\r\n } else {\r\n $('input#InvoiceCertificate').prop('checked', false);\r\n }\r\n\r\n if (modelInvoiceSituation_UID == '3' || modelInvoiceSituation_UID == '6') {\r\n if (modelInvoicePaymentMethod == '2' || modelInvoicePaymentMethod == '4') {\r\n $('div#invoiceInvoiceCertificate').hide();\r\n } else {\r\n $('div#invoiceInvoiceCertificate').show();\r\n }\r\n }\r\n\r\n SetHealthInsuranceParameters(modelInvoicePaymentMethod);\r\n\r\n $('#loading').hide();\r\n }\r\n}\r\n","\"use strict\";\r\n\r\nvar bodySelector = $('body');\r\nwindow.ChecksDialog = window.ChecksDialog || {\r\n leavechecked: false\r\n}\r\n\r\nbodySelector.on('change', '#checksTable select.dropdownValue', function (e) {\r\n e.stopImmediatePropagation();\r\n var row = $(this).parent().parent();\r\n if (!row.find('td.checkbox input.checkChecked').is(':checked')) {\r\n row.find('td.checkbox input.checkChecked').trigger('click');\r\n }\r\n});\r\n\r\nbodySelector.on('focusout keypress', '#checksTable input.textValue', function (e) {\r\n e.stopImmediatePropagation();\r\n if (e.type === 'focusout' || e.keyCode === 13) {\r\n var row = $(this).parent().parent();\r\n var check = row.find('td.checkbox input.checkChecked');\r\n var dateValue = $(this).closest('td').children('.dateValue');\r\n var textValue2 = $(this).closest('td').children('.textValue2');\r\n //Check if has value\r\n if (!check.is(':checked')\r\n && ($(this).val() != null && $(this).val().trim() !== \"\")) {\r\n //if it has a date/text2 check it also\r\n if ((dateValue.length > 0 && dateValue.val() !== null && dateValue.val().trim() !== \"\")\r\n || (textValue2.length > 0 && textValue2.val() !== null && textValue2.val().trim() !== \"\")) {\r\n check.trigger('click');\r\n } else if (dateValue.length === 0 && textValue2.length === 0) {\r\n check.trigger('click');\r\n }\r\n //if it's checked and the value is empty, uncheck it\r\n } else if (check.is(':checked') && ($(this).val() === null || $(this).val().trim() === \"\")) {\r\n check.trigger('click');\r\n }\r\n }\r\n});\r\n\r\nbodySelector.on('focusout keypress', '#checksTable input.dateValue, #checksTable input.textValue2', function (e) {\r\n e.stopImmediatePropagation();\r\n if (e.type === 'focusout' || e.keyCode === 13) {\r\n var row = $(this).parent().parent();\r\n var check = row.find('td.checkbox input.checkChecked');\r\n var textValue = $(this).closest('td').children('.textValue');\r\n //Check if date/text2 has value\r\n if (!check.is(':checked')\r\n && ($(this).val() != null && $(this).val().trim() !== \"\")) {\r\n //if it has a text value check it also\r\n if (textValue.length > 0 && textValue.val() !== null && textValue.val().trim() !== \"\") {\r\n check.trigger('click');\r\n } else if (textValue.length === 0) {\r\n check.trigger('click');\r\n }\r\n //if it's checked and the value is empty, uncheck it\r\n } else if (check.is(':checked') && ($(this).val() === null || $(this).val().trim() === \"\")) {\r\n check.trigger('click');\r\n }\r\n }\r\n});\r\n\r\nbodySelector.on('click', '#divPopupConfirmationChecksRemaining #checksTable td.checkbox input.checkChecked', function (e) {\r\n e.stopImmediatePropagation();\r\n var forchecked = $(this).parent().find('.checkGUID').val();\r\n if ($(this).is(':checked')) {\r\n\r\n $('#divSetCheckedBy').find('#forCheckSetBy').val(forchecked);\r\n\r\n window.ChecksDialog.leavechecked = false;\r\n\r\n $('#divSetCheckedBy').dialog(\"open\");\r\n\r\n $('#divSetCheckedBy').find('span.validation').hide();\r\n\r\n $.ajax({\r\n type: \"GET\",\r\n url: '/legacy/System/GetLoggedInUser',\r\n data: {},\r\n dataType: 'json',\r\n async: false,\r\n success: function (data) {\r\n if (data.AllOk) {\r\n $('#divSetCheckedBy').find('#setCheckedByUser').val(data.Username);\r\n $('#divSetCheckedBy').find('#setCheckedByUser').attr('value', data.Username);\r\n $('#divSetCheckedBy').find('#setCheckedByUserUID').val(data.UserUID);\r\n $('#divSetCheckedBy').find('#setCheckedByUserUID').attr('value', data.UserUID);\r\n }\r\n }\r\n });\r\n\r\n } else {\r\n $(this).parent().parent().find('td.checkedBy').find('.checkByText').val('');\r\n $(this).parent().parent().find('td.checkedBy').find('.checkByUID').val(0); \r\n }\r\n});","\"use strict\";\r\n\r\nwindow.loadJustificationDialogScript = (isWorklistOrder = false) => {\r\n $('#divJustification').dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n modal: true,\r\n appendTo: \"#contentView\",\r\n title: $(\"\").html(justificationLabel).text(),\r\n dialogClass: 'no-close, justificationDialog',\r\n position: { my: \"center\", at: \"center\", of: $(\"#subPageContent\") }\r\n })\r\n\r\n $('body').off('click', '.tdJustification');\r\n $('body').on('click', '.tdJustification' ,function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n $('.justificationWrapper').empty();\r\n\r\n $('.activeRow').removeClass('activeRow');\r\n $(this).parent().addClass('activeRow');\r\n\r\n var orderNumber = $(this).parent().find('span.orderNumber').text();\r\n var orderID = $(this).parent().find('span.id').text();\r\n var orderStatusID = $(this).closest('tr').children('td').children('.orderStatusUID').text();\r\n var patientID = $(this).parent().find('span.patientID').text();\r\n var patientTitle = $(this).parent().find('span.patientWithGender').text();\r\n var patientDOB = $(this).parent().find('span.dateOfBirth').text();\r\n $('#divJustification input#orderID').val(orderID);\r\n var toAppend = 'a';\r\n\r\n $.ajax({\r\n traditional: true,\r\n type: 'GET',\r\n url: '/legacy/System/GetProceduresForJustification',\r\n data: {\r\n Order_UID: orderID,\r\n Patient_UID: patientID\r\n },\r\n dataType: 'json',\r\n async: false,\r\n success:\r\n function (data) {\r\n if (data.AllOk) {\r\n if (data.List.length > 0) {\r\n $.each(data.List, function (i, proc) {\r\n //repeat following for each procedure\r\n toAppend = '€ ' + amount.toFixed(2) + '';\r\n lineToAdd += ' ';\r\n lineToAdd += '' + dueDate + '';\r\n lineToAdd += ' ';\r\n lineToAdd += '
';\r\n }\r\n\r\n toAppend += ' ');\r\n });\r\n } else {\r\n $('#gridFindApplicant' + viewbagUniquePrefix).append('' + this.ID + ' ' + this.FullName + ' ' + this.ContactInformationID + ' ' + this.ContactInformation + ' ' + this.Type + ' ' + this.Department + ' ' + this.RIZIV + ' ');\r\n }\r\n }\r\n });\r\n }\r\n\r\n var findApplicantCC = function (e) {\r\n $.ajax({\r\n type: 'POST',\r\n url: '/legacy/Orders/FindPhysiciansForGrid',\r\n data: {\r\n Name: $('#txtFindAppCCName' + viewbagUniquePrefix).val(),\r\n Address: $('#txtFindAppCCAddress' + viewbagUniquePrefix).val(),\r\n RIZIV: $('#txtFindAppCCRIZIV' + viewbagUniquePrefix).val(),\r\n except: $('#Applicant_UID').val() + \"-\" + $('#Applicant_CC_2_UID').val(),\r\n Type: $('#dropFindAppCCType').val(),\r\n Department: $('#dropFindAppCCDepartment').val()\r\n },\r\n dataType: 'json',\r\n success:\r\n function (data) {\r\n $('#gridFindApplicantCC' + viewbagUniquePrefix + ' tr:not(.tableHeader)').remove();\r\n $(\"#btnLoadSelectedAppCC\" + viewbagUniquePrefix).attr(\"disabled\", true);\r\n if (data.items.length > 0) {\r\n $.each(data.items, function (e) {\r\n $('#gridFindApplicantCC' + viewbagUniquePrefix).append('' + resourceNoPhysiciansFound + ' ');\r\n });\r\n } else {\r\n $('#gridFindApplicantCC' + viewbagUniquePrefix).append('' + this.ID + ' ' + this.FullName + ' ' + this.ContactInformationID + ' ' + this.ContactInformation + ' ' + this.Type + ' ' + this.Department + ' ' + this.RIZIV + ' ');\r\n }\r\n }\r\n });\r\n }\r\n\r\n var findApplicantCC2 = function (e) {\r\n $.ajax({\r\n type: 'POST',\r\n url: '/legacy/Orders/FindPhysiciansForGrid',\r\n data: {\r\n Name: $('#txtFindAppCC2Name' + viewbagUniquePrefix).val(),\r\n Address: $('#txtFindAppCC2Address' + viewbagUniquePrefix).val(),\r\n RIZIV: $('#txtFindAppCC2RIZIV' + viewbagUniquePrefix).val(),\r\n except: $('#Applicant_CC_UID').val() + \"-\" + $('#Applicant_UID').val(),\r\n Type: $('#dropFindAppCC2Type').val(),\r\n Department: $('#dropFindAppCC2Department').val()\r\n },\r\n dataType: 'json',\r\n success:\r\n function (data) {\r\n $('#gridFindApplicantCC2' + viewbagUniquePrefix + ' tr:not(.tableHeader)').remove();\r\n $(\"#btnLoadSelectedAppCC2\" + viewbagUniquePrefix).attr(\"disabled\", true);\r\n if (data.items.length > 0) {\r\n $.each(data.items, function (e) {\r\n $('#gridFindApplicantCC2' + viewbagUniquePrefix).append('' + resourceNoPhysiciansFound + ' ');\r\n });\r\n } else {\r\n $('#gridFindApplicantCC2' + viewbagUniquePrefix).append('' + this.ID + ' ' + this.FullName + ' ' + this.ContactInformationID + ' ' + this.ContactInformation + ' ' + this.Type + ' ' + this.Department + ' ' + this.RIZIV + ' ');\r\n }\r\n }\r\n });\r\n }\r\n\r\n $('#gridFindApplicant' + viewbagUniquePrefix).on('click', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedApp\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n });\r\n\r\n $('#gridFindApplicantCC' + viewbagUniquePrefix).on('click', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedAppCC\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n });\r\n\r\n $('#gridFindApplicantCC2' + viewbagUniquePrefix).on('click', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedAppCC2\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n });\r\n\r\n $('#gridFindApplicant' + viewbagUniquePrefix).on('dblclick', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedApp\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n SharedOrderFunctions.LoadSelectedApplicant(viewbagUniquePrefix);\r\n });\r\n\r\n $('#gridFindApplicantCC' + viewbagUniquePrefix).on('dblclick', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedAppCC\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n SharedOrderFunctions.LoadSelectedAppCC(viewbagUniquePrefix);\r\n });\r\n\r\n $('#gridFindApplicantCC2' + viewbagUniquePrefix).on('dblclick', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedAppCC2\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n SharedOrderFunctions.LoadSelectedAppCC2(viewbagUniquePrefix);\r\n });\r\n\r\n $('#btnLoadSelectedApp' + viewbagUniquePrefix).on('click', function (e) {\r\n SharedOrderFunctions.LoadSelectedApplicant(viewbagUniquePrefix);\r\n });\r\n\r\n $('#btnLoadSelectedAppCC' + viewbagUniquePrefix).on('click', function (e) {\r\n SharedOrderFunctions.LoadSelectedAppCC(viewbagUniquePrefix);\r\n });\r\n\r\n $('#btnLoadSelectedAppCC2' + viewbagUniquePrefix).on('click', function (e) {\r\n SharedOrderFunctions.LoadSelectedAppCC2(viewbagUniquePrefix);\r\n });\r\n\r\n $('a#showAppDetail' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n var id = $('input#Applicant_UID').val();\r\n useFilingCabinet('/Physicians/Detail/' + id);\r\n }\r\n });\r\n\r\n $('a#showAppCCDetail' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n var id = $('input#Applicant_CC_UID').val();\r\n useFilingCabinet('/Physicians/Detail/' + id);\r\n }\r\n });\r\n\r\n $('a#showAppCC2Detail' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n var id = $('input#Applicant_CC_2_UID').val();\r\n useFilingCabinet('/Physicians/Detail/' + id);\r\n }\r\n });\r\n\r\n $('#Applicant_Text').autocomplete({\r\n autoFocus: true,\r\n source: function (request, response) {\r\n SharedOrderFunctions.resetAndSetLoadingApplicantForAutocomplete(\"App\", viewbagUniquePrefix);\r\n\r\n const applicantValue = $('#Applicant_UID').val();\r\n const applicantID = applicantValue === '0' ? null : parseInt(applicantValue);\r\n const applicantCCValue = $('#Applicant_CC_UID').val();\r\n const applicantCCID = applicantCCValue === '0' ? null : parseInt(applicantCCValue);\r\n const applicantCC2Value = $('#Applicant_CC_2_UID').val();\r\n const applicantCC2ID = applicantCC2Value === '0' ? null : parseInt(applicantCC2Value);\r\n\r\n const exclusionIDs = [applicantCCID, applicantCC2ID].filter(id => id !== null);\r\n\r\n const params = new URLSearchParams( { term: request.term } );\r\n exclusionIDs.forEach(exclusionID => {\r\n params.append(\"except\", exclusionID);\r\n });\r\n\r\n fetch('/core/physician/autocomplete?' +\r\n params, {\r\n method: 'GET',\r\n headers: {\r\n 'Accept': 'application/json',\r\n \"X-Requested-With\": \"XMLHttpRequest\"\r\n }})\r\n .then(res => res.json())\r\n .then(data => {\r\n SharedOrderFunctions.setAutocompleteApplicantLoading(false, \"App\", data, response);\r\n });\r\n },\r\n minLength: 2,\r\n delay: 500,\r\n select: function (event, ui) {\r\n event.preventDefault();\r\n var appId = ui.item.id;\r\n SharedOrderFunctions.LoadApplicantWithID(appId, \"App\", viewbagUniquePrefix);\r\n }\r\n });\r\n\r\n $('#Applicant_ContactID').on('change' , function () {\r\n SharedOrderFunctions.LoadPhyscianExportFormatsForApplicantType('App');\r\n });\r\n\r\n $('#Applicant_CC_Text').autocomplete({\r\n autoFocus: true,\r\n source: function (request, response) {\r\n SharedOrderFunctions.resetAndSetLoadingApplicantForAutocomplete(\"AppCC\", viewbagUniquePrefix);\r\n\r\n const applicantValue = $('#Applicant_UID').val();\r\n const applicantID = applicantValue === '0' ? null : parseInt(applicantValue);\r\n const applicantCCValue = $('#Applicant_CC_UID').val();\r\n const applicantCCID = applicantCCValue === '0' ? null : parseInt(applicantCCValue);\r\n const applicantCC2Value = $('#Applicant_CC_2_UID').val();\r\n const applicantCC2ID = applicantCC2Value === '0' ? null : parseInt(applicantCC2Value);\r\n\r\n const exclusionIDs = [applicantID, applicantCC2ID].filter(id => id !== null);\r\n\r\n const params = new URLSearchParams( { term: request.term } );\r\n exclusionIDs.forEach(exclusionID => {\r\n params.append(\"except\", exclusionID);\r\n });\r\n\r\n fetch('/core/physician/autocomplete?' +\r\n params, {\r\n method: 'GET',\r\n headers: {\r\n 'Accept': 'application/json',\r\n \"X-Requested-With\": \"XMLHttpRequest\"\r\n }})\r\n .then(res => res.json())\r\n .then(data => {\r\n SharedOrderFunctions.setAutocompleteApplicantLoading(false, \"AppCC\", data, response);\r\n });\r\n },\r\n minLength: 2,\r\n delay: 500,\r\n select: function (event, ui) {\r\n event.preventDefault();\r\n var appCCId = ui.item.id;\r\n SharedOrderFunctions.LoadApplicantWithID(appCCId, \"AppCC\", viewbagUniquePrefix);\r\n }\r\n });\r\n\r\n $('#Applicant_CC_ContactID').on('change' , function () {\r\n SharedOrderFunctions.LoadPhyscianExportFormatsForApplicantType('AppCC');\r\n });\r\n\r\n $('#Applicant_CC_2_Text').autocomplete({\r\n autoFocus: true,\r\n source: function (request, response) {\r\n SharedOrderFunctions.resetAndSetLoadingApplicantForAutocomplete(\"AppCC2\", viewbagUniquePrefix);\r\n\r\n const applicantValue = $('#Applicant_UID').val();\r\n const applicantID = applicantValue === '0' ? null : parseInt(applicantValue);\r\n const applicantCCValue = $('#Applicant_CC_UID').val();\r\n const applicantCCID = applicantCCValue === '0' ? null : parseInt(applicantCCValue);\r\n const applicantCC2Value = $('#Applicant_CC_2_UID').val();\r\n const applicantCC2ID = applicantCC2Value === '0' ? null : parseInt(applicantCC2Value);\r\n\r\n const exclusionIDs = [applicantID, applicantCCID].filter(id => id !== null);\r\n\r\n const params = new URLSearchParams( { term: request.term } );\r\n exclusionIDs.forEach(exclusionID => {\r\n params.append(\"except\", exclusionID);\r\n });\r\n\r\n fetch('/core/physician/autocomplete?' +\r\n params, {\r\n method: 'GET',\r\n headers: {\r\n 'Accept': 'application/json',\r\n \"X-Requested-With\": \"XMLHttpRequest\"\r\n }})\r\n .then(res => res.json())\r\n .then(data => {\r\n SharedOrderFunctions.setAutocompleteApplicantLoading(false, \"AppCC2\", data, response);\r\n });\r\n },\r\n minLength: 2,\r\n delay: 500,\r\n select: function (event, ui) {\r\n event.preventDefault();\r\n\r\n var appCC2Id = ui.item.id;\r\n SharedOrderFunctions.LoadApplicantWithID(appCC2Id, \"AppCC2\", viewbagUniquePrefix);\r\n }\r\n });\r\n\r\n $('#Applicant_CC_2_ContactID').on('change' , function () {\r\n SharedOrderFunctions.LoadPhyscianExportFormatsForApplicantType('AppCC2');\r\n });\r\n\r\n var m = moment($('span#age').html(), \"DD/MM/YYYY\");\r\n if (m.isValid()) {\r\n $('span#age').html('(' + moment().diff(m, 'years') + ')');\r\n }\r\n\r\n $('a[href=\"#\"]').on('click', function (e) {\r\n e.preventDefault();\r\n });\r\n\r\n $('div#subPageContent').height($('div#content').height() - 20 - $('div#submitBottom').height());\r\n\r\n $('select').each(function (e) {\r\n if ($(this).attr('value') != null) {\r\n $(this).val($(this).attr('value'));\r\n }\r\n });\r\n\r\n $('textarea').each(function (e) {\r\n if ($(this).attr('value') != null) {\r\n $(this).val($(this).attr('value'));\r\n }\r\n });\r\n\r\n $(\"body\").keydown(function (e) {\r\n if (!$(e.target).is('input')) {\r\n if (e.keyCode == 37) { // left\r\n ScrollLeft();\r\n return false;\r\n } else if (e.keyCode == 39) { // right\r\n ScrollRight();\r\n return false;\r\n }\r\n }\r\n });\r\n\r\n var filterProcedures = function (e) {\r\n var filter = $('input#searchProcedure').val();\r\n if (filter) {\r\n filter = filter.toLowerCase();\r\n var matches = viewbagListProcedureItems.filter( function(obj) {return obj.Code.toLowerCase().includes(filter) || obj.FullCode.toLowerCase().includes(filter) || obj.Description.toLowerCase().includes(filter)\r\n || obj.Modality_Text.toLowerCase().includes(filter) });\r\n $('#emptyProcedures').text(matches.length + $(\"\").html(' ' + resourceProceduresFound).text());\r\n }\r\n else {\r\n $('#emptyProcedures').text(viewbagListProcedureItems.length + $(\"\").html(' ' + resourceProceduresFound).text());\r\n }\r\n return false;\r\n }\r\n\r\n $('#searchProcedure')\r\n .change(function () {\r\n filterProcedures();\r\n })\r\n .keyup(function () {\r\n $(this).change();\r\n });\r\n\r\n var onAutoCompleteEnter = false;\r\n $('input#searchProcedure').on('keypress', function (e) {\r\n e.stopImmediatePropagation();\r\n if (e.keyCode == 13 && $(this).val() != \"\") {\r\n if (!onAutoCompleteEnter) {\r\n e.preventDefault();\r\n\r\n var filter = $(this).val().toLowerCase();\r\n var matches = viewbagListProcedureItems.filter( function(obj) {return obj.Code.toLowerCase().includes(filter) || obj.FullCode.toLowerCase().includes(filter) || obj.Description.toLowerCase().includes(filter)\r\n || obj.Modality_Text.toLowerCase().includes(filter) });\r\n\r\n if (matches.length > 0) {\r\n\r\n selectProcedure(matches[0].ID);\r\n\r\n $('input#searchProcedure').val(\"\");\r\n $('input#searchProcedure').attr(\"value\", \"\");\r\n filterProcedures();\r\n $('input#searchProcedure').autocomplete(\"close\");\r\n onAutoCompleteEnter = false;\r\n }\r\n }\r\n else {\r\n onAutoCompleteEnter = false;\r\n }\r\n return false;\r\n }\r\n });\r\n\r\n $('input#searchProcedure').autocomplete({\r\n autoFocus: false,\r\n source: function (request, response) {\r\n setAutocompleteInputLoading(true, $('input#searchProcedure'));\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteProcedures\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term,\r\n date: $('#DateOfImplementation').val(),\r\n patientID: modelPatientID,\r\n includeGroups: true\r\n },\r\n success: function (data) {\r\n setAutocompleteInputLoading(false, $('input#searchProcedure'));\r\n if (data.length == 0) {\r\n }\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.Code + \" (\" + item.Description + \")\",\r\n value: item.Code,\r\n id: item.IDString\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 1,\r\n select: function (event, ui) {\r\n event.stopPropagation();\r\n onAutoCompleteEnter = true;\r\n if (ui.item.id.indexOf('_') > 0) {\r\n $.each(ui.item.id.split('_'), function (i, y) {\r\n if (y != \"\") {\r\n selectProcedure(y);\r\n }\r\n });\r\n } else {\r\n selectProcedure(ui.item.id);\r\n }\r\n $('input#searchProcedure').val(\"\");\r\n $('input#searchProcedure').attr(\"value\", \"\");\r\n filterProcedures();\r\n event.preventDefault();\r\n },\r\n close: function (event, ui) {\r\n if (event.originalEvent !== undefined) {\r\n if (event.originalEvent.type == \"blur\") {\r\n onAutoCompleteEnter = false;\r\n }\r\n }\r\n }\r\n });\r\n\r\n var selectProcedure = function (procedureID) {\r\n let procedure = _.find(viewbagListProcedureItems, function (obj) {\r\n return obj.ID === parseInt(procedureID)\r\n });\r\n const id = procedure.ID;\r\n const fullCode = procedure.Description;\r\n const code = procedure.Code;\r\n const color = procedure.Color;\r\n const modality = procedure.Modality_Text;\r\n const useOnDuty = procedure.UseOnDuty;\r\n const procedureTemplateUID = procedure.TemplateUID;\r\n const screeningsTemplateUID = procedure.ScreeningTemplateUID;\r\n const justificationType = procedure.JustificationType;\r\n\r\n let oProcedureStatus = null;\r\n let orderProcedure_UID = 0;\r\n\r\n if (!$('div#subPageContent').hasClass('disabled') && !$('div#subPageContent').hasClass('disabledNone')) {\r\n\r\n if ($('input[name=\"EditableProcedure\"]:checked').length > 0) {\r\n var checkedRadio = $('input[name=\"EditableProcedure\"]:checked');\r\n\r\n var roomUID;\r\n var roomText;\r\n\r\n var site_uid = -1;\r\n\r\n if ($('#Site_UID').val() != null) {\r\n site_uid = $('#Site_UID').val();\r\n }\r\n\r\n $.ajax({\r\n url: \"/legacy/Orders/GetRoomForChangedProcedure\",\r\n type: \"GET\",\r\n async: false,\r\n dataType: \"json\",\r\n data: {\r\n id: id,\r\n Site_UID: site_uid\r\n },\r\n success: function (data) {\r\n if (data.Done) {\r\n roomUID = data.RoomUID;\r\n roomText = data.RoomText;\r\n }\r\n }\r\n });\r\n\r\n var oTd = checkedRadio.parent().parent().find('td.procedure');\r\n var oId = checkedRadio.parent().parent().find('input.id');\r\n var oColor = checkedRadio.parent().parent().find('input.color');\r\n var oCode = checkedRadio.parent().parent().find('input.code');\r\n var oModalityInput = checkedRadio.parent().parent().find('input.modality');\r\n var oFullCode = checkedRadio.parent().parent().find('input.fullCode');\r\n var oTextCode = checkedRadio.parent().parent().find('span.textCode');\r\n var oModalityCode = checkedRadio.parent().parent().find('span.modalityCode');\r\n var originalProcedureID = oId.val();\r\n var oRoom = checkedRadio.parent().parent().find('td.room');\r\n var oUseOnDuty = checkedRadio.parent().parent().find('input.useOnDuty');\r\n var oProcedureTemplateUID = checkedRadio.parent().parent().find('input.template');\r\n var oScreeningsTemplateUID = checkedRadio.parent().parent().find('input.screeningTemplate');\r\n var oJustificationType = checkedRadio.parent().parent().find('input.justificationType');\r\n var oHasJustification = checkedRadio.parent().parent().find('input.hasjustification');\r\n var oJustificationRemark = checkedRadio.parent().parent().find('input.justificationRemark');\r\n oProcedureStatus = checkedRadio.parent().parent().find('select.statusDrop').val();\r\n\r\n if (useProducts) {\r\n if (oProcedureStatus != null && oProcedureStatus != viewbagFinishedStatusID && oProcedureStatus != viewbagCorrectionStatusID\r\n && oProcedureStatus != viewbagDictatedStatusID && oProcedureStatus != viewbagTranscriptionStatusID) {\r\n var changedOrderHasProcedure = checkedRadio.parent().parent();\r\n CheckProductsAfterChangeProcedure(changedOrderHasProcedure);\r\n } else {\r\n //Update existing products rows\r\n ReplaceProducts(procedure, oId.val());\r\n }\r\n }\r\n\r\n oTd.parent().removeClass('recordActive');\r\n\r\n oTd.attr('title', fullCode);\r\n oTd.css('background-color', color);\r\n oId.val(id);\r\n oColor.val(color);\r\n oCode.val(code);\r\n oFullCode.val(fullCode);\r\n oTextCode.text(code);\r\n oModalityInput.val(modality);\r\n oModalityCode.text(modality);\r\n oUseOnDuty.val(useOnDuty);\r\n oProcedureTemplateUID.val(procedureTemplateUID);\r\n oScreeningsTemplateUID.val(screeningsTemplateUID);\r\n oJustificationType.val(justificationType);\r\n\r\n var justificationRemark = oJustificationRemark.val();\r\n var hasJustification = !_.isEmpty(justificationRemark);\r\n oHasJustification.val(hasJustification);\r\n\r\n if (!hasJustification && justificationType == 2) {\r\n checkedRadio.parent().parent().find('.tdOrderDetailJustification').addClass(\"tdOrderDetailJustificationRequired\");\r\n } else if (!hasJustification && justificationType == 1) {\r\n checkedRadio.parent().parent().find('.tdOrderDetailJustification').removeClass(\"tdOrderDetailJustificationRequired\");\r\n checkedRadio.parent().parent().find('.tdOrderDetailJustification').addClass(\"tdOrderDetailJustificationNeeded\");\r\n }\r\n\r\n oRoom.find('input.roomUID').val(roomUID);\r\n oRoom.find('input.roomUID').attr('value', roomUID);\r\n oRoom.find('input.roomText').val(roomText);\r\n oRoom.find('input.roomText').attr('value', roomText);\r\n\r\n\r\n $('table#tblProcedureExportFormat').find('input.procedureEFProcedureID[value=' + originalProcedureID + ']').parent().parent().remove();\r\n\r\n checkedRadio.attr('checked', false);\r\n\r\n orderProcedure_UID = checkedRadio.parent().parent().find('input.uid').val();\r\n\r\n SharedOrderFunctions.checkOnDuty();\r\n } else {\r\n var statusToUse = 1;\r\n var existingStatusArr = new Array();\r\n try {\r\n $('.statusDrop').each(function () {\r\n existingStatusArr.push(parseInt($(this).val()));\r\n });\r\n } catch (e) {\r\n }\r\n\r\n var orderStatus = $('#statusList').find('li.default').attr('id');\r\n if (orderStatus != 1) {\r\n statusToUse = viewbagDefaultProcedureStatus;\r\n }\r\n\r\n var toAppend = '' + resourceNoPhysiciansFound + ' ';\r\n toAppend += ' ';\r\n\r\n $('table#selectedProcedures').append($(toAppend));\r\n $('.radText').autocomplete(autocompleteRadiologists);\r\n $('.tecText').autocomplete(autocompleteTechnicians);\r\n $('.roomText').autocomplete(autocompleteRooms);\r\n\r\n SetDefaultRadiologist($('table#selectedProcedures').find('tr#' + id).find('td.radiologist'));\r\n SetDefaultTechnician($('table#selectedProcedures').find('tr#' + id).find('td.technician'));\r\n SharedOrderFunctions.SetDefaultRoom($('table#selectedProcedures').find('tr#' + id), true, viewbagDefaultRoomUID, viewbagDefaultRoomText);\r\n\r\n $(this).css('opacity', '0.3');\r\n $('table#selectedProcedures tr#emptyTable').hide();\r\n\r\n SortSelectedProcedures();\r\n }\r\n\r\n //we need to wait for the GetAndSetProcedureExportFormatsForProcedureWithID promise as there is also a GetInvoiceInformation in there\r\n SharedOrderFunctions.GetAndSetProcedureExportFormatsForProcedureWithID(id, orderProcedure_UID)\r\n .then(function() {\r\n const ul = $tabs.find('ul#tabSource');\r\n if (procedureTemplateUID == 4 && !ul.find('#openRequestFormTab').length) {\r\n containsRequestForm = true;\r\n showRequestFormTab();\r\n } else {\r\n if (containsRequestForm) {\r\n $tabs.find('#openRequestFormTab').remove();\r\n $tabs.tabs(\"refresh\");\r\n containsRequestForm = false;\r\n }\r\n }\r\n\r\n setTimeout(function () {\r\n SharedOrderFunctions.GetInvoiceInformation(true, true);\r\n }, 0);\r\n\r\n\r\n if (viewbagUseMotivationLetters && viewbagUseMotivationLetters === 'True') {\r\n SharedOrderFunctions.checkMotivationLetters();\r\n }\r\n\r\n checkPatientProcedureHistory(id);\r\n });\r\n }\r\n\r\n }\r\n\r\n var index = 0;\r\n\r\n var containsRequestForm = (viewbagHasScreening == 'True');\r\n\r\n $('#tblProcedureExportFormat').on('click', 'td.delete', function (e) {\r\n if (!$('div#subPageContent').hasClass('disabled')) {\r\n e.stopImmediatePropagation();\r\n $(this).parent().remove();\r\n SharedOrderFunctions.SortProceduresExportFormats();\r\n }\r\n });\r\n\r\n $('table#selectedProcedures').on('click', 'td.delete', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n if (!$('div#subPageContent').hasClass('disabled') && !$('div#subPageContent').hasClass('disabledNone')) {\r\n var id = $(this).parent().attr('id');\r\n var orderProcedure_UID = $.trim($(this).parent().find('td.exProcedure').find('input.uid').val());\r\n\r\n var procedurecount = 0;\r\n $.each($('table#selectedProcedures').find('tr.selectedProcedureItem').find('td.procedure'), function (index, obj) {\r\n if ($(this).find('input.template').val() == 4) {\r\n procedurecount++;\r\n }\r\n })\r\n\r\n var procedureTemplateUID = $(this).parent().find('td.procedure').find('input.template').val();\r\n if (procedureTemplateUID == 4 && procedurecount == 1) {\r\n $tabs.find('#openRequestFormTab').remove();\r\n $tabs.tabs(\"refresh\");\r\n containsRequestForm = false;\r\n }\r\n\r\n var totalOfThis = $('table#selectedProcedures').find('tr#' + id).length;\r\n if (totalOfThis == 1) {\r\n $('ul#procedures').find('li#' + id).css('opacity', '1.0');\r\n }\r\n $(this).parent().remove();\r\n var total = $('table#selectedProcedures').find('tr.selectedProcedureItem').length;\r\n if (total == 0) {\r\n $('table#selectedProcedures tr#emptyTable').show();\r\n }\r\n\r\n SortSelectedProcedures();\r\n\r\n if (totalOfThis == 1) {\r\n $('table#tblProcedureExportFormat').find('input.procedureEFProcedureID[value=' + id + ']').parent().parent().remove();\r\n SharedOrderFunctions.SortProceduresExportFormats();\r\n }\r\n\r\n if (useProducts) {\r\n if (orderProcedure_UID && orderProcedure_UID != \"\" && orderProcedure_UID != \"0\") {\r\n DeleteProductsByDeletingProcedure(orderProcedure_UID, \"\");\r\n } else {\r\n DeleteProductsByDeletingProcedure(\"\", id);\r\n }\r\n }\r\n\r\n if (useChecks) {\r\n if (orderProcedure_UID && orderProcedure_UID != \"\" && orderProcedure_UID != \"0\") {\r\n DeleteChecksByDeletingProcedure(orderProcedure_UID, \"\");\r\n } else {\r\n DeleteChecksByDeletingProcedure(\"\", id);\r\n }\r\n }\r\n\r\n SharedOrderFunctions.GetInvoiceInformation(true);\r\n\r\n SharedOrderFunctions.checkOnDuty();\r\n }\r\n });\r\n\r\n var SortSelectedProcedures = function (e) {\r\n var selected = $('table#selectedProcedures').find('tr.selectedProcedureItem');\r\n $('span#nrSelectedProcedures').text(selected.length);\r\n if (selected.length == 0) {\r\n $('span#nrSelectedProcedures').css('color', '#CD0A0A');\r\n } else {\r\n $('span#nrSelectedProcedures').css('color', '#666');\r\n }\r\n $.each(selected, function (index, obj) {\r\n $(selected[index]).find('input.id').attr('name', 'ListProcedureItems[' + index + '].ID');\r\n $(selected[index]).find('input.accessionNumber').attr('name', 'ListProcedureItems[' + index + '].AccessionNumber');\r\n $(selected[index]).find('input.modality').attr('name', 'ListProcedureItems[' + index + '].Modality_Text');\r\n $(selected[index]).find('input.color').attr('name', 'ListProcedureItems[' + index + '].Color');\r\n $(selected[index]).find('input.code').attr('name', 'ListProcedureItems[' + index + '].Code');\r\n $(selected[index]).find('input.fullCode').attr('name', 'ListProcedureItems[' + index + '].FullCode');\r\n $(selected[index]).find('input.radUid').attr('name', 'ListProcedureItems[' + index + '].Radiologist_UID');\r\n $(selected[index]).find('input.tecUid').attr('name', 'ListProcedureItems[' + index + '].Technician_UID');\r\n $(selected[index]).find('input.radText').attr('name', 'ListProcedureItems[' + index + '].Radiologist_Text');\r\n $(selected[index]).find('input.tecText').attr('name', 'ListProcedureItems[' + index + '].Technician_Text');\r\n $(selected[index]).find('input.uid').attr('name', 'ListProcedureItems[' + index + '].OrderHasProcedure_UID');\r\n $(selected[index]).find('input.roomUID').attr('name', 'ListProcedureItems[' + index + '].Room_UID');\r\n $(selected[index]).find('input.roomText').attr('name', 'ListProcedureItems[' + index + '].Room_Text');\r\n $(selected[index]).find('input.roomOnDuty').attr('name', 'ListProcedureItems[' + index + '].RoomOnDuty');\r\n $(selected[index]).find('input.description').attr('name', 'ListProcedureItems[' + index + '].Description');\r\n $(selected[index]).find('input.useOnDuty').attr('name', 'ListProcedureItems[' + index + '].UseOnDuty');\r\n $(selected[index]).find('input.template').attr('name', 'ListProcedureItems[' + index + '].TemplateUID');\r\n $(selected[index]).find('input.screeningTemplate').attr('name', 'ListProcedureItems[' + index + '].ScreeningTemplateUID');\r\n $(selected[index]).find('select.statusDrop').attr('name', 'ListProcedureItems[' + index + '].Status_UID');\r\n $(selected[index]).find('input.substitution').attr('id', 'ListProcedureItems_' + index + '__Substitution');\r\n $(selected[index]).find('input.substitution').attr('name', 'ListProcedureItems[' + index + '].Substitution');\r\n $(selected[index]).find('td.substitution').find('input[type=\"hidden\"]').attr('name', 'ListProcedureItems[' + index + '].Substitution');\r\n $(selected[index]).find('input.procImplementation').attr('name', 'ListProcedureItems[' + index + '].Implementation');\r\n $(selected[index]).find('input.procPlanned').attr('name', 'ListProcedureItems[' + index + '].DateTimePlanned');\r\n $(selected[index]).find('input.justificationUsername').attr('name', 'ListProcedureItems[' + index + '].JustificationUsername');\r\n $(selected[index]).find('input.justificationDatetime').attr('name', 'ListProcedureItems[' + index + '].JustificationDatetime');\r\n $(selected[index]).find('input.justificationRemark').attr('name', 'ListProcedureItems[' + index + '].JustificationRemark');\r\n $(selected[index]).find('input.hasjustification').attr('name', 'ListProcedureItems[' + index + '].HasJustification');\r\n $(selected[index]).find('input.justificationType').attr('name', 'ListProcedureItems[' + index + '].JustificationType');\r\n $(selected[index]).find('input.hasDoseInformation').attr('name', 'ListProcedureItems[' + index + '].HasDoseInformation');\r\n $(selected[index]).find('input.doseInformation').attr('name', 'ListProcedureItems[' + index + '].DoseInformation');\r\n });\r\n }\r\n\r\n var autocompleteRadiologists = {\r\n autoFocus: true,\r\n source: function (request, response) {\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteRadiologists\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term\r\n },\r\n success: function (data) {\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.FullText,\r\n value: item.FullText,\r\n id: item.ID\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 0,\r\n select: function (event, ui) {\r\n invoiceMethod = null;\r\n $(this).parent().find('input.radUid').val(ui.item.id);\r\n $(this).parent().find('input.radText').attr('value', ui.item.value);\r\n if ($('input#CheckRadiologist').is(':checked')) {\r\n var selectedProcedures = $('table#selectedProcedures tr.selectedProcedureItem');\r\n if (selectedProcedures.first().get(0) === $(this).parent().parent().get(0)) {\r\n selectedProcedures.each(function (e) {\r\n $(this).find('.radUid').val(ui.item.id);\r\n $(this).find('.radUid').attr('value', ui.item.id);\r\n $(this).find('.radText').val(ui.item.value);\r\n $(this).find('.radText').attr('value', ui.item.value);\r\n });\r\n }\r\n }\r\n SharedOrderFunctions.GetInvoiceInformation(false, true);\r\n }\r\n };\r\n\r\n var autocompleteRooms = {\r\n autoFocus: true,\r\n source: function (request, response) {\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteRooms\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term,\r\n Site_UID: $('#Site_UID').val()\r\n },\r\n success: function (data) {\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.FullText,\r\n value: item.FullText,\r\n id: item.ID,\r\n onDuty: item.UseOnDuty\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 0,\r\n select: function (event, ui) {\r\n $(this).parent().find('input.roomUID').val(ui.item.id);\r\n $(this).parent().find('input.roomText').attr('value', ui.item.value);\r\n $(this).parent().find('input.roomOnDuty').attr('value', ui.item.onDuty);\r\n\r\n var row = $(this).parent().parent();\r\n\r\n $.ajax({\r\n url: \"/legacy/Json/GetDefaultRadiologistForRoom\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n Room_UID: ui.item.id\r\n },\r\n success: function (data) {\r\n var radUid = data.RadUID;\r\n var radText = data.RadText;\r\n\r\n if ($.trim(radText) != \"\") {\r\n row.find('td.radiologist').find('input.radUid').val(radUid);\r\n row.find('td.radiologist').find('input.radUid').attr('value', radUid);\r\n row.find('td.radiologist').find('input.radText').val(radText);\r\n row.find('td.radiologist').find('input.radText').attr('value', radText);\r\n }\r\n if (useChecks) {\r\n if ($('#GroupChecks').is(':checked')) {\r\n deGroupChecks();\r\n groupChecks();\r\n }\r\n }\r\n }\r\n })\r\n\r\n if ($('input#CheckRoom').is(':checked')) {\r\n var selectedProcedures = $('table#selectedProcedures tr.selectedProcedureItem');\r\n if (selectedProcedures.first().get(0) === $(this).parent().parent().get(0)) {\r\n selectedProcedures.each(function (e) {\r\n $(this).find('.roomUID').val(ui.item.id);\r\n $(this).find('.roomUID').attr('value', ui.item.id);\r\n $(this).find('.roomText').val(ui.item.value);\r\n $(this).find('.roomText').attr('value', ui.item.value);\r\n $(this).find('.roomOnDuty').val(ui.item.onDuty);\r\n $(this).find('.roomOnDuty').attr('value', ui.item.onDuty);\r\n });\r\n }\r\n }\r\n SharedOrderFunctions.checkOnDuty();\r\n },\r\n change: function (event, ui) {\r\n if (!ui.item) {\r\n $(this).parent().find('input.roomUID').val(\"\");\r\n $(this).parent().find('input.roomText').val(\"\");\r\n }\r\n }\r\n };\r\n\r\n var autocompleteTechnicians = {\r\n autoFocus: true,\r\n source: function (request, response) {\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteTechnicians\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term\r\n },\r\n success: function (data) {\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.FullText,\r\n value: item.FullText,\r\n id: item.ID\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 0,\r\n select: function (event, ui) {\r\n $(this).parent().find('input.tecUid').val(ui.item.id);\r\n $(this).parent().find('input.tecText').attr('value', ui.item.value);\r\n if ($('input#CheckTechnician').is(':checked')) {\r\n var selectedProcedures = $('table#selectedProcedures tr.selectedProcedureItem');\r\n if (selectedProcedures.first().get(0) === $(this).parent().parent().get(0)) {\r\n selectedProcedures.each(function (e) {\r\n $(this).find('.tecUid').val(ui.item.id);\r\n $(this).find('.tecUid').attr('value', ui.item.id);\r\n $(this).find('.tecText').val(ui.item.value);\r\n $(this).find('.tecText').attr('value', ui.item.value);\r\n });\r\n }\r\n }\r\n },\r\n change: function (event, ui) {\r\n if (!ui.item) {\r\n $(this).parent().find('input.tecUid').val(\"\");\r\n $(this).parent().find('input.tecText').val(\"\");\r\n }\r\n }\r\n };\r\n\r\n $('input#CheckRadiologist').on('change', function (e) {\r\n if ($('input#CheckRadiologist').is(':checked')) {\r\n $('table#selectedProcedures tr.selectedProcedureItem').each(function (e) {\r\n SetDefaultRadiologist($(this));\r\n });\r\n }\r\n });\r\n\r\n $('input#CheckTechnician').on('change', function (e) {\r\n if ($('input#CheckTechnician').is(':checked')) {\r\n $('table#selectedProcedures tr.selectedProcedureItem').each(function (e) {\r\n SetDefaultTechnician($(this));\r\n });\r\n }\r\n });\r\n\r\n $('input#CheckRoom').on('change', function (e) {\r\n if ($('input#CheckRoom').is(':checked')) {\r\n // TODO_Anthony drastically different from Add.js\r\n var roomUid = $('table#selectedProcedures tr.selectedProcedureItem').first().find('input.roomUID').val();\r\n var roomText = $('table#selectedProcedures tr.selectedProcedureItem').first().find('input.roomText').val();\r\n var roomOnDuty = $('table#selectedProcedures tr.selectedProcedureItem').first().find('input.roomOnDuty').val();\r\n $('table#selectedProcedures tr.selectedProcedureItem').each(function (e) {\r\n $(this).find('.roomUID').val(roomUid);\r\n $(this).find('.roomUID').attr('value', roomUid);\r\n $(this).find('.roomText').val(roomText);\r\n $(this).find('.roomText').attr('value', roomText);\r\n $(this).find('.roomOnDuty').val(roomOnDuty);\r\n $(this).find('.roomOnDuty').attr('value', roomOnDuty);\r\n });\r\n SharedOrderFunctions.checkOnDuty();\r\n if ($('#GroupChecks').is(':checked')) {\r\n deGroupChecks();\r\n groupChecks();\r\n }\r\n }\r\n });\r\n\r\n var defaultRadUid = viewbagDefaultRadiologistUID;\r\n var defaultRadText = viewbagDefaultRadiologistText;\r\n var SetDefaultRadiologist = function (row) {\r\n var radUid;\r\n var radText;\r\n\r\n if ($('input#CheckRadiologist').is(':checked')) {\r\n radUid = $('table#selectedProcedures tr.selectedProcedureItem').first().find('input.radUid').val();\r\n radText = $('table#selectedProcedures tr.selectedProcedureItem').first().find('input.radText').val();\r\n if (radUid == \"\") {\r\n radUid = defaultRadUid;\r\n radText = defaultRadText;\r\n }\r\n } else {\r\n radUid = defaultRadUid;\r\n radText = defaultRadText;\r\n }\r\n\r\n row.find('.radUid').val(radUid);\r\n row.find('.radUid').attr('value', radUid);\r\n row.find('.radText').val(radText);\r\n row.find('.radText').attr('value', radText);\r\n }\r\n\r\n var defaultTecUid = viewbagDefaultTechnicianUID;\r\n var defaultTecText = viewbagDefaultTechnicianText;\r\n var SetDefaultTechnician = function (row, uid, text) {\r\n var tecUid;\r\n var tecText;\r\n\r\n if ($('input#CheckTechnician').is(':checked')) {\r\n tecUid = $('table#selectedProcedures tr.selectedProcedureItem').first().find('input.tecUid').val();\r\n tecText = $('table#selectedProcedures tr.selectedProcedureItem').first().find('input.tecText').val();\r\n if (tecUid == \"\") {\r\n tecUid = defaultTecUid;\r\n tecText = defaultTecText;\r\n }\r\n } else {\r\n tecUid = defaultTecUid;\r\n tecText = defaultTecText;\r\n }\r\n\r\n row.find('.tecUid').val(tecUid);\r\n row.find('.tecUid').attr('value', tecUid);\r\n row.find('.tecText').val(tecText);\r\n row.find('.tecText').attr('value', tecText);\r\n }\r\n\r\n var SetLabels = function () {\r\n if ($('#Site_UID').length > 0) {\r\n $.ajax({\r\n url: \"/legacy/Orders/GetLabelsDetailForSite\",\r\n type: \"GET\",\r\n dataType: \"html\",\r\n data: {\r\n Site_UID: $('#Site_UID').val()\r\n },\r\n async: true,\r\n success: function (data) {\r\n if (data) {\r\n $('div#labelsDiv').html(data);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n var SetME = function () {\r\n if ($('#Site_UID').length > 0) {\r\n $.ajax({\r\n url: \"/legacy/Json/GetMEForSite\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n Site_UID: $('#Site_UID').val()\r\n },\r\n async: false,\r\n success: function (data) {\r\n if (data) {\r\n $('#Idgkb').val(data.ME);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n $('#Site_UID').on('change', function (e) {\r\n $('table#selectedProcedures tr.selectedProcedureItem').each(function (e) {\r\n SharedOrderFunctions.SetDefaultRoom($(this), false, viewbagDefaultRoomUID, viewbagDefaultRoomText);\r\n });\r\n SetME();\r\n SetLabels();\r\n });\r\n\r\n $('#subFieldProcedures').keypress(function (e) {\r\n if (e.keyCode == 13) {\r\n return false;\r\n }\r\n });\r\n\r\n $('#tblOrderExportFormats').on('click', 'td.delete', function (e) {\r\n if (!$('div#subPageContent').hasClass('disabled')) {\r\n $(this).parent().remove();\r\n $('#DropOrderExportFormats').append($('').val($(this).parent().find('input.orderEFID').val() + \"_\" + $(this).parent().find('input.orderEFOrderTriggerStatus').val() + \"_\" + $(this).parent().find('input.orderEFReportTriggerStatus').val()).html( $(this).parent().find('input.orderEFName').val() + ' | ' + $(this).parent().find('input.triggerStatus').val()));\r\n SharedOrderFunctions.sortOrderExportFormats();\r\n }\r\n });\r\n\r\n $('#tblOrderExportFormatsAdd td.add').on('click', function (e) {\r\n if (!$('div#subPageContent').hasClass('disabled')) {\r\n var val = $('#DropOrderExportFormats').val();\r\n if (val != \"-1\") {\r\n var text = $('#DropOrderExportFormats option:selected').text();\r\n var amount = $(this).parent().find('input.orderEFAmount').spinner(\"value\");\r\n var triggerStatus = text.substring(text.indexOf(\"|\")+1);\r\n var efID = val.split(\"_\")[0];\r\n var orderTriggerStatusID = val.split(\"_\")[1];\r\n var reportTriggerStatusID = val.split(\"_\")[2];\r\n\r\n var toAppend = ' ';\r\n toAppend += '';\r\n toAppend += '' + modality + ' ';\r\n toAppend += '' + code + '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += ' ';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += ' ';\r\n toAppend += '';\r\n toAppend += ' ';\r\n toAppend += ' ';\r\n toAppend += ' ';\r\n toAppend += ' ';\r\n toAppend += ' ';\r\n toAppend += ' ';\r\n toAppend += '';\r\n toAppend += ' Delete ';\r\n $('#tblOrderExportFormats').append(toAppend);\r\n $('.spinner').spinner(spinnerOptions);\r\n $('.spinner').ForceNumericOnly();\r\n $('#DropOrderExportFormats option[value=\"' + val + '\"]').remove();\r\n SharedOrderFunctions.sortOrderExportFormats();\r\n }\r\n }\r\n });\r\n\r\n $('table').on('click', 'td.refresh', function (e) {\r\n if (!$('div#subPageContent').hasClass('disabled')) {\r\n if ($(this).hasClass('done')) {\r\n $(this).find('input').val(\"0\");\r\n $(this).removeClass('done');\r\n $(this).addClass('notDone');\r\n } else {\r\n $(this).find('input').val(\"2\");\r\n $(this).removeClass('notDone');\r\n $(this).addClass('done');\r\n }\r\n }\r\n });\r\n\r\n\r\n $('#tblPhysExportFormatsApp').on('click', 'td.delete', function (e) {\r\n if (!$('div#subPageContent').hasClass('disabled')) {\r\n $(this).parent().remove();\r\n SharedOrderFunctions.SortPhysExportFormats('App');\r\n }\r\n });\r\n\r\n $('#tblPhysExportFormatsAppCC').on('click', 'td.delete', function (e) {\r\n if (!$('div#subPageContent').hasClass('disabled')) {\r\n $(this).parent().remove();\r\n SharedOrderFunctions.SortPhysExportFormats('AppCC');\r\n }\r\n });\r\n\r\n $('#tblPhysExportFormatsAppCC2').on('click', 'td.delete', function (e) {\r\n if (!$('div#subPageContent').hasClass('disabled')) {\r\n $(this).parent().remove();\r\n SharedOrderFunctions.SortPhysExportFormats('AppCC2');\r\n }\r\n });\r\n\r\n if ($('input#Applicant_UID').val() != \"0\") {\r\n SharedOrderFunctions.setActiveApplicantDetailAndRemoveMenuOptions(true, \"App\", viewbagUniquePrefix);\r\n }\r\n\r\n if ($('input#Applicant_CC_UID').val() != \"0\") {\r\n SharedOrderFunctions.setActiveApplicantDetailAndRemoveMenuOptions(true, \"AppCC\", viewbagUniquePrefix);\r\n }\r\n\r\n\r\n if ($('input#Applicant_CC_2_UID').val() != \"0\") {\r\n SharedOrderFunctions.setActiveApplicantDetailAndRemoveMenuOptions(true, \"AppCC2\", viewbagUniquePrefix);\r\n }\r\n\r\n $('.spinner').spinner(spinnerOptions);\r\n $('.spinner').ForceNumericOnly();\r\n $('.spinner2').spinner(spinnerOptions2);\r\n $('.spinner2').ForceNumericOnly();\r\n $('.tecText').autocomplete(autocompleteTechnicians);\r\n $('.radText').autocomplete(autocompleteRadiologists);\r\n $('.roomText').autocomplete(autocompleteRooms);\r\n\r\n SortSelectedProcedures();\r\n SharedOrderFunctions.SortPhysExportFormats('App');\r\n SharedOrderFunctions.SortPhysExportFormats('AppCC');\r\n SharedOrderFunctions.SortPhysExportFormats('AppCC2');\r\n SharedOrderFunctions.SortProceduresExportFormats();\r\n\r\n var unformattedModDate = $('span#modDate').html();\r\n var m = moment(unformattedModDate, \"MM/DD/YYYY hh:mm:ss A\");\r\n if (m.isValid()) {\r\n $('span#modDate').html(m.calendar());\r\n }\r\n\r\n $('input[name=\"EditableProcedure\"]').on('click', function (e) {\r\n $('#selectedProcedures tr').removeClass('recordActive');\r\n if ($(this).hasClass('checked')) {\r\n $(this).removeClass('checked');\r\n $(this).prop('checked', false);\r\n $(this).parent().parent().removeClass('recordActive');\r\n } else {\r\n $(this).parent().parent().addClass('recordActive');\r\n $(this).addClass('checked');\r\n $(this).prop('checked', true);\r\n }\r\n });\r\n\r\n $(\"#PopupPatientHealthInsuranceSpecificSearch\").change(function () {\r\n\r\n $('#PopupPatientHealthInsuranceText').autocomplete(\"search\");\r\n });\r\n\r\n $('#PopupPatientHealthInsuranceText').autocomplete({\r\n autoFocus: false,\r\n source: function (request, response) {\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteHealthInsurances\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term,\r\n specific: $('#PopupPatientHealthInsuranceSpecificSearch').is(':checked')\r\n },\r\n success: function (data) {\r\n if (data.length == 0) {\r\n $('#PopupPatientHealthInsuranceID').val(\"0\");\r\n $('#PopupPatientHealthInsuranceText').css('border-color', '#CD0A0A');\r\n }\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.FullText,\r\n value: item.FullText,\r\n id: item.ID\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 0,\r\n select: function (event, ui) {\r\n $('#PopupPatientHealthInsuranceID').val(ui.item.id);\r\n $('#PopupPatientHealthInsuranceText').attr('value', ui.item.value);\r\n $('#PopupPatientHealthInsuranceText').css('border-color', '#999');\r\n }\r\n });\r\n\r\n $('input#loadPatient').on('click', function (e) {\r\n useFilingCabinet('/Patients/Detail/' + modelPatientID);\r\n });\r\n\r\n $('input#loadPatientHistory').on('click', function (e) {\r\n useFilingCabinet(\"/Patients/OrderHistory/\" + modelPatientID);\r\n });\r\n\r\n if (!BelgianLayout) {\r\n $tabs.find('#openInvoiceTab').remove();\r\n $tabs.tabs(\"refresh\");\r\n }\r\n\r\n $('div#invoiceTab').on('change', 'input#OnDuty, ' +\r\n 'input#WIGW,' +\r\n ' input#AmbulantHospitalized,' +\r\n ' input#FreeOfContribution,' +\r\n ' input#FreeOfCharge,' +\r\n ' input#InvoiceCumulRules,' +\r\n ' input#InvoiceSupplement,' +\r\n ' input#InvoiceClaustrophobia,' +\r\n ' input#InvoiceCertificate'\r\n , function (e) {\r\n e.stopImmediatePropagation();\r\n\r\n GetInvoiceInformation(true);\r\n }\r\n );\r\n\r\n var SetInvoiceSituationParameters = function (value) {\r\n switch (value) {\r\n default:\r\n //NORMAL\r\n case \"1\":\r\n $('div#invoiceTab div#invoiceCompany').hide();\r\n $('div#invoiceTab div#invoiceEmployer').hide();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceFreeOfCharge label, div#invoiceTab div#invoiceFreeOfCharge input').show();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', true);\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').hide();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules input').prop('checked', true);\r\n companyFilled = false;\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').hide();\r\n\r\n break;\r\n //MISC\r\n case \"2\":\r\n $('div#invoiceTab div#invoiceCompany').hide();\r\n $('div#invoiceTab div#invoiceEmployer').hide();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceFreeOfCharge label, div#invoiceTab div#invoiceFreeOfCharge input').hide();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').hide();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').prop('checked', true).parent().show();\r\n invoiceMethod = 1;\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', false);\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').hide();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules input').prop('checked', true);\r\n companyFilled = false;\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').hide();\r\n\r\n break;\r\n //SOCIAL WELFARE\r\n case \"3\":\r\n $('div#invoiceTab div#invoiceCompany').show();\r\n $('div#invoiceTab div#invoiceEmployer').hide();\r\n $('div#invoiceTab div#invoiceCompany span.required').show();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceFreeOfCharge label, div#invoiceTab div#invoiceFreeOfCharge input').hide();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').hide();\r\n if (invoiceMethod > 2) {\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').prop('checked', true);\r\n invoiceMethod = 1;\r\n }\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').parent().show();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"2\"]').parent().show();\r\n\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', true);\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').hide();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules input').prop('checked', true);\r\n companyFilled = false;\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').hide();\r\n\r\n break;\r\n //EXPERTISE\r\n case \"4\":\r\n $('div#invoiceTab div#invoiceCompany').show();\r\n $('div#invoiceTab div#invoiceEmployer').show();\r\n $('div#invoiceTab div#invoiceCompany span.required').show();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', false);\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').hide();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').prop('checked', true).parent().show();\r\n invoiceMethod = 1;\r\n $('div#invoiceTab div#invoiceFreeOfCharge label, div#invoiceTab div#invoiceFreeOfCharge input').show();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').show();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules input').prop('checked', false);\r\n companyFilled = false;\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').hide();\r\n\r\n break;\r\n //INSURANCE COMPANY\r\n case \"5\":\r\n $('div#invoiceTab div#invoiceCompany').show();\r\n $('div#invoiceTab div#invoiceEmployer').show();\r\n $('div#invoiceTab div#invoiceCompany span.required').show();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', false);\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').hide();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').prop('checked', true).parent().show();\r\n invoiceMethod = 1;\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').show();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').show();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules input').prop('checked', true);\r\n companyFilled = false;\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').hide();\r\n\r\n break;\r\n //OTHER\r\n case \"6\":\r\n $('div#invoiceTab div#invoiceCompany').show();\r\n $('div#invoiceTab div#invoiceEmployer').hide();\r\n $('div#invoiceTab div#invoiceCompany span.required').hide();\r\n $('div#invoiceTab div#invoiceOnDuty label, div#invoiceTab div#invoiceOnDuty input').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate').show();\r\n $('div#invoiceTab div#invoiceInvoiceCertificate input').prop('checked', true);\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField').hide();\r\n if (invoiceMethod > 2) {\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').prop('checked', true);\r\n invoiceMethod = 1;\r\n }\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"1\"]').parent().show();\r\n $('div#invoiceTab div#invoiceInvoicePaymentMethod div.radioField input[value=\"2\"]').parent().show();\r\n\r\n $('div#invoiceTab div#invoiceInvoiceReferenceNumber').hide();\r\n $('div#invoiceTab div#invoiceInvoiceReferenceDateTime').hide();\r\n $('div#invoiceTab div#invoiceInvoiceCumulRules').show();\r\n //$('div#invoiceTab div#invoiceInvoiceCumulRules input').prop('checked', true);\r\n\r\n $('div#invoiceTab div#invoiceCompany span.infoIcon').show();\r\n\r\n break;\r\n }\r\n }\r\n\r\n invoiceMethod = $('input[name=\"InvoicePaymentMethod\"]:checked').val();\r\n SetInvoiceSituationParameters($('select#InvoiceSituation_UID').val());\r\n\r\n $('div#invoiceTab').on('change', 'select#InvoiceSituation_UID', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n SetInvoiceSituationParameters($(this).val());\r\n invoiceMethod = $('input[name=\"InvoicePaymentMethod\"]:checked').val();\r\n if (invoiceMethod == 2 || invoiceMethod == 4) {\r\n $('input#InvoiceCertificate').prop('checked', true);\r\n $('div#invoiceInvoiceCertificate').hide();\r\n } else {\r\n if ($(this).val() == \"3\" || $(this).val() == \"6\") {\r\n $('input#InvoiceCertificate').prop('checked', true);\r\n $('div#invoiceInvoiceCertificate').show();\r\n }\r\n }\r\n SetHealthInsuranceParameters(invoiceMethod);\r\n\r\n $('input#InvoiceCompany_Text').val(\"\");\r\n $('input#InvoiceCompany_UID').val(\"0\");\r\n GetInvoiceInformation(true);\r\n });\r\n\r\n $('div#invoiceTab').on('click', 'span.refreshAmountPatient', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n if (!$('div#subPageContent').hasClass('disabled') && !$('div#subPageContent').hasClass('disabledNone')) {\r\n amountPatientEdited = false;\r\n GetInvoiceInformation(true);\r\n }\r\n });\r\n\r\n $('div#invoiceTab').on('click', 'span.refreshTotalAmount', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n if (!$('div#subPageContent').hasClass('disabled') && !$('div#subPageContent').hasClass('disabledNone')) {\r\n totalAmountEdited = false;\r\n GetInvoiceInformation(true);\r\n }\r\n });\r\n\r\n $('form#editOrderForm').on('submit', function (e) {\r\n if ($('div#invoiceTab input.cleanInput').is(':focus')) {\r\n e.preventDefault();\r\n return false;\r\n }\r\n });\r\n\r\n $('#scanOrder').tooltip({\r\n tooltipClass: 'jqueryTooltip',\r\n content: function () {\r\n return resourceScanOrderValidationMessage.toUpperCase();\r\n },\r\n disabled: true,\r\n position: {\r\n my: \"left top\",\r\n at: \"left bottom\"\r\n },\r\n close: function (event, ui) {\r\n $('.jqueryTooltip').remove();\r\n },\r\n show: function (event, ui) {\r\n $('.jqueryTooltip').remove();\r\n }\r\n });\r\n\r\n let validateOrderImplementationDetailAjax;\r\n $('input#DateOfImplementation').bind('input', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n SharedOrderFunctions.validateOrderImplementationDate($(this), validateOrderImplementationDetailAjax, useProducts, modelPatientID)\r\n });\r\n\r\n let validateProcImplementationDetailAjax;\r\n $('body').on('keyup', '.procImplementation', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n SharedOrderFunctions.validateProcedureImplementationDate($(this), validateProcImplementationDetailAjax);\r\n });\r\n\r\n var setOndutyLevelCall;\r\n var setOnDutyLevel = function (e) {\r\n //doublecheck for ondutylevel. Otherwise sometimes onduty is not set correctly\r\n if (setOndutyLevelCall && setOndutyLevelCall.readyState != 4) {\r\n setOndutyLevelCall.abort();\r\n }\r\n var input = $(this);\r\n setOndutyLevelCall = $.ajax({\r\n type: \"GET\",\r\n url: \"/legacy/Json/ValidateDateTimeFormat\",\r\n async: true,\r\n data: {\r\n DateTime: $('#DateOfImplementation').val(),\r\n CheckOnDuty: true\r\n },\r\n success: function (data) {\r\n if (data.IsValid) {\r\n $('input#OnDutyLevel').val(data.OnDutyLevel);\r\n $('input#OnDutyLevelValue').val(data.OnDutyLevelValue);\r\n if (data.OnDutyLevel != 'N') {\r\n $('span#OnDutyLevelValueSpan').text(htmlDecode(data.OnDutyLevelValue));\r\n } else {\r\n $('span#OnDutyLevelValueSpan').text(\"\");\r\n }\r\n } else {\r\n input.addClass('error');\r\n }\r\n }\r\n });\r\n };\r\n\r\n setOnDutyLevel();\r\n\r\n $('div#invoiceTab').on('change', 'input[name=InvoicePaymentMethod]:radio', function (e) {\r\n e.stopImmediatePropagation();\r\n $('input[type=radio][name=InvoicePaymentMethod]').removeAttr('checked');\r\n $('input[type=radio][name=InvoicePaymentMethod]').removeProp('checked');\r\n $(this).attr('checked', 'checked');\r\n $(this).prop('checked', true);\r\n\r\n invoiceMethod = $('input[name=\"InvoicePaymentMethod\"]:checked').val();\r\n if (invoiceMethod == 2 || invoiceMethod == 4) {\r\n $('input#InvoiceCertificate').prop('checked', false);\r\n $('div#invoiceInvoiceCertificate').hide();\r\n } else {\r\n var selectedInvoice = $('select#InvoiceSituation_UID').val();\r\n if (selectedInvoice == \"3\" || selectedInvoice == \"6\") {\r\n $('input#InvoiceCertificate').prop('checked', true);\r\n $('div#invoiceInvoiceCertificate').show();\r\n }\r\n }\r\n SetHealthInsuranceParameters(invoiceMethod);\r\n GetInvoiceInformation(true);\r\n });\r\n\r\n $('#InvoiceCompany_Text').autocomplete({\r\n autoFocus: false,\r\n source: function (request, response) {\r\n $.ajax({\r\n url: \"/legacy/Json/AutoCompleteCompany\",\r\n type: \"GET\",\r\n dataType: \"json\",\r\n data: {\r\n term: request.term,\r\n invoiceSituation_UID: $('select#InvoiceSituation_UID').val()\r\n },\r\n success: function (data) {\r\n if (data.length == 0) {\r\n $('#InvoiceCompany_UID').val(\"0\");\r\n $('a#showCompanyDetail' + viewbagUniquePrefix).addClass('inActive');\r\n $('a#removeCompany' + viewbagUniquePrefix).addClass('inActive');\r\n $('#InvoiceCompany_Text').css('border-color', '#CD0A0A');\r\n }\r\n response($.map(data, function (item) {\r\n return {\r\n label: item.FullText,\r\n value: item.FullText,\r\n id: item.ID\r\n };\r\n }))\r\n }\r\n })\r\n },\r\n minLength: 0,\r\n select: function (event, ui) {\r\n $('#InvoiceCompany_UID').val(ui.item.id);\r\n $('a#showCompanyDetail' + viewbagUniquePrefix).removeClass('inActive');\r\n $('a#removeCompany' + viewbagUniquePrefix).removeClass('inActive');\r\n $('#InvoiceCompany_Text').attr('value', ui.item.value);\r\n $('#InvoiceCompany_Text').css('border-color', '#999');\r\n if ($('select#InvoiceSituation_UID').val() == 6) {\r\n companyFilled = true;\r\n GetInvoiceInformation();\r\n }\r\n }\r\n });\r\n\r\n\r\n $('a#showCompanyDialog' + viewbagUniquePrefix).on('click', function (e) {\r\n $('#divFindCompany' + viewbagUniquePrefix).dialog(\"open\");\r\n });\r\n\r\n $('button#btnCloseCompanyDialog' + viewbagUniquePrefix).on('click', function (e) {\r\n $('#divFindCompany' + viewbagUniquePrefix).dialog(\"close\");\r\n });\r\n\r\n $('#txtFindCompanyName' + viewbagUniquePrefix).on('keyup', function (e) {\r\n findCompanies();\r\n });\r\n $('#txtFindCompanyAddress' + viewbagUniquePrefix).on('keyup', function (e) {\r\n findCompanies();\r\n });\r\n\r\n var findCompanies = function (e) {\r\n $.ajax({\r\n type: 'POST',\r\n url: '/legacy/Orders/FindCompaniesForGrid',\r\n data: {\r\n Name: $('#txtFindCompanyName' + viewbagUniquePrefix).val(),\r\n Address: $('#txtFindCompanyAddress' + viewbagUniquePrefix).val(),\r\n InvoiceSituation_UID: $('select#InvoiceSituation_UID').val()\r\n },\r\n dataType: 'json',\r\n success:\r\n function (data) {\r\n $('#gridFindCompany' + viewbagUniquePrefix + ' tr:not(.tableHeader)').remove();\r\n $(\"#btnLoadSelectedCompany\" + viewbagUniquePrefix).attr(\"disabled\", true);\r\n if (data.items.length > 0) {\r\n $.each(data.items, function (e) {\r\n $('#gridFindCompany' + viewbagUniquePrefix).append('' + text.substring(0, text.indexOf(\"|\")-1);\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += ' ';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += ' ' + triggerStatus + '';\r\n toAppend += '';\r\n toAppend += '';\r\n toAppend += ' 0 ';\r\n toAppend += '';\r\n toAppend += ' ' + htmlDecode(resourceDelete) + ' ');\r\n });\r\n } else {\r\n $('#gridFindCompany' + viewbagUniquePrefix).append('' + this.ID + ' ' + this.FullName + ' ' + this.Address + ' ');\r\n }\r\n }\r\n });\r\n }\r\n\r\n $('#gridFindCompany' + viewbagUniquePrefix).on('click', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedCompany\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n });\r\n\r\n $('#gridFindCompany' + viewbagUniquePrefix).on('dblclick', 'tr.record', function (e) {\r\n $(this).parent().find('tr.focus').removeClass('focus');\r\n $(this).addClass('focus');\r\n $(\"#btnLoadSelectedCompany\" + viewbagUniquePrefix).removeAttr(\"disabled\");\r\n LoadSelectedCompany();\r\n });\r\n\r\n $('#btnLoadSelectedCompany' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($('select#InvoiceSituation_UID').val() == 6) {\r\n companyFilled = true;\r\n GetInvoiceInformation();\r\n }\r\n LoadSelectedCompany();\r\n });\r\n\r\n var LoadSelectedCompany = function (e) {\r\n var id = $('#gridFindCompany' + viewbagUniquePrefix).find('tr.focus').find('td.rowId').html();\r\n var name = $('#gridFindCompany' + viewbagUniquePrefix).find('tr.focus').find('td.rowName').html();\r\n var address = $('#gridFindCompany' + viewbagUniquePrefix).find('tr.focus').find('td.rowAddress').html();\r\n $('#divFindCompany' + viewbagUniquePrefix).dialog(\"close\");\r\n $('input#InvoiceCompany_Text').attr('value', name + \" - \" + address);\r\n $('input#InvoiceCompany_Text').val(name + \" - \" + address);\r\n $('input#InvoiceCompany_UID').attr('value', id);\r\n $('a#showCompanyDetail' + viewbagUniquePrefix).removeClass('inActive');\r\n $('a#removeCompany' + viewbagUniquePrefix).removeClass('inActive');\r\n $('#InvoiceCompany_Text').css('border-color', '#999');\r\n }\r\n\r\n // Set initial state of Detail/Remove btn in Company selection context-menu in Invoice tab\r\n if ($('#InvoiceCompany_Text').val()) {\r\n $('a#removeCompany' + viewbagUniquePrefix).removeClass('inActive');\r\n $('a#showCompanyDetail' + viewbagUniquePrefix).removeClass('inActive');\r\n companyFilled = true;\r\n }\r\n\r\n $('a#removeCompany' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n $('input#InvoiceCompany_UID').val(\"0\");\r\n $('input#InvoiceCompany_Text').val(\"\");\r\n $('input#InvoiceCompany_Text').attr('value', \"\");\r\n $(this).addClass('inActive');\r\n $('a#showCompanyDetail' + viewbagUniquePrefix).addClass('inActive');\r\n }\r\n if ($('select#InvoiceSituation_UID').val() == 6) {\r\n companyFilled = false;\r\n GetInvoiceInformation();\r\n }\r\n });\r\n\r\n $('a#showCompanyDetail' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n var id = $('input#InvoiceCompany_UID').val();\r\n useFilingCabinet('/Companies/Detail/' + id);\r\n }\r\n });\r\n\r\n $('#InvoiceCompany_Text').on('keyup', function (e) {\r\n if ($('select#InvoiceSituation_UID').val() == 6) {\r\n if ($(this).val() == \"\") {\r\n $('input#InvoiceCompany_UID').val(\"0\");\r\n $('input#InvoiceCompany_Text').val(\"\");\r\n $('input#InvoiceCompany_Text').attr('value', \"\");\r\n companyFilled = false;\r\n GetInvoiceInformation();\r\n }\r\n }\r\n });\r\n\r\n var SetHealthInsuranceParameters = function (paymentMethod) {\r\n if (paymentMethod == '2' || paymentMethod == '4') {\r\n $('#healthInsuranceParams span.none').addClass('noneRequired');\r\n } else {\r\n $('#healthInsuranceParams span.none').removeClass('noneRequired');\r\n }\r\n }\r\n\r\n $('.infoHoverPopup').hide();\r\n\r\n\r\n $('input#AddPaymentInput').ForcePositiveNegativeNumericOnly();\r\n $('input#AddPaymentPlanInput').ForcePositiveNegativeNumericOnly();\r\n\r\n\r\n var SortPaymentItems = function () {\r\n var payments = $('#donePayments table.donePayment').find('.paymentRow');\r\n $.each(payments, function (index, obj) {\r\n $(payments[index]).find('input.hiddenDonePaymentValue').attr('name', 'ListPaymentItem[' + index + '].Amount');\r\n $(payments[index]).find('input.hiddenDonePaymentMethod').attr('name', 'ListPaymentItem[' + index + '].Method');\r\n $(payments[index]).find('input.hiddenDonePaymentUser').attr('name', 'ListPaymentItem[' + index + '].UserReceived');\r\n });\r\n }\r\n\r\n $('input#confirmInvoiceButton').on('click', function (e) {\r\n SharedOrderFunctions.ShowConfirmInvoiceDialog();\r\n });\r\n\r\n $('#btnCloseConfirmInvoice' + viewbagUniquePrefix).on('click', function (e) {\r\n if (SharedOrderFunctions.ValidatePaymentPlan()) {\r\n $('#dialogConfirmInvoice' + viewbagUniquePrefix).dialog('close');\r\n } else {\r\n var validation = $('#dialogConfirmInvoice' + viewbagUniquePrefix).find('span.validation');\r\n validation.text(resourceInvalidPaymentPlan);\r\n validation.show();\r\n return false;\r\n }\r\n });\r\n\r\n $('input#AddPaymentInput').on('keypress', function (e) {\r\n if (e.keyCode == 13) {\r\n $('span#btnAddPayment').trigger('click');\r\n return false;\r\n }\r\n });\r\n\r\n $('select#PayedByMethod').on('keypress', function (e) {\r\n if (e.keyCode == 13) {\r\n $('span#btnAddPayment').trigger('click');\r\n return false;\r\n }\r\n });\r\n\r\n $('input#AddPaymentPlanInput').on('keypress', function (e) {\r\n if (e.keyCode == 13) {\r\n $('span#btnAddPaymentPlan').trigger('click');\r\n return false;\r\n }\r\n });\r\n\r\n $('input#AddPaymentPlanDate').on('keypress', function (e) {\r\n if (e.keyCode == 13) {\r\n $('span#btnAddPaymentPlan').trigger('click');\r\n return false;\r\n }\r\n });\r\n\r\n $('i.unlinkInvoiceIcon').off();\r\n $('i.unlinkInvoiceIcon').on('click', function (e) {\r\n e.stopImmediatePropagation();\r\n e.preventDefault();\r\n $('#txtUnlinkPaymentId' + viewbagUniquePrefix).val($(this).next().attr('data-paymentId'))\r\n $('#divUnlinkInvoice' + viewbagUniquePrefix).dialog(\"open\");\r\n });\r\n\r\n $('button#btnCloseUnlinkInvoiceDialog' + viewbagUniquePrefix).on('click', function (e) {\r\n $('#divUnlinkInvoice' + viewbagUniquePrefix).dialog(\"close\");\r\n });\r\n\r\n $('#btnUnlinkSelectedInvoice' + viewbagUniquePrefix).on('click', function (e) {\r\n UnlinkSelectedInvoice();\r\n });\r\n\r\n var UnlinkSelectedInvoice = function (e) {\r\n var paymentId = $('#txtUnlinkPaymentId' + viewbagUniquePrefix).val();\r\n $.ajax({\r\n url: \"/legacy/Invoices/UnlinkInvoiceFromPayment\",\r\n type: \"POST\",\r\n dataType: \"json\",\r\n async: false,\r\n data: {\r\n paymentId: paymentId\r\n },\r\n success: function (data) {\r\n $('label.unlinkInvoice[data-paymentId= ' + paymentId + ']').parent().parent().remove();\r\n SharedOrderFunctions.CalculateInvoiceAmounts();\r\n SortPaymentItems();\r\n $('#divUnlinkInvoice' + viewbagUniquePrefix).dialog(\"close\");\r\n }\r\n });\r\n }\r\n\r\n $('dd#donePayments table.donePayment').on('click', 'td.delete', function (e) {\r\n const row = $(this).parent();\r\n const id = row.attr('x-paymentID');\r\n modelPayments.forEach(x => {\r\n if (x.ID != id) return;\r\n x.deleted = true;\r\n });\r\n row.remove();\r\n SharedOrderFunctions.CalculateInvoiceAmounts();\r\n SortPaymentItems();\r\n });\r\n\r\n $('span#btnAddPayment').on('click', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n var dialog = $('#dialogConfirmInvoice' + viewbagUniquePrefix);\r\n var validation = dialog.find('span.validation');\r\n var amount = $('input#AddPaymentInput').val();\r\n var amountToPay = dialog.find('#stillToPay span').text();\r\n\r\n if (!$.isNumeric(amount)) {\r\n validation.text(htmlDecode(resourceErrorValidAmount));\r\n validation.show();\r\n return false;\r\n } else if (parseFloat(amount, 10) > parseFloat(amountToPay, 10)) {\r\n validation.text(htmlDecode(resourceErrorValidAmount));\r\n validation.show();\r\n return false;\r\n }\r\n\r\n var amountNumber = parseFloat(amount, 10);\r\n var selectedMethod = $(\"#PayedByMethod option:selected\").text();\r\n var selectedMethodID = $(\"#PayedByMethod\").val();\r\n\r\n addPaymentRow(0, amountNumber, selectedMethod, selectedMethodID, true);\r\n\r\n SharedOrderFunctions.CalculateInvoiceAmounts();\r\n SortPaymentItems();\r\n });\r\n\r\n let addPaymentRow = (id, amountNumber, selectedMethod, selectedMethodID, isNew, userReceived, dateAdded) => {\r\n const donePayments = $('dd#donePayments table.donePayment');\r\n const amount = amountNumber.toFixed(2).toString();\r\n let lineToAdd = `resourceNoCompaniesFound ';\r\n donePayments.append(lineToAdd);\r\n };\r\n\r\n $('dd#donePaymentsPlan table.donePaymentPlan').on('click', 'td.delete', function (e) {\r\n var dialog = $('#dialogConfirmInvoice' + viewbagUniquePrefix);\r\n $(this).parent().remove();\r\n dialog.find('.toAddPaymentPlan').show();\r\n SharedOrderFunctions.CalculateInvoiceAmounts();\r\n SharedOrderFunctions.SortPaymentPlanItems();\r\n });\r\n\r\n $('span#btnAddPaymentPlan').on('click', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n var dialog = $('#dialogConfirmInvoice' + viewbagUniquePrefix);\r\n var validation = dialog.find('span.validation');\r\n var amount = parseFloat($('input#AddPaymentPlanInput').val());\r\n var dueDate = $('input#AddPaymentPlanDate').val();\r\n var amountPaymentPlan = parseFloat(dialog.find('#totalDonePaymentsPlan span').text());\r\n var totalAmount = parseFloat(dialog.find('dd#totalAmount span').text());\r\n\r\n if (!$.isNumeric(amount) || amount <= 0) {\r\n validation.text(htmlDecode(resourceErrorValidAmount));\r\n validation.show();\r\n return false;\r\n } else if (parseFloat((amount + amountPaymentPlan).toFixed(2)) > parseFloat(totalAmount.toFixed(2))) {\r\n validation.text(htmlDecode(resourceErrorValidAmount));\r\n validation.show();\r\n return false;\r\n }\r\n\r\n var dueDateMoment = moment(dueDate, \"DD/MM/YYYY\", true);\r\n if (dueDateMoment == null || !dueDateMoment.isValid()) {\r\n validation.text(resourceInvalidDueDate);\r\n validation.show();\r\n return false;\r\n }\r\n\r\n var donePayments = $('dd#donePaymentsPlan table.donePaymentPlan');\r\n\r\n var paymentPlanLength = $(\".donePaymentPlan tr\").length - 1;\r\n var lineToAdd = '€ ` + amount;\r\n lineToAdd += '';\r\n lineToAdd += ' ';\r\n lineToAdd += '' + selectedMethod + ' ';\r\n if (isNew)\r\n lineToAdd += ' ';\r\n else {\r\n lineToAdd += `${userReceived} `;\r\n lineToAdd += `${dateAdded} `;\r\n }\r\n lineToAdd += ' ';\r\n\r\n donePayments.append(lineToAdd);\r\n\r\n SharedOrderFunctions.CalculateInvoiceAmounts();\r\n SharedOrderFunctions.SortPaymentPlanItems();\r\n });\r\n\r\n $('#btnConfirmInvoice' + viewbagUniquePrefix).on('click', function (e) {\r\n SharedOrderFunctions.ConfirmInvoice(viewbagUniquePrefix);\r\n });\r\n\r\n $('#btnConfirmPrepayment' + viewbagUniquePrefix).on('click', function (e) {\r\n if (SharedOrderFunctions.ValidatePaymentPlan()) {\r\n $('input#ConfirmInvoice').val(\"false\");\r\n $('input#ConfirmInvoice').attr('value', \"false\");\r\n $('input#ConfirmPrepayment').val(\"true\");\r\n $('input#ConfirmPrepayment').attr('value', \"true\");\r\n\r\n $('#btnConfirmPrepayment' + viewbagUniquePrefix).prop('disabled', true);\r\n\r\n SharedOrderFunctions.ConfirmInvoiceFunctionality();\r\n } else {\r\n var validation = $('#dialogConfirmInvoice' + viewbagUniquePrefix).find('span.validation');\r\n validation.text(resourceInvalidPaymentPlan);\r\n validation.show();\r\n return false;\r\n }\r\n });\r\n\r\n SortPaymentItems();\r\n SharedOrderFunctions.SortPaymentPlanItems();\r\n\r\n var SwitchTabs = function (e) {\r\n if ($tabs !== undefined) {\r\n var activeTab = 0;\r\n $(\".ui-tabs-panel\").each(function (i, tab) {\r\n if ($(tab).attr('aria-expanded') == \"true\") {\r\n activeTab = i;\r\n }\r\n });\r\n var toActivateTab = activeTab + 1;\r\n if (toActivateTab > totalTabs) {\r\n toActivateTab = 0;\r\n }\r\n $tabs.tabs('option', 'active', toActivateTab);\r\n }\r\n }\r\n\r\n $('body').on('keypress', function (e) {\r\n // TODO_Anthony MR question: this is the ² key...\r\n if (e.which == 178) {\r\n if ($(':focus').hasClass('auto')) {\r\n $(':focus').autocomplete('close');\r\n $(':focus').autocomplete('disable');\r\n e.preventDefault();\r\n SwitchTabs();\r\n return false;\r\n } else if ($(':focus').length == 0) {\r\n SwitchTabs();\r\n return false;\r\n } else {\r\n e.preventDefault();\r\n SwitchTabs();\r\n return false;\r\n }\r\n } else {\r\n if ($(':focus').hasClass('auto')) {\r\n $(':focus').autocomplete('enable');\r\n }\r\n }\r\n });\r\n\r\n $('input.numeric').ForceNumericOnly();\r\n\r\n\r\n CheckToDisableCertificateNumber();\r\n\r\n var OpenOrderReport = function (e) {\r\n useFilingCabinet(\"/Reports/OrderDetail/\" + modelID);\r\n }\r\n\r\n $('a#openReportFromTab').on('click', function (e) {\r\n e.stopImmediatePropagation();\r\n OpenOrderReport();\r\n });\r\n\r\n $('input#loadReport').on('click', function (e) {\r\n e.stopImmediatePropagation();\r\n OpenOrderReport();\r\n });\r\n\r\n $('body').on('change', '.statusDrop', function (e) {\r\n });\r\n\r\n var highlightPartialRecords = function (parent, children) {\r\n $(parent).addClass('hoveredExportFormat');\r\n $.each(children, function (i, y) {\r\n $(y).parent().addClass('hoveredExportFormat');\r\n });\r\n }\r\n\r\n var deHighlightPartialRecords = function (parent, children) {\r\n $(parent).removeClass('hoveredExportFormat');\r\n $.each(children, function (i, y) {\r\n $(y).parent().removeClass('hoveredExportFormat');\r\n });\r\n }\r\n\r\n $('body').on('mouseover', 'tr.orderExportFormatRecord', function (e) {\r\n var uid = $(this).find('.orderExportFormatUID').val();\r\n var allPartials = $('.partialEFOrderHasExport_UID[value=' + uid + ']');\r\n highlightPartialRecords($(this), allPartials);\r\n }).on('mouseout', 'tr.orderExportFormatRecord', function (e) {\r\n var uid = $(this).find('.orderExportFormatUID').val();\r\n var allPartials = $('.partialEFOrderHasExport_UID[value=' + uid + ']');\r\n deHighlightPartialRecords($(this), allPartials);\r\n });\r\n\r\n $('body').on('mouseover', 'tr.partialEFRecord', function (e) {\r\n var uid = $(this).find('.partialEFOrderHasExport_UID').val();\r\n var all = $('.orderExportFormatUID[value=' + uid + ']').parent();\r\n highlightPartialRecords($(this), all);\r\n }).on('mouseout', 'tr.partialEFRecord', function (e) {\r\n var uid = $(this).find('.partialEFOrderHasExport_UID').val();\r\n var all = $('.orderExportFormatUID[value=' + uid + ']').parent();\r\n deHighlightPartialRecords($(this), all);\r\n });\r\n\r\n $('body').on('click', \".radText, .tecText, .roomText\", function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n $(this).select();\r\n });\r\n\r\n $('.switchRequestingAndCC').on('click', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n\r\n SharedOrderFunctions.SwitchRequestingAndCCApplicant(viewbagUniquePrefix);\r\n });\r\n\r\n\r\n $('#btnResendPOWDialogOK').on('click', function (e) {\r\n $('#divResendPOWDialog').dialog('close');\r\n });\r\n\r\n var resendToPOW = function (e) {\r\n $.ajax({\r\n url: \"/legacy/Reports/ResendToPOW\",\r\n type: \"POST\",\r\n dataType: \"json\",\r\n data: {\r\n Order_UID: modelID\r\n },\r\n success: function (data) {\r\n if (data.AllOk) {\r\n if (data.AllResent) {\r\n //has been sent\r\n $('#resendPOWMessage').html(resourceAllReportsResent);\r\n } else {\r\n if (!data.HasReport) {\r\n $('#resendPOWMessage').html(resourceErrorHasNoReport);\r\n } else {\r\n if (!data.AllValidated && data.HasReport) {\r\n $('#resendPOWMessage').html(resourceErrorNotAllReportsValidated);\r\n } else {\r\n $('#resendPOWMessage').html(resourceErrorReportNotValidated);\r\n }\r\n }\r\n console.log('NOT ok: HasReport ' + data.HasReport + ', ReportIsValidated ' + data.ReportIsValidated);\r\n }\r\n $('#divResendPOWDialog').dialog('open');\r\n } else {\r\n if (data.Error) {\r\n alert('Error resending to POW: ' + data.Message);\r\n console.log('ERROR: ' + data.Message);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n $('#resendPOWButton').on('click', function (e) {\r\n resendToPOW();\r\n });\r\n\r\n var ResendExportFormat = function (uid) {\r\n $.ajax({\r\n type: 'POST',\r\n url: '/legacy/Export/ExportFromOrderDetail',\r\n data: {\r\n Order_HasExport_UID: uid\r\n },\r\n dataType: 'json',\r\n success: function (data) {\r\n if (data.AllOk) {\r\n $('#resendExportDialog span.popupInfo').html(htmlDecode(resourceExportSuccess));\r\n $('#resendExportDialog span.popupInfo').css('background-color', '#fefebf');\r\n $('#resendExportDialog span.popupInfo').css('color', '#666');\r\n } else {\r\n $('#resendExportDialog span.popupInfo').html(htmlDecode(resourceExportFailed) + \" (\" + htmlDecode(data.Message) + \")\");\r\n $('#resendExportDialog span.popupInfo').css('background-color', '#ffebeb');\r\n $('#resendExportDialog span.popupInfo').css('color', '#cd0a0a');\r\n }\r\n\r\n $('#resendExportDialog').dialog('open');\r\n }\r\n });\r\n };\r\n\r\n var ResendPartialExportFormat = function (uid) {\r\n $.ajax({\r\n type: 'POST',\r\n url: '/legacy/Export/ExportPartialFromOrderDetail',\r\n data: {\r\n Report_HasExport_UID: uid\r\n },\r\n dataType: 'json',\r\n success: function (data) {\r\n if (data.AllOk) {\r\n $('#resendExportDialog span.popupInfo').html(htmlDecode(resourceExportSuccess));\r\n $('#resendExportDialog span.popupInfo').css('background-color', '#fefebf');\r\n $('#resendExportDialog span.popupInfo').css('color', '#666');\r\n } else {\r\n $('#resendExportDialog span.popupInfo').html(htmlDecode(resourceExportFailed) + \" (\" + htmlDecode(data.Message) + \")\");\r\n $('#resendExportDialog span.popupInfo').css('background-color', '#ffebeb');\r\n $('#resendExportDialog span.popupInfo').css('color', '#cd0a0a');\r\n }\r\n\r\n $('#resendExportDialog').dialog('open');\r\n }\r\n });\r\n };\r\n\r\n $('#tblPhysExportFormatsApp, #tblPhysExportFormatsAppCC, #tblPhysExportFormatsAppCC2, #tblOrderExportFormats, #tblProcedureExportFormat, #tblProductExportFormat').on('click', 'td.resend', function (e) {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n if (!$('div#subPageContent').hasClass('disabled')) {\r\n var uid = $(this).parent().find('input.orderExportFormatUID').val();\r\n ResendExportFormat(uid);\r\n }\r\n });\r\n\r\n $('tr.partialEFRecord').on('click', 'td.resend', function (e) {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n if (!$('div#subPageContent').hasClass('disabled')) {\r\n var uid = $(this).parent().find('input.partialEFReportHasExport_UID').val();\r\n ResendPartialExportFormat(uid);\r\n }\r\n });\r\n\r\n\r\n var previousOPStatus;\r\n $('body').on('focus', 'select.statusDrop', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n previousOPStatus = $(this).val();\r\n\r\n if ($(this).find('option.lock').length > 0) {\r\n $(this).find('option').each(function (i, y) {\r\n if (!$(y).hasClass('lock')) {\r\n $(y).prop('disabled', 'disabled');\r\n }\r\n });\r\n }\r\n }).on('change', 'select.statusDrop', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n var statusID = $(this).val();\r\n if ((statusID == 4 || statusID == 5 || statusID == 6) && (previousOPStatus < 4)) {\r\n var time = moment().format(\"DD/MM/YYYY HH:mm\");\r\n var inputImplementation = $(this).parent().parent().find('td.implementation').find('input.procImplementation');\r\n inputImplementation.val(time);\r\n inputImplementation.attr('value', time);\r\n inputImplementation.removeClass('original');\r\n inputImplementation.addClass('changed');\r\n\r\n var removeChangedFromDateTimeProcedures = function () {\r\n inputImplementation.removeClass('changed');\r\n inputImplementation.addClass('original');\r\n };\r\n setTimeout(removeChangedFromDateTimeProcedures, 1500);\r\n\r\n if(SharedOrderFunctions.checkDatesWhenProcedureDateChangedInOrder(inputImplementation))\r\n {\r\n GetInvoiceInformation();\r\n }\r\n }\r\n previousOPStatus = statusID;\r\n GetInvoiceInformation();\r\n });\r\n\r\n $('#ReadyForInvoicing').on('click', function () {\r\n if ($(this).prop('checked') && modelReadyForInvoicing === 'True') {\r\n $('#ReadyForInvoicingReset').val(true);\r\n }\r\n });\r\n\r\n $('#MergeWithPatient_UID').val(\"\");\r\n\r\n $('table#mergePatientTable' + viewbagUniquePrefix + ' tbody').on('dblclick', 'tr.record', function (e) {\r\n var id = $(this).find('td.id').text();\r\n if (id) {\r\n useFilingCabinet('/Patients/Detail/' + id);\r\n }\r\n });\r\n\r\n $('input#searchMergePatient' + viewbagUniquePrefix).bind('keydown', function (e) {\r\n if (e.keyCode == 13) {\r\n SharedOrderFunctions.FindPatientsToMergeForOrder(viewbagUniquePrefix, modelPatientID);\r\n return false;\r\n }\r\n });\r\n\r\n $('table#mergePatientTable' + viewbagUniquePrefix + ' tbody').on('click', 'tr.record', function (e) {\r\n $('table#mergePatientTable' + viewbagUniquePrefix + ' tbody tr.record').removeClass('activeRecord');\r\n $(this).addClass('activeRecord');\r\n $('button#btnConfirmMerge' + viewbagUniquePrefix).removeAttr('disabled');\r\n });\r\n\r\n\r\n $('#btnCancelMerge' + viewbagUniquePrefix).on('click', function (e) {\r\n $('#divMergePatient' + viewbagUniquePrefix).dialog('close');\r\n CheckLockBeforeSaving($('#lockableController').text(), modelID, \"editOrderForm\");\r\n });\r\n\r\n $('#btnConfirmMerge' + viewbagUniquePrefix).on('click', function (e) {\r\n $('#divMergePatient' + viewbagUniquePrefix).dialog('close');\r\n var row = $('table#mergePatientTable' + viewbagUniquePrefix + ' tbody').find('tr.activeRecord');\r\n\r\n var id = row.find('td.id').text();\r\n if (id) {\r\n $('#MergeWithPatient_UID').val(id);\r\n CheckLockBeforeSaving($('#lockableController').text(), modelID, \"editOrderForm\");\r\n } else {\r\n CheckLockBeforeSaving($('#lockableController').text(), modelID, \"editOrderForm\");\r\n }\r\n });\r\n\r\n $('#divEditWeight' + viewbagUniquePrefix + ' input').ForceNumericOnly();\r\n $('#divEditLength' + viewbagUniquePrefix + ' input').ForceNumericWithoutPunctuation();\r\n\r\n\r\n if (viewbagErrorVersionIncreased && viewbagErrorVersionIncreased == 'True') {\r\n $('div#divVersionChanged' + viewbagUniquePrefix).dialog('open');\r\n\r\n $('#btnOverwrite' + viewbagUniquePrefix).on('click', function () {\r\n $('#editOrderForm').attr('data-ajax-url', \"/legacy/Orders/EditDetail/\" + modelID + \"?patientId=\" + modelPatientID + \"&overwrite=true\");\r\n CheckLockBeforeSaving($('#lockableController').text(), modelID, \"editOrderForm\");\r\n });\r\n\r\n $('#btnDiscard' + viewbagUniquePrefix).on('click', function () {\r\n closeActiveFile(true);\r\n });\r\n\r\n $('#btnReload' + viewbagUniquePrefix).on('click', function () {\r\n closeActiveFile(false);\r\n });\r\n } else {\r\n $('div#divVersionChanged' + viewbagUniquePrefix).dialog('close');\r\n }\r\n\r\n\r\n $('button#btnCloseDialogAlreadyHadProcedureRecently').on('click', function (e) {\r\n $('#dialogAlreadyHadProcedureRecently').dialog(\"close\");\r\n });\r\n\r\n const downloadStringAsFile = function(str, fileName) {\r\n var url = window.URL || window.webkitURL;\r\n var link = url.createObjectURL(new Blob([str]));\r\n var a = document.createElement(\"a\");\r\n a.setAttribute('download', fileName);\r\n a.href = link;\r\n document.body.appendChild(a);\r\n a.click();\r\n a.remove();\r\n }\r\n\r\n const downloadXMLRequest = function(orderID) {\r\n $.ajax({\r\n method: 'POST',\r\n url: '/legacy/Orders/GetExportXMLs',\r\n data: {orderID: orderID},\r\n success: function(data) {\r\n downloadStringAsFile(data, 'xml-download-' + orderID + '.xml');\r\n }\r\n });\r\n }\r\n\r\n var checkPatientProcedureHistory = function (procedure_ids) {\r\n\r\n //check if procedure was done in last 24 hours\r\n $.ajax({\r\n url: \"/legacy/Orders/CheckPatientProcedureHistory\",\r\n type: \"GET\",\r\n async: true,\r\n dataType: \"json\",\r\n data: {\r\n Order_UID: modelID,\r\n Procedure_UIDs: procedure_ids,\r\n Patient_UID: modelPatientID,\r\n Date: $('#DateOfImplementation').val()\r\n },\r\n success: function (data) {\r\n }\r\n });\r\n };\r\n if (viewbagOpenInScannedOrderTab && viewbagOpenInScannedOrderTab == 'True') {\r\n $(document).ready(function () {\r\n setTimeout(function (y) {\r\n $('li#openOrderDocumentTab a').trigger('click');\r\n }, 250);\r\n });\r\n }\r\n else if (viewbagOpenInInvoiceTab && viewbagOpenInInvoiceTab == 'True') {\r\n $(document).ready(function () {\r\n setTimeout(function (y) {\r\n $('li#openInvoiceTab a').trigger('click');\r\n }, 250);\r\n });\r\n }\r\n\r\n if (modelPatientGeneralPractitionerID) {\r\n $('#addGeneralPractitionerAsApp' + viewbagUniquePrefix).removeClass('inActive');\r\n $('#addGeneralPractitionerAsAppCC' + viewbagUniquePrefix).removeClass('inActive');\r\n $('#addGeneralPractitionerAsAppCC2' + viewbagUniquePrefix).removeClass('inActive');\r\n\r\n $('#addGeneralPractitionerAsApp' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n SharedOrderFunctions.LoadApplicantWithID(modelPatientGeneralPractitionerID, \"App\", viewbagUniquePrefix);\r\n if (hasScreening) {\r\n LoadRequestForm('App', modelPatientGeneralPractitionerID, htmlDecode(patientModel.GeneralPractitionerText));\r\n }\r\n }\r\n });\r\n\r\n $('#addGeneralPractitionerAsAppCC' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n SharedOrderFunctions.LoadApplicantWithID(modelPatientGeneralPractitionerID, \"AppCC\", viewbagUniquePrefix);\r\n if (hasScreening) {\r\n LoadRequestForm('AppCC', modelPatientGeneralPractitionerID, htmlDecode(patientModel.GeneralPractitionerText));\r\n }\r\n }\r\n });\r\n\r\n $('#addGeneralPractitionerAsAppCC2' + viewbagUniquePrefix).on('click', function (e) {\r\n if ($(this).hasClass('inActive')) {\r\n e.preventDefault();\r\n } else {\r\n SharedOrderFunctions.LoadApplicantWithID(modelPatientGeneralPractitionerID, \"AppCC2\", viewbagUniquePrefix);\r\n if (hasScreening) {\r\n LoadRequestForm('AppCC2', modelPatientGeneralPractitionerID, htmlDecode(patientModel.GeneralPractitionerText));\r\n }\r\n }\r\n });\r\n }\r\n ;\r\n\r\n if (pacsIntegration && pacsIntegration == 'True') {\r\n $('td.exProcedure').on('mousedown', function (e) {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n var number = $(this).find('input.uid').val();\r\n if (!number || !(e.which == 1 || e.which == 2))\r\n return;\r\n\r\n var compare = e.which == 1 ? false : true;\r\n ReportSharedFunctions.LaunchPacsIntegrationFor(number, null, compare)\r\n .then((data) => {\r\n if (data.Done && data.Synapse5) {\r\n window.open(data.Synapse5URL, 'synapse5Window');\r\n }\r\n });\r\n });\r\n }\r\n\r\n if (modelConfirmInvoice == 'False') {\r\n $('li#deleteOrder a').on('click', function (e) {\r\n $('#divConfirmDeleteOrder' + viewbagUniquePrefix + ' .dialogInput p').text(\"\");\r\n $('#divConfirmDeleteOrder' + viewbagUniquePrefix).dialog('open');\r\n });\r\n\r\n $('button#btnCancelDeleteOrder' + viewbagUniquePrefix).on('click', function (e) {\r\n $('#divConfirmDeleteOrder' + viewbagUniquePrefix).dialog('close');\r\n });\r\n\r\n $('button#btnConfirmDeleteOrder' + viewbagUniquePrefix).on('click', function (e) {\r\n\r\n $.ajax({\r\n type: 'GET',\r\n async: false,\r\n url: '/legacy/Orders/DeleteOrder',\r\n data: {Order_UID: modelID},\r\n dataType: 'json',\r\n success:\r\n function (data) {\r\n if (data.Error) {\r\n $('#divConfirmDeleteOrder' + viewbagUniquePrefix + ' .dialogInput p').text(data.Message);\r\n } else if (data.AllOk) {\r\n closeActiveFile(true, true);\r\n }\r\n }\r\n });\r\n\r\n $('#divConfirmDeleteOrder' + viewbagUniquePrefix).dialog('close');\r\n });\r\n }\r\n\r\n if (viewbagEditMode && viewbagEditMode == 'True') {\r\n if ($('span#editFromStart').text() == \"false\") {\r\n $.ajax({\r\n type: 'POST',\r\n url: '/legacy/Locks/TryCreateLockFile',\r\n data: { LockType: LockType.Order, RecordID: modelID, CheckCabinet: false },\r\n async: false,\r\n dataType: 'json',\r\n success:\r\n function (data) {\r\n if (data.Done) {\r\n EnableEditing();\r\n window.addLocks(new URLSearchParams(window.location.search).get('fc') * 1, data.LockUIDs);\r\n }\r\n else if (!data.Done) {\r\n window.showLockedFileDialog(data, null, EnableEditing, true);\r\n $('input#confirmInvoiceButton').hide();\r\n $('#scanOrder').hide();\r\n $('span#editFromStart').text(\"true\");\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n\r\n $('#btnOkReasonForCancelationInOrder').on('click', function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n\r\n var cancellationReasonInOrderUID = $('select#CancellationReasonInOrder_UID').val();\r\n var selectedReasonText = $(\"select#CancellationReasonInOrder_UID option:selected\").text();\r\n var cancellationReasonText = htmlDecode(resourceCancellationReason + \": \" + selectedReasonText);\r\n\r\n $('#CancellationReason_UID').val(cancellationReasonInOrderUID);\r\n $('#CancellationReason_Text').val(cancellationReasonText);\r\n\r\n $('#cancellationReason').text(cancellationReasonText);\r\n $('#cancellationReason').show();\r\n\r\n $('div#divReasonForCancelationInOrder').dialog('close');\r\n });\r\n\r\n var ChooseCanceledStatus = function (orderID) {\r\n $('div#divReasonForCancelationInOrder').dialog('open');\r\n };\r\n\r\n\r\n if (modelCancellationReasonID) {\r\n $('#cancellationReason').show();\r\n } else {\r\n $('#cancellationReason').hide();\r\n }\r\n\r\n var setChangedFromVisitSupplementChanged = function () {\r\n var VisitSupplementChanged = $('#VisitSupplementChanged');\r\n VisitSupplementChanged.removeClass('original');\r\n VisitSupplementChanged.addClass('changed');\r\n };\r\n\r\n var removeChangedFromVisitSupplementChanged = function () {\r\n var VisitSupplementChanged = $('#VisitSupplementChanged');\r\n VisitSupplementChanged.removeClass('changed');\r\n VisitSupplementChanged.addClass('original');\r\n };\r\n\r\n if (viewbagSupplementChangedWithUpdate && viewbagSupplementChangedWithUpdate == 'True') {\r\n var newvalue = viewbagSupplementNewValue;\r\n var VisitSupplementChanged = $('#VisitSupplementChanged');\r\n VisitSupplementChanged.show();\r\n if (newvalue == \"true\") {\r\n VisitSupplementChanged.text(htmlDecode(resourceSupplementUpdatedTrue));\r\n }\r\n if (newvalue == \"false\") {\r\n VisitSupplementChanged.text(htmlDecode(resourceSupplementUpdatedFalse));\r\n }\r\n setTimeout(setChangedFromVisitSupplementChanged, 1500);\r\n setTimeout(removeChangedFromVisitSupplementChanged, 3000);\r\n setTimeout(setChangedFromVisitSupplementChanged, 4500);\r\n setTimeout(removeChangedFromVisitSupplementChanged, 6000);\r\n }\r\n\r\n if (viewbagVisitRequiredError) {\r\n $('div#fullVisitContainer span.visitValidation').text(viewbagVisitRequiredError);\r\n $('div#fullVisitContainer span.visitValidation').show();\r\n $('a[href=\"#visitTab\"]').trigger('click');\r\n $('#openVisitTab').trigger('click');\r\n } else {\r\n $('div#fullVisitContainer span.visitValidation').hide();\r\n }\r\n\r\n if (viewbagErrorPaymentPlan) {\r\n $('#errorPaymentPlanDialog').dialog('open');\r\n }\r\n\r\n if (modelListProcedureItemsAny && modelListProcedureItemsAny == 'True') {\r\n $('table#selectedProcedures tr#emptyTable').hide();\r\n } else {\r\n $('table#selectedProcedures tr#emptyTable').show();\r\n }\r\n\r\n if (modelInvoiceCertificate && modelInvoiceCertificate == 'True') {\r\n $('input#InvoiceCertificate').prop('checked', true);\r\n } else {\r\n $('input#InvoiceCertificate').prop('checked', false);\r\n }\r\n\r\n if (modelInvoiceSituation_UID == '3' || modelInvoiceSituation_UID == '6') {\r\n if (modelInvoicePaymentMethod == '2' || modelInvoicePaymentMethod == '4') {\r\n $('div#invoiceInvoiceCertificate').hide();\r\n } else {\r\n $('div#invoiceInvoiceCertificate').show();\r\n }\r\n }\r\n\r\n if (modelorderReportController && modelorderReportController == 'True' && modelHasSingleReportInformation == 'False' && modelReportIsScreening == 'False' && modelReportIsDictated == 'True') {\r\n setTimeout(function () {\r\n $('li#openReportTab a').trigger('click');\r\n }, 0);\r\n }\r\n\r\n if ($('input#editButton').is(\":visible\")) {\r\n $('input#editButton').show();\r\n $('input#saveButton').hide();\r\n $('input#saveAndClose').hide();\r\n $('input#confirmInvoiceButton').hide();\r\n $('#scanOrder').hide();\r\n\r\n $(\".actionMenu\").menu(\"option\", \"disabled\", true);\r\n $('div#subPageContent').addClass('disabled');\r\n $('div#subPageContent').addClass('disabledNone');\r\n $('li#deleteOrder').hide();\r\n } else {\r\n setTimeout(function(){\r\n showScanEditMode();\r\n }, 0);\r\n $('input#editButton').hide();\r\n $('input#saveButton').show();\r\n $('input#saveAndClose').show();\r\n $('input#confirmInvoiceButton').show();\r\n $('#scanOrder').show();\r\n\r\n if (modelStatusInvoice == resourceConfirmed) {\r\n $(\".actionMenuNone\").menu(\"option\", \"disabled\", false);\r\n $('.disNone:disabled').each(function (e) {\r\n $(this).attr('disabled', false);\r\n });\r\n $('div#subPageContent').removeClass('disabled');\r\n $('div#subPageContent').addClass('disabledNone');\r\n $('li#deleteOrder').hide();\r\n\r\n if(invoiceModelValidated == 'False')\r\n {\r\n $('.enableInvalid').each(function(e)\r\n {\r\n $(this).attr('disabled', false);\r\n });\r\n }\r\n } else {\r\n $('div.input .dis:disabled').each(function (e) {\r\n $(this).attr('disabled', false);\r\n });\r\n $(\".actionMenu\").menu(\"option\", \"disabled\", false);\r\n $('div#subPageContent').removeClass('disabled');\r\n $('div#subPageContent').removeClass('disabledNone');\r\n $('li#deleteOrder').show();\r\n }\r\n\r\n if(viewbagDisableSupplements && viewbagDisableSupplements === 'True')\r\n {\r\n $('#AutoUpdateSupplement').prop('disabled', true);\r\n $('#InvoiceSupplement').prop('disabled', true);\r\n }\r\n }\r\n\r\n SetHealthInsuranceParameters(modelInvoicePaymentMethod);\r\n $('#loading').hide();\r\n\r\n if ($('div#subPageContent').hasClass('disabled')) {\r\n $('#btnLinkPrescription').hide();\r\n $('#btnUnlinkPrescription').hide();\r\n }\r\n\r\n // Because of the possibility to delete an Invoice and coming back to the Order/Detail page we should be able to dynamically change the information shown for the invoice (since the version that is shown when deleting invoice is cached)\r\n // A call to the Orders Controller will give us some information to \"reset\" the cached UI to a new, better state according to the new Invoice data.\r\n const promise = fetch(\"/legacy/OrdersNoSession/GetInvoiceDataByOrderID?\" +\r\n new URLSearchParams({\r\n orderID: modelID\r\n }),\r\n {\r\n method: \"GET\",\r\n headers: {\r\n 'Accept': 'application/json',\r\n \"X-Requested-With\": \"XMLHttpRequest\"\r\n }\r\n }\r\n )\r\n .then(function(response) {\r\n return response.json();\r\n })\r\n .then(function(data) {\r\n // If anything changed in the Invoice when coming back to this page, we want to be aggressively proactive and reload the current Detail page just in case\r\n // some state is not as up-to-date as it should be. (This would solve, for example, the issue described in SIR-4330)\r\n if (modelStatusInvoice != data.status ||\r\n (modelConfirmInvoice == \"True\") != data.confirmInvoice ||\r\n (modelConfirmPrepayment == \"True\") != data.confirmPrePayment ||\r\n (modelLockedInvoice == \"True\") != data.isLocked) {\r\n closeActiveFile(false);\r\n }\r\n\r\n modelStatusInvoice = data.status;\r\n modelConfirmInvoice = data.confirmInvoice;\r\n modelConfirmPrepayment = data.confirmPrePayment;\r\n modelLockedInvoice = data.isLocked;\r\n $('input#LockedInvoice').val(data.isLocked ? 'True' : 'False');\r\n\r\n $('#confirmInvoiceButton').css('display', data.isLocked ? 'none' : 'initial');\r\n $('#unlockedInvoice').css('display', data.isLocked ? 'none' : 'initial');\r\n $('#lockedInvoice').css('display', data.isLocked ? 'initial' : 'none');\r\n $('#ConfirmInvoice').val(data.confirmInvoice);\r\n $('#ConfirmPrePayment').val(data.confirmPrePayment);\r\n\r\n $('#lockedInvoiceInfo').css('display', 'none');\r\n $('#confirmPrePaymentInfo').css('display', 'none');\r\n $('#invoiceStatusInfo').css('display', 'none');\r\n if (data.isLocked) $('#lockedInvoiceInfo').css('display', 'initial');\r\n else if (data.confirmPrePayment) $('#confirmPrePaymentInfo').css('display', 'initial');\r\n else $('#invoiceStatusInfo').css('display', 'initial');\r\n\r\n $('.statusInvoiceText').text(data.status);\r\n\r\n // Dialog\r\n $('.printInvoiceWhenConfirming').css('display', data.confirmInvoice ? 'none' : 'initial');\r\n $('#btnConfirmInvoice'+viewbagUniquePrefix).css('display', data.confirmInvoice ? 'none' : 'initial');\r\n $('#btnConfirmPrepayment').css('display', !data.confirmPrePayment && !data.confirmInvoice && viewbagAbleToConfirmAsPrepayment ? 'initial' : 'none');\r\n\r\n CheckToDisableCertificateNumber();\r\n // Reenable edit-mode if necessary\r\n if (viewbagEditMode != \"True\") return;\r\n EnableEditing();\r\n });\r\n SharedOrderFunctions.saveChecker.queueSaveBlockingPromise(promise);\r\n\r\n $.ajax('/legacy/OrdersNoSession/GetProcedureStatusHistory', {\r\n data: { orderID: modelID },\r\n success: function(req) {\r\n $('#procedureStatusPartial').html(req);\r\n }\r\n });\r\n }\r\n}\r\n","window.refreshOverviewPayments = function() {\r\n function InitPopups() {\r\n $('#divLinkInvoice' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n modal: true,\r\n appendTo: \"#contentView\",\r\n close: function() {\r\n $('#txtFindInvoicePatientName' + viewbagUniquePrefix).val('');\r\n $('#txtFindInvoiceOrderNumber' + viewbagUniquePrefix).val('');\r\n $('#txtFindInvoiceInvoiceNumber' + viewbagUniquePrefix).val('');\r\n $('#txtFindInvoiceAmount' + viewbagUniquePrefix).val('')\r\n $('#txtFindInvoiceUnpaid' + viewbagUniquePrefix).prop('checked', true);\r\n $('#txtFindInvoicePaymentId' + viewbagUniquePrefix).val('');\r\n $('#datepickerFromFindInvoice').val('');\r\n $('#datepickerToFindInvoice').val('');\r\n $('#gridLinkInvoice' + viewbagUniquePrefix + ' ' + 'tr').remove();\r\n $('#btnLinkSelectedInvoice'+ viewbagUniquePrefix).prop(\"disabled\",true);\r\n $(\".linkedInvoice-validation-error\").css('display', 'none');\r\n },\r\n title: $(\"\").html(window.Resources.LinkInvoice).text()\r\n });\r\n\r\n $('#divUnlinkInvoice' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n modal: true,\r\n appendTo: \"#contentView\",\r\n close: function() {\r\n $('#txtUnlinkPaymentId' + viewbagUniquePrefix).val('');\r\n },\r\n title: $(\"\").html(window.Resources.UnlinkInvoice).text()\r\n });\r\n\r\n $('#divIgnorePayment' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n modal: true,\r\n appendTo: \"#contentView\",\r\n close: function() {\r\n $('#txIgnorePaymentId' + viewbagUniquePrefix).val('');\r\n },\r\n title: $(\"\").html(window.Resources.IgnorePayment).text()\r\n });\r\n\r\n $('input#txtFindInvoiceAmount' + viewbagUniquePrefix).ForcePositiveNegativeNumericOnly();\r\n\r\n var frompicker = '';\r\n var topicker = '€ ' + amount.toFixed(2) + '';\r\n lineToAdd += ' ';\r\n lineToAdd += '' + dueDate + '';\r\n lineToAdd += ' ';\r\n lineToAdd += '
Rijksregisternummer van de patiënt dient gekend te zijn. Update de patiënt.
\";\r\n }\r\n\r\n\r\n //REGEXKES\r\n if ($('#MXcompYes').prop('checked')) {\r\n var lastMX = $('#dateLastMX').val();\r\n if ($.trim(lastMX) == \"\" || !inputDateRegex.test(lastMX)) {\r\n generalOK = false;\r\n $('div#dateLastMXDiv span.required').show();\r\n generalmessage += \"Datum vergeleken MX heeft niet het correcte formaat (dd/MM/yyyy)
\";\r\n }\r\n else\r\n {\r\n if(new Date(lastMX.split(\"/\")[2],parseInt(lastMX.split(\"/\")[1])-1,lastMX.split(\"/\")[0]) >= Date.now())\r\n {\r\n generalOK = false;\r\n $('div#dateLastMXDiv span.required').show();\r\n generalmessage += \"Datum vergeleken MX dient in het verleden te liggen.
\";\r\n }\r\n if(new Date(lastMX.split(\"/\")[2],parseInt(lastMX.split(\"/\")[1])-1,lastMX.split(\"/\")[0]) >= new Date(Model.OrderDateOfImplementation.substr(6,4),parseInt(Model.OrderDateOfImplementation.substr(3,2))-1,Model.OrderDateOfImplementation.substr(0,2)))\r\n {\r\n generalOK = false;\r\n $('div#dateLastMXDiv span.required').show();\r\n generalmessage += \"Datum vergeleken MX dient kleiner te zijn dan MX datum.
\";\r\n }\r\n }\r\n }\r\n\r\n //AANTAL HAS TO BE > 0\r\n var aantalBeelden = $('#numberImages').val();\r\n if(aantalBeelden <= 0)\r\n {\r\n generalOK = false;\r\n $('div#numberImagesDiv span.required').show();\r\n generalmessage += \"Aantal beelden dient groter te zijn dan 0
\";\r\n }\r\n\r\n //READER HAS TO HAVE LENGTH 8\r\n if($('#reader').val().length != 8)\r\n {\r\n generalOK = false;\r\n $('div#readerDiv span.required').show();\r\n generalmessage += \"Lezer dient 8 getallen lang te zijn
\";\r\n }\r\n\r\n //ME HAS TO BE NUMERIC\r\n if(!$.isNumeric($('#identificatieME').val()))\r\n {\r\n generalOK = false;\r\n $('div#MEDiv span.required').show();\r\n generalmessage += \"ME dient numeriek te zijn
\";\r\n }\r\n\r\n //WHEN TECHNICAL QUALITY IS NOT GOOD BUT NOT POSSIBLE TO DO BETTER, A REASON HAS TO BE GIVEN\r\n if($('#032R').hasClass('active') && $.trim($('#improvementNotPossible').val()) == \"\")\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve een reden op te geven waarom de technische kwaliteit niet beter kan.
\";\r\n }\r\n if($('#032L').hasClass('active') && $.trim($('#improvementNotPossible').val()) == \"\")\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve een reden op te geven waarom de technische kwaliteit niet beter kan.
\";\r\n }\r\n\r\n //WHEN PRIORITY CHECKBOX IS CHECKED, A REASON HAS TO BE GIVEN\r\n if($('#prioritair').prop('checked') && $('#prioritairReason').val().trim().length === 0)\r\n {\r\n generalOK = false;\r\n $('div#priorityDiv span.required').show();\r\n generalmessage += \"Gelieve een reden op te geven voor prioritair behandelen
\";\r\n }\r\n\r\n //WHEN A PRIORITY REASON IS GIVEN AND THE CHECKBOX IS NOT CHECKED\r\n if(!$('#prioritair').prop('checked') && $.trim($('#prioritairReason').val()).length != 0)\r\n {\r\n generalOK = false;\r\n $('div#priorityDiv span.required').show();\r\n generalmessage += \"Er werd een reden opgegeven voor prioritair behandelen, maar de checkbox is niet actief.
\";\r\n }\r\n\r\n //IF CALCIFICATIONS ARE SUSPICIOUS, AT LEAST ONE LOCALISATION HAS TO BE GIVEN\r\n if($('#035R').hasClass('active') && ($('#011R').hasClass('active') || $('#002R').hasClass('active')))\r\n {\r\n if(!RightLocalisations)\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve minstens 1 localisatie aan te duiden.
\";\r\n }\r\n }\r\n if(($('#035L').hasClass('active') && ($('#011L').hasClass('active')) ||$('#002L').hasClass('active')))\r\n {\r\n if(!LeftLocalisations)\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve minstens 1 localisatie aan te duiden.
\";\r\n }\r\n }\r\n\r\n\r\n //LOCALISATIONS NOT ALLOWED WHEN NOT SUSPICIOUS\r\n if($('#010R').hasClass('active') && $('#001R').hasClass('active'))\r\n {\r\n if(RightLocalisations)\r\n {\r\n rightOK = false;\r\n rightmessage += \"Er mogen geen localisaties opgegeven worden indien geen verdachte afwijkingen of calcificaties
\";\r\n }\r\n }\r\n if($('#010L').hasClass('active') && $('#001L').hasClass('active'))\r\n {\r\n if(LeftLocalisations)\r\n {\r\n leftOK = false;\r\n leftmessage += \"Er mogen geen localisaties opgegeven worden indien geen verdachte afwijkingen of calcificaties
\";\r\n }\r\n }\r\n\r\n //WHEN CONCLUSION IS \"VERDERE OPPUNTSTELLING\" THEN \"TE WEERHOUDEN OMWILLE VAN\" AND/OR \"VERDACHT\" HAS TO BE FILLED OUT AND THE \"GEVOLG\" HAS TO BE \"VERDER ONDERZOEK\"\r\n if($('#035R').hasClass('active'))\r\n {\r\n if((!$('#002R').hasClass('active') && !$('#011R').hasClass('active')) || !$('#039R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Indien conclusie 'Verdere oppuntstelling' is, dan moet 'te weerhouden omwille van' en/of 'verdacht' ingevuld zijn en dient het gevolg 'verder onderzoek' te zijn.
\";\r\n }\r\n\r\n }\r\n if($('#035L').hasClass('active'))\r\n {\r\n if((!$('#002L').hasClass('active') && !$('#011L').hasClass('active')) || !$('#039L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Indien conclusie 'Verdere oppuntstelling' is, dan moet 'te weerhouden omwille van' en/of 'verdacht' ingevuld zijn en dient het gevolg 'verder onderzoek' te zijn.
\";\r\n }\r\n }\r\n\r\n\r\n //IF CONCLUSION IS NOT \"VERDERE OPPUNTSTELLING\", \"Te weerhouden omwille van\" AND/OR \"VERDACHT\" ARE NOT ALLOWED TO BE FILLED OUT\r\n if(!$('#035R').hasClass('active'))\r\n {\r\n if(!$('#035R').hasClass('active') && ($('#002R').hasClass('active') || $('#011R').hasClass('active')))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Indien conclusie verschillend is van 'Verdere oppuntstelling', dan is het niet toegestaan 'verdacht' of 'te weerhouden omwille van' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#035L').hasClass('active'))\r\n {\r\n if(!$('#035L').hasClass('active') && ($('#002L').hasClass('active') || $('#011L').hasClass('active')))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Indien conclusie verschillend is van 'Verdere oppuntstelling', dan is het niet toegestaan 'verdacht' of 'te weerhouden omwille van' in te vullen.
\";\r\n }\r\n }\r\n\r\n //IF LABORANT IS CHECKED, AN ID HAS TO BE GIVEN FOR THE LABORANT\r\n if($('#beeldvormerLaborant').is(':checked') && $.trim($('#beeldvormerLaborantID').val()) == \"\")\r\n {\r\n generalOK = false;\r\n $('div#laborantDiv span.required').show();\r\n generalmessage += \"Gelieve een laborant ID op te geven.
\";\r\n }\r\n\r\n //IF TECHNICAL REASON IS \"NIET GOED MAAR KAN NIET BETER\" THEN CONCLUSION CAN NOT BE RECALL\r\n if($('#032R').hasClass('active') && $('#036R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Als 'niet goed maar kan niet beter', dan moet conclusie 'geen afwijking', 'goedaardige afwijking' of 'verdere oppuntstelling' zijn.
\";\r\n }\r\n if($('#032L').hasClass('active') && $('#036L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Als 'niet goed maar kan niet beter', dan moet conclusie 'geen afwijking', 'goedaardige afwijking' of 'verdere oppuntstelling' zijn.
\";\r\n }\r\n\r\n //CHECK IF ANY AFWIJKING HAS BEEN SELECTED, WHEN CONCLUSION IS NOT RECALL OR MASTECTOMY\r\n if(!$('#036R').hasClass('active') && !$('#037R').hasClass('active'))\r\n {\r\n if(!$('#001R').hasClass('active') && !$('#002R').hasClass('active') && !$('#003R').hasClass('active') && !$('#004R').hasClass('active') && !$('#005R').hasClass('active') && !$('#006R').hasClass('active') && !$('#007R').hasClass('active') && !$('#008R').hasClass('active') && !$('#009R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Afwijking' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#036L').hasClass('active') && !$('#037L').hasClass('active'))\r\n {\r\n if(!$('#001L').hasClass('active') && !$('#002L').hasClass('active') && !$('#003L').hasClass('active') && !$('#004L').hasClass('active') && !$('#005L').hasClass('active') && !$('#006L').hasClass('active') && !$('#007L').hasClass('active') && !$('#008L').hasClass('active') && !$('#009L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Afwijking' in te vullen.
\";\r\n }\r\n }\r\n\r\n //CHECK IF ANY CALCIFICATION HAS BEEN SELECTED, WHEN CONCLUSION IS NOT RECALL OR MASTECTOMY\r\n if(!$('#036R').hasClass('active') && !$('#037R').hasClass('active'))\r\n {\r\n if(!$('#010R').hasClass('active') && !$('#011R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Calcificaties' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#036L').hasClass('active') && !$('#037L').hasClass('active'))\r\n {\r\n if(!$('#010L').hasClass('active') && !$('#011L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Calcificaties' in te vullen.
\";\r\n }\r\n }\r\n\r\n //CHECK IF ANY SAMENSTELLING BORSTWEEFSEL HAS BEEN SELECTED, WHEN CONCLUSION IS NOT RECALL OR MASTECTOMY\r\n if(!$('#036R').hasClass('active') && !$('#037R').hasClass('active'))\r\n {\r\n if(!$('#012R').hasClass('active') && !$('#013R').hasClass('active') && !$('#014R').hasClass('active') && !$('#015R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Samenstelling Borstweefsel' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#036L').hasClass('active') && !$('#037L').hasClass('active'))\r\n {\r\n if(!$('#012L').hasClass('active') && !$('#013L').hasClass('active') && !$('#014L').hasClass('active') && !$('#015L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Samenstelling Borstweefsel' in te vullen.
\";\r\n }\r\n }\r\n\r\n //CHECK IF ANY SAMENSTELLING BORSTWEEFSEL HAS BEEN SELECTED, WHEN CONCLUSION IS NOT MASTECTOMY\r\n if(!$('#037R').hasClass('active'))\r\n {\r\n if(!$('#016R').hasClass('active') && !$('#017R').hasClass('active') && !$('#018R').hasClass('active') && !$('#019R').hasClass('active') && !$('#020R').hasClass('active') && !$('#021R').hasClass('active') && !$('#022R').hasClass('active') && !$('#023R').hasClass('active') && !$('#024R').hasClass('active') && !$('#025R').hasClass('active') && !$('#026R').hasClass('active') && !$('#027R').hasClass('active') && !$('#028R').hasClass('active') && !$('#029R').hasClass('active') && !$('#030R').hasClass('active') && !$('#031R').hasClass('active') && !$('#032R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Technische Kwaliteit' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#037L').hasClass('active'))\r\n {\r\n if(!$('#016L').hasClass('active') && !$('#017L').hasClass('active') && !$('#018L').hasClass('active') && !$('#019L').hasClass('active') && !$('#020L').hasClass('active') && !$('#021L').hasClass('active') && !$('#022L').hasClass('active') && !$('#023L').hasClass('active') && !$('#024L').hasClass('active') && !$('#025L').hasClass('active') && !$('#026L').hasClass('active') && !$('#027L').hasClass('active') && !$('#028L').hasClass('active') && !$('#029L').hasClass('active') && !$('#030L').hasClass('active') && !$('#031L').hasClass('active') && !$('#032L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Technische Kwaliteit' in te vullen.
\";\r\n }\r\n }\r\n\r\n //CHECK IF ANY CONCLUSION HAS BEEN SELECTED\r\n if(!$('#033R').hasClass('active') && !$('#034R').hasClass('active') && !$('#035R').hasClass('active') && !$('#036R').hasClass('active') && !$('#037R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Conclusie' in te vullen.
\";\r\n }\r\n if(!$('#033L').hasClass('active') && !$('#034L').hasClass('active') && !$('#035L').hasClass('active') && !$('#036L').hasClass('active') && !$('#037L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Conclusie' in te vullen.
\";\r\n }\r\n\r\n //CHECK IF ANY GEVOLG HAS BEEN SELECTED, WHEN CONCLUSION IS NOT RECALL OR MASTECTOMY\r\n if(!$('#036R').hasClass('active') && !$('#037R').hasClass('active'))\r\n {\r\n if(!$('#038R').hasClass('active') && !$('#039R').hasClass('active') && !$('#040R').hasClass('active') && !$('#041R').hasClass('active') && !$('#042R').hasClass('active') && !$('#043R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Gevolg' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#036L').hasClass('active') && !$('#037L').hasClass('active'))\r\n {\r\n if(!$('#038L').hasClass('active') && !$('#039L').hasClass('active') && !$('#040L').hasClass('active') && !$('#041L').hasClass('active') && !$('#042L').hasClass('active') && !$('#043L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Gevolg' in te vullen.
\";\r\n }\r\n }\r\n\r\n //IF 'TE WEERHOUDEN OMWILLE VAN' THEN SOLITAIR OR MEERDERE HAS TO BE SELECTED\r\n if($('#002R').hasClass('active') && (!$('#008R').hasClass('active') && !$('#009R').hasClass('active')))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Indien 'te weerhouden omwille van' is ingevuld, dient 'solitair' of 'meerdere' geselecteerd te worden.
\";\r\n }\r\n if($('#002L').hasClass('active') && (!$('#008L').hasClass('active') && !$('#009L').hasClass('active')))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Indien 'te weerhouden omwille van' is ingevuld, dient 'solitair' of 'meerdere' geselecteerd te worden.
\";\r\n }\r\n\r\n //IF 'TE WEERHOUDEN OMWILLE VAN' THEN UNDERLYING REASON HAS TO BE SELECTED\r\n if($('#002R').hasClass('active') && (!$('#003R').hasClass('active') && !$('#004R').hasClass('active') && !$('#005R').hasClass('active') && !$('#006R').hasClass('active') && !$('#007R').hasClass('active')))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Indien 'te weerhouden omwille van' is ingevuld, dient een onderliggende reden geselecteerd te worden.
\";\r\n }\r\n if($('#002L').hasClass('active') && (!$('#003L').hasClass('active') && !$('#004L').hasClass('active') && !$('#005L').hasClass('active') && !$('#006L').hasClass('active') && !$('#007L').hasClass('active')))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Indien 'te weerhouden omwille van' is ingevuld, dient een onderliggende reden geselecteerd te worden.
\";\r\n }\r\n\r\n //IF A REASON WHY NIET GOED MAAR KAN NIET BETER IS GIVEN, BUT THE BUTTON IS NOT ACTIVE\r\n if((!$('#032R').hasClass('active') && !$('#032L').hasClass('active')) && $.trim($('#improvementNotPossible').val()).length > 0)\r\n {\r\n generalOK = false;\r\n generalmessage += \"Er werd een reden opgegeven, maar 'Niet goed maar kan niet beter' is niet actief.
\";\r\n }\r\n\r\n //TECHNICAL QUALITY NOT GOOD, BUT NO REASON SELECTED\r\n if($('#019R').hasClass('active') && !$('#020R').hasClass('active') && !$('#021R').hasClass('active') && !$('#022R').hasClass('active') && !$('#023R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve een reden waarom 'Niet goed technisch-fysisch' aan te duiden.
\";\r\n }\r\n if($('#019L').hasClass('active') && !$('#020L').hasClass('active') && !$('#021L').hasClass('active') && !$('#022L').hasClass('active') && !$('#023L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve een reden waarom 'Niet goed technisch-fysisch' aan te duiden.
\";\r\n }\r\n if($('#024R').hasClass('active') && !$('#025R').hasClass('active') && !$('#026R').hasClass('active') && !$('#027R').hasClass('active') && !$('#028R').hasClass('active') && !$('#029R').hasClass('active') && !$('#030R').hasClass('active') && !$('#031R').hasClass('active') && !$('#032R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve een reden waarom 'Niet goed positionering' aan te duiden.
\";\r\n }\r\n if($('#024L').hasClass('active') && !$('#025L').hasClass('active') && !$('#026L').hasClass('active') && !$('#027L').hasClass('active') && !$('#028L').hasClass('active') && !$('#029L').hasClass('active') && !$('#030L').hasClass('active') && !$('#031L').hasClass('active') && !$('#032L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve een reden waarom 'Niet goed positionering' aan te duiden.
\";\r\n }\r\n\r\n //FURTHER INVESTIGATION SELECTED, BUT NO REASON\r\n if($('#039R').hasClass('active') && !$('#040R').hasClass('active') && !$('#041R').hasClass('active') && !$('#042R').hasClass('active') && !$('#043R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve een reden voor 'Verder onderzoek' te selecteren.
\";\r\n }\r\n if($('#039L').hasClass('active') && !$('#040L').hasClass('active') && !$('#041L').hasClass('active') && !$('#042L').hasClass('active') && !$('#043L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve een reden voor 'Verder onderzoek' te selecteren.
\";\r\n }\r\n\r\n //WHEN MASTECTOMY OR RECALL, NO LOCALISATIONS CAN BE PRESENT\r\n if($('#036R').hasClass('active') || $('#037R').hasClass('active'))\r\n {\r\n if(RightLocalisations)\r\n {\r\n rightOK = false;\r\n rightmessage += \"Er mogen geen localisaties opgegeven worden indien technisch niet interpreteerbaar of mastectomie.
\";\r\n }\r\n }\r\n if($('#036L').hasClass('active') || $('#037L').hasClass('active'))\r\n {\r\n if(LeftLocalisations)\r\n {\r\n leftOK = false;\r\n leftmessage += \"Er mogen geen localisaties opgegeven worden indien technisch niet interpreteerbaar of mastectomie.
\";\r\n }\r\n }\r\n\r\n //WHEN 'VERDER ONDERZOEK' IS NOT SELECTED, BUT ONE OF THE UNDERLYING REASONS IS SELECTED\r\n if(!$('#039R').hasClass('active') && ($('#040R').hasClass('active') || $('#041R').hasClass('active') || $('#042R').hasClass('active') || $('#043R').hasClass('active')))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Er werd een gevolg voor 'Verder onderzoek' aangeduid, hoewel 'verder onderzoek' niet geselecteerd werd.
\";\r\n }\r\n if(!$('#039L').hasClass('active') && ($('#040L').hasClass('active') || $('#041L').hasClass('active') || $('#042L').hasClass('active') || $('#043L').hasClass('active')))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Er werd een gevolg voor 'Verder onderzoek' aangeduid, hoewel 'verder onderzoek' niet geselecteerd werd.
\";\r\n }\r\n\r\n $('span.validationAreaGeneral').html(generalmessage);\r\n $('span.validationAreaRight').html('R:
' + rightmessage);\r\n $('span.validationAreaLeft').html('L:
' + leftmessage);\r\n\r\n if(!generalOK)\r\n $('span.validationAreaGeneral').show();\r\n if(!leftOK)\r\n $('span.validationAreaLeft').show();\r\n if(!rightOK)\r\n $('span.validationAreaRight').show();\r\n\r\n return generalOK && leftOK && rightOK;\r\n };\r\n\r\n $('input#btnSendToTranscription').on('click', function (e, fromEOL, dontCheckEmpty) {\r\n if (screening) {\r\n $('span.validationAreaGeneral').hide();\r\n $('span.validationAreaLeft').hide();\r\n $('span.validationAreaRight').hide();\r\n if(!ValidateScreeningInputFields())\r\n {\r\n $(\"#screeningvalidationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n if (!noRequestForm)\r\n {\r\n if(!ValidateRequestFormInputFields(true))\r\n {\r\n $('a[href=\"#requestTab\"]').trigger('click');\r\n $(\"#request #validationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n }\r\n }\r\n //CHECK G2\r\n if (typeof dontCheckEmpty == \"undefined\") {\r\n dontCheckEmpty = false;\r\n }\r\n if (typeof fromEOL == \"undefined\") {\r\n fromEOL = false;\r\n }\r\n\r\n if (!fromEOL && userHasSpeechRecognition && useG2Speech && !dontCheckEmpty && !screening) {\r\n\r\n clearTimeout(window.pollG2Timeout);\r\n $('#btnValidateAndCloseFile').attr('disabled', true);\r\n $('#btnSaveAndCloseFile').attr('disabled', true);\r\n\r\n closeActiveSpeech(Model.OrderNumber).done(function (e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n\r\n $.ajax({\r\n type: \"GET\",\r\n url: \"/legacy/Reports/GetG2SpeechDocumentOnSaveAndClose\",\r\n async: false,\r\n data: {\r\n GUID: reportGUID,\r\n Order_UID: Model.OrderID\r\n },\r\n timeout: 15000,\r\n success: function (data) {\r\n clearTimeout(window.pollG2Timeout);\r\n\r\n if ((data.AllOk || (data.ErrorG2 && !data.SpeechDocumentExists && $('#editableContent').val() == \"true\")) && $('#editableContent').val() == \"false\") {\r\n if (data.ReportGUID)\r\n {\r\n reportGUID = data.ReportGUID;\r\n }\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n tinymce.activeEditor.setContent(data.Result);\r\n }\r\n else if (data.ErrorG2) {\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n alert(data.ErrorMessage);\r\n return false;\r\n }\r\n else if (data.Error) {\r\n console.log('Error getting G2speechdocumentOnSaveAndClose');\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n }\r\n\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 3)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(3);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, true, false);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, true, false);\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }).error(function(e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n });\r\n\r\n }\r\n else {\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 3)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(3);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, true, false);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, true, false);\r\n }\r\n }\r\n }\r\n }\r\n });\r\n\r\n function SendToPreliminary(e, fromEOL, dontCheckEmpty, triggerExportFormats) {\r\n if (screening) {\r\n $('span.validationAreaGeneral').hide();\r\n $('span.validationAreaLeft').hide();\r\n $('span.validationAreaRight').hide();\r\n }\r\n //CHECK G2\r\n if (typeof dontCheckEmpty == \"undefined\") {\r\n dontCheckEmpty = false;\r\n }\r\n if (typeof fromEOL == \"undefined\") {\r\n fromEOL = false;\r\n }\r\n\r\n if (!fromEOL && userHasSpeechRecognition && useG2Speech && !dontCheckEmpty && !screening) {\r\n\r\n clearTimeout(window.pollG2Timeout);\r\n $('#btnValidateAndCloseFile').attr('disabled', true);\r\n $('#btnSaveAndCloseFile').attr('disabled', true);\r\n\r\n closeActiveSpeech(Model.OrderNumber).done(function (e) {\r\n\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n\r\n $.ajax({\r\n type: \"GET\",\r\n url: \"/legacy/Reports/GetG2SpeechDocumentOnSaveAndClose\",\r\n async: false,\r\n data: {\r\n GUID: reportGUID,\r\n Order_UID: Model.OrderID\r\n },\r\n timeout: 15000,\r\n success: function (data) {\r\n clearTimeout(window.pollG2Timeout);\r\n\r\n if ((data.AllOk || (data.ErrorG2 && !data.SpeechDocumentExists && $('#editableContent').val() == \"true\")) && $('#editableContent').val() == \"false\") {\r\n if (data.ReportGUID)\r\n {\r\n reportGUID = data.ReportGUID;\r\n }\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n tinymce.activeEditor.setContent(data.Result);\r\n }\r\n else if (data.ErrorG2) {\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n alert(data.ErrorMessage);\r\n return false;\r\n }\r\n\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 4)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(4);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, false, true, triggerExportFormats);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, false, true, triggerExportFormats);\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }).error(function(e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n });\r\n\r\n }\r\n else {\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 4)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(4);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, false, true, triggerExportFormats);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, false, true, triggerExportFormats);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n $('input#btnSendToPreliminary').on('click', function (e, fromEOL, dontCheckEmpty) {\r\n gTriggerExportFormats = false;\r\n SendToPreliminary(e, fromEOL, dontCheckEmpty, gTriggerExportFormats);\r\n });\r\n\r\n $('input#btnSendToPreliminaryAndTriggerExportFormats').on('click', function (e, fromEOL, dontCheckEmpty) {\r\n gTriggerExportFormats = true;\r\n SendToPreliminary(e, fromEOL, dontCheckEmpty, gTriggerExportFormats);\r\n });\r\n\r\n function TriggerExportFormats() {\r\n $('.triggerExportFormatsMessage').html(window.Resources.SendingReport);\r\n $.ajax({\r\n type: 'POST',\r\n data: {\r\n orderUid: Model.OrderID,\r\n reportUid: Model.FullOrderReport_UID\r\n },\r\n url: '/legacy/Reports/TriggerReportExportFormats',\r\n dataType: 'json',\r\n success: function (data) {\r\n if (data.AllOk == true) {\r\n $('.triggerExportFormatsMessage').html(window.Resources.ReportWasSentOn + \" \" + moment().format(\"DD/MM/YYYY hh:mm:ss A\"))\r\n } else {\r\n alert(\"Printing failed\");\r\n $('.triggerExportFormatsMessage').html(\"\")\r\n }\r\n }\r\n });\r\n }\r\n\r\n $('input#btnTriggerExportFormats').on('click', function (e) {\r\n TriggerExportFormats();\r\n });\r\n\r\n $('input#btnSaveAndCloseFile').on('click', function (e, fromEOL, dontCheckEmpty) {\r\n if (screening) {\r\n $('span.validationAreaGeneral').hide();\r\n $('span.validationAreaLeft').hide();\r\n $('span.validationAreaRight').hide();\r\n if(!ValidateScreeningInputFields())\r\n {\r\n $(\"#screeningvalidationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n if (!noRequestForm)\r\n {\r\n if(!ValidateRequestFormInputFields(true))\r\n {\r\n $('a[href=\"#requestTab\"]').trigger('click');\r\n $(\"#request #validationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n }\r\n }\r\n //CHECK G2\r\n if (typeof dontCheckEmpty == \"undefined\") {\r\n dontCheckEmpty = false;\r\n }\r\n if (typeof fromEOL == \"undefined\") {\r\n fromEOL = false;\r\n }\r\n\r\n if (!fromEOL && userHasSpeechRecognition && useG2Speech && !dontCheckEmpty && !screening) {\r\n\r\n clearTimeout(window.pollG2Timeout);\r\n $('#btnValidateAndCloseFile').attr('disabled', true);\r\n $('#btnSaveAndCloseFile').attr('disabled', true);\r\n\r\n closeActiveSpeech(Model.OrderNumber).done(function (e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n\r\n $.ajax({\r\n type: \"GET\",\r\n url: \"/legacy/Reports/GetG2SpeechDocumentOnSaveAndClose\",\r\n async: false,\r\n data: {\r\n GUID: reportGUID,\r\n Order_UID: Model.OrderID\r\n },\r\n timeout: 15000,\r\n success: function (data) {\r\n clearTimeout(window.pollG2Timeout);\r\n\r\n if ((data.AllOk || (data.ErrorG2 && !data.SpeechDocumentExists && $('#editableContent').val() == \"true\")) && $('#editableContent').val() == \"false\") {\r\n if (data.ReportGUID)\r\n {\r\n reportGUID = data.ReportGUID;\r\n }\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n tinymce.activeEditor.setContent(data.Result);\r\n }\r\n else if (data.ErrorG2) {\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n alert(data.ErrorMessage);\r\n return false;\r\n }\r\n\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 1)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(2);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, false, false);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, false, false);\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }).error(function(e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n });\r\n\r\n }\r\n else {\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 1)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(2);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, false, false);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, false, false);\r\n }\r\n }\r\n }\r\n }\r\n $('body').off('click', 'ul.listFound li');\r\n });\r\n\r\n $('input#btnValidateAndCloseFile').on('click', function (e, fromEOL, dontCheckEmpty) {\r\n if (screening) {\r\n $('span.validationAreaGeneral').hide();\r\n $('span.validationAreaLeft').hide();\r\n $('span.validationAreaRight').hide();\r\n if(!ValidateScreeningInputFields())\r\n {\r\n $(\"#screeningvalidationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n if (!noRequestForm)\r\n {\r\n if(!ValidateRequestFormInputFields(true))\r\n {\r\n $('a[href=\"#requestTab\"]').trigger('click');\r\n $(\"#request #validationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n }\r\n }\r\n //CHECK G2\r\n if (typeof dontCheckEmpty == \"undefined\") {\r\n dontCheckEmpty = false;\r\n }\r\n if (typeof fromEOL == \"undefined\") {\r\n fromEOL = false;\r\n }\r\n\r\n if (!fromEOL && userHasSpeechRecognition && useG2Speech && !dontCheckEmpty && !screening) {\r\n\r\n clearTimeout(window.pollG2Timeout);\r\n\r\n $('#btnValidateAndCloseFile').attr('disabled', true);\r\n $('#btnSaveAndCloseFile').attr('disabled', true);\r\n\r\n closeActiveSpeech(Model.OrderNumber).done(function (e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n\r\n $.ajax({\r\n type: \"GET\",\r\n url: \"/legacy/Reports/GetG2SpeechDocumentOnSaveAndClose\",\r\n async: false,\r\n data: {\r\n GUID: reportGUID,\r\n Order_UID: Model.OrderID\r\n },\r\n success: function (data) {\r\n clearTimeout(window.pollG2Timeout);\r\n\r\n if ((data.AllOk || (data.ErrorG2 && !data.SpeechDocumentExists && $('#editableContent').val() == \"true\")) && $('#editableContent').val() == \"false\") {\r\n if (data.ReportGUID) {\r\n reportGUID = data.ReportGUID;\r\n }\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n tinymce.activeEditor.setContent(data.Result);\r\n }\r\n else if (data.ErrorG2) {\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n alert(data.ErrorMessage);\r\n return false;\r\n }\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 2)) {\r\n if (showConfirmationOnValidate) {\r\n showConfirmationPopup(1);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(true, true, false, false);\r\n }\r\n else {\r\n if (userRadiologistId != 0 && Model.SupervisorId != null && userRadiologistId !== Model.SupervisorId) {\r\n ShowPopupSetCurrentRadiologistAsSupervisor(true, true, false, false)\r\n }\r\n else {\r\n ValidateOrSaveAndClose(true, true, null, false, false);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }).error(function(e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n });\r\n\r\n }\r\n else {\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 2)) {\r\n if (showConfirmationOnValidate) {\r\n showConfirmationPopup(1);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(true, true, false, false);\r\n }\r\n else {\r\n if (userRadiologistId != 0 && Model.SupervisorId != null && userRadiologistId !== Model.SupervisorId) {\r\n ShowPopupSetCurrentRadiologistAsSupervisor(true, true, false, false)\r\n }\r\n else {\r\n ValidateOrSaveAndClose(true, true, null, false, false);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n $('body').off('click', 'ul.listFound li');\r\n });\r\n\r\n $('input#verifyNomenclatures').on('click', function (e) {\r\n showConfirmationPopup(5);\r\n });\r\n\r\n $('span.validation').hide();\r\n\r\n $('span.validationAreaGeneral').hide();\r\n $('span.validationAreaLeft').hide();\r\n $('span.validationAreaRight').hide();\r\n\r\n $('h3.panelHeaderPassive').next().hide();\r\n\r\n var m = moment($('dd#age').html(), \"DD/MM/YYYY\");\r\n if (m.isValid()) {\r\n $('dd#age').html(moment().diff(m, 'years'));\r\n }\r\n\r\n $('a[href=\"#\"]').on('click', function (e) {\r\n e.preventDefault();\r\n });\r\n\r\n $('select').each(function (e) {\r\n if ($(this).attr('value') != null) {\r\n $(this).val($(this).attr('value'));\r\n }\r\n });\r\n\r\n $('textarea').each(function (e) {\r\n if ($(this).attr('value') != null) {\r\n $(this).val($(this).attr('value'));\r\n }\r\n });\r\n\r\n var ResizeTopSubField = function (e) {\r\n var subField = $('form#addOrderForm').find('div.subField').first();\r\n var width = subField.width();\r\n var imageHolder = subField.find('div#imageHolder');\r\n var personalInfo = subField.find('div#personalInfo');\r\n personalInfo.width(width - imageHolder.width() - 20);\r\n }\r\n\r\n\r\n ResizeTopSubField();\r\n\r\n $('dd#publicRemarksShow').on('click', function (e) {\r\n e.stopImmediatePropagation();\r\n if ($(this).hasClass('open')) {\r\n $(this).removeClass('open');\r\n $(this).text(window.Resources.ClickToOpen + '...');\r\n $('#dialogPublicRemarks' + viewbagUniquePrefix).dialog(\"close\");\r\n }\r\n else {\r\n $(this).addClass('open');\r\n $(this).text(window.Resources.ClickToClose + '...');\r\n $('#dialogPublicRemarks' + viewbagUniquePrefix).dialog(\"open\");\r\n }\r\n });\r\n\r\n $('dd#privateRemarksShow').on('click', function (e) {\r\n if ($(this).hasClass('open')) {\r\n $(this).removeClass('open');\r\n $(this).text(window.Resources.ClickToOpen + '...');\r\n $('#dialogPrivateRemarks' + viewbagUniquePrefix).dialog(\"close\");\r\n }\r\n else {\r\n $(this).addClass('open');\r\n $(this).text(window.Resources.ClickToClose + '...');\r\n $('#dialogPrivateRemarks' + viewbagUniquePrefix).dialog(\"open\");\r\n }\r\n });\r\n\r\n $('dd#publicRemarksShow').removeClass('open');\r\n $('dd#publicRemarksShow').text(window.Resources.ClickToOpen + '...');\r\n $('dd#privateRemarksShow').removeClass('open');\r\n $('dd#privateRemarksShow').text(window.Resources.ClickToOpen + '...');\r\n\r\n $('#dialogPublicRemarks' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n modal: false,\r\n position: { my: \"right top\", at: \"right-15 top+30\", of: '#contentView' },\r\n appendTo: \"#contentView\",\r\n dialogClass: \"innerDialog\",\r\n title: $(\"\").html(window.Resources.PublicRemarks).text(),\r\n close: function (e, ui) {\r\n $('dd#publicRemarksShow').removeClass('open');\r\n $('dd#publicRemarksShow').text(window.Resources.ClickToOpen + '...');\r\n }\r\n });\r\n\r\n $('#dialogPrivateRemarks' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n modal: false,\r\n appendTo: \"#contentView\",\r\n dialogClass: \"innerDialog\",\r\n position: { my: \"right top\", at: \"right-15 top+30\", of: '#contentView' },\r\n title: $(\"\").html(window.Resources.PrivateRemarks).text(),\r\n close: function (e, ui) {\r\n $('dd#privateRemarksShow').removeClass('open');\r\n $('dd#privateRemarksShow').text(window.Resources.ClickToOpen + '...');\r\n }\r\n });\r\n\r\n $('#divPopupConfirmation' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n position: { my: \"right top\", at: \"right-15 top+30\", of: '#contentView' },\r\n modal: true,\r\n appendTo: \"#contentView\"\r\n });\r\n\r\n $('#divViewReportDialog' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n modal: false,\r\n draggable: true,\r\n appendTo: \"#contentView\",\r\n title: $(\"\").html(window.Resources.Preview + ' ' + window.Resources.Report).text(),\r\n position: { my: \"right top\", at: \"right-15 top+30\", of: '#contentView' },\r\n sticky: 'false'\r\n });\r\n\r\n $('input[type=radio]').on('change', function (e) {\r\n var thisVal = $(this).val();\r\n $(this).attr('checked', true);\r\n $('input[type=radio][name=' + $(this).attr('name') + ']').each(function (i, y) {\r\n if ($(y).val() != thisVal) {\r\n $(y).removeAttr('checked');\r\n }\r\n });\r\n });\r\n\r\n $('input#viewHistoryPatient').on('click', function (e) {\r\n useFilingCabinet(\"/Patients/OrderHistory/\" + Model.PatientID);\r\n });\r\n\r\n $('input#loadOrder').on('click', function (e) {\r\n useFilingCabinet(\"/Orders/Detail/\" + Model.OrderID);\r\n });\r\n\r\n\r\n $('body').on('mouseenter', 'div#orderHistoryTimeline li ul, div#orderHistoryTimeline li.yearItem span.amount', function (e) {\r\n $(this).parent().addClass('hoverItem');\r\n });\r\n $('body').on('mouseleave', 'div#orderHistoryTimeline li ul, div#orderHistoryTimeline li.yearItem span.amount', function (e) {\r\n $(this).parent().removeClass('hoverItem');\r\n });\r\n\r\n $('div#submitBottom').find('div#orderHistoryTimeline, div#noOrderHistoryTimeline').remove();\r\n\r\n $('div#contentView').show();\r\n\r\n var NoOrderHistory = function (e) {\r\n var divNoTimeLine = 'Rijksregisternummer van de patiënt dient gekend te zijn. Update de patiënt.
\";\r\n }\r\n\r\n\r\n //REGEXKES\r\n if ($('#MXcompYes').prop('checked')) {\r\n var lastMX = $('#dateLastMX').val();\r\n if ($.trim(lastMX) == \"\" || !inputDateRegex.test(lastMX)) {\r\n generalOK = false;\r\n $('div#dateLastMXDiv span.required').show();\r\n generalmessage += \"Datum vergeleken MX heeft niet het correcte formaat (dd/MM/yyyy)
\";\r\n }\r\n else\r\n {\r\n if(new Date(lastMX.split(\"/\")[2],parseInt(lastMX.split(\"/\")[1])-1,lastMX.split(\"/\")[0]) >= Date.now())\r\n {\r\n generalOK = false;\r\n $('div#dateLastMXDiv span.required').show();\r\n generalmessage += \"Datum vergeleken MX dient in het verleden te liggen.
\";\r\n }\r\n if(new Date(lastMX.split(\"/\")[2],parseInt(lastMX.split(\"/\")[1])-1,lastMX.split(\"/\")[0]) >= new Date(Model.OrderDateOfImplementation.substr(6,4),parseInt(Model.OrderDateOfImplementation.substr(3,2))-1,Model.OrderDateOfImplementation.substr(0,2)))\r\n {\r\n generalOK = false;\r\n $('div#dateLastMXDiv span.required').show();\r\n generalmessage += \"Datum vergeleken MX dient kleiner te zijn dan MX datum.
\";\r\n }\r\n }\r\n }\r\n\r\n //AANTAL HAS TO BE > 0\r\n var aantalBeelden = $('#numberImages').val();\r\n if(aantalBeelden <= 0)\r\n {\r\n generalOK = false;\r\n $('div#numberImagesDiv span.required').show();\r\n generalmessage += \"Aantal beelden dient groter te zijn dan 0
\";\r\n }\r\n\r\n //READER HAS TO HAVE LENGTH 8\r\n if($('#reader').val().length != 8)\r\n {\r\n generalOK = false;\r\n $('div#readerDiv span.required').show();\r\n generalmessage += \"Lezer dient 8 getallen lang te zijn
\";\r\n }\r\n\r\n //ME HAS TO BE NUMERIC\r\n if(!$.isNumeric($('#identificatieME').val()))\r\n {\r\n generalOK = false;\r\n $('div#MEDiv span.required').show();\r\n generalmessage += \"ME dient numeriek te zijn
\";\r\n }\r\n\r\n //WHEN TECHNICAL QUALITY IS NOT GOOD BUT NOT POSSIBLE TO DO BETTER, A REASON HAS TO BE GIVEN\r\n if($('#032R').hasClass('active') && $.trim($('#improvementNotPossible').val()) == \"\")\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve een reden op te geven waarom de technische kwaliteit niet beter kan.
\";\r\n }\r\n if($('#032L').hasClass('active') && $.trim($('#improvementNotPossible').val()) == \"\")\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve een reden op te geven waarom de technische kwaliteit niet beter kan.
\";\r\n }\r\n\r\n //WHEN PRIORITY CHECKBOX IS CHECKED, A REASON HAS TO BE GIVEN\r\n if($('#prioritair').prop('checked') && $('#prioritairReason').val().trim().length === 0)\r\n {\r\n generalOK = false;\r\n $('div#priorityDiv span.required').show();\r\n generalmessage += \"Gelieve een reden op te geven voor prioritair behandelen
\";\r\n }\r\n\r\n //WHEN A PRIORITY REASON IS GIVEN AND THE CHECKBOX IS NOT CHECKED\r\n if(!$('#prioritair').prop('checked') && $.trim($('#prioritairReason').val()).length != 0)\r\n {\r\n generalOK = false;\r\n $('div#priorityDiv span.required').show();\r\n generalmessage += \"Er werd een reden opgegeven voor prioritair behandelen, maar de checkbox is niet actief.
\";\r\n }\r\n\r\n //IF CALCIFICATIONS ARE SUSPICIOUS, AT LEAST ONE LOCALISATION HAS TO BE GIVEN\r\n if($('#035R').hasClass('active') && ($('#011R').hasClass('active') || $('#002R').hasClass('active')))\r\n {\r\n if(!RightLocalisations)\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve minstens 1 localisatie aan te duiden.
\";\r\n }\r\n }\r\n if(($('#035L').hasClass('active') && ($('#011L').hasClass('active')) ||$('#002L').hasClass('active')))\r\n {\r\n if(!LeftLocalisations)\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve minstens 1 localisatie aan te duiden.
\";\r\n }\r\n }\r\n\r\n\r\n //LOCALISATIONS NOT ALLOWED WHEN NOT SUSPICIOUS\r\n if($('#010R').hasClass('active') && $('#001R').hasClass('active'))\r\n {\r\n if(RightLocalisations)\r\n {\r\n rightOK = false;\r\n rightmessage += \"Er mogen geen localisaties opgegeven worden indien geen verdachte afwijkingen of calcificaties
\";\r\n }\r\n }\r\n if($('#010L').hasClass('active') && $('#001L').hasClass('active'))\r\n {\r\n if(LeftLocalisations)\r\n {\r\n leftOK = false;\r\n leftmessage += \"Er mogen geen localisaties opgegeven worden indien geen verdachte afwijkingen of calcificaties
\";\r\n }\r\n }\r\n\r\n //WHEN CONCLUSION IS \"VERDERE OPPUNTSTELLING\" THEN \"TE WEERHOUDEN OMWILLE VAN\" AND/OR \"VERDACHT\" HAS TO BE FILLED OUT AND THE \"GEVOLG\" HAS TO BE \"VERDER ONDERZOEK\"\r\n if($('#035R').hasClass('active'))\r\n {\r\n if((!$('#002R').hasClass('active') && !$('#011R').hasClass('active')) || !$('#039R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Indien conclusie 'Verdere oppuntstelling' is, dan moet 'te weerhouden omwille van' en/of 'verdacht' ingevuld zijn en dient het gevolg 'verder onderzoek' te zijn.
\";\r\n }\r\n\r\n }\r\n if($('#035L').hasClass('active'))\r\n {\r\n if((!$('#002L').hasClass('active') && !$('#011L').hasClass('active')) || !$('#039L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Indien conclusie 'Verdere oppuntstelling' is, dan moet 'te weerhouden omwille van' en/of 'verdacht' ingevuld zijn en dient het gevolg 'verder onderzoek' te zijn.
\";\r\n }\r\n }\r\n\r\n\r\n //IF CONCLUSION IS NOT \"VERDERE OPPUNTSTELLING\", \"Te weerhouden omwille van\" AND/OR \"VERDACHT\" ARE NOT ALLOWED TO BE FILLED OUT\r\n if(!$('#035R').hasClass('active'))\r\n {\r\n if(!$('#035R').hasClass('active') && ($('#002R').hasClass('active') || $('#011R').hasClass('active')))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Indien conclusie verschillend is van 'Verdere oppuntstelling', dan is het niet toegestaan 'verdacht' of 'te weerhouden omwille van' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#035L').hasClass('active'))\r\n {\r\n if(!$('#035L').hasClass('active') && ($('#002L').hasClass('active') || $('#011L').hasClass('active')))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Indien conclusie verschillend is van 'Verdere oppuntstelling', dan is het niet toegestaan 'verdacht' of 'te weerhouden omwille van' in te vullen.
\";\r\n }\r\n }\r\n\r\n //IF LABORANT IS CHECKED, AN ID HAS TO BE GIVEN FOR THE LABORANT\r\n if($('#beeldvormerLaborant').is(':checked') && $.trim($('#beeldvormerLaborantID').val()) == \"\")\r\n {\r\n generalOK = false;\r\n $('div#laborantDiv span.required').show();\r\n generalmessage += \"Gelieve een laborant ID op te geven.
\";\r\n }\r\n\r\n //IF TECHNICAL REASON IS \"NIET GOED MAAR KAN NIET BETER\" THEN CONCLUSION CAN NOT BE RECALL\r\n if($('#032R').hasClass('active') && $('#036R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Als 'niet goed maar kan niet beter', dan moet conclusie 'geen afwijking', 'goedaardige afwijking' of 'verdere oppuntstelling' zijn.
\";\r\n }\r\n if($('#032L').hasClass('active') && $('#036L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Als 'niet goed maar kan niet beter', dan moet conclusie 'geen afwijking', 'goedaardige afwijking' of 'verdere oppuntstelling' zijn.
\";\r\n }\r\n\r\n //CHECK IF ANY AFWIJKING HAS BEEN SELECTED, WHEN CONCLUSION IS NOT RECALL OR MASTECTOMY\r\n if(!$('#036R').hasClass('active') && !$('#037R').hasClass('active'))\r\n {\r\n if(!$('#001R').hasClass('active') && !$('#002R').hasClass('active') && !$('#003R').hasClass('active') && !$('#004R').hasClass('active') && !$('#005R').hasClass('active') && !$('#006R').hasClass('active') && !$('#007R').hasClass('active') && !$('#008R').hasClass('active') && !$('#009R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Afwijking' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#036L').hasClass('active') && !$('#037L').hasClass('active'))\r\n {\r\n if(!$('#001L').hasClass('active') && !$('#002L').hasClass('active') && !$('#003L').hasClass('active') && !$('#004L').hasClass('active') && !$('#005L').hasClass('active') && !$('#006L').hasClass('active') && !$('#007L').hasClass('active') && !$('#008L').hasClass('active') && !$('#009L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Afwijking' in te vullen.
\";\r\n }\r\n }\r\n\r\n //CHECK IF ANY CALCIFICATION HAS BEEN SELECTED, WHEN CONCLUSION IS NOT RECALL OR MASTECTOMY\r\n if(!$('#036R').hasClass('active') && !$('#037R').hasClass('active'))\r\n {\r\n if(!$('#010R').hasClass('active') && !$('#011R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Calcificaties' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#036L').hasClass('active') && !$('#037L').hasClass('active'))\r\n {\r\n if(!$('#010L').hasClass('active') && !$('#011L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Calcificaties' in te vullen.
\";\r\n }\r\n }\r\n\r\n //CHECK IF ANY SAMENSTELLING BORSTWEEFSEL HAS BEEN SELECTED, WHEN CONCLUSION IS NOT RECALL OR MASTECTOMY\r\n if(!$('#036R').hasClass('active') && !$('#037R').hasClass('active'))\r\n {\r\n if(!$('#012R').hasClass('active') && !$('#013R').hasClass('active') && !$('#014R').hasClass('active') && !$('#015R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Samenstelling Borstweefsel' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#036L').hasClass('active') && !$('#037L').hasClass('active'))\r\n {\r\n if(!$('#012L').hasClass('active') && !$('#013L').hasClass('active') && !$('#014L').hasClass('active') && !$('#015L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Samenstelling Borstweefsel' in te vullen.
\";\r\n }\r\n }\r\n\r\n //CHECK IF ANY SAMENSTELLING BORSTWEEFSEL HAS BEEN SELECTED, WHEN CONCLUSION IS NOT MASTECTOMY\r\n if(!$('#037R').hasClass('active'))\r\n {\r\n if(!$('#016R').hasClass('active') && !$('#017R').hasClass('active') && !$('#018R').hasClass('active') && !$('#019R').hasClass('active') && !$('#020R').hasClass('active') && !$('#021R').hasClass('active') && !$('#022R').hasClass('active') && !$('#023R').hasClass('active') && !$('#024R').hasClass('active') && !$('#025R').hasClass('active') && !$('#026R').hasClass('active') && !$('#027R').hasClass('active') && !$('#028R').hasClass('active') && !$('#029R').hasClass('active') && !$('#030R').hasClass('active') && !$('#031R').hasClass('active') && !$('#032R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Technische Kwaliteit' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#037L').hasClass('active'))\r\n {\r\n if(!$('#016L').hasClass('active') && !$('#017L').hasClass('active') && !$('#018L').hasClass('active') && !$('#019L').hasClass('active') && !$('#020L').hasClass('active') && !$('#021L').hasClass('active') && !$('#022L').hasClass('active') && !$('#023L').hasClass('active') && !$('#024L').hasClass('active') && !$('#025L').hasClass('active') && !$('#026L').hasClass('active') && !$('#027L').hasClass('active') && !$('#028L').hasClass('active') && !$('#029L').hasClass('active') && !$('#030L').hasClass('active') && !$('#031L').hasClass('active') && !$('#032L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Technische Kwaliteit' in te vullen.
\";\r\n }\r\n }\r\n\r\n //CHECK IF ANY CONCLUSION HAS BEEN SELECTED\r\n if(!$('#033R').hasClass('active') && !$('#034R').hasClass('active') && !$('#035R').hasClass('active') && !$('#036R').hasClass('active') && !$('#037R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Conclusie' in te vullen.
\";\r\n }\r\n if(!$('#033L').hasClass('active') && !$('#034L').hasClass('active') && !$('#035L').hasClass('active') && !$('#036L').hasClass('active') && !$('#037L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Conclusie' in te vullen.
\";\r\n }\r\n\r\n //CHECK IF ANY GEVOLG HAS BEEN SELECTED, WHEN CONCLUSION IS NOT RECALL OR MASTECTOMY\r\n if(!$('#036R').hasClass('active') && !$('#037R').hasClass('active'))\r\n {\r\n if(!$('#038R').hasClass('active') && !$('#039R').hasClass('active') && !$('#040R').hasClass('active') && !$('#041R').hasClass('active') && !$('#042R').hasClass('active') && !$('#043R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve de sectie 'Gevolg' in te vullen.
\";\r\n }\r\n }\r\n if(!$('#036L').hasClass('active') && !$('#037L').hasClass('active'))\r\n {\r\n if(!$('#038L').hasClass('active') && !$('#039L').hasClass('active') && !$('#040L').hasClass('active') && !$('#041L').hasClass('active') && !$('#042L').hasClass('active') && !$('#043L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve de sectie 'Gevolg' in te vullen.
\";\r\n }\r\n }\r\n\r\n //IF 'TE WEERHOUDEN OMWILLE VAN' THEN SOLITAIR OR MEERDERE HAS TO BE SELECTED\r\n if($('#002R').hasClass('active') && (!$('#008R').hasClass('active') && !$('#009R').hasClass('active')))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Indien 'te weerhouden omwille van' is ingevuld, dient 'solitair' of 'meerdere' geselecteerd te worden.
\";\r\n }\r\n if($('#002L').hasClass('active') && (!$('#008L').hasClass('active') && !$('#009L').hasClass('active')))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Indien 'te weerhouden omwille van' is ingevuld, dient 'solitair' of 'meerdere' geselecteerd te worden.
\";\r\n }\r\n\r\n //IF 'TE WEERHOUDEN OMWILLE VAN' THEN UNDERLYING REASON HAS TO BE SELECTED\r\n if($('#002R').hasClass('active') && (!$('#003R').hasClass('active') && !$('#004R').hasClass('active') && !$('#005R').hasClass('active') && !$('#006R').hasClass('active') && !$('#007R').hasClass('active')))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Indien 'te weerhouden omwille van' is ingevuld, dient een onderliggende reden geselecteerd te worden.
\";\r\n }\r\n if($('#002L').hasClass('active') && (!$('#003L').hasClass('active') && !$('#004L').hasClass('active') && !$('#005L').hasClass('active') && !$('#006L').hasClass('active') && !$('#007L').hasClass('active')))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Indien 'te weerhouden omwille van' is ingevuld, dient een onderliggende reden geselecteerd te worden.
\";\r\n }\r\n\r\n //IF A REASON WHY NIET GOED MAAR KAN NIET BETER IS GIVEN, BUT THE BUTTON IS NOT ACTIVE\r\n if((!$('#032R').hasClass('active') && !$('#032L').hasClass('active')) && $.trim($('#improvementNotPossible').val()).length > 0)\r\n {\r\n generalOK = false;\r\n generalmessage += \"Er werd een reden opgegeven, maar 'Niet goed maar kan niet beter' is niet actief.
\";\r\n }\r\n\r\n //TECHNICAL QUALITY NOT GOOD, BUT NO REASON SELECTED\r\n if($('#019R').hasClass('active') && !$('#020R').hasClass('active') && !$('#021R').hasClass('active') && !$('#022R').hasClass('active') && !$('#023R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve een reden waarom 'Niet goed technisch-fysisch' aan te duiden.
\";\r\n }\r\n if($('#019L').hasClass('active') && !$('#020L').hasClass('active') && !$('#021L').hasClass('active') && !$('#022L').hasClass('active') && !$('#023L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve een reden waarom 'Niet goed technisch-fysisch' aan te duiden.
\";\r\n }\r\n if($('#024R').hasClass('active') && !$('#025R').hasClass('active') && !$('#026R').hasClass('active') && !$('#027R').hasClass('active') && !$('#028R').hasClass('active') && !$('#029R').hasClass('active') && !$('#030R').hasClass('active') && !$('#031R').hasClass('active') && !$('#032R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve een reden waarom 'Niet goed positionering' aan te duiden.
\";\r\n }\r\n if($('#024L').hasClass('active') && !$('#025L').hasClass('active') && !$('#026L').hasClass('active') && !$('#027L').hasClass('active') && !$('#028L').hasClass('active') && !$('#029L').hasClass('active') && !$('#030L').hasClass('active') && !$('#031L').hasClass('active') && !$('#032L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve een reden waarom 'Niet goed positionering' aan te duiden.
\";\r\n }\r\n\r\n //FURTHER INVESTIGATION SELECTED, BUT NO REASON\r\n if($('#039R').hasClass('active') && !$('#040R').hasClass('active') && !$('#041R').hasClass('active') && !$('#042R').hasClass('active') && !$('#043R').hasClass('active'))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Gelieve een reden voor 'Verder onderzoek' te selecteren.
\";\r\n }\r\n if($('#039L').hasClass('active') && !$('#040L').hasClass('active') && !$('#041L').hasClass('active') && !$('#042L').hasClass('active') && !$('#043L').hasClass('active'))\r\n {\r\n leftOK = false;\r\n leftmessage += \"Gelieve een reden voor 'Verder onderzoek' te selecteren.
\";\r\n }\r\n\r\n //WHEN MASTECTOMY OR RECALL, NO LOCALISATIONS CAN BE PRESENT\r\n if($('#036R').hasClass('active') || $('#037R').hasClass('active'))\r\n {\r\n if(RightLocalisations)\r\n {\r\n rightOK = false;\r\n rightmessage += \"Er mogen geen localisaties opgegeven worden indien technisch niet interpreteerbaar of mastectomie.
\";\r\n }\r\n }\r\n if($('#036L').hasClass('active') || $('#037L').hasClass('active'))\r\n {\r\n if(LeftLocalisations)\r\n {\r\n leftOK = false;\r\n leftmessage += \"Er mogen geen localisaties opgegeven worden indien technisch niet interpreteerbaar of mastectomie.
\";\r\n }\r\n }\r\n\r\n //WHEN 'VERDER ONDERZOEK' IS NOT SELECTED, BUT ONE OF THE UNDERLYING REASONS IS SELECTED\r\n if(!$('#039R').hasClass('active') && ($('#040R').hasClass('active') || $('#041R').hasClass('active') || $('#042R').hasClass('active') || $('#043R').hasClass('active')))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Er werd een gevolg voor 'Verder onderzoek' aangeduid, hoewel 'verder onderzoek' niet geselecteerd werd.
\";\r\n }\r\n if(!$('#039L').hasClass('active') && ($('#040L').hasClass('active') || $('#041L').hasClass('active') || $('#042L').hasClass('active') || $('#043L').hasClass('active')))\r\n {\r\n rightOK = false;\r\n rightmessage += \"Er werd een gevolg voor 'Verder onderzoek' aangeduid, hoewel 'verder onderzoek' niet geselecteerd werd.
\";\r\n }\r\n\r\n $('span.validationAreaGeneral').html(generalmessage);\r\n $('span.validationAreaRight').html('R:
' + rightmessage);\r\n $('span.validationAreaLeft').html('L:
' + leftmessage);\r\n\r\n if(!generalOK)\r\n $('span.validationAreaGeneral').show();\r\n if(!leftOK)\r\n $('span.validationAreaLeft').show();\r\n if(!rightOK)\r\n $('span.validationAreaRight').show();\r\n\r\n return generalOK && leftOK && rightOK;\r\n\r\n };\r\n\r\n $('ul#urgentList li').on('click', function (e) {\r\n if (!validatedModel && !readOnly) {\r\n if (!$('div#subPageContent').hasClass('disabled')) {\r\n if (!$(this).hasClass('default')) {\r\n $('ul#urgentList li.default').removeClass('default');\r\n $(this).addClass('default');\r\n selectedUrgency = $(this).attr('id');\r\n }\r\n }\r\n }\r\n });\r\n\r\n function TriggerExportFormats() {\r\n $('.triggerExportFormatsMessage').html(window.Resources.SendingReport);\r\n $.ajax({\r\n type: 'POST',\r\n data: {\r\n orderUid: Model.OrderID,\r\n reportUid: Model.FullOrderReport_UID\r\n },\r\n url: '/legacy/Reports/TriggerReportExportFormats',\r\n dataType: 'json',\r\n success: function (data) {\r\n if (data.AllOk == true) {\r\n $('.triggerExportFormatsMessage').html(window.Resources.ReportWasSentOn + \" \" + moment().format(\"DD/MM/YYYY hh:mm:ss A\"))\r\n } else {\r\n alert(\"Printing failed\");\r\n $('.triggerExportFormatsMessage').html(\"\")\r\n }\r\n }\r\n });\r\n }\r\n\r\n $('input#btnTriggerExportFormats').on('click', function (e) {\r\n TriggerExportFormats();\r\n });\r\n\r\n $('input#btnSendToTranscription').on('click', function (e, fromEOL, dontCheckEmpty) {\r\n if (screening) {\r\n $('span.validationAreaGeneral').hide();\r\n $('span.validationAreaLeft').hide();\r\n $('span.validationAreaRight').hide();\r\n if(!ValidateScreeningInputFields())\r\n {\r\n $(\"#screeningvalidationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n if (!noRequestForm)\r\n {\r\n if(!ValidateRequestFormInputFields(true))\r\n {\r\n $('a[href=\"#requestTab\"]').trigger('click');\r\n $(\"#request #validationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n }\r\n }\r\n //CHECK G2\r\n if (typeof dontCheckEmpty == \"undefined\") {\r\n dontCheckEmpty = false;\r\n }\r\n if (typeof fromEOL == \"undefined\") {\r\n fromEOL = false;\r\n }\r\n\r\n if (!fromEOL && userHasSpeechRecognition && useG2Speech && !dontCheckEmpty && !screening) {\r\n\r\n clearTimeout(window.pollG2Timeout);\r\n $('#btnValidateAndCloseFile').attr('disabled', true);\r\n $('#btnSaveAndCloseFile').attr('disabled', true);\r\n\r\n closeActiveSpeech(Model.OrderNumber).done(function (e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n\r\n $.ajax({\r\n type: \"GET\",\r\n url: \"/legacy/Reports/GetG2SpeechDocumentOnSaveAndClose\",\r\n async: false,\r\n data: {\r\n GUID: reportGUID,\r\n Order_UID: Model.OrderID\r\n },\r\n timeout: 15000,\r\n success: function (data) {\r\n clearTimeout(window.pollG2Timeout);\r\n\r\n if ((data.AllOk || (data.ErrorG2 && !data.SpeechDocumentExists && $('#editableContent').val() == \"true\")) && $('#editableContent').val() == \"false\") {\r\n if (data.ReportGUID)\r\n {\r\n reportGUID = data.ReportGUID;\r\n }\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n tinymce.activeEditor.setContent(data.Result);\r\n }\r\n else if (data.ErrorG2) {\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n alert(data.ErrorMessage);\r\n return false;\r\n }\r\n else if (data.Error) {\r\n console.log('Error getting G2speechdocumentOnSaveAndClose');\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n }\r\n\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 3)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(3);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, true, false);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, true, false);\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }).error(function(e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n });\r\n\r\n }\r\n else {\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 3)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(3);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, true, false);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, true, false);\r\n }\r\n }\r\n }\r\n }\r\n });\r\n\r\n function SendToPreliminary(e, fromEOL, dontCheckEmpty, triggerExportFormats) {\r\n if (screening) {\r\n $('span.validationAreaGeneral').hide();\r\n $('span.validationAreaLeft').hide();\r\n $('span.validationAreaRight').hide();\r\n }\r\n //CHECK G2\r\n if (typeof dontCheckEmpty == \"undefined\") {\r\n dontCheckEmpty = false;\r\n }\r\n if (typeof fromEOL == \"undefined\") {\r\n fromEOL = false;\r\n }\r\n\r\n if (!fromEOL && userHasSpeechRecognition && useG2Speech && !dontCheckEmpty && !screening) {\r\n\r\n clearTimeout(window.pollG2Timeout);\r\n $('#btnValidateAndCloseFile').attr('disabled', true);\r\n $('#btnSaveAndCloseFile').attr('disabled', true);\r\n\r\n closeActiveSpeech(Model.OrderNumber).done(function (e) {\r\n\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n\r\n $.ajax({\r\n type: \"GET\",\r\n url: \"/legacy/Reports/GetG2SpeechDocumentOnSaveAndClose\",\r\n async: false,\r\n data: {\r\n GUID: reportGUID,\r\n Order_UID: Model.OrderID\r\n },\r\n timeout: 15000,\r\n success: function (data) {\r\n clearTimeout(window.pollG2Timeout);\r\n\r\n if ((data.AllOk || (data.ErrorG2 && !data.SpeechDocumentExists && $('#editableContent').val() == \"true\")) && $('#editableContent').val() == \"false\") {\r\n if (data.ReportGUID)\r\n {\r\n reportGUID = data.ReportGUID;\r\n }\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n tinymce.activeEditor.setContent(data.Result);\r\n }\r\n else if (data.ErrorG2) {\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n alert(data.ErrorMessage);\r\n return false;\r\n }\r\n\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 4)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(4);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, false, true, triggerExportFormats);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, false, true, triggerExportFormats);\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }).error(function(e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n });\r\n\r\n }\r\n else {\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 4)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(4);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, false, true, triggerExportFormats);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, false, true, triggerExportFormats);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n $('input#btnSendToPreliminary').on('click', function (e, fromEOL, dontCheckEmpty) {\r\n gTriggerExportFormats = false;\r\n SendToPreliminary(e, fromEOL, dontCheckEmpty, gTriggerExportFormats);\r\n });\r\n\r\n $('input#btnSendToPreliminaryAndTriggerExportFormats').on('click', function (e, fromEOL, dontCheckEmpty) {\r\n gTriggerExportFormats = true;\r\n SendToPreliminary(e, fromEOL, dontCheckEmpty, gTriggerExportFormats);\r\n });\r\n\r\n $('input#btnSaveAndCloseFile').on('click', function (e, fromEOL, dontCheckEmpty) {\r\n if (screening) {\r\n $('span.validationAreaGeneral').hide();\r\n $('span.validationAreaLeft').hide();\r\n $('span.validationAreaRight').hide();\r\n if(!ValidateScreeningInputFields())\r\n {\r\n $(\"#screeningvalidationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n if (!noRequestForm)\r\n {\r\n if(!ValidateRequestFormInputFields(true))\r\n {\r\n $('a[href=\"#requestTab\"]').trigger('click');\r\n $(\"#request #validationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n }\r\n }\r\n //CHECK G2\r\n if (typeof dontCheckEmpty == \"undefined\") {\r\n dontCheckEmpty = false;\r\n }\r\n if (typeof fromEOL == \"undefined\") {\r\n fromEOL = false;\r\n }\r\n\r\n if (!fromEOL && userHasSpeechRecognition && useG2Speech && !dontCheckEmpty && !screening) {\r\n\r\n clearTimeout(window.pollG2Timeout);\r\n $('#btnValidateAndCloseFile').attr('disabled', true);\r\n $('#btnSaveAndCloseFile').attr('disabled', true);\r\n\r\n closeActiveSpeech(Model.OrderNumber).done(function (e) {\r\n\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n\r\n $.ajax({\r\n type: \"GET\",\r\n url: \"/legacy/Reports/GetG2SpeechDocumentOnSaveAndClose\",\r\n async: false,\r\n data: {\r\n GUID: reportGUID,\r\n Order_UID: Model.OrderID\r\n },\r\n timeout: 15000,\r\n success: function (data) {\r\n clearTimeout(window.pollG2Timeout);\r\n\r\n if ((data.AllOk || (data.ErrorG2 && !data.SpeechDocumentExists && $('#editableContent').val() == \"true\")) && $('#editableContent').val() == \"false\") {\r\n if (data.ReportGUID)\r\n {\r\n reportGUID = data.ReportGUID;\r\n }\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n tinymce.activeEditor.setContent(data.Result);\r\n }\r\n else if (data.ErrorG2) {\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n alert(data.ErrorMessage);\r\n return false;\r\n }\r\n\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 1)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(2);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, false, false);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, false, false);\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }).error(function(e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n });\r\n\r\n }\r\n else {\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 1)) {\r\n if (showConfirmationOnSave) {\r\n showConfirmationPopup(2);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(false, true, false, false);\r\n }\r\n else {\r\n ValidateOrSaveAndClose(false, true, null, false, false);\r\n }\r\n }\r\n }\r\n }\r\n $('body').off('click', 'ul.listFound li');\r\n });\r\n\r\n $('input#btnValidateAndCloseFile').on('click', function (e, fromEOL, dontCheckEmpty) {\r\n if (screening) {\r\n $('span.validationAreaGeneral').hide();\r\n $('span.validationAreaLeft').hide();\r\n $('span.validationAreaRight').hide();\r\n if(!ValidateScreeningInputFields())\r\n {\r\n $(\"#screeningvalidationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n if (!noRequestForm)\r\n {\r\n if(!ValidateRequestFormInputFields(true))\r\n {\r\n $('a[href=\"#requestTab\"]').trigger('click');\r\n $(\"#request #validationdiv\")[0].scrollIntoView(true);\r\n return;\r\n }\r\n }\r\n }\r\n //CHECK G2\r\n if (typeof dontCheckEmpty == \"undefined\") {\r\n dontCheckEmpty = false;\r\n }\r\n if (typeof fromEOL == \"undefined\") {\r\n fromEOL = false;\r\n }\r\n\r\n if (!fromEOL && userHasSpeechRecognition && useG2Speech && !dontCheckEmpty && !screening) {\r\n\r\n clearTimeout(window.pollG2Timeout);\r\n $('#btnValidateAndCloseFile').attr('disabled', true);\r\n $('#btnSaveAndCloseFile').attr('disabled', true);\r\n\r\n closeActiveSpeech(Model.OrderNumber).done(function (e) {\r\n\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n\r\n $.ajax({\r\n type: \"GET\",\r\n url: \"/legacy/Reports/GetG2SpeechDocumentOnSaveAndClose\",\r\n async: false,\r\n data: {\r\n GUID: reportGUID,\r\n Order_UID: Model.OrderID\r\n },\r\n success: function (data) {\r\n clearTimeout(window.pollG2Timeout);\r\n if ((data.AllOk || (data.ErrorG2 && !data.SpeechDocumentExists && $('#editableContent').val() == \"true\")) && $('#editableContent').val() == \"false\") {\r\n if (data.ReportGUID) {\r\n reportGUID = data.ReportGUID;\r\n }\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n tinymce.activeEditor.setContent(data.Result);\r\n }\r\n else if (data.ErrorG2) {\r\n $('#startSpeechRecognition').removeClass('disabled');\r\n alert(data.ErrorMessage);\r\n return false;\r\n }\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 2)) {\r\n if (showConfirmationOnValidate) {\r\n showConfirmationPopup(1);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(true, true, false, false);\r\n }\r\n else {\r\n if (userRadiologistId != 0 && Model.SupervisorId != null && userRadiologistId !== Model.SupervisorId) {\r\n ShowPopupSetCurrentRadiologistAsSupervisor(true, true, false, false)\r\n }\r\n else {\r\n ValidateOrSaveAndClose(true, true, null, false, false);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }).error(function(e) {\r\n $('#btnValidateAndCloseFile').removeAttr('disabled');\r\n $('#btnSaveAndCloseFile').removeAttr('disabled');\r\n });\r\n\r\n }\r\n else {\r\n if (CheckReportContentBeforeSaving(dontCheckEmpty, 2)) {\r\n if (showConfirmationOnValidate) {\r\n showConfirmationPopup(1);\r\n }\r\n else {\r\n if (isAssistentRadiologist) {\r\n ShowPopupChooseSupervisor(true, true, false, false);\r\n }\r\n else {\r\n if (userRadiologistId != 0 && Model.SupervisorId != null && userRadiologistId !== Model.SupervisorId) {\r\n ShowPopupSetCurrentRadiologistAsSupervisor(true, true, false, false)\r\n }\r\n else {\r\n ValidateOrSaveAndClose(true, true, null, false, false);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n $('body').off('click', 'ul.listFound li');\r\n });\r\n\r\n $('input#verifyNomenclatures').on('click', function (e) {\r\n showConfirmationPopup(5);\r\n });\r\n\r\n $('span.validation').hide();\r\n\r\n $('span.validationAreaGeneral').hide();\r\n $('span.validationAreaLeft').hide();\r\n $('span.validationAreaRight').hide();\r\n\r\n $('h3.panelHeaderPassive').next().hide();\r\n\r\n var m = moment($('span#age').html(), \"DD/MM/YYYY\");\r\n var mReportDate = moment(Model.OrderDateOfImplementation, \"DD/MM/YYYY\");\r\n if (m.isValid() && mReportDate.isValid()) {\r\n $('span#age').html(mReportDate.diff(m, 'years'));\r\n }\r\n\r\n $('a[href=\"#\"]').on('click', function (e) {\r\n e.preventDefault();\r\n });\r\n\r\n $('select').each(function (e) {\r\n if ($(this).attr('value') != null) {\r\n $(this).val($(this).attr('value'));\r\n }\r\n });\r\n\r\n $('textarea').each(function (e) {\r\n if ($(this).attr('value') != null) {\r\n $(this).val($(this).attr('value'));\r\n }\r\n });\r\n\r\n $('#divPopupConfirmation' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n position: { my: \"left top\", at: \"left+15 top+30\", of: '#contentView' },\r\n modal: true,\r\n appendTo: \"#contentView\"\r\n });\r\n\r\n $('#divViewReportDialog' + viewbagUniquePrefix).dialog({\r\n autoOpen: false,\r\n resizable: false,\r\n modal: false,\r\n draggable: true,\r\n appendTo: \"#contentView\",\r\n title: $(\"\").html(window.Resources.Preview + ' ' + window.Resources.Report).text(),\r\n position: { my: \"right top\", at: \"right-15 top+30\", of: '#contentView' },\r\n sticky: 'false'\r\n });\r\n\r\n $('input[type=radio]').on('change', function (e) {\r\n var thisVal = $(this).val();\r\n $(this).attr('checked', true);\r\n $('input[type=radio][name=' + $(this).attr('name') + ']').each(function (i, y) {\r\n if ($(y).val() != thisVal) {\r\n $(y).removeAttr('checked');\r\n }\r\n });\r\n });\r\n\r\n $('input#viewHistoryPatient').on('click', function (e) {\r\n useFilingCabinet(\"/Patients/OrderHistory/\" + Model.PatientID);\r\n });\r\n\r\n $('input#loadOrder').on('click', function (e) {\r\n useFilingCabinet(\"/Orders/Detail/\" + Model.OrderID);\r\n });\r\n\r\n $('body').on('mouseenter', 'div#orderHistoryTimeline li ul, div#orderHistoryTimeline li.yearItem span.amount', function (e) {\r\n $(this).parent().addClass('hoverItem');\r\n });\r\n $('body').on('mouseleave', 'div#orderHistoryTimeline li ul, div#orderHistoryTimeline li.yearItem span.amount', function (e) {\r\n $(this).parent().removeClass('hoverItem');\r\n });\r\n\r\n //$('div#submitBottom').find('div#orderHistoryTimeline, div#noOrderHistoryTimeline').remove();\r\n\r\n $('div#contentView').show();\r\n\r\n var activeTimeline;\r\n\r\n var ToggleTimeline = function (e) {\r\n if (!$('#subPageContent').hasClass('loadedForToggleTimeline')) {\r\n $('#subPageContent').addClass('loadedForToggleTimeline');\r\n if (showTimelineOnBottomOfReport) {\r\n activeTimeline = true;\r\n }\r\n else {\r\n activeTimeline = false;\r\n }\r\n }\r\n\r\n if (activeTimeline || typeof activeTimeline == 'undefined') {\r\n $('#toggleTimeline' + viewbagUniquePrefix).addClass('active');\r\n $('#orderHistoryContainer').show();\r\n $('#yearHistoryContainer').show();\r\n $('#noOrderHistoryContainer').show();\r\n }\r\n else {\r\n $('#toggleTimeline' + viewbagUniquePrefix).removeClass('active');\r\n $('#orderHistoryContainer').hide();\r\n $('#yearHistoryContainer').hide();\r\n $('#noOrderHistoryContainer').hide();\r\n }\r\n\r\n ResizeOrderReportFields();\r\n };\r\n\r\n $('body').on('click', '#toggleTimeline' + viewbagUniquePrefix, function (e) {\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n if ($(this).hasClass('active')) {\r\n $(this).removeClass('active');\r\n activeTimeline = false;\r\n }\r\n else {\r\n activeTimeline = true;\r\n }\r\n ToggleTimeline();\r\n });\r\n\r\n var NoOrderHistory = function (e) {\r\n var divNoTimeLine = '' + htmlDecode(window.Resources.Date) + ' | ';\r\n orderHistoryTab += '' + htmlDecode(window.Resources.Procedures) + ' | ';\r\n orderHistoryTab += '
---|---|
' + x.DateTime + ' | ';\r\n orderHistoryTab += '' + ulToAppend + ' | ';\r\n orderHistoryTab += '
' + htmlDecode(data.Content) + '
';\r\n }\r\n\r\n if (!Model.Validated && !Model.ReadOnly && !data.Screening) {\r\n //\r\n content += '';\r\n content += '';\r\n content += '';\r\n content += '