Skip to content

Commit

Permalink
Calculation delete and restore to interface works
Browse files Browse the repository at this point in the history
History accessibility improvements
Tab icon added
  • Loading branch information
ratmir-delas committed Jan 14, 2024
1 parent 7e2d238 commit 3a988fc
Show file tree
Hide file tree
Showing 10 changed files with 175 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public ResponseEntity<?> createCalculation(@RequestBody Calculation calculation)
}


// @PutMapping("/update/{id}")
// public void updateCalculation(@PathVariable Integer id) {
// Calculation calculation = calculationService.getCalculation(id);
// calculation.setName("Updated name");
// calculationService.updateCalculation(id, calculation);
// }
@PutMapping("/update/{id}")
public ResponseEntity<?> updateCalculation(@PathVariable Integer id, @RequestBody Calculation calculation) {
// Logic to save the calculation
Calculation savedCalculation = calculationService.updateCalculation(id, calculation);
return ResponseEntity.ok(savedCalculation);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,18 @@ public Calculation saveCalculation(Calculation calculation) {
return calculation;
}

// public void updateCalculation(Integer id, Calculation calculation) {
// Calculation calculationToUpdate = calculationRepository.findById(id).orElseThrow();
// calculationToUpdate.setName(calculation.getName());
// calculationToUpdate.setInitialAmount(calculation.getInitialAmount());
// calculationToUpdate.setContributionAmount(calculation.getContributionAmount());
// calculationToUpdate.setContributionFrequency(calculation.getContributionFrequency());
// calculationRepository.save(calculationToUpdate);
// }
public Calculation updateCalculation(Integer id, Calculation calculation) {
Calculation calculationToUpdate = calculationRepository.findById(id).orElseThrow();
calculationToUpdate.setName(calculation.getName());
calculationToUpdate.setContributionAmount(calculation.getContributionAmount());
calculationToUpdate.setContributionFrequency(calculation.getContributionFrequency());
calculationToUpdate.setCapitalizationFrequency(calculation.getCapitalizationFrequency());
calculationToUpdate.setInterestRate(calculation.getInterestRate());
calculationToUpdate.setCreatedAt(calculation.getCreatedAt());
calculationToUpdate.setIncomeTaxRate(calculation.getIncomeTaxRate());
calculationToUpdate.setInflationRate(calculation.getInflationRate());
calculationToUpdate.setInitialDeposit(calculation.getInitialDeposit());
calculationRepository.save(calculationToUpdate);
return calculationToUpdate;
}
}
3 changes: 2 additions & 1 deletion src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ simulator.tax=Tax
simulator.maxValueReached=Maximum value reached
simulator.enterCalculationName=Enter calculation name
simulator.alreadyExists=Already exists
simulator.Delete=Delete
simulator.delete=Delete
simulator.calculationNameRequired=Calculation name is required
simulator.inflation=Inflation
history.delete=Delete

# History
history.title=History
Expand Down
32 changes: 18 additions & 14 deletions src/main/resources/static/assets/css/simulator.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ label {
}

#sub-container-history {
width: 85%;
width: 100%;
margin: auto;
}

Expand All @@ -50,10 +50,6 @@ label {
margin-top: 1.5em;
}

#btn-export-csv {
/*float: right;*/
}


/*////////// Responsiveness /////////////////*/
/* Laptop */
Expand Down Expand Up @@ -108,13 +104,13 @@ label {
margin: auto;
}

#btn-export-csv {
margin-bottom: 2em;
}

.container-export {
width: 100%;
}

.history-additional-info-tablet {
display: none;
}
}

/* Smartphones in landscape mode */
Expand All @@ -138,13 +134,13 @@ label {
margin: auto;
}

#btn-export-csv {
margin-bottom: 2em;
}

.container-export {
width: 100%;
}

.history-additional-info-tablet {
display: none;
}
}

/* Smartphones in portrait mode */
Expand Down Expand Up @@ -182,7 +178,15 @@ label {
width: 100%;
}

.history-additional-info {
.history-additional-info-smartphone {
display: none;
}

.history-additional-info-tablet {
display: none;
}

.button-history-delete {
display: none;
}
}
Binary file added src/main/resources/static/assets/img/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3a988fc

Please sign in to comment.