YNICTE/BO/Views/cm/cms.cshtml

479 lines
25 KiB
Plaintext
Raw Normal View History

2020-10-12 14:39:23 +09:00
@model NP.Model.VMCM
<form id="mform" method="post">
<section class="panel panel-default clearfix devsearch" data-cleartbody="tbody1">
2020-10-21 17:23:55 +09:00
@*@Html.Partial("./Partial/SearchCaption")*@
<div class="table-responsive">
<table class="table b-t b-light viewtable">
<colgroup>
<col width="15%" />
<col width="35%" />
<col width="15%" />
<col width="*" />
<col />
</colgroup>
<tbody id="searchtbody">
2020-10-12 14:39:23 +09:00
@if (Model.viewidx == 0)
{
2020-10-21 17:23:55 +09:00
<tr>
<th>년도</th>
<td>
<div class="col-md-12">
<select id="stringval12" name="stringval12" class="form-control">
<option value="">-년도선택</option>
@foreach (var t in Model.Terms.Select(s => s.tyear).Distinct())
{
<option value="@t" @(Model.stringval12 == t.ToString() ? "selected" : "")>@t 년</option>
}
</select>
</div>
</td>
<th>기수</th>
<td>
<div class="col-md-12">
<select id="stringval13" name="stringval13" class="form-control">
<option value="">-기수선택</option>
@foreach (var t in Model.Terms.Where(w => w.tyear.ToString() == Model.stringval13))
{
<option value="@t.tseq" @(Model.stringval13 == t.tseq.ToString() ? "selected" : "")>@t.tseq 기</option>
}
</select>
</div>
</td>
</tr>
2020-10-12 14:39:23 +09:00
}
2020-10-21 17:23:55 +09:00
<tr>
<th>과정분류</th>
<td>
<div class="col-md-6">
@Html.Partial("./Partial/Select", Model.CGs.Where(w => w.pcgno == null), new ViewDataDictionary { { "name", "stringval" }, { "selected", Model.stringval }, { "style", "width: 100%" }, { "df", ":-상위분류" } })
</div>
<div class="col-md-6">
@Html.Partial("./Partial/Select", Model.CGs.Where(w => w.pcgno != null && w.pcgno.ToString() == Model.stringval), new ViewDataDictionary { { "name", "stringval2" }, { "selected", Model.stringval2 }, { "style", "width: 100%;" }, { "df", ":-분류" } })
</div>
</td>
<th>교육유형</th>
<td>
<div class="col-md-12">
@Html.Partial("./Partial/Select", null, new ViewDataDictionary { { "valuetext", "0:온라인;1:오프라인;2:혼합" }, { "name", "stringval3" }, { "selected", Model.stringval3 }, { "style", "width: 100%" }, { "df", ":-유형선택" } })
</div>
</td>
</tr>
<tr>
<th>기술인분류</th>
<td>
<div class="col-md-12">
@Html.Partial("./Partial/Select", Model.ComCodes.Where(w => w.cgroup == "typeman"), new ViewDataDictionary { { "name", "stringval4" }, { "selected", Model.stringval4 }, { "style", "width: 100%" }, { "df", ":-기술인분류" } })
</div>
</td>
<th>교육목적</th>
<td>
<div class="col-md-12">
@Html.Partial("./Partial/Select", Model.ComCodes.Where(w => w.cgroup == "typeedu"), new ViewDataDictionary { { "name", "stringval5" }, { "selected", Model.stringval5 }, { "style", "width: 100%" }, { "df", ":-교육목적" } })
</div>
</td>
</tr>
<tr>
<th>등급</th>
<td>
<div class="col-md-12">
@Html.Partial("./Partial/Select", Model.ComCodes.Where(w => w.cgroup == "typegrade"), new ViewDataDictionary { { "name", "stringval6" }, { "selected", Model.stringval6 }, { "style", "width: 100%" }, { "df", ":-등급" } })
</div>
</td>
<th>직무분야</th>
<td>
<div class="col-md-12">
@Html.Partial("./Partial/Select", Model.ComCodes.Where(w => w.cgroup == "typejob"), new ViewDataDictionary { { "name", "stringval7" }, { "selected", Model.stringval7 }, { "style", "width: 100%" }, { "df", ":-직무분야" } })
</div>
</td>
</tr>
@if (Model.viewidx == 1)
{
<tr>
<th>교육장구분</th>
<td>
<div class="col-md-12">
@Html.Partial("./Partial/Select", Model.ComCodes.Where(w => w.cgroup == "studyplace"), new ViewDataDictionary { { "name", "stringval8" }, { "selected", Model.stringval8 }, { "style", "width: 100%" }, { "df", ":-교육장구분" } })
</div>
</td>
<th>@(Model.viewidxname)명</th>
<td>
<div class="col-md-12">
@Html.Partial("./Partial/Text", Model.stringval9, Helpers.DicText(new NP.Model.TextDic() { Name = "stringval9", Value = Model.stringval9, PH = Model.viewidxname + "명을 입력하세요.", CssClass = "ff" }))
</div>
</td>
</tr>
}
else
{
<tr>
<th>교육장구분</th>
<td>
<div class="col-md-12">
@Html.Partial("./Partial/Select", Model.ComCodes.Where(w => w.cgroup == "studyplace"), new ViewDataDictionary { { "name", "stringval8" }, { "selected", Model.stringval8 }, { "style", "width: 100%" }, { "df", ":-교육장구분" } })
</div>
</td>
<th>학습기간</th>
<td>
<div class="col-md-12">
@Html.Partial("./Partial/Date", Convert.ToDateTime(Model.stringval10), new ViewDataDictionary { { "name", "stringval10" } })~
@Html.Partial("./Partial/Date", Convert.ToDateTime(Model.stringval11), new ViewDataDictionary { { "name", "stringval11" } })
</div>
</td>
2020-10-20 15:42:40 +09:00
2020-10-21 17:23:55 +09:00
</tr>
<tr>
<th>@(Model.viewidxname)명</th>
<td colspan="3">
<div class="col-md-12">
@Html.Partial("./Partial/Text", Model.stringval9, Helpers.DicText(new NP.Model.TextDic() { Name = "stringval9", Value = Model.stringval9, PH = Model.viewidxname + "명을 입력하세요.", CssClass = "ff" }))
</div>
</td>
</tr>
}
</table>
2020-10-12 14:39:23 +09:00
</div>
2020-10-21 17:23:55 +09:00
2020-10-12 14:39:23 +09:00
</section>
2020-10-21 17:23:55 +09:00
<div style="text-align: right; border-bottom: 1px solid #ddd; padding-bottom: 5px;">
<button class="btn btn-default btn-s-xs" type="button" onclick="javascript:submit();"><i class="fa fa-search"></i></button>
</div><br />
2020-10-12 14:39:23 +09:00
<div class="tar buttonbox">
@Html.Partial("./Partial/pagerow", new ViewDataDictionary { { "tbodyid", "tbody1" }, { "searchmethod", "submit()" }, { "pagesize", Model.pagerowcount } })
@*@if (Model.viewidx == 0)
2020-10-21 17:23:55 +09:00
{
<a href="#" onclick="javascript:delme();" class="btn btn-s-xs btn-danger">선택삭제</a>
}*@
2020-10-12 14:39:23 +09:00
<a href="#" onclick="javascript:reg(0);" class="btn btn-s-xs btn-info">등록</a>
</div>
<section class="panel panel-default">
<div class="table-responsive" id="excel1">
<table class="table table-striped b-t b-light">
<thead>
<tr>
@*@if (Model.viewidx == 0)
2020-10-21 17:23:55 +09:00
{
<th><input type="checkbox" onclick="javascript: checkall('excel1', this);" /></th>
}*@
2020-10-12 14:39:23 +09:00
<th width="20">No</th>
<th width="80">@(Model.viewidxname)코드</th>
@Html.Raw(Model.viewidx == 0 ? "<th>기수</th>" : "")
<th>상위분류</th>
<th>분류</th>
<th>유형</th>
<th>@(Model.viewidxname)명</th>
@Html.Raw(Model.viewidx == 1 ? "<th>복제</th>" : "")
@Html.Raw(Model.viewidx == 1 ? "<th>강좌추가</th>" : "")
@Html.Raw(Model.viewidx == 0 ? "<th>신청인원</th>" : "")
@Html.Raw(Model.viewidx == 0 ? "<th>복제</th>" : "")
</tr>
</thead>
<tbody class="data" id="tbody1">
2020-10-21 17:23:55 +09:00
@if (Model.viewidx == 0)
{
foreach (var item in Model.CMs)
2020-10-12 14:39:23 +09:00
{
2020-10-21 17:23:55 +09:00
<tr>
@*@if (Model.viewidx == 0)
{
<td><input type="checkbox" class="autocheck" value="@item.cmno" /></td>
}*@
<td>@item.rnorvt</td>
@*<td>@Html.Raw(Model.addstringval.Contains("," + item.cmno + ",") ? "" : string.Format("<input type=\"checkbox\" class=\"autocheck\" value=\"{0}\" />", item.cmno))</td>*@
<td>@item.cmno</td>
<td>@item.tmname</td>
<td>@item.pcgname</td>
<td>@item.cgname</td>
<td>@item.cshapename</td>
<td class="link cname"><a href="#" onclick="reg(@item.cmno)">@item.cname (@item.classno)</a></td>
<td class="link text-center"><a href="#" onclick="golect(@item.cmno)">@Model.Datas.Where(w => w.intval == item.cmno).Select(w => w.intval2).FirstOrDefault()</a></td>
<td class="link text-center"><a href="#" onclick="copycm(@item.cmno, '@item.cname', @item.pcgno, @item.cgno, @item.pcmno, this)">[복제]</a></td>
</tr>
}
}
else
{
foreach (var item in Model.CMs)
{
<tr>
<td>@item.rnorvt</td>
<td>@item.cmno</td>
<td>@item.pcgname</td>
<td>@item.cgname</td>
<td>@item.cshapename</td>
<td class="link"><a href="#" onclick="reg(@item.cmno)">@item.cname</a></td>
<td class="link text-center"><a href="#" onclick="copycm(@item.cmno, '@item.cname')">[복제]</a></td>
<td class="link text-center"><a href="#" onclick="createcm('r',@item.cmno, @item.pcgno, @item.cgno)">[추가]</a></td>
</tr>
}
}
2020-10-12 14:39:23 +09:00
</tbody>
</table>
</div>
@Html.Pager((int)Model.pagenum, 10, Model.pagerowcount, Model.pagetotalcount)
</section>
</form>
<form id="dform" method="post" action="/cm/@Model.viewname">
@Html.Partial("./Partial/dform", Model, new ViewDataDictionary { { "preform", 1 } })
</form>
<div id="thisbox" class="findbox draggable regbox summernoteparentfixedbox" style="width: 500px; height:500px; z-index: 1041; top: 60px; bottom: 30px; overflow: auto;">
<h4><i class="fa fa-bars"></i> <span id="pcap">강좌등록</span><a href="#" class="btn btn-default btn-xs f-r closethisbox">닫기</a></h4>
<table class="regtable">
<colgroup><col style="width:150px;" /><col /></colgroup>
<tr id="trcopy">
<th>원본강좌</th>
<td><label id="lblorgcname">원본강좌명</label></td>
</tr>
<tr id="trisparent">
<th class="req">과정분류</th>
<td style="line-height: 35px;">
@Html.Partial("./Partial/Select", Model.CGs.Where(w => w.pcgno == null), new ViewDataDictionary { { "special", "reg" }, { "name", "pcgno" }, { "selected", "" }, { "df", ":-상위분류선택" } })
@Html.Partial("./Partial/Select", Model.CGs.Where(w => w.cgno < 1), new ViewDataDictionary { { "special", "reg" }, { "name", "cgno" }, { "selected", "" }, { "df", ":-과정분류선택" } })
</td>
</tr>
<tr>
<th class="req">과정선택</th>
<td>@Html.Partial("./Partial/Select", Model.CMs.Where(w => w.cmno < 1), new ViewDataDictionary { { "special", "reg" }, { "name", "cmno" }, { "selected", "" }, { "df", ":-과정선택" } })</td>
</tr>
<tr>
<th class="req">강좌명</th>
<td>@Html.TextBox("cname", "", new { @class = "form-control ff", @maxlength = "100" })</td>
</tr>
<tr>
<th class="req">기수선택</th>
<td>
<select id="tyear" name="tyear" class="form-control disp-init" style="width: 130px;">
<option value="">-년도선택</option>
@foreach (var t in Model.Terms.Select(s => s.tyear).Distinct())
{
<option value="@t">@t 년</option>
}
</select>
@Html.Partial("./Partial/Select", Model.Terms.Where(w => w.tyear == 1), new ViewDataDictionary { { "special", "reg" }, { "name", "tseq" }, { "selected", "" }, { "df", ":-기수선택" }, { "class", "disp-init" }, { "style", "width:130px;" } })
</td>
</tr>
</table>
<div class="findboxbtnbox">
<a href="#" class="btn btn-primary" onclick="save();" id="btnregcm">강좌등록</a>
</div>
</div>
@section scriptsHeader{
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
2020-10-21 17:23:55 +09:00
@Html.Partial("./Partial/ScriptDate")
2020-10-12 14:39:23 +09:00
}
@section scripts{
<script>
var _viewidx = '@(Model.viewidx)';
var _terms = '@(string.Join(";", Model.Terms.Select(s=>string.Format("{0}:{1}:{2}", s.tmno, s.tyear, s.tseq))))';
var _cgs = '@(string.Join(";", Model.CGs.Select(s=>string.Format("{0}:{1}:{2}", s.pcgno??0, s.cgno, s.cgname))))';
$(document).ready(function () {
2020-10-21 17:23:55 +09:00
$("#stringval12").on("change", function () {
$("#stringval13").val("");
$("#stringval13 option:gt(0)").remove();
2020-10-12 14:39:23 +09:00
if ($(this).val() != "") {
var _y = $(this).val();
$.each(_terms.split(';'), function (i, t) {
if (t.split(':')[1] == _y) {
2020-10-21 17:23:55 +09:00
$("#stringval13").append("<option value=\"" + t.split(':')[2]+"\">" + t.split(':')[2]+" 기</option>")
2020-10-12 14:39:23 +09:00
}
});
}
});
$("#pcgno").on("change", function () {
bindcgno("pcgno", "cgno");
$("#cmno option:gt(0)").remove();
setv("cname", "");
});
$("#stringval").on("change", function () {
bindcgno("stringval", "stringval2");
});
$("#cgno").on("change", function () {
$("#cmno option:gt(0)").remove();
setv("cname", "");
if ($(this).val() != "") {
capp("/acommon/cmget", { cgno: $(this).val() ,isall:1, ismaster: 1 }, "cbgetcm", null, null, null, true);
}
});
$("#tyear").on("change", function () {
bindtseq();
});
});
function cbgetcm() {
if (capResult.obj != null && capResult.obj.length > 0) {
$.each(capResult.obj, function (i, d) {
$("#cmno").append("<option value=\"" + d.cmno + "\" data-countinning=\""+d.countinning+"\">" + d.cname + "</option>");
});
}
}
var _bindcdnocid = "";
function bindcgno(id, cid) {
_bindcdnocid = cid;
$("#" + cid + " option:gt(0)").remove();
if ($("#" + id).val() != "") {
$.each(_cgs.split(';'), function (i, d) {
if (d.split(':')[0] == $("#" + id).val()) {
$("#" + _bindcdnocid).append("<option value=\"" + d.split(':')[1] + "\">" + d.split(':')[2] + "</option>");
}
});
}
}
function reg(no) {
if (_viewidx == '0' && no < 1) {
createcm('r',0, 0, 0);
}
else {
setv("dform_intval", no);
setv("dform_viewname", "@Model.viewname");
setv("dform_listviewname", "@Model.listviewname");
$("#dform").submit();
}
}
function golect(no) {
setv("dform_intval", no);
$("#dform").attr("action", "/croom/cmlects").submit();
}
function copycm(no, nm, pcgno, cgno, pcmno, a) {
if ('@(Model.viewidx)' == '1') {
if (confirm("[" + nm + "] 을 복제하시겠습니까?")) {
alert("[" + nm + "]을 " + "[사본_" + nm + "](으)로 복제를 시작합니다.");
capp("/acommon/cmcopy", { cmno: no }, "cbcopycm");
}
} else {
$("#lblorgcname").text($(a).closest("tr").find("td.cname a").text());
createcm('c',no, pcgno, cgno, pcmno);
}
}
function cbcopycm() {
if (capResult.code == 1000) {
msg("복제하였습니다.", 0, null, null, true);
submit("mform", 500);
}
else { msgadmin(); }
}
function bindtseq() {
$("#tseq").val("");
$("#tseq option:gt(0)").remove();
if ($("#tyear").val() != "") {
var _y = $("#tyear").val();
$.each(_terms.split(';'), function (i, t) {
if (t.split(':')[1] == _y) {
$("#tseq").append("<option value=\"" + t.split(':')[0] + "\">" + t.split(':')[2] + " 기</option>")
}
});
}
}
var _no = 0;
var _pcmno = 0;
function createcm(rc, no, pcgno, cgno, pcmno) {
pcmno = pcmno || 0;
_pcmno = pcmno;
_no = no;
$("#pcgno,#cname,#cgno,#cmno,#tseq").val("");
$("#cgno option:gt(0)").remove(); $("#cmno option:gt(0)").remove();
$("#tseq").val('');
$("#tseq option:gt(0)").remove();
$("#tyear").val('@(DateTime.Now.Year)');
$("#pcgno, #cgno, #cmno").removeAttr("disabled");
$("#btnregcm").text("강좌등록");
$("#trcopy").hide();
if (rc == "c") {
$("#trcopy").show();
$("#pcgno, #cgno, #cmno").attr("disabled", "disabled");
$("#btnregcm").text("강좌복제");
}
bindtseq();
if (_viewidx == '0' && pcmno == 0) {
bglayer(); $("#thisbox").slideDown("fast", function () { $("#thisbox").scrollTop(0); });
} else {
setv("pcgno", pcgno);
bindcgno("pcgno", "cgno");
setv("cgno", cgno);
capp("/acommon/cmcreatebycmmaster", { cgno: cgno }, "cbcmcreatebycmmaster");
}
}
function cbcmcreatebycmmaster() {
var _cname = "";
$.each(capResult.obj, function (i, d) {
$("#cmno").append("<option value=\"" + d.cmno + "\">" + d.cname + "</option>");
if (d.cmno == _no) {
_cname = d.cname;
}
});
if (_pcmno > 0) {
$("#cmno").val(_pcmno);
} else {
$("#cmno").val(_no);
$("#cname").val(_cname);
}
setTimeout(function () {
bglayer(); $("#thisbox").slideDown("fast", function () { $("#thisbox").scrollTop(0); });
}, 100);
}
function save() {
if (check("pcgno", null, "상위과정분류를 선택해주세요.", true)) { }
else if (check("cgno", null, "과정분류를 선택해주세요.", true)) { }
else if (check("cmno", null, "과정을 선택해주세요.", true)) { }
else if (check("cname", null, "강좌명을 입력해주세요.", true)) { }
else if (check("tyear", null, "기수년도를 선택해주세요.", true)) { }
else if (check("tseq", null, "기수를 선택해주세요.", true)) { }
else if (confirm("강좌를 " + (_pcmno < 1 ? "생성" : "복제") + "하시겠습니까?")) {
if (_pcmno == 0) {
capp("/acommon/cmcopy", { cmno: val("cmno"), cname: val("cname"), tmno: $("#tseq").val(), nomaster: true }, "cbsave", null, null, null, true);
}
else {
capp("/acommon/cmcopy", { cmno: _no, cname: val("cname"), tmno: $("#tseq").val(), nomaster: true }, "cbsave", null, null, null, true);
}
}
}
function cbsave() {
if (capResult.code == 1000) {
$("#thisbox").hide();
if ('@Model.viewidx' == '0') {
msg("강좌를 "+ (_pcmno == 0 ? "생성" : "복제") + "하였습니다.", 0, null, null, true);
submit("mform", 500);
}
else {
setTimeout(function () {
if (confirm("강좌등록이 완료되었습니다.\n수정화면에서 구체적으로 확인하시겠습니까?")) {
location.href = "/cm/cmreg?intval=" + capResult.obj;
}
else {
submit("mform", 500);
}
}, 50);
}
} else if (capResult.code == 1) {
msg("회차가 1개라도 생성되어 있어야 강좌를 생성하실 수 있습니다.");
$("#thisbox").hide();
}
else { msgadmin2(); }
}
var _delcount = 0;
function delme() {
_delcount = $("#tbody1 tr td input.autocheck:checked").length;
if (_delcount < 1) {
msg("삭제할 강좌를 선택해주세요.");
} else {
var cmnos = "";
$.each($("#tbody1 tr td input.autocheck:checked"), function (i, c) {
cmnos += "," + $(c).val();
});
if (confirm("선택한 강좌를 삭제하시겠습니까?")) {
capp("/acommon/cmdels", { cmnos: cmnos.substr(1) }, "cbdelete");
}
}
}
function cbdelete() {
if (capResult.code == 1000) {
if (_delcount == capResult.obj) {
msg("삭제했습니다.", 0, null, null, true);
submit(null, 500, true);
} else {
msg(_delcount + "건 중 " + capResult.obj + "건을 삭제했습니다(수강신청된 강좌" + (_delcount - capResult.obj) + ")", 0, null, null, true);
submit(null, 500, true);
}
} else {
msg("수강신청된 강좌가 있습니다. 삭제할 수 없습니다.");
}
}
</script>
}