Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 5.87 KB | None | 0 0
  1. @model MVCProject.Models.User
  2.  
  3. @{
  4.     ViewBag.Title = "AddManager";
  5. }
  6. <!DOCTYPE html>
  7.  
  8. <html>
  9. <head>
  10.     <meta name="AddManager" content="width=device-width" />
  11.     <title>AddManager</title>
  12.  
  13.     <script src="~/Scripts/jquery-3.1.1.js"></script>
  14.     <script src="~/Scripts/jquery.validate.js"></script>
  15.     <script src="~/Scripts/jquery.validate.unobtrusive.js"></script>
  16. </head>
  17.  
  18. <body>
  19.     <div class="jumbotron">
  20.         <div class="row">
  21.             <h2>Add Manager:</h2>
  22.             <div class="col-md-4">
  23.                 <form id="frmSearchUser">
  24.                     <div class="form-group">
  25.                         <label>Customer's Username:</label>
  26.                         @Html.TextBoxFor(x => x.Username, new { type = "text",name= "Username", @class = "form-control", id = "Username", placeholder = "Customer's Username", required = "required", maxlength = "50" })
  27.                         <div> @Html.ValidationMessageFor(x => x.Username, null, new { @class = "text-danger" })</div>
  28.                     </div>
  29.                     <input type="button" class="btn btn-success" onclick="search()" value="Search" id="SearchButton">
  30.                 </form>
  31.             </div>
  32.         </div>
  33.         <h3>Customers Found:</h3>
  34.         <div id="status"></div>
  35.         <style type="text/css">
  36.             strong {
  37.                 font-weight: bold;
  38.             }
  39.  
  40.             em {
  41.                 font-style: italic;
  42.             }
  43.  
  44.             table {
  45.                 background: #f5f5f5;
  46.                 border-collapse: separate;
  47.                 box-shadow: inset 0 1px 0 #fff;
  48.                 font-size: 12px;
  49.                 line-height: 24px;
  50.                 margin: 30px auto;
  51.                 text-align: left;
  52.                 width: 800px;
  53.             }
  54.  
  55.             th {
  56.                 background: linear-gradient(#777, #444);
  57.                 border-left: 1px solid #555;
  58.                 border-right: 1px solid #777;
  59.                 border-top: 1px solid #555;
  60.                 border-bottom: 1px solid #333;
  61.                 box-shadow: inset 0 1px 0 #999;
  62.                 color: #fff;
  63.                 font-weight: bold;
  64.                 padding: 10px 15px;
  65.                 position: relative;
  66.                 text-shadow: 0 1px 0 #000;
  67.             }
  68.  
  69.                 th:after {
  70.                     background: linear-gradient(rgba(255,255,255,0), rgba(255,255,255,.08));
  71.                     content: '';
  72.                     display: block;
  73.                     height: 25%;
  74.                     left: 0;
  75.                     margin: 1px 0 0 0;
  76.                     position: absolute;
  77.                     top: 25%;
  78.                     width: 100%;
  79.                 }
  80.  
  81.                 th:first-child {
  82.                     border-left: 1px solid #777;
  83.                     box-shadow: inset 1px 1px 0 #999;
  84.                 }
  85.  
  86.                 th:last-child {
  87.                     box-shadow: inset -1px 1px 0 #999;
  88.                 }
  89.  
  90.             td {
  91.                 border-right: 1px solid #fff;
  92.                 border-left: 1px solid #e8e8e8;
  93.                 border-top: 1px solid #fff;
  94.                 border-bottom: 1px solid #e8e8e8;
  95.                 padding: 10px 15px;
  96.                 position: relative;
  97.                 transition: all 300ms;
  98.             }
  99.  
  100.                 td:first-child {
  101.                     box-shadow: inset 1px 0 0 #fff;
  102.                 }
  103.  
  104.                 td:last-child {
  105.                     border-right: 1px solid #e8e8e8;
  106.                     box-shadow: inset -1px 0 0 #fff;
  107.                 }
  108.  
  109.             tr:last-of-type td {
  110.                 box-shadow: inset 0 -1px 0 #fff;
  111.             }
  112.  
  113.                 tr:last-of-type td:first-child {
  114.                     box-shadow: inset 1px -1px 0 #fff;
  115.                 }
  116.  
  117.                 tr:last-of-type td:last-child {
  118.                     box-shadow: inset -1px -1px 0 #fff;
  119.                 }
  120.  
  121.             tbody:hover td {
  122.                 color: transparent;
  123.                 text-shadow: 0 0 3px #aaa;
  124.             }
  125.  
  126.             tbody:hover tr:hover td {
  127.                 color: #444;
  128.                 text-shadow: 0 1px 0 #fff;
  129.             }
  130.         </style>
  131.         <table id="UsersTable" class="tg">
  132.             <tr>
  133.                 <th class="tg-sl89">Customer ID</th>
  134.                 <th class="tg-sl89">Username</th>
  135.                 <th class="tg-sl89"></th>
  136.             </tr>
  137.         </table>
  138.  
  139.         <script language="javascript">
  140.  
  141.             function search()
  142.             {
  143.                 $("#status").text("Loading...");
  144.                 var un = $("#Username").val();
  145.                 $.get("GetUsersByJSON", { un }, FillTable);
  146.             }
  147.  
  148.             function FillTable(Users)
  149.             {
  150.                 $("#UsersTable").find("tr:gt(0)").remove();
  151.                 var table = $("#UsersTable");
  152.                 for(i=0;i<Users.length;i++)
  153.                {
  154.                    var row =
  155.                        "<tr><td>" + Users[i].CID + "</td>" +
  156.                         "<td>" + Users[i].Username + "</td>" +
  157.                         "<td><input type='button' class='btn btn-success' onclick='SendData(" + Users[i].CID + ")' value='Make Manager'>"
  158.                 +"</td></tr>";
  159.  
  160.                 table.append(row);
  161.                 }
  162.                 $("#status").text("");
  163.                 $('#SearchButton').attr("disabled", false);
  164.             }
  165.  
  166.             function SendData(frm)
  167.             {
  168.                 $('#SearchButton').attr("disabled", true);
  169.                 $("#status").text("Adding...");
  170.                 $.post("SubmitUser", { id: frm }, success);
  171.             }
  172.  
  173.             function success()
  174.             {
  175.                 $("#status").text("User is now admin");
  176.                 $("#Username").val("");
  177.                 $('#SearchButton').attr("disabled", false);
  178.             }
  179.         </script>
  180.     </div>
  181. </body>
  182. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement