카트 담기 연결 및 기준 정리
This commit is contained in:
parent
9b5fd91c20
commit
fe15c8a399
@ -224,7 +224,7 @@ function goList(){
|
|||||||
<c:if test="${result.ableRead and not result.ableReadNow }"><button type="button" class="btn btn-gray" onclick="alert('현재 방문열람신청이 불가능한 상태입니다.')">방문열람신청</button></c:if>
|
<c:if test="${result.ableRead and not result.ableReadNow }"><button type="button" class="btn btn-gray" onclick="alert('현재 방문열람신청이 불가능한 상태입니다.')">방문열람신청</button></c:if>
|
||||||
|
|
||||||
<c:if test="${result.ableRent or result.ableRead }">
|
<c:if test="${result.ableRent or result.ableRead }">
|
||||||
<button type="button" class="btn btn-orange" onclick="fn_addRentCart('${result.masterId}', '${result.lentYn}', '${result.onReqYn}')">카트담기</button>
|
<button type="button" class="btn btn-orange" onclick="fn_addRentCart('${result.masterId}', '${result.ableRent}', '${result.ableRead}')">카트담기</button>
|
||||||
</c:if>
|
</c:if>
|
||||||
</div>
|
</div>
|
||||||
<c:if test="${fn:length(keywordList) > 0 }">
|
<c:if test="${fn:length(keywordList) > 0 }">
|
||||||
|
|||||||
@ -1,103 +0,0 @@
|
|||||||
<%
|
|
||||||
/**
|
|
||||||
* <pre>
|
|
||||||
* @Class Name : listRentItem.jsp (샘플)
|
|
||||||
*
|
|
||||||
* @Description : RESTful API 호출 샘플
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @ ------------ -------- ---------------------------
|
|
||||||
* @ 수정일 수정자 수정내용
|
|
||||||
* @ ------------ -------- ---------------------------
|
|
||||||
* @ 2021. 6. 15. KNKIM 최초 생성
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author 이씨플라자 * DIGITALSHIP KNKIM
|
|
||||||
* @since 2021. 6. 15.
|
|
||||||
* @version 1.0
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
%>
|
|
||||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
|
||||||
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %>
|
|
||||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
|
||||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
|
||||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
|
||||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
|
||||||
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
|
|
||||||
<c:set var="pageTitle">대출목록</c:set>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>${pageTitle}</title>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
||||||
|
|
||||||
<script type="text/javaScript" language="javascript">
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<!-- javascript warning tag -->
|
|
||||||
<noscript class="noScriptTitle"><spring:message code="common.noScriptTitle.msg" /></noscript>
|
|
||||||
<form
|
|
||||||
action="${pageContext.request.contextPath}/sample/listRentItem.do"
|
|
||||||
method="post">
|
|
||||||
|
|
||||||
<div class="wTableFrm">
|
|
||||||
<!-- 타이틀 -->
|
|
||||||
<h2>${pageTitle}</h2>
|
|
||||||
|
|
||||||
<div style="clear:both;">Server Protocol : ${serverProtocol}</div>
|
|
||||||
<div style="clear:both;">Server IP : ${serverIp}</div>
|
|
||||||
<div style="clear:both;">Server PORT : ${serverPort}</div>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<a href="/cart/listCartItems.do">카트</a><br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
rows : <input name="rows" id="rows" value="10" /> <br />
|
|
||||||
page : <input name="page" id="page" value="1" /> <br />
|
|
||||||
mngOrgCd : <input name="mngOrgCd" id="mngOrgCd" value="KCCF" /> <br />
|
|
||||||
mbInfoId : <input name="mbInfoId" id="mbInfoId" value="BDCCAF34CF8AA365C660ADB121CE6741" /> <br />
|
|
||||||
--------------------------------------------------------------------------
|
|
||||||
<br />
|
|
||||||
resultCode : <input name="resultCode" id="resultCode" value="${resultCode}" /> <br />
|
|
||||||
resultMessage : <input name="resultCode" id="resultCode" value="${resultMessage}" /> <br />
|
|
||||||
totPages : <input name="info.name" id="info.name" value="${info.totPages}" /> <br />
|
|
||||||
records : <input name="info.name" id="info.name" value="${info.records}" /> <br />
|
|
||||||
list : <input name=""list"" id="list" value="${list}" /> <br />
|
|
||||||
<c:forEach var="record" items="${list }">
|
|
||||||
> ----------------------------------------------------------- <br />
|
|
||||||
> mngOrgCd = ${record.mngOrgCd} <br />
|
|
||||||
> operReadRangeCd = ${record.operReadRangeCd} <br />
|
|
||||||
> bookLtRvStatusCd = ${record.bookLtRvStatusCd} <br />
|
|
||||||
> title = ${record.title} <br />
|
|
||||||
> typeCodeNm = ${record.typeCodeNm} <br />
|
|
||||||
> awaiterCnt = ${record.awaiterCnt} <br />
|
|
||||||
> useStatus = ${record.useStatus} <br />
|
|
||||||
> masterId = ${record.masterId} <br />
|
|
||||||
|
|
||||||
<input type="button" name="addCartBtn" id="addCartBtn" onclick="fn_addRentCart('${record.masterId}', '${record.useStatus}')" value="관심자료 추가" />
|
|
||||||
<br />
|
|
||||||
</c:forEach>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<div style="clear:both;"></div>
|
|
||||||
|
|
||||||
<input type="submit" id="btnSubmit" name="btnSubmit" value="전송" />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -6,61 +6,27 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function fn_addRentCart(masterId, lentYn , onReqYn ) {
|
function fn_addRentCart(masterId, ableRent , ableRead ) {
|
||||||
|
|
||||||
/* useStatus
|
|
||||||
01 : 이용가능
|
|
||||||
02 : 대출중 (대기자 0명)
|
|
||||||
03 : 대출중 (대기자 1명)
|
|
||||||
04 : 열람대기(대출가능)
|
|
||||||
05 : 이용가능
|
|
||||||
06 : 열람대기(대출불가능)
|
|
||||||
07 : 온라인열람만"
|
|
||||||
*/
|
|
||||||
fn_addRentCartItem(masterId, lentYn, onReqYn
|
|
||||||
, function(data) {
|
|
||||||
if(data.code == "S") {
|
|
||||||
if(confirm(data.message + "\n카트로 이동하시겠습니까?")) {
|
|
||||||
fn_gotoCart();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
alert(data.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
, function(error) {
|
|
||||||
alert(error.message);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function fn_gotoCart() {
|
|
||||||
location.href = "/cart/listCartItems.do";
|
|
||||||
}
|
|
||||||
|
|
||||||
function fn_addRentCartItem(masterId, lentYn, onReqYn, resolve, reject) {
|
|
||||||
|
|
||||||
|
|
||||||
var cartTypeCd = null;
|
var cartTypeCd = null;
|
||||||
|
|
||||||
if(masterId == "undefined" || masterId == "") {
|
if(masterId == "undefined" || masterId == "") {
|
||||||
reject(new Error("선택된 자료 정보가 없습니다."));
|
alert("선택된 자료 정보가 없습니다.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((lentYn == "undefined" || lentYn == "") || (onReqYn == "undefined" || onReqYn == "")) {
|
if((ableRent === undefined || ableRent == "") || (ableRead === undefined || ableRead == "")) {
|
||||||
reject(new Error("선택된 자료의 상태 정보를 확인할 수 없습니다."));
|
alert("선택된 자료의 상태 정보를 확인할 수 없습니다.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lentYn == "Y") {
|
if(ableRent) {
|
||||||
cartTypeCd = "1"; // 대출
|
cartTypeCd = "1"; // 대출
|
||||||
} else if(onReqYn == "Y") {
|
} else if(ableRead) {
|
||||||
cartTypeCd = "2"; // 방문열람
|
cartTypeCd = "2"; // 방문열람
|
||||||
} else {
|
} else {
|
||||||
reject(new Error("해당 자료의 상태를 확인할 수 없습니다."));
|
alert("대출 또는 방문열람이 가능한 자료만 카트에 추가 가능합니다.");
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -73,12 +39,24 @@ function fn_addRentCartItem(masterId, lentYn, onReqYn, resolve, reject) {
|
|||||||
cartTypeCd : cartTypeCd
|
cartTypeCd : cartTypeCd
|
||||||
}),
|
}),
|
||||||
success : function(data) {
|
success : function(data) {
|
||||||
resolve(JSON.parse(data));
|
var jsonData = JSON.parse(data);
|
||||||
|
if(jsonData.code == "S") {
|
||||||
|
if(confirm(jsonData.message + "\n카트로 이동하시겠습니까?")) {
|
||||||
|
fn_gotoCart();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert(jsonData.message);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error : function(error) {
|
error : function(error) {
|
||||||
reject(error);
|
alert(error.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function fn_gotoCart() {
|
||||||
|
location.href = "/cart/listCartItems.do";
|
||||||
}
|
}
|
||||||
|
|
||||||
function fn_addReserveCart() {
|
function fn_addReserveCart() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user