From f39682ce351a3e4f12a75c5cdc2ac7038a7c0d1b Mon Sep 17 00:00:00 2001 From: Ignazio Date: Sun, 29 Jun 2014 23:53:27 +0200 Subject: [PATCH] Aggiunta converti crediti + correzione bugs --- .settings/org.eclipse.core.resources.prefs | 2 + .../ai/server/controller/HomeController.java | 30 ++++- .../webapp/WEB-INF/views/convertiCrediti.jsp | 106 ++++++++++++++++++ src/main/webapp/WEB-INF/views/home.jsp | 82 ++++---------- src/main/webapp/WEB-INF/views/index.jsp | 67 +++++++---- .../resources/css/convertiCreditiStyle.css | 32 ++++++ src/main/webapp/resources/css/indexStyle.css | 14 ++- 7 files changed, 239 insertions(+), 94 deletions(-) create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 src/main/webapp/WEB-INF/views/convertiCrediti.jsp create mode 100644 src/main/webapp/resources/css/convertiCreditiStyle.css diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..b0da92b --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//src/main/webapp/WEB-INF/views/convertiCrediti.jsp=UTF-8 diff --git a/src/main/java/ai/server/controller/HomeController.java b/src/main/java/ai/server/controller/HomeController.java index dd4d0ab..4ec2973 100644 --- a/src/main/java/ai/server/controller/HomeController.java +++ b/src/main/java/ai/server/controller/HomeController.java @@ -22,25 +22,29 @@ public class HomeController { @Autowired private Dati dati; - public void setDati(Dati dati){ + public void setDati(Dati dati) { this.dati=dati; } @RequestMapping(value="/") - public ModelAndView home(HttpServletRequest request,@ModelAttribute("error")String error) throws IOException{ - - if(error!=null){ + public ModelAndView home(HttpServletRequest request, @ModelAttribute("error")String error) throws IOException { + if(error != null) { Map map = new HashMap(); map.put("dati",dati); map.put("error", error); System.out.println("home"); return new ModelAndView("index",map); - }else{ + } else { System.out.println("fatto2"); return new ModelAndView("index","dati",dati); } } + @RequestMapping(value="/home") + public ModelAndView homePage() throws IOException { + return new ModelAndView("home"); + } + @RequestMapping(value="/suggerimentoSingolo", method=RequestMethod.POST) public ModelAndView getSuggerimentoSingolo(HttpServletRequest request, Principal principal) { System.out.println("getSuggerimentoSingolo: " + request.getParameter("idInserzione")); @@ -49,4 +53,20 @@ public ModelAndView getSuggerimentoSingolo(HttpServletRequest request, Principal return new ModelAndView("suggerimentoSingolo"); } + @RequestMapping(value="/convertiCrediti", method=RequestMethod.GET) + public ModelAndView getConvertiCrediti(HttpServletRequest request, Principal principal) { + return new ModelAndView("convertiCrediti"); + } + + @RequestMapping(value="/richiediBuono", method=RequestMethod.POST) + public void richiediBuono(HttpServletRequest request, Principal principal) { + System.out.println("richiediBuono: " + request.getParameter("id_buono")); + System.out.println("richiediBuono: " + request.getParameter("valore_sconto")); + System.out.println("richiediBuono: " + request.getParameter("descrizione")); + System.out.println("richiediBuono: " + request.getParameter("costo")); + + // TODO Se si riesce, inviare una mail al tizio con il buono + // TODO Aggiornare crediti utente + } + } diff --git a/src/main/webapp/WEB-INF/views/convertiCrediti.jsp b/src/main/webapp/WEB-INF/views/convertiCrediti.jsp new file mode 100644 index 0000000..116d59c --- /dev/null +++ b/src/main/webapp/WEB-INF/views/convertiCrediti.jsp @@ -0,0 +1,106 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %> + +
+
+
+
+ +
+
+
BUONO SCONTO 5 €
+
+ Il buono è valido per i prodotti della categoria Alimentari e Prima infanzia. +

+ Validitá 15 giorni dall'emissione. +
+
Crediti necessari al riscatto: 50
+
Richiedi
+
+
+
+
+ +
+
+
BUONO SCONTO 10 €
+
+ Il buono è valido per i prodotti della categoria Tecnologia. +

+ Validitá 10 giorni dall'emissione. +
+
Crediti necessari al riscatto: 80
+
Richiedi
+
+
+
+
+ +
+
+
BUONO SCONTO 5%
+
+ Il buono è valido per tutti i prodotti. +

+ Validitá 7 giorni dall'emissione. +
+
Crediti necessari al riscatto: 100
+
Richiedi
+
+
+
+
+ +
+
+
BUONO SCONTO 50 €
+
+ Il buono è valido per tutti i prodotti dei punti vendita Ipermercato. +

