EnVisageOnline/Main/Source/EnVisage/Views/Scenarios/_addNote.cshtml

77 lines
3.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@using EnVisage.Code
@model EnVisage.Models.NoteModel
@if (SecurityManager.CheckSecurityObjectPermission(Areas.Scenarios, AccessLevel.Write))
{
ViewBag.AllowEdit = true;
}
<script type="text/javascript">
var _noteDataChanged = false;
function onNoteDataChanged() {
_noteDataChanged = true;
}
function resetNoteDataChanged() {
_noteDataChanged = false;
}
function isNoteDataChanged() {
return _noteDataChanged;
}
function onNoteFailure(xhr) {
showErrorModal('@Resources.Messages.Common_Oops', '@Resources.Messages.Common_YourRequestError');
unblockUI();
}
function onNoteSuccess(data) {
resetNoteDataChanged();
closeEditNoteWindow();
refreshNotes();
unblockUI();
}
$(document).ready(function () {
$.validator.unobtrusive.parse($(this));
$('#edit-note-form').find('input[type=checkbox],input[type=text],select,textarea').on("change", function () {
if (typeof onNoteDataChanged === 'function')
onNoteDataChanged();
});
});
</script>
@using (Ajax.BeginForm(Model.Id == Guid.Empty ? "AddNote" : "EditNote", "Scenarios",
new AjaxOptions { HttpMethod = "Post", OnSuccess = "onNoteSuccess", OnFailure = "onNoteFailure", OnBegin = "blockUI" },
new { @class = "form-horizontal", id = "edit-note-form" }))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.Id)
@Html.HiddenFor(model => model.ParentId)
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">@(Model.Id == Guid.Empty ? "Add Note" : "Edit Note")</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<div class="form-group no-margin-hr">
@Html.LabelFor(model => model.Title, new { @class = "control-label" })
@Html.TextBoxFor(model => model.Title, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Title)
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="form-group no-margin-hr">
@Html.LabelFor(model => model.Details, new { @class = "control-label" })
@Html.TextAreaFor(model => model.Details, new { @class = "form-control", rows = 6 })
@Html.ValidationMessageFor(model => model.Details)
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" id="btnSaveNote">@Resources.Buttons.Common_Save</button>
<button type="button" class="btn btn-default" data-dismiss="modal">@Resources.Buttons.Common_Cancel</button>
</div>
</div> <!-- / .modal-content -->
}