Changeset 1e7126f


Ignore:
Timestamp:
08/24/23 02:28:14 (15 months ago)
Author:
DenicaKj <dkorvezir@…>
Branches:
master
Children:
bcb4acc
Parents:
40935d3
Message:

fix

Location:
src/main
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/config/WebSecurityConfig.java

    r40935d3 r1e7126f  
    3434                .antMatchers("/","/films","/home/projections","/home/events","/home/getProjections/**","/home/films","/home/getFilm/**","/getFilm/**","/home/getEvent/**","/getEvent/**","/login","/events","/projections" ,"/home", "/assets/**", "/register", "/registerWorker","/api/**").permitAll()
    3535                .antMatchers("/","/finishRegister","/registerWorker","/films","/home/projections","/home/events","/home/getProjections/**","/home/films","/home/getFilm/**","/getFilm/**","/home/getEvent/**","/getEvent/**","redirect:/login","/login","/events","/projections" ,"/home", "/assets/**", "/register", "/api/**").permitAll()
    36                 .antMatchers("/home/getSeats/**","/myTickets","/home/addInterestedEvent/**","/home/deleteInterestedEvent/**","/home/addRating/**","/addRating/**","/getProjection/**","/home/makeReservation","/profileUser").hasRole("USER")
     36                .antMatchers("/home/getSeats/**","/myTickets","/home/addInterestedEvent/**","/home/deleteInterestedEvent/**","/home/addRating/**","/addRating/**","/getProjection/**","/home/makeReservation","/profileUser","/cancelTicket/**").hasRole("USER")
     37                .antMatchers("/profileWorker").hasRole("WORKER")
    3738                .antMatchers("/**").hasRole("ADMIN")
    3839                .anyRequest()
  • src/main/java/com/example/moviezone/model/Discount.java

    r40935d3 r1e7126f  
    2929    String type;
    3030    Integer percent;
     31
     32    public Discount() {
     33    }
     34
     35    public Discount(LocalDate validity, String code, String type, Integer percent) {
     36        this.validity = validity;
     37        this.code = code;
     38        this.type = type;
     39        this.percent = percent;
     40    }
    3141}
  • src/main/java/com/example/moviezone/model/Projection.java

    r40935d3 r1e7126f  
    88
    99import java.time.LocalDate;
     10import java.time.LocalDateTime;
    1011
    1112@Getter
     
    2021    Integer id_projection;
    2122
    22     LocalDate date_time_start;
     23    LocalDateTime date_time_start;
    2324    String type_of_technology;
    24     LocalDate date_time_end;
     25    LocalDateTime date_time_end;
    2526    @ManyToOne
    2627    @JoinColumn(name = "id_film")
     
    3334    Discount discount;
    3435
    35     public Projection(LocalDate date_time_start, String type_of_technology, LocalDate date_time_end, Film film) {
     36    public Projection(LocalDateTime date_time_start, String type_of_technology, LocalDateTime date_time_end, Film film, Discount discount) {
    3637        this.date_time_start = date_time_start;
    3738        this.type_of_technology = type_of_technology;
    3839        this.date_time_end = date_time_end;
    3940        this.film = film;
     41        this.discount = discount;
    4042    }
    4143
  • src/main/java/com/example/moviezone/model/Role.java

    r40935d3 r1e7126f  
    66public enum Role implements GrantedAuthority {
    77
    8     ROLE_USER, ROLE_ADMIN;
     8    ROLE_USER, ROLE_ADMIN, ROLE_WORKER;
    99
    1010    @Override
  • src/main/java/com/example/moviezone/model/Worker.java

    r40935d3 r1e7126f  
    5959    @Override
    6060    public Collection<? extends GrantedAuthority> getAuthorities() {
    61         return Collections.singletonList(Role.ROLE_ADMIN);
     61        if (position.equalsIgnoreCase("admin"))
     62            return Collections.singletonList(Role.ROLE_ADMIN);
     63        else{
     64            return Collections.singletonList(Role.ROLE_WORKER);
     65        }
    6266    }
    6367
  • src/main/java/com/example/moviezone/model/enums/GenreEnum.java

    r40935d3 r1e7126f  
    1 package com.example.moviezone.model;public enum GenreEnum {
     1package com.example.moviezone.model.enums;
     2
     3public enum GenreEnum {
     4    Animation,
     5    Adventure,
     6    Comedy,
     7    Fantasy,
     8    Crime,
     9    Drama,
     10    Thriller
    211}
  • src/main/java/com/example/moviezone/model/manytomany/ProjectionIsPlayedInRoom.java

    r40935d3 r1e7126f  
    3030    Integer idroom;
    3131
    32 
     32    public ProjectionIsPlayedInRoom(Integer idprojection, Integer idroom) {
     33        this.idprojection = idprojection;
     34        this.idroom = idroom;
     35    }
    3336}
  • src/main/java/com/example/moviezone/model/procedures/TicketsCancelClass.java

    r40935d3 r1e7126f  
    1 package com.example.moviezone.model.procedures;public class TicketsCancelClass {
     1package com.example.moviezone.model.procedures;
     2
     3import com.example.moviezone.model.Ticket;
     4
     5public class TicketsCancelClass {
     6    public Ticket ticket;
     7    public boolean canCancel;
     8
     9    public TicketsCancelClass(Ticket ticket, boolean canCancel) {
     10        this.ticket = ticket;
     11        this.canCancel = canCancel;
     12    }
     13
     14    public TicketsCancelClass() {
     15    }
    216}
  • src/main/java/com/example/moviezone/repository/DiscountRepository.java

    r40935d3 r1e7126f  
    22
    33import com.example.moviezone.model.Discount;
     4import com.example.moviezone.model.Projection;
    45import org.springframework.data.jpa.repository.JpaRepository;
     6import org.springframework.data.jpa.repository.query.Procedure;
    57
     8import javax.transaction.Transactional;
     9import java.util.List;
     10
     11@Transactional
    612public interface DiscountRepository extends JpaRepository<Discount,Integer> {
     13    @Procedure("project.getValidDiscounts")
     14    List<Discount> getValidDiscounts();
    715}
  • src/main/java/com/example/moviezone/repository/ProjectionRepository.java

    r40935d3 r1e7126f  
    1212    @Procedure("project.getProjectionsForFilms")
    1313    List<Projection> getProjectionsForFilms(int id);
     14    @Procedure("project.getProjectionsNow")
     15    List<Projection> getProjectionsNow();
    1416}
  • src/main/java/com/example/moviezone/service/CustomerService.java

    r40935d3 r1e7126f  
    77import java.util.Optional;
    88
    9 @Repository
    109public interface CustomerService {
    1110    List<Customer> findAllCustomers();
  • src/main/java/com/example/moviezone/service/DiscountService.java

    r40935d3 r1e7126f  
    1 package com.example.moviezone.service;public interface DiscountService {
     1package com.example.moviezone.service;
     2
     3import com.example.moviezone.model.Discount;
     4import org.springframework.stereotype.Repository;
     5
     6import java.time.LocalDate;
     7import java.util.List;
     8
     9
     10public interface DiscountService {
     11    Discount save(String code, String type, LocalDate validity, Integer percent);
     12    List<Discount> getValidDiscounts();
    213}
  • src/main/java/com/example/moviezone/service/Impl/DiscountServiceImpl.java

    r40935d3 r1e7126f  
    1 package com.example.moviezone.service.Impl;public class DiscountServiceImpl {
     1package com.example.moviezone.service.Impl;
     2
     3import com.example.moviezone.model.Discount;
     4import com.example.moviezone.repository.DiscountRepository;
     5import com.example.moviezone.service.DiscountService;
     6import org.springframework.stereotype.Service;
     7
     8import java.time.LocalDate;
     9import java.util.List;
     10
     11@Service
     12public class DiscountServiceImpl implements DiscountService {
     13    private final DiscountRepository discountRepository;
     14
     15    public DiscountServiceImpl(DiscountRepository discountRepository) {
     16        this.discountRepository = discountRepository;
     17    }
     18
     19    @Override
     20    public Discount save(String code, String type, LocalDate validity, Integer percent) {
     21        return discountRepository.save(new Discount(validity,code,type,percent));
     22    }
     23
     24    @Override
     25    public List<Discount> getValidDiscounts() {
     26        return discountRepository.getValidDiscounts();
     27    }
    228}
  • src/main/java/com/example/moviezone/service/Impl/ProjectionServiceImpl.java

    r40935d3 r1e7126f  
    11package com.example.moviezone.service.Impl;
    22
     3import com.example.moviezone.model.Discount;
    34import com.example.moviezone.model.Film;
    45import com.example.moviezone.model.Projection;
     6import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom;
     7import com.example.moviezone.repository.DiscountRepository;
    58import com.example.moviezone.repository.FilmRepository;
     9import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository;
    610import com.example.moviezone.repository.ProjectionRepository;
    711import com.example.moviezone.service.ProjectionService;
     
    913
    1014import java.time.LocalDate;
     15import java.time.LocalDateTime;
    1116import java.util.List;
    1217
     
    1419public class ProjectionServiceImpl implements ProjectionService {
    1520    private final ProjectionRepository projectionRepository;
     21    private final ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository;
    1622    private final FilmRepository filmRepository;
    17     public ProjectionServiceImpl(ProjectionRepository projectionRepository, FilmRepository filmRepository) {
     23    private final DiscountRepository discountRepository;
     24    public ProjectionServiceImpl(ProjectionRepository projectionRepository, ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository, FilmRepository filmRepository, DiscountRepository discountRepository) {
    1825        this.projectionRepository = projectionRepository;
     26        this.projectionIsPlayedInRoomRepository = projectionIsPlayedInRoomRepository;
    1927        this.filmRepository = filmRepository;
     28        this.discountRepository = discountRepository;
    2029    }
    2130
     
    3140
    3241    @Override
     42    public List<Projection> getProjectionsNow() {
     43        return projectionRepository.getProjectionsNow();
     44    }
     45
     46    @Override
    3347    public Projection findById(Integer id_projection) {
    3448        return projectionRepository.findById(id_projection).orElseThrow(RuntimeException::new);
     
    3751
    3852    @Override
    39     public Projection save(LocalDate date_time_start, LocalDate date_time_end, String type_of_technology, Integer id_film) {
     53    public Projection save(LocalDateTime date_time_start, LocalDateTime date_time_end, String type_of_technology, Integer id_film, Integer id_room, Integer id_discount) {
    4054       Film film=filmRepository.findById(id_film).orElseThrow(RuntimeException::new);
    41         return projectionRepository.save(new Projection(date_time_start,type_of_technology,date_time_end,film));
     55        Discount discount = discountRepository.findById(id_discount).orElseThrow(RuntimeException::new);
     56        Projection projection =  projectionRepository.save(new Projection(date_time_start,type_of_technology,date_time_end,film,discount));
     57        projectionIsPlayedInRoomRepository.save(new ProjectionIsPlayedInRoom(projection.getId_projection(),id_room));
     58        return projection;
    4259    }
    4360
  • src/main/java/com/example/moviezone/service/Impl/SeatServiceImpl.java

    r40935d3 r1e7126f  
    11package com.example.moviezone.service.Impl;
    22
    3 import com.example.moviezone.model.Category;
    4 import com.example.moviezone.model.Projection_Room;
    5 import com.example.moviezone.model.Seat;
    6 import com.example.moviezone.model.Ticket;
     3import com.example.moviezone.model.*;
    74import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom;
    85import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository;
     
    4340
    4441    @Override
    45     public List<Seat> findAllByRoomAndCategory(Projection_Room projectionRoom, Category category) {
     42    public List<Seat> findAllByRoomAndCategory(Projection projection, Projection_Room projectionRoom, Category category) {
    4643        List<Ticket> tickets=ticketService.findAllTickets();
    4744        List<Seat> seats=seatRepository.findAllByCategoryAndProjection(category,projectionRoom);
    48         List<Seat> s=new ArrayList<>();
    49         List<Projection_Room> projection_rooms=new ArrayList<>();
     45
    5046        for (int i = 0; i < tickets.size(); i++) {
    51             List<ProjectionIsPlayedInRoom> projectionIsPlayedInRooms= projectionIsPlayedInRoomRepository.findAllByProjectionId(tickets.get(i).getProjection().getId_projection());
    52             for (int j = 0; j < projectionIsPlayedInRooms.size(); j++) {
    53                 projection_rooms.add(projection_roomRepository.getById(projectionIsPlayedInRooms.get(j).getIdroom()));
     47            if(tickets.get(i).getProjection()==projection){
     48                if(seats.contains(tickets.get(i).getSeat())){
     49                    seats.remove(tickets.get(i).getSeat());
     50                }
    5451            }
    5552        }
    56         int f=0;
    57         for (int i = 0; i < seats.size(); i++) {
    58             for (int j = 0; j < tickets.size(); j++) {
    59                 if(seats.get(i).getId_seat().equals(tickets.get(j).getSeat().getId_seat())){
    60                     for (int k = 0; k < projection_rooms.size(); k++) {
    61                         if(seats.get(i).getProjection().getId_room().equals(projection_rooms.get(k).getId_room()))
    62                             f=1;
    63                     }
    64                 }
    65 
    66             }
    67 
    68             if(f==0){
    69                 s.add(seats.get(i));
    70             }
    71             f=0;
    72         }
    73         return s;
     53        return seats;
    7454    }
    7555
  • src/main/java/com/example/moviezone/service/Impl/TicketServiceImpl.java

    r40935d3 r1e7126f  
    4848        return ticketRepository.getPriceForTicket(id);
    4949    }
     50
     51    @Override
     52    public void delete(int id) {
     53        ticketRepository.deleteById(id);
     54    }
    5055}
  • src/main/java/com/example/moviezone/service/ProjectionService.java

    r40935d3 r1e7126f  
    55
    66import java.time.LocalDate;
     7import java.time.LocalDateTime;
    78import java.util.List;
    89
     
    1011    List<Projection> findAllProjections();
    1112    List<Projection> getProjectionsForFilms(int id);
     13    List<Projection> getProjectionsNow();
    1214    Projection findById(Integer id_projection);
    13 Projection save(LocalDate date_time_start,LocalDate date_time_end, String type_of_technology, Integer id_film );
     15    Projection save(LocalDateTime date_time_start, LocalDateTime date_time_end, String type_of_technology, Integer id_film, Integer id_room, Integer id_discount);
    1416}
  • src/main/java/com/example/moviezone/service/SeatService.java

    r40935d3 r1e7126f  
    22
    33import com.example.moviezone.model.Category;
     4import com.example.moviezone.model.Projection;
    45import com.example.moviezone.model.Projection_Room;
    56import com.example.moviezone.model.Seat;
     
    1112    List<Seat> findAllSeats();
    1213    List<Seat> findAllByProjection_Room(Projection_Room projection_room);
    13     List<Seat> findAllByRoomAndCategory(Projection_Room projectionRoom, Category category);
     14    List<Seat> findAllByRoomAndCategory(Projection projection, Projection_Room projectionRoom, Category category);
    1415    Optional<Seat> getSeatById(int id);
    1516}
  • src/main/java/com/example/moviezone/service/TicketService.java

    r40935d3 r1e7126f  
    1313    Ticket save(long price,Customer customer);
    1414    Integer priceForTicket(int id);
     15    void delete(int id);
    1516}
  • src/main/java/com/example/moviezone/web/HomeController.java

    r40935d3 r1e7126f  
    33
    44import com.example.moviezone.model.*;
     5import com.example.moviezone.model.enums.GenreEnum;
    56import com.example.moviezone.model.exceptions.PasswordsDoNotMatchException;
    67
     
    1011import com.example.moviezone.model.procedures.FilmsReturnTable;
    1112
     13import com.example.moviezone.model.procedures.TicketsCancelClass;
    1214import com.example.moviezone.service.*;
    1315import org.springframework.format.annotation.DateTimeFormat;
     
    2224import java.io.IOException;
    2325import java.time.LocalDate;
     26import java.time.LocalDateTime;
     27import java.time.temporal.ChronoUnit;
     28import java.util.ArrayList;
    2429import java.util.Collections;
    2530import java.util.LinkedList;
     
    4752private final Projection_RoomService projectionRoomService;
    4853private final CustomerIsInterestedInEventService customerIsInterestedInEventService;
    49 
    50     public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService, CinemaService cinemaService, CinemaOrganizesEventService cinemaOrganizesEventService, CinemaPlaysFilmService cinemaPlaysFilmService, ProjectionIsPlayedInRoomService projectionIsPlayedInRoomService, CategoryService categoryService, SeatService seatService, CustomerService customerService, Projection_RoomService projectionRoomService, CustomerIsInterestedInEventService customerIsInterestedInEventService)
     54private final DiscountService discountService;
     55
     56    public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService, CinemaService cinemaService, CinemaOrganizesEventService cinemaOrganizesEventService, CinemaPlaysFilmService cinemaPlaysFilmService, ProjectionIsPlayedInRoomService projectionIsPlayedInRoomService, CategoryService categoryService, SeatService seatService, CustomerService customerService, Projection_RoomService projectionRoomService, CustomerIsInterestedInEventService customerIsInterestedInEventService, DiscountService discountService)
    5157    {
    5258
     
    6773        this.projectionRoomService = projectionRoomService;
    6874        this.customerIsInterestedInEventService = customerIsInterestedInEventService;
     75        this.discountService = discountService;
    6976    }
    7077
     
    127134        model.addAttribute("category",category);
    128135
    129         List<Seat> seats=seatService.findAllByRoomAndCategory(projectionRoomService.getRoomByProjection(projection.getId_projection()).get(0),category);
     136        List<Seat> seats=seatService.findAllByRoomAndCategory(projection,projectionRoomService.getRoomByProjection(projection.getId_projection()).get(0),category);
    130137        model.addAttribute("seats",seats);
    131138        model.addAttribute("bodyContent", "seats");
     
    231238    public String getFilmsPage1(Model model,@RequestParam(required = false) Integer id_cinema){
    232239        model.addAttribute("cinemas",cinemaService.findAllCinemas());
     240        model.addAttribute("genres", GenreEnum.values());
    233241        if (id_cinema!=null) {
    234242            model.addAttribute("films",filmService.getFilmsFromCinema(id_cinema));
     
    272280    {
    273281        Customer customer=customerService.findByUsername(request.getRemoteUser());
    274         model.addAttribute("tickets",ticketService.findAllByCustomer(customer));
     282        List<Ticket> tickets = ticketService.findAllByCustomer(customer);
     283        List<TicketsCancelClass> ticketsCancelClass = new ArrayList<>();
     284        LocalDateTime oneDayLater = LocalDateTime.now().plus(1, ChronoUnit.DAYS);
     285        for (int i = 0; i < tickets.size(); i++) {
     286            if(tickets.get(i).getProjection().getDate_time_start().isAfter(oneDayLater)){
     287                ticketsCancelClass.add(new TicketsCancelClass(tickets.get(i),true));
     288            }else{
     289                ticketsCancelClass.add(new TicketsCancelClass(tickets.get(i),false));
     290            }
     291        }
     292        model.addAttribute("tickets",ticketsCancelClass);
    275293        model.addAttribute("bodyContent","myTickets");
    276294        return "master-template";
    277295    }
     296
     297    @PostMapping("/cancelTicket/{id}")
     298    public String getSeats(@PathVariable Long id, Model model) {
     299        ticketService.delete(id.intValue());
     300        return "redirect:/myTickets";
     301    }
     302
    278303    @GetMapping("/addProjection")
     304    @Transactional
    279305    public  String getAddProjectionPage(Model model)
    280306    {
    281307        model.addAttribute("films",filmService.findAllFilms());
     308        model.addAttribute("projection_rooms", projectionRoomService.findAllProjectionRooms());
     309        model.addAttribute("discounts",discountService.getValidDiscounts());
    282310        model.addAttribute("bodyContent","addProjection");
    283311        return "master-template";
    284312    }
    285 
    286 
     313    @GetMapping("/addDiscount")
     314    public  String getAddDiscountPage(Model model)
     315    {
     316        model.addAttribute("bodyContent","addDiscount");
     317        return "master-template";
     318    }
    287319    @GetMapping("/addEvent")
    288320    public  String getAddEventPage(Model model)
     
    298330    }
    299331
     332    @PostMapping("/addD")
     333    public String saveEvent(@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate validity,
     334                            @RequestParam String type,
     335                            @RequestParam String code,
     336                            @RequestParam Integer percent)
     337    {
     338        discountService.save(code,type,validity,percent);
     339        return "redirect:/home";
     340    }
     341
    300342    @PostMapping("/addP")
    301     public String saveProjection(@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date_time_start,
    302                                  @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date_time_end,
     343    public String saveProjection(@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime date_time_start,
     344                                 @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime date_time_end,
    303345                                 @RequestParam String type_of_technology,
    304                                  @RequestParam Integer id_film)
    305     {
    306         projectionService.save(date_time_start,date_time_end,type_of_technology,id_film);
     346                                 @RequestParam Integer id_film,
     347                                @RequestParam Integer id_room,
     348                                @RequestParam Integer id_discount)
     349    {
     350        projectionService.save(date_time_start,date_time_end,type_of_technology,id_film,id_room,id_discount);
    307351         return "redirect:/home";
    308352    }
     
    350394        return "master-template";
    351395    }
     396
    352397    @PostMapping("/addCinemaOrganizesEvent")
    353398    public String saveCinemaOrganizesEvent(@RequestParam Integer id_cinema,
     
    356401
    357402       cinemaOrganizesEventService.save(id_cinema,id_event);
    358         return "redirect:/home";
     403       return "redirect:/home";
    359404    }
    360405    @GetMapping("/addFilmToCinema")
  • src/main/resources/templates/addDiscount.html

    r40935d3 r1e7126f  
    1 <!DOCTYPE html>
    2 <html lang="en">
    3 <head>
    4   <meta charset="UTF-8">
    5   <title>$Title$</title>
    6 </head>
    7 <body>
    8 $END$
    9 </body>
    10 </html>
     1<th:block xmlns:th="http://www.thymeleaf.org">
     2    <div style="color: white" class="container">
     3        <h1 class="jumbotron-heading">Додани нов попуст</h1>
     4        <div class="row">
     5            <div class="col-md-5">
     6                <form action="/home/addD" method="POST">
     7                    <div class="form-group">
     8                        <label for="code">Код</label>
     9                        <input type="text"
     10                               class="form-control"
     11                               id="code"
     12                               name="code"
     13                               required
     14                               placeholder="внеси код">
     15                    </div>
     16                    <div class="form-group">
     17                        <label for="validity">Валиндост</label>
     18                        <input type="date"
     19                               class="form-control"
     20                               id="validity"
     21                               name="validity"
     22                               placeholder="Валидност">
     23                    </div>
     24                    <div class="form-group">
     25                        <label for="type">Тип</label>
     26                        <input type="text"
     27                               class="form-control"
     28                               id="type"
     29                               name="type"
     30                               placeholder="Тип">
     31                    </div>
     32                    <div class="form-group">
     33                        <label for="percent">Процент</label>
     34                        <input type="number"
     35                               class="form-control"
     36                               id="percent"
     37                               name="percent"
     38                        >
     39                    </div>
     40                    <button style="background-color: #ff5019" id="submit" type="submit" class="btn btn-primary">Додади</button>
     41                </form>
     42            </div>
     43
     44        </div>
     45
     46    </div>
     47
     48</th:block>
  • src/main/resources/templates/addProjection.html

    r40935d3 r1e7126f  
    1717                    <div class="form-group">
    1818                        <label for="date_time_start">Почетен датум</label>
    19                         <input type="date"
     19                        <input type="datetime-local"
    2020                               class="form-control"
    2121                               id="date_time_start"
     
    2525                    <div class="form-group">
    2626                        <label for="date_time_end">Краен датум</label>
    27                         <input type="date"
     27                        <input type="datetime-local"
    2828                               class="form-control"
    2929                               id="date_time_end"
     
    4141                        </select>
    4242                    </div>
    43 
     43                    <div class="form-group">
     44                        <label>Сала</label>
     45                        <select name="id_room" id="pr" class="form-control">
     46                            <option
     47                                    th:each="pr : ${projection_rooms}"
     48                                    th:value="${pr.id_room}"
     49                                    th:text="${pr.projection_room_number} + '-' + ${pr.cinema.name}">
     50                            </option>
     51                        </select>
     52                    </div>
     53                    <div class="form-group">
     54                        <label>Попуст</label>
     55                        <select name="id_discount" id="f2" class="form-control">
     56                            <option
     57                                    th:each="d : ${discounts}"
     58                                    th:value="${d.id_discount}"
     59                                    th:text="${d.type} + '-' + ${d.percent}">
     60                            </option>
     61                        </select>
     62                    </div>
    4463                    <button style="background-color: #ff5019" id="submit" type="submit" class="btn btn-primary">Додади</button>
    4564                </form>
  • src/main/resources/templates/films.html

    r40935d3 r1e7126f  
    216216
    217217    </div>
     218        <div class="form-group">
     219            <label style="color: white;font-size: 20px;font-weight: bold">Избери Жарн:</label>
     220            <select name="id_cinema" class="form-control" id="id_cinema">
     221                <option
     222                        th:selected="${genres.get(1)}"
     223                        th:each="genre : ${genres}"
     224                        th:value="${}"
     225                        th:text="${cinema.getName()}">
     226                </option>
     227            </select>
     228
     229        </div>
    218230        <button class="button" type="submit">Filter</button>
    219231    </form>
     
    223235        <div    th:if="${films.isEmpty()} == false"
    224236                th:each="film : ${films}" class="container">
    225             <div class="card">
     237            <div class="card" style="margin-left: 2%;margin-bottom: 2%">
    226238                <div class="imgBx">
    227239                    <img th:src="@{${film.getUrl()}}"/>
  • src/main/resources/templates/fragments/header.html

    r40935d3 r1e7126f  
    6969            <li class="begin"><a href="/myTickets">Мои Карти</a></li>
    7070        </th:block>
    71         <th:block sec:authorize="hasAuthority('ROLE_ADMIN')">
    72         <li class="begin"><a href="/workers">Вработени</a></li>
    73         </th:block>
    74         <th:block sec:authorize="hasAuthority('ROLE_ADMIN')">
    75         <li class="begin"><a href="/addProjection">Нова Проекција</a></li>
    76         </th:block>
    77         <th:block sec:authorize="hasAuthority('ROLE_ADMIN')">
    78         <li class="begin"><a href="/addFilm">Нов Филм</a></li>
    79         </th:block>
    80         <th:block sec:authorize="hasAuthority('ROLE_ADMIN')">
    81         <li class="begin"><a href="/addEvent">Нов Настан</a></li>
     71
     72        <th:block sec:authorize="hasAuthority('ROLE_ADMIN')" th:if="${#request.getRemoteUser()}">
     73            <li class="nav-item dropdown" style="width: 20px">
     74                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="padding: 0">
     75                </a>
     76                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
     77                    <a class="dropdown-item" href="/workers">Вработени</a>
     78                    <a class="dropdown-item" href="/addProjection">Нова Проекција</a>
     79                    <a class="dropdown-item" href="/addFilm">Нов Филм</a>
     80                    <a class="dropdown-item" href="/addEvent">Нов Настан</a>
     81                    <a class="dropdown-item" href="/addDiscount">Нов Попуст</a>
     82                </div>
     83            </li>
    8284        </th:block>
    8385    </ul>
    8486    <ul class="menu-right">
    8587        <th:block sec:authorize="hasAuthority('ROLE_ADMIN')" th:if="${#request.getRemoteUser() != null}">
     88            <li class="reg">
     89                <a href="/profileWorker">
     90                    <th:block th:text="${#request.getRemoteUser()}"></th:block>
     91                </a>
     92            </li>
     93        </th:block>
     94        <th:block sec:authorize="hasAuthority('ROLE_WORKER')" th:if="${#request.getRemoteUser() != null}">
    8695            <li class="reg">
    8796                <a href="/profileWorker">
  • src/main/resources/templates/myTickets.html

    r40935d3 r1e7126f  
    2929    <div class="row">
    3030        <div class="col-12 mt-3" style="padding-left:100px;height:75%;">
    31             <div class="card" th:each="ticket : ${tickets}" style=" border-radius: 30px;width:92%;align-self:center">
     31            <div class="card" th:each="t : ${tickets}" style=" border-radius: 30px;width:92%;align-self:center; margin-bottom: 5%">
    3232                <div class="card-horizontal" >
    3333                    <div class="card-body">
     
    3636                            <div>
    3737                                <span>Филм:</span>
    38                                 <span th:text="${ticket.projection.film.name}"></span></div>
     38                                <span th:text="${t.ticket.projection.film.name}"></span></div>
    3939                            <div>
    4040                                <span>Почеток на проекција: </span>
    41                                 <span th:text="${ticket.projection.date_time_start}"></span></div>
     41                                <span th:text="${t.ticket.projection.date_time_start}"></span></div>
    4242                            <div>
    4343                                <span>Крај на проекција: </span>
    44                                 <span th:text="${ticket.projection.date_time_end}"></span></div>
     44                                <span th:text="${t.ticket.projection.date_time_end}"></span></div>
    4545                        </h4>
    4646
    47                         <p class="card-text" th:text="${ticket.projection.type_of_technology}"></p>
    48                         <span>Број на седиште: </span><p class="card-text" th:text="${ticket.seat.seat_number}"></p>
    49                         <span>Цена: </span><p class="card-text" th:text="${ticket.price}"></p>
     47                        <p class="card-text" th:text="${t.ticket.projection.type_of_technology}"></p>
     48                        <span>Број на седиште: </span><p class="card-text" th:text="${t.ticket.seat.seat_number}"></p>
     49                        <span>Цена: </span><p class="card-text" th:text="${t.ticket.price}"></p>
    5050                    </div>
    5151                </div>
    5252                <div class="card-footer" style="border-bottom-right-radius:30px;border-bottom-left-radius:30px">
    5353                    <small>
    54                         <form th:action="@{'/home/getSeats/{id}' (id=${ticket.id_ticket})}"
    55                               th:method="GET">
    56                             <--button th:if="${ticket.projection.date_time_start != null and #dates.isBefore(java.time.LocalDateTime.of(ticket.projection.date_time_start, java.time.LocalTime.MIN).toInstant(java.time.ZoneOffset.UTC).toEpochMilli(), java.util.Date.from(java.time.LocalDate.now().atStartOfDay(java.time.ZoneId.systemDefault()).toInstant()).getTime())}" class="button" type="submit">Откажи</--button>
     54                        <form th:action="@{'/cancelTicket/{id}' (id=${t.ticket.id_ticket})}"
     55                              th:method="POST">
     56                            <button th:if="${t.canCancel}" class="button" type="submit">Откажи</button>
    5757                        </form>
    5858
Note: See TracChangeset for help on using the changeset viewer.