+ Validitá 20 giorni dall'emissione. +
+
Crediti necessari al riscatto: 500
+
Richiedi
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/home.jsp b/src/main/webapp/WEB-INF/views/home.jsp index 9a24a9b..2a3d2ac 100644 --- a/src/main/webapp/WEB-INF/views/home.jsp +++ b/src/main/webapp/WEB-INF/views/home.jsp @@ -1,61 +1,21 @@ -<%@page import="hibernate.Inserzione"%> -<%@page import="hibernate.Profilo"%> -<%@page import="hibernate.Utente"%> -<%@page import="hibernate.Argomenti"%> -<%@page import="hibernate.ArgomentiInserzione"%> -<%@page import="org.springframework.web.servlet.support.RequestContextUtils"%> -<%@page import="org.springframework.context.ApplicationContext"%> -<%@page import="dati.Dati" %> -<%@page import="java.util.Map" %> -<%@page import="java.util.Set" %> -<%@page contentType="text/html" pageEncoding="UTF-8"%> - - - - - - - Home - <% - Dati dati = (Dati)request.getAttribute("dati"); - %> - - - <% String error = (String) request.getAttribute("error"); - if(null != error ) {%> -
<%= error %>
- <%} %> -
-

Hello World!

-

This is the homepage!

- <% for(Map.Entry u : dati.getInserzioni().entrySet()){ %> - <%= u.getValue().getDescrizione() %>
- <%= u.getValue().getProdotto().getDescrizione()%>
- <%= u.getValue().getPrezzo() %>
- <%= u.getValue().getSupermercato().getNome()%>
- <% - - for(ArgomentiInserzione ai : (Set)u.getValue().getArgomentiInserziones()){ - %> - - Argomento Inserzione - <%=ai.getArgomenti().getArgomento()+" = "+ai.getArgVal() %> - - <% } %> -
- <%} %> - - -
-
-
- - - +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %> + +
+

Benvenuto su CLEVER BUY!

+
+ Trova le offerte migliori e segnala i prodotti più convenienti. + Potrai guadagnare tanti crediti e risparmiare ancora di più. +

+ + Clever Buy è pensata per gli amanti dello shopping e del risparmio. + Potrai creare le tue liste dei desideri, durante la compilazione il sistema ti suggerirà i prodotti disponibili intorno a te al prezzo migliore. +

+ + Consulta le tue liste usando la nostra applicazione Android, è semplice, utile e GRATUITA. +

+ + Inserisci le tue inserzioni o valuta quelle che ti sono state utili, puoi guadagnare tanti crediti e ricevere buoni sconto o effettuare l'upgrade del tuo account. + La versione PREMIUM offre funzionalità di ricerca avanzate, statistiche sui prodotti e tanto altro ancora... +
+

ISCRIVITI SUBITO... è GRATIS!

+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/index.jsp b/src/main/webapp/WEB-INF/views/index.jsp index 3d9ef6d..0ee1680 100644 --- a/src/main/webapp/WEB-INF/views/index.jsp +++ b/src/main/webapp/WEB-INF/views/index.jsp @@ -24,24 +24,20 @@ " type="text/css" media="all"> " > " media="all"> - " media="all"> " media="all"> - "> "> "> "> "> +"> - - - @@ -77,11 +73,11 @@ }; function getHomePage() { - //TODO inserire redirezione alla home page + $("#header-nav-container").find(".current-menu-item").removeClass("current-menu-item"); + $("#home-menu-item").addClass("current-menu-item"); - /* $.ajax({ - url:"./", + url:"./home", type: 'GET', async: true, success: function(returnedData) { @@ -89,7 +85,6 @@ $(".post").html(returnedData); } }); - */ } function sendLogin() { @@ -178,7 +173,7 @@ $.ajax({ url:"./inserzione", type: 'GET', - async: false, + async: true, success: function(returnedData, textStatus, jqXHR) { $(".post").children().hide(); $(".post").html(returnedData); @@ -193,7 +188,7 @@ $.ajax({ url:"./valutazione", type: 'GET', - async: false, + async: true, data: { 'latitudine' : userPosition.coords.latitude, 'longitudine' : userPosition.coords.longitude @@ -212,22 +207,34 @@ $.ajax({ url:"./todolist", type: 'GET', - async: false, + async: true, success: function(returnedData, textStatus, jqXHR) { - $('#garbage').html(returnedData); $(".post").children().hide(); $('#garbage >.todolistContainer').appendTo('.post'); - - console.log(returnedData); - //$(".post").children().hide(); - //$(".post").html(returnedData); - } + } }); }; + //function getInScadenzaPage() {}; + //function getMiglioriAffariPage() {}; + + function getRiscattaCreditiPage() { + $("#header-nav-container").find(".current-menu-item").removeClass("current-menu-item"); + $("#account-menu-item").addClass("current-menu-item"); + + $.ajax({ + url:"./convertiCrediti", + type: 'GET', + async: true, + success: function(returnedData, textStatus, jqXHR) { + console.log(returnedData); + $(".post").children().hide(); + $(".post").html(returnedData); + } + }); + } - function getMiglioriAffariPage() {}; //function getModificaAccountPage() {}; //function getStatistichePage() {}; //function getPremiumPage() {}; @@ -410,9 +417,8 @@