/**
 * Created by vian on 2017/3/17.
 */
let express = require("express");
let billsRouter =express.Router();
const ViewsPermContr = require('../controllers/views_permissionController');
const BillsLibPermContr = require('../controllers/stdBillsLib_permissionController');
const BillsPermContr = require('../controllers/bills_permissionController');
const JobsPermContr = require('../controllers/jobs_permissionController');
const ItemsPermContr = require('../controllers/items_permissionController');
let viewsContr = new ViewsPermContr();
let billsLibContr = new BillsLibPermContr();
let billsContr = new BillsPermContr();
let jobsContr = new JobsPermContr();
let itemsContr = new ItemsPermContr();


module.exports =function (app) {
    app.get("/stdBillsmain", viewsContr.init, viewsContr.redirectStdBillsMain);
    app.get("/stdBills", viewsContr.init, viewsContr.redirectStdBills);
    app.get('/stdJobs', viewsContr.init, viewsContr.redirectStdJobs);
    app.get('/stdItems', viewsContr.init, viewsContr.redirectStdItems);

    billsRouter.post('/getCompilationList', billsLibContr.init, billsLibContr.getCompilationList);
    billsRouter.post('/getMaxNumber', billsLibContr.init, billsLibContr.getMaxNumber);
    billsRouter.post('/getABillsLib', billsLibContr.init, billsLibContr.getABillsLib);
    billsRouter.post("/getStdBillsLib", billsLibContr.init, billsLibContr.getStdBillsLib);
    billsRouter.post("/createStdBillsLib", billsLibContr.init, billsLibContr.createStdBillsLib);
    billsRouter.post("/deleteStdBillsLib", billsLibContr.init, billsLibContr.deleteStdBillsLib);
    billsRouter.post("/renameStdBillsLib", billsLibContr.init, billsLibContr.renameStdBillsLib);
    billsRouter.post("/getStdBillsLibName", billsLibContr.init, billsLibContr.getStdBillsLibName);

    billsRouter.post("/upMove",  billsContr.init, billsContr.upMove);
    billsRouter.post("/downMove",  billsContr.init, billsContr.downMove);
    billsRouter.post("/getCurrentUniqId", billsContr.init, billsContr.getCurrentUniqId);
    billsRouter.post("/getBills",billsContr.init, billsContr.getBills);
    billsRouter.post("/createBills", billsContr.init, billsContr.createBills);
    billsRouter.post("/updatePNId", billsContr.init, billsContr.updatePNId);
    billsRouter.post("/upLevel", billsContr.init, billsContr.upLevel);
    billsRouter.post("/downLevel", billsContr.init, billsContr.downLevel);
    billsRouter.post("/updateBills", billsContr.init, billsContr.updateBills);
    billsRouter.post("/updateBillsArr", billsContr.init, billsContr.updateBillsArr);
    billsRouter.post("/removeTotal", billsContr.init, billsContr.removeTotal);
    billsRouter.post("/updateSerialNo", billsContr.init, billsContr.updateSerialNo);
    billsRouter.post("/pasteBills", billsContr.init, billsContr.pasteBills);
    billsRouter.post('/updateRecharge', billsContr.init, billsContr.updateRecharge);
    billsRouter.post('/pasteRel', billsContr.init, billsContr.pasteRel);
    billsRouter.post("/deleteBills", billsContr.init, billsContr.deleteBills);

    billsRouter.post("/getJobContent", jobsContr.init, jobsContr.getJobContent);
    billsRouter.post("/createJobContent", jobsContr.init, jobsContr.createJobContent);
    billsRouter.post("/updateJobContent", jobsContr.init, jobsContr.updateJobContent);
    billsRouter.post("/deleteJobContent", jobsContr.init, jobsContr.deleteJobContent);
    billsRouter.post("/pasteJobs", jobsContr.init, jobsContr.pasteJobs);
    billsRouter.post("/edCreateJob", jobsContr.init, jobsContr.edCreateJob);
    billsRouter.post("/edUpdateJob", jobsContr.init, jobsContr.edUpdateJob);

    billsRouter.post("/getItemCharacter", itemsContr.init, itemsContr.getItemCharacter);
    billsRouter.post("/createItemCharacter", itemsContr.init, itemsContr.createItemCharacter);
    billsRouter.post("/updateItemCharacter", itemsContr.init, itemsContr.updateItemCharacter);
    billsRouter.post("/updateValue", itemsContr.init, itemsContr.updateValue);
    billsRouter.post("/deleteItemCharacter", itemsContr.init, itemsContr.deleteItemCharacter);
    billsRouter.post("/pasteItems", itemsContr.init, itemsContr.pasteItems);
    billsRouter.post("/pasteValues", itemsContr.init, itemsContr.pasteValues);
    billsRouter.post("/edCreateItem", itemsContr.init, itemsContr.edCreateItem);
    billsRouter.post("/edUpdateItem", itemsContr.init, itemsContr.edUpdateItem);

    billsRouter.post('/getStdBillsByCode', billsContr.init, billsContr.getStdBillsByCode);
    billsRouter.post('/getBillsByQueries', billsContr.init, billsContr.getBillsByQueries);

    app.use("/stdBillsEditor", billsRouter);

}


