package com.supplier.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 页面
 */
@Controller
@RequestMapping("page")
public class IndexController {

    /**
     * 主页
     * @param model
     * @return
     */
    @RequestMapping("/index")
    public String index(Model model, String token){
        model.addAttribute("token", token);
        return "indexHome";
    }

    /**
     * 首页统计
     * @param model
     * @return
     */
    @RequestMapping("/homeIndex")
    public String homeIndex(Model model){
        return "home/index";
    }

    /**
     * 首页轮播
     * @param model
     * @return
     */
    @RequestMapping("/honePageIndex")
    public String honePageIndex(Model model){
        return "homePage/index";
    }

    /**
     * 需求单列表
     * @param model
     * @return
     */
    @RequestMapping("/demandForSingleIndex")
    public String demandForSingleIndex(Model model, String idVal){
        model.addAttribute("idVal", idVal);
        return "demandForSingle/index";
    }

    /**
     * 提供报价
     * @param model
     * @return
     */
    @RequestMapping("/demandForSingleOffer")
    public String demandForSingleOffer(Model model, String uuid){
        model.addAttribute("uuid", uuid);
        return "demandForSingle/offer";
    }

    /**
     * 查看方案
     * @param model
     * @param uuid
     * @return
     */
    @RequestMapping("/planLook")
    public String planLook(Model model, String uuid){
        model.addAttribute("uuid", uuid);
        return "demandForSingle/planLook";
    }

    /**
     * 交通信息
     * @param model
     * @param uuid
     * @return
     */
    @RequestMapping("/trafficUpload")
    public String trafficUpload(Model model, String uuid){
        model.addAttribute("uuid", uuid);
        return "demandForSingle/trafficUpload";
    }

    /**
     * 路线发布
     * @param model
     * @return
     */
    @RequestMapping("/releaseModel")
    public String releaseModel(Model model, String type, String uuid){
        model.addAttribute("uuid", uuid);
        model.addAttribute("type", type);
        return "release/index";
    }

    /**
     * 路线发布
     * @param model
     * @return
     */
    @RequestMapping("/releaseIndex")
    public String releaseIndex(Model model, String uuid){
        model.addAttribute("uuid", uuid);
        return "release/indexPage";
    }

    /**
     * 个人信息
     * @param model
     * @return
     */
    @RequestMapping("/personalIndex")
    public String personalIndex(Model model){
        return "personal/index";
    }

    /**
     * 退款申请
     * @param model
     * @return
     */
    @RequestMapping("/refundIndex")
    public String refundIndex(Model model, String idVal){
        model.addAttribute("idVal", idVal);
        return "refund/index";
    }

    /**
     * 个人信息
     * @param model
     * @return
     */
    @RequestMapping("/ceshi")
    public String ceshi(Model model){
        return "personal/ceshi";
    }

    /**
     * 注册
     * @param model
     * @return
     */
    @RequestMapping("registered/{phone}")
    public String registered(Model model, @PathVariable String phone){
        model.addAttribute("phone", phone);
        return "registered/index";
    }

    /**
     * 新增人员
     * @param model
     * @return
     */
    @RequestMapping("/personnel")
    public String personnel(Model model){
        return "permissions/index";
    }

    /**
     * 权限树
     * @param model
     * @return
     */
    @RequestMapping("/modify")
    public String modify(Model model,String id){
        model.addAttribute("id", id);
        return "permissions/modify";
    }
}
