YNICTE/BO/Views/cc/memosends.cshtml

115 lines
5.6 KiB
Plaintext
Raw Normal View History

2020-10-12 14:39:23 +09:00
@model NP.Model.VMCC
<header class="panel-heading bg-light" id="thistabbox">
<ul class="nav nav-tabs nav-justified">
<li><a href="#" onclick="gotab(0);" data-toggle="tab">받은쪽지</a></li>
<li class="active"><a href="#" data-toggle="tab">보낸쪽지</a></li>
</ul>
</header>
<form id="mform" method="post">
<div class="buttonbox" style="height: 30px; line-height: 30px;">
<a href="#" onclick="del(1)" class="btn btn-xs btn-info">선택삭제</a>
<a href="#" onclick="del(0)" class="btn btn-xs btn-danger">전체삭제</a>
<a href="#" onclick="showramemainlayer('/cc/memosend');" class="btn btn-xs btn-primary f-r">쪽지발송</a>
</div>
<section class="panel panel-default">
<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 width="50"><input type="checkbox" onclick="javascript: checkall('excel1', this);" /></th>
<th width="100">열람</th>
<th>받는사람</th>
<th>제목</th>
<th>보낸날짜</th>
<th>읽은시간</th>
</tr>
</thead>
<tbody class="data" id="tbody1">
@foreach (var item in Model.Memos2)
{
var ms = Model.Memos3.Where(w => w.mno == item.mno);
<tr>
<td><input type="checkbox" class="autocheck" value="@item.mno" /></td>
<td>
@Html.Raw(ms.Count() == 1 ? string.Format("{0}/{1}", ms.First().isread, 1) : string.Format("<a href=\"#\" class=\"link rv\">{0}/{1}</a>", ms.Where(w => w.isread == 1).Count(), ms.Count()))
<ul class="hidden">@Html.Raw(string.Join("", ms.Select(s => string.Format("<li>-{0}({1}) {2} {3}</li>", s.username, s.email, s.isread > 0 ? "열람" : "미열람", s.rdatetext))))</ul>
</td>
<td>@ms.First().username (@(ms.First().email ?? "-")) @(ms.Count() > 1 ? string.Format(" 외 {0}명", ms.Count() - 1) : "")</td>
<td class="text-left"><a class="link" href="#" onclick="view(@item.mno)" title="@item.mtitle">@item.mtitle</a></td>
<td>@item.cdtymdhms</td>
<td>@(ms.Count() < 2 ? ms.First().rdatetext : (ms.Where(w => w.rdate != null).FirstOrDefault() ?? new NP.Model.Memo() { }).rdatetext)</td>
</tr>
}
</tbody>
</table>
</div>
@Html.Pager((int)Model.pagenum, 10, Model.pagerowcount, Model.pagetotalcount)
</section>
</form>
<form id="dform" method="post" action="">
@Html.Partial("./Partial/DForm", Model, new ViewDataDictionary { { "preform", 1 } })
</form>
@section styles{
<style type="text/css">
#tbody1 tr td ul{position: absolute; z-index: 2; background-color: #fff; border: 1px solid #ddd; border-radius: 3px; padding: 5px 10px; max-height: 150px; line-height: 22px; overflow: auto; text-align: left;}
section.panel.panel-default{background-color: #fff;}
</style>
}
@section scriptsHeader{
}
@section scripts{
<script>
$(document).ready(function () {
$("#tbody1 td a.rv").on("click", function () {
if ($(this).closest("td").find("ul").hasClass("hidden")) {
$("#tbody1 td ul").addClass("hidden");
$(this).closest("td").find("ul").removeClass("hidden");
}
else {
$(this).closest("td").find("ul").addClass("hidden");
}
});
$("#tbody1 td ul").on("click", function () { $(this).addClass("hidden"); });
});
function del(no) {
if (no < 1) {
if ('@(Model.Memos2.Count())' == '0') {
msg("삭제할 쪽지가 없습니다.");
}
else if (confirm("모든 쪽지를 삭제하시겠습니까?")) {
capp("/acommon/delmemo", { sendrcv: "S", isall: true }, "cbdel");
}
}
else if ($("#tbody1 tr input.autocheck:checked").length < 1) {
msg("삭제할 쪽지를 체크해주세요.");
}
else if (confirm("선택한 쪽지를 삭제하시겠습니까?")) {
var mnos = "";
$.each($("#tbody1 tr td input.autocheck:checked"), function (i, c) {
mnos += "," + $(c).val();
});
capp("/acommon/delmemo", { sendrcv: "S", mnos: mnos.substr(1) }, "cbdel");
}
}
function cbdel() {
if (capResult.code == 1000) {
msg("삭제되었습니다.");
$("#PageNum").val(1);
timesubmitauto();
}
}
function view(no) {
showramemainlayer("/cc/memoview?mno=" + no + "&sendorrcv=S");
}
function gotab(idx) {
if (idx == 0) {
$("#dform").attr("action","/cc/memos");
$("#dform_pagenum").val(1);
} else if (idx == 2) {
$("#dform").attr("action","/cc/memosend");
}
timesubmit("dform", 1);
}
</script>
}