Skip to content

Commit 9ff7bbf

Browse files
Monitor edit profile bug solved.
1 parent 00be4c1 commit 9ff7bbf

File tree

6 files changed

+8
-48
lines changed

6 files changed

+8
-48
lines changed

backend/src/main/java/webapp3/webapp3/controller/MonitorController.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ public String addEditedMonitor(Model model, HttpServletRequest request,
147147
@RequestParam String phone,
148148
@RequestParam String birthdayDate,
149149
@RequestParam String hiringDate,
150-
@RequestParam(required = false) Long activityName,
151150
@RequestParam String description,
152151
@RequestParam(name = "image", required = false) MultipartFile image) throws IOException {
153152
String emailName = request.getUserPrincipal().getName();
@@ -172,33 +171,6 @@ public String addEditedMonitor(Model model, HttpServletRequest request,
172171
user.getHiringDate().setYear(hiringDate.substring(0, 4));
173172
user.getHiringDate().generateSpanishFormat();
174173

175-
if (activityName == -1) {
176-
//Delete association to an activity
177-
Activity act = user.getACT1();
178-
act.setMonitorName(null);
179-
actServ.save(act);
180-
user.setACT1(null);
181-
} else if (activityName != -1 && user.getACT1() == null) {
182-
//Add activity to a monitor without previous activity
183-
Optional<Activity> activityOptional = actServ.findById(activityName);
184-
activityOptional.orElseThrow().setMonitorName(user.getName());
185-
actServ.save(activityOptional.get());
186-
user.setACT1(activityOptional.get());
187-
} else if (activityName != -1 && user.getACT1() != null && !user.getACT1().getId().equals(activityName)) {
188-
//Add activity to monitor with previous activity associated
189-
//1 -> Change monitorName in old activity
190-
if (user.getACT1() != null) {
191-
user.getACT1().setMonitorName(null);
192-
actServ.save(user.getACT1());
193-
}
194-
//2 -> Change monitor name in new Activity
195-
Optional<Activity> activityOptional = actServ.findById(activityName);
196-
activityOptional.orElseThrow().setMonitorName(user.getName());
197-
actServ.save(activityOptional.get());
198-
//3 -> Add activity to user
199-
user.setACT1(activityOptional.get());
200-
}
201-
202174
user.setDescription(description);
203175
if (!image.isEmpty())
204176
user.setImage(BlobProxy.generateProxy(image.getInputStream(), image.getSize()));

backend/src/main/resources/templates/USRADM_04AddActivity.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ <h4 class="card-title" style="color: black; margin-bottom: 20px; padding-left:9p
120120
<div class="card-body">
121121
<h4 class="card-title" style="color: black; margin-bottom: 20px;">Descripción</h4>
122122
<!-- Create the container -->
123-
<textarea style="height: 300px; color: black; width:100%" name="description">
124-
</textarea>
123+
<textarea style="height: 300px; color: black; width:100%" name="description"></textarea>
125124
</div>
126125
</div>
127126
</div>

backend/src/main/resources/templates/USRADM_07EditActivity.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ <h4 class="card-title" style="color: black; margin-bottom: 20px;">Datos generale
127127
<div class="card-body">
128128
<h4 class="card-title" style="color: black; margin-bottom: 20px;">Descripción</h4>
129129
<!-- Create the container -->
130-
<p><textarea style="height: 300px; color: black; width:100%" name="description">{{activity.description}}
131-
</textarea></p>
130+
<p><textarea style="height: 300px; color: black; width:100%" name="description">{{activity.description}}</textarea></p>
132131
</div>
133132
</div>
134133
</div>

backend/src/main/resources/templates/USRADM_11EditMonitor.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ <h4 class="page-title">Modificar información del monitor</h4>
177177
<h4 class="card-title " style="color: black; margin-bottom: 20px;">Experiencia y
178178
carrera profesional</h4>
179179
<!-- Create the editor container -->
180-
<p><textarea style="height: 300px; color: black; width:100%" name="description">{{monitor.description}}
181-
</textarea></p>
180+
<p><textarea style="height: 300px; color: black; width:100%" name="description">{{monitor.description}}</textarea></p>
182181

183182
</div>
184183
</div>

backend/src/main/resources/templates/USRMON_02Pofile.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ <h4 class="card-title " style="color: black; margin-bottom: 20px; padding-left:9
156156
<div class="card-body ">
157157
<h4 class="card-title " style="color: black; margin-bottom: 20px;">Experiencia y carrera profesional</h4>
158158
<!-- Create the editor container -->
159-
<textarea style="height: 300px; color: black; width:100%" readonly>{{monitor.description}}
160-
</textarea>
159+
<textarea style="height: 300px; color: black; width:100%" readonly>{{monitor.description}}</textarea>
161160
</div>
162161
</div>
163162
</div>

backend/src/main/resources/templates/USRMON_05EditProfile.html

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ <h4 class="page-title">Perfil</h4>
7171
<p style="color:black; " class="centerText"> Email: </p>
7272
</div>
7373
<div class="col-lg-10 col-md-8 col-12 ">
74-
<span style="color:black;">{{monitor.email}}</span>
74+
<input type="text" class="form-control " value="{{monitor.email}}" name="email" readonly/>
7575
</div>
7676
</div>
7777

@@ -133,19 +133,12 @@ <h4 class="page-title">Perfil</h4>
133133
<p style="color:black; " class="centerText"> Actividad: </p>
134134
</div>
135135
<div class="col-lg-10 col-md-8 col-12 ">
136-
<select name="activityName" type="number">
137-
138136
{{#monitor.ACT1.name}}
139-
<option value="{{monitor.ACT1.id}}" selected>{{monitor.ACT1.name}}</option>
140-
<option value="-1" >Ninguna</option>
137+
<input type="text" class="form-control " value="{{monitor.ACT1.name}}" readonly/>
141138
{{/monitor.ACT1.name}}
142139
{{^monitor.ACT1.name}}
143-
<option value="-1" selected>Ninguna</option>
140+
<input type="text" class="form-control " value="Ninguna" readonly/>
144141
{{/monitor.ACT1.name}}
145-
{{#freeAct}}
146-
<option value="{{id}}">{{name}}</option>
147-
{{/freeAct}}
148-
</select>
149142
</div>
150143
</div>
151144

@@ -177,8 +170,7 @@ <h4 class="page-title">Perfil</h4>
177170
<h4 class="card-title " style="color: black; margin-bottom: 20px;">Experiencia y
178171
carrera profesional</h4>
179172
<!-- Create the editor container -->
180-
<p><textarea style="height: 300px; color: black; width:100%" name="description">{{monitor.description}}
181-
</textarea></p>
173+
<p><textarea style="height: 300px; color: black; width:100%" name="description">{{monitor.description}}</textarea></p>
182174

183175
</div>
184176
</div>

0 commit comments

Comments
 (0)