@model rightmobilesite.models.pulse
@{
viewbag.title = "setdates";
}
<h2>setdates</h2>
<div>
@html.actionlink("pulse", "editpulse", new { pulseid = model.pulseid }) >
@html.label("set dates", "setdates") >
@html.actionlink("view pulse", "viewpulse",new { pulseid=model.pulseid }) >
@html.actionlink("select audience", "index") >
@html.actionlink("send for approval", "index")
</div>
<script src="@url.content("~/scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@url.content("~/scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@url.content("~/scripts/jquery.ui.datetimepicker.js")" type="text/javascript"></script>
<script type="text/javascript">
<!--
function datediff(interval, date1, date2) {
var objinterval = { 'd': 1000 * 60 * 60 * 24, 'h': 1000 * 60 * 60, 'm': 1000 * 60, 's': 1000, 't': 1 };
interval = interval.touppercase();
var dt1 = new date(date.parse(date1.replace(/-/g, '/')));
var dt2 = new date(date.parse(date2.replace(/-/g, '/')));
try {
return math.round((dt2.gettime() - dt1.gettime()) / eval('objinterval.' + interval));
}
catch (e) {
return e.message;
}
}
function calc() {
var a = $("input#pulsestartdate").val();
var b = $("input#pulsefinishdate").val();
return datediff('d',a,b);
}
function setretval() {
$("input#duration").val(calc());
return (true);
}
//-->
$(function () {
$("input#pulsestartdate").datetimepicker();
$("input#pulsefinishdate").datetimepicker();
$("input#duration").val(calc());
$("input#pulsestartdate").change(function () {
setretval();
});
$("input#pulsefinishdate").blur(function () {
setretval();
});
$("input#pulsefinishdate").change(function () {
setretval();
});
});
</script>
@using (html.beginform())
{
@html.hiddenfor(model => model.pulseid)
@html.validationsummary(true)
<fieldset>
<legend>pulse</legend>
<div class="editor-label">
@html.labelfor(model => model.pulsestartdate)
</div>
<div class="editor-field">
@html.editorfor(model => model.pulsestartdate)
@html.validationmessagefor(model => model.pulsestartdate)
</div>
<div class="editor-label">
@html.labelfor(model => model.pulsefinishdate)
</div>
<div class="editor-field">
@html.editorfor(model => model.pulsefinishdate)
@html.validationmessagefor(model => model.pulsefinishdate)
</div>
<div class="editor-label">
@html.label("pulse duration")
</div>
<div class="editor-label">
<input type="text" id="duration"/>
@html.label("days")
</div>
<p>
<input type="submit" value="setdates" />
</p>
</fieldset>
}