{"version":3,"sources":["webpack:///./node_modules/@abaco/activities-module/src/modules/activities-module/api/DocumentApi.ts"],"names":["DocumentApi","http","rootPath","this","cancelTokenSource","pkCuaa","campaign","itemId","get","params","offset","count","res","data","records","documentId","delete","detailOut","post","pk_cuaa","stock_item_id","act_type_id","stocked_lot_id","detailOfPrice","refDate"],"mappings":"yMAKqBA,G,+BAMjB,WAAYC,EAAkBC,GAAgB,uBAC1CC,KAAKF,KAAOA,EACZE,KAAKD,SAAWA,EAChBC,KAAKC,kBAAoB,K,qHAGtB,WAA4BC,EAAgBC,EAAkBC,GAA9D,uGACeJ,KAAKF,KAAKO,IAAV,yDAAgEH,EAAhE,YAA0EC,EAA1E,oBAA8FC,EAA9F,mCAAuI,CACrJE,OAAQ,CACJC,OAAQ,EACRC,MAAO,OAJZ,cACGC,EADH,yBAOIA,EAAIC,KAAKC,SAPb,gD,qJASA,WAAuBT,EAAgBC,EAAkBC,GAAzD,uGACeJ,KAAKF,KAAKO,IAAV,yDAAgEH,EAAhE,YAA0EC,EAA1E,oBAA8FC,EAA9F,8BAAkI,CAChJE,OAAQ,CACJC,OAAQ,EACRC,MAAO,OAJZ,cACGC,EADH,yBAOIA,EAAIC,KAAKC,SAPb,gD,iJASA,WAAmBT,EAAgBC,EAAkBC,GAArD,uGACeJ,KAAKF,KAAKO,IAAV,yDAAgEH,EAAhE,YAA0EC,EAA1E,oBAA8FC,EAA9F,cAAkH,CAChIE,OAAQ,CACJC,OAAQ,EACRC,MAAO,OAJZ,cACGC,EADH,yBAOIA,EAAIC,KAAKC,SAPb,gD,mJAYA,WAAqBT,EAAgBC,EAAkBC,EAAgBQ,GAAvE,uGACeZ,KAAKF,KAAKe,OAAV,yDAAmEX,EAAnE,YAA6EC,EAA7E,oBAAiGC,EAAjG,sBAAqHQ,IADpI,cACGH,EADH,yBAEIA,EAAIC,MAFR,gD,qJAIA,WAAqBR,EAAgBC,EAAkBC,EAAgBU,GAAvE,uGACed,KAAKF,KAAKiB,KAAV,yDA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,SAAvB,sDAA6EG,EAA7E,uBAAkGiB,GAAkBC,GADnI,cACGX,EADH,yBAEIA,EAAIC,MAFR,gD,oJAKA,WAAsBR,EAAgBiB,EAAwBE,GAA9D,uGACerB,KAAKF,KAAKO,IAAV,UAAiBL,KAAKD,SAAtB,sDAA4EG,EAA5E,uBAAiGiB,EAAjG,qBAA4HE,IAD3I,cACGZ,EADH,yBAEIA,EAAIC,MAFR,gD","file":"js/chunk-2d0cc56a.5d809ab6.js","sourcesContent":["import { HTTPClient, propsToDate, propsToDatePaged } from '@abaco/web-common/src/HTTP';\nimport { PagedResults, PagingParams } from '@abaco/web-common/src/Paging';\nimport { DateHelper } from '@abaco/web-components/src/components/DateUtils';\nimport axios, { CancelTokenSource } from \"axios\";\nimport { Document, DocumentType, DocumentCategory, DocumentOut, DocumentCategoryCheck } from '../models/Document';\nexport default class DocumentApi {\n\n private http: HTTPClient;\n private rootPath: string;\n private cancelTokenSource: CancelTokenSource | null;\n\n constructor(http: HTTPClient, rootPath: string) {\n this.http = http;\n this.rootPath = rootPath;\n this.cancelTokenSource = null;\n }\n\n public async getDocumentCategories(pkCuaa: number, campaign: number, itemId: number): Promise {\n const res = await this.http.get(`/sitiagri-rest-api/api_basic/v1/plots/subjects/${pkCuaa}/${campaign}/actions/${itemId}/dictionary_document_categories`, {\n params: {\n offset: 0,\n count: 300,\n }\n });\n return res.data.records;\n }\n public async getDocumentTypes(pkCuaa: number, campaign: number, itemId: number): Promise {\n const res = await this.http.get(`/sitiagri-rest-api/api_basic/v1/plots/subjects/${pkCuaa}/${campaign}/actions/${itemId}/dictionary_document_types`, {\n params: {\n offset: 0,\n count: 300,\n }\n });\n return res.data.records;\n }\n public async getDocuments(pkCuaa: number, campaign: number, itemId: number): Promise {\n const res = await this.http.get(`/sitiagri-rest-api/api_basic/v1/plots/subjects/${pkCuaa}/${campaign}/actions/${itemId}/documents`, {\n params: {\n offset: 0,\n count: 300,\n }\n });\n return res.data.records;\n }\n\n\n\n public async deleteDocument(pkCuaa: number, campaign: number, itemId: number, documentId: number): Promise {\n const res = await this.http.delete(`/sitiagri-rest-api/api_basic/v1/plots/subjects/${pkCuaa}/${campaign}/actions/${itemId}/documents/${documentId}`);\n return res.data;\n }\n public async insertDocument(pkCuaa: number, campaign: number, itemId: number, detailOut: DocumentOut): Promise {\n const res = await this.http.post(`/sitiagri-rest-api/api_basic/v1/plots/subjects/${pkCuaa}/${campaign}/actions/${itemId}/documents`, detailOut);\n return res.data;\n }\n\n public async getFilteredDocumentCategory(pk_cuaa: number, stock_item_id: number, act_type_id: number): Promise {\n const res = await this.http.get(`${this.rootPath}/v1/warehouse/subjects/${pk_cuaa}/stocks/${stock_item_id}/dictionary_document_categories?filter=act_type_id eq ${act_type_id}`);\n return res.data;\n }\n\n public async getStockDocumentCategory(pk_cuaa: number, stock_item_id: number): Promise {\n const res = await this.http.get(`${this.rootPath}/v1/warehouse/subjects/${pk_cuaa}/stocks/${stock_item_id}/dictionary_document_categories`);\n return res.data.records;\n }\n\n public async getStockDocumentTypes(pk_cuaa: number, stock_item_id: number, act_type_id: number): Promise {\n const res = await this.http.get(`${this.rootPath}/v1/warehouse/subjects/${pk_cuaa}/stocks/${stock_item_id}/dictionary_document_types?filter=act_type_id eq ${act_type_id}`);\n return res.data.records;\n }\n\n public async getStockDocuments(pk_cuaa: number, stock_item_id: number): Promise {\n const res = await this.http.get(`${this.rootPath}/v1/warehouse/subjects/${pk_cuaa}/stocks/${stock_item_id}/documents`);\n return res.data.records;\n }\n\n public async deleteStockDocument(pkCuaa: number, stock_item_id: number, documentId: number): Promise {\n const res = await this.http.delete(`${this.rootPath}/v1/warehouse/subjects/${pkCuaa}/stocks/${stock_item_id}/documents/${documentId}`);\n return res.data;\n }\n\n public async insertStockDocument(pkCuaa: number, stock_item_id: number, detailOut: DocumentOut): Promise {\n const res = await this.http.post(`${this.rootPath}/v1/warehouse/subjects/${pkCuaa}/stocks/${stock_item_id}/documents`, detailOut);\n return res.data;\n }\n\n public async insertProductPrice(pkCuaa: number, stocked_lot_id: number, detailOfPrice: any): Promise {\n const res = await this.http.post(`${this.rootPath}/v1/ref_prices/entity_types/STOCK/subjects/${pkCuaa}/ref_prices/${stocked_lot_id}`, detailOfPrice);\n return res.data;\n }\n\n public async getProductPrice(pkCuaa: number, stocked_lot_id: number, refDate: number): Promise {\n const res = await this.http.get(`${this.rootPath}/v1/ref_prices/entity_types/STOCK/subjects/${pkCuaa}/ref_prices/${stocked_lot_id}?ref_date=${refDate}`);\n return res.data;\n }\n\n}\n"],"sourceRoot":""}