package app.admin;

<<<<<<< HEAD
import app.service.menu.MenuService;
import spark.ModelAndView;
import spark.TemplateViewRoute;

import javax.servlet.MultipartConfigElement;
import javax.servlet.http.Part;
import java.util.HashMap;

=======
import spark.Route;
import spark.ModelAndView;
import spark.TemplateViewRoute;

>>>>>>> 4117d4c5ce7b611194f0c69f45dece8d0e3b0bc0
/**
 * Administration Controller.
 *
 * @author Bc. Jiří Ketner
 * @author Bc. David Věžník
 * @author Peter Neupauer
 * @version 1.0
 */
public class AdminController {

    /**
     * Show the application dashboard.
     */
    public static TemplateViewRoute index = (request, response) -> new ModelAndView(null, "admin/index");

    /**
     * Show the menu.
     */
    public static TemplateViewRoute menu = (request, response) -> new ModelAndView(null, "admin/menu");

    /**
     * Show the menu create form.
     */
    public static TemplateViewRoute menuCreate = (request, response) -> new ModelAndView(null, "admin/menu-create");

    /**
     * Save the menu.
     */
    public static Route menuCreatePost = (request, response) -> "TODO: menu create";

    /**
     * Show the menu import form.
     */
    public static TemplateViewRoute menuImport = (request, response) -> new ModelAndView(null, "admin/menu-import");

<<<<<<< HEAD
        if(MenuService.menuFactory(menuFile)) { // parsed successfully
            System.out.println("Soubor OK");
        } else System.out.println("Soubor NOK"); // parsing failed
=======
    /**
     * Import the menu.
     */
    public static Route menuImportPost = (request, response) -> "TODO: menu import";
>>>>>>> 4117d4c5ce7b611194f0c69f45dece8d0e3b0bc0


//    public static TemplateViewRoute uploadedMenu = (request, response) -> {
//
//
//        HashMap data = new HashMap<>();
//
//        if (request.raw().getAttribute("org.eclipse.jetty.multipartConfig") == null) {
//            MultipartConfigElement multipartConfigElement = new MultipartConfigElement(System.getProperty("java.io.tmpdir"));
//            request.raw().setAttribute("org.eclipse.jetty.multipartConfig", multipartConfigElement);
//        }
//
//        Part menuFile = request.raw().getPart("uploadMenu");
//
//        if(MenuService.saveMenu(menuFile)) { // parsed successfully
//            System.out.println("Soubor OK");
//        } else System.out.println("Soubor NOK"); // parsing failed
//
//
//        return new ModelAndView(null, "admin/uploaded-menu");
//    };


}

@@ -17,358 +17,87 @@
 n;%0A%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0Aimport app.service.menu.MenuService;%0Aimport spark.ModelAndView;%0Aimport spark.TemplateViewRoute;%0A%0Aimport javax.servlet.MultipartConfigElement;%0Aimport javax.servlet.http.Part;%0Aimport java.util.HashMap;%0A%0A=======%0Aimport spark.Route;%0Aimport spark.ModelAndView;%0Aimport spark.TemplateViewRoute;%0A%0A%3E%3E%3E%3E%3E%3E%3E 4117d4c5ce7b611194f0c69f45dece8d0e3b0bc0
+import spark.ModelAndView;%0Aimport spark.Route;%0Aimport spark.TemplateViewRoute;%0A
 %0A/**
@@ -1031,212 +1031,12 @@
 %22);%0A
-%0A%3C%3C%3C%3C%3C%3C%3C HEAD%0A        if(MenuService.menuFactory(menuFile)) %7B // parsed successfully%0A            System.out.println(%22Soubor OK%22);%0A        %7D else System.out.println(%22Soubor NOK%22); // parsing failed%0A=======
+    
 %0A   
@@ -1161,57 +1161,8 @@
 t%22;%0A
-%3E%3E%3E%3E%3E%3E%3E 4117d4c5ce7b611194f0c69f45dece8d0e3b0bc0%0A
 %0A%0A//

fix AdminController