/**
 * Created by Zhong on 2017/8/3.
 */
import BaseController from "../../common/base/base_controller";
let config = require("../../../config/config.js");
class ViewsController extends BaseController{
    redirectMain(req, res){
        res.render('maintain/ration_repository/main.html',
            {
                userAccount: req.session.managerData.username,
                userID: req.session.managerData.userID
            });
    }
    //rationRepository/lmm rationRepository/coeList rationRepository/installation
    redirectRation(req, res){
        const repId = req.query.repository;
        const redirectGlj = `/rationRepository/lmm?repository=${repId}`;
        const redirectCoe = `/rationRepository/coeList?repository=${repId}`;
        const redirectInstallation = `/rationRepository/installation?repository=${repId}`;
        res.render('maintain/ration_repository/dinge.html',
            {
                userAccount: req.session.managerData.username,
                userID: req.session.managerData.userID,
                redirectGlj: redirectGlj,
                redirectCoe: redirectCoe,
                redirectInstallation: redirectInstallation,
                LicenseKey:config.getLicenseKey(process.env.NODE_ENV)
            });
    }
    redirectGlj(req, res){
        const repId = req.query.repository;
        const redirectRation = `/rationRepository/ration?repository=${repId}`;
        const redirectCoe = `/rationRepository/coeList?repository=${repId}`;
        const redirectInstallation = `/rationRepository/installation?repository=${repId}`;
        res.render('maintain/ration_repository/gongliao.html',
            {
                userAccount: req.session.managerData.username,
                userID: req.session.managerData.userID,
                redirectRation: redirectRation,
                redirectCoe: redirectCoe,
                redirectInstallation: redirectInstallation,
                LicenseKey:config.getLicenseKey(process.env.NODE_ENV)
            });
    }
    redirectCoeList(req, res){
        const repId = req.query.repository;
        const redirectGlj = `/rationRepository/lmm?repository=${repId}`;
        const redirectRation = `/rationRepository/ration?repository=${repId}`;
        const redirectInstallation = `/rationRepository/installation?repository=${repId}`;
        res.render('maintain/ration_repository/fuzhu.html',
            {
                userAccount: req.session.managerData.username,
                userID: req.session.managerData.userID,
                redirectGlj: redirectGlj,
                redirectRation: redirectRation,
                redirectInstallation: redirectInstallation,
                LicenseKey:config.getLicenseKey(process.env.NODE_ENV)
            });
    }
    redirectInstallation(req, res){
        const repId = req.query.repository;
        const redirectGlj = `/rationRepository/lmm?repository=${repId}`;
        const redirectCoe = `/rationRepository/coeList?repository=${repId}`;
        const redirectRation = `/rationRepository/ration?repository=${repId}`;
        res.render('maintain/ration_repository/anzhuang.html',
            {
                userAccount: req.session.managerData.username,
                userID: req.session.managerData.userID,
                redirectGlj: redirectGlj,
                redirectCoe: redirectCoe,
                redirectRation: redirectRation,
                LicenseKey:config.getLicenseKey(process.env.NODE_ENV)
            });
    }
}

export default ViewsController;