Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1x 1x 1x 1x 1x 1x 1x 1x | import { OperationsStatus } from './types'
import { SelectedAccountingObject } from '@/entities/accounting-object'
import { PipeStateEnum } from '@/entities/pipe'
export const validateStates = (
operation: OperationsStatus,
obj: SelectedAccountingObject,
packageObjects?: SelectedAccountingObject[]
) => {
if (!operation.availableStates.includes(obj.state as PipeStateEnum) && obj.state) {
return true
} else if (obj.packageId && !obj.state) {
if (packageObjects) {
const isNotValid = !packageObjects?.every(object =>
operation?.availableStates.includes(object.state as PipeStateEnum)
)
if (isNotValid) return true
} else {
return true
}
}
}
|