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
|
cassette4
|
||||||
numberOfCassettes
|
numberOfCassettes
|
||||||
}
|
}
|
||||||
|
unpairedMachines {
|
||||||
|
id: deviceId
|
||||||
|
name
|
||||||
|
}
|
||||||
config
|
config
|
||||||
bills(filters: $billFilters) {
|
bills(filters: $billFilters) {
|
||||||
id
|
id
|
||||||
|
|
@ -160,6 +164,7 @@ const CashCassettes = () => {
|
||||||
const [machineId, setMachineId] = useState('')
|
const [machineId, setMachineId] = useState('')
|
||||||
|
|
||||||
const machines = R.path(['machines'])(data) ?? []
|
const machines = R.path(['machines'])(data) ?? []
|
||||||
|
const unpairedMachines = R.path(['unpairedMachines'])(data) ?? []
|
||||||
const config = R.path(['config'])(data) ?? {}
|
const config = R.path(['config'])(data) ?? {}
|
||||||
const fillingPercentageSettings = fromNamespace('notifications', config)
|
const fillingPercentageSettings = fromNamespace('notifications', config)
|
||||||
const [setCassetteBills, { error }] = useMutation(SET_CASSETTE_BILLS, {
|
const [setCassetteBills, { error }] = useMutation(SET_CASSETTE_BILLS, {
|
||||||
|
|
@ -356,7 +361,10 @@ const CashCassettes = () => {
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{showHistory && (
|
{showHistory && (
|
||||||
<CashboxHistory machines={machines} currency={fiatCurrency} />
|
<CashboxHistory
|
||||||
|
machines={R.concat(machines, unpairedMachines)}
|
||||||
|
currency={fiatCurrency}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
<CashCassettesFooter
|
<CashCassettesFooter
|
||||||
currencyCode={fiatCurrency}
|
currencyCode={fiatCurrency}
|
||||||
|
|
|
||||||
|
|
@ -161,9 +161,12 @@ const CashboxHistory = ({ machines, currency }) => {
|
||||||
header: 'Machine',
|
header: 'Machine',
|
||||||
width: 200,
|
width: 200,
|
||||||
textAlign: 'left',
|
textAlign: 'left',
|
||||||
view: it => {
|
view: R.pipe(
|
||||||
return R.find(R.propEq('id', it.deviceId))(machines).name
|
R.prop('deviceId'),
|
||||||
}
|
id => R.find(R.propEq('id', id), machines),
|
||||||
|
R.defaultTo({ name: <i>Unpaired device</i> }),
|
||||||
|
R.prop('name')
|
||||||
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'billCount',
|
name: 'billCount',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue