78 lines
3.0 KiB
Plaintext
78 lines
3.0 KiB
Plaintext
@using EnVisage.Code.HtmlHelpers
|
||
@using Microsoft.AspNet.Identity
|
||
@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('Oops...', 'An error occurred while processing your request. Please, try again later.');
|
||
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">Save</button>
|
||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||
</div>
|
||
</div> <!-- / .modal-content -->
|
||
}
|