Quellcode durchsuchen

Actions Educatives: style crud ok

olivier.massot vor 7 Jahren
Ursprung
Commit
252be74ea5

+ 3 - 7
CD67.FicheCollege.Entity/Extend/ActionEdu.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.ComponentModel.DataAnnotations;
 
 namespace CD67.FicheCollege.Entity
 {
@@ -36,10 +31,11 @@ namespace CD67.FicheCollege.Entity
         public int ActionEduThematiqueId { get; set; }
 
         [Required]
-        [Display(Name = "Action")]
+        [Display(Name = "Nom")]
         public string Nom { get; set; }
 
         [Display(Name = "Description")]
+        [DataType(DataType.MultilineText)]
         public string Description { get; set; }
 
         [Display(Name = "Neutralisé (oui/non)")]

+ 16 - 25
CD67.FicheCollege.MVC/Views/ActionsEdu/Create.cshtml

@@ -7,17 +7,28 @@
     ActionEdu actionEdu = Model.Obj;
 }
 
+<header>
+    <h2>Nouvelle Action Educative</h2>
+</header>
+
 @using (Html.BeginForm()) 
 {
     @Html.AntiForgeryToken()
     
     <div class="form-horizontal">
-        <h4>Actions</h4>
-        <hr />
         @Html.ValidationSummary(true, "", new { @class = "text-danger" })
         @Html.HiddenFor(model => actionEdu.Id)
         @Html.HiddenFor(model => actionEdu.Ordre)
         @Html.HiddenFor(model => actionEdu.AnneeId)
+        @Html.HiddenFor(model => actionEdu.Neutralise)
+
+        <div class="form-group">
+            @Html.LabelFor(model => actionEdu.ActionEduThematiqueId, htmlAttributes: new { @class = "control-label col-md-2" })
+            <div class="col-md-10">
+                @Html.DropDownListFor(model => actionEdu.ActionEduThematiqueId, Model.Sel_Thematique, htmlAttributes: new { @class = "form-control" })
+                @Html.ValidationMessageFor(model => actionEdu.ActionEduThematiqueId, "", new { @class = "text-danger" })
+            </div>
+        </div>
 
         <div class="form-group">
             @Html.LabelFor(model => actionEdu.Numero, htmlAttributes: new { @class = "control-label col-md-2" })
@@ -43,34 +54,14 @@
             </div>
         </div>
 
-        <div class="form-group">
-            @Html.LabelFor(model => actionEdu.Neutralise, htmlAttributes: new { @class = "control-label col-md-2" })
-            <div class="col-md-10">
-                @Html.EditorFor(model => actionEdu.Neutralise, new { htmlAttributes = new { @class = "form-control" } })
-                @Html.ValidationMessageFor(model => actionEdu.Neutralise, "", new { @class = "text-danger" })
-            </div>
-        </div>
-
-        <div class="form-group">
-            @Html.LabelFor(model => actionEdu.ActionEduThematiqueId, htmlAttributes: new { @class = "control-label col-md-2" })
-            <div class="col-md-10">
-                @Html.DropDownListFor(model => actionEdu.ActionEduThematiqueId, Model.Sel_Thematique, htmlAttributes: new { @class = "form-control" })
-                @Html.ValidationMessageFor(model => actionEdu.ActionEduThematiqueId, "", new { @class = "text-danger" })
-            </div>
-        </div>
-
         <div class="form-group">
             <div class="col-md-offset-2 col-md-10">
-                <input type="submit" value="Créer" class="btn btn-default" />
+                <input type="submit" value="Enregistrer" class="btn btn-default" />
             </div>
         </div>
     </div>
 }
 
 <div>
-    @Html.ActionLink("Retour à la liste", "Index")
-</div>
-
-@section Scripts {
-
-}
+    @Html.ActionLink("Annuler", "Index", new { annee_id = actionEdu.AnneeId })
+</div>

+ 11 - 17
CD67.FicheCollege.MVC/Views/ActionsEdu/Delete.cshtml

@@ -7,29 +7,23 @@
     ActionEdu action = Model.Obj;
 }
 
-<h2>Suppression</h2>
+<header>
+    <h2>Suppression</h2>
+</header>
 
-<h3>Voulez-vous vraiment supprimer cet élément?</h3>
+<h3>Voulez-vous vraiment supprimer cet l'action '@action.Nom'</h3>
 <div>
-    <h4>Action</h4>
-    <hr />
-    <dl class="dl-horizontal">
-        <dt>
-            @Html.DisplayNameFor(model => action.Nom)
-        </dt>
-
-        <dd>
-            @Html.DisplayFor(model => action.Nom)
-        </dd>
-
-    </dl>
-
     @using (Html.BeginForm()) {
         @Html.AntiForgeryToken()
 
         <div class="form-actions no-color">
-            <input type="submit" value="Supprimer" class="btn btn-default" /> |
-            @Html.ActionLink("Retour à la liste", "Index")
+            <input type="submit" value="Supprimer" class="btn btn-default" />
         </div>
     }
+
 </div>
+
+</br>
+<div>
+    @Html.ActionLink("Annuler", "Details", new { id = action.Id })
+</div>

+ 32 - 16
CD67.FicheCollege.MVC/Views/ActionsEdu/Details.cshtml

@@ -7,17 +7,13 @@
     ActionEdu actionEdu = Model.Obj;
 }
 
