implemented poi and mvi
This commit is contained in:
@ -8,8 +8,8 @@ let selectedMITsByMVT = [];
|
||||
let selectedMITsByState = [];
|
||||
let selectedMITsByUser = [];
|
||||
let selectedMITsByCustomer = [];
|
||||
let mitTodosByTemplateId = [];
|
||||
let mit = [];
|
||||
let mviTodosByTemplateId = [];
|
||||
let mvi = [];
|
||||
let insertId = -1;
|
||||
let errorMsg = '';
|
||||
|
||||
@ -55,11 +55,11 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.path.startsWith("/api/addMVTasd")) {
|
||||
if (event.path.startsWith("/api/addMVI")) {
|
||||
const body = await readBody(event)
|
||||
// add the mvt in the backend
|
||||
// add the mvi in the backend
|
||||
try {
|
||||
let res = await axiosInstance.post(`https://${serversideConfig.url}:${serversideConfig.port}/masterMaintenanceVisits`, body);
|
||||
let res = await axiosInstance.post(`https://${serversideConfig.url}:${serversideConfig.port}/maintenanceVisit`, body);
|
||||
insertId = res.data.insertId
|
||||
} catch (err) {
|
||||
if (axios.isAxiosError(err)) {
|
||||
@ -84,11 +84,11 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.path.startsWith("/api/addTodoMVTasd")) {
|
||||
if (event.path.startsWith("/api/addTodoMVI")) {
|
||||
const body = await readBody(event)
|
||||
// add the mvt todo in the backend
|
||||
// add the mvi todo in the backend
|
||||
try {
|
||||
let res = await axiosInstance.post(`https://${serversideConfig.url}:${serversideConfig.port}/masterMaintenanceVisitTodos`, body);
|
||||
let res = await axiosInstance.post(`https://${serversideConfig.url}:${serversideConfig.port}/maintenanceVisitTodos`, body);
|
||||
} catch (err) {
|
||||
if (axios.isAxiosError(err)) {
|
||||
const axiosError = err as AxiosError;
|
||||
@ -305,15 +305,15 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.path.startsWith("/api/deleteMaintenanceVisitTemplateasd")) {
|
||||
let mvtId = null;
|
||||
if (event.path.startsWith("/api/deleteMaintenanceVisitInstance")) {
|
||||
let mviId = null;
|
||||
const path = event._path;
|
||||
const pathSegments = path.split('/');
|
||||
mvtId = pathSegments[pathSegments.length - 1];
|
||||
mviId = pathSegments[pathSegments.length - 1];
|
||||
|
||||
// delete the mvt in the backend
|
||||
try {
|
||||
let res = await axiosInstance.delete(`https://${serversideConfig.url}:${serversideConfig.port}/masterMaintenanceVisits/${mvtId}`);
|
||||
let res = await axiosInstance.delete(`https://${serversideConfig.url}:${serversideConfig.port}/maintenanceVisit/${mviId}`);
|
||||
} catch (err) {
|
||||
if (axios.isAxiosError(err)) {
|
||||
const axiosError = err as AxiosError;
|
||||
@ -337,16 +337,16 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.path.startsWith("/api/getTodosMaintenanceVisitTemplateasd")) {
|
||||
// get maintenance visit template todos object from backend
|
||||
if (event.path.startsWith("/api/getTodosMaintenanceVisitInstance")) {
|
||||
// get maintenance visit instance todos object from backend
|
||||
let itemId = null;
|
||||
const path = event._path;
|
||||
const pathSegments = path.split('/');
|
||||
itemId = pathSegments[pathSegments.length - 1];
|
||||
|
||||
try {
|
||||
let res = await axiosInstance.get(`https://${serversideConfig.url}:${serversideConfig.port}/masterMaintenanceVisitTodos/${itemId}`);
|
||||
mitTodosByTemplateId = res.data;
|
||||
let res = await axiosInstance.get(`https://${serversideConfig.url}:${serversideConfig.port}/maintenanceVisitTodosByTemplateId/${itemId}`);
|
||||
mviTodosByTemplateId = res.data;
|
||||
} catch (err) {
|
||||
if (axios.isAxiosError(err)) {
|
||||
const axiosError = err as AxiosError;
|
||||
@ -369,15 +369,15 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.path.startsWith("/api/deleteTodosMVTasd")) {
|
||||
let mvtId = null;
|
||||
if (event.path.startsWith("/api/deleteTodosMVI")) {
|
||||
let mviId = null;
|
||||
const path = event._path;
|
||||
const pathSegments = path.split('/');
|
||||
mvtId = pathSegments[pathSegments.length - 1];
|
||||
mviId = pathSegments[pathSegments.length - 1];
|
||||
|
||||
// delete the mvt todos in the backend
|
||||
// delete the mv todos in the backend
|
||||
try {
|
||||
let res = await axiosInstance.delete(`https://${serversideConfig.url}:${serversideConfig.port}/masterMaintenanceVisitTodosByTemplateid/${mvtId}`);
|
||||
let res = await axiosInstance.delete(`https://${serversideConfig.url}:${serversideConfig.port}/maintenanceVisitTodosByTemplateID/${mviId}`);
|
||||
} catch (err) {
|
||||
if (axios.isAxiosError(err)) {
|
||||
const axiosError = err as AxiosError;
|
||||
@ -401,11 +401,11 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.path.startsWith("/api/updateMaintenanceVisitTemplateasd")) {
|
||||
if (event.path.startsWith("/api/updateMaintenanceVisitInstance")) {
|
||||
const body = await readBody(event)
|
||||
// update the maintenance visit template in the backend
|
||||
// update the maintenance visit instance in the backend
|
||||
try {
|
||||
let res = await axiosInstance.put(`https://${serversideConfig.url}:${serversideConfig.port}/masterMaintenanceVisits`, body);
|
||||
let res = await axiosInstance.put(`https://${serversideConfig.url}:${serversideConfig.port}/maintenanceVisit`, body);
|
||||
} catch (err) {
|
||||
if (axios.isAxiosError(err)) {
|
||||
const axiosError = err as AxiosError;
|
||||
@ -429,16 +429,16 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.path.startsWith("/api/getMaintenanceVisitTemplateasd")) {
|
||||
// get maintenance visit template object from backend
|
||||
let mvtId = null;
|
||||
if (event.path.startsWith("/api/getMaintenanceVisitInstance")) {
|
||||
// get maintenance visit instance object from backend
|
||||
let mviId = null;
|
||||
const path = event._path;
|
||||
const pathSegments = path.split('/');
|
||||
mvtId = pathSegments[pathSegments.length - 1];
|
||||
mviId = pathSegments[pathSegments.length - 1];
|
||||
|
||||
try {
|
||||
let res = await axiosInstance.get(`https://${serversideConfig.url}:${serversideConfig.port}/masterMaintenanceVisit/${mvtId}`);
|
||||
mit = res.data;
|
||||
let res = await axiosInstance.get(`https://${serversideConfig.url}:${serversideConfig.port}/maintenanceVisit/${mviId}`);
|
||||
mvi = res.data;
|
||||
} catch (err) {
|
||||
if (axios.isAxiosError(err)) {
|
||||
const axiosError = err as AxiosError;
|
||||
@ -461,11 +461,11 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.path.startsWith("/api/updateMVTTodoasd")) {
|
||||
if (event.path.startsWith("/api/updateMVITodo")) {
|
||||
const body = await readBody(event)
|
||||
// update the maintenance visit template todo in the backend
|
||||
// update the maintenance visit instance todo in the backend
|
||||
try {
|
||||
let res = await axiosInstance.put(`https://${serversideConfig.url}:${serversideConfig.port}/masterMaintenanceVisitTodos`, body);
|
||||
let res = await axiosInstance.put(`https://${serversideConfig.url}:${serversideConfig.port}/maintenanceVisitTodos`, body);
|
||||
} catch (err) {
|
||||
if (axios.isAxiosError(err)) {
|
||||
const axiosError = err as AxiosError;
|
||||
@ -490,14 +490,14 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
|
||||
if (event.path.startsWith("/api/deleteMVTTodoasd")) {
|
||||
let mvtId = null;
|
||||
let mviId = null;
|
||||
const path = event._path;
|
||||
const pathSegments = path.split('/');
|
||||
mvtId = pathSegments[pathSegments.length - 1];
|
||||
mviId = pathSegments[pathSegments.length - 1];
|
||||
|
||||
// delete the mvt in the backend
|
||||
try {
|
||||
let res = await axiosInstance.delete(`https://${serversideConfig.url}:${serversideConfig.port}/masterMaintenanceVisitTodos/${mvtId}`);
|
||||
let res = await axiosInstance.delete(`https://${serversideConfig.url}:${serversideConfig.port}/masterMaintenanceVisitTodos/${mviId}`);
|
||||
} catch (err) {
|
||||
if (axios.isAxiosError(err)) {
|
||||
const axiosError = err as AxiosError;
|
||||
@ -522,4 +522,4 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
})
|
||||
|
||||
export { maintenanceVisitInstances, selectedMITsByState, selectedMITsByUser, selectedMITsByMVT, selectedMITsByMIT, selectedMITsByCustomer, mitTodosByTemplateId, mit, insertId, errorMsg };
|
||||
export { maintenanceVisitInstances, selectedMITsByState, selectedMITsByUser, selectedMITsByMVT, selectedMITsByMIT, selectedMITsByCustomer, mviTodosByTemplateId, mvi, insertId, errorMsg };
|
||||
Reference in New Issue
Block a user