YNICTE/BO/Views/cm/bookreg.cshtml

156 lines
9.1 KiB
Plaintext
Raw Permalink Normal View History

2020-10-12 14:39:23 +09:00
@model NP.Model.VMCM
<div class="row">
<form id="mform" method="post" enctype="multipart/form-data" class="form-horizontal" action="/cm/termreg">
<section class="panel panel-default">
<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.TextBoxFor(m => m.Book.bkname, new { @class = "form-control ff", @style = "width: 500px;", @maxlength = "50" })</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.TextBoxFor(m => m.Book.author, new { @class = "form-control disp-init", @style = "width: 200px;", @maxlength = "50" })</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.TextBoxFor(m => m.Book.publisher, new { @class = "form-control disp-init", @style = "width: 200px;", @maxlength = "50" })</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.Partial("./Partial/Date", Model.Book.pubdate == null ? (DateTime?)null : Convert.ToDateTime(Model.Book.pubdate), new ViewDataDictionary { { "name", "Book.pubdate" } })</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.Partial("./Partial/File", Model.FileList.Where(w => w.fgno == Model.Book.fgnothumb).ToList(), new ViewDataDictionary {
{ "name", "Book.fgnothumb" },{"value", Model.Book.fgnothumb },{ "fname", "fgnothumb"},
{"width", null },{"table", "book" },{ "column", "fgnothumb"},{"filecount", 1 },
{"readmode", 0 },{"hidemode", 1 },
{ "isimage", 1 },{ "imageid", "fgnothumb" },{ "dftsrc", "/img/common/fair_book_sample01.jpg" },
{ "fileext", "" }, { "loginfo",Model.Book.bkno+"|9"}
})
<br />
<img id="fgnothumb" src="@(Model.FileList.Where(w=>w.fgno == Model.Book.fgnothumb).Count() > 0 && !string.IsNullOrEmpty(Model.FileList.Where(w=>w.fgno == Model.Book.fgnothumb).First().fileurl) ? string.Format("{0}{1}", Model.Files, Model.FileList.Where(w=>w.fgno == Model.Book.fgnothumb).First().fileurl) : "/img/common/fair_book_sample01.jpg")" style="max-width: 135px; max-height: 135px; border-radius: 5px;" />
</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" id="fgnomulti">
@Html.Partial("./Partial/File", Model.FileList.Where(w => w.fgno == Model.Book.fgno).ToList(), new ViewDataDictionary {
{ "name", "Book.fgno" },{"value", Model.Book.fgno },{ "fname", "fgno"},
{"width", null },{"table", "book" },{ "column", "fgno"},{"filecount", 10 },
{"readmode", 0 },{"hidemode", 0 },
{ "isimage", 1 },
{ "fileext", "" }
})
</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.TextBoxFor(m => m.Book.price, new { @class = "form-control int disp-init text-right", @style = "width: 200px;", @maxlength = "15" })</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.Book.introhtml, new { @class = "form-control", @style = "resize: none; width: 90%; height: 80px; padding: 3px 5px;" })</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.Book.contents, new { @class = "form-control", @style = "resize: none; width: 90%; height: 80px; padding: 3px 5px;" })</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.Partial("./Partial/Radio", null, new ViewDataDictionary() { { "valuetext", "1:사용;0:사용안함" }, { "checked", Model.Book.isuse }, { "name", "Book.isuse" } })</div>
</div>
</div>
</section>
@Html.HiddenFor(m => m.intval)
@Html.HiddenFor(m => m.Book.bkno)
</form>
</div>
<div class="botfixempty">&nbsp;</div>
<div class="form-group botfix">
<a href="#" class="btn btn-primary" onclick="save();">저장</a>
@if (Model.Book.bkno > 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/books">
@Html.Partial("./Partial/DForm", Model, new ViewDataDictionary { { "preform", 1 } })
</form>
@section styles{
@Html.Partial("./Partial/Summernotestyle")
}
@section scriptsHeader{
@Html.Partial("./Partial/ScriptDate")
@Html.Partial("./Partial/FileScript")
@Html.Partial("./Partial/Summernote")
}
@section scripts{
<script>
$(document).ready(function () {
if ($("#fgnothumb").attr("src") == "/img/common/fair_book_sample01.jpg") {
$("#fgnothumb").attr("style", "max-width: 135px; max-height: 135px; border: 1px solid gray;");
}
$('#Book_contents,#Book_introhtml').summernote({
height: 100,
tabsize: 2,
callbacks: {
onImageUpload: function (files, editor, welEditable) {
var fdata = new FormData();
fdata.append('img', files[0]);
fdata.append('fd', "Editor");
uploadeditorimage(files, this, fdata, "cbeditorupload()");
}
}
});
//$('#Book_introhtml').summernote({
// height: 100,
// tabsize: 2,
// callbacks: {
// onImageUpload: function (files, editor, welEditable) {
// var fdata = new FormData();
// fdata.append('img', files[0]);
// fdata.append('fd', "Editor");
// uploadeditorimage(files, this, fdata, "cbupload()");
// }
// }
//});
});
function save() {
if (check("Book_bkname", null, "교재명을 입력해주세요.")) { }
else if (confirm("저장하시겠습니까?")) {
var cdata = $('#Book_introhtml').summernote('code');
cdata = cdata == "<p><br></p>" ? "" : cdata;
setv("Book_introhtml", cdata);
cdata = $('#Book_contents').summernote('code');
cdata = cdata == "<p><br></p>" ? "" : cdata;
setv("Book_contents", cdata);
capfileform("/acommon/booksave", "mform", "cbsave");
}
}
function cbsave() {
if (capResult.code == 1000) {
msgok(1, "", true);
golist(700, true);
}
else { msgdev(); }
}
function del() {
if (confirm("삭제하시겠습니까?")) {
capp("/acommon/bookdel", { bkno: @Model.Book.bkno}, "cbdel");
}
}
function cbdel() {
if (capResult.code == 1000) {
msgok(0, null, true);
$("#dform").attr("action", "/cm/books");
submit("dform", 500);
} else {
msg("강좌에 설정된 교재는 삭제할 수 없습니다.");
}
}
</script>
}