{"version":3,"file":"entity-VBrusOHG.js","sources":["../../../app/frontend/entrypoints/utils/entity.ts","../../../app/frontend/entrypoints/utils/erp.ts","../../../app/frontend/entrypoints/utils/timetrack.ts","../../../app/frontend/entrypoints/utils/wms.ts","../../../app/frontend/entrypoints/utils/licenses.ts","../../../app/frontend/entrypoints/utils/index.ts"],"sourcesContent":["import UtilsEntityView from \"./entityView\";\nimport Utils from \"./index\";\n\nexport default class UtilsEntity {\n static get view() {\n return UtilsEntityView\n }\n\n static async getAll(entity: string, parent_entity: any = null, filter = {}, params = {}) {\n await Utils.showLoader();\n let url = `/api/v1/${entity}/`\n if (parent_entity) {\n url = `/api/v1/${parent_entity}/${entity}/`\n }\n const r = await UtilsEntity.request(Utils.appendParamsToUrl(url, filter), 'GET')\n await Utils.hideLoader();\n return r;\n }\n\n static async getMultiple(ids: any[], entity: string) {\n let url = `/api/v1/${entity}/multiple`\n const r = await UtilsEntity.request(url, 'POST', {\n ids\n })\n return r;\n }\n\n static async find(entity: string, params = {}) {\n let url = `/api/v1/${entity}/find`\n const r = await UtilsEntity.request(url, 'POST', params)\n return r;\n }\n\n static async get(id: any, entity: string, parent_id = null, parent_entity = null, hide_loader = false) {\n if (!hide_loader) {\n await Utils.showLoader();\n }\n let url = `/api/v1/${entity}/${id}`\n if (parent_entity) {\n url = `/api/v1/${parent_entity}/${parent_id}/${entity}/${id}`\n }\n const r = await UtilsEntity.request(url, 'GET')\n if (!hide_loader) {\n await Utils.hideLoader();\n }\n return r;\n }\n\n static async destroy(id: any, entity: string, parent_id = null, parent_entity = null) {\n\n await Utils.showLoader();\n let url = `/api/v1/${entity}/${id}`\n if (parent_entity) {\n url = `/api/v1/${parent_entity}/${parent_id}/${entity}/${id}`\n }\n const r = await UtilsEntity.request(url, 'DELETE')\n await Utils.hideLoader();\n return r\n }\n\n static async destroyAll(ids: any, entity: string, parent_id = null, parent_entity = null) {\n\n await Utils.showLoader();\n let url = `/api/v1/${entity}/destroy_all`\n if (parent_entity) {\n url = `/api/v1/${parent_entity}/${parent_id}/${entity}/destroy_all`\n }\n const r = await UtilsEntity.request(url, 'POST', {ids})\n await Utils.hideLoader();\n return r\n }\n\n static async upsert(data: any, entity: string, parent_id = null, parent_entity = null) {\n let url = `/api/v1/${entity}`\n let method = 'POST'\n if (parent_entity) {\n url = `/api/v1/${parent_entity}/${parent_id}/${entity}`\n }\n if (data.uuid) {\n if (data.uuid instanceof Array) {\n url = `${url}/multiple`\n method = 'POST'\n } else {\n url = `${url}/${data.uuid}`\n method = 'PATCH'\n }\n }\n let body = {}\n if (data instanceof FormData) {\n body = data\n } else {\n //@ts-ignore\n body[entity] = data\n }\n return await UtilsEntity.request(url, method, body, data instanceof FormData)\n }\n\n\n static async request(url: string, method: string, body = {}, plaintext = false) {\n const init = {\n method: method,\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n }\n }\n if (method !== \"GET\" && method !== \"DELETE\") {\n if (!plaintext) {\n // @ts-ignore\n init.body = JSON.stringify(body)\n } else {\n // @ts-ignore\n init.body = body\n }\n }\n console.log(\"init.body\", init.body)\n const r = await fetch(url, init)\n return await r.json()\n }\n}","import UtilsEntityView from \"./entityView\";\nimport Utils from \"./index\";\n\nexport default class UtilsErp {\n\n static async multiMove(productId: string, elements: any, warehouseId: string, warehouseLocationId: string, warehousePalletId: string, customerId: string) {\n\n let url = `/api/v1/erp/actions/multi_move_products`\n const r = await UtilsErp.request(url, \"POST\", {\n productId, elements, warehouseId, warehouseLocationId, warehousePalletId, customerId\n }, false, false)\n return r\n }\n\n static async generateDocument(html: string) {\n let url = `/erp/documents/generate_document`\n const r = await UtilsErp.request(url, \"POST\", {\n html\n }, false, false)\n return r\n }\n\n static async generateDocumentWarehouse(itemConfig: any) {\n let url = `/api/v1/erp/actions/warehouse_by_document_config`\n const r = await UtilsErp.request(url, \"POST\", {\n item_config: itemConfig\n })\n return r\n }\n\n static async checkSerial(customerId: string, productId: string, serial: string) {\n let url = `/api/v1/erp/actions/check_serial`\n const r = await UtilsErp.request(url, \"POST\", {\n customerId, productId, serial\n })\n return r\n }\n\n\n static async productMappingsBySerial(customerId: string, productId: string, serial: string) {\n let url = `/api/v1/erp/actions/product_mappings_by_serial`\n const r = await UtilsErp.request(url, \"POST\", {\n productId, serial, customerId\n })\n return r\n }\n static async productMappingsFull() {\n let url = `/api/v1/erp/actions/full_stock`\n const r = await UtilsErp.request(url, \"POST\", {})\n return r\n }\n\n static async productMappingsByWarehouse(customerId: string, productId: string, warehouseId: string, warehouseLocationId: string, warehouseLocationPalletId: string) {\n let url = `/api/v1/erp/actions/product_mappings_by_warehouse`\n const r = await UtilsErp.request(url, \"POST\", {\n productId, warehouseId, warehouseLocationId, warehouseLocationPalletId, customerId\n })\n return r\n }\n\n static async stockInfo(productId: string) {\n let url = `/api/v1/erp/actions/stock_info`\n const r = await UtilsErp.request(url, \"POST\", {\n productId\n })\n return r\n }\n static async productMapById(productId: string, warehouseLocationId: string, warehouseLocationPalletId: string = \"\", customerId: string = \"\") {\n let url = `/api/v1/erp/actions/product_map_by_id`\n const r = await UtilsErp.request(url, \"POST\", {\n productId, customerId, warehouseLocationId, warehouseLocationPalletId\n })\n return r\n }\n static async addProducts(data: any) {\n let url = `/api/v1/erp/actions/add_products`\n const r = await UtilsErp.request(url, \"POST\", {\n ...data\n })\n return r\n }\n static async moveProducts(data: any) {\n let url = `/api/v1/erp/actions/products_move`\n const r = await UtilsErp.request(url, \"POST\", {\n ...data\n })\n return r\n }\n static async outputProducts(data: any) {\n let url = `/api/v1/erp/actions/products_output`\n const r = await UtilsErp.request(url, \"POST\", {\n ...data\n })\n return r\n }\n static async inputProducts(data: any) {\n let url = `/api/v1/erp/actions/products_input`\n const r = await UtilsErp.request(url, \"POST\", {\n ...data\n })\n return r\n }\n\n static async movePallet(palletId: any, warehouseId: any, warehouseLocationId: any) {\n let url = `/api/v1/erp/actions/move_pallet`\n const r = await UtilsErp.request(url, \"POST\", {\n palletId, warehouseId, warehouseLocationId\n })\n }\n static async productStock(customerId: string, productId: string) {\n let url = `/api/v1/erp/actions/product_stock?customer_id=${customerId}&product_id=${productId}`\n const r = await UtilsErp.request(url, \"GET\")\n return r;\n }\n static async initOrder() {\n let url = `/api/v1/erp/actions/order_init`\n const r = await UtilsErp.request(url, \"POST\")\n return r;\n }\n\n static async saveOrder(token: any) {\n let url = `/api/v1/erp/actions/order_save`\n const r = await UtilsErp.request(url, \"POST\", {\n token: token\n })\n return r;\n }\n\n static async customerOrder(customerId: any, addressId: any, token: any) {\n let url = `/api/v1/erp/actions/order_customer`\n const r = await UtilsErp.request(url, \"POST\", {\n customerId: customerId,\n addressId: addressId,\n token: token\n })\n }\n\n static async addPalletOrder(data: any, orderId = null) {\n let url = `/api/v1/erp/actions/order_add_pallet`\n const r = await UtilsErp.request(url, \"POST\", {\n warehouse_pallet_id: data,\n order_id: orderId\n })\n return r;\n }\n static async addLineItemOrder(data: any, customerId: any, token: any) {\n let url = `/api/v1/erp/actions/order_add_line_item`\n const r = await UtilsErp.request(url, \"POST\", {\n lineItem: data,\n token: token,\n customerId\n })\n return r;\n }\n static async removeLineItemOrder(data: any, token: any) {\n let url = `/api/v1/erp/actions/order_remove_line_item`\n const r = await UtilsErp.request(url, \"POST\", {\n lineItem: data,\n token: token\n })\n return r;\n }\n\n static async downloadLabel(id: any, entity: string) {\n await Utils.showLoader();\n let url = `/api/v1/erp/actions/create_labels`\n const r = await UtilsErp.request(url, 'POST', {\n entity: entity,\n ids: [id]\n })\n await Utils.hideLoader();\n return r;\n }\n\n static async saveSignature(id: string, documentUrl: string, image: string) {\n await Utils.showLoader();\n let url = `/api/v1/erp/actions/save_signature`\n const r = await UtilsErp.request(url, 'POST', {\n documentId: id,\n documentUrl,\n image\n })\n await Utils.hideLoader();\n return r;\n }\n\n\n static async request(url: string, method: string, body = {}, plaintext = false, json = true) {\n const init = {\n method: method,\n headers: {\n 'Content-Type': 'application/json'\n }\n }\n if (json) {\n // @ts-ignore\n init.headers['Accept'] = 'application/json';\n }\n if (method !== \"GET\" && method !== \"DELETE\") {\n if (!plaintext) {\n // @ts-ignore\n init.body = JSON.stringify(body)\n } else {\n // @ts-ignore\n init.body = body\n }\n }\n const r = await fetch(url, init)\n if (json) {\n return await r.json()\n } else {\n return await r.text()\n }\n }\n}","import Utils from \"./index\";\n\nexport default class UtilsTimeTrack {\n\n static updateLiveEdit(element: HTMLElement, data: any) {\n const parent = ((element.closest(\"ul\") as HTMLUListElement).closest(\"div\") as HTMLElement);\n (document.querySelector(\"#time_entry_committed_messages .backend_errors\") as HTMLElement).innerHTML = '';\n if (data.failed) {\n let failedHtml = '';\n for(const message of data.messages) {\n failedHtml += `
\n ${d.time ? `+${d.time} ${type}` : \"\"}\n
\n\n