일정관리 추가

main
이범준 9 months ago
parent 656c020c7e
commit 42931d6a5d

@ -11,4 +11,39 @@ import lombok.Setter;
@Setter @Setter
public class Schdl extends AbstractEntity { public class Schdl extends AbstractEntity {
/**
* ID
*/
private String schdlId;
/**
*
*/
private String schdlBgngYmd;
/**
*
*/
private String schdlEndYmd;
/**
* ID
*/
private String userId;
/**
*
*/
private String schdlCn;
/**
*
*/
private String delYn;
/**
*
*/
private String delRsn;
} }

@ -16,4 +16,14 @@ public class SchdlQuery extends CmmnQuery {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String userId;
public String getUserId() {
return this.userId;
}
public SchdlQuery setUserId(String userId) {
this.userId = userId;
return this;
}
} }

@ -1,8 +1,14 @@
package cokr.xit.fims.mngt.dao; package cokr.xit.fims.mngt.dao;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper; import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.mngt.Schdl;
import cokr.xit.fims.mngt.SchdlQuery;
import cokr.xit.foundation.component.AbstractMapper; import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO /** DAO
* @author leebj * @author leebj
@ -10,4 +16,82 @@ import cokr.xit.foundation.component.AbstractMapper;
@Mapper("schdlMapper") @Mapper("schdlMapper")
public interface SchdlMapper extends AbstractMapper { public interface SchdlMapper extends AbstractMapper {
/** .<br />
* @param req
* @return
*/
List<DataObject> selectSchdlList(SchdlQuery req);
/** .
* @param schdlId ID
* @return
*/
DataObject selectSchdlInfo(String schdlId);
/** .
* @param params
* <ul><li>"schdl" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertSchdl(Map<String, Object> params);
/** .
* @param schdl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean insert(Schdl schdl) {
if(schdl == null) {
return false;
}
DataObject map = params().set("schdl", schdl);
int effected = insertSchdl(map);
return effected == 1;
}
/** .
* @param params
* <ul><li>"schdl" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateSchdl(Map<String, Object> params);
/** .
* @param schdl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean update(Schdl schdl) {
return schdl != null && updateSchdl(params().set("schdl", schdl)) == 1;
}
/** .
* @param params
* <ul><li>"schdl" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int deleteSchdl(Map<String, ?> params);
/** .
* @param schdl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean delete(Schdl schdl) {
return schdl != null && deleteSchdl(params().set("schdl", schdl)) == 1;
}
} }

@ -1,5 +1,48 @@
package cokr.xit.fims.mngt.service; package cokr.xit.fims.mngt.service;
import java.util.List;
import cokr.xit.fims.mngt.Schdl;
import cokr.xit.fims.mngt.SchdlQuery;
import cokr.xit.foundation.data.DataObject;
public interface SchdlService { public interface SchdlService {
/** .
* @param req
* @return
*/
List<DataObject> getSchdlList(SchdlQuery req);
/** .
* @param schdlId ID
* @return
*/
DataObject getSchdlInfo(String schdlId);
/** .
* @param schdl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
String create(Schdl schdl);
/** .
* @param schdl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
String update(Schdl schdl);
/** .
* @param schdl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
String remove(Schdl schdl);
} }

@ -1,11 +1,16 @@
package cokr.xit.fims.mngt.service.bean; package cokr.xit.fims.mngt.service.bean;
import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import cokr.xit.fims.mngt.Schdl;
import cokr.xit.fims.mngt.SchdlQuery;
import cokr.xit.fims.mngt.dao.SchdlMapper; import cokr.xit.fims.mngt.dao.SchdlMapper;
import cokr.xit.foundation.AbstractComponent; import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
/** Bean /** Bean
* @author leebj * @author leebj
@ -16,4 +21,53 @@ public class SchdlBean extends AbstractComponent {
@Resource(name="schdlMapper") @Resource(name="schdlMapper")
private SchdlMapper schdlMapper; private SchdlMapper schdlMapper;
/** .
* @param req
* @return
*/
public List<DataObject> getSchdlList(SchdlQuery req) {
return schdlMapper.selectSchdlList(req);
}
/** .
* @param schdlId ID
* @return
*/
public DataObject getSchdlInfo(String schdlId) {
return schdlMapper.selectSchdlInfo(schdlId);
}
/** .
* @param schdl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean create(Schdl schdl) {
return schdlMapper.insert(schdl);
}
/** .
* @param schdl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean update(Schdl schdl) {
return schdlMapper.update(schdl);
}
/** .
* @param schdl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean remove(Schdl schdl) {
return schdlMapper.delete(schdl);
}
} }

@ -1,11 +1,16 @@
package cokr.xit.fims.mngt.service.bean; package cokr.xit.fims.mngt.service.bean;
import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cokr.xit.fims.mngt.Schdl;
import cokr.xit.fims.mngt.SchdlQuery;
import cokr.xit.fims.mngt.service.SchdlService; import cokr.xit.fims.mngt.service.SchdlService;
import cokr.xit.foundation.component.AbstractServiceBean; import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
@Service("schdlService") @Service("schdlService")
public class SchdlServiceBean extends AbstractServiceBean implements SchdlService { public class SchdlServiceBean extends AbstractServiceBean implements SchdlService {
@ -13,4 +18,28 @@ public class SchdlServiceBean extends AbstractServiceBean implements SchdlServic
@Resource(name="schdlBean") @Resource(name="schdlBean")
private SchdlBean schdlBean; private SchdlBean schdlBean;
@Override
public List<DataObject> getSchdlList(SchdlQuery req) {
return schdlBean.getSchdlList(req);
}
@Override
public DataObject getSchdlInfo(String schdlId) {
return schdlBean.getSchdlInfo(schdlId);
}
@Override
public String create(Schdl schdl) {
return schdlBean.create(schdl) ? "[S]" : "[F]";
}
@Override
public String update(Schdl schdl) {
return schdlBean.update(schdl) ? "[S]" : "[F]";
}
@Override
public String remove(Schdl schdl) {
return schdlBean.remove(schdl) ? "[S]" : "[F]";
}
} }

@ -1,11 +1,16 @@
package cokr.xit.fims.mngt.web; package cokr.xit.fims.mngt.web;
import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.web.ApplicationController; import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.mngt.Schdl;
import cokr.xit.fims.mngt.SchdlQuery;
import cokr.xit.fims.mngt.service.SchdlService; import cokr.xit.fims.mngt.service.SchdlService;
import cokr.xit.foundation.data.DataObject;
/** .<br /> /** .<br />
* { }/mngt/mngt02 . * { }/mngt/mngt02 .
@ -17,7 +22,12 @@ public class Mngt02Controller extends ApplicationController {
public class METHOD_URL { public class METHOD_URL {
public static final String public static final String
schdlMain = "/010/main.do" schdlMain = "/010/main.do",
getSchdlList = "/010/list.do",
getSchdlInfo = "/020/info.do",
create = "/020/create.do",
update = "/020/update.do",
remove = "/020/remove.do"
; ;
} }
@ -35,4 +45,109 @@ public class Mngt02Controller extends ApplicationController {
return mav; return mav;
} }
/** .<br />
* {@link SchdlService#getSchdlList(SchdlQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "schdlList": [ ]
* "schdlStart":
* "schdlFetch":
* "schdlTotal":
* }</code></pre>
*/
public ModelAndView getSchdlList(SchdlQuery req) {
ModelAndView mav = new ModelAndView("jsonView");
req.setUserId(currentUser().getId());
List<DataObject> list = schdlService.getSchdlList(req);
mav.addObject("list", list);
return mav;
}
/** .<br />
* {@link SchdlService#getSchdlInfo(SchdlQuery)}
* @param req
* @return jsonView
*/
public ModelAndView getSchdlInfo(String schdlId, String schdlBgngYmd, String schdlEndYmd) {
boolean json = jsonResponse();
ModelAndView mav = new ModelAndView(json ? "jsonView" : "fims/mngt/mngt02020-info");
mav.addObject("pageName", "mngt02020");
DataObject info = new DataObject();
if(!ifEmpty(schdlId, ()->"").equals("")) {
info = schdlService.getSchdlInfo(schdlId);
} else {
info = null;
}
mav.addObject("schdlInfo", json ? info : toJson(info));
mav.addObject("schdlBgngYmd", schdlBgngYmd);
mav.addObject("schdlEndYmd", schdlEndYmd);
return mav;
}
/** .
* @param schdl
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView create(Schdl schdl) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
schdl.setUserId(currentUser().getId());
String rtnMsg = schdlService.create(schdl);
if(rtnMsg.contains("[S]")) {
saved = true;
}
mav.addObject("saved", saved);
mav.addObject("schdlId", schdl.getSchdlId());
return mav;
}
/** .
* @param schdl
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView update(Schdl schdl) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
schdl.setUserId(currentUser().getId());
String rtnMsg = schdlService.update(schdl);
if(rtnMsg.contains("[S]")) {
saved = true;
}
mav.addObject("saved", saved);
return mav;
}
/** .
* @param schdlIDs
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
public ModelAndView remove(Schdl schdl) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
schdl.setUserId(currentUser().getId());
String rtnMsg = schdlService.remove(schdl);
if(rtnMsg.contains("[S]")) {
saved = true;
}
mav.addObject("saved", saved);
return mav;
}
} }

@ -18,6 +18,8 @@ import cokr.xit.fims.mngt.FineIntegrationDepartment;
import cokr.xit.fims.mngt.FineIntegrationSigungu; import cokr.xit.fims.mngt.FineIntegrationSigungu;
import cokr.xit.fims.mngt.Ntc; import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery; import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.fims.mngt.Schdl;
import cokr.xit.fims.mngt.SchdlQuery;
import cokr.xit.fims.mngt.Task; import cokr.xit.fims.mngt.Task;
import cokr.xit.fims.mngt.VltnQuery; import cokr.xit.fims.mngt.VltnQuery;
import cokr.xit.fims.sprt.SprtQuery; import cokr.xit.fims.sprt.SprtQuery;
@ -620,6 +622,37 @@ public class CmnController {
return super.schdlMain(); return super.schdlMain();
} }
@Override
@RequestMapping(name="일정 목록 조회", value=METHOD_URL.getSchdlList)
public ModelAndView getSchdlList(SchdlQuery req) {
return super.getSchdlList(req);
}
@Override
@RequestMapping(name="일정 조회", value=METHOD_URL.getSchdlInfo)
public ModelAndView getSchdlInfo(String schdlId, String schdlBgngYmd, String schdlEndYmd) {
return super.getSchdlInfo(schdlId, schdlBgngYmd, schdlEndYmd);
}
@Override
@RequestMapping(name="일정 추가", value=METHOD_URL.create)
public ModelAndView create(Schdl schdl) {
return super.create(schdl);
}
@Override
@RequestMapping(name="일정 수정", value=METHOD_URL.update)
public ModelAndView update(Schdl schdl) {
return super.update(schdl);
}
@Override
@RequestMapping(name="일정 삭제", value=METHOD_URL.remove)
public ModelAndView remove(Schdl schdl) {
return super.remove(schdl);
}
} }
@Controller @Controller

@ -106,8 +106,8 @@ UPDATE TB_NOTICE
/* 공지사항 삭제(ntcMapper.deleteNtc) */ /* 공지사항 삭제(ntcMapper.deleteNtc) */
UPDATE TB_NOTICE UPDATE TB_NOTICE
SET DEL_YN = 'Y' SET DEL_YN = 'Y'
, MDFCN_DT = <include refid="utility.now" /> , DEL_DT = <include refid="utility.now" />
, MDFR = #{currentUser.id} , DLTR = #{currentUser.id}
WHERE NTC_ID = #{ntc.ntcId} WHERE NTC_ID = #{ntc.ntcId}
</update> </update>

