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

View File

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

View File

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

View File

@ -217,7 +217,7 @@ const updateConfigItem = async () => {
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!");
item.value.assetName = '';
return;

View File

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

View File

@ -65,7 +65,7 @@ const goToChosenIssueSlip = (id) => {
store.commit('changeToIssueSlip');
};
const clientFilter = computed(() => store.state.filteredByClient);
const customerFilter = computed(() => store.state.filteredByCustomer);
const searchable = computed(() => store.state.searchable);
const issueSlipSearchFilter = ref('');
@ -80,7 +80,7 @@ const updateSearchTerm = async () => {
//get all issueSlips
const getIssueSlips = async () => {
if (!(clientFilter.value === '')) {
if (!(customerFilter.value === '')) {
await getFilteredIssueSlipsByClient();
} else {
try {
@ -95,7 +95,7 @@ const getIssueSlips = async () => {
//get all issue slips based on the searched client
const getFilteredIssueSlipsByClient = async () => {
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;
} catch (err) {
console.log(err.response.statusText);
@ -116,7 +116,7 @@ const searchIssueSlip = async () => {
}
}
watch(clientFilter, getIssueSlips);
watch(customerFilter, getIssueSlips);
watch(searchable, updateSearchTerm);

View File

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

View File

@ -9,7 +9,7 @@
<div class="data-field" id="variantOf">
<pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">Variant of:</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 class="info">

View File

@ -23,7 +23,7 @@
:class="['table-row', darkMode ? 'tr-darkmode' : 'tr-lightmode']" id="row-1">
<td v-if="!editable"
: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']"
@click="goToChosenIssueVariant(issueVar.primaryID)">
{{ issueVar.name }}

View File

@ -1,7 +1,7 @@
<template>
<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']">{{
mvt.name }}</h2>
mvt.name }}</h2>
<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']">
<div class="maintenance-visits-template-data">
@ -20,7 +20,8 @@
<div class="data-field" id="info">
<div class="id-type-user" id="ID">
<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 class="id-type-user" id="type">
<pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">Type:</pre>
@ -92,8 +93,8 @@
</div>
</section>
</template>
<script setup>
import { ref, onMounted, watch } from 'vue';
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!")) {
try {
await Axios.delete(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/deleteMaintenanceVisitTemplate/${chosenMVTId.value}`);
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToTemplatelist');
} catch (err) {
console.log(err.response.statusText);
}
@ -148,6 +146,9 @@ const confirmDeleteMVT = async () => {
} catch (err) {
console.log(err.response.statusText);
}
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToTemplatelist');
} else {
store.commit('undoDelete');
}
@ -278,10 +279,10 @@ onMounted(() => {
export default {
name: "MaintenanceVisitsTemplate",
};
</script>
</script>
<style scoped>
.information {
display: flex;

View File

@ -1,7 +1,7 @@
<template>
<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']">{{
pot.name }}</h2>
pot.name }}</h2>
<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']">
<div class="production-orders-template-data">
@ -100,7 +100,7 @@
</div>
</section>
</template>
<script setup>
import { ref, onMounted, watch } from 'vue';
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!")) {
try {
await Axios.delete(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/deleteProductionOrderTemplate/${chosenPOTId.value}`);
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToTemplatelist');
} catch (err) {
console.log(err.response.statusText);
}
@ -154,6 +151,9 @@ const confirmDeletePOT = async () => {
} catch (err) {
console.log(err.response.statusText);
}
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToTemplatelist');
} else {
store.commit('undoDelete');
}
@ -283,9 +283,9 @@ onMounted(() => {
export default {
name: "ProductionOrdersTemplate",
};
</script>
</script>
<style scoped>
.information {
display: flex;
@ -440,7 +440,7 @@ export default {
border-radius: 0.3125rem;
}
.customer-ID,
.customer-ID,
.user {
display: flex;
flex-direction: column;

View File

@ -232,7 +232,7 @@ const updateSolution = async () => {
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!");
sol.value.solutionName = '';
return;
@ -276,9 +276,6 @@ const confirmDeleteSolution = async () => {
if (confirm("Do you really want to delete this solution? It cannot be undone!")) {
try {
await Axios.delete(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/deleteSolution/${chosenSolutionId.value}`);
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToSolutionlist');
} catch (err) {
console.log(err.response.statusText);
}
@ -287,6 +284,9 @@ const confirmDeleteSolution = async () => {
} catch (err) {
console.log(err.response.statusText);
}
store.commit('undoDelete');
store.commit('resetStore');
store.commit('changeToSolutionlist');
} else {
store.commit('undoDelete');
}

View File

@ -658,7 +658,7 @@ th {
font: 400 0.875rem/1.875rem Overpass, sans-serif;
border: none;
border-radius: 0.625rem;
margin-left: 2rem;
margin-left: 15.8rem;
padding-left: 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>
</Transition>
</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">
<img :class="[darkMode ? 'img-darkmode' : 'img-lightmode']" loading="lazy" src="/icons/navbar-icons/Accounting-Icon.svg" />
</div>
@ -91,6 +91,11 @@ const defaultSolutionPage = () => {
store.commit('changeToSolutionlist')
}
const defaultIssueSlipPage = () => {
store.commit('resetStore');
store.commit('changeToIssueSliplist')
}
const ToggleSidebar = () => {
isExpanded.value = !isExpanded.value;
};

View File

@ -17,7 +17,6 @@ const store = createStore({
onAsset: false,
onSolutionlistAsset: false,
chosenAssetId: -1,
filteredAssetbyCustomer: '',
newAsset: false,
newAssetName: '',
newCustomerID: '',
@ -180,13 +179,12 @@ const store = createStore({
state.chosenAssetId = id
},
resetAssetStore(state) {
state.assetEditable = false
state.assetFiltered = false
state.assetSearchable = false
state.editable = false
state.filtered = false
state.searchable = false
state.deleteAsset = false
state.chosenAssetId = -1
state.filteredAssetbyCustomer = ''
state.newAsset = false
state.filteredByCustomer = ''
state.newAssetName = ''
state.newCustomerID = ''
state.newCustomer = ''
@ -275,23 +273,20 @@ const store = createStore({
undoDeleteAsset(state) {
state.deleteAsset = false
},
updateAssetFilterbyCustomer(state, customer) {
state.filteredAssetbyCustomer = customer
},
toggleAssetSearchable(state) {
if (state.assetSearchable == false) {
state.assetSearchable = true
state.assetFiltered = false
if (state.searchable == false) {
state.searchable = true
state.filtered = false
} else {
state.assetSearchable = false
state.searchable = false
}
state.filteredAssetbyCustomer = ''
state.filteredByCustomer = ''
},
addNewAsset(state) {
state.newAsset = true
state.assetEditable = false
state.assetFiltered = false
state.assetSearchable = false
state.editable = false
state.filtered = false
state.searchable = false
state.onAssetlist = false
state.onCustomerAssetlist = false
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
});
if (event.path.startsWith("/api/signup")) {
if (event.path.startsWith("/signup")) {
const body = await readBody(event)
// do the post request in the backend