diff --git a/README.md b/README.md new file mode 100644 index 00000000..580ad473 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +the creation of a frontend according to the task, an additionally made a modal window for Bootstrap 4 \ No newline at end of file diff --git a/src/main/java/com/game/controller/PlayerController.java b/src/main/java/com/game/controller/PlayerController.java index 362efdbb..909007ed 100644 --- a/src/main/java/com/game/controller/PlayerController.java +++ b/src/main/java/com/game/controller/PlayerController.java @@ -44,7 +44,8 @@ public Integer getAllCount() { @PostMapping public ResponseEntity createPlayer(@RequestBody PlayerInfo info) { - if (StringUtils.isEmpty(info.name) || info.name.length() > 12) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); + if (StringUtils.isEmpty(info.name) || info.name.length() > 12) + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); if (info.title.length() > 30) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); if (isNull(info.race)) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); if (isNull(info.profession)) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); @@ -64,8 +65,10 @@ public ResponseEntity createPlayer(@RequestBody PlayerInfo info) { public ResponseEntity updatePlayer(@PathVariable("ID") long id, @RequestBody PlayerInfo info) { if (id <= 0) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); - if (nonNull(info.name) && (info.name.length() > 12 || info.name.isEmpty())) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); - if (nonNull(info.title) && info.title.length() > 30) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); + if (nonNull(info.name) && (info.name.length() > 12 || info.name.isEmpty())) + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); + if (nonNull(info.title) && info.title.length() > 30) + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); Player player = playerService.updatePlayer(id, info.name, info.title, info.race, info.profession, info.banned); if (isNull(player)) { diff --git a/src/main/java/com/game/repository/PlayerRepository.java b/src/main/java/com/game/repository/PlayerRepository.java index f5de068e..8951e949 100644 --- a/src/main/java/com/game/repository/PlayerRepository.java +++ b/src/main/java/com/game/repository/PlayerRepository.java @@ -58,11 +58,12 @@ public class PlayerRepository { }}; public List getAll(int pageNumber, int pageSize) { - return storage.stream() + ListplayerList = storage.stream() .sorted(Comparator.comparingLong(Player::getId)) .skip((long) pageNumber * pageSize) .limit(pageSize) .collect(Collectors.toList()); + return playerList; } diff --git a/src/main/webapp/css/my.css b/src/main/webapp/css/my.css index e69de29b..bce51c9e 100644 --- a/src/main/webapp/css/my.css +++ b/src/main/webapp/css/my.css @@ -0,0 +1,97 @@ +.html_body { + margin-left: 2%; + background: #f5f5dc; +} + +th, td { + border: 1px solid black; + padding: 3px; +} + + +.click_active { + color: red; +} + +#table_players { + width: 96%; + margin-bottom: 20px; + border: 1px solid #dddddd; + border-collapse: collapse; +} + +#table_players th { + font-weight: bold; + padding: 5px; + background: #deb887; + border: 2px solid #8b0000; +} + +#table_players td { + border: 2px solid #555555; + padding: 5px; +} + +#table_players tbody tr:nth-child(odd) { + background: #a9a9a9; +} + +#table_players tr:nth-child(even) { + background: #dddddd; +} + +/*label*/ +#create_block .label_create { + display: inline-block; + user-select: none; + background-color: #555; + color: white; + border: 1px solid black; + padding: 3px; + font-size: 16px; + cursor: pointer; + position: relative; + height: auto; + top: 1px; + width: calc(10% - 1px); + box-sizing: border-box; +} + +#create-button { + background-color: #555; + color: white; + opacity: 0.8; + width: 80px; + height: 40px; + border: 3px solid black; + padding: 3px; + font-size: 20px; + font-style: italic; +} + +#create_block{ + background: #f5f5dc; +} + + +#data_win #create_block .label_create { + display: inline-block; + user-select: none; + background-color: #555; + color: white; + border: 1px solid black; + padding: 3px; + font-size: 16px; + cursor: pointer; + position: relative; + height: auto; + top: 1px; + width: calc(20% - 1px); + box-sizing: border-box; +} + + + + + + diff --git a/src/main/webapp/html/my.html b/src/main/webapp/html/my.html index eb66ac55..78652601 100644 --- a/src/main/webapp/html/my.html +++ b/src/main/webapp/html/my.html @@ -1,11 +1,394 @@ - + RPG + + + + + + + - + +

RPG admin panel

+ + + + + + + + + + + + + + + + + +
#NameTitleRaceProfessionBirthdayBannedLevelEditDelete
+
+ Pages: +
+ +

Create new account

+
+Creating a new account using a modal window, the form below will not be available +
+ +
+
+Creating a new account using the form below +
+
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+
+
+ + + +
+
+ + + + + + + + \ No newline at end of file