168 lines
8.4 KiB
Plaintext
168 lines
8.4 KiB
Plaintext
|
|
@model NP.Model.VMCC
|
||
|
|
@{
|
||
|
|
Layout = "~/Views/Shared/_PopupLayout.cshtml";
|
||
|
|
}
|
||
|
|
<form id="mform" method="post" enctype="multipart/form-data">
|
||
|
|
<section class="panel panel-default">
|
||
|
|
<div class="table-responsive">
|
||
|
|
<table class="table b-t b-light viewtable">
|
||
|
|
<colgroup>
|
||
|
|
<col width="150" />
|
||
|
|
<col />
|
||
|
|
</colgroup>
|
||
|
|
<tbody id="tbody1">
|
||
|
|
@if (Model.mno > 0)
|
||
|
|
{
|
||
|
|
<tr>
|
||
|
|
<th width="100">받는사람</th>
|
||
|
|
<td>
|
||
|
|
<ul id="users" style="max-height: 200px; overflow: auto; padding: 5px; margin: 0;">
|
||
|
|
<li data-user="@Model.Memo.cno" class="user@(Model.Memo.cno)">@Model.Memo.cnoname (@(Model.Memo.email ?? "-"))</li>
|
||
|
|
</ul>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
<tr>
|
||
|
|
<th rowspan="2" width="100">받는사람</th>
|
||
|
|
<td>
|
||
|
|
<label><input type="radio" id="rcvtype0" name="rcvtype" value="0" checked /> 강좌별 발송</label>
|
||
|
|
|
||
|
|
<select id="year" class="form-control disp-init">
|
||
|
|
<option value="">-년도선택</option>
|
||
|
|
@foreach (var y in Model.Terms.Select(s => s.tyear).Distinct())
|
||
|
|
{
|
||
|
|
<option value="@y" @(DateTime.Now.Year == y ? "selected" : "")>@y 년</option>
|
||
|
|
}
|
||
|
|
</select>
|
||
|
|
<select id="tmno" class="form-control disp-init">
|
||
|
|
<option value="">-기수선택</option>
|
||
|
|
@foreach (var t in Model.Terms.Where(w => w.tyear == DateTime.Now.Year))
|
||
|
|
{
|
||
|
|
<option value="@t.tmno">@t.tseq 기</option>
|
||
|
|
}
|
||
|
|
</select>
|
||
|
|
<select id="Memo_cmno" name="Memo.cmno" class="form-control disp-init">
|
||
|
|
<option value="">-강좌(반)선택</option>
|
||
|
|
</select>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>
|
||
|
|
<label class="data-find-float"><input type="radio" id="rcvtype1" name="rcvtype" value="1" /> 개별 발송</label>
|
||
|
|
<a href="#" class="btn btn-info btn-find btn-xs data-find data-find-float" style="margin-left: 20px;" onclick="findusershow()" id="btnuser"><i class="fa fa-search"></i> 수신자 선택</a>
|
||
|
|
<ul id="users" style="max-height: 200px; overflow: auto; padding: 5px; margin: 0;"></ul>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
}
|
||
|
|
<tr><th width="100">제목</th><td>@Html.TextBox("Memo.mtitle", "", new { @class = "form-control", @maxlength = "50" })</td></tr>
|
||
|
|
<tr><th width="100">내용</th><td>@Html.TextArea("Memo.mcontents", "", new { @class = "form-control", @style = "height: 150px; resize: none;" })</td></tr>
|
||
|
|
<tr>
|
||
|
|
<th width="100">첨부파일</th>
|
||
|
|
<td><input type="file" name="file" id="file" /></td>
|
||
|
|
</tr>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
@Html.HiddenFor(m => m.mno)
|
||
|
|
@Html.HiddenFor(m => m.Memo.mno)
|
||
|
|
@Html.HiddenFor(m => m.Memo.pmno)
|
||
|
|
</form>
|
||
|
|
<div class="text-center">
|
||
|
|
<a href="#" class="btn btn-primary" style="margin-right: 10px;" onclick="save();">발송</a>
|
||
|
|
<a href="#" class="btn btn-default" onclick="parent.hideframemainlayer();">닫기</a>
|
||
|
|
</div>
|
||
|
|
@Html.Partial("./Partial/UserBox", "bindUser;사용자 검색;999", new ViewDataDictionary { { "assigns", Model.Assigns },{"userauths",Model.userauths } })
|
||
|
|
<style type="text/css">
|
||
|
|
.btnnobg{background-color: #fff; color: red!important;}
|
||
|
|
#tbody1 tr td ul {
|
||
|
|
max-height: 150px;
|
||
|
|
line-height: 25px;
|
||
|
|
overflow: auto;
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
@section scriptsHeader{
|
||
|
|
|
||
|
|
}
|
||
|
|
@section scripts{
|
||
|
|
<script>
|
||
|
|
var terms = '@(string.Join(";", Model.Terms.Select(s=>string.Format("{0}:{1}:{2}", s.tmno, s.tyear, s.tseq))))';
|
||
|
|
$(document).ready(function () {
|
||
|
|
$("#year").on("change", function () {
|
||
|
|
$("#tmno option:gt(0)").remove();
|
||
|
|
$("#Memo_cmno option:gt(0)").remove();
|
||
|
|
var y = $(this).val();
|
||
|
|
if (y != "") {
|
||
|
|
$.each(terms.split(';'), function (i, t) {
|
||
|
|
if (t.split(':')[1] == y) {
|
||
|
|
$("#tmno").append("<option value=\"" + t.split(':')[0] + "\">" + t.split(':')[2] + " 기</optoin>");
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
$("#tmno").on("change", function () {
|
||
|
|
$("#Memo_cmno option:gt(0)").remove();
|
||
|
|
if ($(this).val() != "") {
|
||
|
|
capp("/acommon/cmgetforboard", { tmno: $(this).val() }, "cbget1");
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
function cbget1() {
|
||
|
|
$.each(capResult.obj, function (i, c) {
|
||
|
|
$("#Memo_cmno").append("<option value=\"" + c.cmno + "\">" + c.cname + "(" + c.classno + ")</optoin>");
|
||
|
|
});
|
||
|
|
}
|
||
|
|
function bindUser(v) {
|
||
|
|
//UserNo:UserType:UserName:Email
|
||
|
|
$.each($(v.split(';')), function (i, d) {
|
||
|
|
var u = d.split(':');
|
||
|
|
if ($("#users li.user" + u[0]).length < 1) {
|
||
|
|
$("#users").append("<li data-user=\"" + u[0] + "\" class=\"user" + u[0] + "\"><a href=\"#\" class=\"btn btn-xxs btn-danger btnnobg\" onclick=\"delthis(this)\">삭제</a> " + u[2] + " (" + u[3] + ")</li>");
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
function save(idx) {
|
||
|
|
if (@Model.mno < 1 && $("#rcvtype0").prop("checked") && $("#Memo_cmno").val() == "") { focus("Memo_cmno"); msg("강좌를 선택해주세요."); }
|
||
|
|
else if (@Model.mno < 1 && $("#rcvtype1").prop("checked") && $("#users li").length < 1) { focus("btnuser"); msg("받는사람을 선택해주세요."); }
|
||
|
|
else if (check("Memo_mtitle", null, "제목을 입력해주세요.")) { }
|
||
|
|
else if (getBytes(val("Memo_mcontents")) < 1) { focus("Memo_mcontents"); msg("내용을 입력해주세요."); }
|
||
|
|
else if (confirm("발송하시겠습니까?")) {
|
||
|
|
var usernos = "";
|
||
|
|
if ($("#rcvtype1").prop("checked")) {
|
||
|
|
$.each($("#users li"), function (i, r) {
|
||
|
|
usernos += "," + $(r).attr("data-user");
|
||
|
|
});
|
||
|
|
}
|
||
|
|
var data = new FormData();
|
||
|
|
data.append("pmno", val("Memo_pmno"));
|
||
|
|
data.append("mtitle", val("Memo_mtitle"));
|
||
|
|
data.append("mcontents", val("Memo_mcontents"));
|
||
|
|
data.append("usernos", @Model.mno != 0 ? "@Model.Memo.cno" : usernos == "" ? "" : usernos.substr(1));
|
||
|
|
if ($("#rcvtype0").prop("checked")){
|
||
|
|
data.append("cmno", val("Memo_cmno"));
|
||
|
|
}
|
||
|
|
if ($("#file")[0].files.length > 0) {
|
||
|
|
data.append("file", $("#file")[0].files[0]);
|
||
|
|
}
|
||
|
|
capfile("/acommon/savememo", data, "cbsave", false, null, true, true);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function cbsave() {
|
||
|
|
if (capResult.code == 1000) {
|
||
|
|
msg("발송되었습니다.");
|
||
|
|
$("a.mainokbutton,a.mainokbutton2").hide();
|
||
|
|
setTimeout(function () {
|
||
|
|
parent.timesubmit("dform", 1);
|
||
|
|
}, 500);
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
msg("해당강좌는 수강생이 없습니다.");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function delthis(a) {
|
||
|
|
$(a).closest("li").remove();
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
}
|