kit

Inline consequence

Built revision v17.10.0

React
Topics

Human support

Bring a missing role, layout, or state, or a rendering against the standard, to the session working on kit. Name the package and the entry.

On Record, Form, Stepped flow, Settings

Inline consequence

Oakmere Primary School invoice

Cancelling this invoice removes the £240.00 amount due.

Takes effect as soon as you confirm.

You can issue a replacement invoice from Oakmere Primary School’s record.

A consequence whose action cannot be taken yet.

Oakmere Primary School invoice

Cancelling this invoice removes the £240.00 amount due.

Takes effect as soon as you confirm.

You can issue a replacement invoice from Oakmere Primary School’s record.

Wait for the invoice to be checked before cancelling.

Oakmere Primary School invoice

Cancelling this invoice removes the £240.00 amount due.

Takes effect as soon as you confirm.

A consequence that sends an email shows it as its recipient will get it.

Oakmere Primary School choir rehearsal

Moving the rehearsal to Thursday 6 February emails Aisha Khan the new time.

Channel
Email to aisha@oakmereprimary.org
Subject
Your rehearsal moves to Thursday 6 February

Aisha is emailed as soon as you confirm.

To change it after that, move it again. Aisha is emailed about that move too.

A consequence that sends a text shows it as a phone shows it.

St Anne’s Scout Group deposit

Refunding the £50.00 deposit texts Priya Shah that it is on its way.

Channel
Text to 07700 900123

Oakmere Village Hall: your £50.00 deposit for St Anne’s Scout Group is on its way back to you. It reaches your account within 5 working days.

Takes effect as soon as you confirm.

A refund cannot be taken back. You can charge a new deposit from St Anne’s Scout Group’s record.

A consequence that changes amounts holds each, before and after.

Autumn programme hire charge

Splitting the £180.00 charge across three payers changes what each one owes.

What each payer owes
PayerBeforeAfter
Oakmere Primary School
£180.00
£90.00
Oakmere WI
£0.00
£50.00
St Anne’s Scout Group
£0.00
£40.00

Takes effect as soon as you confirm.

To change the split later, split the charge again from its record.

A consequence that changes amounts and sends a text holds the amounts, then the text.

St Anne’s Scout Group deposit

Refunding the £50.00 deposit texts Priya Shah that it is on its way.

The deposit before and after
DepositBeforeAfter
Held
£50.00
£0.00
Refunded
£0.00
£50.00
Channel
Text to 07700 900123

Oakmere Village Hall: your £50.00 deposit for St Anne’s Scout Group is on its way back to you. It reaches your account within 5 working days.

Takes effect as soon as you confirm.

A refund cannot be taken back. You can charge a new deposit from St Anne’s Scout Group’s record.

Source
let money = amount => KitReact.Table.Words([KitReact.Words.Amount(KitReact.Amount.money(Specimen_Reader.reader, ~amount, ~currency="GBP"))])

let amounts = (~caption, ~heading, rows): KitReact.Table.ComparisonTable.props => {
  caption: React.string(caption),
  subjectHeading: {label: heading, props: {}},
  columnHeadings: [{label: "Before", kind: Amount, props: {}}, {label: "After", kind: Amount, props: {}}],
  rows: rows->Array.map(((name, before, after)): KitReact.Table.ComparisonTable.row => {
    subject: React.string(name),
    facts: [{content: money(before), props: {}}, {content: money(after), props: {}}],
    expansion: None,
    props: {},
    subjectProps: {},
  }),
}

let payers = [("Oakmere Primary School", "180.00", "90.00"), ("Oakmere WI", "0.00", "50.00"), ("St Anne’s Scout Group", "0.00", "40.00")]

