297 lines
16 KiB
Plaintext
297 lines
16 KiB
Plaintext
@model NP.Model.VMCM
|
|
<div class="row mgclear">
|
|
<form id="mform" method="post" enctype="multipart/form-data" class="form-horizontal">
|
|
<section class="panel panel-default">
|
|
<header class="panel-heading"><strong><i class="fa fa-bars"></i> 기본정보<span class=""></span></strong></header>
|
|
<div class="panel-body">
|
|
<div class="form-group">
|
|
<label class="col-sm-4 col-md-2 control-label req">과정분류</label>
|
|
<div class="col-sm-8 col-md-10">
|
|
@Html.Partial("./Partial/Select", Model.CGs.Where(w => w.pcgno == null), new ViewDataDictionary { { "special", "reg" }, { "name", "pcgno" }, { "selected", Model.CM.pcgno }, { "df", ":-상위분류" }, { "class", "disp-init" } })
|
|
@Html.Partial("./Partial/Select", Model.CGs.Where(w => w.pcgno == Model.CM.pcgno), new ViewDataDictionary { { "special", "reg" }, { "name", "CM.cgno" }, { "selected", Model.CM.cgno }, { "df", ":-과정분류" }, { "class", "disp-init" } })
|
|
</div>
|
|
</div>
|
|
<div class="line line-dashed line-lg pull-in"></div><div class="form-group">
|
|
<label class="col-sm-4 col-md-2 control-label req">기수/패키지명</label>
|
|
<div class="col-sm-8 col-md-10">
|
|
<select id="tyear" name="tyear" class="form-control disp-init" style="width: 130px;" @(Model.CM.cmno > 0 ? "disabled":"")>
|
|
<option value="">-년도선택</option>
|
|
@foreach (var t in Model.Terms.Select(s => s.tyear).Distinct())
|
|
{
|
|
<option value="@t" @(Model.CM.tyear == t ? "selected":"")>@t 년</option>
|
|
}
|
|
</select>
|
|
<select id="tseq" name="CM.tmno" class="form-control disp-init" style="width: 130px;" @(Model.CM.cmno > 0 ? "disabled":"")>
|
|
<option value="">-기수선택</option>
|
|
@foreach (var t in Model.Terms.Where(w=>w.tyear == Model.CM.tyear))
|
|
{
|
|
<option value="@t.tmno" @(Model.CM.tmno == t.tmno ? "selected" : "")>@t.tseq 기</option>
|
|
}
|
|
</select>
|
|
@Html.TextBoxFor(m => m.CM.cname, new { @class = "form-control disp-init ff", @style = "width: 50%", @maxlength = "100", @placeholder = "패키지명을 입력하세요." })
|
|
</div>
|
|
</div>
|
|
@*<div class="line line-dashed line-lg pull-in"></div><div class="form-group">
|
|
<label class="col-sm-4 col-md-2 control-label req">학습기간</label>
|
|
<div class="col-sm-8 col-md-10">@Html.Partial("./Partial/Date", Model.CM.sstime == null ? (DateTime?)null : Convert.ToDateTime(Model.CM.sstime), new ViewDataDictionary { { "name", "CM.sstime" } }) ~ @Html.Partial("./Partial/Date", Model.CM.setime == null ? (DateTime?)null : Convert.ToDateTime(Model.CM.setime), new ViewDataDictionary { { "name", "CM.setime" } })</div>
|
|
</div>
|
|
<div class="line line-dashed line-lg pull-in"></div><div class="form-group">
|
|
<label class="col-sm-4 col-md-2 control-label">메모</label>
|
|
<div class="col-sm-8 col-md-10">@Html.TextAreaFor(m => m.CM.introhtml, new { @class = "form-control", @style = "resize: none; width: 90%; height: 80px; padding: 3px 5px;" })</div>
|
|
</div>*@
|
|
</div>
|
|
</section>
|
|
@Html.HiddenFor(m => m.intval)
|
|
@Html.HiddenFor(m => m.CM.cmno)
|
|
@Html.HiddenFor(m => m.CM.ismaster)
|
|
@Html.HiddenFor(m=>m.savedata)
|
|
</form>
|
|
</div>
|
|
<div class="text-right" style="padding: 3px 5px 5px;"><a href="#" onclick="add()" class="btn btn-s-xs btn-info">강좌추가</a></div>
|
|
<section class="panel panel-default">
|
|
<header class="panel-heading">
|
|
<strong><i class="fa fa-bars"></i> 강좌정보<span class=""></span></strong>
|
|
</header>
|
|
<div class="table-responsive" id="excel1">
|
|
<table class="table table-striped b-t b-light">
|
|
<thead>
|
|
<tr>
|
|
<th width="80" rowspan="2">삭제</th>
|
|
<th width="80" rowspan="2">순서</th>
|
|
<th rowspan="2">기수 | 유형 | 강좌명 | 분반</th>
|
|
<th colspan="2">정가</th>
|
|
<th width="130" rowspan="2">할인율</th>
|
|
<th colspan="2">할인가</th>
|
|
</tr>
|
|
<tr>
|
|
<th>회원</th>
|
|
<th>비회원</th>
|
|
<th>회원</th>
|
|
<th>비회원</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="data" id="tbody1">
|
|
@foreach (var item in Model.CMs)
|
|
{
|
|
<tr data-isnew="0" data-cmno="@item.cmno" class="cmno@(item.cmno)">
|
|
<td><a class="btn btn-xxs btn-danger" href="#" onclick="delcm(@item.cmno, 1, this)">[삭제]</a></td>
|
|
<td class="dseq"><input type="text" class="form-control int nocomma text-center" value="@item.dseq" /></td>
|
|
<td class="text-left">@(item.tmname + " | " + item.cshapename + " | " + item.cname + " | " + item.classno + "반")</td>
|
|
<td class="orginfee text-right">@item.orginfee.ToString("#,0")</td>
|
|
<td class="orgoutfee text-right">@item.orgoutfee.ToString("#,0")</td>
|
|
<td class="drate"><input type="text" class="form-control int nocomma text-center disp-init" style="width: 60%;" value="@item.drate" /> %</td>
|
|
<td class="infee"><input type="text" class="form-control int text-right" value="@item.infee" /></td>
|
|
<td class="outfee"><input type="text" class="form-control int text-right" value="@item.outfee" /></td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<th colspan="3">소계</th>
|
|
<th class="text-right" id="toi">@Model.CMs.Sum(s => s.orginfee).ToString("#,0")</th>
|
|
<th class="text-right" id="too">@Model.CMs.Sum(s => s.orgoutfee).ToString("#,0")</th>
|
|
<th>-</th>
|
|
<th class="text-right" id="ti">@Model.CMs.Sum(s => s.infee).ToString("#,0")</th>
|
|
<th class="text-right" id="to">@Model.CMs.Sum(s => s.outfee).ToString("#,0")</th>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
<div class="botfixempty"> </div>
|
|
<div class="form-group botfix">
|
|
<a href="#" class="btn btn-primary" onclick="save();">저장</a>
|
|
@if (Model.CM.cmno > 0)
|
|
{
|
|
<a href="#" class="btn btn-danger" onclick="del();">삭제</a>
|
|
}
|
|
<a href="#" class="btn btn-default" onclick="golist();">목록</a>
|
|
</div>
|
|
<form id="dform" method="post" action="/cm/pcs">
|
|
@Html.Partial("./Partial/DForm", Model, new ViewDataDictionary { { "preform", 1 } })
|
|
</form>
|
|
@Html.Partial("./Partial/CMBox", "bindCM;강좌 검색;0;0")
|
|
@section styles{
|
|
|
|
}
|
|
@section scriptsHeader{
|
|
@Html.Partial("./Partial/ScriptDate")
|
|
}
|
|
@section scripts{
|
|
<script>
|
|
var _terms = '@(string.Join(";", Model.Terms.Select(s=>string.Format("{0}:{1}:{2}", s.tmno, s.tyear, s.tseq))))';
|
|
var cmboxnotcmno = "@(string.Join(",", Model.CMs.Select(s=>s.cmno)))";
|
|
var cmboxtmno = 0;
|
|
var _delcma;
|
|
function delcm(cmno, issaved, a) {
|
|
if (issaved == 0) {
|
|
recmno($(a).closest("tr").attr("data-cmno"), 0);
|
|
$(a).closest("tr").remove();
|
|
retot();
|
|
} else {
|
|
_delcma = a;
|
|
capp("/acommon/cmcheck", { cmno: @Model.CM.cmno, check: 'cmpcpay' }, "cbdelcm");
|
|
}
|
|
}
|
|
function recmno(cmno, idx) {
|
|
if (idx == 0) {
|
|
var cmnos = "";
|
|
$.each(cmboxnotcmno.split(','), function (i, v) {
|
|
if (v != cmno) {
|
|
cmnos += "," + v;
|
|
}
|
|
});
|
|
cmboxnotcmno = cmnos.substr(0, 1) == "" ? "" : cmnos.substr(1);
|
|
} else {
|
|
cmboxnotcmno = cmboxnotcmno == "" ? cmno : (cmboxnotcmno + "," + cmno);
|
|
}
|
|
}
|
|
function cbdelcm() {
|
|
if (capResult.code == 1000 && capResult.obj == 0) {
|
|
$(_delcma).closest("tr").remove();
|
|
retot();
|
|
msg("저장해야 삭제건이 반영됩니다.");
|
|
} else {
|
|
msg("이미 수강신청된 패키지는 강좌를 삭제할 수 없습니다.");
|
|
}
|
|
}
|
|
function add() {
|
|
cmboxtmno = getint(val("tseq"));
|
|
if ($("#tseq").val() == "") {
|
|
msg("기수를 선택 후 강좌를 추가해주세요.");
|
|
}
|
|
else if ('@(Model.CM.cmno)' == '0') {
|
|
findcmshow();
|
|
} else {
|
|
capp("/acommon/cmcheck", { cmno: @Model.CM.cmno, check: 'cmpcpay' }, "cbadd");
|
|
}
|
|
}
|
|
function cbadd() {
|
|
if (capResult.code == 1000 && capResult.obj == 0) {
|
|
setTimeout(function () {
|
|
findcmshow();
|
|
}, 10);
|
|
} else {
|
|
msg("이미 수강신청된 패키지는 강좌를 추가할 수 없습니다.");
|
|
}
|
|
}
|
|
function del() {
|
|
if (confirm("삭제하시겠습니까?")) {
|
|
capp("/acommon/cmdel", { cmno: @Model.CM.cmno}, "cbdel");
|
|
}
|
|
}
|
|
function cbdel() {
|
|
if (capResult.code == 1000) {
|
|
msgok(0, "", true);
|
|
golist(400, true);
|
|
} else {
|
|
if ('@Model.CM.ismaster' == '0') {
|
|
msg("수강신청정보가 있거나 패키지연동된 강좌가 있습니다. 삭제할 수 없습니다.");
|
|
} else {
|
|
msg("연결된 과정/강좌/콘텐츠가 있습니다. 삭제할 수 없습니다.");
|
|
}
|
|
}
|
|
}
|
|
function bindCM(ui) {
|
|
var maxdseq = 0;
|
|
$.each($("#tbody1 tr td.dseq input"), function (i, c) {
|
|
if (getint($(c).val()) > maxdseq) { maxdseq = getint($(c).val()); }
|
|
});
|
|
maxdseq++;
|
|
$.each($(ui.split(';')), function (i, d) {
|
|
if ($("#tbody1 tr.cmno" + d.split(':')[0]).length < 1) {
|
|
$("#tbody1").append("" +
|
|
"<tr data-isnew=\"1\" data-cmno=\"" + d.split(':')[0] + "\" class=\"cmno" + d.split(':')[0] + "\">" +
|
|
"<th><a class=\"btn btn-xxs btn-danger\" href=\"#\" onclick=\"delcm(" + d.split(':')[0] + ", 1, this)\">[삭제]</a></th>" +
|
|
"<td class=\"dseq\"><input type=\"text\" class=\"form-control int nocomma text-center\" value=\"" + (maxdseq++) + "\" /></td>" +
|
|
"<td class=\"text-left\">" + d.split(':')[2] + " | " + d.split(':')[3] + " | " + d.split(':')[1] + " | " + d.split(':')[4] + "반</td>" +
|
|
"<td class=\"orginfee text-right\">" + bindComma3(d.split(':')[5]) + "</td>" +
|
|
"<td class=\"orgoutfee text-right\">" + bindComma3(d.split(':')[6]) + "</td>" +
|
|
"<td class=\"drate\"><input type=\"text\" class=\"form-control int nocomma text-center disp-init\" style=\"width: 60%;\" value=\"0\" /> %</td>" +
|
|
"<td class=\"infee\"><input type=\"text\" class=\"form-control int text-right\" value=\"" + bindComma3(d.split(':')[5]) + "\" /></td>" +
|
|
"<td class=\"outfee\"><input type=\"text\" class=\"form-control int text-right\" value=\"" + bindComma3(d.split(':')[6]) + "\" /></td></tr>");
|
|
recmno(d.split(':')[0], 1);
|
|
}
|
|
});
|
|
retot();
|
|
}
|
|
function retot() {
|
|
var _toi, _too, _ti, _to;
|
|
_toi = _too = _ti = _to = 0;
|
|
$.each($("#tbody1 tr"), function (i, r) {
|
|
_toi += getint($(r).find("td.orginfee").text());
|
|
_too += getint($(r).find("td.orgoutfee").text());
|
|
_ti += getint($(r).find("td.infee input").val());
|
|
_to += getint($(r).find("td.outfee input").val());
|
|
});
|
|
$("#toi").text(bindComma3(_toi));
|
|
$("#too").text(bindComma3(_too));
|
|
$("#ti").text(bindComma3(_ti));
|
|
$("#to").text(bindComma3(_to));
|
|
}
|
|
$(document).ready(function () {
|
|
$("#pcgno").on("change", function () {
|
|
$("#CM_cgno option:gt(0)").remove();
|
|
if ($(this).val() != "") {
|
|
capp("/acommon/cgget", { pcgno: $(this).val() }, "cbcgget");
|
|
}
|
|
});
|
|
$("#tyear").on("change", function () {
|
|
$("#tseq").val("");
|
|
$("#tseq option:gt(0)").remove();
|
|
if ($(this).val() != "") {
|
|
var _y = $(this).val();
|
|
$.each(_terms.split(';'), function (i, t) {
|
|
if (t.split(':')[1] == _y) {
|
|
$("#tseq").append("<option value=\"" + t.split(':')[0] + "\">" + t.split(':')[2] + " 기</option>")
|
|
}
|
|
});
|
|
}
|
|
});
|
|
$("#tbody1").on("keyup", "td.drate input, td.infee input, td.outfee input", function () {
|
|
if ($(this).parent().hasClass("drate")) {
|
|
var oi = getint($(this).closest("tr").find("td.orginfee").text());
|
|
var oo = getint($(this).closest("tr").find("td.orgoutfee").text());
|
|
var d = getint($(this).val());
|
|
$(this).closest("tr").find("td.infee input").val(bindComma3(oi - (oi * (d / 100))));
|
|
$(this).closest("tr").find("td.outfee input").val(bindComma3(oo - (oo * (d / 100))));
|
|
}
|
|
retot();
|
|
});
|
|
});
|
|
function cbcgget() {
|
|
binddatacheck("CM_cgno");
|
|
}
|
|
function save() {
|
|
if (check("CM_cgno", null, "과정분류를 선택해주세요.")) { }
|
|
else if (check("tseq", null, "기수를 선택해주세요.")) { }
|
|
else if (check("CM_cname", null, "패키지명을 입력해주세요.")) { }
|
|
//else if (check("CM_sstime", null, "학습기간을 입력해주세요.")) { }
|
|
//else if (check("CM_setime", null, "학습기간을 입력해주세요.")) { }
|
|
//else if (getint(val("CM_sstime").replace(/-/, '')) > getint(val("CM_setime").replace(/-/, ''))) { focus("CM_setime"); msg("학습기간이 올바르지 않습니다."); }
|
|
else if ($("#tbody1 tr").length < 1) { msg("강좌를 추가해주세요."); }
|
|
else if (confirm("저장하시겠습니까?")) {
|
|
var sd = "";
|
|
$.each($("#tbody1 tr"), function (i, r) {
|
|
sd += ";" + $(r).attr("data-isnew") + ":" + $(r).attr("data-cmno") + ":" + getint($(r).find("td.dseq input").val()) + ":"
|
|
+ getint($(r).find("td.orginfee").text()) + ":"
|
|
+ getint($(r).find("td.orgoutfee").text()) + ":"
|
|
+ getint($(r).find("td.drate input").val()) + ":"
|
|
+ getint($(r).find("td.infee input").val()) + ":"
|
|
+ getint($(r).find("td.outfee input").val());
|
|
});
|
|
setv("savedata", sd == "" ? "" : sd.substr(1));
|
|
cap("/acommon/cmpcsave", "mform", "cbsave");
|
|
}
|
|
}
|
|
function cbsave() {
|
|
if (capResult.code == 1000) {
|
|
msgok(1, "", true);
|
|
setv("dform_intval", capResult.obj);
|
|
$("#dform").attr("action", "/cm/pcr");
|
|
submit("dform", 500);
|
|
} else { msgdev(); }
|
|
}
|
|
</script>
|
|
}
|