Creation date:
-
...
+
...
Completion date:
-
...
+
...
Time spent:
@@ -197,15 +202,12 @@
-
@@ -226,14 +228,16 @@ const deleteBool = computed(() => store.state.deleteBool);
const addBool = computed(() => store.state.new);
const darkMode = ref('');
+const potSelected = ref('');
const poi = ref({});
+const pot = ref({});
const customers = ref([]);
-const customer = ref({});
-const productionOrderInstances = ref([]);
const assets = ref([]);
const newName = ref('');
+const newTemplateID = ref('');
+const chosenTemplate = ref('');
const newCustomerID = ref('');
const newCustomer = ref('');
const newUser = ref('');
@@ -242,8 +246,12 @@ const newNotes = ref('');
const newTemplateDescription = ref('');
const newTemplateNotes = ref('');
const newAsset = ref('');
+const newCreationDate = ref('');
const newCompletionDate = ref('');
const newTimeSpent = ref('');
+const productionOrderInstances = ref([]);
+const productionOrderTemplates = ref([]);
+const userList = ref([]);
//get all customers
const getCustomers = async () => {
@@ -256,6 +264,57 @@ const getCustomers = async () => {
}
}
+//get all productionOrder templates
+const getProductionOrderTemplates = async () => {
+ try {
+ const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getAllProductionOrderTemplates`);
+ productionOrderTemplates.value = response.data;
+ } catch (err) {
+ console.log(err.response.statusText);
+ }
+}
+
+// get production order template from id
+const getPOTById = async () => {
+ if (chosenPOTId.value == '-1') {
+ potSelected.value = false;
+ await getProductionOrderTemplates();
+ } else {
+ potSelected.value = true;
+ try {
+ const response = await Axios.get(
+ `https://${clientsideConfig.url}:${clientsideConfig.port}/api/getProductionOrderTemplate/${chosenPOTId.value}`
+ );
+ pot.value = response.data;
+ poi.value.customer = pot.value.customer;
+ poi.value.customerID = pot.value.customerID;
+ newCustomer.value = pot.value.customer;
+ newCustomerID.value = pot.value.customerID;
+ await getConfigItemsFromCustomer();
+ } catch (err) {
+ console.log(err.response.statusText);
+ }
+ }
+ await getProductionOrderInstances();
+}
+
+// get production order template from id
+const getChosenPOTById = async (newPotId) => {
+ try {
+ const response = await Axios.get(
+ `https://${clientsideConfig.url}:${clientsideConfig.port}/api/getProductionOrderTemplate/${newPotId}`
+ );
+ pot.value = response.data;
+ poi.value.customer = pot.value.customer;
+ poi.value.customerID = pot.value.customerID;
+ newCustomer.value = pot.value.customer;
+ newCustomerID.value = pot.value.customerID;
+ await getConfigItemsFromCustomer();
+ } catch (err) {
+ console.log(err.response.statusText);
+ }
+}
+
const confirmDeletePOI = async () => {
if (deleteBool.value === true) {
if (confirm("Do you really want to delete this production order instance? It cannot be undone!")) {
@@ -271,18 +330,19 @@ const confirmDeletePOI = async () => {
}
store.commit('undoDelete');
store.commit('resetStore');
- store.commit('changeToTemplatelist');
+ store.commit('changeToInstancelist');
+ store.commit('seeAllIcon');
} else {
store.commit('undoDelete');
}
}
}
-//get all productionOrder instances
-const getProductionOrderInstances = async () => {
+//get all users
+const getUsers = async () => {
try {
- const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getAllProductionOrderInstances`);
- productionOrderInstances.value = response.data;
+ const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getAllEmployees`);
+ userList.value = response.data;
} catch (err) {
console.log(err.response.statusText);
}
@@ -333,98 +393,60 @@ const updatePOI = async () => {
}
}
-// add new production order instance
-const addPOI = async () => {
- // check if all input data is valid
- if (newName.value.trim() === "") {
- alert("Please add a production order instance name!");
- return;
- } else {
- var counter = 0;
- if (!(productionOrderInstances.value.length == null)) {
- // check if production order instance name already exists
- productionOrderInstances.value.forEach(p => {
- if (p.name === newName.value) {
- counter += 1;
- }
- });
- if (counter == 1) {
- alert("This production order instance name already exists. Please choose an unique production order instance name or modify respectively delete the old one!");
- return;
- }
- }
- }
- if (newCustomer.value.length === 0) {
- alert("Please choose a customer!");
- return;
- }
- // get the time and date
- const today = new Date();
- const date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
- const time = today.getHours() + ":" + today.getMinutes();
- const dateTime = date + ' ' + time;
- // add todos
- // let allFine = true;
- // newTodos.forEach(todo => {
- // if (todo.asset.length === 0) {
- // alert(`Please choose a config item for all todos.`);
- // allFine = false
- // }
- // })
- // if (!allFine) {
- // return
- // }
+//get all productionOrder instances
+const getProductionOrderInstances = async () => {
try {
- const response = await Axios.post(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/addPOI`,
- {
- name: newName.value,
- templateID: chosenPOTId.value,
- customerID: newCustomerID.value,
- customer: newCustomer.value,
- asset: newAsset.value,
- state: newState.value,
- creationDate: dateTime,
- completionDate: newCompletionDate.value,
- user: newUser.value,
- templateDescription: newTemplateDescription.value,
- templateNotes: newTemplateNotes.value,
- timeSpent: newTimeSpent.value,
- notes: newNotes.value,
- });
- store.commit('resetStore');
- store.commit('changeToTemplatelist');
- // newTodos.forEach(async todo => {
- // try {
- // const res = await Axios.post(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/addTodoPOT`,
- // {
- // templateID: response.data,
- // rowID: todo.rowID,
- // asset: todo.asset,
- // task: todo.task,
- // comment: todo.comments,
- // });
- // } catch (err) {
- // console.log(err.response.statusText);
- // }
- // })
- } catch (err) {
- // console.log(err.response.statusText);
- console.log(err);
- }
-}
-
-// update customerid if customer was changed
-const updateCustomerID = async () => {
- try {
- const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getCustomerByName/${poi.value.customer}`);
- customer.value = response.data;
- poi.value.customerID = customer.value.customerID;
- store.commit('toggleCustomerChanged');
- store.commit('toggleCustomerId', poi.value.customerID);
+ const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getAllProductionOrderInstances`);
+ productionOrderInstances.value = response.data;
} catch (err) {
console.log(err.response.statusText);
}
- await updatePOI();
+}
+
+// update production order instance fields in the store
+const updateProductionOrderInstance = async (newPotId = -1) => {
+ let productionOrderInstance = {};
+ if (potSelected.value) {
+ productionOrderInstance = {
+ name: newName.value,
+ templateID: chosenPOTId.value,
+ customerID: newCustomerID.value,
+ customer: newCustomer.value,
+ asset: newAsset.value,
+ state: newState.value,
+ creationDate: newCreationDate.value,
+ completionDate: newCompletionDate.value,
+ user: newUser.value,
+ templateDescription: newTemplateDescription.value,
+ templateNotes: newTemplateNotes.value,
+ timeSpent: newTimeSpent.value,
+ notes: newNotes.value,
+ };
+ } else {
+ if (!(newPotId == '-1')) {
+ // Find the object with the selected Name
+ const selectedObject = productionOrderTemplates.value.find(obj => obj.name === newPotId);
+ // Get the templateID
+ newTemplateID.value = selectedObject ? selectedObject.templateID : null;
+ await getChosenPOTById(newTemplateID.value);
+ }
+ productionOrderInstance = {
+ name: newName.value,
+ templateID: newTemplateID.value,
+ customerID: newCustomerID.value,
+ customer: newCustomer.value,
+ asset: newAsset.value,
+ state: newState.value,
+ creationDate: newCreationDate.value,
+ completionDate: newCompletionDate.value,
+ user: newUser.value,
+ templateDescription: newTemplateDescription.value,
+ templateNotes: newTemplateNotes.value,
+ timeSpent: newTimeSpent.value,
+ notes: newNotes.value,
+ };
+ }
+ store.commit('updateProductionOrderInstanceComponent', productionOrderInstance);
}
// get production order instance from id
@@ -439,18 +461,6 @@ const getPOIById = async () => {
console.log(err.response.statusText);
}
}
- await getConfigItemsFromCustomer();
-}
-
-// update customerid if customer was changed
-const updateNewCustomerID = async () => {
- try {
- const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getCustomerByName/${newCustomer.value}`);
- newCustomerID.value = response.data.customerID;
- } catch (err) {
- console.log(err.response.statusText);
- }
- await getConfigItemsFromCustomer();
}
// include delay to avoid 503 error
@@ -478,14 +488,12 @@ const getConfigItemsFromCustomer = async () => {
} catch (err) {
console.log(err.response.statusText);
}
- } else {
- if (newCustomerID.value.length != 0) {
- try {
- const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getCIFromCustomer/${newCustomerID.value}`);
- assets.value = response.data;
- } catch (err) {
- console.log(err.response.statusText);
- }
+ } else if (!(newCustomerID.value == '')) {
+ try {
+ const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getCIFromCustomer/${newCustomerID.value}`);
+ assets.value = response.data;
+ } catch (err) {
+ console.log(err.response.statusText);
}
}
}
@@ -500,12 +508,14 @@ function getItem(item) {
watch(modeChanged, getSession);
watch(deleteBool, confirmDeletePOI);
+watch(editable, getConfigItemsFromCustomer);
onMounted(async () => {
getSession();
await getPOIById();
- await getProductionOrderInstances();
+ await getPOTById();
triggerBackendCallsWithDelay(getCustomers);
+ triggerBackendCallsWithDelay(getUsers);
});
@@ -564,42 +574,6 @@ export default {
sans-serif;
}
-.saveNewPOI-darkmode {
- background: #2c2c2c;
- color: #fff;
- font: 400 0.875rem/1.875rem Overpass, sans-serif;
- border: none;
- padding: 1rem 1.875rem;
- width: 8%;
- border-radius: 0.625rem;
- box-shadow: 0.25rem 0.25rem 0.25rem 0rem rgba(0, 0, 0, 0.25);
-}
-
-.saveNewPOI-lightmode {
- background: #EBEBEB;
- color: #212121;
- font: 400 0.875rem/1.875rem Overpass, sans-serif;
- border: none;
- padding: 1rem 1.875rem;
- width: 8%;
- border-radius: 0.625rem;
- box-shadow: 0.25rem 0.25rem 0.25rem 0rem rgba(0, 0, 0, 0.25);
-}
-
-.saveNewPOI-darkmode:hover {
- background-color: #444444;
- cursor: pointer;
-}
-
-.saveNewPOI-lightmode:hover {
- background-color: #ACACAC;
- cursor: pointer;
-}
-
-#saveNewPOI {
- text-align: center;
-}
-
.h2-darkmode {
color: #fff;
}
diff --git a/components/server/ProductionOrdersInstanceTable.vue b/components/server/ProductionOrdersInstanceTable.vue
index f4e7558..722ece7 100644
--- a/components/server/ProductionOrdersInstanceTable.vue
+++ b/components/server/ProductionOrdersInstanceTable.vue
@@ -43,7 +43,12 @@
- {{ instance.asset }} |
+
+ {{ instance.asset }}
+
+
{{ instance.state }} |
@@ -74,6 +79,7 @@ const modeChanged = computed(() => store.state.updateDarkMode);
const chosenPOTId = computed(() => store.state.chosenPOTId);
const searchable = computed(() => store.state.searchable);
const filtered = computed(() => store.state.filtered);
+const notAllInstancesIcon = computed(() => store.state.notAllInstancesIcon);
const userSearchFilter = ref('');
const stateSearchFilter = ref('');
const productionOrderInstances = ref([]);
@@ -90,11 +96,20 @@ const goToChosenPOI = (id) => {
//get all production order instances
const getProductionOrderInstances = async () => {
- try {
- const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getSelectedPOIsByPOT/${pot.value.templateID}`);
- productionOrderInstances.value = response.data;
- } catch (err) {
- console.log(err.response.statusText);
+ if (notAllInstancesIcon.value) {
+ try {
+ const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getSelectedPOIsByPOT/${pot.value.templateID}`);
+ productionOrderInstances.value = response.data;
+ } catch (err) {
+ console.log(err.response.statusText);
+ }
+ } else {
+ try {
+ const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getAllProductionOrderInstances`);
+ productionOrderInstances.value = response.data;
+ } catch (err) {
+ console.log(err.response.statusText);
+ }
}
}
@@ -112,16 +127,34 @@ const updateFilterTerm = async () => {
// get production order template from id
const getPOTById = async () => {
+ if (notAllInstancesIcon.value) {
+ try {
+ const response = await Axios.get(
+ `https://${clientsideConfig.url}:${clientsideConfig.port}/api/getProductionOrderTemplate/${chosenPOTId.value}`
+ );
+ pot.value = response.data;
+ } catch (err) {
+ console.log(err.response.statusText);
+ }
+ }
+ await getProductionOrderInstances();
+}
+
+const goToChosenAsset = async (name) => {
+ let ci = {}
try {
const response = await Axios.get(
- `https://${clientsideConfig.url}:${clientsideConfig.port}/api/getProductionOrderTemplate/${chosenPOTId.value}`
+ `https://${clientsideConfig.url}:${clientsideConfig.port}/api/getSelectedConfigItemsByAsset/${name}`
);
- pot.value = response.data;
- await getProductionOrderInstances();
+ ci = response.data;
} catch (err) {
console.log(err.response.statusText);
}
-}
+ store.commit('setChosenAsset', ci[0].primaryID);
+ setTimeout(() => {
+ }, 1000);
+ store.commit('changeToAsset');
+};
//get all instances based on the searched state
const filterPOIByState = async () => {
@@ -179,6 +212,7 @@ function getItem(item) {
watch(modeChanged, getSession)
watch(searchable, updateSearchTerm);
watch(filtered, updateFilterTerm);
+watch(notAllInstancesIcon, getProductionOrderInstances);
onMounted(async () => {
getSession();
diff --git a/layouts/Actionbar.vue b/layouts/Actionbar.vue
index 9183f2d..74e6c19 100644
--- a/layouts/Actionbar.vue
+++ b/layouts/Actionbar.vue
@@ -120,6 +120,17 @@
+