Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PStA WP2 OmarElkadi1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Omar Elkadi
PStA WP2 OmarElkadi1
Commits
42a3ec0d
Commit
42a3ec0d
authored
3 years ago
by
Omar Elkadi
Browse files
Options
Downloads
Patches
Plain Diff
Add message and diagnose to SickForm and Server
parent
00686ee2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
server/src/routes/patientRoutes.ts
+10
-10
10 additions, 10 deletions
server/src/routes/patientRoutes.ts
src/views/SickForm.vue
+56
-21
56 additions, 21 deletions
src/views/SickForm.vue
with
67 additions
and
31 deletions
.gitignore
+
1
−
0
View file @
42a3ec0d
.DS_Store
node_modules
server/uploads
/dist
...
...
This diff is collapsed.
Click to expand it.
server/src/routes/patientRoutes.ts
+
10
−
10
View file @
42a3ec0d
...
...
@@ -47,26 +47,26 @@ export class patientRoutes {
// parse JSON to Objects
var
patientStudent
=
JSON
.
parse
(
body
.
patientStudent
);
var
sickNote
=
JSON
.
parse
(
body
.
sickNoteData
);
var
sickNote
=
JSON
.
parse
(
body
.
SickNote
);
var
message
=
JSON
.
parse
(
body
.
Message
);
var
sicknessReport
=
{
patientStudent
,
sickNote
};
const
file
=
req
.
file
;
if
(
!
file
)
{
console
.
log
(
"
not file error
"
);
}
res
.
status
(
200
)
.
send
(
"
the body and the file are recived
"
+
JSON
.
stringify
(
body
));
const
path
=
"
./uploads/reports/
"
+
patientStudent
.
MatrikelNumber
+
"
.json
"
;
var
sicknessReport
=
{
patientStudent
,
sickNote
,
message
,
sickNoteFilePath
:
path
,
};
writeFile
(
path
,
JSON
.
stringify
(
sicknessReport
),
function
(
err
)
{
if
(
err
)
return
console
.
log
(
err
);
else
return
console
.
log
(
"
file generated in path:
"
+
path
);
});
res
.
status
(
200
).
send
(
"
the body and the file are recived
"
+
JSON
.
stringify
(
body
));
}
}
This diff is collapsed.
Click to expand it.
src/views/SickForm.vue
+
56
−
21
View file @
42a3ec0d
<
template
>
<form
class=
"container mb-
1
mt-
1
p-
1
border border-info rounded"
class=
"container mb-
3
mt-
3
p-
2
border border-info rounded"
@
submit.prevent=
"OnSubmit"
enctype=
"multipart/form-data"
>
<div
class=
"row"
>
<div
class=
"col-md-8"
>
<!--1. name-->
<div
class=
"form-row"
>
<div
class=
"form-group col-md-5"
>
<div
class=
"form-group col-md-5
col-sm-12 col-sm-12
"
>
<label
for=
"fname"
>
Vorname
</label>
<input
type=
"text"
...
...
@@ -16,7 +18,7 @@
required
/>
</div>
<div
class=
"form-group col-md-5"
>
<div
class=
"form-group col-md-5
col-sm-12
"
>
<label
for=
"lname"
>
Nachname
</label>
<input
type=
"text"
...
...
@@ -37,8 +39,9 @@
/>
</div>
</div>
<!--2. Email && phonenumber -->
<div
class=
"form-row"
>
<div
class=
"form-group col-md-6"
>
<div
class=
"form-group col-md-6
col-sm-12
"
>
<label
for=
"inputEmail4"
>
E-mail
</label>
<input
type=
"email"
...
...
@@ -48,7 +51,7 @@
required
/>
</div>
<div
class=
"form-group col-md-6"
>
<div
class=
"form-group col-md-6
col-sm-12
"
>
<label
for=
"phone"
>
Anrufnummer
</label>
<input
type=
"tel"
...
...
@@ -60,6 +63,7 @@
/>
</div>
</div>
<!--3. Adress street haus num -->
<div
class=
"form-row"
>
<div
class=
"form-group col-md-10"
>
<label
for=
"Street"
>
Straße
</label>
...
...
@@ -82,12 +86,13 @@
/>
</div>
</div>
<!-- 4. Adress city + country-->
<div
class=
"form-row"
>
<div
class=
"form-group col-md-2"
>
<label
for=
"inputZip"
>
Postleizahl
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputZip"
v-model=
"patientStudent.Address.ZIPcode"
required
/>
</div>
<div
class=
"form-group col-md-6"
>
<div
class=
"form-group col-md-6
col-sm-12
"
>
<label
for=
"inputCity"
>
Stadt
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputCity"
v-model=
"patientStudent.Address.City"
required
/>
</div>
...
...
@@ -100,7 +105,7 @@
</select>
</div>
</div>
<!-- 5.
Row
-->
<!-- 5.
date select and file upload
-->
<div
class=
"form-row"
>
<div
class=
"form-group col-md-4"
>
<label
for=
"date-input-start"
>
Startdatum
</label>
...
...
@@ -116,18 +121,38 @@
<input
class=
"form-control"
type=
"file"
id=
"formFile"
ref=
"file"
accept=
".pdf,.docx,image/*"
@
change=
"handleFileUpload()"
required
>
</div>
</div>
<!--
<div
class=
"form-group"
>
<div
class=
"form-check"
>
<input
class=
"form-check-input"
type=
"checkbox"
id=
"gridCheck"
/>
<label
class=
"form-check-label"
for=
"gridCheck"
>
Check me out
</label>
</div>
<div
class=
"col-md-4"
>
<div
class=
"form-row h-50 p-1"
>
<div
class=
"form-group col-md-12"
>
<label
for=
"diag"
>
Diagnose
</label>
<textarea
type=
"text-area"
class=
"form-control h-75"
id=
"diag"
v-model=
"SickNote.diagnose"
required
>
</textarea>
</div>
</div>
<div
class=
"form-row h-50 p-1"
>
<div
class=
"form-group col-md-12"
>
<label
for=
"mess"
>
Nachricht
</label>
<textarea
type=
"text-area"
class=
"form-control h-75"
id=
"mess"
v-model=
"Message"
required
>
</textarea>
</div>
</div>
-->
<button
type=
"submit"
class=
"btn btn-success"
>
Abschicken
</button>
</form>
</div>
</div>
<button
type=
"submit"
class=
"btn btn-success"
>
Abschicken
</button>
</form>
</
template
>
<
script
lang=
"ts"
>
...
...
@@ -153,9 +178,11 @@ export default {
}
},
SickNote
:
{
diagnose
:
''
,
StartDate
:
new
Date
().
getDate
(),
EndDate
:
new
Date
().
getDate
()
},
Message
:
''
,
countries
:
[
{
name
:
'
Afghanistan
'
,
code
:
'
AF
'
},
...
...
@@ -405,6 +432,7 @@ export default {
}
},
methods
:
{
// get the file in a variable and check the validation
handleFileUpload
()
{
// get the file from tag
const
file
=
this
.
$refs
.
file
.
files
[
0
]
...
...
@@ -416,7 +444,7 @@ export default {
console
.
log
(
fileExtension
)
if
(
!
allowedExtentions
.
includes
(
fileExtension
))
{
// extention validation
this
.
$refs
.
file
.
value
=
null
this
.
$refs
.
file
.
value
=
null
// delete the file from selection
Swal
.
fire
({
title
:
'
Fehler!
'
,
text
:
'
Die Datei muss jpg, jpeg, png oder pdf
'
,
...
...
@@ -445,7 +473,8 @@ export default {
// prepare and bulid the messege
// FormData is a dictionary type -> (key , value)
formData
.
append
(
'
patientStudent
'
,
JSON
.
stringify
(
this
.
patientStudent
))
formData
.
append
(
'
sickNoteData
'
,
JSON
.
stringify
(
this
.
SickNote
))
formData
.
append
(
'
SickNote
'
,
JSON
.
stringify
(
this
.
SickNote
))
formData
.
append
(
'
Message
'
,
JSON
.
stringify
(
this
.
Message
))
// add file to the message body
formData
.
append
(
'
sickNoteEvidence
'
,
this
.
EvidenceFile
)
...
...
@@ -459,7 +488,13 @@ export default {
const
data
=
res
.
data
console
.
log
(
data
)
Swal
.
fire
(
'
Danke! Das Formular wurde schon gesandet
'
)
// trigger alert the the form is accepted
Swal
.
fire
({
title
:
'
Gesandet!
'
,
text
:
'
Danke für Ihre Meldung
'
,
icon
:
'
success
'
})
// reset the form
event
.
target
.
reset
()
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment