package com.jwipc.inquiry.controller;

import com.jwipc.inquiry.dto.InquiryMaterialDTO;
import com.jwipc.inquiry.logic.InquiryMaterialLogic;
import com.jwipc.security.LoginUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;

import static com.jwipc.inquiry.constant.ModuleConst.MODULE_ROOT;

/**
 * <p>
 * 询价供应商成本报价明细 前端控制器
 * </p>
 *
 * @author shenyang.ou
 * @since 2024-02-23
 */
@Controller
@RequestMapping(MODULE_ROOT+ "/supplier/cost/quote/detail")
@RequiredArgsConstructor
public class InquirySupplierCostQuoteDetailPageController {
    private final InquiryMaterialLogic inquiryMaterialLogic;
    @GetMapping("/dialog")
    public String dialog(Model model,Long inquiryMaterialSupplierId,Long inquiryMaterialId,Integer lookFlag,String costTemplateCode,String parentFrameName) {
        InquiryMaterialDTO inquiryMaterialDTO = inquiryMaterialLogic.getById(inquiryMaterialId);
        model.addAttribute("inquiryMaterialSupplierId", inquiryMaterialSupplierId);
        model.addAttribute("lookFlag", lookFlag==1);
        model.addAttribute("costTemplateCode", costTemplateCode);
        model.addAttribute("materialCode", inquiryMaterialDTO.getMaterialCode());
        model.addAttribute("materialName", inquiryMaterialDTO.getMaterialName());
        model.addAttribute("parentFrameName", parentFrameName);
        return MODULE_ROOT + "/supplier/cost_quote";
    }
}
