@open-tender/store 0.3.19 → 0.3.20

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.
@@ -17,6 +17,8 @@ export interface PrepStation {
17
17
  assembly_options: KdsAssemblyOptions;
18
18
  show_print: boolean;
19
19
  show_reset: boolean;
20
+ done_only: boolean;
21
+ require_complete: boolean;
20
22
  }
21
23
  export declare type PrepStations = PrepStation[];
22
24
  export interface KdsTerminal {
@@ -126,14 +126,16 @@ var filterOrdersByItemType = function (orders, itemTypeIds) {
126
126
  };
127
127
  exports.filterOrdersByItemType = filterOrdersByItemType;
128
128
  var makeOrdersForPrepStation = function (orders, prepStation, orderType) {
129
- var item_type_ids = prepStation.item_type_ids, prep_type = prepStation.prep_type;
129
+ var item_type_ids = prepStation.item_type_ids, prep_type = prepStation.prep_type, done_only = prepStation.done_only;
130
130
  var ordersOfType = (0, exports.makeOrdersOfType)(orders, orderType);
131
131
  if (orderType === 'COMPLETED') {
132
132
  return (0, exports.filterOrdersByItemType)(ordersOfType, item_type_ids);
133
133
  }
134
134
  var filteredOrders = prep_type === 'ASSEMBLY'
135
135
  ? ordersOfType.filter(function (i) { return (0, exports.notDone)(i.prep_status); })
136
- : ordersOfType.filter(function (i) { return i.prep_status === 'DONE'; });
136
+ : ordersOfType.filter(function (i) {
137
+ return done_only ? i.prep_status === 'DONE' : (0, exports.notCompleted)(i.prep_status);
138
+ });
137
139
  var filtered = (0, exports.filterOrdersByItemType)(filteredOrders, item_type_ids);
138
140
  return prep_type === 'EXPO'
139
141
  ? filtered
@@ -221,14 +223,24 @@ exports.makeKdsStationCount = makeKdsStationCount;
221
223
  var makeKdsStationCounts = function (orders, prepStations) {
222
224
  var _a = (0, exports.makeCurrentAndFutureOrders)(orders), currentOrders = _a.current, futureOrders = _a.future;
223
225
  var currentAssembly = currentOrders.filter(function (i) { return (0, exports.notDone)(i.prep_status); });
224
- var currentExpo = currentOrders.filter(function (i) { return i.prep_status === 'DONE'; });
225
226
  var futureAssembly = futureOrders.filter(function (i) { return (0, exports.notDone)(i.prep_status); });
226
- var futureExpo = futureOrders.filter(function (i) { return i.prep_status === 'DONE'; });
227
+ var currentExpoDone = currentOrders.filter(function (i) { return i.prep_status === 'DONE'; });
228
+ var currentExpo = currentOrders.filter(function (i) { return (0, exports.notCompleted)(i.prep_status); });
229
+ var futureExpoDone = futureOrders.filter(function (i) { return i.prep_status === 'DONE'; });
230
+ var futureExpo = futureOrders.filter(function (i) { return (0, exports.notCompleted)(i.prep_status); });
227
231
  return prepStations.reduce(function (obj, i) {
228
232
  var _a;
229
- var currentFiltered = i.prep_type === 'ASSEMBLY' ? currentAssembly : currentExpo;
233
+ var currentFiltered = i.prep_type === 'ASSEMBLY'
234
+ ? currentAssembly
235
+ : i.done_only
236
+ ? currentExpoDone
237
+ : currentExpo;
230
238
  var current = (0, exports.makeKdsStationCount)(currentFiltered, i.item_type_ids);
231
- var futureFiltered = i.prep_type === 'ASSEMBLY' ? futureAssembly : futureExpo;
239
+ var futureFiltered = i.prep_type === 'ASSEMBLY'
240
+ ? futureAssembly
241
+ : i.done_only
242
+ ? futureExpoDone
243
+ : futureExpo;
232
244
  var future = (0, exports.makeKdsStationCount)(futureFiltered, i.item_type_ids);
233
245
  return tslib_1.__assign(tslib_1.__assign({}, obj), (_a = {}, _a[i.prep_station_id] = { CURRENT: current, FUTURE: future }, _a));
234
246
  }, {});
@@ -17,6 +17,8 @@ export interface PrepStation {
17
17
  assembly_options: KdsAssemblyOptions;
18
18
  show_print: boolean;
19
19
  show_reset: boolean;
20
+ done_only: boolean;
21
+ require_complete: boolean;
20
22
  }
21
23
  export declare type PrepStations = PrepStation[];
22
24
  export interface KdsTerminal {
@@ -112,14 +112,16 @@ export var filterOrdersByItemType = function (orders, itemTypeIds) {
112
112
  .filter(function (i) { return i.tickets.length; });
113
113
  };
114
114
  export var makeOrdersForPrepStation = function (orders, prepStation, orderType) {
115
- var item_type_ids = prepStation.item_type_ids, prep_type = prepStation.prep_type;
115
+ var item_type_ids = prepStation.item_type_ids, prep_type = prepStation.prep_type, done_only = prepStation.done_only;
116
116
  var ordersOfType = makeOrdersOfType(orders, orderType);
117
117
  if (orderType === 'COMPLETED') {
118
118
  return filterOrdersByItemType(ordersOfType, item_type_ids);
119
119
  }
120
120
  var filteredOrders = prep_type === 'ASSEMBLY'
121
121
  ? ordersOfType.filter(function (i) { return notDone(i.prep_status); })
122
- : ordersOfType.filter(function (i) { return i.prep_status === 'DONE'; });
122
+ : ordersOfType.filter(function (i) {
123
+ return done_only ? i.prep_status === 'DONE' : notCompleted(i.prep_status);
124
+ });
123
125
  var filtered = filterOrdersByItemType(filteredOrders, item_type_ids);
124
126
  return prep_type === 'EXPO'
125
127
  ? filtered
@@ -203,14 +205,24 @@ export var makeKdsStationCount = function (orders, itemTypeIds) {
203
205
  export var makeKdsStationCounts = function (orders, prepStations) {
204
206
  var _a = makeCurrentAndFutureOrders(orders), currentOrders = _a.current, futureOrders = _a.future;
205
207
  var currentAssembly = currentOrders.filter(function (i) { return notDone(i.prep_status); });
206
- var currentExpo = currentOrders.filter(function (i) { return i.prep_status === 'DONE'; });
207
208
  var futureAssembly = futureOrders.filter(function (i) { return notDone(i.prep_status); });
208
- var futureExpo = futureOrders.filter(function (i) { return i.prep_status === 'DONE'; });
209
+ var currentExpoDone = currentOrders.filter(function (i) { return i.prep_status === 'DONE'; });
210
+ var currentExpo = currentOrders.filter(function (i) { return notCompleted(i.prep_status); });
211
+ var futureExpoDone = futureOrders.filter(function (i) { return i.prep_status === 'DONE'; });
212
+ var futureExpo = futureOrders.filter(function (i) { return notCompleted(i.prep_status); });
209
213
  return prepStations.reduce(function (obj, i) {
210
214
  var _a;
211
- var currentFiltered = i.prep_type === 'ASSEMBLY' ? currentAssembly : currentExpo;
215
+ var currentFiltered = i.prep_type === 'ASSEMBLY'
216
+ ? currentAssembly
217
+ : i.done_only
218
+ ? currentExpoDone
219
+ : currentExpo;
212
220
  var current = makeKdsStationCount(currentFiltered, i.item_type_ids);
213
- var futureFiltered = i.prep_type === 'ASSEMBLY' ? futureAssembly : futureExpo;
221
+ var futureFiltered = i.prep_type === 'ASSEMBLY'
222
+ ? futureAssembly
223
+ : i.done_only
224
+ ? futureExpoDone
225
+ : futureExpo;
214
226
  var future = makeKdsStationCount(futureFiltered, i.item_type_ids);
215
227
  return __assign(__assign({}, obj), (_a = {}, _a[i.prep_station_id] = { CURRENT: current, FUTURE: future }, _a));
216
228
  }, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",