{"version":3,"sources":["webpack:///./node_modules/@abaco/grapes-dashboard-module/src/modules/grapes-dashboard-module/models/Shortcut.ts","webpack:///./node_modules/@abaco/grapes-dashboard-module/src/modules/grapes-dashboard-module/api/ShortcutsApi.ts"],"names":["toShortcut","e","category","id","description","icon","enabled","order","ord","ShortcutsApi","http","this","get","params","sort","res","shortcuts","data","forEach","items","length","push","e1","a","b","shortcutId","delete","post"],"mappings":"+OAiBM,SAAUA,EAAWC,EAAgBC,GACvC,MAAO,CACHA,SAAUA,EACVC,GAAIF,EAAEE,GACNC,YAAaH,EAAEE,GACfE,KAAM,KACNC,QAASL,EAAEK,QACXC,MAAON,EAAEO,K,ICpBIC,E,WAIjB,WAAYC,GAAgB,uBACxBC,KAAKD,KAAOA,E,4GAGT,sHACeC,KAAKD,KAAKE,IAAV,oEAAmF,CACjGC,OAAQ,CACJC,KAAM,iBAHX,cACGC,EADH,OAMGC,EAAwB,GAC9BD,EAAIE,KAAKC,SAAQ,SAACjB,GACG,OAAdA,EAAEK,SAAuC,IAAnBL,EAAEkB,MAAMC,QAC7BJ,EAAUK,KAAKrB,EAAWC,EAAG,OAEjCA,EAAEkB,MAAMD,SAAQ,SAACI,GACbN,EAAUK,KAAKrB,EAAWsB,EAAIrB,EAAEE,WAGxCa,EAAUF,MAAK,SAAUS,EAAaC,GAClC,OAAQD,EAAEpB,GAAKqB,EAAErB,IAAO,EAAKoB,EAAEpB,GAAKqB,EAAErB,GAAM,EAAI,KAhBjD,kBAkBIa,GAlBJ,gD,8IAqBA,WAAqBS,GAArB,uGACed,KAAKD,KAAKgB,OAAV,kEAA4ED,IAD3F,cACGV,EADH,yBAEIA,EAAIE,MAFR,gD,4IAKA,WAAkBQ,GAAlB,uGACed,KAAKD,KAAKiB,KAAV,0DAA0E,CACxFxB,GAAIsB,IAFL,cACGV,EADH,yBAIIA,EAAIE,MAJR,gD","file":"js/chunk-2d20971e.39452a78.js","sourcesContent":["\nexport interface Shortcut {\n category: string | null;\n id: string;\n description: string;\n icon: string | null;\n enabled: boolean | null;\n order: number;\n}\n\nexport interface ShortcutRaw {\n enabled: boolean | null;\n id: string;\n items: ShortcutRaw[];\n ord: number;\n}\n\nexport function toShortcut(e: ShortcutRaw, category: string | null): Shortcut {\n return {\n category: category,\n id: e.id,\n description: e.id,\n icon: null,\n enabled: e.enabled,\n order: e.ord,\n }\n}\n\nexport interface ShortcutUI extends Shortcut{\n readonly: boolean;\n uncheck: number | null;\n}\n","import { HTTPClient, propsToDate, propsToDatePaged } from \"@abaco/web-common/src/HTTP\";\nimport { dbGIStoStandardPage, PagedResults, PagingParams } from \"@abaco/web-common/src/Paging\";\nimport { Shortcut, ShortcutRaw, toShortcut } from \"../models/Shortcut\";\n\nexport default class ShortcutsApi {\n\n private http: HTTPClient;\n\n constructor(http: HTTPClient) {\n this.http = http;\n }\n\n public async getShortcuts(): Promise {\n const res = await this.http.get(`/sitiagri-rest-api/api_basic/v1/user_registry/hierarchy_shortcuts`, {\n params: {\n sort: \"description\",\n }\n });\n const shortcuts: Shortcut[] = [];\n res.data.forEach((e: ShortcutRaw) => {\n if(e.enabled !== null && e.items.length === 0){\n shortcuts.push(toShortcut(e, null));\n }\n e.items.forEach((e1: ShortcutRaw) => {\n shortcuts.push(toShortcut(e1, e.id));\n });\n });\n shortcuts.sort(function (a: Shortcut, b: Shortcut) {\n return (a.id < b.id) ? -1 : (a.id > b.id) ? 1 : 0;\n });\n return shortcuts;\n }\n\n public async removeShortcut(shortcutId: string): Promise {\n const res = await this.http.delete(`/sitiagri-rest-api/api_basic/v1/user_registry/shortcuts/${shortcutId}`);\n return res.data;\n }\n\n public async addShortcut(shortcutId: string): Promise {\n const res = await this.http.post(`/sitiagri-rest-api/api_basic/v1/user_registry/shortcuts`, {\n id: shortcutId\n });\n return res.data;\n }\n\n\n}\n"],"sourceRoot":""}