// @ts-nocheck import { useState } from 'react'; import { Button, Intent, MenuItem } from '@blueprintjs/core'; import { useFormikContext } from 'formik'; import { css } from '@emotion/css'; import { x } from '@xstyled/emotion'; import { unique, chain } from 'lodash'; import { FFormGroup, FInputGroup, FMultiSelect, FTextArea, Group, Stack, } from '@/components'; import { useDrawerContext } from '@/components/Drawer/DrawerProvider'; import { useDrawerActions } from '@/hooks/state'; import { SelectOptionProps } from '@blueprintjs-formik/select'; import { useInvoiceMailItems } from './_hooks'; // Create new account renderer. const createNewItemRenderer = (query, active, handleClick) => { return ( ); }; // Create new item from the given query string. const createNewItemFromQuery = (name) => ({ name }); const styleEmailButton = css` &.bp4-button.bp4-small { width: auto; margin: 0; min-height: 26px; line-height: 26px; padding-top: 0; padding-bottom: 0; font-size: 12px; } `; const fieldsWrapStyle = css` > :not(:first-of-type) .bp4-input { border-top-color: transparent; border-top-right-radius: 0; border-top-left-radius: 0; } > :not(:last-of-type) .bp4-input { border-bottom-left-radius: 0; border-bottom-right-radius: 0; } `; export function InvoiceSendMailFields() { const [showCCField, setShowCCField] = useState(false); const [showBccField, setShowBccField] = useState(false); const { values, setFieldValue } = useFormikContext(); const items = useInvoiceMailItems(); const handleClickCcBtn = (event) => { event.preventDefault(); event.stopPropagation(); setShowCCField(true); }; const handleClickBccBtn = (event) => { event.preventDefault(); event.stopPropagation(); setShowBccField(true); }; const handleCreateToItemSelect = (value: SelectOptionProps) => { setFieldValue('to', [...values?.to, value?.name]); }; const handleCreateCcItemSelect = (value: SelectOptionProps) => { setFieldValue('cc', [...values?.cc, value?.name]); }; const handleCreateBccItemSelect = (value: SelectOptionProps) => { setFieldValue('bcc', [...values?.bcc, value?.name]); }; const rightElementsToField = ( ); return ( {showCCField && ( )} {showBccField && ( )} ); } function InvoiceSendMailFooter() { const { isSubmitting } = useFormikContext(); const { name } = useDrawerContext(); const { closeDrawer } = useDrawerActions(); const handleClose = () => { closeDrawer(name); }; return ( ); }