@@ -99,6 +99,7 @@ export const useStocktakeColumns = ({
99
99
accessor : ( { rowData } ) => {
100
100
return rowData . item ?. unitName ?? '' ;
101
101
} ,
102
+ sortable : false ,
102
103
} ,
103
104
] ,
104
105
[
@@ -119,41 +120,26 @@ export const useStocktakeColumns = ({
119
120
[
120
121
'expiryDate' ,
121
122
{
122
- getSortValue : row =>
123
- getColumnPropertyAsString ( row , [
124
- { path : [ 'lines' , 'expiryDate' ] } ,
125
- { path : [ 'expiryDate' ] , default : '' } ,
126
- ] ) ,
127
123
accessor : ( { rowData } ) =>
128
124
getColumnProperty ( rowData , [
129
125
{ path : [ 'lines' , 'expiryDate' ] } ,
130
126
{ path : [ 'expiryDate' ] } ,
131
127
] ) ,
132
128
} ,
133
129
] ,
134
- [
135
- 'location' ,
136
- {
137
- getSortValue : row =>
138
- getColumnPropertyAsString ( row , [
139
- { path : [ 'lines' , 'location' , 'code' ] } ,
140
- { path : [ 'location' , 'code' ] , default : '' } ,
141
- ] ) ,
142
- accessor : ( { rowData } ) =>
143
- getColumnProperty ( rowData , [
144
- { path : [ 'lines' , 'location' , 'code' ] } ,
145
- { path : [ 'location' , 'code' ] } ,
146
- ] ) ,
147
- } ,
148
- ] ,
130
+ {
131
+ key : 'locationCode' ,
132
+ label : 'label.location' ,
133
+ width : 90 ,
134
+ accessor : ( { rowData } ) =>
135
+ getColumnProperty ( rowData , [
136
+ { path : [ 'lines' , 'location' , 'code' ] } ,
137
+ { path : [ 'location' , 'code' ] } ,
138
+ ] ) ,
139
+ } ,
149
140
[
150
141
'packSize' ,
151
142
{
152
- getSortValue : row =>
153
- getColumnPropertyAsString ( row , [
154
- { path : [ 'lines' , 'packSize' ] } ,
155
- { path : [ 'packSize' ] , default : '' } ,
156
- ] ) ,
157
143
accessor : ( { rowData } ) =>
158
144
getColumnProperty ( rowData , [
159
145
{ path : [ 'lines' , 'packSize' ] } ,
@@ -171,19 +157,7 @@ export const useStocktakeColumns = ({
171
157
getLinesFromRow ( row ) . some (
172
158
r => getError ( r ) ?. __typename === 'SnapshotCountCurrentCountMismatch'
173
159
) ,
174
- getSortValue : row => {
175
- if ( 'lines' in row ) {
176
- const { lines } = row ;
177
- return (
178
- lines . reduce (
179
- ( total , line ) => total + line . snapshotNumberOfPacks ,
180
- 0
181
- ) ?? 0
182
- ) . toString ( ) ;
183
- } else {
184
- return row . snapshotNumberOfPacks ?? '' ;
185
- }
186
- } ,
160
+ sortable : false ,
187
161
accessor : ( { rowData } ) => {
188
162
if ( 'lines' in rowData ) {
189
163
const { lines } = rowData ;
@@ -208,19 +182,7 @@ export const useStocktakeColumns = ({
208
182
getLinesFromRow ( row ) . some (
209
183
r => getError ( r ) ?. __typename === 'SnapshotCountCurrentCountMismatch'
210
184
) ,
211
- getSortValue : row => {
212
- if ( 'lines' in row ) {
213
- const { lines } = row ;
214
- return (
215
- lines . reduce (
216
- ( total , line ) => total + ( line . countedNumberOfPacks ?? 0 ) ,
217
- 0
218
- ) ?? 0
219
- ) . toString ( ) ;
220
- } else {
221
- return row . countedNumberOfPacks ?? '' ;
222
- }
223
- } ,
185
+ sortable : false ,
224
186
accessor : ( { rowData } ) => {
225
187
if ( 'lines' in rowData ) {
226
188
const { lines } = rowData ;
@@ -239,25 +201,7 @@ export const useStocktakeColumns = ({
239
201
key : 'difference' ,
240
202
label : 'label.difference' ,
241
203
align : ColumnAlign . Right ,
242
- getSortValue : row => {
243
- if ( 'lines' in row ) {
244
- const { lines } = row ;
245
- const total =
246
- lines . reduce (
247
- ( total , line ) =>
248
- total +
249
- ( line . snapshotNumberOfPacks -
250
- ( line . countedNumberOfPacks ?? line . snapshotNumberOfPacks ) ) ,
251
- 0
252
- ) ?? 0 ;
253
- return ( total < 0 ? Math . abs ( total ) : - total ) . toString ( ) ;
254
- } else {
255
- return (
256
- row . snapshotNumberOfPacks -
257
- ( row . countedNumberOfPacks ?? row . snapshotNumberOfPacks ) ?? ''
258
- ) ;
259
- }
260
- } ,
204
+ sortable : false ,
261
205
accessor : ( { rowData } ) => {
262
206
if ( 'lines' in rowData ) {
263
207
const { lines } = rowData ;
@@ -282,17 +226,12 @@ export const useStocktakeColumns = ({
282
226
key : 'inventoryAdjustmentReason' ,
283
227
label : 'label.reason' ,
284
228
accessor : ( { rowData } ) => getStocktakeReasons ( rowData , t ) ,
285
- getSortValue : rowData => getStocktakeReasons ( rowData , t ) ,
229
+ sortable : false ,
286
230
} ,
287
231
{
288
232
key : 'comment' ,
289
233
label : 'label.stocktake-comment' ,
290
-
291
- getSortValue : row =>
292
- getColumnPropertyAsString ( row , [
293
- { path : [ 'lines' , 'comment' ] } ,
294
- { path : [ 'comment' ] , default : '' } ,
295
- ] ) ,
234
+ sortable : false ,
296
235
accessor : ( { rowData } ) =>
297
236
getColumnProperty ( rowData , [
298
237
{ path : [ 'lines' , 'comment' ] } ,
0 commit comments