YNICTE/FO/Views/Course/Partial/ThisBoxUser.cshtml

359 lines
20 KiB
Plaintext
Raw Normal View History

2020-10-12 14:39:23 +09:00
@model dynamic
@{
var _method = ViewData["bindmethod"].ToString();
var ccpositions = ViewData["ccposition"] == null ? new List<NP.Model.ComCode>() { } : (List<NP.Model.ComCode>)ViewData["ccposition"];
var asno = ViewData["asno"] ?? "0";
}
<div class="clsPop clsPopFull" id="thisboxuser">
<div id="thisboxuser0">
<div>
<div class="clsPopWrap">
<div class="clsPopTitle"><h5>참가자추가</h5><a href="#" onclick="thisboxuserclose()"></a></div>
<div class="clsPopCont">
<div class="clspSch slct">
<select id="thisboxuser_findtype">
<option value="username">이름</option>
<option value="email">이메일</option>
</select>
<input type="text" id="thisboxuser_text">
<input type="button" class="btn-find" value="검색" onclick="thisboxuserfind()">
</div>
<table class="clspCpny">
<tbody id="thisboxuser_data"></tbody>
</table>
<div class="paging" id="thisboxuser_paging" data-method="thisboxuserpagego" data-lastpage="0"></div>
<div style="display: none;" id="thisboxusernewdata">
<p class="sctyNone">
<span id="thisboxuser_nouser">‘김공수’</span> 님이 존재하지 않습니다.<br />
신규로 등록하기 버튼을 클릭하여 새롭게 등록해주세요.
</p>
</div>
<div class="sctyBtn">
<a href="#" onclick="thisboxusernewuser()" id="btnthisboxusernewuser">신규로 등록하기</a>
</div>
</div>
</div>
</div>
</div>
<div id="thisboxuser1" style="display: none;">
<div>
<div class="clsPopWrap">
<div class="clsPopTitle">
<h5 id="thisboxusertitle">참가자 신규등록</h5>
<a href="#" onclick="thisboxuserclose();"></a>
</div>
<div class="clsPopScroll">
<div class="clsPopCont">
<table class="clsTable sctyTable">
<tbody>
<tr>
<th>이름</th>
<td>
<input type="text" id="thisboxuser_username" style="width:100%;">
</td>
</tr>
<tr>
<th>직위<span>*</span></th>
<td>
<select id="thisboxuser_ccposition">
<option value="">선택</option>
@Html.Partial("./Partial/option", ccpositions, new ViewDataDictionary { { "selected", "" } })
</select>
<input type="text" id="thisboxuser_ccpositionetc" style="width:100px; display:none;" value="">
</td>
</tr>
<tr>
<th>부서</th>
<td><input type="text" id="thisboxuser_depart" style="width:100%;"></td>
</tr>
<tr>
<th>이메일<span class="hideupdate">*</span><br /><em class="hideupdate">(ID로사용)</em></th>
<td>
<input type="text" id="thisboxuser_email" style="width:100%;">
</td>
</tr>
<tr>
<th>회사전화번호<span>*</span><br /><em class="hideupdate">(비밀번호로사용)</em></th>
<td>
<input type="text" id="thisboxuser_telno" class="int nocomma" style="width:100%;">
</td>
</tr>
<tr>
<th>휴대전화번호<span>*</span></th>
<td>
<input type="text" id="thisboxuser_mobile" class="int nocomma" style="width:100%;">
</td>
</tr>
<tr>
<th>공정거래업무경력<span>*</span></th>
<td>
<select id="thisboxuser_kfcfyear">
<option value="">선택</option>
<option value="1">1년</option>
<option value="2">2년</option>
<option value="3">3년</option>
<option value="4">4년</option>
<option value="5">5년이상</option>
</select>
</td>
</tr>
<tr>
<th>사업장과의관계</th>
<td>
<ul class="sctyRadio">
<li><input type="radio" name="thisboxuser_isassignuser" id="thisboxuser_isassignuser1" /><label for="thisboxuser_isassignuser1">자사근로자</label></li>
<li><input type="radio" name="thisboxuser_isassignuser" id="thisboxuser_isassignuser2" /><label for="thisboxuser_isassignuser2">타사근로자</label></li>
</ul>
</td>
</tr>
<tr>
<th>연합회 교육이력</th>
<td>
<ul class="sctyChk">
<li><input type="checkbox" name="thisboxuser_edus" id="thisboxuser_edus1" /><label for="thisboxuser_edus1">공정거래 일반</label></li>
<li><input type="checkbox" name="thisboxuser_edus" id="thisboxuser_edus2" /><label for="thisboxuser_edus2">불공정 거래행위</label></li>
<li><input type="checkbox" name="thisboxuser_edus" id="thisboxuser_edus3" /><label for="thisboxuser_edus3">부당한 공동행위</label></li>
<li><input type="checkbox" name="thisboxuser_edus" id="thisboxuser_edus4" /><label for="thisboxuser_edus4">하도급거래</label></li>
<li><input type="checkbox" name="thisboxuser_edus" id="thisboxuser_edus5" /><label for="thisboxuser_edus5">부당내부거래 </label></li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="sctyBtn">
<a href="#" onclick="thisboxusersavenewuser()">참가자 추가</a>
</div>
</div><!-- clsPopCont -->
</div>
</div><!-- clsPopWrap -->
</div>
</div>
</div>
<script>
var thisboxuser_pagenum = 1;
var thisboxuser_pagetc = 0;
var thisboxuser_asno = 0;
var thisboxuser_userno = 0;
var thisboxuser_issearchenter = false;
$(document).ready(function () {
$("#thisboxuser_ccposition").on("change", function () {
$("#thisboxuser_ccpositionetc").hide();
if ($(this).find("option:selected").text() == "기타") {
$("#thisboxuser_ccpositionetc").show().focus();
}
});
$("#thisboxuser_findtype").on("change", function () {
if (!ismobile()) { $("#thisboxuser_text").focus(); }
thisboxuser_pagenum = 1;
$("#thisboxuser_data tr").remove();
$("#thisboxuser_paging").html("");
$("#thisboxusernewdata").hide();
});
$("#thisboxuser_text").on("keydown", function (e) {
if (e.keyCode == 13) {
thisboxuser_issearchenter = true;
//$(this).next(".btn-find").focus();
thisboxuserfind();
}
}).on("change", function () {
//if (!thisboxuser_issearchenter) {
// thisboxuser_pagenum = 1;
// $("#thisboxuser_data tr").remove();
// $("#thisboxuser_paging").html("");
// $("#thisboxusernewdata").hide();
//}
});
$("#thisboxuser1 input,#thisboxuser1 select").on("change", function () {
_thisboxuserismodified = true;
});
});
function thisboxuserview() {
$("#thisboxuser0").show();
$("#thisboxuser1").hide();
$("#thisboxuser_text").val("");
$("#thisboxuser_data tr").remove();
$("#thisboxuser_paging").html("");
thisboxuser_pagenum = 1;
$("#thisboxuser").slideDown("fast");
$("#thisboxusernewdata").hide();
if (!ismobile()) { $("#thisboxuser_text").focus();}
}
function thisboxuserfind() {
//if (check("thisboxuser_text")) {
// msg((val("thisboxuser_findtype") == "username" ? "이름을 " : "이메일을 ") + "입력 후 검색해주세요.");
//} else {
capp("/fcommon/userfind", { asno: thisboxuser_asno, username: val("thisboxuser_findtype") == "username" ? val("thisboxuser_text") : null, email: val("thisboxuser_findtype") == "email" ? val("thisboxuser_text") : null, pno: thisboxuser_pagenum }, "cbthisboxuserfind");
//}
}
function cbthisboxuserfind() {
$("#thisboxuser_data").html("");
$("#thisboxusernewdata").hide();
$("#thisboxuser_paging").html("");
$.each(capResult.obj, function (i, d) {
$("#thisboxuser_data").append("<tr><th><p>" + (d.username.length < 3 ? (d.username.substr(0, 1) + "*") : (d.username.substr(0, 1) + "*" + d.username.substr(2, 1))) + " " + getdb(d.ccpositionname) + "(" + (getdb(d.email)==""?"-": (d.email.split('@@')[0].length < 4 ? d.email.split('@@')[0] : d.email.split('@@')[0].substr(0, 4)) + "****@@" + d.email.split('@@')[1]) + ")</p></th><td><a href=\"#\" onclick=\"thisboxuseruserview("+d.userno+")\">선택</a></td></tr>");
});
if (capResult.obj.length > 0) {
poppaging("thisboxuser_paging", capResult.obj.length < 1 ? 0 : capResult.obj[0].pagetotalcount, thisboxuser_pagenum);
} else {
$("#thisboxuser_nouser").text("" + val("thisboxuser_text") + "");
setTimeout(function () {
$("#btnthisboxusernewuser").focus();
}, 10);
$("#thisboxusernewdata").show();
}
thisboxuser_issearchenter = false;
}
function thisboxuserpagego(goc) {
if (goc == 'F') { thisboxuser_pagenum = 1; }
else if (goc == 'P') { thisboxuser_pagenum -= 1; }
else if (goc == 'N') { thisboxuser_pagenum += 1; }
else if (goc == 'L') { thisboxuser_pagenum = getint($("#thisboxuser_paging").attr("data-lastpage")); }
else { thisboxuser_pagenum = getint(goc); }
thisboxuserfind();
}
function thisboxuserselectsingle(v) {
thisboxuserclose();
eval("@(_method)" + "('" + v + "')");
}
function thisboxuserclose() {
$('#thisboxuser').slideUp('fast');
}
function thisboxusernewdata() {
if (val("thisboxuser_brno") == "") {
if (!ismobile()) { $("#thisboxuser_brno").focus(); }
msg("사업자등록번호를 확인해주세요.");
} else if (val("thisboxuser_brno").replace(/-/gi, '').length != 10) {
if (!ismobile()) { $("#thisboxuser_brno").focus(); }
msg("사업자등록번호 10자리를 입력후 검색해주세요.");
} else if (val("thisboxuser_asname") == "") {
if (!ismobile()) { $("#thisboxuser_asname").focus(); }
msg("직장명을 입력해주세요.");
} else {
confirmtoggle(true, "직장을 등록하시겠습니까?", "thisboxusergogo()");
}
}
function thisboxusergogo() {
setTimeout(function () {
capp("/fcommon/newuser", {
brno: val("thisboxuser_brno"),
asname: val("thisboxuser_asname")
}, "cbthisboxusernewuser");
}, 10);
}
function cbthisboxusernewuser() {
if (capResult.code == 1000) {
setTimeout(function () {
thisboxuserfind();
}, 10);
}
}
function thisboxuseruserview(userno) {
thisboxuser_userno = userno;
capp("/fcommon/userget", { userno: userno }, "cbthisboxuseruserviewuserget");
}
function cbthisboxuseruserviewuserget() {
_thisboxuserismodified = false;
var d = capResult.obj;
$(".hideupdate").hide();
setv("thisboxuser_username", d.username); $("#thisboxuser_username").attr("readonly", "readonly"); $("#thisboxuser_username").addClass("readonly");
setv("thisboxuser_ccposition", getdb(d.ccposition));
$("#thisboxuser_ccpositionetc").hide();
if ($("#thisboxuser_ccposition").find("option:selected").text() == "기타") {
$("#thisboxuser_ccpositionetc").show().focus();
}
setv("thisboxuser_ccpositionetc", getdb(d.ccpositionetc));
setv("thisboxuser_depart", getdb(d.depart));
setv("thisboxuser_email", getdb(d.email)); $("#thisboxuser_email").attr("readonly", "readonly"); $("#thisboxuser_email").addClass("readonly");
setv("thisboxuser_telno", getdb(d.telno));
setv("thisboxuser_mobile", getdb(d.mobile));
setv("thisboxuser_kfcfyear", getdb(d.kfcfyear));
$("#thisboxuser_isassignuser" + getdb(d.isassignuser)).prop("checked", true);
var edus = fillzero(getdb(d.edus), true, 5);
$("#thisboxuser_edus1").prop("checked", edus.substr(0, 1) == "1" ? "checked" : "");
$("#thisboxuser_edus2").prop("checked", edus.substr(1, 1) == "1" ? "checked" : "");
$("#thisboxuser_edus3").prop("checked", edus.substr(2, 1) == "1" ? "checked" : "");
$("#thisboxuser_edus4").prop("checked", edus.substr(3, 1) == "1" ? "checked" : "");
$("#thisboxuser_edus5").prop("checked", edus.substr(4, 1) == "1" ? "checked" : "");
$("#thisboxuser0").hide();
$("#thisboxuser1").show();
}
var _thisboxuserismodified = false;
function thisboxusernewuser() {
thisboxuser_userno = 0;
$(".hideupdate").show();
$("#thisboxuser_username,#thisboxuser_email").removeAttr("readonly");
$("#thisboxuser_username,#thisboxuser_email").removeClass("readonly");
$("#thisboxuser_username,#thisboxuser_ccposition,#thisboxuser_depart,#thisboxuser_email,#thisboxuser_telno,#thisboxuser_mobile,#thisboxuser_kfcfyear").val("");
$("#thisboxuser_isassignuser1").prop("checked", true);
$("#thisboxuser_edus1,#thisboxuser_edus2,#thisboxuser_edus3,#thisboxuser_edus4,#thisboxuser_edus5").prop("checked", false);
$("#thisboxuser0").hide();
$("#thisboxuser1").show();
}
function thisboxusersavenewuser() {
setv("thisboxuser_mobile", formatmobile(val("thisboxuser_mobile")));
if (thisboxuser_userno < 1 && val("thisboxuser_username") == "") { $("#thisboxuser_username").focus();msg("이름을 입력해주세요."); }
else if (check("thisboxuser_ccposition", null, "직위를 선택해주세요.")) { }
else if (thisboxuser_userno < 1 && (val("thisboxuser_email") == "" || !isemail(val("thisboxuser_email")))) { $("#thisboxuser_email").focus();msg("이메일을 확인해주세요."); }
else if (val("thisboxuser_telno") == "") { $("#thisboxuser_telno").focus(); msg("회사전화번호를 확인해주세요."); }
else if (thisboxuser_userno < 1 && val("thisboxuser_mobile") == "") { $("#thisboxuser_mobile").focus(); msg("휴대전화번호를 확인해주세요."); }
else if (thisboxuser_userno < 1 && !ismobilenumber(val("thisboxuser_mobile"))) { $("#thisboxuser_mobile").focus(); msg("휴대전화번호를 확인해주세요."); }
else if (val("thisboxuser_kfcfyear") == "") { $("#thisboxuser_kfcfyear").focus();msg("공정거래업무경력을 선택해주세요."); }
else if (thisboxuser_userno > 0 && !_thisboxuserismodified) {
thisboxuserbindme();
}
else if (thisboxuser_userno < 1 && !isemail(val("thisboxuser_email"))) { msg("이메일을 확인해주세요."); }
else if (val("thisboxuser_mobile") != "" && !ismobilenumber(val("thisboxuser_mobile"))) { msg("핸드폰번호를 확인해주세요."); }
else {
confirmtoggle(true, "참가자" + (thisboxuser_userno < 1 ? "를 등록": "정보를 수정")+"하고 추가하시겠습니까?", "thisboxusergogo()");
}
}
function thisboxusergogo() {
capp("/fcommon/usernew", {
asno: thisboxuser_asno,
userno: thisboxuser_userno,
username: val("thisboxuser_username"),
ccposition: val("thisboxuser_ccposition"),
ccpositionetc: val("thisboxuser_ccpositionetc"),
depart: val("thisboxuser_depart"),
email: val("thisboxuser_email"),
telno: val("thisboxuser_telno"),
mobile: val("thisboxuser_mobile"),
kfcfyear: val("thisboxuser_kfcfyear"),
isassignuser: $("#thisboxuser_isassignuser1").prop("checked")?1:0,
edus: ($("#thisboxuser_edus1").prop("checked") ? "1" : "0") + ($("#thisboxuser_edus2").prop("checked") ? "1" : "0") + ($("#thisboxuser_edus3").prop("checked") ? "1" : "0") + ($("#thisboxuser_edus4").prop("checked") ? "1" : "0") + ($("#thisboxuser_edus5").prop("checked") ? "1" : "0")
}, "cbthisboxuserusernew");
}
function cbthisboxuserusernew() {
if (capResult.code == 1000) {
if (thisboxuser_userno < 1) {
thisboxuser_userno = capResult.obj;
}
thisboxuserbindme();
} else if (capResult.obj == -1) {
focus("thisboxuser_email");
msg("이미 사용중인 이메일입니다.");
} else if (capResult.obj == -2) {
focus("thisboxuser_email");
msg("이미 사용중인 이메일주소입니다.");
}
}
function thisboxuserbindme() {
var edus = "";
edus += ($("#thisboxuser_edus1").prop("checked") ? ", 공정거래 일반" : "");
edus += ($("#thisboxuser_edus2").prop("checked") ? ", 불공정거래행위" : "");
edus += ($("#thisboxuser_edus3").prop("checked") ? ", 부당한 공동행위" : "");
edus += ($("#thisboxuser_edus4").prop("checked") ? ", 하도급거래" : "");
edus += ($("#thisboxuser_edus5").prop("checked") ? ", 부당내부거래" : "");
thisboxuserclose();
eval("@(_method)" + "(" + thisboxuser_userno + "," +
"'" + val("thisboxuser_username") + "'," +
"'" + $("#thisboxuser_ccposition option:selected").text() + "'," +
"'" + ($("#thisboxuser_isassignuser1").prop("checked") ? "자사근로자" : "타사근로자") + "'," +
"'" + val("thisboxuser_email") + "'," +
"'" + val("thisboxuser_telno") + "'," +
val("thisboxuser_kfcfyear") + "," +
"'" + (edus == "" ? "" : edus.substr(2)) + "')");
}
</script>