{"version":3,"sources":["webpack:///./node_modules/@abaco/crop-plan-module/src/modules/crop-plan-module/api/PlotGroupApi.ts"],"names":["PlotGroupApi","http","this","pkCuaa","paging","get","params","offset","count","res","data","plot_group_id","plot_group_name","put","pk_cuaa","post","plotsIdToBeAdded","plotsIdToBeRemoved","delete","ssoFunction","result"],"mappings":"yMAIqBA,G,qBAIjB,WAAYC,GAAgB,uBACxBC,KAAKD,KAAOA,E,6GAGhB,WAAoBE,EAAgBC,GAApC,uGACsBF,KAAKD,KAAKI,IAAV,yDAAgEF,EAAhE,gBAAsF,CACpGG,OAAQ,CACJC,OAAQH,EAAOG,OACfC,MAAOJ,EAAOI,SAJ1B,cACUC,EADV,yBAQWA,EAAIC,MARf,gD,+IAWA,WAAmBC,GAAnB,uGACsBT,KAAKD,KAAKI,IAAV,4DAAmEM,IADzF,cACUF,EADV,yBAGWA,EAAIC,MAHf,gD,8IAMA,WAAoBC,EAAuBC,GAA3C,uGACsBV,KAAKD,KAAKY,IAAV,4DAAmEF,GAAiB,CAClGC,oBAFR,cACUH,EADV,yBAKWA,EAAIC,MALf,gD,kJAQA,WAAsBI,EAAiBF,GAAvC,uGACsBV,KAAKD,KAAKc,KAAV,yDAAiED,EAAjE,gBAAuF,CACrGF,oBAFR,cACUH,EADV,yBAKWA,EAAIC,MALf,gD,kJAQA,WAAsBC,EAAuBK,GAA7C,uGACsBd,KAAKD,KAAKc,KAAV,4DAAoEJ,EAApE,UAA2FK,GADjH,cACUP,EADV,yBAGWA,EAAIC,MAHf,gD,uJAMA,WAA2BC,EAAuBM,GAAlD,uGACsBf,KAAKD,KAAKiB,OAAV,4DAAsEP,EAAtE,UAA6F,CAACD,KAAMO,IAD1H,cACUR,EADV,yBAGWA,EAAIC,MAHf,gD,kJAMA,WAAsBC,GAAtB,uGACsBT,KAAKD,KAAKiB,OAAV,4DAAsEP,IAD5F,cACUF,EADV,yBAGWA,EAAIC,MAHf,gD,0IAMA,WAAgBS,GAAhB,uGACsBjB,KAAKD,KAAKI,IAAV,6EAAoFc,IAD1G,cACUV,EADV,yBAEWA,EAAIC,KAAKU,QAFpB,gD","file":"js/chunk-2d0af09a.ab49fbd7.js","sourcesContent":["import { PagingParams, PagedResults } from '@abaco/web-common/src/Paging';\nimport { HTTPClient } from '@abaco/web-common/src/HTTP';\nimport { PlotGroup } from '../models/PlotGroup';\n\nexport default class PlotGroupApi {\n\n private http: HTTPClient;\n\n constructor(http: HTTPClient) {\n this.http = http;\n }\n\n async getPlotGroups(pkCuaa: number, paging: PagingParams): Promise> {\n const res = await this.http.get(`/sitiagri-rest-api/api_basic/v1/plots/subjects/${pkCuaa}/plot_groups`, {\n params: {\n offset: paging.offset,\n count: paging.count\n }\n });\n\n return res.data;\n }\n\n async getPlotGroup(plot_group_id: number): Promise{\n const res = await this.http.get(`/sitiagri-rest-api/api_basic/v1/plots/plot_groups/${plot_group_id}`);\n\n return res.data;\n }\n\n async editPlotGroup(plot_group_id: number, plot_group_name: string): Promise{\n const res = await this.http.put(`/sitiagri-rest-api/api_basic/v1/plots/plot_groups/${plot_group_id}`, {\n plot_group_name\n });\n\n return res.data;\n }\n\n async createPlotGroup(pk_cuaa: number, plot_group_name: string): Promise{\n const res = await this.http.post(`/sitiagri-rest-api/api_basic/v1/plots/subjects/${pk_cuaa}/plot_groups`,{\n plot_group_name\n });\n\n return res.data;\n }\n\n async addPlotsToGroup(plot_group_id: number, plotsIdToBeAdded: {plot_id: number}[]): Promise<{plot_id: number}[]> {\n const res = await this.http.post(`/sitiagri-rest-api/api_basic/v1/plots/plot_groups/${plot_group_id}/plots`, plotsIdToBeAdded);\n\n return res.data;\n }\n\n async removePlotsFromGroup(plot_group_id: number, plotsIdToBeRemoved: {plot_id: number}[]): Promise<{plot_id: number}[]> {\n const res = await this.http.delete(`/sitiagri-rest-api/api_basic/v1/plots/plot_groups/${plot_group_id}/plots`, {data: plotsIdToBeRemoved});\n\n return res.data;\n }\n\n async deletePlotGroup(plot_group_id: number): Promise {\n const res = await this.http.delete(`/sitiagri-rest-api/api_basic/v1/plots/plot_groups/${plot_group_id}`);\n\n return res.data;\n }\n\n async getPermit(ssoFunction: string): Promise {\n const res = await this.http.get(`/sitiagri-rest-api/api_basic/v1/user_registry/sso_functions/SCHEDE/${ssoFunction}`);\n return res.data.result;\n }\n\n}\n"],"sourceRoot":""}