@react.component
let make = () => {
  <>
    <KitReact.Roles.InlineConsequence
      props={{ariaLabel: "Cancel Oakmere Primary School invoice"}}
      subject={React.string("Oakmere Primary School invoice")}
      consequence={React.string("Cancelling this invoice removes the £240.00 amount due.")}
      effectiveTime={React.string("Takes effect as soon as you confirm.")}
      correctionPath={<>{React.string("You can issue a replacement invoice from ")}<a href="#role-inline-consequence">{React.string("Oakmere Primary School’s record")}</a>{React.string(".")}</>}
      action={{action: <KitReact.Roles.PrimaryAction>{React.string("Cancel invoice")}</KitReact.Roles.PrimaryAction>}}
    />
    <p className="specimen-case-line">{React.string("A consequence whose action cannot be taken yet.")}</p>
    <KitReact.Roles.InlineConsequence
      props={{ariaLabel: "Cancel Oakmere Primary School invoice"}}
      subject={React.string("Oakmere Primary School invoice")}
      consequence={React.string("Cancelling this invoice removes the £240.00 amount due.")}
      effectiveTime={React.string("Takes effect as soon as you confirm.")}
      correctionPath={<>{React.string("You can issue a replacement invoice from ")}<a href="#role-inline-consequence">{React.string("Oakmere Primary School’s record")}</a>{React.string(".")}</>}
      action={{action: <KitReact.Roles.InertControl action=PrimaryAction id="role-inline-consequence-cancel" words={[KitReact.Words.Text("Wait for the invoice to be checked before cancelling.")]}>{React.string("Cancel invoice")}</KitReact.Roles.InertControl>}}
    />
    <KitReact.Roles.InlineConsequence
      props={{id: "role-inline-consequence-empty-region", ariaLabel: "Cancel Oakmere Primary School invoice"}}
      subject={React.string("Oakmere Primary School invoice")}
      consequence={React.string("Cancelling this invoice removes the £240.00 amount due.")}
      effectiveTime={React.string("Takes effect as soon as you confirm.")}
      correctionPath={<></>}
      action={{action: <KitReact.Roles.PrimaryAction>{React.string("Cancel invoice")}</KitReact.Roles.PrimaryAction>}}
    />
    <p className="specimen-case-line">{React.string("A consequence that sends an email shows it as its recipient will get it.")}</p>
    <KitReact.Roles.InlineConsequence
      props={{ariaLabel: "Move Oakmere Primary School choir rehearsal"}}
      subject={React.string("Oakmere Primary School choir rehearsal")}
      consequence={React.string("Moving the rehearsal to Thursday 6 February emails Aisha Khan the new time.")}
      outboundPreviews=[Role_OutboundPreview.email]
      effectiveTime={React.string("Aisha is emailed as soon as you confirm.")}
      correctionPath={React.string("To change it after that, move it again. Aisha is emailed about that move too.")}
      action={{action: <KitReact.Roles.PrimaryAction>{React.string("Move rehearsal")}</KitReact.Roles.PrimaryAction>}}
    />
    <p className="specimen-case-line">{React.string("A consequence that sends a text shows it as a phone shows it.")}</p>
    <KitReact.Roles.InlineConsequence
      props={{ariaLabel: "Refund St Anne’s Scout Group deposit"}}
      subject={React.string("St Anne’s Scout Group deposit")}
      consequence={React.string("Refunding the £50.00 deposit texts Priya Shah that it is on its way.")}
      outboundPreviews=[Role_OutboundPreview.text]
      effectiveTime={React.string("Takes effect as soon as you confirm.")}
      correctionPath={<>{React.string("A refund cannot be taken back. You can charge a new deposit from ")}<a href="#role-inline-consequence">{React.string("St Anne’s Scout Group’s record")}</a>{React.string(".")}</>}
      action={{action: <KitReact.Roles.PrimaryAction>{React.string("Refund deposit")}</KitReact.Roles.PrimaryAction>}}
    />
    <p className="specimen-case-line">{React.string("A consequence that changes amounts holds each, before and after.")}</p>
    <KitReact.Roles.InlineConsequence
      props={{ariaLabel: "Split the Autumn programme hire charge"}}
      subject={React.string("Autumn programme hire charge")}
      consequence={React.string("Splitting the £180.00 charge across three payers changes what each one owes.")}
      amounts={amounts(~caption="What each payer owes", ~heading="Payer", payers)}
      effectiveTime={React.string("Takes effect as soon as you confirm.")}
      correctionPath={React.string("To change the split later, split the charge again from its record.")}
      action={{action: <KitReact.Roles.PrimaryAction>{React.string("Split charge")}</KitReact.Roles.PrimaryAction>}}
    />
    <p className="specimen-case-line">{React.string("A consequence that changes amounts and sends a text holds the amounts, then the text.")}</p>
    <KitReact.Roles.InlineConsequence
      props={{ariaLabel: "Refund St Anne’s Scout Group deposit"}}
      subject={React.string("St Anne’s Scout Group deposit")}
      consequence={React.string("Refunding the £50.00 deposit texts Priya Shah that it is on its way.")}
      amounts={amounts(~caption="The deposit before and after", ~heading="Deposit", [("Held", "50.00", "0.00"), ("Refunded", "0.00", "50.00")])}
      outboundPreviews=[Role_OutboundPreview.text]
      effectiveTime={React.string("Takes effect as soon as you confirm.")}
      correctionPath={<>{React.string("A refund cannot be taken back. You can charge a new deposit from ")}<a href="#role-inline-consequence">{React.string("St Anne’s Scout Group’s record")}</a>{React.string(".")}</>}
      action={{action: <KitReact.Roles.PrimaryAction>{React.string("Refund deposit")}</KitReact.Roles.PrimaryAction>}}
    />
  </>
}