mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
add Select Modal and Modal views
This commit is contained in:
@@ -26,44 +26,30 @@
|
||||
<div class="ulTag">
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: center;">
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">제품명</span>
|
||||
<input type="text" name="productDto.name" id="productDto.name" class="form-control"
|
||||
<input type="text" name="productName" id="productName" class="form-control"
|
||||
placeholder="제품명을 검색하세요" aria-label="제품명" value="${dto.productDto.name }"
|
||||
aria-describedby="basic-addon1">
|
||||
aria-describedby="basic-addon1" readonly>
|
||||
<button class="btn btn-outline-secondary rounded-end" id="searchProductName"
|
||||
style="background-color:#FF5E5E;" type="button" >검색</button>
|
||||
<input type='hidden' id='searchProductName' value='0'>
|
||||
style="background-color:#FF5E5E;" type="button" onclick="showSearchModal('제품 검색','product')" >검색</button>
|
||||
<input type='hidden' id="product_id" value="">
|
||||
|
||||
</div>
|
||||
<!-- 설명만 있는 입력 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon2">중분류</span>
|
||||
<input type="text" name="cls_nm_2" id="cls_nm_2" class="form-control"
|
||||
placeholder="중분류를 입력하세요" aria-label="중분류" value="${dto.cls_nm_2 }"
|
||||
<span class="input-group-text" id="basic-addon2">가격</span>
|
||||
<input type="number" name="price" id="price" class="form-control"
|
||||
placeholder="가격을 입력하세요" aria-label="가격" value="${dto.price }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon3">소분류</span>
|
||||
<input type="text" name="cls_nm_3" id="cls_nm_3" class="form-control"
|
||||
placeholder="소분류를 입력하세요" aria-label="소분류" value="${dto.cls_nm_3 }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon4">세분류</span>
|
||||
<input type="text" name="cls_nm_4" id="cls_nm_4" class="form-control"
|
||||
placeholder="세분류를 입력하세요" aria-label="세분류" value="${dto.cls_nm_4 }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon5">KAN 분류코드</span>
|
||||
<input type="number" min="1" name="kan_code" id="kan_code" class="form-control"
|
||||
placeholder="KAN 분류코드를 입력하세요" aria-label="KAN 분류코드" value="${dto.kan_code }"
|
||||
aria-describedby="button-addon2">
|
||||
<button class="btn btn-outline-secondary rounded-end" id="checkKan"
|
||||
style="background-color:#FF5E5E;" type="button" >중복확인</button>
|
||||
<input type='hidden' id='kan_chack' value='0'>
|
||||
</div>
|
||||
|
||||
<!-- 추후 수정 -->
|
||||
<input type='hidden' id="manager_id" value="83bdda69-ae95-11ee-935d-0242ac110006">
|
||||
|
||||
|
||||
<!-- 추후 수정 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -72,17 +58,101 @@
|
||||
<div class="w-40 col-centered" style="text-align: right">
|
||||
<button type="button" class="btn btn-success" id="submitBtn">생성</button>
|
||||
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
|
||||
|
||||
</script>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#cancelBtn").on("click", function(){
|
||||
$(location).attr("href", "/product/list");
|
||||
|
||||
})
|
||||
|
||||
$("#submitBtn").on("click", function(){
|
||||
|
||||
var price = $("#price").val();
|
||||
var manager_id = $("#manager_id").val();// 수정해야함.
|
||||
var product_id = $("#product_id").val();// 수정해야함.
|
||||
|
||||
if(!price){
|
||||
alert("가격을 입력해야 합니다.");
|
||||
$("#price").focus();
|
||||
return false;
|
||||
}
|
||||
if(!product_id){
|
||||
alert("제품을 선택해야합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: "/price/create_process",
|
||||
type: "post",
|
||||
data: {
|
||||
"price": price,
|
||||
"manager_id": manager_id, // 추후 수정해야함.
|
||||
"product_id": product_id, // 추후 수정해야함.
|
||||
"activation": true
|
||||
},
|
||||
datatype:"json"
|
||||
}).done(function(data) {
|
||||
if (data == true) {
|
||||
alert("제품 가격을 추가했습니다.");
|
||||
$(location).attr("href", "/price/list");
|
||||
|
||||
|
||||
//생각해서 바꿔야함.
|
||||
// 조건 : DB에서 생성되는 uuid를 어떻게 자바스크립트에서 가져올것인지 궁리.
|
||||
/*
|
||||
var form = document.createElement("form");
|
||||
form.action = "/product/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = data.id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
*/
|
||||
} else {
|
||||
alert("제품 가격 추가에 실패하였습니다.");
|
||||
}
|
||||
}).fail(function() {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function() {
|
||||
//
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});//ready
|
||||
|
||||
function showSearchModal(title, val){
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
$.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)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -109,7 +109,94 @@
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
});//createButton
|
||||
|
||||
//상세페이지
|
||||
$("body").on("click", ".detailTr", function(){
|
||||
var id = $(this).data("id");
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/price/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
});
|
||||
|
||||
$("#searchBtn").on("click",function(){
|
||||
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/price/list";
|
||||
form.method = "get";
|
||||
|
||||
var input1 = document.createElement("input");
|
||||
input1.type = "hidden";
|
||||
input1.name = "searchn";
|
||||
input1.value = searchn;
|
||||
form.appendChild(input1);
|
||||
|
||||
var input2 = document.createElement("input");
|
||||
input2.type = "hidden";
|
||||
input2.name = "search";
|
||||
input2.value = search;
|
||||
form.appendChild(input2);
|
||||
|
||||
var input3 = document.createElement("input");
|
||||
input3.type = "hidden";
|
||||
input3.name = "p";
|
||||
input3.value = 1;
|
||||
form.appendChild(input3);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});//ready
|
||||
|
||||
function pagingFunction(clickedId){
|
||||
var searchn1 = $("#searchn1").val();
|
||||
var search1 = $("#search1").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/price/list";
|
||||
form.method = "get";
|
||||
|
||||
var input1 = document.createElement("input");
|
||||
input1.type = "hidden";
|
||||
input1.name = "searchn";
|
||||
input1.value = searchn1;
|
||||
form.appendChild(input1);
|
||||
|
||||
var input2 = document.createElement("input");
|
||||
input2.type = "hidden";
|
||||
input2.name = "search";
|
||||
input2.value = search1;
|
||||
form.appendChild(input2);
|
||||
|
||||
var input3 = document.createElement("input");
|
||||
input3.type = "hidden";
|
||||
input3.name = "p";
|
||||
input3.value = clickedId;
|
||||
form.appendChild(input3);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
123
src/main/webapp/WEB-INF/views/price/read.jsp
Normal file
123
src/main/webapp/WEB-INF/views/price/read.jsp
Normal file
@@ -0,0 +1,123 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>제품 가격 상세페이지</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div style="text-align: center">
|
||||
<form>
|
||||
<div class="ulTag">
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: center;">
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">제품명</span> <input
|
||||
type="text" class="form-control" placeholder="제품명"
|
||||
aria-label="제품명" value="${dto.productDto.name }" readonly>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon2">가격</span> <input
|
||||
type="text" class="form-control" placeholder="가격"
|
||||
aria-label="가격" value="${dto.price }" readonly>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon3">등록날짜</span> <input
|
||||
type="text" class="form-control" placeholder="등록날짜"
|
||||
aria-label="등록날짜" value="${dto.registration_date }" readonly>
|
||||
</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" placeholder="담당자"
|
||||
aria-label="담당자" value="${dto.accountDto.name }" readonly>
|
||||
</div>
|
||||
<input type='hidden' id="id" value="${dto.id }">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 ">
|
||||
<div class="w-40 col-centered" style="text-align: right">
|
||||
<button type="button" class="btn btn-primary" id="checkBtn">확인</button>
|
||||
<button type="button" class="btn btn-warning" id="modifyBtn">수정</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#checkBtn").on("click", function() {
|
||||
$(location).attr("href", "/price/list");
|
||||
|
||||
})//checkBtn click
|
||||
|
||||
$("#modifyBtn").on("click", function() {
|
||||
var id = $("#id").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/price/update";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
|
||||
})//modifyBtn click
|
||||
|
||||
yesNoModal.yesFunction = deletePriceFunction;
|
||||
|
||||
|
||||
|
||||
|
||||
});//ready
|
||||
|
||||
function deletePriceFunction(){
|
||||
var id = $("#id").val();
|
||||
$.ajax({
|
||||
url: "/price/delete",
|
||||
type: "delete",
|
||||
data: {
|
||||
"id": id
|
||||
},
|
||||
datatype:"json"
|
||||
}).done(function(data) {
|
||||
if (data == true) {
|
||||
alert("삭제되었습니다.");
|
||||
$(location).attr("href", "/price/list");
|
||||
} else {
|
||||
alert("정상적으로 삭제되지 않았습니다..");
|
||||
}
|
||||
}).fail(function() {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function() {
|
||||
//
|
||||
});
|
||||
}//deletePriceFunction
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
125
src/main/webapp/WEB-INF/views/price/update.jsp
Normal file
125
src/main/webapp/WEB-INF/views/price/update.jsp
Normal file
@@ -0,0 +1,125 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Insert title here</title>
|
||||
</head>
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<div class="row">
|
||||
<h1>제품 가격 수정페이지</h1>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div style="text-align: center">
|
||||
<form>
|
||||
<div class="ulTag">
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: center;">
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">제품명</span>
|
||||
<input type="text" class="form-control" placeholder="제품명" id="name"
|
||||
aria-label="제품명" value="${dto.productDto.name }" readonly>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon2">가격</span>
|
||||
<input type="text" class="form-control" placeholder="가격" id="price"
|
||||
aria-label="가격" value="${dto.price }">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon3">등록날짜</span>
|
||||
<input type="text" class="form-control" placeholder="등록날짜"
|
||||
aria-label="등록날짜" value="${dto.registration_date }" readonly>
|
||||
</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" placeholder="담당자"
|
||||
aria-label="담당자" value="${dto.accountDto.name }" readonly>
|
||||
</div>
|
||||
|
||||
<input type='hidden' id="id" value="${dto.id }">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 ">
|
||||
<div class="w-40 col-centered" style="text-align: right">
|
||||
<button type="button" class="btn btn-primary" id="submitBtn">수정 완료</button>
|
||||
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#submitBtn").on("click", function() {
|
||||
var id = $("#id").val();
|
||||
var price = $("#price").val();
|
||||
|
||||
if (!price || isNaN(price)) {
|
||||
alert("올바른 가격을 입력하세요.");
|
||||
$("#price").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/price/update_process",
|
||||
type: "put",
|
||||
data: {
|
||||
"id": id,
|
||||
"price": price
|
||||
},
|
||||
datatype: "json"
|
||||
}).done(function(data) {
|
||||
if (data == true) {
|
||||
alert("제품 가격을 수정했습니다.");
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/price/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
} else {
|
||||
alert("제품 가격 수정에 실패하였습니다.");
|
||||
}
|
||||
}).fail(function() {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function() {
|
||||
//
|
||||
});
|
||||
});//submitBtn
|
||||
|
||||
$("#cancelBtn").on("click", function() {
|
||||
var id = $("#id").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/price/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
});//cancelBtn
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user