-
-
Save BrianJVarley/9c6352cc03f1ec38ee3db6237b19519f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model dynamic | |
<div class="container body-content"> | |
<div class="page-header"> | |
<div class="form-group"> | |
<fieldset> | |
<form id="createForm" class="form-group has-feedback" method="post"> | |
<div class="form-horizontal"> | |
<!-- Outage Start --> | |
<div class="form-group required"> | |
<label class="col-md-9 control-label" style="text-align: left;" for="OutageStartDisplay">Outage Start (UTC)</label> | |
<div class="col-md-9"> | |
<div class='input-group date' id='OutageStartDisplay'> | |
<input type='text' class="form-control" id="outageStartInput" required readonly name="OutageStartInput" /> | |
<span class="input-group-addon" id="OutageStartDisplayCalendar"> | |
<span class="glyphicon glyphicon-calendar"></span> | |
</span> | |
</div> | |
</div> | |
</div> | |
<!-- Outage Start Hidden Field --> | |
<div class="hidden"> | |
<input id="OutageStart" name="OutageStart" type="text" class="label-info"><input> | |
</div> | |
</div> | |
</form> <!--END OF FORM ^^--> | |
</fieldset> | |
</div> | |
</div> | |
</div> | |
<script> | |
var outageStart; | |
//Once the Document DOM is ready.. | |
$(document).ready(function () { | |
var currentDateTime = new Date(); | |
currentDateTime.setMinutes(currentDateTime.getMinutes() + currentDateTime.getTimezoneOffset()); | |
var $createForm = $('#createForm'); | |
//Init the Outage Start date time picker | |
$(function () { | |
$('#OutageStartDisplay').datetimepicker({ | |
defaultDate: currentDateTime, | |
ignoreReadonly: true, | |
allowInputToggle: true, | |
widgetPositioning: { | |
horizontal: 'right', | |
vertical: 'bottom' | |
} | |
}); | |
}); | |
//On change of the OutageStartDisplay datetime picker | |
//update's the OutageStart hidden field with the datetime. | |
$("#OutageStartDisplay").on("dp.change", function (e) { | |
outageStart = moment.utc(e.date); | |
$('#OutageStart').val(moment.utc(e.date).format()); | |
}); | |
//Ajax POST method fired on submitAndEmailBtn button click | |
//Submits serialized JSON of form inputs | |
$('#btnSubmit').click(function(evt) | |
{ | |
evt.preventDefault ? evt.preventDefault() : (evt.returnValue = false); | |
swal({ | |
title: "Send", | |
text: "Are you sure?", | |
type: "warning", | |
showCancelButton: true, | |
closeOnConfirm: false, | |
showLoaderOnConfirm: true, | |
}, function () { | |
$.ajax({ | |
url: "@(Url.Action("EmailAndSubmit", "CreateEscalation"))", | |
type: 'POST', | |
traditional: true, | |
data: $("#createForm").serialize(), | |
dataType: "json", | |
success: function (result) { | |
if (result.Success) { | |
swal("Sent"); | |
window.location.href = result.redirectUrl; | |
} | |
else { | |
swal("Error","Error"); | |
} | |
}, | |
}); | |
}); //end of btnSubmit click event | |
});//end $(document).ready | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment