YNICTE/BO/Views/Shared/Partial/UserBoxSelect.cshtml

130 lines
6.6 KiB
Plaintext

@model String
@{
var issingle = Model.Split(';').Length > 3 && Model.Split(';')[3] == "1";
var _parentboxid = Model.Split(';').Length > 4 ? Model.Split(';')[4] : "";
var _userboxftype = Model.Split(';').Length > 5 ? Model.Split(';')[5] : "";
}
<input type="hidden" id="userboxusertypes" value="@Model.Split(';')[2]" />
<div id="userbox" class="findbox" style="width: 900px;">
<h4><i class="fa fa-bars"></i> @Model.Split(';')[1]<a href="#" class="btn btn-default btn-xs f-r" onclick="hideuserbox()">닫기</a></h4>
<br />
@Html.Partial("./Partial/Select", (List<NP.Model.Assign>)ViewData["assigns"], new ViewDataDictionary { { "special", "reg" }, { "name", "userboxasno" }, { "df", ":-소속선택" }, { "style", Model.Split(';')[2] == "999" ? "" : "display: none;" } })
<select id="userboxusertype" class="form-control disp-init" style="@(Model.Split(';')[2] == "999" || Model.Split(';')[2] == "999_1"?"":"display:none;")">
<option value="">-권한선택</option>
@if(Model.Split(';')[2] != "999_1")
{
<option value="1">교육생</option>
}
@if((List<NP.Model.UserAuth>)ViewData["userauths"] != null)
{
foreach(var d in (List<NP.Model.UserAuth>)ViewData["userauths"])
{
<option value="@d.usertype">@d.authname</option>
}
}
@*<option value="11">강사</option>
<option value="81">고객사관리자</option>
<option value="91">통합관리자</option>
<option value="92">일반관리자</option>*@
</select>
<input type="text" class="form-control search disp-init" placeholder="이름/ID로 검색하세요." id="findboxuser" style="width: 200px" /><a href="#" style="margin-top:-5px;" class="btn btn-find btn-info btn-sm" onclick="finduser()">검색</a>
<a href="#" style="margin-top:-5px; display:@(ViewData["assigns"] == null ? "none;":"")" class="btn btn-sm btn-danger" onclick="winopen('/user/professorreg?viewname=professor', 'professorreg',1300, 800);">+추가</a>
<br /><br />
<section class="panel panel-default" style="max-height: 300px; overflow: auto; min-height: 67px;">
<div class="table-responsive" id="excel1">
<table class="table table-striped b-t b-light" style="table-layout: fixed; white-space: nowrap;">
<thead>
<tr>
<th style="@(issingle?"display:none":"")" width="50"><input type="checkbox" onclick="javascript: checkall('excel1', this);" /></th>
<th style="width:110px;">구분</th>
<th>소속</th>
<th style="width:200px;">이름(ID)</th>
<th>이메일</th>
<th>휴대폰</th>
</tr>
</thead>
<tbody class="data" id="userlistbox"></tbody>
</table>
</div>
</section>
@if (!issingle)
{
<div><a href="#" class="btn btn-primary btn-xs" onclick="selectuser()">선택</a></div>
}
<br /><br />
</div>
<script>
var userboxftype = 0;
var userboxabsasno = 0;
function selectuser() {
if ($("#userlistbox tr td input.autocheck:checked").length < 1) {
msg2("사용자를 선택해주세요.");
} else {
var v = "";
$.each($("#userlistbox tr td input.autocheck:checked"), function (i, c) {
v += ";" + $(c).val();
});
$("#userlistbox tr").remove();
hideuserbox();
eval("@(Model.Split(';')[0])" + "('" + v.substr(1) + "')");
}
}
function userboxviewregbox() {
if ($('#userboxregbox:visible').length < 1) {
$('#userboxregbox').show();
}
else {
$('#userboxregbox').hide();
}
}
function findusershow() {
if ('@(_parentboxid)' != "") {
$("#@(_parentboxid)").hide();
}
bglayer();
$("#userbox").slideDown("fast");
focus("findboxuser");
}
function finduser() {
$("#userlistbox").html("");
//if (val("findboxuser") == "") {
// focus("findboxuser");
// msg2("이름을 입력해주세요.");
//} else {
// capp("/acommon/userfind", { ftype: userboxftype/*, usertypes: val("userboxusertypes"), asno: val("userboxasno")*/, username: val("findboxuser") }, "cbfinduser", null, null, true, true);
//}
capp("/acommon/userfind", {
ftype: 1, usertypes: '@(_userboxftype)'=='2' ? val("userboxusertypes") : null, asno: val("userboxasno"), usernameid: val("findboxuser"), asno: userboxabsasno == 0 ? val("userboxasno") : userboxabsasno, usertype: userboxftype == 2 ? val("userboxusertypes") : val("userboxusertype") }, "cbfinduser", null, null, true, true);
}
function cbfinduser() {
if (capResult.code == 1000) {
$.each($(capResult.obj), function (i, r) {
$("#userlistbox").append("<tr><td style=\"@(issingle?"display:none;":"")\"><input type=\"radio\" class=\"autocheck\" name=\"rdoInstructors\" value=\"" +
r.userno + ":" +
r.usertype + ":" +
getdb(r.username).replace(/:/gi, '|').replace(/;/gi, '|') + ":" +
getdb(r.email).replace(/:/gi, '|').replace(/;/gi, '|') + ":" +
r.isjoin + ":" +
getdb(r.isjoinname) + ":" +
getdb(r.asname) + ":" +
getdb(r.userid) + ":" +
getdb(r.asno) + "\" /></td>" +
"<td>" + r.usertypestr + "</td>" +
"<td>" + getdb((r.usertype == 11 ? r.pasname : r.asname)).replace(/:/gi, '|').replace(/;/gi, '|') + "</td>" +
(@(issingle?1:0) == 1 ?
("<td class=\"link\"><a href=\"#\" onclick=\"$(this).closest('tr').find('input.autocheck').prop('checked', true);selectuser()\">" + getdb(r.username).replace(/:/gi, '|').replace(/;/gi, '|') + "(" + getdb(r.userid).replace(/:/gi, '|').replace(/;/gi, '|') + ")" + "</a></td>")
: ("<td > " + getdb(r.username).replace(/:/gi, '|').replace(/;/gi, '|') + "(" + getdb(r.userid).replace(/:/gi, '|').replace(/;/gi, '|') + ")" + "</td>")) +
"<td>" + getdb(r.email) + "</td>" +
"<td>" + getdb(r.mobile) + "</td>" +
"</tr>");
});
}
}
function hideuserbox() {
if ('@(_parentboxid)' != "") {
$('#userbox').slideUp('fast'); $('#@(_parentboxid)').slideDown('fast');
} else {
$('#userbox').slideUp('fast'); $('#bglayer').hide();
}
}
</script>