@things-factory/warehouse-ui 4.3.656 → 4.3.660

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -81,7 +81,8 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
81
81
  return {
82
82
  _searchFields: Array,
83
83
  config: Object,
84
- _warehouseName: String
84
+ _warehouseName: String,
85
+ enableDirectInbound: Boolean
85
86
  }
86
87
  }
87
88
 
@@ -90,7 +91,7 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
90
91
  <search-form
91
92
  id="search-form"
92
93
  .fields=${this._searchFields}
93
- @submit=${() => this.warehouseGrist.fetch()}
94
+ @submit=${() => (this.enableDirectInbound ? this.locationGrist.fetch() : this.warehouseGrist.fetch())}
94
95
  ></search-form>
95
96
 
96
97
  <div class="grist-container">
@@ -134,24 +135,42 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
134
135
  }
135
136
 
136
137
  async firstUpdated() {
137
- this._searchFields = [
138
- {
139
- name: 'name',
140
- label: i18next.t('field.name'),
141
- type: 'text',
142
- props: {
143
- searchOper: 'i_like'
144
- }
145
- },
146
- {
147
- name: 'description',
148
- label: i18next.t('field.description'),
149
- type: 'text',
150
- props: {
151
- searchOper: 'i_like'
152
- }
153
- }
154
- ]
138
+ this._searchFields = !this.enableDirectInbound
139
+ ? [
140
+ {
141
+ name: 'name',
142
+ label: i18next.t('field.name'),
143
+ type: 'text',
144
+ props: {
145
+ searchOper: 'i_like'
146
+ }
147
+ },
148
+ {
149
+ name: 'description',
150
+ label: i18next.t('field.description'),
151
+ type: 'text',
152
+ props: {
153
+ searchOper: 'i_like'
154
+ }
155
+ }
156
+ ]
157
+ : [
158
+ {
159
+ name: 'name',
160
+ label: i18next.t('field.location'),
161
+ type: 'text',
162
+ props: {
163
+ searchOper: 'i_like'
164
+ }
165
+ },
166
+ {
167
+ label: i18next.t('field.location_type'),
168
+ name: 'type',
169
+ type: 'select',
170
+ options: [{ value: '' }, ...Object.values(LOCATION_TYPE).filter(type => type.value != 'BIN')],
171
+ props: { searchOper: 'eq' }
172
+ }
173
+ ]
155
174
 
156
175
  this.warehouseConfig = {
157
176
  pagination: { infinite: true },
@@ -194,7 +213,8 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
194
213
  selectable: {
195
214
  multiple: false
196
215
  },
197
- appendable: false
216
+ appendable: false,
217
+ handlers: { dblclick: this._dblClickHandler.bind(this) }
198
218
  },
199
219
  columns: [
200
220
  { type: 'gutter', gutterName: 'sequence' },
@@ -205,6 +225,12 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
205
225
  header: i18next.t('field.name'),
206
226
  width: 180
207
227
  },
228
+ {
229
+ type: 'string',
230
+ name: 'type',
231
+ header: i18next.t('field.location_type'),
232
+ width: 180
233
+ },
208
234
  {
209
235
  type: 'string',
210
236
  name: 'description',
@@ -290,6 +316,24 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
290
316
  async fetchLocations({ page, limit, sorters = [] }) {
291
317
  if (!this._warehouseId) return
292
318
 
319
+ let filters = []
320
+ filters = this.searchForm?.queryFilters
321
+ if (this.enableDirectInbound) {
322
+ filters.push(
323
+ {
324
+ name: 'type',
325
+ operator: 'noteq',
326
+ value: LOCATION_TYPE.BIN.value
327
+ },
328
+ { name: 'warehouse_id', operator: 'eq', value: this._warehouseId }
329
+ )
330
+ } else {
331
+ filters.push({
332
+ name: 'type',
333
+ operator: 'eq',
334
+ value: LOCATION_TYPE.BUFFER.value
335
+ })
336
+ }
293
337
  const response = await client.query({
294
338
  query: gql`
295
339
  query locations($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -297,30 +341,24 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
297
341
  items {
298
342
  id
299
343
  name
344
+ type
300
345
  description
301
346
  zone
302
347
  row
303
348
  column
304
349
  shelf
305
350
  status
351
+ warehouse {
352
+ id
353
+ name
354
+ }
306
355
  }
307
356
  total
308
357
  }
309
358
  }
310
359
  `,
311
360
  variables: {
312
- filters: [
313
- {
314
- name: 'warehouse_id',
315
- operator: 'eq',
316
- value: this._warehouseId
317
- },
318
- {
319
- name: 'type',
320
- operator: 'eq',
321
- value: LOCATION_TYPE.BUFFER.value
322
- }
323
- ],
361
+ filters: filters,
324
362
  pagination: { page, limit },
325
363
  sortings: sorters
326
364
  }
@@ -334,10 +372,20 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
334
372
  }
335
373
  }
336
374
 
375
+ _dblClickHandler(columns, data, column, record, rowIndex, target) {
376
+ console.log('DEBUG: Double-clicked location record: ', record)
377
+ this.dispatchEvent(new CustomEvent('selected', { detail: { ...record, locationName: record.name } }))
378
+ history.back()
379
+ }
380
+
337
381
  _selectLocation() {
338
382
  const selectedLocation = this.locationGrist.selected[0]
339
383
  if (selectedLocation) {
340
- this.dispatchEvent(new CustomEvent('selected', { detail: this.locationGrist.selected[0] }))
384
+ this.dispatchEvent(
385
+ new CustomEvent('selected', {
386
+ detail: { ...this.locationGrist.selected[0], locationName: this.locationGrist.selected[0].name }
387
+ })
388
+ )
341
389
  history.back()
342
390
  } else {
343
391
  document.dispatchEvent(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/warehouse-ui",
3
- "version": "4.3.656",
3
+ "version": "4.3.660",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -28,10 +28,10 @@
28
28
  "@things-factory/form-ui": "^4.3.591",
29
29
  "@things-factory/grist-ui": "^4.3.642",
30
30
  "@things-factory/i18n-base": "^4.3.591",
31
- "@things-factory/import-ui": "^4.3.642",
31
+ "@things-factory/import-ui": "^4.3.660",
32
32
  "@things-factory/layout-base": "^4.3.591",
33
33
  "@things-factory/shell": "^4.3.591",
34
- "@things-factory/warehouse-base": "^4.3.656"
34
+ "@things-factory/warehouse-base": "^4.3.660"
35
35
  },
36
- "gitHead": "784dc56acc60bf6b4d5a5e8df3aa325a541b4a7d"
36
+ "gitHead": "d5c870cd06b2fcacea68ba21baadd244e4532b99"
37
37
  }