| [752] | 1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Wierszowki.Models.MagazineItemViewData>" %>
|
|---|
| [842] | 2 | <%@ Import namespace="Wierszowki.Core.Validation"%>
|
|---|
| [752] | 3 | <asp:Content ID="js" ContentPlaceHolderID="jsContent" runat="server">
|
|---|
| 4 | <script src="../../Scripts/jquery-1.3.1.js" type="text/javascript"></script>
|
|---|
| 5 | <script src="../../Scripts/jquery-1.3.1.min.js" type="text/javascript"></script>
|
|---|
| 6 | <script src="../../Scripts/jquery.form.js" type="text/javascript"></script>
|
|---|
| 7 | <script src="../../Scripts/jquery.blockUI.js" type="text/javascript"></script>
|
|---|
| 8 | <script src="../../Scripts/date.js" type="text/javascript"></script>
|
|---|
| 9 | <script src="../../Scripts/jquery.datePicker.js" type="text/javascript"></script>
|
|---|
| 10 | <script src="../../Scripts/spiffy.js" type="text/javascript"></script>
|
|---|
| 11 | <script src="../../Scripts/jHelper.js" type="text/javascript"></script>
|
|---|
| [842] | 12 | <script src="../../Scripts/jquery.validate.js" type="text/javascript" ></script>
|
|---|
| 13 | <script src="../../Scripts/xVal.jquery.validate.js" type="text/javascript"></script>
|
|---|
| [752] | 14 | </asp:Content>
|
|---|
| 15 |
|
|---|
| 16 | <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
|
|---|
| [842] | 17 | Edytuj wierszówkê
|
|---|
| [752] | 18 | </asp:Content>
|
|---|
| 19 |
|
|---|
| 20 | <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
|
|---|
| [842] | 21 | <script type="text/javascript">
|
|---|
| 22 | $(function() {
|
|---|
| 23 | $("#Magazine_Id").change(function() {
|
|---|
| 24 | var magazineId = $("#Magazine_Id > option:selected").attr("value");
|
|---|
| 25 | var urlAction = "<%= Url.Action("FindIssuesById", "Magazine") %>";
|
|---|
| 26 | urlAction = urlAction + "/" + magazineId;
|
|---|
| 27 | $.getJSON(urlAction, function(data) {
|
|---|
| 28 | $("#MagazineItem_IssueId").addItems(data);
|
|---|
| 29 | });
|
|---|
| [752] | 30 | });
|
|---|
| [842] | 31 | jQuery.validator.setDefaults({
|
|---|
| 32 | success: "valid"
|
|---|
| 33 | });
|
|---|
| 34 | jQuery.validator.addMethod("DateCorrectFormat", function(data, element) {
|
|---|
| 35 | return data.match(/^(19|20)\d\d(-)(0[1-9]|1[012])$/);
|
|---|
| 36 | }, "Podaj prawid³ow¹ datê i format (0000-00).");
|
|---|
| 37 |
|
|---|
| 38 | jQuery.validator.addMethod("RangePrice", function(cena, element) {
|
|---|
| [844] | 39 | return cena.match(/^((0([,]\d\d)?)|([1-9](\d){0,2}([,]\d\d)?)|([1]{1}[0]{3}([,][0]{2})?))$/);
|
|---|
| [842] | 40 | },"Wymagany format to 0,00 , a wartoæ nie mo¿e byæ wiêksza ni¿ 1000.");
|
|---|
| [844] | 41 |
|
|---|
| [842] | 42 | $("#myform").validate({
|
|---|
| 43 | rules: {
|
|---|
| 44 | "MagazineItem.AuthorId": { required: true },
|
|---|
| 45 | "MagazineItem.IssueId": { required: true, min:1 },
|
|---|
| 46 | "MagazineItem.ItemTypeId": { required: true },
|
|---|
| 47 | "MagazineItem.Date": { required: true, DateCorrectFormat: true },
|
|---|
| 48 | "MagazineItem.Caption": { required: true, maxlength: 255 },
|
|---|
| 49 | "MagazineItem.Description": { maxlength: 255 },
|
|---|
| 50 | "MagazineItem.Bonus": { required: true, RangePrice: true},
|
|---|
| 51 | "MagazineItem.Price": { required: true, RangePrice: true}
|
|---|
| 52 | },
|
|---|
| 53 | messages: {
|
|---|
| 54 | "MagazineItem.AuthorId": { required: "Proszê wybraæ autora." },
|
|---|
| [844] | 55 | "MagazineItem.IssueId": { required: "Proszê wybraæ numer wydania. Musisz najpierw wybraæ Gazetê.", min: "Prosze wybraæ numer wydania. Musisz najpierw wybraæ Gazetê." },
|
|---|
| [842] | 56 | "MagazineItem.ItemTypeId": { required: "Proszê wybraæ typ wierszówki." },
|
|---|
| 57 | "MagazineItem.Date": { required: "Proszê wprowadziæ miesi¹c."},
|
|---|
| 58 | "MagazineItem.Caption": { required: "Proszê wprowadziæ tytu³ wierszówki.", maxlength: "Tytu³ jest za d³ugi." },
|
|---|
| 59 | "MagazineItem.Description": { maxlength:"Opis jest za d³ugi."},
|
|---|
| [844] | 60 | "MagazineItem.Bonus": { required: "Proszê wprowadziæ bonus do wierszówki."},
|
|---|
| [842] | 61 | "MagazineItem.Price": { required: "Proszê wprowadziæ wycenê wierszówki."}
|
|---|
| 62 | }
|
|---|
| 63 | });
|
|---|
| 64 | $("#myform").change(function() {
|
|---|
| 65 | $("#myform").valid();
|
|---|
| 66 | });
|
|---|
| 67 | });
|
|---|
| 68 | </script>
|
|---|
| [752] | 69 | <h2>Edytuj wierszówkê</h2>
|
|---|
| 70 | <%= Html.ValidationSummary("Proszê poprawiæ b³êdy i spróbowaæ ponownie.") %>
|
|---|
| 71 |
|
|---|
| 72 | <div>
|
|---|
| 73 | <div id="messages"></div>
|
|---|
| [842] | 74 | <%
|
|---|
| 75 | using (Html.BeginForm("Update", "MagazineItem", FormMethod.Post, new { id = "myform" }))
|
|---|
| 76 | { %>
|
|---|
| [752] | 77 | <fieldset>
|
|---|
| [842] | 78 | <%= Html.Hidden("Info.user_id", Model.Info.user_id)%>
|
|---|
| 79 | <%= Html.Hidden("Info.powrot", Model.Info.powrot)%>
|
|---|
| 80 | <%= Html.Hidden("Info.month", Model.Info.month)%>
|
|---|
| 81 | <%= Html.Hidden("Info.year", Model.Info.year)%>
|
|---|
| [752] | 82 | <legend>Dane wierszówki</legend>
|
|---|
| 83 | <%= Html.Hidden("MagazineItem.Id", Model.MagazineItem.Id)%>
|
|---|
| 84 | <div class="formitem">
|
|---|
| 85 | <label for="MagazineItem.AuthorId">Autor:</label>
|
|---|
| [842] | 86 | <%= Html.DropDownList("MagazineItem.AuthorId", Model.AuthorList, "-- proszê wybraæ --")%>
|
|---|
| [752] | 87 | <%= Html.ValidationMessage("MagazineItem.AuthorId", "*")%>
|
|---|
| [842] | 88 | <br />
|
|---|
| [752] | 89 | </div>
|
|---|
| 90 | <div class="formitem">
|
|---|
| 91 | <label for="Magazine">Gazeta:</label>
|
|---|
| [842] | 92 | <%= Html.DropDownList("Magazine.Id",Model.MagazineList, "-- proszê wybraæ --")%>
|
|---|
| [752] | 93 | <%= Html.ValidationMessage("Magazine.Id", "*")%>
|
|---|
| [842] | 94 | <br />
|
|---|
| 95 | </div>
|
|---|
| [752] | 96 | <div class="formitem">
|
|---|
| [842] | 97 | <label for="MagazineItem.IssueId">Wydanie</label>
|
|---|
| 98 | <%= Html.DropDownList("MagazineItem.IssueId", Model.IssueList, "-- proszê wybraæ --")%>
|
|---|
| [752] | 99 | <%= Html.ValidationMessage("MagazineItem.IssueId", "*")%>
|
|---|
| [842] | 100 | <br />
|
|---|
| [752] | 101 | </div>
|
|---|
| 102 | <div class="formitem">
|
|---|
| 103 | <label for="MagazineItem.ItemTypeId">Typ:</label>
|
|---|
| [842] | 104 | <%= Html.DropDownList("MagazineItem.ItemTypeId", Model.ItemTypeList, "-- proszê wybraæ --")%>
|
|---|
| [752] | 105 | <%= Html.ValidationMessage("MagazineItem.ItemTypeId", "*")%>
|
|---|
| [842] | 106 | <br />
|
|---|
| [752] | 107 | </div>
|
|---|
| 108 | <div class="formitem">
|
|---|
| 109 | <label for="MagazineItem.Date">Miesi¹c:</label>
|
|---|
| 110 | <%= Html.TextBox("MagazineItem.Date", Model.MagazineItem.Date, new { Class = "date-pick" })%>
|
|---|
| 111 | <%= Html.ValidationMessage("MagazineItem.Date", "*")%>
|
|---|
| [842] | 112 | <br />
|
|---|
| 113 | </div>
|
|---|
| [752] | 114 | <div class="formitem">
|
|---|
| 115 | <label for="MagazineItem.Caption">Tytu³:</label>
|
|---|
| [842] | 116 | <%= Html.TextBox("MagazineItem.Caption", Model.MagazineItem.Caption )%>
|
|---|
| [752] | 117 | <%= Html.ValidationMessage("MagazineItem.Caption", "*")%>
|
|---|
| [842] | 118 | <br />
|
|---|
| [752] | 119 | </div>
|
|---|
| 120 | <div class="formitem">
|
|---|
| 121 | <label for="MagazineItem.Description">Opis:</label>
|
|---|
| [842] | 122 | <%= Html.TextArea("MagazineItem.Description", Model.MagazineItem.Description )%>
|
|---|
| 123 | <%= Html.ValidationMessage("MagazineItem.Description", "*")%>
|
|---|
| 124 | <br />
|
|---|
| [752] | 125 | </div>
|
|---|
| 126 | <div class="formitem">
|
|---|
| 127 | <label for="MagazineItem.Price">Wycena:</label>
|
|---|
| [842] | 128 | <%= Html.TextBox("MagazineItem.Price", Model.MagazineItem.Price.ToString("#0.00"))%>
|
|---|
| [752] | 129 | <%= Html.ValidationMessage("MagazineItem.Price", "*")%>
|
|---|
| [842] | 130 | <br />
|
|---|
| [752] | 131 | </div>
|
|---|
| 132 | <div class="formitem">
|
|---|
| 133 | <label for="MagazineItem.Bonus">Bonus:</label>
|
|---|
| [842] | 134 | <%= Html.TextBox("MagazineItem.Bonus", Model.MagazineItem.Bonus.ToString("#0.00"))%>
|
|---|
| [752] | 135 | <%= Html.ValidationMessage("MagazineItem.Bonus", "*")%>
|
|---|
| [842] | 136 | <br />
|
|---|
| [752] | 137 | </div>
|
|---|
| [844] | 138 | <div>
|
|---|
| [842] | 139 | <input type="submit" name="edit" value="Aktualizuj" />
|
|---|
| [752] | 140 | </div>
|
|---|
| 141 | </fieldset>
|
|---|
| [842] | 142 | <% } %>
|
|---|
| [752] | 143 | </div>
|
|---|
| 144 | <div>
|
|---|
| 145 | <%=Html.ActionLink("Powrót", "Index", "Home") %>
|
|---|
| [842] | 146 | <%=Html.ClientSideValidation<MagazineItemValidation>("MagazineItem")%>
|
|---|
| [752] | 147 | </div>
|
|---|
| 148 | </asp:Content> |
|---|