@ -1,4 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.fims.mngt.dao.SchdlMapper"> <mapper namespace="cokr.xit.fims.mngt.dao.SchdlMapper">
<!-- 일정관리 정보 매퍼
========== 변경 이력 ==========
2024-02-26 leebj 최초 작성
============================ -->
<resultMap id="schdlRow" type="cokr.xit.fims.mngt.Schdl"> <!-- 일정관리 -->
<result property="schdlId" column="SCHDL_ID" /> <!-- 일정 ID -->
<result property="schdlBgngYmd" column="SCHDL_BGNG_YMD" /> <!-- 일정 시작 일자 -->
<result property="schdlEndYmd" column="SCHDL_END_YMD" /> <!-- 일정 종료 일자 -->
<result property="userId" column="USER_ID" /> <!-- 사용자 ID -->
<result property="schdlCn" column="SCHDL_CN" /> <!-- 일정 내용 -->
<result property="delYn" column="DEL_YN" /> <!-- 삭제 여부 -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
<result property="lastModified" column="MDFCN_DT" /> <!-- 수정 일시 -->
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
<result property="removedAt" column="DEL_DT" /> <!-- 삭제 일시 -->
<result property="removedBy" column="DLTR" /> <!-- 삭제자 -->
<result property="delRsn" column="DEL_RSN" /> <!-- 삭제 사유 -->
</resultMap>
<sql id="select">
SELECT SCHDL_ID <!-- 일정 ID -->
, SCHDL_BGNG_YMD <!-- 일정 시작 일자 -->
, SCHDL_END_YMD <!-- 일정 종료 일자 -->
, USER_ID <!-- 사용자 ID -->
, SCHDL_CN <!-- 일정 내용 -->
, DEL_YN <!-- 삭제 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
, DEL_DT <!-- 삭제 일시 -->
, DLTR <!-- 삭제자 -->
, DEL_RSN <!-- 삭제 사유 -->
FROM TB_SCHDL
</sql>
<select id="selectSchdlList" parameterType="map" resultType="dataobject">
/* 일정관리 목록 조회(schdlMapper.selectSchdlList) */
<include refid="select" />
WHERE DEL_YN = 'N'
AND USER_ID = #{userId}
<include refid="utility.orderBy" />
</select>
<select id="selectSchdlInfo" parameterType="string" resultType="dataObject">
/* 일정관리 객체 가져오기(schdlMapper.selectSchdlInfo) */
<include refid="select" />
WHERE DEL_YN = 'N'
AND SCHDL_ID = #{schdlId}
</select>
<insert id="insertSchdl" parameterType="map">
/* 일정관리 등록(schdlMapper.insertSchdl) */
<selectKey resultType="string" keyProperty="schdl.schdlId" keyColumn="NEW_ID" order="BEFORE">
SELECT
LPAD(CAST(IFNULL(MAX(SCHDL_ID) + 1, 1) AS INT), 10, '0')
AS NEW_ID
FROM TB_SCHDL
</selectKey>
INSERT
INTO TB_SCHDL (
SCHDL_ID <!-- 일정 ID -->
, SCHDL_BGNG_YMD <!-- 일정 시작 일자 -->
, SCHDL_END_YMD <!-- 일정 종료 일자 -->
, USER_ID <!-- 사용자 ID -->
, SCHDL_CN <!-- 일정 내용 -->
, DEL_YN <!-- 삭제 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
) VALUES (
#{schdl.schdlId} <!-- 일정 ID -->
, #{schdl.schdlBgngYmd} <!-- 일정 시작 일자 -->
, #{schdl.schdlEndYmd} <!-- 일정 종료 일자 -->
, #{schdl.userId} <!-- 사용자 ID -->
, #{schdl.schdlCn} <!-- 일정 내용 -->
, 'N' <!-- 삭제 여부 -->
, <include refid="utility.now" /> <!-- 등록 일시 -->
, #{currentUser.id} <!-- 등록자 -->
, <include refid="utility.now" /> <!-- 수정 일시 -->
, #{currentUser.id} <!-- 수정자 -->
)
</insert>
<update id="updateSchdl" parameterType="map">
/* 일정관리 수정(schdlMapper.updateSchdl) */
UPDATE TB_SCHDL
SET SCHDL_BGNG_YMD = #{schdl.schdlBgngYmd} <!-- 일정 시작 일자 -->
, SCHDL_END_YMD = #{schdl.schdlEndYmd} <!-- 일정 종료 일자 -->
, USER_ID = #{schdl.userId} <!-- 사용자 ID -->
, SCHDL_CN = #{schdl.schdlCn} <!-- 일정 내용 -->
, MDFCN_DT = <include refid="utility.now" /> <!-- 수정 일시 -->
, MDFR = #{currentUser.id} <!-- 수정자 -->
WHERE SCHDL_ID = #{schdl.schdlId}
</update>
<update id="deleteSchdl" parameterType="map">
/* 일정관리 삭제(schdlMapper.deleteSchdl) */
UPDATE TB_SCHDL
SET DEL_YN = 'Y'
, DEL_DT = <include refid="utility.now" />
, DLTR = #{currentUser.id}
WHERE SCHDL_ID = #{schdl.schdlId}
</update>
</mapper> </mapper>

