{"version":3,"sources":["components/AccountManagers/AccountManagerQuery.tsx","components/AccountManagers/AccountManagerSelect.tsx","components/CustomDatePicker.tsx","components/shared/PeriodPicker.tsx","components/Forms/PeriodPickerField.tsx","components/AccountManagers/AccountManagerList/AccountManagerListQuery.tsx","components/Proposals/ProposalDealerOverview/StatsBox.tsx","components/AccountManagers/AccountManagerTargetsSummary/AccountManagerTargetsQuery.tsx","components/Forms/QuerystringForm.tsx","components/Proposals/ProposalDealerOverview/TargetStatsBox.tsx","components/AccountManagers/AccountManagerTargetsSummary/index.tsx","components/AccountManagers/AccountManagerScene/AccountManagerTargetsTabContent.tsx","components/AccountManagers/AccountManagerScene/UserAccountManagerTargetsTabContent.tsx"],"names":["GET_ACCOUNT_MANAGER","gql","AccountManagerFragment","LoggedInUserFragment","GET_ACCOUNT_MANAGER_SHALLOW","GET_LOGGED_IN_ACCOUNT_MANAGER","useLoggedInAccountManager","useQuery","loading","data","accountManager","loggedInUser","useAccountManager","id","variables","skip","useAccountManagerShallow","AccountManagerSelect","props","useState","query","setQuery","accountManagerId","regionalSalesManagerId","onSelectAccountManager","autoFocus","hasIdentityProviderUserId","requiresHouseDealer","isClearable","isDisabled","input","page","pageSize","q","undefined","selected","useAccountManagerList","accountManagers","fetchMore","options","edges","map","node","label","name","value","selectedOption","pageInfo","inputValue","onInputChange","onChange","noOptionsMessage","filterOption","placeholder","onMenuScrollToBottom","hasMorePages","updateQuery","prev","fetchMoreResult","mergeWith","objValue","srcValue","isArray","MyDatePicker","DatePicker","CustomDatePicker","className","onDayChange","selectsStart","selectsEnd","startDate","endDate","showMonthYearPicker","dateFormat","inputStyle","minDate","maxDate","showTimes","disabled","moment","toDate","date","customInput","style","placeholderText","showTimeSelect","buttonOptions","start","end","editDates","divider","getMonthDateRange","subtract","getCurrentQuarter","add","startOf","toISOString","endOf","getYearDateRange","format","getFinancialYearDateRange","getPeriodDescription","range","find","opt","PeriodPicker","getDateRange","bind","this","compactView","monthsOnly","dateRange","x","isEqual","classNames","caret","color","i","key","active","onClick","onSelectMonth","width","fixStartDate","roundToUnit","startAdjusted","endAdjusted","isBefore","React","PeriodPickerField","submitOnChange","startDateFieldName","endDateFieldName","editDatesFieldName","form","values","setFieldValue","submitForm","setTimeout","ACCOUNT_MANAGER_LIST","StatsBox","description","units","ACCOUNT_MANAGER_TARGETS","AccountManagerTargetsFragment","AccountManagerActualsFragment","ACCOUNT_MANAGER_TARGETS_WITHOUT_NET_PROFIT","AccountManagerTargetsFragmentWithoutNetProfit","AccountManagerActualsFragmentWithoutNetProfit","ACCOUNT_MANAGER_SINGLE_TARGET","useAccountManagerTargets","canViewNetProfit","targetTemplate","targets","useAccountManagerSingleTarget","target","QuerystringForm","addDefaults","removeDefaults","getQuerystring","mapQuerystringToValues","children","initialValues","enableReinitialize","onSubmit","mapValuesToQuerystring","history","location","qs","replace","pathname","search","queryString","fixedValues","defaultValues","defaults","mergedValues","Object","keys","forEach","k","withRouter","defaultFormatter","Math","round","toString","TargetStatsBox","actual","proportionOfPeriodElapsed","projectToEndOfPeriod","formatter","displayActual","progressPercent","min","formatToPercentage","classnames","forecast","getQueryStringForReports","args","convertedArgs","querystring","stringify","AccountManagerTargetsSummaryInner","context","now","isBetween","totalDuration","duration","diff","result","asMilliseconds","getProportionOfPeriodElapsed","useLoggedInUser","isSuperUser","isSeniorManager","isRegionalSalesManager","checkCanRead","PermissionModuleNames","RegionalSalesManagers","canViewNewStats","isThisMonth","thisMonth","isSame","getIsThisMonth","actuals","ContextNames","ACCOUNT_MANAGER","Row","Col","md","xl","lg","BooleanCheckboxField","proposalsCreated","totalCreatedCount","proposalsPaidout","totalPaidOutCount","netProfit","netProfit100","formatCurrency","turnover","totalFinance","dealerCreated","dealerPaidOut","dealerSetup","getProportion","holdbackInternal","FileDownloadLink","href","config","API_URL","encodeURIComponent","icon","faFileExcel","AccountManagerTargetsSummary","formikProps","UserAccountManagerTargetsTabContent","regionalSalesManager","LoadingSpinner","AccountManagerTargetsTabContent","match","params","decodeURICom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YAEf/B,uBAAwB,SAAC9B,GAAD,OAAiBA,GACzCuC,cAAeA,EACfD,YAAa,CACXvJ,mBACAC,4BAGD,SAACwO,GAAD,OACC,kBAAC,EAAD,iBAAuCA,EAAvC,CAAoDpD,QAASA,SCvZrE,kCAOA,IAqBaqD,EAAsC,WAAO,IAAD,IAC/CrP,EAAiByM,cAAjBzM,aAER,OAAKA,EAKH,kBAAC,EAAD,CACEW,iBAAgB,OAAEX,QAAF,IAAEA,OAAF,YAAEA,EAAcD,sBAAhB,aAAE,EAA8BG,GAChDU,uBAAsB,OAAEZ,QAAF,IAAEA,OAAF,YAAEA,EAAcsP,4BAAhB,aAAE,EAAoCpP,KANvD,kBAACqP,EAAA,EAAD,OAWIC,IApCyB,SAAC,GAAD,IACtCC,EADsC,EACtCA,MADsC,OAMtC,kBAAC,EAAD,CACE9O,iBACE8O,EAAMC,OAAO/O,iBACTgP,mBAAmBF,EAAMC,OAAO/O,uBAChCY,EAENX,uBAAwB6O,EAAMC,OAAO9O,uBACrCoL,QACEyD,EAAMC,OAAO/O,iBACT2M,IAAaC,gBACbD,IAAasC,2B,kCCvBvB,qBAEeP,YAAf","file":"static/js/17.0191afb8.chunk.js","sourcesContent":["import gql from \"graphql-tag\";\nimport { useQuery } from \"react-apollo\";\nimport { LoggedInUserFragment } from \"../LoggedInUserQuery\";\nimport { User } from \"../types\";\nimport { AccountManagerFragment } from \"./fragments\";\nimport { AccountManager } from \"./types\";\n\nexport interface LoggedInAccountManagerProps {\n loggedInUser: User;\n}\n\nexport interface AccountManagerProps {\n loggedInUser: User;\n accountManager: AccountManager;\n}\n\nexport const GET_ACCOUNT_MANAGER = gql`\n query AccountManagerQuery($id: String!) {\n loggedInUser {\n ...LoggedInUserFragment\n }\n accountManager(id: $id) {\n ...AccountManagerFragment\n }\n }\n ${AccountManagerFragment}\n ${LoggedInUserFragment}\n`;\n\nexport const GET_ACCOUNT_MANAGER_SHALLOW = gql`\n query AccountManagerShallowQuery($id: String!) {\n accountManager(id: $id) {\n id\n name\n email\n }\n }\n`;\n\n/** Logged in user with fully populated account manager */\nexport const GET_LOGGED_IN_ACCOUNT_MANAGER = gql`\n query LoggedInAccountManagerQuery {\n loggedInUser {\n ...LoggedInUserFragment\n accountManager {\n ...AccountManagerFragment\n }\n }\n }\n ${LoggedInUserFragment}\n ${AccountManagerFragment}\n`;\n\nexport const useLoggedInAccountManager = () => {\n const { loading, data } = useQuery<{ loggedInUser?: User }>(\n GET_LOGGED_IN_ACCOUNT_MANAGER\n );\n\n return { loading, accountManager: data?.loggedInUser?.accountManager };\n};\n\nexport const useAccountManager = (id?: string) => {\n const { loading, data } = useQuery<\n { accountManager?: AccountManager },\n { id?: string }\n >(GET_ACCOUNT_MANAGER, {\n variables: { id },\n skip: !id\n });\n\n return { loading, accountManager: data?.accountManager };\n};\n\nexport const useAccountManagerShallow = (id?: string) => {\n const { loading, data } = useQuery<\n { accountManager?: AccountManager },\n { id?: string }\n >(GET_ACCOUNT_MANAGER_SHALLOW, {\n variables: { id },\n skip: !id\n });\n\n return { loading, accountManager: data?.accountManager };\n};\n","import { isArray, mergeWith } from \"lodash\";\nimport React, { useState } from \"react\";\nimport CustomSelect from \"../Forms/CustomSelect\";\nimport { useAccountManagerList } from \"./AccountManagerList/AccountManagerListQuery\";\nimport { useAccountManagerShallow } from \"./AccountManagerQuery\";\ninterface AccountManagerSelectProps {\n accountManagerId?: string;\n regionalSalesManagerId?: string;\n hasIdentityProviderUserId?: boolean;\n requiresHouseDealer?: boolean;\n onSelectAccountManager: (id: string) => void;\n autoFocus?: boolean;\n isClearable?: boolean;\n isDisabled?: boolean;\n}\n\nconst AccountManagerSelect = (props: AccountManagerSelectProps) => {\n const [query, setQuery] = useState(\"\");\n\n const {\n accountManagerId,\n regionalSalesManagerId,\n onSelectAccountManager,\n autoFocus,\n hasIdentityProviderUserId,\n requiresHouseDealer,\n isClearable,\n isDisabled\n } = props;\n\n const input = {\n page: 1,\n pageSize: 40,\n q: query || undefined,\n hasIdentityProviderUserId,\n regionalSalesManagerId,\n requiresHouseDealer\n };\n\n const { accountManager: selected } = useAccountManagerShallow(\n accountManagerId\n );\n\n const { accountManagers, loading, fetchMore } = useAccountManagerList(input);\n\n const options = accountManagers\n ? accountManagers.edges.map(({ node: { name, id } }) => ({\n label: name,\n value: id\n }))\n : [];\n\n const selectedOption = selected\n ? {\n label: selected.name,\n value: selected.id\n }\n : null;\n\n const pageInfo = accountManagers && accountManagers.pageInfo;\n\n return (\n \n onSelectAccountManager(value ? value.value : undefined)\n }\n noOptionsMessage={() =>\n loading\n ? selected\n ? selected.name\n : \"Loading...\"\n : \"No account managers found\"\n }\n filterOption={() => true}\n placeholder={\n accountManagers ? \"Type to search account managers\" : \"Loading...\"\n }\n autoFocus={autoFocus}\n isClearable={!!isClearable}\n onMenuScrollToBottom={() => {\n if (!pageInfo || !pageInfo.hasMorePages) {\n return;\n }\n return fetchMore({\n variables: {\n input: {\n ...input,\n page: (pageInfo.page || 1) + 1\n }\n },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) {\n return prev;\n }\n\n return mergeWith(\n {},\n prev,\n fetchMoreResult,\n (objValue, srcValue) => {\n if (isArray(objValue)) {\n return [...objValue, ...srcValue];\n }\n return;\n }\n );\n }\n });\n }}\n />\n );\n};\n\nexport default AccountManagerSelect;\n","import moment from \"moment\";\nimport * as React from \"react\";\nimport DatePicker from \"react-datepicker\";\n// tslint:disable-next-line:no-submodule-imports\nimport \"react-datepicker/dist/react-datepicker.css\";\nimport { Input } from \"reactstrap\";\nconst MyDatePicker: React.ComponentType = DatePicker;\n\nconst CustomDatePicker = ({\n className,\n selected,\n onDayChange,\n selectsStart,\n selectsEnd,\n startDate,\n endDate,\n placeholder,\n showMonthYearPicker,\n dateFormat,\n inputStyle,\n minDate,\n maxDate,\n showTimes,\n disabled\n}: {\n className?: string;\n selected?: Date | string;\n selectsStart?: boolean;\n selectsEnd?: boolean;\n startDate?: Date | string;\n endDate?: Date | string;\n placeholder?: string;\n showMonthYearPicker?: boolean;\n dateFormat?: string;\n inputStyle?: React.CSSProperties;\n minDate?: Date | null;\n maxDate?: Date | null;\n showTimes?: boolean;\n disabled?: boolean;\n onDayChange(day?: Date): void;\n}) => (\n onDayChange(date || undefined)}\n dateFormat={dateFormat ? dateFormat : \"dd/MM/yyyy\"}\n customInput={}\n selectsStart={selectsStart}\n selectsEnd={selectsEnd}\n startDate={startDate ? moment(startDate).toDate() : undefined}\n endDate={endDate ? moment(endDate).toDate() : undefined}\n placeholderText={placeholder}\n showMonthYearPicker={showMonthYearPicker}\n minDate={minDate ? moment(minDate).toDate() : null}\n maxDate={maxDate ? moment(maxDate).toDate() : null}\n showTimeSelect={showTimes}\n />\n);\n\nexport default CustomDatePicker;\n","import classNames from \"classnames\";\nimport { isEqual } from \"lodash\";\nimport moment from \"moment\";\nimport * as React from \"react\";\nimport {\n DropdownItem,\n DropdownMenu,\n DropdownToggle,\n UncontrolledDropdown\n} from \"reactstrap\";\nimport {\n getCurrentQuarter,\n getFinancialYearDateRange,\n getMonthDateRange,\n getYearDateRange\n} from \"../../utils\";\nimport CustomDatePicker from \"../CustomDatePicker\";\n\nexport interface PeriodPickerProps {\n monthsOnly?: boolean;\n editDates?: boolean;\n compactView?: boolean;\n startDate?: Date | string;\n endDate?: Date | string;\n disabled?: boolean;\n onSelectMonth: (\n startDate?: Date,\n endDate?: Date,\n editDates?: boolean\n ) => void;\n className?: string;\n}\n\nconst buttonOptions = [\n {\n label: \"All time\",\n value: { start: undefined, end: undefined }\n },\n {\n label: \"Custom dates\",\n value: { start: undefined, end: undefined },\n editDates: true\n },\n {\n divider: true\n },\n {\n ...getMonthDateRange(moment()),\n label: \"This month\"\n },\n {\n ...getMonthDateRange(moment().subtract(1, \"month\")),\n label: \"Last month\"\n },\n {\n ...getMonthDateRange(moment().subtract(2, \"month\"))\n },\n {\n ...getMonthDateRange(moment().subtract(3, \"month\"))\n },\n {\n ...getMonthDateRange(moment().subtract(4, \"month\"))\n },\n {\n ...getMonthDateRange(moment().subtract(5, \"month\"))\n },\n {\n divider: true\n },\n {\n ...getCurrentQuarter(moment()),\n label: \"Current quarter\"\n },\n {\n ...getCurrentQuarter(moment().subtract(1, 'Q')),\n label: \"Previous quarter\"\n },\n {\n divider: true\n },\n {\n label: \"Last 12 months\",\n value: {\n start: moment()\n .add(1, \"day\")\n .startOf(\"month\")\n .subtract(1, \"year\")\n .toISOString(true),\n end: moment()\n .add(1, \"day\")\n .endOf(\"month\")\n .endOf(\"day\")\n .toISOString(true)\n }\n },\n {\n ...getYearDateRange(moment()),\n label: \"This year\"\n },\n {\n ...getYearDateRange(moment().subtract(1, \"year\")),\n label: `Last year (${moment()\n .subtract(1, \"year\")\n .format(\"YYYY\")})`\n },\n {\n ...getFinancialYearDateRange(moment())\n },\n {\n ...getFinancialYearDateRange(moment().subtract(1, \"year\"))\n }\n];\n\nexport const getPeriodDescription = (\n start?: string | Date,\n end?: string | Date\n) => {\n const startDate = start ? moment(start).toISOString(true) : undefined;\n const endDate = end ? moment(end).toISOString(true) : undefined;\n\n const range = buttonOptions.find(\n opt =>\n opt.value && opt.value.start === startDate && opt.value.end === endDate\n );\n\n if (range) {\n return range.label;\n }\n\n if (!startDate && !endDate) {\n return \"All time\";\n }\n\n if (startDate) {\n if (endDate) {\n return `${moment(start).format(\"LL\")}-${moment(end).format(\"LL\")}`;\n }\n return `On or after ${moment(start).format(\"LL\")}`;\n }\n return `On or before ${moment(end).format(\"LL\")}`;\n};\n\nclass PeriodPicker extends React.Component {\n constructor(props: PeriodPickerProps) {\n super(props);\n this.getDateRange = this.getDateRange.bind(this);\n }\n\n public render() {\n const {\n editDates,\n compactView,\n monthsOnly,\n disabled,\n className\n } = this.props;\n const dateRange = {\n start: this.props.startDate\n ? moment(this.props.startDate).toISOString(true)\n : undefined,\n end: this.props.endDate\n ? moment(this.props.endDate).endOf(\"day\").toISOString(true)\n : undefined\n };\n\n const selected = buttonOptions.find(x =>\n editDates\n ? x.editDates === true\n : !x.editDates && isEqual(dateRange, x.value)\n );\n \n const dateFormat = monthsOnly ? \"MMM yyyy\" : \"dd/MM/yyyy\";\n\n return (\n
\n \n \n {selected ? selected.label : \"Custom date\"}\n \n \n {buttonOptions.map((x, i) =>\n x.divider ? (\n \n ) : (\n {\n const start = x.editDates\n ? this.props.startDate\n : x.value && x.value.start;\n const end = x.editDates\n ? this.props.endDate\n : x.value && x.value.end;\n const { startDate, endDate } = this.getDateRange(\n start,\n end,\n true,\n !!monthsOnly\n );\n\n this.props.onSelectMonth(\n startDate ? moment(startDate).toDate() : undefined,\n endDate ? moment(endDate).toDate() : undefined,\n !!x.editDates\n );\n }}\n >\n {x.label}\n \n )\n )}\n \n \n {(!compactView || editDates) && (\n <>\n {\n const { startDate, endDate } = this.getDateRange(\n date,\n this.props.endDate,\n true,\n !!monthsOnly\n );\n\n this.props.onSelectMonth(startDate, endDate, true);\n }}\n showMonthYearPicker={!!monthsOnly}\n inputStyle={{ width: 120 }}\n />\n {\n const { startDate, endDate } = this.getDateRange(\n this.props.startDate,\n date,\n false,\n !!monthsOnly\n );\n\n this.props.onSelectMonth(startDate, endDate, true);\n }}\n showMonthYearPicker={!!monthsOnly}\n inputStyle={{ width: 120 }}\n />\n \n )}\n
\n );\n }\n\n private getDateRange(\n startDate: Date | string | null | undefined,\n endDate: Date | string | null | undefined,\n fixStartDate: boolean,\n monthsOnly: boolean\n ) {\n const roundToUnit = monthsOnly ? \"month\" : \"day\";\n let startAdjusted = startDate\n ? moment(startDate).startOf(roundToUnit)\n : undefined;\n\n let endAdjusted = endDate\n ? moment(endDate).startOf(roundToUnit)\n : undefined;\n\n if (startAdjusted && endAdjusted && endAdjusted.isBefore(startAdjusted)) {\n if (fixStartDate) {\n endAdjusted = moment(startAdjusted);\n } else {\n startAdjusted = moment(endAdjusted);\n }\n }\n\n return {\n startDate: startAdjusted ? startAdjusted.toDate() : undefined,\n endDate: endAdjusted\n ? endAdjusted\n .add(1, roundToUnit)\n .subtract(1, \"day\")\n .endOf(\"day\")\n .toDate()\n : undefined\n };\n }\n}\n\nexport default PeriodPicker;\n","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","import gql from \"graphql-tag\";\nimport * as React from \"react\";\nimport { Query, QueryResult, useQuery } from \"react-apollo\";\nimport { DebounceKeys, SearchResults, User } from \"../../types\";\nimport { AccountManagerFragment } from \"../fragments\";\nimport { AccountManager, AccountManagerSearchArgs } from \"../types\";\n\nexport interface AccountManagerListData {\n loggedInUser: User;\n accountManagers: SearchResults;\n}\n\ninterface AccountManagerListVariables {\n input?: AccountManagerSearchArgs;\n}\n\nexport const ACCOUNT_MANAGER_LIST = gql`\n query AccountManagerListQuery($input: AccountManagerSearchArgsInput) {\n accountManagers(input: $input) {\n pageInfo {\n hasMorePages\n totalResults\n page\n pageSize\n first\n last\n }\n edges {\n node {\n ...AccountManagerFragment\n }\n }\n }\n }\n ${AccountManagerFragment}\n`;\n\nconst AccountManagerListQuery = ({\n children,\n ...input\n}: AccountManagerSearchArgs & {\n children: (\n result: QueryResult & {\n accountManagers?: SearchResults;\n }\n ) => JSX.Element | null;\n}) => (\n \n query={ACCOUNT_MANAGER_LIST}\n variables={{ input }}\n context={{\n debounceKey: DebounceKeys.ACCOUNT_MANAGER_LIST,\n debounceTimeout: 300\n }}\n >\n {result =>\n children({\n ...result,\n accountManagers: result.data && result.data.accountManagers\n })\n }\n \n);\n\nexport const useAccountManagerList = (input?: AccountManagerSearchArgs) => {\n const { loading, data, fetchMore } = useQuery<\n AccountManagerListData,\n AccountManagerListVariables\n >(ACCOUNT_MANAGER_LIST, { variables: { input } });\n\n return { loading, accountManagers: data?.accountManagers, fetchMore };\n};\n\nexport default AccountManagerListQuery;\n","import * as React from \"react\";\n\nconst StatsBox = ({\n label,\n description,\n value,\n units,\n loading\n}: {\n label: string;\n description?: string;\n value?: string;\n units?: string;\n loading?: boolean;\n}) => (\n
\n {loading ? (\n

 

\n ) : (\n

\n {units ? {units} : null}\n {value || \"0\"}\n

\n )}\n

{label}

\n

{description}

\n
\n);\n\nexport default StatsBox;\n","import gql from \"graphql-tag\";\nimport { useQuery } from \"react-apollo\";\nimport {\n AccountManagerActualsFragment,\n AccountManagerTargetsFragment,\n AccountManagerTargetsFragmentWithoutNetProfit,\n AccountManagerActualsFragmentWithoutNetProfit,\n} from \"../fragments\";\nimport { AccountManagerTargets } from \"../types\";\n\nexport interface AccountManagerTargetsData {\n targets: AccountManagerTargets;\n}\n\nexport interface AccountManagerSingleTargetData {\n target: AccountManagerTargets;\n}\n\nexport const ACCOUNT_MANAGER_TARGETS = gql`\n query AccountManagerTargetsQuery(\n $input: AccountManagerTargetsArgsInputType!\n ) {\n targets(input: $input) {\n ...AccountManagerTargetsFragment\n actuals {\n ...AccountManagerActualsFragment\n }\n }\n }\n ${AccountManagerTargetsFragment}\n ${AccountManagerActualsFragment}\n`;\n\nexport const ACCOUNT_MANAGER_TARGETS_WITHOUT_NET_PROFIT = gql`\n query AccountManagerTargetsQuery(\n $input: AccountManagerTargetsArgsInputType!\n ) {\n targets(input: $input) {\n ...AccountManagerTargetsFragment\n actuals {\n ...AccountManagerActualsFragment\n }\n }\n }\n ${AccountManagerTargetsFragmentWithoutNetProfit}\n ${AccountManagerActualsFragmentWithoutNetProfit}\n`;\n\nexport const ACCOUNT_MANAGER_SINGLE_TARGET = gql`\n query AccountManagerSingleTargetQuery($id: ID!) {\n target(id: $id) {\n ...AccountManagerTargetsFragment\n actuals {\n ...AccountManagerActualsFragment\n }\n }\n }\n ${AccountManagerTargetsFragment}\n ${AccountManagerActualsFragment}\n`;\n\ninterface AccountManagerTargetsVariables {\n input: {\n accountManagerId?: string;\n regionalSalesManagerId?: string;\n startDate?: string;\n endDate?: string;\n };\n}\n\nexport const useAccountManagerTargets = (\n input: {\n accountManagerId?: string;\n regionalSalesManagerId?: string;\n startDate?: string;\n endDate?: string;\n },\n canViewNetProfit: boolean\n) => {\n let targetTemplate = ACCOUNT_MANAGER_TARGETS_WITHOUT_NET_PROFIT;\n\n if (canViewNetProfit) {\n targetTemplate = ACCOUNT_MANAGER_TARGETS;\n }\n const { data, loading } = useQuery<\n AccountManagerTargetsData,\n AccountManagerTargetsVariables\n >(targetTemplate, { variables: { input } });\n return { loading, targets: data?.targets };\n};\n\nexport const useAccountManagerSingleTarget = (id?: string) => {\n const { data, loading } = useQuery<\n AccountManagerSingleTargetData,\n { id?: string }\n >(ACCOUNT_MANAGER_SINGLE_TARGET, { variables: { id }, skip: !id });\n\n return { loading, target: data?.target };\n};\n","import { Formik, FormikProps } from \"formik\";\nimport { defaults, isEqual } from \"lodash\";\nimport * as queryString from \"query-string\";\nimport * as React from \"react\";\nimport { RouteComponentProps, withRouter } from \"react-router\";\n\nexport interface QuerystringFormProps {\n mapValuesToQuerystring: (values: Values) => any;\n mapQuerystringToValues: (querystring: any) => Values;\n\n fixedValues?: Partial;\n defaultValues?: Partial;\n children: (\n props: FormikProps\n ) => JSX.Element | null | React.ReactNode;\n}\n\nclass QuerystringForm extends React.Component<\n QuerystringFormProps & RouteComponentProps\n> {\n constructor(props: QuerystringFormProps & RouteComponentProps) {\n super(props);\n this.addDefaults = this.addDefaults.bind(this);\n this.removeDefaults = this.removeDefaults.bind(this);\n this.getQuerystring = this.getQuerystring.bind(this);\n }\n\n public render() {\n const { mapQuerystringToValues, children } = this.props;\n const initialValues = this.addDefaults(\n mapQuerystringToValues(this.getQuerystring())\n );\n\n return (\n {\n const { mapValuesToQuerystring, history, location } = this.props;\n const filteredValues = this.removeDefaults(values);\n const qs = mapValuesToQuerystring(filteredValues);\n\n // Set the new querystring by replacing the current history location\n history.replace({\n pathname: location.pathname,\n search: queryString.stringify(qs)\n });\n }}\n >\n {children}\n \n );\n }\n\n private addDefaults(values: Values) {\n const { fixedValues, defaultValues } = this.props;\n\n const mergedValues = defaults({}, fixedValues, values, defaultValues);\n\n return mergedValues;\n }\n\n private removeDefaults(values: Values) {\n const fixedValues = this.props.fixedValues as any;\n const defaultValues = this.props.defaultValues as any;\n const mergedValues = defaults({}, values, defaultValues);\n\n // Remove values which match defaults\n if (defaultValues) {\n Object.keys(defaultValues).forEach(\n k =>\n typeof mergedValues[k] !== \"undefined\" &&\n isEqual(mergedValues[k], defaultValues[k]) &&\n delete mergedValues[k]\n );\n }\n\n // Remove all fixed values, because they will always stay the same\n if (fixedValues) {\n Object.keys(fixedValues).forEach(\n k =>\n typeof (fixedValues as any)[k] !== \"undefined\" &&\n delete mergedValues[k]\n );\n }\n\n // Delete any empty properties except nulls\n Object.keys(mergedValues).forEach(\n k =>\n (typeof mergedValues[k] === \"undefined\" || mergedValues[k] === \"\") &&\n delete mergedValues[k]\n );\n\n return mergedValues;\n }\n\n private getQuerystring() {\n const { location } = this.props;\n return queryString.parse(location.search);\n }\n}\n\nexport default withRouter(QuerystringForm);\n","import classnames from \"classnames\";\nimport * as React from \"react\";\nimport { formatToPercentage } from \"../../../utils\";\n\nconst defaultFormatter = (value?: number) =>\n value ? Math.round(value).toString() : \"-\";\n\nexport interface TargetStatsBoxProps {\n label?: string;\n target?: number;\n actual?: number;\n proportionOfPeriodElapsed?: number | null;\n formatter?: (value?: number) => string;\n loading?: boolean;\n projectToEndOfPeriod?: boolean;\n}\n\nconst TargetStatsBox = ({\n label,\n target,\n actual,\n loading,\n proportionOfPeriodElapsed,\n projectToEndOfPeriod,\n ...props\n}: TargetStatsBoxProps) => {\n const { formatter = defaultFormatter } = props;\n\n const displayActual =\n projectToEndOfPeriod && actual && proportionOfPeriodElapsed\n ? actual / proportionOfPeriodElapsed\n : actual;\n\n const progressPercent =\n Math.min(target ? (displayActual || 0) / target : 0, 1) * 100;\n return (\n
\n {loading ? (\n

 

\n ) : (\n

\n {(displayActual || displayActual === 0) && target\n ? formatToPercentage((displayActual / target) * 100)\n : \"0%\"}\n

\n )}\n

{label}

\n
\n \n {proportionOfPeriodElapsed && (\n \n )}\n
\n

\n {`${formatter(displayActual)} / ${formatter(target)}`}\n

\n
\n );\n};\nexport default TargetStatsBox;\n","import { faFileExcel } from \"@fortawesome/free-solid-svg-icons\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport classnames from \"classnames\";\nimport { FormikProps } from \"formik\";\nimport moment from \"moment\";\nimport querystring from \"query-string\";\nimport React from \"react\";\nimport { Col, Row } from \"reactstrap\";\nimport config from \"../../../config\";\nimport {\n formatCurrency,\n getMonthDateRange,\n getProportion,\n} from \"../../../utils\";\nimport FileDownloadLink from \"../../FileDownloadLink\";\nimport BooleanCheckboxField from \"../../Forms/BooleanCheckboxField\";\nimport PeriodPickerField from \"../../Forms/PeriodPickerField\";\nimport QuerystringForm from \"../../Forms/QuerystringForm\";\nimport { useLoggedInUser } from \"../../LoggedInUserQuery\";\nimport { PermissionModuleNames } from \"../../Permissions/types\";\nimport StatsBox from \"../../Proposals/ProposalDealerOverview/StatsBox\";\nimport TargetStatsBox from \"../../Proposals/ProposalDealerOverview/TargetStatsBox\";\nimport { ContextNames } from \"../../types\";\nimport AccountManagerSelect from \"../AccountManagerSelect\";\nimport { useAccountManagerTargets } from \"./AccountManagerTargetsQuery\";\n\nexport const TargetsTableRow = (props: {\n title: string;\n proportion?: any;\n actual?: any;\n target?: any;\n valueHighlighted?: boolean;\n}) => (\n <>\n \n {props.title}\n \n {props.proportion}\n \n \n {props.actual && props.target\n ? `${props.actual} / ${props.target}`\n : \"0\"}\n \n \n \n);\n\nexport const StatisticsTableRow = (props: {\n title: string;\n value?: any;\n valueHighlighted?: boolean;\n}) => (\n <>\n \n {props.title}\n \n \n {props.value ? props.value : \"0\"}\n \n \n \n);\n\ninterface AccountManagerTargetsSummaryProps {\n regionalSalesManagerId?: string;\n accountManagerId?: string;\n context?: ContextNames;\n}\n\ninterface AccountManagerTargetsFormValues {\n accountManagerId?: string;\n regionalSalesManagerId?: string;\n startDate?: string | null;\n endDate?: string | null;\n editDates?: boolean;\n forecast?: boolean;\n}\n\nconst defaultValues: AccountManagerTargetsFormValues = {\n startDate: moment().startOf(\"month\").format(\"YYYY-MM-DD\"),\n endDate: moment()\n .add(1, \"month\")\n .startOf(\"month\")\n .subtract(1, \"day\")\n .format(\"YYYY-MM-DD\"),\n editDates: false,\n forecast: false,\n};\n\nconst getQueryStringForReports = (args: any) => {\n const { editDates, forecast, ...convertedArgs } = args;\n\n return querystring.stringify(convertedArgs);\n};\n\nconst getProportionOfPeriodElapsed = (start: string, end: string) => {\n if (!start || !end) {\n return null;\n }\n const now = moment();\n if (!now.isBetween(start, end)) {\n return null;\n }\n const totalDuration = moment.duration(moment(end).diff(moment(start)));\n const currentDuration = moment.duration(now.diff(moment(start)));\n\n const result =\n currentDuration.asMilliseconds() / totalDuration.asMilliseconds();\n\n return Math.round(result * 100) / 100;\n};\n\nconst getIsThisMonth = (startDate: string, endDate: string) => {\n if (startDate && endDate) {\n const thisMonth = getMonthDateRange(moment());\n if (\n moment(thisMonth.value.start).isSame(moment(startDate)) &&\n moment(thisMonth.value.end).isSame(moment(endDate))\n ) {\n return true;\n }\n }\n return false;\n};\n\nconst AccountManagerTargetsSummaryInner = ({\n values,\n setFieldValue,\n submitForm,\n context,\n}: FormikProps & { context?: ContextNames }) => {\n const proportionOfPeriodElapsed = getProportionOfPeriodElapsed(\n values.startDate,\n values.endDate\n );\n\n const { isSuperUser, isSeniorManager, isRegionalSalesManager, checkCanRead } =\n useLoggedInUser();\n const canViewNetProfit =\n (isSuperUser || isRegionalSalesManager) &&\n checkCanRead(PermissionModuleNames.RegionalSalesManagers);\n const canViewNewStats =\n (isSuperUser || isRegionalSalesManager || isSeniorManager) &&\n checkCanRead(PermissionModuleNames.RegionalSalesManagers);\n\n const isThisMonth = getIsThisMonth(values.startDate, values.endDate);\n\n const { targets, loading } = useAccountManagerTargets(\n {\n accountManagerId: values.accountManagerId,\n regionalSalesManagerId: values.regionalSalesManagerId,\n startDate: values.startDate,\n endDate: values.endDate,\n },\n canViewNetProfit\n );\n\n const actuals = targets?.actuals;\n\n return (\n
\n {!values.accountManagerId && context !== ContextNames.ACCOUNT_MANAGER && (\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 \n \n

Proposal targets

\n {proportionOfPeriodElapsed || proportionOfPeriodElapsed === 0 ? (\n <>\n

\n Lower bar shows time elapsed{\" \"}\n {isThisMonth ? \"this month\" : \"in the selected date range\"}\n

\n \n \n ) : null}\n
\n \n \n {canViewNetProfit && (\n \n )}\n \n
\n \n
\n \n \n

Dealers

\n
\n \n \n \n
\n \n
\n \n \n

Stats

\n
\n \n \n \n
\n \n
\n {canViewNewStats && (\n \n \n

New Stats

\n
\n \n \n
\n \n
\n )}\n \n \n \n \n Download report\n \n \n \n \n
\n );\n};\n\nconst AccountManagerTargetsSummary = (\n props: AccountManagerTargetsSummaryProps\n) => {\n const { accountManagerId, regionalSalesManagerId, context } = props;\n\n return (\n ({\n ...qs,\n editDates: qs.editDates === \"true\",\n forecast: qs.forecast === \"true\",\n })}\n mapValuesToQuerystring={(values: any) => values}\n defaultValues={defaultValues}\n fixedValues={{\n accountManagerId,\n regionalSalesManagerId,\n }}\n >\n {(formikProps: any) => (\n \n )}\n \n );\n};\n\nexport default AccountManagerTargetsSummary;\n","import React from \"react\";\nimport { RouteComponentProps } from \"react-router\";\nimport LoadingSpinner from \"../../LoadingSpinner\";\nimport { useLoggedInUser } from \"../../LoggedInUserQuery\";\nimport { ContextNames } from \"../../types\";\nimport AccountManagerTargetsSummary from \"../AccountManagerTargetsSummary\";\n\nconst AccountManagerTargetsTabContent = ({\n match\n}: RouteComponentProps<{\n accountManagerId?: string;\n regionalSalesManagerId?: string;\n}>) => (\n \n);\n\nexport const UserAccountManagerTargetsTabContent = () => {\n const { loggedInUser } = useLoggedInUser();\n\n if (!loggedInUser) {\n return ;\n }\n\n return (\n \n );\n};\n\nexport default AccountManagerTargetsTabContent;\n","import { UserAccountManagerTargetsTabContent } from \"./AccountManagerTargetsTabContent\";\n\nexport default UserAccountManagerTargetsTabContent;\n"],"sourceRoot":""}