Changeset 9280859


Ignore:
Timestamp:
02/01/23 22:35:56 (21 months ago)
Author:
Gjoko <goko_kostadinov@…>
Branches:
master
Children:
cc52b09
Parents:
044bd76
Message:

Adding search by date on homepage.

Location:
src/main
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/edu/gjoko/schedlr/controllers/HomePageController.java

    r044bd76 r9280859  
    11package edu.gjoko.schedlr.controllers;
    22
     3import edu.gjoko.schedlr.entity.Search;
    34import org.springframework.stereotype.Controller;
    45import org.springframework.ui.Model;
    56import org.springframework.web.bind.annotation.GetMapping;
     7import org.springframework.web.bind.annotation.ModelAttribute;
    68import org.springframework.web.bind.annotation.PostMapping;
    79
     
    1012
    1113    @GetMapping(name = "/homepage")
    12     public String getHomePageTemplate(Model model) {
     14    public String getHomePageTemplate(Model model, @ModelAttribute("search")Search search ) {
     15        model.addAttribute("search", search);
    1316        return "homepage";
    1417    }
    1518
    1619    @PostMapping(name = "/homepage")
    17     public String postHomePageTemplate(Model model) {
     20    public String postHomePageTemplate(Model model, @ModelAttribute("search")Search search) {
     21        model.addAttribute("search", search);
     22        return "homepage";
     23    }
     24
     25    @GetMapping("/search")
     26    public String getAppointments(Model model, @ModelAttribute("search")Search search) {
     27        model.addAttribute("search", search);
    1828        return "homepage";
    1929    }
  • src/main/resources/static/js/homepage.js

    r044bd76 r9280859  
    4545            right: 'prev,next today'
    4646        },
    47         editable: true,
     47        editable: false,
    4848        edit: function (start, end, allDay) {
    4949
    5050        },
    5151        firstDay: 1, //  1(Monday) this can be changed to 0(Sunday) for the USA system
    52         selectable: true,
     52        selectable: false,
    5353        defaultView: 'agendaWeek',
    5454
     
    8282            calendar.fullCalendar('unselect');
    8383        },
    84         droppable: true, // this allows things to be dropped onto the calendar !!!
     84        droppable: false, // this allows things to be dropped onto the calendar !!!
    8585        drop: function(date, allDay) { // this function is called when something is dropped
    8686
  • src/main/resources/templates/homepage.html

    r044bd76 r9280859  
    77    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    88
     9    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet" />
     10    <!-- Google Fonts -->
     11    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
     12    <!-- MDB -->
     13    <link href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/5.0.0/mdb.min.css" rel="stylesheet" />
    914
    1015    <link href='css/fullcalendar.css' rel='stylesheet'/>
    1116    <link href='css/fullcalendar.print.css' rel='stylesheet' media='print'/>
     17    <link href="css/homepage.css" rel="stylesheet" />
    1218</head>
    1319<body>
     
    1521    <div id='calendar'></div>
    1622    <div style='clear:both'></div>
     23</div>
     24
     25<div class="">
     26    <div class="card">
     27        <div class="card-body py-5 px-md-5">
     28            <form th:action="@{/search}" method="get" th:object="${search}">
     29                <div>
     30                    <label for="student-birth-date">Date of search:</label>
     31                    <input type="date" th:field="${search.date}" id="student-birth-date"/>
     32                </div>
     33                <div>
     34                    <button type="submit" class="button">Search</button>
     35                </div>
     36            </form>
     37        </div>
     38    </div>
    1739</div>
    1840<script src='js/jquery-1.10.2.js' type="text/javascript"></script>
Note: See TracChangeset for help on using the changeset viewer.