Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 716 - improve form validation/ui #717

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,4 @@ crisischeckin/CrisisCheckinMobile/Components/
*.sln.GhostDoc.xml
project.lock.json
crisischeckin/CrisisCheckinMobile/CrisisCheckInMobile.sln.DotSettings
/crisischeckin/UpgradeLog3.htm
26 changes: 20 additions & 6 deletions crisischeckin/crisicheckinweb/Views/Organization/Home.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,25 @@
<tbody>
<tr>
<td>@Html.DropDownListFor(m => m.ResourceDisasterId, new SelectList(Model.AllDisasters, "Id", "Name", Model.ResourceDisasterId), "-- Choose One --", new { @class = "form-control", @id = "disasterList" })</td>
<td>@Html.TextBoxFor(m => m.ResourceDescription)</td>
<td>@Html.TextBoxFor(m => m.ResourceQuantity)</td>
<td>@Html.TextBoxFor(m => m.ResourceDescription, new { @class = "form-control" })</td>
<td>@Html.TextBoxFor(m => m.ResourceQuantity, new { @class = "form-control numeric-only" })</td>
<td>@Html.DropDownListFor(m => m.ResourceTypeId, new SelectList(Model.ResourceTypes, "ResourceTypeId", "TypeName", Model.ResourceTypeId), "-- Choose One --", new { @class = "form-control", @id = "resourcetypelist" })</td>
<td>@Html.TextBoxFor(m => m.ResourceStartDate, new { id = "dp_resourceStartDate", @class = "form-control" })</td>
<td>@Html.TextBoxFor(m => m.ResourceEndDate, new { id = "dp_resourceEndDate", @class = "form-control" })</td>
<td>
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-calendar"></i>
</span>
@Html.TextBoxFor(m => m.ResourceStartDate, new { id = "dp_resourceStartDate", @class = "form-control"})
</div>
</td>
<td>
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-calendar"></i>
</span>
@Html.TextBoxFor(m => m.ResourceEndDate, new { id = "dp_resourceEndDate", @class = "form-control" })
</div>
</td>
<td>@Html.TextBoxFor(m => m.ResourceLocation, new { @class = "form-control" })</td>
<td><input class="btn btn-black" id="GoButton" type="submit" value="Checkin" /></td>
</tr>
Expand Down Expand Up @@ -195,7 +209,7 @@
@Html.AntiForgeryToken()
@Html.HiddenFor(m => m.OrganizationId, new { @Value = Model.OrganizationId })
@Html.HiddenFor(m => m.PromoteToAdminPersonId, new { @Value = volunteer.Id })
<button class="btn btn-danger btn-xs" type="submit"><i class="glyphicon glyphicon-remove"></i> Elevate admin</button>
<button class="btn btn-black btn-xs" type="submit"><i class="glyphicon glyphicon-arrow-up"></i> Elevate admin</button>
}
}
else
Expand Down Expand Up @@ -224,7 +238,7 @@
@Html.ValidationSummary()
@Html.HiddenFor(m => m.OrganizationId, new { @Value = Model.OrganizationId })
@Html.DropDownListFor(m => m.AddVolunteerId, Model.VolunteersSelectList, "-- Select Volunteer --", new { @class = "form-control", @id = "addvolunteerlist" })
<button class="btn btn-danger btn-xs" type="submit"><i class="glyphicon glyphicon-remove"></i> Add</button>
<button class="btn btn-black btn-sm" type="submit"><i class="glyphicon glyphicon-plus"></i> Add</button>
}
}

Expand Down
1 change: 1 addition & 0 deletions crisischeckin/crisicheckinweb/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
</div>

@Scripts.Render("~/bundles/libs")
@Scripts.Render("~/bundles/jquery-validate")
@RenderSection("scripts", false)
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
(function ($) {$(document).ready(function () {
(function ($) {
$(document).ready(function () {
$("#dp_resourceStartDate").datepicker({ minDate: 'today', onSelect: updateResourceEndDate }).datepicker('setDate',
'@(Model.ResourceStartDate == default(DateTime) ? DateTime.Now : Model.ResourceStartDate)');
$("#dp_resourceEndDate").datepicker({ minDate: 'today' }).datepicker('setDate',
'@(Model.ResourceEndDate == default(DateTime) ? DateTime.Now : Model.ResourceEndDate)');

$('.numeric-only').on('input blur paste',
function () {
$(this).val($(this).val().replace(/\D/g, ''));
});

});

function updateResourceEndDate(dateText) {
Expand Down