Prechádzať zdrojové kódy

FIX Correction creation de college

olivier.massot 7 rokov pred
rodič
commit
23715813d8

+ 3 - 0
CD67.FicheCollege.MVC/Models/CollegeViewModel.cs

@@ -10,6 +10,7 @@ namespace CD67.FicheCollege.MVC.Models
     {
         public SelectList Sel_TypesCollege;
         public SelectList Sel_CodesPostaux;
+        public SelectList Sel_Territoires;
 
         public CollegeViewModel(College model, Entities dbContext, ModeAcces acces = ModeAcces.Lecture, Dictionary<string, object> bag = null) : base(model, acces, bag)
         {
@@ -17,6 +18,8 @@ namespace CD67.FicheCollege.MVC.Models
             {
                 TypeCollegeFactory fact = new TypeCollegeFactory(dbContext);
                 Sel_TypesCollege = new SelectList(fact.getAll(), "Id", "Libelle", Obj.TypeCollege_Id);
+                TerritoireFactory fact_t = new TerritoireFactory(dbContext);
+                Sel_Territoires = new SelectList(fact_t.getAll(), "Id", "Libelle", Obj.Territoire_Id);
                 Sel_CodesPostaux = new SelectList(Referentiel.GetCodesPostaux(Obj.Commune_Insee), Obj.Code_Postal);
             }
         }

+ 10 - 2
CD67.FicheCollege.MVC/Views/Colleges/Edit.cshtml

@@ -70,6 +70,14 @@ else
                 </div>
             </div>
 
+            <div class="form-group">
+                @Html.LabelFor(model => college.Territoire_Id, htmlAttributes: new { @class = "control-label col-md-2" })
+                <div class="col-md-10">
+                    @Html.DropDownListFor(model => college.Territoire_Id, Model.Sel_Territoires, htmlAttributes: new { @class = "form-control" })
+                    @Html.ValidationMessageFor(model => college.Territoire_Id, "", new { @class = "text-danger" })
+                </div>
+            </div>
+
             @Html.HiddenFor(model => college.Commune_Insee, new { data_picker = "commune.insee" })
             @Html.HiddenFor(model => college.Commune, new { data_picker = "commune.nom" })
             @Html.HiddenFor(model => college.Canton, new { data_picker = "commune.canton" })
@@ -190,12 +198,12 @@ else
             var code_postaux = $('#code_postaux').val();
             if (code_postaux != '') {
                 //On vide la liste actuelle
-                $('#contenu_Code_Postal').empty();
+                $('#college_Code_Postal').empty();
 
                 var liste = code_postaux.split(',');
                 liste.forEach(function (element) {
                     //On ajoute les choix
-                    $('#contenu_Code_Postal').append($('<option>', {
+                    $('#college_Code_Postal').append($('<option>', {
                         value: element,
                         text: element
                     }));