{"version":3,"sources":["components/Forms/PeriodPickerField.tsx","components/shared/AutoConvertLogo.svg","components/Proposals/ProposalList/ProposalListActionButtons.tsx","components/Proposals/ProposalList/RunningMannDropDownItem.tsx","components/PagedList/RunningManDropdown.tsx","components/Proposals/ProposalList/SlaDropdown.tsx","components/Proposals/ProposalList/ProposalDropdown.tsx","components/Proposals/ProposalList/ProposalListItem.tsx","components/Proposals/ProposalStatisticsQuery.tsx","components/Proposals/ProposalList/ProposalListTotals.tsx","components/Proposals/ProposalList/ProposalSearchFilterPanel.tsx","components/Proposals/ProposalList/ProposalStatusDropdown.tsx","components/Proposals/ProposalList/ProposalSearchInputField.tsx","components/Proposals/ProposalList/index.tsx","components/PagedList/ListTotals.tsx"],"names":["PeriodPickerField","monthsOnly","compactView","submitOnChange","disabled","props","startDateFieldName","endDateFieldName","editDatesFieldName","form","values","setFieldValue","submitForm","startDate","endDate","editDates","onSelectMonth","moment","format","setTimeout","module","exports","ProposalListActionButtons","variables","dealerId","context","ContextNames","DEALER","input","undefined","useLoggedInUser","checkCanCreate","checkCanRead","useDealer","dealer","dealerLoading","loading","className","PermissionModuleNames","Proposals","to","classnames","isSuspended","DraftProposals","RunningManDropDownItem","error","data","runningManText","proposalSlas","sLAs","DropdownItem","icon","faArrowDown","LoadingSpinner","RunningManDropdown","children","allowClicks","UncontrolledDropdown","DropdownToggle","outline","onClick","e","preventDefault","stopPropagation","faRunning","DropdownMenu","right","PROPOSAL_SLAS","gql","SlaDropdown","React","memo","useState","SLAs","setSLAs","useLazyQuery","getSLAs","id","useEffect","Array","isArray","initialValues","map","sla","index","key","DELETE_PROPOSAL","REFRESH_PROPOSAL","ProposalDropdown","proposal","proposalRef","autoConvertReference","requestSlas","useMutation","deleteProposal","refreshProposal","client","useApolloClient","name","individualCustomer","getFullName","business","checkCanDelete","isDealer","isAccountManager","isAdministrator","canOpenInAutoConvert","ActionsDropdown","href","config","AUTOCONVERT_URL","target","rel","src","AutoConvertLogo","alt","AUTOCONVERT_NAME","style","width","display","then","ms","Promise","resolve","query","PROPOSAL_LIST","fetchPolicy","faSync","divider","title","message","confirmButtonText","confirmButtonColor","confirm","refetchQueries","faTrash","ProposalListItemLoadingPlaceholder","colSpan","ProposalListItemNoItemsPlaceholder","compose","withRouter","loggedInUser","item","history","roles","includes","UserRoles","encodeURIComponent","toLowerCase","push","vehicle","regNo","toUpperCase","make","model","finance","totalFinance","formatCurrency","Math","round","aprRate","dealerCommission","ProposalBadges","toString","PROPOSAL_STATISTICS","ProposalListTotals","searchArgs","page","pageSize","useQuery","proposalStatistics","useProposalStatistics","ListTotals","label","value","getPeriodDescription","totalDealerCommission","getQuerystringForReports","args","status","length","s","replace","convertedArgs","create","querystring","stringify","ProposalSearchFilterPanel","isSuperUser","Row","Col","md","FormGroup","caret","color","filterByDate","ProposalSearchDateLookup","description","ProposalSearchDate","CREATED_DATE","Object","keys","x","ACCOUNT_MANAGER","lg","Label","AccountManagerSelect","accountManagerId","onSelectAccountManager","isClearable","DealerSelect","fundedDealersOnly","onSelectDealer","BooleanCheckboxField","FileDownloadLink","API_URL","faFileExcel","ProposalStatusDropdownItem","active","updateStatus","ProposalStatusDropdown","withToggleState","currentStatus","toggle","difference","ActiveProposalStatus","ProposalStatusLookup","allStatus","ProposalStatusEnum","activeGroup","inactiveGroup","InputGroupButtonDropdown","addonType","isOpen","ProposalSearchInputField","placeholder","InputGroup","field","Input","type","InputGroupAddon","Button","faSearch","mapValuesToQuerystring","getQuerystringStatus","mapQuerystringToValues","qs","hasDebitBackOnly","getStatusFromQuerystring","defaultValues","PAID_OUT_DATE","statisticsFilterByDate","ProposalListTableContainer","ProposalList","this","defaultArgs","fixedArgs","SearchForm","defaults","fixedValues","searchInput","filterPanel","formikProps","table","FormikEffects","onChange","prevValues","currentValues","setStatusToAll","statusIncludesPaidOut","PAID_OUT","PagedList","getSearchResults","proposals","listItemsContainer","actionButtonsComponent","pollInterval","loadingPlaceholder","noItemsPlaceholder","listItemComponent","ProposalListItem","withLoggedInU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AmFZmN,gBAAiB5B,K,kCCnOhC,6EAKMxM,EAAiB,kBACrB,gBAAC,IAAD,CAAiBhB,UAAU,kBAAkBc,KAAMuO,KAAWC,MAAM,KAkBzDC,EAAiB,SAAC,GAIH,IAH1B/G,EAGyB,EAHzBA,MACAC,EAEyB,EAFzBA,MACA1I,EACyB,EADzBA,QAEA,OACE,uBAAKC,UAAU,oBACb,wBAAMA,UAAU,qBAAqBwI,GACrC,wBAAMxI,UAAU,qBACbD,EAAU,gBAACiB,EAAD,MAAqByH,GAAS,QAMlCF,IAnBW,SAAC,GAA8C,IAA5CrH,EAA2C,EAA3CA,SAAUlB,EAAiC,EAAjCA,UACrC,OAAO,uBAAKA,UAAWwP,IAAW,cAAexP,IAAakB,K","file":"static/js/6.377aaf84.chunk.js","sourcesContent":["import { Field, FieldProps } from \"formik\";\nimport moment from \"moment\";\nimport * as React from \"react\";\nimport PeriodPicker from \"../shared/PeriodPicker\";\n\ninterface PeriodPickerFieldProps {\n compactView?: boolean;\n monthsOnly?: boolean;\n submitOnChange?: boolean;\n startDateFieldName?: string;\n endDateFieldName?: string;\n editDatesFieldName?: string;\n disabled?: boolean;\n}\n\nconst PeriodPickerField = ({\n monthsOnly,\n compactView,\n submitOnChange,\n disabled,\n ...props\n}: PeriodPickerFieldProps) => {\n const {\n startDateFieldName = \"startDate\",\n endDateFieldName = \"endDate\",\n editDatesFieldName = \"editDates\"\n } = props;\n\n return (\n \n {({ form: { values, setFieldValue, submitForm } }: FieldProps) => (\n {\n setFieldValue(\n startDateFieldName,\n startDate ? moment(startDate).format(\"YYYY-MM-DD\") : null,\n !submitOnChange\n );\n setFieldValue(\n endDateFieldName,\n endDate ? moment(endDate).format(\"YYYY-MM-DD\") : null,\n !submitOnChange\n );\n setFieldValue(editDatesFieldName, !!editDates, !submitOnChange);\n submitOnChange && setTimeout(submitForm, 0);\n }}\n />\n )}\n \n );\n};\n\nexport default PeriodPickerField;\n","module.exports = __webpack_public_path__ + \"static/media/AutoConvertLogo.2bd4d6a7.svg\";","import classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Link as RouterLink } from \"react-router-dom\";\nimport { useDealer } from \"../../Dealers/DealerQuery\";\nimport { useLoggedInUser } from \"../../LoggedInUserQuery\";\nimport { PermissionModuleNames } from \"../../Permissions/types\";\nimport { ContextNames } from \"../../types\";\nimport { ProposalSearchArgs } from \"../types\";\n\nconst ProposalListActionButtons = ({\n variables,\n context,\n}: {\n variables?: { input: ProposalSearchArgs };\n context?: ContextNames;\n}) => {\n const dealerId =\n context === ContextNames.DEALER ? variables?.input?.dealerId : undefined;\n\n const { checkCanCreate, checkCanRead } = useLoggedInUser();\n\n const { dealer, loading: dealerLoading } = useDealer(dealerId);\n\n return (\n
\n {checkCanCreate(PermissionModuleNames.Proposals) ? (\n \n New proposal\n \n ) : null}\n {checkCanRead(PermissionModuleNames.DraftProposals) ? (\n \n Draft proposals\n \n ) : null}\n
\n );\n};\n\nexport default ProposalListActionButtons;\n","import React from \"react\";\nimport { DropdownItem } from \"reactstrap\";\nimport LoadingSpinner from \"../../LoadingSpinner\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { faArrowDown } from \"@fortawesome/free-solid-svg-icons\";\nimport { ApolloError } from \"apollo-boost\";\n\ninterface SLAs {\n sLAs: string[];\n}\ninterface RunningManData {\n proposalSlas?: SLAs;\n}\n\ninterface RunningManDropdownItemProps {\n loading: boolean;\n error: ApolloError | undefined;\n data: RunningManData;\n}\n\nconst RunningManDropDownItem: React.FunctionComponent<\n RunningManDropdownItemProps\n> = (props) => {\n const { loading, error, data } = props;\n\n let runningManText = \"No SLA set\";\n if (error) {\n runningManText = \"Issues retrieving SLA\";\n } else if (data && data.proposalSlas != null) {\n runningManText = data.proposalSlas.sLAs[0];\n }\n\n return (\n <>\n \n \n Dealer visible SLA{\" \"}\n \n \n \n {loading ? : runningManText}\n \n \n );\n};\n\nexport default RunningManDropDownItem;\n","import { faRunning } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { DropdownMenu, DropdownToggle, UncontrolledDropdown } from \"reactstrap\";\n\ninterface RunningManDropdownProps {\n className?: string;\n children: React.ReactNode | React.ReactNode[];\n allowClicks?: boolean;\n}\n\nconst RunningManDropdown: React.FunctionComponent = ({\n className,\n children,\n allowClicks,\n}: RunningManDropdownProps) => (\n \n {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n {\" \"}\n RunningMan\n \n {\n if (!allowClicks) {\n e.preventDefault();\n }\n e.stopPropagation();\n }}\n >\n {children}\n \n \n);\n\nexport default RunningManDropdown;\n","import { Field, FieldProps } from \"formik\";\nimport gql from \"graphql-tag\";\nimport React, { useEffect, useState } from \"react\";\nimport { useLazyQuery } from \"react-apollo\";\nimport { DropdownItem } from \"reactstrap\";\nimport RunningManDropdown from \"../../PagedList/RunningManDropdown\";\n\nexport const PROPOSAL_SLAS = gql`\n query ProposalSlas($input: ProposalIdInput) {\n proposalSlas(input: $input) {\n sLAs\n }\n }\n`;\n\nconst SlaDropdown = React.memo((props: { id: string }) => {\n const [SLAs, setSLAs] = useState();\n const [getSLAs, { loading, error, data }] = useLazyQuery(PROPOSAL_SLAS);\n const { id } = props;\n\n useEffect(() => {\n if (!Array.isArray(SLAs) || loading) {\n getSLAs({ variables: { input: { id: id } } });\n setSLAs(data?.proposalSlas?.sLAs);\n }\n }, [SLAs, data, loading, getSLAs, id]);\n\n if (!Array.isArray(SLAs) || loading || error) {\n return null;\n }\n\n return (\n \n {({\n form: {\n initialValues: { editDates, ...initialValues },\n },\n }: FieldProps) => (\n \n {SLAs?.map((sla, index) => (\n \n {sla}\n \n ))}\n \n )}\n \n );\n});\n\nexport default SlaDropdown;\n","import { faSync, faTrash } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport classnames from \"classnames\";\nimport { Field, FieldProps } from \"formik\";\nimport gql from \"graphql-tag\";\nimport * as React from \"react\";\nimport { useApolloClient, useMutation, useLazyQuery } from \"react-apollo\";\nimport { DropdownItem } from \"reactstrap\";\nimport config from \"../../../config\";\nimport { getFullName } from \"../../../utils\";\nimport { ConfirmDialog } from \"../../Forms/ConfirmDialogProvider\";\nimport { useLoggedInUser } from \"../../LoggedInUserQuery\";\nimport ActionsDropdown from \"../../PagedList/ActionsDropdown\";\nimport RunningManDropdownItem from \"./RunningMannDropDownItem\";\nimport { PermissionModuleNames } from \"../../Permissions/types\";\nimport AutoConvertLogo from \"../../shared/AutoConvertLogo.svg\";\nimport { Proposal } from \"../types\";\nimport { PROPOSAL_LIST } from \"./ProposalListQuery\";\nimport { PROPOSAL_SLAS } from \"./SlaDropdown\";\n\nconst DELETE_PROPOSAL = gql`\n mutation DeleteProposal($id: ID!) {\n deleteProposal(id: $id) {\n success\n }\n }\n`;\n\nconst REFRESH_PROPOSAL = gql`\n mutation RefreshProposal($id: ID!) {\n refreshProposal(id: $id) {\n success\n }\n }\n`;\n\n/** Promise which returns after the specified number of milliseconds */\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));\n\nconst ProposalDropdown = ({ proposal }: { proposal: Proposal }) => {\n const { id, proposalRef, autoConvertReference } = proposal;\n\n const [getSLAs, { data, loading, error }] = useLazyQuery(PROPOSAL_SLAS);\n const requestSlas = () => getSLAs({ variables: { input: { id: id } } });\n\n const [deleteProposal] = useMutation<{ success: boolean }, { id: number }>(\n DELETE_PROPOSAL\n );\n const [refreshProposal] = useMutation<{ success: boolean }, { id: number }>(\n REFRESH_PROPOSAL\n );\n const client = useApolloClient();\n\n const name = proposal.individualCustomer\n ? getFullName(proposal.individualCustomer)\n : proposal.business?.name;\n\n const { checkCanDelete, isDealer, isAccountManager, isAdministrator } =\n useLoggedInUser();\n\n const canOpenInAutoConvert = !isDealer && !isAccountManager;\n\n return (\n \n {({\n form: {\n initialValues: { editDates, ...initialValues },\n },\n }: FieldProps) => (\n \n {canOpenInAutoConvert ? (\n {\n if (!autoConvertReference) {\n e.preventDefault();\n }\n\n e.stopPropagation();\n }}\n className={classnames(\"dropdown-item\", {\n disabled: !autoConvertReference,\n })}\n href={`${config.AUTOCONVERT_URL}/application/view/${autoConvertReference}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n \n Open in {config.AUTOCONVERT_NAME}\n \n ) : null}\n {isAdministrator ? (\n <>\n {\n e.preventDefault();\n e.stopPropagation();\n\n refreshProposal({\n variables: { id },\n })\n .then(() => sleep(1000))\n .then(() =>\n client.query({\n query: PROPOSAL_LIST,\n variables: {\n input: initialValues || {},\n },\n fetchPolicy: \"network-only\",\n })\n );\n }}\n >\n \n Sync with {config.AUTOCONVERT_NAME}\n \n \n \n ) : null}\n {checkCanDelete(PermissionModuleNames.Proposals) ? (\n <>\n \n \n

\n Are you sure you want to delete proposal \"{proposalRef}\"\n for {name}?\n

\n

\n This action cannot be undone\n

\n \n }\n confirmButtonText=\"Delete proposal\"\n confirmButtonColor=\"danger\"\n >\n {(confirm) => (\n {\n e.preventDefault();\n e.stopPropagation();\n\n confirm(() =>\n deleteProposal({\n variables: { id },\n refetchQueries: [\n {\n query: PROPOSAL_LIST,\n variables: {\n input: initialValues || {},\n },\n },\n ],\n })\n );\n }}\n >\n \n Delete\n
\n )}\n \n \n ) : null}\n
\n )}\n
\n );\n};\n\nexport default ProposalDropdown;\n","import * as React from \"react\";\nimport { RouteComponentProps, withRouter } from \"react-router-dom\";\nimport { compose } from \"recompose\";\nimport { formatCurrency, getFullName, isAdministrator } from \"../../../utils\";\nimport LoadingSpinner from \"../../LoadingSpinner\";\nimport { ContextNames, User, UserRoles } from \"../../types\";\nimport ProposalBadges from \"../ProposalBadges\";\nimport { Proposal } from \"../types\";\nimport ProposalDropdown from \"./ProposalDropdown\";\nimport SlaDropdown from \"./SlaDropdown\";\n\nconst getName = (proposal: Proposal) => {\n if (proposal.business) {\n return proposal.business.name;\n }\n\n if (proposal.individualCustomer) {\n return getFullName(proposal.individualCustomer);\n }\n return undefined;\n};\n\ninterface ProposalListItemProps {\n loggedInUser: User;\n item: Proposal;\n context?: ContextNames;\n}\n\nconst ProposalListItem = ({\n loggedInUser,\n item,\n context,\n history,\n}: RouteComponentProps & ProposalListItemProps) => {\n const isDealer =\n loggedInUser.roles.includes(UserRoles.dealer) ||\n context === ContextNames.DEALER;\n const proposalRef = encodeURIComponent(item.proposalRef.toLowerCase());\n return (\n history.push(`/proposals/${proposalRef}`)}\n >\n \n
\n

\n {getName(item) || \"[No name]\"}\n

\n

\n {item.vehicle.regNo\n ? `${item.vehicle.regNo.toUpperCase()}, `\n : null}\n {item.vehicle.make || item.vehicle.model\n ? `${item.vehicle.make} ${item.vehicle.model}`\n : \"[vehicle unknown]\"}\n

\n
\n {!isDealer && context !== ContextNames.DEALER && item.dealer ? (\n

{item.dealer.name}

\n ) : null}\n\n

\n Finance:{\" \"}\n {item.finance.totalFinance\n ? formatCurrency(item.finance.totalFinance)\n : \"\"}\n

\n

\n APR: {`${Math.round((item.finance.aprRate || 0) * 100) / 100}%`}\n

\n\n

\n Comm:{\" \"}\n {`${\n item.finance.dealerCommission\n ? formatCurrency(item.finance.dealerCommission)\n : \"-\"\n }`}\n

\n\n \n\n {isAdministrator(loggedInUser) ? (\n
\n \n
\n ) : (\n
\n \n
\n )}\n \n \n {item.finance.totalFinance\n ? formatCurrency(item.finance.totalFinance)\n : \"\"}\n \n {`${\n Math.round((item.finance.aprRate || 0) * 100) / 100\n }%`}\n\n \n {`${\n item.finance.dealerCommission\n ? formatCurrency(item.finance.dealerCommission)\n : \"-\"\n }`}\n \n {isAdministrator(loggedInUser) ? (\n \n \n \n ) : (\n \n \n \n )}\n \n );\n};\n\nexport const ProposalListItemLoadingPlaceholder = () => (\n \n \n \n \n \n);\n\nexport const ProposalListItemNoItemsPlaceholder = () => (\n \n \n

No results found

\n \n \n);\n\nexport default compose<\n RouteComponentProps & ProposalListItemProps,\n ProposalListItemProps\n>(withRouter)(ProposalListItem);\n","import gql from \"graphql-tag\";\nimport * as React from \"react\";\nimport { Query, QueryResult, useQuery } from \"react-apollo\";\nimport { ProposalSearchArgs, ProposalStatistics } from \"./types\";\n\nexport interface ProposalStatisticsData {\n proposalStatistics: ProposalStatistics;\n}\n\nexport const PROPOSAL_STATISTICS = gql`\n query ProposalStatisticsQuery($input: ProposalSearchArgsInput) {\n proposalStatistics(input: $input) {\n totalCreatedCount\n totalPaidOutCount\n totalAcceptedCount\n totalCancelledCount\n totalFinance\n averagePaidOutFinance\n averageApr\n averagePeriod\n totalDebitBackAmount\n totalDealerCommission\n averageAcceptedFinance\n acceptance\n }\n }\n`;\n\ninterface ProposalStatisticsVariables {\n input?: ProposalSearchArgs;\n}\n\nconst ProposalStatisticsQuery = ({\n children,\n variables\n}: { variables: ProposalStatisticsVariables } & {\n children: (\n result: QueryResult\n ) => JSX.Element | null;\n}) => (\n \n query={PROPOSAL_STATISTICS}\n variables={variables}\n >\n {children}\n \n);\n\nexport const useProposalStatistics = (searchArgs?: ProposalSearchArgs) => {\n // Remove the page information from the payload, so paging does not cause a re-query\n const { page, pageSize, ...input } = searchArgs || {};\n\n const { loading, data } = useQuery<\n ProposalStatisticsData,\n ProposalStatisticsVariables\n >(PROPOSAL_STATISTICS, {\n variables: { input }\n });\n\n return { loading, proposalStatistics: data?.proposalStatistics };\n};\n\nexport default ProposalStatisticsQuery;\n","import * as React from \"react\";\nimport { formatCurrency } from \"../../../utils\";\nimport ListTotals, { ListTotalsItem } from \"../../PagedList/ListTotals\";\nimport { getPeriodDescription } from \"../../shared/PeriodPicker\";\nimport { useProposalStatistics } from \"../ProposalStatisticsQuery\";\nimport { ProposalSearchArgs } from \"../types\";\n\nconst ProposalListTotals = ({\n searchArgs\n}: {\n searchArgs?: ProposalSearchArgs;\n}) => {\n const { loading, proposalStatistics } = useProposalStatistics(searchArgs);\n\n return (\n \n \n {getPeriodDescription(searchArgs?.startDate, searchArgs?.endDate)}\n \n }\n />\n {formatCurrency(proposalStatistics?.totalFinance)}\n ) : null\n }\n loading={loading}\n />\n {formatCurrency(proposalStatistics?.totalDealerCommission)}\n ) : null\n }\n loading={loading}\n />\n \n );\n};\n\nexport default ProposalListTotals;\n","import { faFileExcel } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { FormikProps } from \"formik\";\nimport querystring from \"querystring\";\nimport * as React from \"react\";\nimport {\n Col,\n DropdownItem,\n DropdownMenu,\n DropdownToggle,\n FormGroup,\n Label,\n Row,\n UncontrolledDropdown\n} from \"reactstrap\";\nimport config from \"../../../config\";\nimport AccountManagerSelect from \"../../AccountManagers/AccountManagerSelect\";\nimport DealerSelect from \"../../Dealers/DealerSelect\";\nimport FileDownloadLink from \"../../FileDownloadLink\";\nimport BooleanCheckboxField from \"../../Forms/BooleanCheckboxField\";\nimport PeriodPickerField from \"../../Forms/PeriodPickerField\";\nimport { useLoggedInUser } from \"../../LoggedInUserQuery\";\nimport { ContextNames } from \"../../types\";\nimport {\n ProposalSearchArgs,\n ProposalSearchDate,\n ProposalSearchDateLookup\n} from \"../types\";\n\nconst getQuerystringForReports = (args: ProposalSearchArgs) => {\n const status =\n args.status && args.status.length\n ? args.status.map(s => s.replace(/_/g, \"\"))\n : [];\n\n const convertedArgs = {\n ...args,\n status: status && status.length ? status : []\n };\n\n delete (convertedArgs as any).create;\n delete (convertedArgs as any).editDates;\n\n return querystring.stringify(convertedArgs as any);\n};\n\nconst ProposalSearchFilterPanel = ({\n values,\n setFieldValue,\n submitForm,\n initialValues,\n context\n}: FormikProps & { context?: ContextNames }) => {\n const {\n loading,\n loggedInUser,\n isDealer,\n isAccountManager,\n isSuperUser\n } = useLoggedInUser();\n\n if (loading || !loggedInUser) {\n return null;\n }\n\n return (\n <>\n \n \n \n \n
\n \n \n {values.filterByDate\n ? ProposalSearchDateLookup[values.filterByDate].description\n : ProposalSearchDateLookup[ProposalSearchDate.CREATED_DATE]\n .description}{\" \"}\n \n \n {Object.keys(ProposalSearchDate).map(x => (\n {\n setFieldValue(\"filterByDate\", x, false);\n submitForm();\n }}\n >\n {\n ProposalSearchDateLookup[x as ProposalSearchDate]\n .description\n }\n \n ))}\n \n \n \n
\n
\n \n
\n {context !== ContextNames.DEALER && !isDealer && (\n <>\n {context !== ContextNames.ACCOUNT_MANAGER && !isAccountManager && (\n \n \n \n \n {\n setFieldValue(\"accountManagerId\", id, false);\n submitForm();\n }}\n isClearable={true}\n />\n \n \n \n )}\n \n \n \n \n {\n setFieldValue(\"dealerId\", id, false);\n submitForm();\n }}\n isClearable={true}\n />\n \n \n \n \n \n )}\n {!isDealer && (\n \n \n \n \n \n )}\n {isSuperUser && (\n \n \n \n \n \n )}\n {!isDealer && (\n <>\n \n Download\n report\n \n {(isDealer || isAccountManager) && (\n

Report is limited to 200 proposals

\n )}\n \n )}\n \n );\n};\nexport default ProposalSearchFilterPanel;\n","import { difference } from \"lodash\";\nimport * as React from \"react\";\nimport {\n DropdownItem,\n DropdownMenu,\n DropdownToggle,\n InputGroupButtonDropdown\n} from \"reactstrap\";\nimport withToggleState, { ToggleStateProps } from \"../../withToggleState\";\nimport {\n ActiveProposalStatus,\n ProposalStatusEnum,\n ProposalStatusLookup\n} from \"../types\";\n\n// tslint:disable:jsx-no-lambda\nconst ProposalStatusDropdownItem = ({\n status,\n active,\n updateStatus,\n title\n}: {\n title: string;\n active: boolean;\n status: string[];\n updateStatus: (status: string[]) => void;\n}) => {\n const update = () => updateStatus(status);\n\n return (\n \n {title}\n \n );\n};\n\nconst ProposalStatusDropdown = withToggleState<{\n status?: string[];\n updateStatus: (status: string[]) => void;\n}>(false)(\n ({\n status,\n active,\n toggle,\n updateStatus\n }: ToggleStateProps & {\n status?: string[];\n updateStatus: (status: string[]) => void;\n }) => {\n let currentStatus: string;\n\n if (!status || !status.length) {\n currentStatus = \"all\";\n } else {\n currentStatus = status[0].toUpperCase();\n\n if (status.length > 1) {\n const diff = difference(ActiveProposalStatus, status);\n if (diff.length === 0) {\n currentStatus = \"active\";\n }\n }\n }\n\n const title =\n currentStatus === \"all\"\n ? \"All\"\n : !currentStatus || currentStatus === \"active\"\n ? \"Active\"\n : ProposalStatusLookup[currentStatus as ProposalStatusEnum].description;\n\n const allStatus = Object.keys(ProposalStatusEnum) as ProposalStatusEnum[];\n\n const activeGroup = ActiveProposalStatus;\n const inactiveGroup = difference(allStatus, activeGroup);\n\n return (\n \n {title}\n \n \n \n \n {activeGroup.map(s => (\n \n ))}\n \n {inactiveGroup.map(s => (\n \n ))}\n \n \n );\n }\n);\n\nexport default ProposalStatusDropdown;\n","import { faSearch } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { Field, FieldProps } from \"formik\";\nimport * as React from \"react\";\nimport { Button, Input, InputGroup, InputGroupAddon } from \"reactstrap\";\nimport ProposalStatusDropdown from \"./ProposalStatusDropdown\";\n\nconst ProposalSearchInputField = ({\n name,\n placeholder\n}: {\n name: string;\n placeholder?: string;\n}) => (\n \n \n {({\n field,\n form: { setFieldValue, submitForm, values }\n }: FieldProps) => (\n <>\n \n {\n setFieldValue(\"status\", s, false);\n submitForm();\n }}\n />\n \n )}\n \n \n \n \n \n);\n\nexport default ProposalSearchInputField;\n","import { format } from \"date-fns\";\nimport { FormikProps } from \"formik\";\nimport { defaults, difference } from \"lodash\";\nimport * as React from \"react\";\nimport { isAdministrator } from \"../../../utils\";\nimport FormikEffects from \"../../Forms/FormikEffects\";\nimport SearchForm from \"../../Forms/SearchForm\";\nimport { LoggedInUserProps, withLoggedInUser } from \"../../LoggedInUserQuery\";\nimport PagedList from \"../../PagedList\";\nimport { ContextNames, User } from \"../../types\";\nimport {\n ActiveProposalStatus,\n ProposalSearchArgs,\n ProposalSearchDate,\n ProposalStatusEnum\n} from \"../types\";\nimport \"./index.scss\";\nimport ProposalListActionButtons from \"./ProposalListActionButtons\";\nimport ProposalListItem, {\n ProposalListItemLoadingPlaceholder,\n ProposalListItemNoItemsPlaceholder\n} from \"./ProposalListItem\";\nimport { PROPOSAL_LIST, ProposalListData } from \"./ProposalListQuery\";\nimport ProposalListTotals from \"./ProposalListTotals\";\nimport ProposalSearchFilterPanel from \"./ProposalSearchFilterPanel\";\nimport ProposalSearchInputField from \"./ProposalSearchInputField\";\n\ninterface ProposalListProps {\n context?: ContextNames;\n fixedArgs?: ProposalListFormValues;\n defaultArgs?: ProposalListFormValues;\n}\n\ninterface ProposalListFormValues extends ProposalSearchArgs {\n table?: boolean;\n}\n\nconst mapValuesToQuerystring = (values: ProposalListFormValues) => ({\n ...values,\n status: getQuerystringStatus(values.status as ProposalStatusEnum[]),\n startDate: values.startDate\n ? format(values.startDate, \"YYYY-MM-DD\")\n : undefined,\n endDate: values.endDate ? format(values.endDate, \"YYYY-MM-DD\") : undefined\n});\n\nconst mapQuerystringToValues = (qs: any): ProposalListFormValues => ({\n ...qs,\n fundedDealersOnly: qs.fundedDealersOnly === \"true\",\n editDates: qs.editDates === \"true\",\n hasDebitBackOnly: qs.hasDebitBackOnly === \"true\",\n status: getStatusFromQuerystring(qs.status)\n});\n\nconst defaultValues: ProposalListFormValues = {\n page: 1,\n pageSize: 10,\n status: ActiveProposalStatus,\n fundedDealersOnly: false,\n hasDebitBackOnly: false,\n filterByDate: ProposalSearchDate.PAID_OUT_DATE,\n statisticsFilterByDate: true,\n editDates: false\n};\n\nconst getQuerystringStatus = (\n status?: ProposalStatusEnum[]\n): string[] | string | undefined => {\n if (!status) {\n return undefined;\n }\n\n if (!difference(ActiveProposalStatus, status).length) {\n return \"active\";\n }\n\n if (!status.length || !difference(Object.keys(ProposalStatusEnum), status)) {\n return \"all\";\n }\n\n return status.map(s => s.toLowerCase());\n};\n\nconst getStatusFromQuerystring = (\n status?: string | string[]\n): ProposalStatusEnum[] | undefined => {\n if (status === \"active\") {\n return ActiveProposalStatus;\n }\n\n if (status === \"all\") {\n return [];\n }\n\n if (status) {\n if (typeof status === \"string\") {\n return [status.toUpperCase() as ProposalStatusEnum];\n }\n\n if (Array.isArray(status)) {\n return status.map(x => x.toUpperCase() as ProposalStatusEnum);\n }\n }\n\n return undefined;\n};\n\nconst ProposalListTableContainer = ({\n variables,\n children,\n loggedInUser\n}: {\n variables: { input: ProposalSearchArgs };\n children: React.ReactNode;\n loggedInUser?: User;\n context?: ContextNames;\n}) => {\n const {\n input: { page, pageSize, ...input }\n } = variables;\n\n return (\n <>\n {input.startDate || input.endDate ? (\n \n ) : null}\n \n \n \n \n \n \n {loggedInUser && isAdministrator(loggedInUser) ? (\n \n \n {children}\n
\n FinanceAPRCommission\n ) : null}\n
\n \n );\n};\n\nclass ProposalList extends React.Component<\n ProposalListProps & LoggedInUserProps\n> {\n public render() {\n const { context, defaultArgs, fixedArgs } = this.props;\n\n return (\n \n {(formikProps: FormikProps) => {\n const { table, editDates, ...input } = formikProps.initialValues;\n return (\n <>\n {\n let setStatusToAll = false;\n\n const statusIncludesPaidOut =\n !currentValues.status ||\n !currentValues.status.length ||\n currentValues.status.includes(ProposalStatusEnum.PAID_OUT);\n\n // Change the status filter to \"All\" if the date filter is changed to \"Paid out date\"\n // and paid-out proposals are not visible.\n if (\n prevValues.filterByDate !== currentValues.filterByDate &&\n currentValues.filterByDate ===\n ProposalSearchDate.PAID_OUT_DATE &&\n !statusIncludesPaidOut\n ) {\n setStatusToAll = true;\n }\n\n // Change the status filter to \"All\" if the \"Proposals with debit backs only\" checkbox\n // is ticked, and paid-out proposals are not visible.\n if (\n prevValues.hasDebitBackOnly !==\n currentValues.hasDebitBackOnly &&\n currentValues.hasDebitBackOnly &&\n !statusIncludesPaidOut\n ) {\n setStatusToAll = true;\n }\n\n if (setStatusToAll) {\n formikProps.setFieldValue(\"status\", [], false);\n setTimeout(formikProps.submitForm, 0);\n }\n }}\n />\n \n data.loggedInUser && data.loggedInUser.proposals\n }\n listItemsContainer={ProposalListTableContainer}\n actionButtonsComponent={ProposalListActionButtons}\n pollInterval={30000}\n fetchPolicy=\"cache-and-network\"\n loadingPlaceholder={ProposalListItemLoadingPlaceholder}\n noItemsPlaceholder={ProposalListItemNoItemsPlaceholder}\n listItemComponent={ProposalListItem}\n />\n \n );\n }}\n \n );\n }\n}\n\nexport default withLoggedInUser(ProposalList);\n","import { faSpinner } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport classNames from \"classnames\";\nimport * as React from \"react\";\n\nconst LoadingSpinner = () => (\n \n);\n\ninterface ListTotalsProps {\n children: React.ReactElement | React.ReactElement[];\n className?: string;\n}\n\ninterface ListTotalsItemProps {\n label: string;\n value?: string | React.ReactElement | null;\n loading?: boolean;\n}\n\nexport const ListTotals = ({ children, className }: ListTotalsProps) => {\n return
{children}
;\n};\n\nexport const ListTotalsItem = ({\n label,\n value,\n loading\n}: ListTotalsItemProps) => {\n return (\n
\n {label}\n \n {loading ? : value || null}\n \n
\n );\n};\n\nexport default ListTotals;\n"],"sourceRoot":""}