Skip to content
Snippets Groups Projects
Commit a1b98a3d authored by Omar Elkadi's avatar Omar Elkadi
Browse files

udate sick form comments and object struction

parent 420efe85
No related branches found
No related tags found
No related merge requests found
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
enctype="multipart/form-data" enctype="multipart/form-data"
> >
<div class="row"> <div class="row">
<!-- 1st col of inputs -->
<div class="col-md-8"> <div class="col-md-8">
<!--1. name--> <!--1. row -> name-->
<div class="form-row" > <div class="form-row" >
<div class="form-group col-md-5 col-sm-12 col-sm-12"> <div class="form-group col-md-5 col-sm-12 col-sm-12">
<input <input
...@@ -39,7 +40,7 @@ ...@@ -39,7 +40,7 @@
/> />
</div> </div>
</div> </div>
<!--2. Email && phonenumber --> <!--2. row -> Email && phonenumber -->
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-6 col-sm-12"> <div class="form-group col-md-6 col-sm-12">
<input <input
...@@ -62,7 +63,7 @@ ...@@ -62,7 +63,7 @@
/> />
</div> </div>
</div> </div>
<!--3. Adress street haus num --> <!--3. row -> Adress street haus num -->
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-9"> <div class="form-group col-md-9">
<input <input
...@@ -85,7 +86,7 @@ ...@@ -85,7 +86,7 @@
/> />
</div> </div>
</div> </div>
<!-- 4. Adress city + country--> <!-- 4. row -> Adress city + country-->
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-2"> <div class="form-group col-md-2">
<input type="text" class="form-control" id="inputZip" placeholder="Postleizahl" v-model="patientStudent.Address.ZIPcode" required /> <input type="text" class="form-control" id="inputZip" placeholder="Postleizahl" v-model="patientStudent.Address.ZIPcode" required />
...@@ -101,7 +102,7 @@ ...@@ -101,7 +102,7 @@
</select> </select>
</div> </div>
</div> </div>
<!-- 5.date select and file upload --> <!-- 5. row -> date select and file upload -->
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="date-input-start">Startdatum</label> <label for="date-input-start">Startdatum</label>
...@@ -118,6 +119,7 @@ ...@@ -118,6 +119,7 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 2nd col of inputs -->
<div class="col-md-4"> <div class="col-md-4">
<div class="form-row h-50 p-1"> <div class="form-row h-50 p-1">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
...@@ -139,7 +141,7 @@ ...@@ -139,7 +141,7 @@
type="text-area" type="text-area"
class="form-control h-75" class="form-control h-75"
id="mess" id="mess"
v-model="Message" v-model="patientStudent.Message"
required required
> >
</textarea> </textarea>
...@@ -172,14 +174,14 @@ export default { ...@@ -172,14 +174,14 @@ export default {
City: '', City: '',
ZIPcode: '', ZIPcode: '',
selectedCountry: 'Germany' selectedCountry: 'Germany'
} },
Message: ''
}, },
SickNote: { SickNote: {
diagnose: '', diagnose: '',
StartDate: new Date().getDate(), StartDate: new Date().getDate(),
EndDate: new Date().getDate() EndDate: new Date().getDate()
}, },
Message: '',
countries: countries:
[ [
{ name: 'Afghanistan', code: 'AF' }, { name: 'Afghanistan', code: 'AF' },
...@@ -439,18 +441,18 @@ export default { ...@@ -439,18 +441,18 @@ export default {
const sizeLimit = 2000000 // 2 megabyte const sizeLimit = 2000000 // 2 megabyte
const fileExtension = file.name.split('.').pop() const fileExtension = file.name.split('.').pop()
console.log(fileExtension) console.log(fileExtension)
if (!allowedExtentions.includes(fileExtension)) { // extention validation if (!allowedExtentions.includes(fileExtension)) { // check extention validation
this.$refs.file.value = null // delete the file from selection this.$refs.file.value = null // delete the file from selection
Swal.fire({ Swal.fire({ // rise up an Alret
title: 'Fehler!', title: 'Fehler!',
text: 'Die Datei muss jpg, jpeg, png oder pdf', text: 'Die Datei muss jpg, jpeg, png oder pdf',
icon: 'error', icon: 'error',
confirmButtonColor: '#1a4273', confirmButtonColor: '#1a4273',
background: '#dadada' background: '#dadada'
}) })
} else if (file.size > sizeLimit) { // size validation } else if (file.size > sizeLimit) { // check size validation
this.$refs.file.value = null this.$refs.file.value = null
Swal.fire({ Swal.fire({ // rise up an Alret
title: 'Fehler!', title: 'Fehler!',
text: 'Die Datei ist zu Groß', text: 'Die Datei ist zu Groß',
icon: 'error', icon: 'error',
...@@ -476,8 +478,7 @@ export default { ...@@ -476,8 +478,7 @@ export default {
// FormData is a dictionary type -> (key , value) // FormData is a dictionary type -> (key , value)
formData.append('patientStudent', JSON.stringify(this.patientStudent)) formData.append('patientStudent', JSON.stringify(this.patientStudent))
formData.append('SickNote', JSON.stringify(this.SickNote)) formData.append('SickNote', JSON.stringify(this.SickNote))
formData.append('Message', JSON.stringify(this.Message)) // add file to the post request body
// add file to the message body
formData.append('sickNoteEvidence', this.EvidenceFile) formData.append('sickNoteEvidence', this.EvidenceFile)
// perform the post request // perform the post request
...@@ -490,7 +491,7 @@ export default { ...@@ -490,7 +491,7 @@ export default {
const data = res.data const data = res.data
console.log(data) console.log(data)
// trigger alert the the form is accepted // trigger alert that the form was accepted
Swal.fire({ Swal.fire({
title: 'Gesandet!', title: 'Gesandet!',
text: 'Danke für Ihre Meldung', text: 'Danke für Ihre Meldung',
...@@ -498,6 +499,7 @@ export default { ...@@ -498,6 +499,7 @@ export default {
confirmButtonColor: '#1a4273', confirmButtonColor: '#1a4273',
background: '#dadada' background: '#dadada'
}) })
// reset the form // reset the form
event.target.reset() event.target.reset()
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment