'use strict';

/**
 *
 *
 * @author Zhong
 * @date 2018/5/29
 * @version
 */
import BaseController from "../../common/base/base_controller";
import mongoose from 'mongoose';
let config = require("../../../config/config.js");
const billsGuideLibModel = mongoose.model('std_billsGuidance_lib');
import { checkCompilationPermission } from '../../common/base/base_util';

class ViewsController extends BaseController {
    redirectMain(req, res) {
        res.render('maintain/billsGuidance_lib/html/main.html',
            {
                userAccount: req.session.managerData.username
            });
    }
    async redirectGuidance(req, res) {
        const lib = await billsGuideLibModel.findOne({ ID: req.query.libID, deleted: false }).lean();
        checkCompilationPermission(req, res, lib.compilationId, '/billsGuidance/main')
        res.render('maintain/billsGuidance_lib/html/zhiyin.html',
            {
                userAccount: req.session.managerData.username,
                LicenseKey: config.getLicenseKey(process.env.NODE_ENV)
            });
    }
}

export default ViewsController;