@ -12,54 +12,124 @@
</div> </div>
</div> </div>
<script> <script>
LoadScript("fullCalendarScript","/resources/3rd-party/sneat/libs/fullcalendar/fullcalendar.js"); LoadScript("fullCalendarScript","/resources/3rd-party/sneat/libs/fullcalendar/fullcalendar.js");
pageObject["${pageName}"] = {};
$(document).ready(function(){
var calendar = new Calendar(document.getElementById("calendar--${pageName}"), { var $P = pageObject["${pageName}"];
$P.calendar = new Calendar(document.getElementById("calendar--${pageName}"), {
initialView: 'dayGridMonth', initialView: 'dayGridMonth',
plugins : [dayGridPlugin, interactionPlugin], plugins : [dayGridPlugin, interactionPlugin],
locale: 'ko', locale: 'ko',
editable: true, editable: false,
selectable: true, selectable: true,
height: '700px', height: '700px',
handleWindowResize : false, handleWindowResize : false,
eventColor: '#ffeecc', eventColor: '#ffeecc',
select: function(arg) { select: function(arg) {
$P.getInfo("", arg.startStr.replaceAll("-",""), getPrevDay(arg.endStr.replaceAll("-",""),1));
var text = prompt('일정을 입력하세요.');
if(text){
calendar.addEvent({
title: text,
start: arg.start,
end: arg.end,
allDay: arg.allDay
});
}
calendar.unselect();
}, },
eventClick:function(obj, element) { eventClick:function(obj, element) {
$P.getInfo(obj.event.id, "", "");
}
});
var text = prompt('일정 변경내용을 입력하세요.', obj.event.title); $P.getInfo = (schdlId, schdlBgngYmd, schdlEndYmd) => {
if(text == null){ ajax.get({
return; url : wctx.url("/mngt/mngt02/020/info.do"),
data : {
schdlId : schdlId,
schdlBgngYmd : schdlBgngYmd,
schdlEndYmd : schdlEndYmd
},
success : (resp) => {
dialog.open({
id : "scheduleInfoDialog",
title : "일정 정보",
size : "xl",
content : resp,
init : () => {
var parentRes = new Object();
var childReq = pageObject.childReq.pop();
for(var reqKey in childReq) {
if($P.provide[reqKey]){
parentRes[reqKey] = $P.provide[reqKey];
} else {
parentRes[reqKey] = function(){};
}
} }
if(text) { pageObject.parentRes.push(parentRes);
obj.event.setProp("title", text);
} else {
obj.event.remove();
} }
});
}
});
calendar.unselect();
} }
$P.add = (info) => {
$P.calendar.addEvent({
title : info.schdlCn,
start : dateFormat.format(info.schdlBgngYmd),
end : dateFormat.format(getNextDay(info.schdlEndYmd,1)),
allDay : true
});
}
$P.modify = (info) => {
var ev = $P.calendar.getEventById(info.schdlId);
ev.setProp("title", info.schdlCn);
ev.setDates(dateFormat.format(info.schdlBgngYmd), dateFormat.format(getNextDay(info.schdlEndYmd,1)), { allDay : true });
};
$P.del = (info) => {
$P.calendar.getEventById(info.schdlId).remove();
};
$P.provide = {
"refresh" : function(type, info){
if(type == "add"){
$P.add(info);
} else if(type == "modify"){
$P.modify(info);
} else if(type == "del"){
$P.del(info);
}
}
};
//
$P.calendar.render();
//
ajax.get({
url : wctx.url("/mngt/mngt02/010/list.do"),
data : {},
success : (resp) => {
if(resp.list != null && resp.list.length > 0){
for(var i=0; i < resp.list.length; i++){
var info = resp.list[i];
$P.calendar.addEvent({
id : info.SCHDL_ID,
title : info.SCHDL_CN,
start : dateFormat.format(info.SCHDL_BGNG_YMD),
end : dateFormat.format(getNextDay(info.SCHDL_END_YMD,1)),
allDay : true
}); });
calendar.render(); }
}
}
});
});
</script> </script>

@ -0,0 +1,213 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="pageKorName" scope="request">일정 상세</c:set>
<div class="content-wrapper">
<div class="container-xxl flex-grow-1 px-0">
<div class="card">
<form id="frmEdit--${pageName}" name="frmEdit">
<input type="text" id="schdlId--${pageName}" name="schdlId" data-map="SCHDL_ID" hidden />
<div class="row g-1">
<div class="col-md-6">
<label for="schdlBgngYmd--${pageName}"
class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end required">
시작일
</label>
<input type="text" id="schdlBgngYmd--${pageName}" name="schdlBgngYmd" data-map="SCHDL_BGNG_YMD"
class="form-control form-date" required
data-fmt-type="day" title="시작 날짜 선택" />
<button type="button" class="bx bx-sm bx-calendar bg-white"></button>
</div>
<div class="col-md-6">
<label for="schdlEndYmd--${pageName}"
class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end required">
종료일
</label>
<input type="text" id="schdlEndYmd--${pageName}" name="schdlEndYmd" data-map="SCHDL_END_YMD"
class="form-control form-date" required
data-fmt-type="day" title="종료 날짜 선택" />
<button type="button" class="bx bx-sm bx-calendar bg-white"></button>
</div>
<div class="col-md-12">
<label for="schdlCn--${pageName}"
class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end align-top required">
내용
</label>
<input type="text" id="schdlCn--${pageName}" name="schdlCn" data-map="SCHDL_CN"
class="form-control w-px-500" required />
</div>
</div>
<div class="row m-3">
<div class="col-md-12">
<span class="float-end">
<button type="button" id="btnSave--${pageName}" class="btn btn-primary">저장</button>
<button type="button" id="btnRemove--${pageName}" class="btn btn-primary">삭제</button>
</span>
</div>
</div>
</form>
</div>
</div>
</div>
<script>
pageObject["${pageName}"] = {};
pageObject["${pageName}"].provided = {};
pageObject.childReq = [];
pageObject.childReq.push({
refresh : function(){ },
});
$(document).ready(function(){
var $P = pageObject["${pageName}"];
if(pageObject.parentRes.length > 0){
$P.provided = pageObject.parentRes.pop();
} else {
$P.provided = pageObject.childReq.pop();
}
/**************************************************************************
* DatasetControl, Dataset, FormFields
**************************************************************************/
$P.formFields = new FimsFormFields("#frmEdit--${pageName}");
$P.schdlControl = new DatasetControl({
dataGetter : obj => obj["List"], appendData : false,
keymapper : info => info ? info.SCHDL_ID : "",
urls : {
create : wctx.url("/mngt/mngt02/020/create.do"),
update : wctx.url("/mngt/mngt02/020/update.do"),
remove : wctx.url("/mngt/mngt02/020/remove.do")
},
formats: {
}
});
/**************************************************************************
* Dataset.on
**************************************************************************/
$P.schdlControl.dataset.onCurrentChange = (dataItem) => {
if(!dataItem){
return;
}
$P.formFields.set(dataItem);
}
/**************************************************************************
* pageObject.function
**************************************************************************/
$P.fnSave = () => {
if(!customValidate($("#frmEdit--${pageName} input"))) return;
var info = $P.formFields.get();
if(info.schdlBgngYmd > info.schdlEndYmd){
alert("시작일자가 종료일자 보다 큽니다.");
return;
}
var create = ($("#schdlId--${pageName}").val() == "");
if(create){
ajax.post({
url : $P.schdlControl.urls.create,
data : info,
success : (resp) => {
if(resp.saved){
dialog.close("scheduleInfoDialog");
dialog.alert({
content:"저장되었습니다.",
init : function() {
setDialogZindex();
focusClose();
},
onClose : () => {
info.schdlId = resp.schdlId;
$P.provided.refresh("add", info);
}
});
}
}
});
} else {
ajax.post({
url : $P.schdlControl.urls.update,
data : info,
success : (resp) => {
if(resp.saved){
dialog.close("scheduleInfoDialog");
dialog.alert({
content:"저장되었습니다.",
init : function() {
setDialogZindex();
focusClose();
},
onClose : () => {
$P.provided.refresh("modify", info);
}
});
}
}
});
}
}
$P.fnRemove = () => {
var info = $P.formFields.get();
ajax.post({
url : $P.schdlControl.urls.remove,
data : info,
success : (resp) => {
if(resp.saved){
dialog.close("scheduleInfoDialog");
dialog.alert({
content:"삭제되었습니다.",
init : function() {
setDialogZindex();
focusClose();
},
onClose : () => {
$P.provided.refresh("del", { schdlId : info.schdlId });
}
});
}
}
});
}
/**************************************************************************
* element.on
**************************************************************************/
$("#btnSave--${pageName}").on('click', () => $P.fnSave());
$("#btnRemove--${pageName}").on('click', () => $P.fnRemove());
/**************************************************************************
* 초기화
**************************************************************************/
initDatepicker("frmEdit--${pageName}"); //달력 초기화
var schdlInfo = ${schdlInfo};
if(schdlInfo != null){
$P.schdlControl.dataset.setData([schdlInfo]);
} else {
$P.schdlControl.dataset.setData([{ SCHDL_BGNG_YMD : "${schdlBgngYmd}", SCHDL_END_YMD : "${schdlEndYmd}" }]);
$("#btnRemove--${pageName}").attr("hidden","hidden");
}
});
</script>

@ -293,9 +293,12 @@ function to2(numberObj) {
* 입력일의 이전일 계산 * 입력일의 이전일 계산
*/ */
function getPrevDay(datestr, days) { function getPrevDay(datestr, days) {
if ( days == "0") return datestr; if ( days == "0")
return datestr;
datestr = datestr.replace(/-/g, ""); datestr = datestr.replace(/-/g, "");
if (datestr == "") return ""; if (datestr == "")
return "";
var dateObj = window.getDateObject(datestr); var dateObj = window.getDateObject(datestr);
dateObj.setDate(dateObj.getDate() - parseInt(days, 10)); dateObj.setDate(dateObj.getDate() - parseInt(days, 10));

Loading…
Cancel
Save