Skip to content

Commit

Permalink
Merge pull request #1043 from opentripplanner/call-taker-fixes-nov-2023
Browse files Browse the repository at this point in the history
CallTaker Fixes Nov. 2023
  • Loading branch information
miles-grant-ibigroup authored Nov 8, 2023
2 parents d36af32 + 9669354 commit 52f7b33
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 49 deletions.
1 change: 1 addition & 0 deletions lib/actions/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function resetForm(full = false) {
// If fully resetting form, also clear the active search, from/to
// locations, and query params.
dispatch(clearActiveSearch())
dispatch(settingQueryParam({ departArrive: 'NOW' }))
dispatch(setLocation({ location: null, locationType: 'from' }))
dispatch(setLocation({ location: null, locationType: 'to' }))
// Get query params. Delete everything except sessionId.
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getFirstStopId } from '../util/itinerary'
import { routingQuery } from './api'
import { setQueryParam } from './form'

const SERVICE_BREAK = '03:00'
const SERVICE_BREAK = '03:30'
const NINETY_SECONDS = 90000

function updateParamsAndPlan(params) {
Expand Down
39 changes: 10 additions & 29 deletions lib/components/admin/mailables-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ class SelectedMailable extends Component {
updateField(index, 'largeFormat', evt.target.checked)
}

_changeSmallFormat = (evt) => {
const { index, updateField } = this.props
updateField(index, 'smallFormat', evt.target.checked)
}

_changeQuantity = (evt) => {
const { index, updateField } = this.props
updateField(index, 'quantity', evt.target.value)
Expand All @@ -62,8 +57,7 @@ class SelectedMailable extends Component {

render() {
const { index, mailable } = this.props
const largeId = `largeFormat-${index}`
const smallId = `smallFormat-${index}`
const id = `largeFormat-${index}`
return (
<SelectedMailableContainer>
<MailableLabel mailable={mailable} />
Expand All @@ -76,26 +70,15 @@ class SelectedMailable extends Component {
type="number"
value={mailable.quantity}
/>
<div style={{ marginTop: '5px' }}>
<input
checked={mailable.smallFormat}
id={smallId}
onChange={this._changeSmallFormat}
type="checkbox"
/>
<label htmlFor={smallId} style={{ marginLeft: '5px' }}>
Small format?
</label>
</div>
{mailable.largePrint && (
<div style={{ marginTop: '5px' }}>
<input
checked={mailable.largeFormat}
id={largeId}
id={id}
onChange={this._changeLargeFormat}
type="checkbox"
value={mailable.largeFormat}
/>
<label htmlFor={largeId} style={{ marginLeft: '5px' }}>
<label htmlFor={id} style={{ marginLeft: '5px' }}>
Large format?
</label>
</div>
Expand All @@ -122,11 +105,9 @@ class MailablesWindow extends Component {
}

_addMailable = (mailable) => {
if (!this.state.mailables.find((m) => m.name === mailable.name)) {
const mailables = [...this.state.mailables]
mailables.push({ ...mailable, quantity: 1, smallFormat: true })
this.setState({ mailables })
}
const mailables = [...this.state.mailables]
mailables.push({ ...mailable, quantity: 1 })
this.setState({ mailables })
}

_removeMailable = (mailable) => {
Expand Down Expand Up @@ -156,9 +137,9 @@ class MailablesWindow extends Component {
const { mailables: selectedMailables } = this.state
const { items } = mailablesConfig
if (!callTaker.mailables.visible) return null
const selectableMailables = items.filter(
(m) => !selectedMailables.find((mailable) => mailable.name === m.name)
)
// If items should not be addable twice, then this line can be amended
const selectableMailables = items

return (
<DraggableWindow
footer={
Expand Down
4 changes: 1 addition & 3 deletions lib/components/admin/query-record.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ class QueryRecordLayout extends Component {
onClick={this._viewQuery}
>
<CallRecordIcon type="search" />
{time}
<br />
{params.from.name} to {params.to.name}
{params.from.name} to {params.to.name} at {time}
</CallRecordButton>
</li>
)
Expand Down
2 changes: 2 additions & 0 deletions lib/components/narrative/default/itinerary.css
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@
.otp .option.default-itin > .header .title > .summary > .mode-block {
height: 18px;
width: 18px;
color: #eee;
fill: #eee;
}

.otp .option.default-itin > .header .title > .summary > .arrow-block {
Expand Down
23 changes: 7 additions & 16 deletions lib/util/mailables.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,13 @@ async function writePDF(formData, imageData, otpConfig) {

const tableData = {
headers: ['Item', 'Quantity'],
rows: mailables
.map((mailable) => {
let { largeFormat, largePrint, name, quantity, smallFormat } = mailable
const rows = []

if (smallFormat) {
rows.push([name, quantity])
}

if (largePrint && largeFormat) {
name += ' (LARGE PRINT)'
rows.push([name, quantity])
}
return rows
})
.flat()
rows: mailables.map((mailable) => {
let { largeFormat, largePrint, name, quantity } = mailable
if (largePrint && largeFormat) {
name += ' (LARGE PRINT)'
}
return [name, quantity]
})
}

doc.table(tableData, {
Expand Down

0 comments on commit 52f7b33

Please sign in to comment.