package com.bohuikeji.delivery.backstage.controller.views;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bohuikeji.delivery.backstage.entity.*;
import com.bohuikeji.frame.module.admin.base.PageTemplateControllerBase;
import com.bohuikeji.frame.module.admin.entity.back.PageEntity;
import com.bohuikeji.frame.module.admin.entity.web.block.ButtonBlock;
import com.bohuikeji.frame.module.admin.entity.web.template.TableTemplate;
import com.bohuikeji.frame.module.admin.enums.ButtonBlockEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * 钱包模块
 * @author 10552
 */
@Slf4j
@Controller
@RequestMapping("/views")
public class StoreWalletPage extends PageTemplateControllerBase {

    /**
     * 加盟商管理-门店管理页面
     *
     * @return
     */
    @GetMapping("/table/franchisee/store")
    public PageEntity toFranchiseeStore() {
        TableTemplate pageTemplate = (TableTemplate) createPage(TableTemplate.class);
        QueryWrapper<TStoreWallet> queryWrapper = getFranQueryWrapper();
        pageTemplate.setQueryWrapper(queryWrapper);
        List<ButtonBlock> buts = new ArrayList<>(0);
        pageTemplate.setBatchButton(buts);
        session.setAttribute("pageTemplate", pageTemplate);
        return PageEntity.page("/table/index");
    }

    /**
     * 门店钱包记录
     *
     * @return
     */
    @GetMapping("/table/store/cash")
    public PageEntity cashWallet() {
        TableTemplate pageTemplate = (TableTemplate) createPage(TableTemplate.class);
        QueryWrapper<TStoreWallet> queryWrapper = getFranQueryWrapper();
        pageTemplate.setQueryWrapper(queryWrapper);
        List<ButtonBlock> buts = new ArrayList<>(0);
        pageTemplate.setBatchButton(buts);
        session.setAttribute("pageTemplate", pageTemplate);
        return PageEntity.page("/storewallet/store_wallet");
    }

    /**
     * 门店钱包记录
     *
     * @return
     */
    @GetMapping("/table/store/exam")
    public PageEntity examWallet() {
        TableTemplate pageTemplate = (TableTemplate) createPage(TableTemplate.class);
        QueryWrapper<TStoreWallet> queryWrapper = getFranQueryWrapper();
        pageTemplate.setQueryWrapper(queryWrapper);
        List<ButtonBlock> buts = new ArrayList<>(0);
        pageTemplate.setBatchButton(buts);
        session.setAttribute("pageTemplate", pageTemplate);
        return PageEntity.page("/table/index");
    }

    /**
     * 门店钱包明细
     *
     * @return
     */
    @GetMapping("/table/store/detail")
    public PageEntity storeWalletDetail() {
        TableTemplate pageTemplate = (TableTemplate) createPage(TableTemplate.class);
        QueryWrapper<TStoreWalletDetail> queryWrapper = getFranQueryWrapper();
        pageTemplate.setQueryWrapper(queryWrapper);
        List<ButtonBlock> buts = new ArrayList<>(0);
        pageTemplate.setBatchButton(buts);
        session.setAttribute("pageTemplate", pageTemplate);
        return PageEntity.page("/table/index");
    }

    /**
     * 派送员工作考核
     * @return
     */
    @GetMapping("/table/work/ment")
    public PageEntity workAssessment() {
        TableTemplate pageTemplate = (TableTemplate) createPage(TableTemplate.class);
        QueryWrapper<TCourierWorkExam> queryWrapper = getFranQueryWrapper();
        pageTemplate.setQueryWrapper(queryWrapper);
        List<ButtonBlock> buts = new ArrayList<>(0);
        buts.add(ButtonBlock.createButton(ButtonBlockEnum.ADD, "新增考核"));
        pageTemplate.setBatchButton(buts);
        session.setAttribute("pageTemplate", pageTemplate);
        return PageEntity.page("/table/index");
    }


}
