From bf9ce2ace5040e1471a2b9f009b3d82743065a68 Mon Sep 17 00:00:00 2001 From: hoa3 Date: Wed, 29 May 2024 14:22:24 +0200 Subject: [PATCH] fix: input mask styling --- .../add-institution.component.html | 178 +++++++---- .../add-institution.component.scss | 283 +++++++++--------- .../add-institution.component.ts | 22 +- 3 files changed, 269 insertions(+), 214 deletions(-) diff --git a/frontend/src/app/add-institution/add-institution.component.html b/frontend/src/app/add-institution/add-institution.component.html index 23d06d7..7a43e05 100644 --- a/frontend/src/app/add-institution/add-institution.component.html +++ b/frontend/src/app/add-institution/add-institution.component.html @@ -2,11 +2,7 @@
Institution Form
-
+ The Documents in the Database are matched using the uuid. This means that if you make changes to the Institution with an existing uuid, the Data from this Institution will be overwritten! If the uuid is new (there is no @@ -31,7 +27,7 @@
- Abbreviated name (Shortname) + Short name
-
+
UUID -
- -
- - *UUID is a required field. - - - Sie befinden sich im Bearbeitungsmodus, die uuid bestehender - Institutionen sollte nicht abgeändert werden - +
+ + *UUID is a required field. + + + Sie befinden sich im Bearbeitungsmodus, die uuid bestehender + Institutionen sollte nicht abgeändert werden +
- Sector - + + Sector + + IT + Communities + Insurances + Banking + Media + FoodBeverage + Pharma + Others + Gov_Companies + Gov_Federal + Gov_Cantons + Gov_Cities + NGOs + ResearchAndEducation + FoodBeverage/Others + City + + - Timestamp - +
+ Timestamp (Last time Institution was crawled) + +
@@ -116,31 +143,69 @@

Add Organization(s)

placeholder="e.g.Tecan Genomics" formControlName="name" /> - -
- - +
+ - + +
+ + + @@ -194,20 +259,7 @@

Add Organization(s)

- - - - +
Edit + + Name_de Edit - -
diff --git a/frontend/src/app/add-institution/add-institution.component.scss b/frontend/src/app/add-institution/add-institution.component.scss index 88064a6..b57d66a 100644 --- a/frontend/src/app/add-institution/add-institution.component.scss +++ b/frontend/src/app/add-institution/add-institution.component.scss @@ -1,176 +1,161 @@ @import "../../styles/colors.scss"; -/* Adjust container to be a flex container */ .wrapper { display: flex; flex-wrap: wrap; gap: 20px; } -/* Adjust the container and table sizes */ -.container { - flex: 1 1 45%; /* Adjust the form to be 50% smaller */ - max-width: 700px; /* Optional, based on your design */ -} - .table-container { - flex: 1 1 45%; /* Adjust the table container to fit beside the form */ + flex: 1 1 45%; + overflow: scroll; + max-height: 1000px; } - - -/* Responsive adjustments */ @media screen and (max-width: 1200px) { .container, .table-container { - flex: 1 1 100%; /* Stack the form and table vertically on smaller screens */ + flex: 1 1 100%; } } -/* Define a class for the Name_de column to control its width */ .mat-column-name_de { - width: 300px; /* Set the desired width */ - max-width: 1000px; /* Ensure it doesn't grow larger */ - word-wrap: break-word; /* Wrap text if it overflows */ + width: 300px; + max-width: 1000px; + word-wrap: break-word; } - .container { - position: relative; - max-width: 700px; - width: 100%; - background: #fff; - padding: 20px 50px; - border-radius: 5px; - margin-bottom: 20px; - box-shadow: - 0px -5px 10px -5px #9e9e9e, - 5px 0px 10px -5px #9e9e9e, - 0px 5px 10px -5px #9e9e9e, - -5px 0px 10px -5px #9e9e9e; - } - .container header { - font-size: 1.5rem; - color: #333; - font-weight: 500; - text-align: center; - } - .container .form { - margin-top: 20px; - padding: 20px; - } - .form .input-box { - width: 100%; - margin-top: 10px; - } - .input-box label { - color: #333; - } - .form :where(.input-box input, .select-box) { - position: relative; - height: 50px; - width: 100%; - outline: none; - font-size: 1rem; - color: #707070; - margin-top: 8px; - /* border: 1px solid #ddd; */ - border-radius: 10px; - padding: 0 15px; - } - .input-box input:focus { - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); - } - .form .column { - display: flex; - column-gap: 50px; - } + position: relative; + max-width: 700px; + width: 100%; + background: #fff; + padding: 20px 50px; + border-radius: 5px; + margin-bottom: 20px; + box-shadow: 0px -5px 10px -5px #9e9e9e, 5px 0px 10px -5px #9e9e9e, 0px 5px 10px -5px #9e9e9e, -5px 0px 10px -5px #9e9e9e; + flex: 1 1 25%; +} - .form .submit-btn { - height: 55px; - width: 100%; - color: #fff; - font-size: 1rem; - font-weight: 400; - margin-top: 30px; - border: none; - border-radius: 5px; - cursor: pointer; - transition: all 0.2s ease; - background: #888; - } +.container header { + font-size: 1.5rem; + color: #333; + font-weight: 500; + text-align: center; + line-height: 200%; +} - .form .submit-btn:hover { - background: #555; - } - .form .delete-btn { - height: 55px; - width: 100%; - color: #fff; - font-size: 1rem; - font-weight: 400; - margin-top: 30px; - border: none; - border-radius: 5px; - cursor: pointer; - transition: all 0.2s ease; - background: #d82222; - } +.input-box { + width: 100%; + margin-top: 10px; +} - .form .delete-btn:hover { - background: #da6565; - } - /*Responsive*/ - @media screen and (max-width: 500px) { - .form .column { - flex-wrap: wrap; - } - .form :where(.gender-option, .gender) { - row-gap: 15px; - } - } - - .form-shadow{ - box-shadow: rgba(187, 185, 185, 0.35) 0px 5px 15px; - } - - input.ng-invalid.ng-touched{ - border: #673ab7 1px solid; - } - - small{ - color: #673ab7; - font-weight: bold; - } - - .btn-add-delete{ - margin: 10px 0px; - padding: 14px 30px; - border-radius: 5px; - background: #888; - border: none; - cursor: pointer; - color: white; - - } - .form .btn-add-delete:hover { - background: #555; - } - .orgs{ - padding: 20px 0px; - } +.input-box label { + color: #333; +} - span{ - padding: 5px 5px; - font-weight: bold; - } - - input.ng-invalid.ng-touched{ - border: #673ab7 1px solid; - } - .container.VALID{ - border: green 2px solid; +.input-box input, .select-box { + height: 50px; + width: 100%; + outline: none; + font-size: 1rem; + color: #707070; + margin-top: 8px; + border-radius: 10px; + padding: 0 15px; +} + +.input-box input:focus { + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); +} + +.column { + display: flex; + column-gap: 50px; +} + +.submit-btn, .delete-btn, .btn-add-delete, .inside-btn { + height: 50%; + width: 20%; + color: #fff; + font-size: small; + font-weight: 400; + margin-top: 30px; + border: none; + border-radius: 5px; + cursor: pointer; + transition: all 0.2s ease; + text-align: center; +} + +.submit-btn { + background: #888; +} + +.submit-btn:hover { + background: #555; +} + +.delete-btn { + background: #d82222; +} + +.delete-btn:hover { + background: #da6565; +} + +.btn-add-delete { + margin: 10px 0px; + padding: 14px 30px; + background: #888; +} + +.btn-add-delete:hover, .inside-btn:hover { + background: #555; +} + +@media screen and (max-width: 500px) { + .column { + flex-wrap: wrap; } - .container.INVALID{ - border: #673ab7 1px solid; + .gender-option, .gender { + row-gap: 15px; } +} + +.form-shadow { + box-shadow: rgba(187, 185, 185, 0.35) 0px 5px 15px; +} + +input.ng-invalid.ng-touched { + border: #673ab7 1px solid; +} + +small { + color: #673ab7; + font-weight: bold; +} + +span { + padding: 5px 5px; + font-weight: bold; +} + +.container.VALID { + border: green 2px solid; +} + +.container.INVALID { + border: #673ab7 1px solid; +} + +.button-container { + position: relative; +} + +.inside-btn { + position: absolute; + background: #888; + top: 5%; + right: 1px; +} diff --git a/frontend/src/app/add-institution/add-institution.component.ts b/frontend/src/app/add-institution/add-institution.component.ts index c30ccec..fa69a59 100644 --- a/frontend/src/app/add-institution/add-institution.component.ts +++ b/frontend/src/app/add-institution/add-institution.component.ts @@ -16,13 +16,13 @@ export class AddInstitutionComponent implements OnInit { reactiveForm: FormGroup; dataSource: any; displayedColumns: string[] = [ + 'edit', 'name_de', 'uuid', 'sector', 'shortname', 'ts', 'orgs', - 'edit', ]; constructor(private dataService: DataService) {} @@ -48,7 +48,7 @@ export class AddInstitutionComponent implements OnInit { ts: new FormControl(null), orgs: new FormArray([ new FormGroup({ - name: new FormControl(null, [Validators.required]), + name: new FormControl(null, [Validators.required, Validators.pattern(/^(\S*)$/)]), ts_org: new FormControl(null), }), ]), @@ -75,6 +75,10 @@ export class AddInstitutionComponent implements OnInit { }, ], }); + // reload the data after adding a new institution + this.dataService.LoadTodoInstitutions().then((data) => { + this.dataSource = data; + }); } AddOrg() { @@ -132,6 +136,11 @@ export class AddInstitutionComponent implements OnInit { }, ], }); + // reload the data after deleting an institution + this.dataService.LoadTodoInstitutions().then((data) => { + this.dataSource = data; + }); + } generateUUID(): void { @@ -149,5 +158,14 @@ export class AddInstitutionComponent implements OnInit { deactivateEditMode(): void { this.isEditMode = false; } +// set the timestamp value to null if reset button is clicked + resetTimestamp() { + this.reactiveForm.get('ts').setValue(null); + const orgsControl = this.reactiveForm.get('orgs'); + for (let i = 0; i < orgsControl.length; i++) { + const orgFormGroup = orgsControl.at(i); + orgFormGroup.get('ts_org').setValue(null); + } + } }