@material-ui/icons#Business TypeScript Examples

The following examples show how to use @material-ui/icons#Business. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PartnershipIncome.tsx    From UsTaxes with GNU Affero General Public License v3.0 4 votes vote down vote up
PartnershipIncome = (): ReactElement => {
  const information: Information = useSelector(
    (state: TaxesState) => state.information
  )
  const ScheduleK1Form1065s = information.scheduleK1Form1065s
  const spouseScheduleK1Form1065s = ScheduleK1Form1065s.filter(
    (k1) => k1.personRole === PersonRole.SPOUSE
  )

  const spouse: Spouse | undefined = information.taxPayer.spouse

  const primary: PrimaryPerson | undefined = information.taxPayer.primaryPerson

  const filingStatus: FilingStatus | undefined =
    information.taxPayer.filingStatus

  // People for employee selector
  const people: Person[] = [primary, spouse].flatMap((p) =>
    p !== undefined ? [p as Person] : []
  )

  const defaultValues = blankUserInput

  const methods = useForm<ScheduleK1Form1065UserInput>({ defaultValues })
  const { handleSubmit } = methods
  const dispatch = useDispatch()

  const { onAdvance, navButtons } = usePager()

  const onSubmitAdd = (formData: ScheduleK1Form1065UserInput): void => {
    const payload = toScheduleK1Form1065(formData)
    if (payload !== undefined) {
      dispatch(addScheduleK1Form1065(payload))
    }
  }

  const onSubmitEdit =
    (index: number) =>
    (formData: ScheduleK1Form1065UserInput): void => {
      const payload = toScheduleK1Form1065(formData)
      if (payload !== undefined) {
        dispatch(editScheduleK1Form1065({ value: payload, index }))
      }
    }

  const form: ReactElement | undefined = (
    <FormListContainer<ScheduleK1Form1065UserInput>
      defaultValues={defaultValues}
      onSubmitAdd={onSubmitAdd}
      onSubmitEdit={onSubmitEdit}
      items={ScheduleK1Form1065s.map((a) => toUserInput(a))}
      removeItem={(i) => dispatch(removeScheduleK1Form1065(i))}
      icon={() => <Business />}
      primary={(k1) => k1.partnershipName}
      secondary={(k1) => {
        const scheduleK1Form1065 = toScheduleK1Form1065(k1)
        if (scheduleK1Form1065 === undefined) return ''
        return <span>{formatEIN(scheduleK1Form1065.partnershipEin)}</span>
      }}
    >
      {' '}
      <Grid container spacing={2}>
        <h3>Partnership Income from Schedule K1 (Form 1065)</h3>
        <LabeledInput label="Partnership name" name="partnershipName" />
        <LabeledInput
          label="Partnership EIN"
          name="partnershipEin"
          patternConfig={Patterns.ein}
        />
        <GenericLabeledDropdown
          dropDownData={['Partnership', 'S Corporation']}
          label="Partnership or S Corporation"
          required={true}
          valueMapping={(t) => t.substring(0, 1)}
          name="partnerOrSCorp"
          keyMapping={(k: string, i: number) => i}
          textMapping={(t) => t}
        />
        <LabeledCheckbox
          label=" If a foreign partner, check this box"
          name="isForeign"
        />
        <LabeledCheckbox
          label=" If you are a passive partner, check this box"
          name="isPassive"
        />
        <LabeledInput
          label={boxLabel('1', 'Ordinary business income (loss)')}
          patternConfig={Patterns.currency}
          name="ordinaryBusinessIncome"
        />
        <LabeledInput
          label={boxLabel('4a', 'Guaranteed payments for services')}
          patternConfig={Patterns.currency}
          name="guaranteedPaymentsForServices"
        />
        <LabeledInput
          label={boxLabel('4b', 'Guaranteed payments for capital')}
          patternConfig={Patterns.currency}
          name="guaranteedPaymentsForCapital"
        />
        <LabeledInput
          label={boxLabel('5', 'Interest Income')}
          patternConfig={Patterns.currency}
          name="interestIncome"
        />
        <LabeledInput
          label={boxLabel('14', 'Self-employment earnings (loss) - Code A')}
          patternConfig={Patterns.currency}
          name="selfEmploymentEarningsA"
        />
        <LabeledInput
          label={boxLabel('14', 'Self-employment earnings (loss) - Code B')}
          patternConfig={Patterns.currency}
          name="selfEmploymentEarningsB"
        />
        <LabeledInput
          label={boxLabel('14', 'Self-employment earnings (loss) - Code C')}
          patternConfig={Patterns.currency}
          name="selfEmploymentEarningsC"
        />
        <LabeledInput
          label={boxLabel('19', 'Distributions - Code A')}
          patternConfig={Patterns.currency}
          name="distributionsCodeAAmount"
        />
        <LabeledInput
          label={boxLabel('20', 'Other information - Code Z')}
          patternConfig={Patterns.currency}
          name="section199AQBI"
        />
        <GenericLabeledDropdown
          dropDownData={people}
          label="Employee"
          required={true}
          valueMapping={(p: Person, i: number) =>
            [PersonRole.PRIMARY, PersonRole.SPOUSE][i]
          }
          name="personRole"
          keyMapping={(p: Person, i: number) => i}
          textMapping={(p) =>
            `${p.firstName} ${p.lastName} (${formatSSID(p.ssid)})`
          }
        />
      </Grid>
    </FormListContainer>
  )

  const spouseScheduleK1Form1065Message: ReactNode = (() => {
    if (
      spouse !== undefined &&
      spouseScheduleK1Form1065s.length > 0 &&
      filingStatus === FilingStatus.MFS
    ) {
      return (
        <div>
          <Box marginBottom={3}>
            <Alert className="inner" severity="warning">
              Filing status is set to Married Filing Separately.{' '}
              <strong>{spouse.firstName}</strong>
              &apos;s ScheduleK1Form1065s will not be added to the return.
            </Alert>
          </Box>
        </div>
      )
    }
  })()

  return (
    <FormProvider {...methods}>
      <form
        tabIndex={-1}
        onSubmit={intentionallyFloat(handleSubmit(onAdvance))}
      >
        <Helmet>
          <title>Partnership Income | Income | UsTaxes.org</title>
        </Helmet>
        <h2>Partnership Income</h2>
        <p>
          If you received Schedule K-1 (Form 1065), enter the information here.
        </p>
        {form}
        {spouseScheduleK1Form1065Message}
        {navButtons}
      </form>
    </FormProvider>
  )
}