-<h1>Les Actions</h1>
-
-<div>
-    @Html.ActionLink("Retour à la liste", "Index")
-</div>
-
-<h2>@actionEdu.Nom</h2>
+<header>
+    <h2>@actionEdu.Nom</h2>
+</header>
 
 <fieldset>
     <legend>
-        Données de base
+        Descriptif
         @if (Model.Acces == ModeAcces.Lecture)
         {
             <span class="pull-right">
@@ -56,14 +52,34 @@
         </span>
     </legend>
 
-
-    foreach (ActionEduCollege item in Model.Obj.ActionsEduColleges)
-    {
-        <div>
-            <span>@item.College.Libelle</span> <span> @Html.ActionLink("Voir", "Details", "ActionsEduCollege", new { Id = item.Id }, new { @class = "btn btn-default" })</span>
-        </div>
-    }
-
+    <table class="table datatable">
+        <thead>
+            <tr>
+                <th>Collège</th>
+                <th>Nombre d'élèves</th>
+                <th>Montant</th>
+                <th>Tiers</th>
+                <th>Commentaire interne</th>
+                <th>Commentaire public</th>
+            </tr>
+        </thead>
+        <tbody>
+            @foreach (ActionEduCollege item in Model.Obj.ActionsEduColleges)
+            {
+            <tr data-url="@Url.Action("Details", "ActionsEduCollege", new { Id = item.Id })">
+                <td>@Html.DisplayFor(model => item.College.Libelle)</td>
+                <td>@Html.DisplayFor(model => item.NbEleves)</td>
+                <td>@Html.DisplayFor(model => item.Montant)</td>
+                <td>@Html.DisplayFor(model => item.TiersAstre_Nom)</td>
+                <td>@Html.DisplayFor(model => item.CommentaireInterne)</td>
+                <td>@Html.DisplayFor(model => item.CommentairePublic)</td>
+            </tr>
+            }
+        </tbody>
+    </table>
 }
 
+<br/>
+@Html.ActionLink("Retour à la liste des actions", "Index", new { annee_id = actionEdu.AnneeId })
+
 

+ 12 - 16
CD67.FicheCollege.MVC/Views/ActionsEdu/Edit.cshtml

@@ -7,21 +7,28 @@
     ActionEdu actionEdu = Model.Obj;
 }
 
-<h2>Modification</h2>
-
+<header>
+    <h2>Edition de l'Action Educative '@actionEdu.Nom'</h2>
+</header>
 
 @using (Html.BeginForm())
 {
     @Html.AntiForgeryToken()
     
     <div class="form-horizontal">
-        <h4>Actions</h4>
-        <hr />
         @Html.ValidationSummary(true, "", new { @class = "text-danger" })
         @Html.HiddenFor(model => actionEdu.Id)
         @Html.HiddenFor(model => actionEdu.Ordre)
         @Html.HiddenFor(model => actionEdu.AnneeId)
 
+        <div class="form-group">
+            @Html.LabelFor(model => actionEdu.ActionEduThematiqueId, htmlAttributes: new { @class = "control-label col-md-2" })
+            <div class="col-md-10">
+                @Html.DropDownListFor(model => actionEdu.ActionEduThematiqueId, Model.Sel_Thematique, htmlAttributes: new { @class = "form-control" })
+                @Html.ValidationMessageFor(model => actionEdu.ActionEduThematiqueId, "", new { @class = "text-danger" })
+            </div>
+        </div>
+
         <div class="form-group">
             @Html.LabelFor(model => actionEdu.Numero, htmlAttributes: new { @class = "control-label col-md-2" })
             <div class="col-md-10">
@@ -53,14 +60,6 @@
                 @Html.ValidationMessageFor(model => actionEdu.Neutralise, "", new { @class = "text-danger" })
             </div>
         </div>
-        
-        <div class="form-group">
-            @Html.LabelFor(model => actionEdu.ActionEduThematiqueId, htmlAttributes: new { @class = "control-label col-md-2" })
-            <div class="col-md-10">
-                @Html.DropDownListFor(model => actionEdu.ActionEduThematiqueId, Model.Sel_Thematique, htmlAttributes: new { @class = "form-control" })
-                @Html.ValidationMessageFor(model => actionEdu.ActionEduThematiqueId, "", new { @class = "text-danger" })
-            </div>
-        </div>
 
         <div class="form-group">
             <div class="col-md-offset-2 col-md-10">
@@ -71,9 +70,6 @@
 }
 
 <div>
-    @Html.ActionLink("Retour à la liste", "Index")
+    @Html.ActionLink("Annuler", "Details", new { id = actionEdu.Id })
 </div>
 
-@section Scripts {
-
-}

+ 1 - 1
CD67.FicheCollege.MVC/Views/ActionsEdu/Index.cshtml

@@ -44,7 +44,7 @@
     <tbody>
         @foreach (ActionEdu item in Model.Obj.ActionsEdu.OrderBy(a => a.ActionEduThematique.ActionEduAxe.Ordre).ThenBy(a => a.ActionEduThematique.Ordre).ThenBy(a => a.Ordre))
         {
-            <tr>
+            <tr data-url="@Url.Action("Details", new { id = item.Id })">
                 <td>
                     @Html.DisplayFor(model => item.ActionEduThematique.ActionEduAxe.Nom)
                 </td>