fixed signup and renaming problems

This commit is contained in:
2024-03-12 17:46:44 +01:00
parent d1bdffb834
commit acae90ee13
17 changed files with 96 additions and 78 deletions

View File

@ -1,8 +1,9 @@
<template> <template>
<section :class="['customer-search', darkMode ? 'section-darkmode' : 'section-lightmode']"> <section :class="['customer-search', darkMode ? 'section-darkmode' : 'section-lightmode']">
<div :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Customer</div> <div :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Customer</div>
<pre v-if="!filtered" :class="['data', 'pre-customer', darkMode ? 'pre-darkmode' : 'pre-lightmode']">{{ clientFilter }}</pre> <pre v-if="!filtered"
<input v-if="filtered" v-model="clientFilter" @change="filterList()" :class="['data', 'pre-customer', darkMode ? 'pre-darkmode' : 'pre-lightmode']">{{ customerFilter }}</pre>
<input v-if="filtered" v-model="customerFilter" @change="filterList()"
:class="['data', 'input-customer', darkMode ? 'data-darkmode' : 'data-lightmode']"> :class="['data', 'input-customer', darkMode ? 'data-darkmode' : 'data-lightmode']">
</section> </section>
</template> </template>
@ -13,9 +14,9 @@ import { useStore } from 'vuex';
import { computed } from 'vue'; import { computed } from 'vue';
const store = useStore(); const store = useStore();
const filtered = computed(() => store.state.assetFiltered); const filtered = computed(() => store.state.filtered);
const filteredTerm = computed(() => store.state.filteredAssetbyCustomer); const filteredTerm = computed(() => store.state.filteredByCustomer);
const customerFilter = ref(store.state.filteredAssetbyCustomer); const customerFilter = ref(store.state.filteredByCustomer);
const darkMode = ref(true) const darkMode = ref(true)
@ -26,14 +27,14 @@ const updateFilterTerm = () => {
const checkFiltered = () => { const checkFiltered = () => {
if (!filtered.value) { if (!filtered.value) {
clientFilter.value = '' customerFilter.value = ''
filterList(); filterList();
} }
} }
// update the filtered term in the store // update the filtered term in the store
const filterList = () => { const filterList = () => {
store.commit('updateFilterbyClient', clientFilter.value); store.commit('updateFilterbyCustomer', customerFilter.value);
} }
watch(filteredTerm, updateFilterTerm) watch(filteredTerm, updateFilterTerm)
@ -106,8 +107,9 @@ export default {
color: #000; color: #000;
} }
.input { .input-customer {
border: none; border: none;
margin-left: 1rem;
} }
.pre-customer { .pre-customer {

View File

@ -15,8 +15,8 @@ import { computed } from 'vue';
const store = useStore(); const store = useStore();
const filtered = computed(() => store.state.filtered); const filtered = computed(() => store.state.filtered);
const filteredTerm = computed(() => store.state.filteredByClient); const filteredTerm = computed(() => store.state.filteredByCustomer);
const issueStateFilter = ref(store.state.filteredByClient); const issueStateFilter = ref(store.state.filteredByCustomer);
const darkMode = ref(true) const darkMode = ref(true)
@ -34,7 +34,7 @@ const checkFiltered = () => {
// update the filtered term in the store // update the filtered term in the store
const filterList = () => { const filterList = () => {
store.commit('updateFilterbyClient', issueStateFilter.value); store.commit('updateFilterbyCustomer', issueStateFilter.value);
} }
watch(filteredTerm, updateFilterTerm) watch(filteredTerm, updateFilterTerm)

View File

@ -83,7 +83,7 @@ const handleLogin = async () => {
// sucessfully logged in // sucessfully logged in
router.push('/home')*/ router.push('/home')*/
let res = await signIn( credentials, { callbackUrl: '/home' }) let res = await signIn( credentials, { callbackUrl: '/home' })
console.log("res", res) // console.log("res", res)
} catch (err) { } catch (err) {
// handle the error // handle the error
@ -97,16 +97,16 @@ const testFunctionSignup = async () => {
isError.value = false; isError.value = false;
errorMsg.value = ''; errorMsg.value = '';
const username = 'franzzzzzrtg' const username = 'adm_tueit'
const password = '112345678' const password = 'SvF=?bfEx7_hV,cMEu4m'
const password_repeat = '112345678' const password_repeat = 'SvF=?bfEx7_hV,cMEu4m'
const fullName = 'hallo' const fullName = 'administrator'
const email = 'test.sdj@web.de' const email = 'support@tueit.de'
const phonenumber = '015736283729' const phonenumber = ''
const address = 'Strasse' const address = ''
const city = 'tuebingen' const city = ''
const postcode = '72121' const postcode = ''
const adminBool = false const adminBool = true
const technician1Bool = false const technician1Bool = false
const technician2Bool = false const technician2Bool = false
const technicianMonitoringBool = false const technicianMonitoringBool = false
@ -132,10 +132,11 @@ const testFunctionSignup = async () => {
} }
try { try {
let res = await Axios.post(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/signup`, requestBody); let res = await Axios.post(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/signup`, requestBody);
// something to do with the res? // something to do with the res?
console.log(res) // console.log(res)
} catch (err) { } catch (err) {
// handle the error // handle the error

View File

@ -217,7 +217,7 @@ const updateConfigItem = async () => {
counter += 1; counter += 1;
} }
}); });
if (counter == 1) { if (counter == 2) {
alert("This asset name already exists. Please choose an unique asset name or modify respectively delete the old one!"); alert("This asset name already exists. Please choose an unique asset name or modify respectively delete the old one!");
item.value.assetName = ''; item.value.assetName = '';
return; return;

View File

@ -63,8 +63,8 @@ const goToChosenAsset = (id) => {
store.commit('setChosenAsset', id); store.commit('setChosenAsset', id);
store.commit('changeToAsset'); store.commit('changeToAsset');
}; };
const customerFilter = computed(() => store.state.filteredAssetbyCustomer); const customerFilter = computed(() => store.state.filteredByCustomer);
const assetSearchable = computed(() => store.state.assetSearchable); const assetSearchable = computed(() => store.state.searchable);
const assetSearchFilter = ref(''); const assetSearchFilter = ref('');
const darkMode = ref(true) const darkMode = ref(true)

View File

@ -65,7 +65,7 @@ const goToChosenIssueSlip = (id) => {
store.commit('changeToIssueSlip'); store.commit('changeToIssueSlip');
}; };
const clientFilter = computed(() => store.state.filteredByClient); const customerFilter = computed(() => store.state.filteredByCustomer);
const searchable = computed(() => store.state.searchable); const searchable = computed(() => store.state.searchable);
const issueSlipSearchFilter = ref(''); const issueSlipSearchFilter = ref('');
@ -80,7 +80,7 @@ const updateSearchTerm = async () => {
//get all issueSlips //get all issueSlips
const getIssueSlips = async () => { const getIssueSlips = async () => {
if (!(clientFilter.value === '')) { if (!(customerFilter.value === '')) {
await getFilteredIssueSlipsByClient(); await getFilteredIssueSlipsByClient();
} else { } else {
try { try {
@ -95,7 +95,7 @@ const getIssueSlips = async () => {
//get all issue slips based on the searched client //get all issue slips based on the searched client
const getFilteredIssueSlipsByClient = async () => { const getFilteredIssueSlipsByClient = async () => {
try { try {
const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getSelectedIssueSlipsByClient/${clientFilter.value}`); const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getSelectedIssueSlipsByClient/${customerFilter.value}`);
issueSlips.value = response.data; issueSlips.value = response.data;
} catch (err) { } catch (err) {
console.log(err.response.statusText); console.log(err.response.statusText);
@ -116,7 +116,7 @@ const searchIssueSlip = async () => {
} }
} }
watch(clientFilter, getIssueSlips); watch(customerFilter, getIssueSlips);
watch(searchable, updateSearchTerm); watch(searchable, updateSearchTerm);

View File

@ -24,7 +24,7 @@
:class="['table-row', darkMode ? 'tr-darkmode' : 'tr-lightmode']" id="row-1"> :class="['table-row', darkMode ? 'tr-darkmode' : 'tr-lightmode']" id="row-1">
<td <td
:class="['Name', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Name-darkmode' : 'Name-lightmode']"> :class="['Name', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Name-darkmode' : 'Name-lightmode']">
<nuxt-link to="/issues" id="nuxt-link" class="button" <nuxt-link to="/issueItems" id="nuxt-link" class="button"
:class="[darkMode ? 'button-darkmode' : 'button-lightmode']" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']"
@click="goToChosenIssue(issue.primaryID)"> @click="goToChosenIssue(issue.primaryID)">
{{ issue.name }} {{ issue.name }}
@ -58,7 +58,7 @@ const goToChosenIssue = (id) => {
store.commit('changeToIssueItem'); store.commit('changeToIssueItem');
}; };
const stateFilter = computed(() => store.state.filteredByClient); const stateFilter = computed(() => store.state.filteredByCustomer);
const searchable = computed(() => store.state.searchable); const searchable = computed(() => store.state.searchable);
const issueSearchFilter = ref(''); const issueSearchFilter = ref('');

View File

@ -9,7 +9,7 @@
<div class="data-field" id="variantOf"> <div class="data-field" id="variantOf">
<pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">Variant of:</pre> <pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">Variant of:</pre>
<pre <pre
:class="['data', darkMode ? 'data-darkmode' : 'data-lightmode']"><nuxt-link to="/issues" id="nuxt-link" class="button" @click="goToChosenIssue(issue.primaryID)">{{ nameOfVariant }}</nuxt-link></pre> :class="['data', darkMode ? 'data-darkmode' : 'data-lightmode']"><nuxt-link to="/issueItems" id="nuxt-link" class="button" @click="goToChosenIssue(issue.primaryID)">{{ nameOfVariant }}</nuxt-link></pre>
</div> </div>
</div> </div>
<div class="info"> <div class="info">

View File

@ -23,7 +23,7 @@
:class="['table-row', darkMode ? 'tr-darkmode' : 'tr-lightmode']" id="row-1"> :class="['table-row', darkMode ? 'tr-darkmode' : 'tr-lightmode']" id="row-1">
<td v-if="!editable" <td v-if="!editable"
:class="['Name', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Name-darkmode' : 'Name-lightmode']"> :class="['Name', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Name-darkmode' : 'Name-lightmode']">
<nuxt-link to="/issues" id="nuxt-link" class="button" <nuxt-link to="/issueItems" id="nuxt-link" class="button"
:class="[darkMode ? 'button-darkmode' : 'button-lightmode']" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']"
@click="goToChosenIssueVariant(issueVar.primaryID)"> @click="goToChosenIssueVariant(issueVar.primaryID)">
{{ issueVar.name }} {{ issueVar.name }}

View File

@ -1,7 +1,7 @@
<template> <template>
<section v-if="!addBool" :class="['information', darkMode ? 'section-darkmode' : 'section-lightmode']"> <section v-if="!addBool" :class="['information', darkMode ? 'section-darkmode' : 'section-lightmode']">
<h2 v-if="!editable" :class="['maintenance-visits-template-name', darkMode ? 'h2-darkmode' : 'h2-lightmode']">{{ <h2 v-if="!editable" :class="['maintenance-visits-template-name', darkMode ? 'h2-darkmode' : 'h2-lightmode']">{{
mvt.name }}</h2> mvt.name }}</h2>
<input v-if="editable" v-model="mvt.name" @change="updateMVT()" <input v-if="editable" v-model="mvt.name" @change="updateMVT()"
:class="['data', 'mvt-name-input', darkMode ? 'h2-darkmode' : 'h2-lightmode', darkMode ? 'h2-input-darkmode' : 'h2-input-lightmode', 'input']"> :class="['data', 'mvt-name-input', darkMode ? 'h2-darkmode' : 'h2-lightmode', darkMode ? 'h2-input-darkmode' : 'h2-input-lightmode', 'input']">
<div class="maintenance-visits-template-data"> <div class="maintenance-visits-template-data">
@ -20,7 +20,8 @@
<div class="data-field" id="info"> <div class="data-field" id="info">
<div class="id-type-user" id="ID"> <div class="id-type-user" id="ID">
<pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">ID:</pre> <pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">ID:</pre>
<pre :class="['data', darkMode ? 'data-darkmode' : 'data-lightmode']">{{ mvt.checklistID }}</pre> <pre
:class="['data', darkMode ? 'data-darkmode' : 'data-lightmode']">{{ mvt.checklistID }}</pre>
</div> </div>
<div class="id-type-user" id="type"> <div class="id-type-user" id="type">
<pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">Type:</pre> <pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">Type:</pre>
@ -92,8 +93,8 @@
</div> </div>
</section> </section>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, watch } from 'vue'; import { ref, onMounted, watch } from 'vue';
import Axios from '../axios.config.js'; import Axios from '../axios.config.js';
@ -137,9 +138,6 @@ const confirmDeleteMVT = async () => {
if (confirm("Do you really want to delete this maintenance visit template? It cannot be undone!")) { if (confirm("Do you really want to delete this maintenance visit template? It cannot be undone!")) {
try { try {
await Axios.delete(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/deleteMaintenanceVisitTemplate/${chosenMVTId.value}`); await Axios.delete(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/deleteMaintenanceVisitTemplate/${chosenMVTId.value}`);
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToTemplatelist');
} catch (err) { } catch (err) {
console.log(err.response.statusText); console.log(err.response.statusText);
} }
@ -148,6 +146,9 @@ const confirmDeleteMVT = async () => {
} catch (err) { } catch (err) {
console.log(err.response.statusText); console.log(err.response.statusText);
} }
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToTemplatelist');
} else { } else {
store.commit('undoDelete'); store.commit('undoDelete');
} }
@ -278,10 +279,10 @@ onMounted(() => {
export default { export default {
name: "MaintenanceVisitsTemplate", name: "MaintenanceVisitsTemplate",
}; };
</script> </script>
<style scoped> <style scoped>
.information { .information {
display: flex; display: flex;

View File

@ -1,7 +1,7 @@
<template> <template>
<section v-if="!addBool" :class="['information', darkMode ? 'section-darkmode' : 'section-lightmode']"> <section v-if="!addBool" :class="['information', darkMode ? 'section-darkmode' : 'section-lightmode']">
<h2 v-if="!editable" :class="['production-orders-template-name', darkMode ? 'h2-darkmode' : 'h2-lightmode']">{{ <h2 v-if="!editable" :class="['production-orders-template-name', darkMode ? 'h2-darkmode' : 'h2-lightmode']">{{
pot.name }}</h2> pot.name }}</h2>
<input v-if="editable" v-model="pot.name" @change="updatePOT()" <input v-if="editable" v-model="pot.name" @change="updatePOT()"
:class="['data', 'pot-name-input', darkMode ? 'h2-darkmode' : 'h2-lightmode', darkMode ? 'h2-input-darkmode' : 'h2-input-lightmode', 'input']"> :class="['data', 'pot-name-input', darkMode ? 'h2-darkmode' : 'h2-lightmode', darkMode ? 'h2-input-darkmode' : 'h2-input-lightmode', 'input']">
<div class="production-orders-template-data"> <div class="production-orders-template-data">
@ -100,7 +100,7 @@
</div> </div>
</section> </section>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, watch } from 'vue'; import { ref, onMounted, watch } from 'vue';
import Axios from '../axios.config.js'; import Axios from '../axios.config.js';
@ -143,9 +143,6 @@ const confirmDeletePOT = async () => {
if (confirm("Do you really want to delete this production order template? It cannot be undone!")) { if (confirm("Do you really want to delete this production order template? It cannot be undone!")) {
try { try {
await Axios.delete(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/deleteProductionOrderTemplate/${chosenPOTId.value}`); await Axios.delete(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/deleteProductionOrderTemplate/${chosenPOTId.value}`);
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToTemplatelist');
} catch (err) { } catch (err) {
console.log(err.response.statusText); console.log(err.response.statusText);
} }
@ -154,6 +151,9 @@ const confirmDeletePOT = async () => {
} catch (err) { } catch (err) {
console.log(err.response.statusText); console.log(err.response.statusText);
} }
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToTemplatelist');
} else { } else {
store.commit('undoDelete'); store.commit('undoDelete');
} }
@ -283,9 +283,9 @@ onMounted(() => {
export default { export default {
name: "ProductionOrdersTemplate", name: "ProductionOrdersTemplate",
}; };
</script> </script>
<style scoped> <style scoped>
.information { .information {
display: flex; display: flex;
@ -440,7 +440,7 @@ export default {
border-radius: 0.3125rem; border-radius: 0.3125rem;
} }
.customer-ID, .customer-ID,
.user { .user {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -232,7 +232,7 @@ const updateSolution = async () => {
counter += 1; counter += 1;
} }
}); });
if (counter == 1) { if (counter == 2) {
alert("This solution name already exists. Please choose an unique solution name or modify respectively delete the old one!"); alert("This solution name already exists. Please choose an unique solution name or modify respectively delete the old one!");
sol.value.solutionName = ''; sol.value.solutionName = '';
return; return;
@ -276,9 +276,6 @@ const confirmDeleteSolution = async () => {
if (confirm("Do you really want to delete this solution? It cannot be undone!")) { if (confirm("Do you really want to delete this solution? It cannot be undone!")) {
try { try {
await Axios.delete(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/deleteSolution/${chosenSolutionId.value}`); await Axios.delete(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/deleteSolution/${chosenSolutionId.value}`);
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToSolutionlist');
} catch (err) { } catch (err) {
console.log(err.response.statusText); console.log(err.response.statusText);
} }
@ -287,6 +284,9 @@ const confirmDeleteSolution = async () => {
} catch (err) { } catch (err) {
console.log(err.response.statusText); console.log(err.response.statusText);
} }
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToSolutionlist');
} else { } else {
store.commit('undoDelete'); store.commit('undoDelete');
} }

View File

@ -658,7 +658,7 @@ th {
font: 400 0.875rem/1.875rem Overpass, sans-serif; font: 400 0.875rem/1.875rem Overpass, sans-serif;
border: none; border: none;
border-radius: 0.625rem; border-radius: 0.625rem;
margin-left: 2rem; margin-left: 15.8rem;
padding-left: 0.9rem; padding-left: 0.9rem;
padding-right: 0.9rem; padding-right: 0.9rem;
} }

View File

@ -44,7 +44,7 @@
<pre v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Solutions</pre> <pre v-if="isExpanded" :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Solutions</pre>
</Transition> </Transition>
</router-link> </router-link>
<router-link to="/issueSlips" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']" id="accounting-button"> <router-link to="/issueSlips" class="button" :class="[darkMode ? 'button-darkmode' : 'button-lightmode']" @click="defaultIssueSlipPage()" id="accounting-button">
<div class="icon" id="accounting-icon"> <div class="icon" id="accounting-icon">
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy" src="/icons/navbar-icons/Accounting-Icon.svg" /> <img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy" src="/icons/navbar-icons/Accounting-Icon.svg" />
</div> </div>
@ -91,6 +91,11 @@ const defaultSolutionPage = () => {
store.commit('changeToSolutionlist') store.commit('changeToSolutionlist')
} }
const defaultIssueSlipPage = () => {
store.commit('resetStore');
store.commit('changeToIssueSliplist')
}
const ToggleSidebar = () => { const ToggleSidebar = () => {
isExpanded.value = !isExpanded.value; isExpanded.value = !isExpanded.value;
}; };

View File

@ -17,7 +17,6 @@ const store = createStore({
onAsset: false, onAsset: false,
onSolutionlistAsset: false, onSolutionlistAsset: false,
chosenAssetId: -1, chosenAssetId: -1,
filteredAssetbyCustomer: '',
newAsset: false, newAsset: false,
newAssetName: '', newAssetName: '',
newCustomerID: '', newCustomerID: '',
@ -180,13 +179,12 @@ const store = createStore({
state.chosenAssetId = id state.chosenAssetId = id
}, },
resetAssetStore(state) { resetAssetStore(state) {
state.assetEditable = false state.editable = false
state.assetFiltered = false state.filtered = false
state.assetSearchable = false state.searchable = false
state.deleteAsset = false state.deleteAsset = false
state.chosenAssetId = -1 state.chosenAssetId = -1
state.filteredAssetbyCustomer = '' state.filteredByCustomer = ''
state.newAsset = false
state.newAssetName = '' state.newAssetName = ''
state.newCustomerID = '' state.newCustomerID = ''
state.newCustomer = '' state.newCustomer = ''
@ -275,23 +273,20 @@ const store = createStore({
undoDeleteAsset(state) { undoDeleteAsset(state) {
state.deleteAsset = false state.deleteAsset = false
}, },
updateAssetFilterbyCustomer(state, customer) {
state.filteredAssetbyCustomer = customer
},
toggleAssetSearchable(state) { toggleAssetSearchable(state) {
if (state.assetSearchable == false) { if (state.searchable == false) {
state.assetSearchable = true state.searchable = true
state.assetFiltered = false state.filtered = false
} else { } else {
state.assetSearchable = false state.searchable = false
} }
state.filteredAssetbyCustomer = '' state.filteredByCustomer = ''
}, },
addNewAsset(state) { addNewAsset(state) {
state.newAsset = true state.newAsset = true
state.assetEditable = false state.editable = false
state.assetFiltered = false state.filtered = false
state.assetSearchable = false state.searchable = false
state.onAssetlist = false state.onAssetlist = false
state.onCustomerAssetlist = false state.onCustomerAssetlist = false
state.onAsset = true state.onAsset = true

14
server/api/signup.ts Normal file
View File

@ -0,0 +1,14 @@
import { errorMsg } from "../middleware/signUp";
export default defineEventHandler(async (event) => {
if (!(errorMsg === '')) {
throw createError({
statusCode: 400,
statusMessage: errorMsg,
})
}
setResponseStatus(event, 202)
return 'Successfully signed up.'
})

View File

@ -17,7 +17,7 @@ export default defineEventHandler(async (event) => {
httpsAgent: agent httpsAgent: agent
}); });
if (event.path.startsWith("/api/signup")) { if (event.path.startsWith("/signup")) {
const body = await readBody(event) const body = await readBody(event)
// do the post request in the backend // do the post request in the backend