@gesagro/jaspion-sdk 1.0.8 → 1.0.10

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.
package/dist/index.mjs CHANGED
@@ -2313,6 +2313,68 @@ var WeaningCollectionForm = class extends Report {
2313
2313
  }
2314
2314
  };
2315
2315
 
2316
+ // src/namespaces/pig-master/reports/weaning-list.ts
2317
+ var WeaningList = class extends Report {
2318
+ constructor() {
2319
+ super(...arguments);
2320
+ this.template = "@pig-master/weaning-list";
2321
+ this.fileName = "Listagem de desmames";
2322
+ }
2323
+ async pdf(input) {
2324
+ return this.requestPdf({
2325
+ resources: this.getResources(input),
2326
+ parameters: [
2327
+ ...this.getParameters(input),
2328
+ { key: "DATA_ONLY", value: false }
2329
+ ]
2330
+ });
2331
+ }
2332
+ async csv(input) {
2333
+ return this.requestCsv({
2334
+ resources: this.getResources(input),
2335
+ parameters: [
2336
+ ...this.getParameters(input),
2337
+ { key: "DATA_ONLY", value: true }
2338
+ ]
2339
+ });
2340
+ }
2341
+ getResources(input) {
2342
+ return [{ key: "FARM_ID", value: input.farmId }];
2343
+ }
2344
+ getParameters(input) {
2345
+ let orderByColumn = input.orderBy.column;
2346
+ switch (orderByColumn) {
2347
+ case "createdAt":
2348
+ orderByColumn = "created_at";
2349
+ break;
2350
+ case "weanedPiglets":
2351
+ orderByColumn = "weaned_piglets";
2352
+ break;
2353
+ default:
2354
+ break;
2355
+ }
2356
+ return [
2357
+ { key: "DATE_BEGIN", value: input.dateRange?.start ?? null },
2358
+ { key: "DATE_END", value: input.dateRange?.end ?? null },
2359
+ { key: "CALENDAR", value: input.calendarType },
2360
+ { key: "PARITY", value: input.parity?.toString() ?? null },
2361
+ { key: "ORIGIN_ID", value: input.originId },
2362
+ { key: "BREED_ID", value: input.breedId },
2363
+ { key: "BIRTH_PLACE_ID", value: input.birthPlaceId },
2364
+ { key: "FEMALE_SWINE_ID", value: input.femaleSwineId },
2365
+ {
2366
+ key: "MATING_DATE_BEGIN",
2367
+ value: input.matingDateRange?.start ?? null
2368
+ },
2369
+ { key: "MATING_DATE_END", value: input.matingDateRange?.end ?? null },
2370
+ { key: "CONTEXT", value: input.context },
2371
+ { key: "PIGLET_BATCH_ID", value: input.nurseryPigletBatchId },
2372
+ { key: "ORDERBYDIRECTION", value: input.orderBy.direction },
2373
+ { key: "ORDERBYCOLUMN", value: orderByColumn }
2374
+ ];
2375
+ }
2376
+ };
2377
+
2316
2378
  // src/namespaces/pig-master/index.ts
2317
2379
  var PigMaster = class {
2318
2380
  constructor(http) {
@@ -2386,6 +2448,7 @@ var PigMaster = class {
2386
2448
  this.weaningAnalysis = new WeaningAnalysis(http);
2387
2449
  this.weaningCollectionForm = new WeaningCollectionForm(http);
2388
2450
  this.maternityPigletDeathList = new MaternityPigletDeathList(http);
2451
+ this.weaningList = new WeaningList(http);
2389
2452
  }
2390
2453
  };
2391
2454