* setup application for contract
This commit is contained in:
@@ -74,6 +74,7 @@ export default {
|
|||||||
deregister() {
|
deregister() {
|
||||||
misapply(this.selectedContract)
|
misapply(this.selectedContract)
|
||||||
this.closeModal()
|
this.closeModal()
|
||||||
|
this.$router.go()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,12 +60,15 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['closeModal']),
|
...mapActions(['closeModal']),
|
||||||
apply(role) {
|
async apply(role) {
|
||||||
const id = this.selectedContract
|
const id = this.selectedContract
|
||||||
if (id === null) {
|
if (id === null) {
|
||||||
router.push('/error?message=' + 'Contract not found' + '&code=404')
|
router.push('/error?message=' + 'Contract not found' + '&code=404')
|
||||||
}
|
}
|
||||||
applyContract(id, role)
|
//contractID, prefRole, userName, userPhone, userEmail
|
||||||
|
await applyContract(id, role, this.$store.state.keycloak.keycloak.tokenParsed.name, '', this.$store.state.keycloak.keycloak.tokenParsed.email)
|
||||||
|
this.closeModal()
|
||||||
|
this.$router.go()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
<td class="text align-top text-xl pl-4 max-sm:text-base py-2">Mitarbeiter:</td>
|
<td class="text align-top text-xl pl-4 max-sm:text-base py-2">Mitarbeiter:</td>
|
||||||
<td class="w-full pl-2 text-lg max-sm:text-base py-2">
|
<td class="w-full pl-2 text-lg max-sm:text-base py-2">
|
||||||
<ul class="list-disc pl-4">
|
<ul class="list-disc pl-4">
|
||||||
<li v-for="person in contract.mitarbeiter" :key="person.name">
|
<li v-for="person in contract.employees" :key="person.name">
|
||||||
{{ person.name }}({{ person.role }}) {{ person.phone }}
|
{{ person.name }}({{ person.role }}) {{ person.phone }}
|
||||||
<a :href="'mailto:' + person.email">
|
<a :href="'mailto:' + person.email">
|
||||||
<font-awesome-icon class="pl-1 h-5 mt-1" icon="fa-solid fa-envelope" />
|
<font-awesome-icon class="pl-1 h-5 mt-1" icon="fa-solid fa-envelope" />
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export async function getOpenContracts() {
|
|||||||
}
|
}
|
||||||
}) //TODO: provide here auth header
|
}) //TODO: provide here auth header
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
return resp.data.openContracts
|
return resp.data
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
router.push('/error?message=' + error.message + '&code=' + error.code)
|
router.push('/error?message=' + error.message + '&code=' + error.code)
|
||||||
@@ -60,12 +60,15 @@ export async function getContractById(identifier, authToken) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function applyContract(contractID, prefRole) {
|
export async function applyContract(contractID, prefRole, userName, userPhone, userEmail) {
|
||||||
return HttpClient.post(
|
return HttpClient.post(
|
||||||
'/contract/apply',
|
'/contract/apply',
|
||||||
{
|
{
|
||||||
id: contractID,
|
id: contractID,
|
||||||
role: prefRole
|
role: prefRole,
|
||||||
|
name: userName,
|
||||||
|
phone: userPhone,
|
||||||
|
email: userEmail
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
@@ -84,17 +87,14 @@ export async function applyContract(contractID, prefRole) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function misapply(contractID) {
|
export async function misapply(contractID) {
|
||||||
return HttpClient.post(
|
return HttpClient.post('/contract/' + contractID + '/misapply', {
|
||||||
'/contract/misapply',
|
id : contractID,
|
||||||
{
|
email : store.state.keycloak.keycloak.tokenParsed.email
|
||||||
id: contractID
|
}, {
|
||||||
},
|
|
||||||
{
|
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: 'Bearer ' + store.state.keycloak.keycloak.token
|
Authorization: 'Bearer ' + store.state.keycloak.keycloak.token
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
)
|
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
//TODO: send also auth token with request
|
//TODO: send also auth token with request
|
||||||
return resp.data
|
return resp.data
|
||||||
|
|||||||
@@ -33,7 +33,15 @@ export default {
|
|||||||
return state.currentContract
|
return state.currentContract
|
||||||
},
|
},
|
||||||
async fetchOpenContracts({ commit }) {
|
async fetchOpenContracts({ commit }) {
|
||||||
const openContracts = await getOpenContracts()
|
let openContracts = await getOpenContracts()
|
||||||
|
for (let i = 0; i < openContracts.length; ++i) {
|
||||||
|
openContracts[i]["registered"] = false
|
||||||
|
for (let j = 0; j < openContracts[i].employees.length; ++j) {
|
||||||
|
if (openContracts[i].employees[j].email === store.state.keycloak.keycloak.tokenParsed.email)
|
||||||
|
openContracts[i]["registered"] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
store.state.keycloak.keycloak.tokenParsed.email
|
||||||
commit('initOpenContracts', openContracts)
|
commit('initOpenContracts', openContracts)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
|||||||
contract.status.name
|
contract.status.name
|
||||||
}}</span>
|
}}</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="py-3 px-4 text-center" v-if:="contract.mitarbeiter">
|
<td class="py-3 px-4 text-center" v-if:="contract.employees">
|
||||||
{{ contract.mitarbeiter.join(', ') }}
|
{{ contract.employees.map(function(item){return item['name'];}).join(', ') }}
|
||||||
</td>
|
</td>
|
||||||
<td class="py-3 px-4 text-center" v-else:>Not found</td>
|
<td class="py-3 px-4 text-center" v-else:>Not found</td>
|
||||||
<td class="py-3 px-4 text-center">
|
<td class="py-3 px-4 text-center">
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import Navbar from '../components/Navbar.vue'
|
|||||||
<th class="py-3 px-4 uppercase font-semibold text-sm text-center">Id</th>
|
<th class="py-3 px-4 uppercase font-semibold text-sm text-center">Id</th>
|
||||||
<th class="py-3 px-4 uppercase font-semibold text-sm text-center">Name</th>
|
<th class="py-3 px-4 uppercase font-semibold text-sm text-center">Name</th>
|
||||||
<th class="py-3 px-4 uppercase font-semibold text-sm text-center">Status</th>
|
<th class="py-3 px-4 uppercase font-semibold text-sm text-center">Status</th>
|
||||||
<th class="py-3 px-4 uppercase font-semibold text-sm text-center">Planed Date</th>
|
<th class="py-3 px-4 uppercase font-semibold text-sm text-center">Created Date</th>
|
||||||
<th class="w-1/3 py-3 px-4 uppercase font-semibold text-sm text-center">Notes</th>
|
<th class="w-1/3 py-3 px-4 uppercase font-semibold text-sm text-center">Notes</th>
|
||||||
<th class="py-3 px-4 uppercase font-semibold text-sm text-center">Aktion</th>
|
<th class="py-3 px-4 uppercase font-semibold text-sm text-center">Aktion</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -37,15 +37,15 @@ import Navbar from '../components/Navbar.vue'
|
|||||||
<td class="py-3 px-4 text-center">
|
<td class="py-3 px-4 text-center">
|
||||||
<!-- TODO: set color specific from status. for colors use https://www.creative-tim.com/learning-lab/tailwind-starter-kit/documentation/css/labels -->
|
<!-- TODO: set color specific from status. for colors use https://www.creative-tim.com/learning-lab/tailwind-starter-kit/documentation/css/labels -->
|
||||||
<span class="text-emerald-600 bg-emerald-200 rounded-full py-1 px-2">{{
|
<span class="text-emerald-600 bg-emerald-200 rounded-full py-1 px-2">{{
|
||||||
contract.status
|
contract.status.name
|
||||||
}}</span>
|
}}</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="py-3 px-4 text-center">
|
<td class="py-3 px-4 text-center">
|
||||||
{{ new Date(contract.appointment).toDateString() }}
|
{{ new Date(contract.updatedAt).toDateString() }}
|
||||||
</td>
|
</td>
|
||||||
<td class="py-3 px-4 text-center">{{ contract.notes }}</td>
|
<td class="py-3 px-4 text-center">{{ contract.notes }}</td>
|
||||||
<td class="text-left py-2">
|
<td class="text-left py-2">
|
||||||
<RouterLink to="/contract?id=TESTID">
|
<RouterLink :to="'/contract?id=' + contract.id">
|
||||||
<button
|
<button
|
||||||
class="bg-blue-500 text-white active:bg-emerald-600 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150"
|
class="bg-blue-500 text-white active:bg-emerald-600 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150"
|
||||||
type="button">
|
type="button">
|
||||||
@@ -53,7 +53,7 @@ import Navbar from '../components/Navbar.vue'
|
|||||||
</button>
|
</button>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<button
|
<button
|
||||||
v-if="contract.registered"
|
v-if="!contract.registered"
|
||||||
class="bg-emerald-500 text-white active:bg-emerald-600 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150"
|
class="bg-emerald-500 text-white active:bg-emerald-600 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150"
|
||||||
type="button"
|
type="button"
|
||||||
@click="
|
@click="
|
||||||
@@ -63,7 +63,7 @@ import Navbar from '../components/Navbar.vue'
|
|||||||
Anmelden
|
Anmelden
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="!contract.registered"
|
v-if="contract.registered"
|
||||||
class="bg-red-500 text-white active:bg-red-600 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150"
|
class="bg-red-500 text-white active:bg-red-600 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150"
|
||||||
type="button"
|
type="button"
|
||||||
@click="
|
@click="
|
||||||
|
|||||||
Reference in New Issue
Block a user