Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Scripts.Render("~/bundles/jquery")
- @Scripts.Render("~/bundles/bootstrap")
- @model ClassDeclarationsThsesis.Models.ClassesViewViewModel
- @{
- ViewBag.Title = "ClassesView";
- }
- <h2>ClassesView</h2>
- <select id="sel">
- <option value="week">Current week</option>
- <option value="total">Total</option>
- </select>
- @{
- int i = 0;
- int inside = 0;
- }
- @using (Html.BeginForm("ClassesView", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
- {
- List<SelectListItem> listItems1 = new List<SelectListItem>();
- <div id="week">
- <table border="1" width="500">
- <tr>
- <th>Surname</th>
- <th>Name</th>
- @foreach (var task in Model.current)
- {
- <th>@task.name</th>
- }
- <th>Total</th>
- </tr>
- @foreach (var user in Model.curr_users)
- {
- if (user.user_type.Replace(" ", String.Empty) == 1.ToString())
- {
- <tr>
- <th>@user.surname</th>
- <th>@user.name</th>
- @foreach (var task in Model.current)
- {
- foreach (var grade in Model.grading)
- {
- if (user.user_id == grade.user_id)
- {
- if (task.task_id == grade.task_id)
- {
- inside = task.value;
- i = i + task.value;
- }
- }
- }
- <th>@inside</th>
- inside = 0;
- listItems1.Add(new SelectListItem
- {
- Text = task.name,
- Value = task.name,
- });
- }
- <th>@i</th>
- @Model.student_id = user.user_id;
- @Html.HiddenFor(m => m.class_id)
- @Html.HiddenFor(m=>m.student_id)
- <th>
- @Html.DropDownListFor(m => m.task_name, listItems1, new { @class = "form-control" })
- <th>
- <th>@Html.TextBoxFor(m=>m.points)</th>>
- <th><input type="submit" class="btn btn-default" value="Modify" /></th>
- </tr>
- }
- i = 0;
- }
- </table>
- </div>
- }
- <div id="total">
- <table border="1" width="500">
- <tr>
- <th>Surname</th>
- <th>Name</th>
- @foreach (var task in Model.t)
- {
- <th>@task.name</th>
- }
- <th>Total</th>
- </tr>
- @foreach (var user in Model.curr_users)
- {
- if (user.user_type.Replace(" ", String.Empty) == 1.ToString())
- {
- <tr>
- <th>@user.surname</th>
- <th>@user.name</th>
- @foreach (var task in Model.t)
- {
- foreach (var grade in Model.grading)
- {
- if (user.user_id == grade.user_id)
- {
- if (task.task_id == grade.task_id)
- {
- inside = task.value;
- i = i + task.value;
- }
- }
- }
- <th>@inside</th>
- inside = 0;
- }
- <th>@i</th>
- </tr>}
- i = 0;
- }
- </table>
- </div>
- <script type='text/javascript'>
- $(function() {
- $("#total").hide();
- console.log($("#sel"));
- $("#sel")
- .change(function() {
- var selectedItem = $(this).val();
- if (selectedItem == "week") {
- $("#week").show();
- $("#total").hide();
- } else if (selectedItem == "total") {
- $("#total").show();
- $("#week").hide();
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement