mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
Merge branch 'master' of https://github.com/suhf/No1WMS
# Conflicts: # src/main/java/com/no1/wms/vendor/VendorDto.java # src/main/resources/mappers/VendorMapper.xml # src/main/webapp/WEB-INF/views/vendor/create.jsp # src/main/webapp/WEB-INF/views/vendor/list.jsp # src/main/webapp/WEB-INF/views/vendor/read.jsp # src/main/webapp/WEB-INF/views/vendor/update.jsp
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package com.no1.wms.account;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.no1.wms.authority.AuthorityDto;
|
||||
import com.no1.wms.authority.AuthorityService;
|
||||
import com.no1.wms.utils.ConstantValues;
|
||||
@@ -11,7 +9,6 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@@ -27,11 +24,32 @@ public class AccountController {
|
||||
AuthorityService authorityService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public ModelAndView list(ModelAndView mav, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "0") int start){
|
||||
public ModelAndView list(ModelAndView mav,@RequestParam(defaultValue = "0") int searchn, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "1") int page){
|
||||
int perPage = 10;
|
||||
int startRow = (page - 1) * perPage;
|
||||
int count = accountService.count(searchn, search, startRow, perPage);
|
||||
|
||||
List<AccountDto> list = accountService.selectAll(search, start, ConstantValues.PER_PAGE);
|
||||
|
||||
int pageNum = 4;//보여질 페이지 번호 수
|
||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
|
||||
|
||||
|
||||
|
||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||
List<AccountDto> list = accountService.selectAll(searchn, search, searchn, perPage);
|
||||
|
||||
int begin = (page - 1) / pageNum * pageNum + 1;
|
||||
int end = begin + pageNum - 1;
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
mav.addObject("list", list);
|
||||
mav.addObject("end", end);
|
||||
mav.addObject("searchn", searchn);
|
||||
mav.addObject("search", search);
|
||||
mav.addObject("page", startRow);
|
||||
mav.addObject("begin", begin);
|
||||
mav.setViewName("account/list");
|
||||
return mav;
|
||||
}
|
||||
@@ -120,7 +138,7 @@ public class AccountController {
|
||||
}else if(name.equals("dept")){
|
||||
list = accountService.selectDeptAll(search, start, ConstantValues.PER_PAGE);
|
||||
}else if(name.equals("pos")){
|
||||
list = accountService.selectPosAll(search, start, ConstantValues.PER_PAGE);
|
||||
list = accountService.selectPosAll(10, search, start);
|
||||
}
|
||||
//
|
||||
mav.addObject("list", list);
|
||||
|
||||
@@ -31,4 +31,6 @@ public interface AccountMapper {
|
||||
int delete(AccountDto dto);
|
||||
|
||||
AccountDto selectByLogin(AccountDto dto);
|
||||
|
||||
int count(Map<String, Object> m);
|
||||
}
|
||||
|
||||
@@ -29,11 +29,12 @@ public class AccountService {
|
||||
return mapper.selectById(dto);
|
||||
}
|
||||
|
||||
public List<AccountDto> selectAll(String search, int start, int perPage){
|
||||
public List<AccountDto> selectAll(int searchn, String search, int start, int perPage){
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("search", search);
|
||||
map.put("start", start);
|
||||
map.put("perPage", perPage);
|
||||
map.put("searchn", searchn);
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +50,7 @@ public class AccountService {
|
||||
return mapper.selectDeptAll(map);
|
||||
}
|
||||
|
||||
List<PositionDto> selectPosAll(String search, int start, int perPage){
|
||||
List<PositionDto> selectPosAll(int perPage, String search, int start){
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("search", search);
|
||||
map.put("start", start);
|
||||
@@ -69,4 +70,13 @@ public class AccountService {
|
||||
return mapper.selectByLogin(dto);
|
||||
}
|
||||
|
||||
int count(int searchn, String search, int start, int perPage){
|
||||
HashMap<String, Object> m = new HashMap<>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
return mapper.count(m);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class AuthAspect {
|
||||
|
||||
|
||||
AuthData authData = auth.get(packageName);
|
||||
if(packageName.equals("base")){
|
||||
if(packageName.equals("base") || packageName.equals("mypage")){
|
||||
return joinPoint.proceed();
|
||||
}else if( authData != null ){
|
||||
String methodName = joinPoint.getSignature().getName().toLowerCase();
|
||||
|
||||
@@ -202,6 +202,8 @@ public class CategoryController {
|
||||
return "modal/categorysearch";
|
||||
};
|
||||
|
||||
|
||||
//서식 다운로드
|
||||
@GetMapping("/category/downlodeCategoryForm")
|
||||
public void downlodeCategoryForm (HttpServletResponse response) throws IOException{
|
||||
String categoryFormName = "카테고리 데이터 입력 서식.xlsx";
|
||||
|
||||
@@ -166,4 +166,6 @@ public class PriceController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
import com.no1.wms.category.CategoryService;
|
||||
import com.no1.wms.price.PriceDto;
|
||||
import com.no1.wms.vendor.VendorDto;
|
||||
import com.no1.wms.vendor.VendorService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/product")
|
||||
@@ -26,6 +28,8 @@ public class ProductController {
|
||||
ProductService productService;
|
||||
@Autowired
|
||||
CategoryService categoryService;
|
||||
@Autowired
|
||||
VendorService service;
|
||||
|
||||
/*
|
||||
@GetMapping("list")
|
||||
@@ -141,7 +145,7 @@ public class ProductController {
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, ModelAndView m, String name) {
|
||||
int count = categoryService.count(searchn, search);
|
||||
|
||||
int perPage = 10; // 한 페이지에 보일 글의 개수
|
||||
int perPage =9; // 한 페이지에 보일 글의 개수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
List<CategoryDto> dto = categoryService.categoryList2(searchn, search, startRow ,perPage);
|
||||
@@ -172,6 +176,44 @@ public class ProductController {
|
||||
|
||||
|
||||
|
||||
@PostMapping("/show_modal2")
|
||||
public ModelAndView vendorShowModal(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, ModelAndView m, String name) {
|
||||
|
||||
int count = service.count(searchn, search);
|
||||
|
||||
int perPage = 9; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||
List<VendorDto> dto = service.list(searchn, search, startRow ,perPage);
|
||||
|
||||
|
||||
m.addObject("vlist", dto);
|
||||
m.addObject("start", startRow + 1);
|
||||
|
||||
int pageNum = 5;//보여질 페이지 번호 수
|
||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
|
||||
int begin = (page - 1) / pageNum * pageNum + 1;
|
||||
int end = begin + pageNum - 1;
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
m.addObject("searchn", searchn);
|
||||
m.addObject("search", search);
|
||||
m.addObject("begin", begin);
|
||||
m.addObject("end", end);
|
||||
m.addObject("pageNum", pageNum);
|
||||
m.addObject("totalPages", totalPages);
|
||||
m.addObject("p" , page);
|
||||
m.setViewName(name);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -63,8 +63,14 @@
|
||||
acc.birth, acc.telephone, acc.address, acc.activation,
|
||||
auth2.name group_auth_name, auth.name personal_auth_name
|
||||
from account acc join authority auth join authority auth2 on acc.personal_authority_id = auth.id and acc.group_authority_id = auth2.id
|
||||
where acc.name like concat('%',#{search},'%')
|
||||
order by acc.activation desc, acc.id desc limit #{start}, #{perPage}
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> acc.activation = 1 and acc.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> acc.activation = 1 and acc.employee_number like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
order by acc.id desc limit #{start}, #{perPage}
|
||||
|
||||
</select>
|
||||
<insert id="insert" parameterType="accountDto">
|
||||
insert into account
|
||||
@@ -134,4 +140,15 @@
|
||||
<update id="delete" parameterType="accountDto">
|
||||
update account SET activation = false WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||||
select count(*) from ( SELECT 1 from account
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 1"> activation = 1 and name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 0"> activation = 1 and employee_number like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
order by id desc limit #{start}, #{perPage} ) t
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -49,6 +49,14 @@
|
||||
|
||||
}
|
||||
|
||||
function onPaging(target){
|
||||
const p = $(target).data("p");
|
||||
$("#pPage").val(p);
|
||||
const $form = $("#search_form");
|
||||
$form.attr("action", "/account/list");
|
||||
$form.trigger("submit");
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@@ -66,6 +74,21 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="search" align="center">
|
||||
<form id="search_form">
|
||||
<select name="searchn">
|
||||
<option <c:if test="${searchn == 0}">selected="selected"</c:if> value="0">사번</option>
|
||||
<option <c:if test="${searchn == 1}">selected="selected"</c:if> value="1">사원명</option>
|
||||
</select>
|
||||
<input type="text" name="search" maxlength="50" value="${search}"/>
|
||||
<button type="submit" class="btn btn-primary" >검색</button>
|
||||
<input id="pPage" hidden type="text" name="page">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table" >
|
||||
@@ -89,6 +112,21 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="page" align="center">
|
||||
<c:if test="${begin > pageNum }">
|
||||
<a data-p='${begin-1 }' href="#" onclick="onPaging(this)">[<]</a>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end}" var="i">
|
||||
<a data-p='${i}' href="#" onclick="onPaging(this)" >${i}</a>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<a data-p='${end+1}' href="#" onclick="onPaging(this)">[>]</a>
|
||||
</c:if>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="row">
|
||||
<h1>제품 카테고리 상세페이지</h1>
|
||||
<div class="col-10" style="text-align: right;">
|
||||
<button type="button" class="btn btn-danger" id="yes_no_modal_show_button">삭제</button>
|
||||
<button type="button" class="btn btn-danger" onclick="goDelete()">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -91,8 +91,6 @@
|
||||
form.submit();
|
||||
|
||||
})//modifyBtn click
|
||||
|
||||
yesNoModal.yesFunction = deleteCategoryFunction;
|
||||
});//ready
|
||||
|
||||
|
||||
@@ -123,6 +121,15 @@
|
||||
}//deleteCategoryFunction
|
||||
|
||||
|
||||
function goDelete(){
|
||||
yesNoModalTextDefine("카테고리 삭제", "해당 카테고리를 삭제하시겠습니까?");
|
||||
$("#yesNoModalLabel").text(yesNoModal.title);
|
||||
$("#yesNoModalBodyTextDiv").text(yesNoModal.body);
|
||||
yesNoModal.yesFunction = deleteCategoryFunction;
|
||||
yesNoModalBootStrap.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
function onSearch(){
|
||||
//
|
||||
//
|
||||
}
|
||||
|
||||
function onSelectAuth(tag){
|
||||
function onSelect(tag){
|
||||
const $tag = $(tag);
|
||||
const tid = $tag.data('tid');
|
||||
const name = $tag.data('tname');
|
||||
@@ -14,7 +11,70 @@
|
||||
$("#cls_nm_4").val(name);
|
||||
$("#kan_code").val(tid);
|
||||
hideSearchModal();
|
||||
}
|
||||
}//onSelect
|
||||
|
||||
function pagingFunction(clickedId){
|
||||
var title = "분류 검색";
|
||||
var val = "category";
|
||||
var searchn = $("#searchn1").val();
|
||||
var search = $("#search1").val();
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val,
|
||||
searchn : searchn,
|
||||
search : search,
|
||||
p : parseInt(clickedId)
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/product/show_modal', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}//pagingFunction
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#searchBtn").on("click", function(){
|
||||
var title = "분류 검색";
|
||||
var val = "category";
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
|
||||
$("#searchModalLabel").text(title);
|
||||
|
||||
const data = { name : val,
|
||||
searchn : searchn,
|
||||
search : search,
|
||||
p : 1
|
||||
};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/product/show_modal', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
})//searchBtn
|
||||
|
||||
});//ready
|
||||
</script>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
@@ -59,7 +119,7 @@
|
||||
<td>${dto.cls_nm_3 }</td>
|
||||
<td>${dto.cls_nm_4 }</td>
|
||||
<td>${dto.kan_code }</td>
|
||||
<td><button data-tid="${dto.kan_code}" data-tname="${dto.cls_nm_4}" class="btn btn-primary" onclick="onSelectAuth(this)">선택</button></td>
|
||||
<td><button data-tid="${dto.kan_code}" data-tname="${dto.cls_nm_4}" class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
@@ -67,3 +127,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 d-flex justify-content-center">
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
<c:if test="${begin > pageNum }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||
<a href="javascript:void(0);" class="page-link " onclick="pagingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${end + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
71
src/main/webapp/WEB-INF/views/modal/price.jsp
Normal file
71
src/main/webapp/WEB-INF/views/modal/price.jsp
Normal file
@@ -0,0 +1,71 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<script>
|
||||
function onSearch(){
|
||||
//
|
||||
//
|
||||
}
|
||||
|
||||
function onSelect(tag){
|
||||
const $tag = $(tag);
|
||||
const tid = $tag.data('tid');
|
||||
const name = $tag.data('tname');
|
||||
|
||||
<!-- 수정해야할 부분 -->
|
||||
$("#productName").val(name);
|
||||
$("#product_id").val(tid);
|
||||
hideSearchModal();
|
||||
}
|
||||
</script>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="div_auth_search" class="text-end">
|
||||
<div class="input-group mb-3 w-50 col-centered">
|
||||
<div class="w-30">
|
||||
<select class="form-select" name="searchn" id="searchn">
|
||||
<option selected="selected" value="0">제품명</option>
|
||||
<option value="1">가격</option>
|
||||
<option value="2">등록날짜</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||
<!-- 페이징작업용 -->
|
||||
<input type="hidden" id="searchn1" value="${searchn}">
|
||||
<input type="hidden" id="search1" value="${search}">
|
||||
<!-- 페이징작업용 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>번호</th>
|
||||
<th>제품명</th>
|
||||
<th>가격</th>
|
||||
<th>등록날짜</th>
|
||||
<th>담당자</th>
|
||||
<th>선택</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${list }" var="dto">
|
||||
<tr class="detailTr" data-product_id="${dto.id}" >
|
||||
<td>${status.count }</td>
|
||||
<td>${dto.productDto.name }</td>
|
||||
<td>${dto.price }</td>
|
||||
<td><fmt:formatDate value="${dto.registration_date }"
|
||||
dateStyle="short" /></td>
|
||||
<td>${dto.accountDto.name }</td>
|
||||
<!-- 수정해야할 부분 -->
|
||||
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,13 +1,10 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
function onSearch(){
|
||||
//
|
||||
//
|
||||
}
|
||||
|
||||
function onSelectAuth(tag){
|
||||
function onSelect(tag){
|
||||
const $tag = $(tag);
|
||||
const tid = $tag.data('tid');
|
||||
const name = $tag.data('tname');
|
||||
@@ -15,7 +12,67 @@
|
||||
$("#productName").val(name);
|
||||
$("#product_id").val(tid);
|
||||
hideSearchModal();
|
||||
}
|
||||
}//onSelect
|
||||
|
||||
function pagingFunction(clickedId){
|
||||
var title = "제품 검색";
|
||||
var val = "product";
|
||||
var searchn = $("#searchn1").val();
|
||||
var search = $("#search1").val();
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val,
|
||||
searchn : searchn,
|
||||
search : search,
|
||||
p : parseInt(clickedId)
|
||||
};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/price/show_modal', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}//pagingFunction
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#searchBtn").on("click", function(){
|
||||
var title = "제품 검색";
|
||||
var val = "product";
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
|
||||
$("#searchModalLabel").text(title);
|
||||
|
||||
const data = { name : val,
|
||||
searchn : searchn,
|
||||
search : search,
|
||||
p : 1
|
||||
};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/price/show_modal', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
})//searchBtn
|
||||
|
||||
});//ready
|
||||
|
||||
</script>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
@@ -62,7 +119,7 @@
|
||||
<td><fmt:formatDate value="${dto.registration_date }"
|
||||
dateStyle="short" /></td>
|
||||
<td>${dto.accountDto.name }</td>
|
||||
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelectAuth(this)">선택</button></td>
|
||||
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
@@ -70,3 +127,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 d-flex justify-content-center">
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
<c:if test="${begin > pageNum }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||
<a href="javascript:void(0);" class="page-link " onclick="pagingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${end + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
147
src/main/webapp/WEB-INF/views/modal/vendor.jsp
Normal file
147
src/main/webapp/WEB-INF/views/modal/vendor.jsp
Normal file
@@ -0,0 +1,147 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
|
||||
function onSelect(tag){
|
||||
const $tag = $(tag);
|
||||
const tid = $tag.data('tid');
|
||||
const name = $tag.data('tname');
|
||||
|
||||
$("#vendor").val(name);
|
||||
$("#vendor_id").val(tid);
|
||||
hideSearchModal();
|
||||
}//onSelect
|
||||
|
||||
function pagingFunction(clickedId){
|
||||
var title = "거래처 검색";
|
||||
var val = "vendor";
|
||||
var searchn = $("#searchn1").val();
|
||||
var search = $("#search1").val();
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val,
|
||||
searchn : searchn,
|
||||
search : search,
|
||||
p : parseInt(clickedId)
|
||||
};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/product/show_modal2', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}//pagingFunction
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#searchBtn").on("click", function(){
|
||||
var title = "거래처 검색";
|
||||
var val = "vendor";
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
|
||||
$("#searchModalLabel").text(title);
|
||||
|
||||
const data = { name : val,
|
||||
searchn : searchn,
|
||||
search : search,
|
||||
p : 1
|
||||
};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/product/show_modal2', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
})//searchBtn
|
||||
|
||||
});//ready
|
||||
|
||||
</script>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="div_auth_search" class="text-end">
|
||||
<div class="input-group mb-3 w-50 col-centered">
|
||||
<div class="w-30">
|
||||
<select class="form-select" name="searchn" id="searchn">
|
||||
<option selected="selected" value="0">업체명</option>
|
||||
<option value="1">업체명</option>
|
||||
<option value="2">거래처 담당자</option>
|
||||
<option value="3">거래처 담당자 전화번호</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||
<!-- 페이징작업용 -->
|
||||
<input type="hidden" id="searchn1" value="${searchn}">
|
||||
<input type="hidden" id="search1" value="${search}">
|
||||
<!-- 페이징작업용 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>번호</th>
|
||||
<th>업체명</th>
|
||||
<th>대표번호</th>
|
||||
<th>거래처 담당자</th>
|
||||
<th>거래처 담당자 전화번호</th>
|
||||
<th>선택</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${vlist }" var="dto">
|
||||
<tr class="detailTr" data-product_id="${dto.id}" >
|
||||
<td>${start} <c:set var="start" value="${start +1 }"/></td>
|
||||
<td>${dto.name }</td>
|
||||
<td>${dto.president_telephone }</td>
|
||||
<td>${dto.vendor_manager }</td>
|
||||
<td>${dto.vendor_manager_telephone }</td>
|
||||
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 d-flex justify-content-center">
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
<c:if test="${begin > pageNum }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||
<a href="javascript:void(0);" class="page-link " onclick="pagingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${end + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="row">
|
||||
<h1>제품 상세페이지</h1>
|
||||
<div class="col-10" style="text-align: right;">
|
||||
<button type="button" class="btn btn-danger" id="yes_no_modal_show_button">삭제</button>
|
||||
<button type="button" class="btn btn-danger" onclick="goDelete()">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -118,6 +118,16 @@
|
||||
});
|
||||
}//deletePriceFunction
|
||||
|
||||
function goDelete(){
|
||||
yesNoModalTextDefine("제품가격 삭제", "해당 제품가격을 삭제하시겠습니까?");
|
||||
$("#yesNoModalLabel").text(yesNoModal.title);
|
||||
$("#yesNoModalBodyTextDiv").text(yesNoModal.body);
|
||||
yesNoModal.yesFunction = deletePriceFunction;
|
||||
yesNoModalBootStrap.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -57,16 +57,14 @@
|
||||
<span class="input-group-text" id="basic-addon4">거래처</span>
|
||||
<input type="text" name="vendor" id="vendor" class="form-control"
|
||||
placeholder="거래처를 입력하세요" aria-label="거래처"
|
||||
aria-describedby="button-addon2">
|
||||
aria-describedby="button-addon2" readonly>
|
||||
<button class="btn btn-outline-secondary rounded-end" id="searchVendor"
|
||||
style="background-color:#FF5E5E;" type="button" onclick="showSearchModal2('거래처 검색','vendor')">검색</button>
|
||||
<input type='hidden' id='searchVendorChack' value='0'>
|
||||
<input type='hidden' id="vendor_id" value="">
|
||||
</div>
|
||||
|
||||
<!-- 추후 수정 -->
|
||||
<input type='hidden' id="manager_id" value="83bdda69-ae95-11ee-935d-0242ac110006">
|
||||
<input type='hidden' id="vendor_id" value="52f16bb8-aeb9-11ee-935d-0242ac110006">
|
||||
|
||||
|
||||
<!-- 추후 수정 -->
|
||||
|
||||
@@ -190,7 +188,7 @@
|
||||
const data = { name : val};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/category/show_modal', // 요청할 서버url
|
||||
url : '/product/show_modal2', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="row">
|
||||
<h1>제품 상세페이지</h1>
|
||||
<div class="col-10" style="text-align: right;">
|
||||
<button type="button" class="btn btn-danger" id="yes_no_modal_show_button">삭제</button>
|
||||
<button type="button" class="btn btn-danger" onclick="goDelete()">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -128,7 +128,15 @@
|
||||
});
|
||||
|
||||
}//deleteProductFunction
|
||||
function goDelete(){
|
||||
yesNoModalTextDefine("제품 삭제", "해당 제품을 삭제하시겠습니까?");
|
||||
$("#yesNoModalLabel").text(yesNoModal.title);
|
||||
$("#yesNoModalBodyTextDiv").text(yesNoModal.body);
|
||||
yesNoModal.yesFunction = deleteProductFunction;
|
||||
yesNoModalBootStrap.show();
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -42,15 +42,15 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon4">거래처</span>
|
||||
<input type="text" class="form-control" name="newVendor" placeholder="거래처를 입력해도 바뀌는 건 없습니다."
|
||||
aria-label="거래처" id="vendor" value="${dto.vendorDto.name }">
|
||||
|
||||
<button class="btn btn-outline-secondary rounded-end" id="searchVendor"
|
||||
style="background-color:#FF5E5E;" type="button" >검색</button>
|
||||
<input type='hidden' id='searchVendorChack' value='0'>
|
||||
</div>
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon4">거래처</span>
|
||||
<input type="text" name="vendor" id="vendor" class="form-control"
|
||||
placeholder="거래처를 입력하세요" aria-label="거래처"
|
||||
aria-describedby="button-addon2" value="${dto.vendorDto.name }" readonly>
|
||||
<button class="btn btn-outline-secondary rounded-end" id="searchVendor"
|
||||
style="background-color:#FF5E5E;" type="button" onclick="showSearchModal2('거래처 검색','vendor')">검색</button>
|
||||
<input type='hidden' id="vendor_id" value="${dto.vendor_id }">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon5">등록날짜</span>
|
||||
@@ -61,8 +61,6 @@
|
||||
<input type='hidden' id="id" value="${dto.id }">
|
||||
<!-- 추후 수정 -->
|
||||
<input type='hidden' id="manager_id" value="83bdda69-ae95-11ee-935d-0242ac110006">
|
||||
<input type='hidden' id="vendor_id" value="${dto.vendor_id }">
|
||||
|
||||
|
||||
<!-- 추후 수정 -->
|
||||
|
||||
@@ -188,7 +186,24 @@
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
}
|
||||
}//showSearchModal
|
||||
function showSearchModal2(title, val){
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/product/show_modal2', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
}//showSearchModal2
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user