{"version":3,"sources":["webpack:///./node_modules/@abaco/processes-module/src/modules/processes/api/ProcessApi.ts"],"names":["ProcessApi","http","normalHttp","rootPath","this","farm","filter","paging","order","filterArr","id","push","status","toUpperCase","subject","type","year","sector","sortStr","get","pk_cuaa","params","count","offset","length","undefined","sort","res","propsToDatePaged","data","records","map","app","last_update","last_transition_date","subject_id","subject_name","description","subject_frn","cuaa","process_id","application_id","status_ds","portal_status","process_type_id","module_id","process_type_ds","app_type_short_descr","process_type_category_ds","campaign","sector_subcode","processId","propsToDate","code","submission_date","full_name","vat_number","fiscal_code","process_code","application_code","residence_council","pkCuaa","totalcount","Error","secondLastEntry","processFilter","processTypes","r","date_from","date_to","app_type_long_descr","tempFormCategories","forEach","tempForm","form_ds","form_short_descr","form_id","url","detail_url","additional_params","editable","temp","find","fc","category_id","group_code","forms","category_ds","group_short_descr","statusList","some","s","status_group_descr","post","pollCreatedProcess","pollRes","outcomeRes","operation_result","split","parseInt","is_queued","sleep","ms","Promise","resolve","setTimeout","ssoFunction","result"],"mappings":"mUASqBA,E,WAMjB,WAAYC,EAAkBC,EAAwBC,GAAgB,uBAClEC,KAAKH,KAAOA,EACZG,KAAKF,WAAaA,EAClBE,KAAKD,SAAWA,E,4GAGpB,WAAmBE,EAAYC,EAA8BC,EAAsBC,GAAnF,oGACUC,EAAY,GACdH,IACIA,EAAOI,IAAID,EAAUE,KAAV,4BAAoCL,EAAOI,KACtDJ,EAAOM,QAAQH,EAAUE,KAAV,6BAAqCL,EAAOM,OAAOC,gBAClEP,EAAOQ,SAASL,EAAUE,KAAV,4BAAoCL,EAAOQ,QAAQD,gBACnEP,EAAOS,MAAMN,EAAUE,KAAV,oCAA4CL,EAAOS,KAAKF,gBACrEP,EAAOU,MAAMP,EAAUE,KAAV,sBAA8BL,EAAOU,OAClDV,EAAOW,QAAQR,EAAUE,KAAV,4BAAoCL,EAAOW,UAE9DC,EAAyB,KACzBV,IACAU,EAAUV,GAZlB,SAcsBJ,KAAKH,KAAKkB,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+C0D,EAA/C,kBAA+DjB,EAA/D,yBAJrB,OAIQjB,EAJR,OAI4HE,KAJ5H,gDAMWF,GANX,iD,wIASQ,WAAY2E,GAAZ,0GACG,IAAIC,SAAQ,SAACC,GAAD,OAAaC,WAAWD,EAASF,OADhD,2C,iJAIR,WAAuBI,GAAvB,uGACsBtG,KAAKF,WAAWiB,IAAhB,8EAA2FuF,IADjH,cACU/E,EADV,yBAEWA,EAAIE,KAAK8E,QAFpB,gD","file":"js/chunk-2d2082aa.21449d5a.js","sourcesContent":["import { Anomaly } from '../models/Anomalies';\nimport { Form, FormCategory, FormIn } from '../models/Forms';\nimport { Print, PrintTypeUI } from '../models/Prints';\nimport { BaseProcess, ProcessFilter, ProcessHistory, ProcessIn, ProcessTypeIn, Status, QueueResult, ProcessType, SectorType } from '../models/Processes';\nimport { Farm } from '@abaco/farm-registry/src/modules/farm-registry/models/Farm';\nimport SSOModule from '@abaco/sso-web-module/src/abaco-module';\nimport { HTTPClient, propsToDate, propsToDatePaged } from '@abaco/web-common/src/HTTP';\nimport { PagedResults, PagingParams } from '@abaco/web-common/src/Paging';\n\nexport default class ProcessApi {\n\n private http: HTTPClient;\n private normalHttp: HTTPClient;\n private rootPath: string;\n\n constructor(http: HTTPClient, normalHttp: HTTPClient, rootPath: string) {\n this.http = http;\n this.normalHttp = normalHttp;\n this.rootPath = rootPath\n }\n\n async getProcesses(farm: Farm, filter: ProcessFilter | null, paging: PagingParams, order?: string | null): Promise> {\n const filterArr = [];\n if (filter) {\n if (filter.id) filterArr.push(`application_id eq ${filter.id}`);\n if (filter.status) filterArr.push(`portal_status like ${filter.status.toUpperCase()}`);\n if (filter.subject) filterArr.push(`subject_name like ${filter.subject.toUpperCase()}`);\n if (filter.type) filterArr.push(`app_type_short_descr like ${filter.type.toUpperCase()}`);\n if (filter.year) filterArr.push(`campaign eq ${filter.year}`);\n if (filter.sector) filterArr.push(`sector_subcode eq ${filter.sector}`)\n }\n let sortStr: string | null = null;\n if (order) {\n sortStr = order;\n }\n const res = await this.http.get(`${this.rootPath}/applications/${farm.pk_cuaa}/applications`, {\n params: {\n count: paging.count,\n offset: paging.offset,\n filter: filterArr.length > 0 ? filterArr : undefined,\n sort: sortStr ? sortStr : undefined,\n }\n });\n\n propsToDatePaged(res.data, [\"last_transition_date\"]);\n\n res.data.records = res.data.records?.map((app: ProcessIn) => ({\n last_update: app.last_transition_date as Date,\n subject_id: farm.pk_cuaa,\n subject_name: farm.description,\n subject_frn: farm.cuaa,\n process_id: app.application_id,\n status_ds: app.portal_status,\n process_type_id: app.module_id,\n process_type_ds: app.app_type_short_descr,\n process_type_category_ds: app.sector,\n year: app.campaign,\n })) || []\n return res.data;\n\n // TODO da aggiungere:\n // submitted_date: new Date(),\n }\n\n async getSectorTypes(farm: Farm, filter: string | null, paging: PagingParams): Promise> {\n return (await this.http.get(`${this.rootPath}/applications/${farm.pk_cuaa}/sector_types`, {\n params: {\n count: paging.count,\n offset: paging.offset\n }\n })).data;\n }\n\n async getSectorDecoding(farm: Farm, sector_subcode: string): Promise {\n const res = (await this.http.get(`${this.rootPath}/applications/${farm.pk_cuaa}/sector_types`, {\n params: {\n count: 1,\n offset: 0,\n filter: `sotto_codice eq ${sector_subcode}`\n }\n })).data;\n if(res.records.length){\n return res.records[0];\n }\n return null\n }\n\n async getProcess(farm: Farm, processId: number): Promise {\n const res = await this.http.get(`${this.rootPath}/applications/${farm.pk_cuaa}/applications/${processId}`);\n\n propsToDate(res.data, [\"last_transition_date\"]);\n res.data = res.data.map((app: ProcessIn) => ({\n last_update: app.last_transition_date as Date,\n subject_id: farm.pk_cuaa,\n subject_name: farm.description,\n subject_frn: farm.cuaa,\n process_id: app.application_id,\n status_ds: app.portal_status,\n process_type_id: app.module_id,\n process_type_ds: app.app_type_short_descr,\n process_type_category_ds: app.sector,\n year: app.campaign,\n })) || null\n return res.data;\n // TODO da aggiungere:\n // submitted_date: new Date(),\n }\n\n async getInspectionProcesses(filter: ProcessFilter | null, paging: PagingParams, order?: string | null): Promise> {\n\n const filterArr = [];\n if (filter) {\n if (filter.code) filterArr.push(`application_code eq ${filter.code}`);\n if (filter.status) filterArr.push(`portal_status like ${filter.status.toUpperCase()}`);\n if (filter.subject) filterArr.push(`full_name like ${filter.subject.toUpperCase()}`);\n if (filter.type) filterArr.push(`app_type_short_descr like ${filter.type.toUpperCase()}`);\n if (filter.year) filterArr.push(`campaign eq ${filter.year}`);\n }\n let sortStr: string | null = null;\n if (order) {\n sortStr = order;\n }\n\n const res = await this.http.get(`${this.rootPath}/applications/inspections`, {\n params: {\n count: paging.count,\n offset: paging.offset,\n filter: filterArr.length > 0 ? filterArr : undefined,\n sort: sortStr ? sortStr : undefined,\n }\n });\n\n propsToDatePaged(res.data, [\"last_transition_date\"]);\n\n res.data.records = res.data.records?.map((app: ProcessIn) => ({\n last_update: app.last_transition_date as Date,\n submission_date: app.submission_date as Date,\n subject_id: app.subject_id,\n subject_name: app.full_name,\n subject_frn: app.vat_number || app.fiscal_code,\n process_id: app.application_id,\n process_code: app.application_code,\n status_ds: app.portal_status,\n process_type_id: app.module_id,\n process_type_ds: app.app_type_short_descr,\n process_type_category_ds: app.sector,\n year: app.campaign,\n residence_council: app.residence_council\n })) || [];\n return res.data;\n\n // TODO da aggiungere:\n // submitted_date: new Date(),\n }\n\n async getSecondLastEntryProcessHistory(pkCuaa: number, application_id: number): Promise {\n const res = await this.http.get(`${this.rootPath}/applications/${pkCuaa}/applications/${application_id}/history`, {\n params: {\n count: 2,\n offset: 0,\n sort: \"-dt_insert\"\n }\n })\n\n if (res.data.totalcount === 0) {\n throw new Error(\"There is no history yet\");\n }\n let secondLastEntry = res.data.records[0];\n if (res.data.totalcount > 1) {\n secondLastEntry = res.data.records[1];\n }\n propsToDate(secondLastEntry, [\"dt_insert\", \"dt_delete\", \"dt_inizio\", \"dt_fine\", \"dt_ultimo_agg\"])\n\n return secondLastEntry;\n }\n\n async getProcessHistory(pkCuaa: number, application_id: number, paging: PagingParams): Promise> {\n const res = await this.http.get(`${this.rootPath}/applications/${pkCuaa}/appplications/${application_id}/history`, {\n params: {\n count: paging.count,\n offset: paging.offset\n }\n })\n\n return res.data;\n }\n\n async getProcessType(pkCuaa: number, campaign: number, process_type_id: number): Promise {\n const res = await this.http.get(`${this.rootPath}/applications/${pkCuaa}/types`, {\n params: {\n count: 1,\n offset: 0,\n campaign: campaign,\n filter: `module_id eq ${process_type_id}`\n }\n });\n\n return res.data.records?.length ? res.data.records[0] : null;\n }\n\n async getProcessTypesList(pkCuaa: number, campaign: number, paging: PagingParams, processFilter?: ProcessFilter): Promise> {\n const filterArr = [];\n if (processFilter)\n if (processFilter.sector) filterArr.push(`sector_subcode eq ${processFilter.sector}`)\n\n const res = await this.http.get(`${this.rootPath}/applications/${pkCuaa}/types?filter=is_open eq S`, {\n params: {\n count: paging.count,\n offset: paging.offset,\n campaign: campaign,\n filter: filterArr.length > 0 ? filterArr : undefined,\n }\n });\n if(!res.data.records){\n res.data.records = [];\n }\n propsToDatePaged(res.data, [\"date_from\", \"date_to\"]);\n\n const processTypes: PagedResults = res.data;\n\n processTypes.records = res.data.records?.map((r: ProcessTypeIn) => (\n {\n date_from: r.date_from,\n date_to: r.date_to,\n year: campaign,\n process_type_ds: r.app_type_long_descr,\n process_type_id: r.module_id\n }\n )) || [];\n\n return processTypes;\n }\n\n async getProcessForms(pkCuaa: number, process_id: number): Promise {\n const res = await this.http.get(`${this.rootPath}/applications/${pkCuaa}/applications/${process_id}/forms`, {\n params: {\n count: 300,\n offset: 0,\n }\n });\n const tempFormCategories: FormCategory[] = [];\n res.data.records?.forEach((r: FormIn) => {\n const tempForm: Form = {\n form_ds: r.form_short_descr,\n form_id: r.form_id,\n url: r.detail_url,\n additional_params: r.additional_params,\n editable: r.editable\n };\n const temp = tempFormCategories.find(fc => fc.category_id === r.group_code)\n if (temp) {\n temp.forms.push(tempForm)\n } else {\n tempFormCategories.push({\n category_ds: r.group_short_descr,\n category_id: r.group_code,\n forms: [tempForm]\n })\n }\n })\n return tempFormCategories;\n }\n\n async getStatusList(pkCuaa: number, process_type_id: number): Promise {\n const res = await this.http.get(`${this.rootPath}/applications/${pkCuaa}/types/${process_type_id}/statuslist`, {\n params: {\n offset: 0,\n count: 300,\n }\n })\n\n const statusList: Status[] = [];\n res.data.records?.forEach((r: Status) => {\n if (!statusList.some(s => s.status_group_descr === r.status_group_descr)) {\n statusList.push(r)\n }\n });\n\n return statusList;\n }\n\n async getProcessAnomalies(pkCuaa: number, campaign: number, processId: number): Promise {\n const res = await this.http.get(`${this.rootPath}/subjects/${pkCuaa}/processes/${processId}/anomalies`);\n return res.data;\n // let res: Anomaly[] = [];\n // let el: Anomaly = { anomaly_id: 0, anomaly_ds: \"Option code GS2 on Parcel SP6792 3361 does not have a valid Approved Quantity\", anomaly_type: \"error\" }; res.push(el);\n // el = { anomaly_id: 1, anomaly_ds: \"This contract contains a parcel SK3559 0684 that is currently included in another application\", anomaly_type: \"error\" }; res.push(el);\n // el = { anomaly_id: 2, anomaly_ds: \"This contract contains a parcel BR6728 1243 that is currently included in another application\", anomaly_type: \"error\" }; res.push(el);\n // el = { anomaly_id: 3, anomaly_ds: \"One or more of the amended commitments has an option compatibility or exists in another agreement anomaly\", anomaly_type: \"warning\" }; res.push(el);\n // el = { anomaly_id: 4, anomaly_ds: \"Amend commitments incomplete, please ensure all amendments and mismatch review for each amended commitment is completed\", anomaly_type: \"warning\" }; res.push(el);\n // return res;\n }\n\n async createProcess(pkCuaa: number, process_type_id: number): Promise {\n await this.http.post(`${this.rootPath}/applications/${pkCuaa}/types/${process_type_id}`);\n\n const pollRes = await this.pollCreatedProcess(pkCuaa, process_type_id)\n\n const outcomeRes = pollRes.operation_result.split(\"|\");\n return parseInt(outcomeRes[0]) >= 0;\n }\n\n async pollCreatedProcess(pkCuaa: number, process_type_id: number): Promise {\n let res: QueueResult = (await this.http.get(`${this.rootPath}/applications/${pkCuaa}/types/${process_type_id}/create_queue_status`)).data;\n while (res.is_queued) {\n await this.sleep(1000);\n res = (await this.http.get(`${this.rootPath}/applications/${pkCuaa}/types/${process_type_id}/create_queue_status`)).data;\n }\n return res;\n }\n\n private async sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n async getProcessPermit(ssoFunction: string): Promise {\n const res = await this.normalHttp.get(`/sitiagri-rest-api/api_basic/v1/user_registry/sso_functions/DOMANDE/${ssoFunction}`);\n return res.data.result;\n }\n\n}\n"],"sourceRoot":""}