@arsedizioni/ars-utils 18.2.158 → 18.2.159

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.
@@ -2191,34 +2191,30 @@ class ClipperService {
2191
2191
  ///
2192
2192
  /**
2193
2193
  * Load working documents
2194
- * @param: showBusy: if true show a busy loading message. Default is true.
2195
2194
  */
2196
- loadBag(showBusy = true) {
2197
- if (showBusy) {
2198
- this.dialogService.busy("Caricamento in corso...");
2199
- }
2200
- this.httpClient
2195
+ loadBag() {
2196
+ return this.httpClient
2201
2197
  .get(this.serviceUri + '/documents/working')
2202
- .subscribe({
2203
- next: r => {
2204
- if (!r.success) {
2205
- this.dialogService.error(r.message);
2206
- }
2207
- else {
2208
- if (r.value) {
2209
- const items = [];
2210
- r.value.forEach(n => {
2211
- if (n.documentDescriptor) {
2212
- items.push(JSON.parse(n.documentDescriptor));
2198
+ .subscribe(r => {
2199
+ if (!r.success) {
2200
+ this.dialogService.error(r.message);
2201
+ }
2202
+ else {
2203
+ if (r.value) {
2204
+ const items = [];
2205
+ r.value.forEach(n => {
2206
+ if (n.documentDescriptor) {
2207
+ const documentInfo = JSON.parse(n.documentDescriptor);
2208
+ if (documentInfo) {
2209
+ n.documentId = documentInfo.DocumentId || documentInfo.Id;
2210
+ n.title1 = documentInfo.Title1 ?? documentInfo.Title2;
2211
+ n.title2 = documentInfo.Title1 ? documentInfo.Title2 : null;
2213
2212
  }
2214
- });
2215
- this.bag.set(items);
2216
- }
2217
- }
2218
- },
2219
- complete: () => {
2220
- if (showBusy) {
2221
- this.dialogService.clearBusy();
2213
+ n.documentDescriptor = null;
2214
+ items.push(n);
2215
+ }
2216
+ });
2217
+ this.bag.set(items);
2222
2218
  }
2223
2219
  }
2224
2220
  });
@@ -2230,7 +2226,7 @@ class ClipperService {
2230
2226
  addToBag(documentIds) {
2231
2227
  return this.httpClient
2232
2228
  .post(this.serviceUri + '/documents/working/add', { documentIds: documentIds })
2233
- .pipe(map(r => {
2229
+ .subscribe(r => {
2234
2230
  if (!r.success) {
2235
2231
  this.dialogService.error(r.message);
2236
2232
  }
@@ -2239,7 +2235,14 @@ class ClipperService {
2239
2235
  const newItems = [];
2240
2236
  r.value.forEach(n => {
2241
2237
  if (n.documentDescriptor) {
2242
- newItems.push(JSON.parse(n.documentDescriptor));
2238
+ const documentInfo = JSON.parse(n.documentDescriptor);
2239
+ if (documentInfo) {
2240
+ n.documentId = documentInfo.DocumentId || documentInfo.Id;
2241
+ n.title1 = documentInfo.Title1 ?? documentInfo.Title2;
2242
+ n.title2 = documentInfo.Title1 ? documentInfo.Title2 : null;
2243
+ }
2244
+ n.documentDescriptor = null;
2245
+ newItems.push(n);
2243
2246
  }
2244
2247
  });
2245
2248
  if (newItems.length > 0) {
@@ -2248,7 +2251,7 @@ class ClipperService {
2248
2251
  this.dialogService.toast('Operazione completata con successo.');
2249
2252
  }
2250
2253
  }
2251
- }));
2254
+ });
2252
2255
  }
2253
2256
  /**
2254
2257
  * Remove one working document
@@ -2257,7 +2260,7 @@ class ClipperService {
2257
2260
  removeFromBag(documentId) {
2258
2261
  return this.httpClient
2259
2262
  .post(this.serviceUri + '/documents/working/delete', { documentIds: [documentId] })
2260
- .pipe(map(r => {
2263
+ .subscribe(r => {
2261
2264
  if (!r.success) {
2262
2265
  this.dialogService.error(r.message);
2263
2266
  }
@@ -2271,7 +2274,7 @@ class ClipperService {
2271
2274
  this.dialogService.toast('Operazione completata con successo.');
2272
2275
  }
2273
2276
  }
2274
- }));
2277
+ });
2275
2278
  }
2276
2279
  /**
2277
2280
  * Clear all working documents
@@ -2279,7 +2282,7 @@ class ClipperService {
2279
2282
  clearBag() {
2280
2283
  return this.httpClient
2281
2284
  .post(this.serviceUri + '/documents/working/delete', { deleteAll: true })
2282
- .pipe(map(r => {
2285
+ .subscribe(r => {
2283
2286
  if (!r.success) {
2284
2287
  this.dialogService.error(r.message);
2285
2288
  }
@@ -2287,7 +2290,7 @@ class ClipperService {
2287
2290
  this.bag.set([]);
2288
2291
  this.dialogService.toast('Operazione completata con successo.');
2289
2292
  }
2290
- }));
2293
+ });
2291
2294
  }
2292
2295
  ///
2293
2296
  // WORKING SEARCHES