fix: show name of unpaired machines
This commit is contained in:
parent
0f93e313b6
commit
2426640bbf
2 changed files with 15 additions and 4 deletions
|
|
@ -98,6 +98,10 @@ const GET_MACHINES_AND_CONFIG = gql`
|
|||
cassette4
|
||||
numberOfCassettes
|
||||
}
|
||||
unpairedMachines {
|
||||
id: deviceId
|
||||
name
|
||||
}
|
||||
config
|
||||
bills(filters: $billFilters) {
|
||||
id
|
||||
|
|
@ -160,6 +164,7 @@ const CashCassettes = () => {
|
|||
const [machineId, setMachineId] = useState('')
|
||||
|
||||
const machines = R.path(['machines'])(data) ?? []
|
||||
const unpairedMachines = R.path(['unpairedMachines'])(data) ?? []
|
||||
const config = R.path(['config'])(data) ?? {}
|
||||
const fillingPercentageSettings = fromNamespace('notifications', config)
|
||||
const [setCassetteBills, { error }] = useMutation(SET_CASSETTE_BILLS, {
|
||||
|
|
@ -356,7 +361,10 @@ const CashCassettes = () => {
|
|||
</>
|
||||
)}
|
||||
{showHistory && (
|
||||
<CashboxHistory machines={machines} currency={fiatCurrency} />
|
||||
<CashboxHistory
|
||||
machines={R.concat(machines, unpairedMachines)}
|
||||
currency={fiatCurrency}
|
||||
/>
|
||||
)}
|
||||
<CashCassettesFooter
|
||||
currencyCode={fiatCurrency}
|
||||
|
|
|
|||
|
|
@ -161,9 +161,12 @@ const CashboxHistory = ({ machines, currency }) => {
|
|||
header: 'Machine',
|
||||
width: 200,
|
||||
textAlign: 'left',
|
||||
view: it => {
|
||||
return R.find(R.propEq('id', it.deviceId))(machines).name
|
||||
}
|
||||
view: R.pipe(
|
||||
R.prop('deviceId'),
|
||||
id => R.find(R.propEq('id', id), machines),
|
||||
R.defaultTo({ name: <i>Unpaired device</i> }),
|
||||
R.prop('name')
|
||||
)
|
||||
},
|
||||
{
|
||||
name: 'billCount',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue