forked from HANYANG/HANYANG_MES
156 lines
4.6 KiB
JavaScript
156 lines
4.6 KiB
JavaScript
jQuery(document).on("click",".btnOpinionSub",function(){
|
|
let opinion_item = jQuery(this).parents(".opinion_item").eq(0);
|
|
opinion_item.find(".opinion_sub").toggleClass("d-none");
|
|
});
|
|
|
|
jQuery(document).on("submit","form[name=opinionForm]",function(event){
|
|
event.preventDefault();
|
|
|
|
let that = this;
|
|
let board_id = jQuery(that).data('board_id');
|
|
let cid = jQuery(that).data('cid');
|
|
let uid = jQuery(that).data('uid');
|
|
let opinion = that.opinion.value.trim();
|
|
let uname = that.uname.value.trim();
|
|
let passwd = that.passwd.value.trim();
|
|
if( !opinion ){
|
|
kuls_alert("내용을 입력하지 않았습니다."); return;
|
|
}
|
|
if( !uname ){
|
|
kuls_alert("작성자를 입력하지 않았습니다."); return;
|
|
}
|
|
if( !passwd ){
|
|
kuls_alert("비밀번호를 입력하지 않았습니다."); return;
|
|
}
|
|
let post_data = new FormData(that);
|
|
post_data.append("mode","putOpinion");
|
|
post_data.append("board_id",board_id);
|
|
post_data.append("cid",cid);
|
|
post_data.append("uid",uid);
|
|
|
|
ajax_form({
|
|
url: "./kbrd.ajax.php",
|
|
type: "POST",
|
|
data: post_data,
|
|
success: function (data) {
|
|
if (!data.code) {
|
|
kuls_alert(data.mesg);
|
|
return;
|
|
}
|
|
if( uid ){
|
|
jQuery("#opinion_sublist_"+uid).load('./kbrd_opinion_sublist.php?board_id='+board_id+'&cid='+cid+'&uid='+uid);
|
|
}else{
|
|
jQuery("#opinion_list").load('./kbrd_opinion.php?board_id='+board_id+'&cid='+cid);
|
|
}
|
|
},
|
|
error: function (request, status, error) {
|
|
kuls_alert(error.message);
|
|
},
|
|
complete: function(){
|
|
that.reset();
|
|
}
|
|
});
|
|
});
|
|
|
|
jQuery(document).on("click",".btnOpinionDel",function(event){
|
|
let frm = jQuery("form[name=frmOpinionDel]");
|
|
let btn = event.target;
|
|
|
|
frm.data('board_id', jQuery(btn).data('board_id'));
|
|
frm.data('cid', jQuery(btn).data('cid'));
|
|
frm.data('uid', jQuery(btn).data('uid'));
|
|
frm.data('oid', jQuery(btn).data('oid'));
|
|
});
|
|
|
|
jQuery("form[name=frmOpinionDel]").on("submit",function(event){
|
|
event.preventDefault();
|
|
|
|
let that = this;
|
|
if( !that.passwd.value.trim() ){
|
|
kuls_alert("비밀번호를 입력하지 않았습니다."); return;
|
|
}
|
|
let post_data = new FormData(that);
|
|
let board_id = jQuery(that).data("board_id");
|
|
let cid = jQuery(that).data("cid");
|
|
let uid = jQuery(that).data("uid");
|
|
let oid = jQuery(that).data("oid");
|
|
post_data.append("mode","delOpinion");
|
|
post_data.append("board_id", board_id);
|
|
post_data.append("cid", cid);
|
|
post_data.append("uid", uid);
|
|
post_data.append("oid", oid);
|
|
|
|
ajax_form({
|
|
url: "./kbrd.ajax.php",
|
|
type: "POST",
|
|
data: post_data,
|
|
success: function (data) {
|
|
if (!data.code) {
|
|
kuls_alert(data.mesg);
|
|
return;
|
|
}
|
|
if( uid == oid ){
|
|
jQuery("#opinion_list").load('./kbrd_opinion.php?board_id='+board_id+'&cid='+cid);
|
|
}else{
|
|
jQuery("#opinion_sublist_"+uid).load('./kbrd_opinion_sublist.php?board_id='+board_id+'&cid='+cid+'&uid='+uid);
|
|
}
|
|
jQuery("#modalOpinionDel .btnClose").trigger("click");
|
|
},
|
|
error: function (request, status, error) {
|
|
kuls_alert(error.message);
|
|
},
|
|
complete: function(){
|
|
that.reset();
|
|
}
|
|
});
|
|
});
|
|
|
|
jQuery(document).on("click",".btnOpinionRej",function(event){
|
|
let frm = jQuery("form[name=frmOpinionRej]");
|
|
let btn = event.target;
|
|
|
|
frm.data('board_id', jQuery(btn).data('board_id'));
|
|
frm.data('cid', jQuery(btn).data('cid'));
|
|
frm.data('uid', jQuery(btn).data('uid'));
|
|
frm.data('oid', jQuery(btn).data('oid'));
|
|
});
|
|
|
|
jQuery("form[name=frmOpinionRej]").on("submit",function(event){
|
|
event.preventDefault();
|
|
|
|
let that = this;
|
|
let post_data = new FormData(that);
|
|
let board_id = jQuery(that).data("board_id");
|
|
let cid = jQuery(that).data("cid");
|
|
let uid = jQuery(that).data("uid");
|
|
let oid = jQuery(that).data("oid");
|
|
post_data.append("mode","rejOpinion");
|
|
post_data.append("board_id", board_id);
|
|
post_data.append("cid", cid);
|
|
post_data.append("uid", uid);
|
|
post_data.append("oid", oid);
|
|
|
|
ajax_form({
|
|
url: "./kbrd.ajax.php",
|
|
type: "POST",
|
|
data: post_data,
|
|
success: function (data) {
|
|
if (!data.code) {
|
|
kuls_alert(data.mesg);
|
|
return;
|
|
}
|
|
if( uid == oid ){
|
|
jQuery("#opinion_list").load('./kbrd_opinion.php?board_id='+board_id+'&cid='+cid);
|
|
}else{
|
|
jQuery("#opinion_sublist_"+uid).load('./kbrd_opinion_sublist.php?board_id='+board_id+'&cid='+cid+'&uid='+uid);
|
|
}
|
|
jQuery("#modalOpinionRej .btnClose").trigger("click");
|
|
},
|
|
error: function (request, status, error) {
|
|
kuls_alert(error.message);
|
|
},
|
|
complete: function(){
|
|
that.reset();
|
|
}
|
|
});
|
|
}); |