using System.Collections.Generic; using System.Web.Http; using System.Web.Mvc; using Kreta.BusinessLogic.Security; using Kreta.Enums; using Kreta.Enums.ManualEnums; using Kreta.Framework; using Kreta.Resources; using Kreta.Web.Areas.OsztalyCsoport.Logic; using Kreta.Web.Areas.OsztalyCsoport.Models; using Kreta.Web.Helpers.TabStrip; using Kreta.Web.Models.EditorTemplates; using Kreta.Web.Security; namespace Kreta.Web.Areas.OsztalyCsoport.Controllers { [MvcRoleClaimsAuthorize(true)] [MvcRolePackageAuthorize(TanevEnum.AktEsKovTanev, KretaClaimPackages.AMImodul.ClaimValue)] public class CsoportAmiController : Controller { public ActionResult Index() { var model = new CsoportSearchModel(); return View("Index", model); } [MvcRolePackageAuthorize(TanevEnum.Mind, KretaClaimPackages.AMImodul.ClaimValue)] public ActionResult OpenCsoportPropertiesTab(int csoportID, bool fromAdd = false) { AmiCsoportModel csmodel = new AmiCsoportModel() { ID = csoportID }; csmodel.TabList = GetTabItems(csmodel); PopUpModel pm = new PopUpModel(csmodel, "CsoportProperties_Info"); pm = pm.AddCancelBtn(pm, fromAdd ? "CsoportHelper.csoportModifyAddCancel" : "CsoportHelper.propertiesCancel"); return PartialView(Constants.General.PopupView, pm); } public ActionResult OpenCsoportAddPopup(int? id) { var csmodel = AmiOsztalyCsoportLogic.GetCsoportBaseProperties(id); csmodel.IsFeladatellatasiHelySzures = true; PopUpModel pm = new PopUpModel(csmodel, "CsoportAdd_Bevitel"); pm = pm.AddCancelBtn(pm, "CsoportHelper.csoportModifyAddCancel"); pm = pm.AddOkBtn(pm, "CsoportHelper.modifyAddSave"); return PartialView(Constants.General.PopupView, pm); } public ActionResult OpenUjEgyeniCsoportAdd(int? id) { EgyeniCsoportModel csoportModel = new EgyeniCsoportModel() { CsoportNeve = OsztalyCsoportLogic.GetEgyeniCsoportAlapertelmezettNev() }; PopUpModel popUpModel = new PopUpModel(csoportModel, "EgyeniCsoportAdd_Bevitel"); popUpModel.AddCancelBtn(popUpModel, "CsoportHelper.egyeniCsoportModifyAddCancel"); popUpModel.AddOkBtn(popUpModel, "CsoportHelper.egyeniCsoportMmodifyAddSave"); return PartialView(Constants.General.PopupView, popUpModel); } public ActionResult OpenCsoportModifyPopup(int? id) { AmiCsoportModel csmodel = AmiOsztalyCsoportLogic.GetCsoportBaseProperties(id); csmodel.IsFeladatellatasiHelySzures = true; csmodel.TabList = new List(); csmodel.TabList.Add(new TabStripItemModel() { ItemId = "1", ItemName = StringResourcesUtil.GetString(3880) /*Csoport alapadatok*/, Model = csmodel, PartialViewName = "CsoportModify_Bevitel", IsActive = true }); csmodel.TabList.Add(new TabStripItemModel() { ItemId = "2", ItemName = StringResourcesUtil.GetString(3881) /*A csoportba járó tanulók listája*/, Model = csmodel, PartialViewName = "CsoportTanulo_Bevitel" }); PopUpModel pm = new PopUpModel(csmodel, "CsoportModify_Bevitel_Tab"); pm = pm.AddCancelBtn(pm, "CsoportHelper.csoportModifyAddCancel"); pm = pm.AddOkBtn(pm, "CsoportHelper.modifyAddSave"); return PartialView(Constants.General.PopupView, pm); } public ActionResult OpenModPopup(List csoportLista) { var model = AmiOsztalyCsoportLogic.GetModelForCsoportModPopup(csoportLista); AmiOsztalyCsoportLogic.ValidateTobbesModAutoEgyeniCsoport(model.CsoportIDArrayString); PopUpModel pm = new PopUpModel(model, "CsoportTobbModify_bevitel"); pm = pm.AddCancelBtn(pm, "CsoportHelper.csoportModifyAddCancel"); pm = pm.AddOkBtn(pm, "CsoportHelper.confirmCsopModWindow"); return PartialView(Constants.General.PopupView, pm); } [MvcRolePackageAuthorize(TanevEnum.Mind, KretaClaimPackages.AMImodul.ClaimValue)] public ActionResult GetCsoportBaseProperties(int? id) { AmiCsoportModel csmodel = AmiOsztalyCsoportLogic.GetCsoportBaseProperties(id); return PartialView("Info_Alapadatok_Tab", csmodel); } [MvcRolePackageAuthorize(TanevEnum.Mind, KretaClaimPackages.AMImodul.ClaimValue)] public ActionResult GetCsoportTanuloi(int id) { AmiCsoportModel csmodel = new AmiCsoportModel() { ID = id }; return PartialView("Info_CsoportTanuloi_Tab", csmodel); } [MvcRolePackageAuthorize(TanevEnum.Mind, KretaClaimPackages.AMImodul.ClaimValue)] public ActionResult GetCsoportFoglalkozasai(int id) { AmiCsoportModel csmodel = new AmiCsoportModel() { ID = id }; return PartialView("Info_CsoportFoglalkozasai_Tab", csmodel); } [MvcRolePackageAuthorize(TanevEnum.Mind, KretaClaimPackages.AMImodul.ClaimValue)] public ActionResult GetCsoportOrarendiOrai(int id) { AmiCsoportModel csmodel = new AmiCsoportModel() { ID = id }; return PartialView("Info_CsoportOrarendiOrai_Tab", csmodel); } [MvcRolePackageAuthorize(TanevEnum.Mind, KretaClaimPackages.AMImodul.ClaimValue)] public ActionResult GetCsoportTanmenetei(int id) { AmiCsoportModel csmodel = new AmiCsoportModel() { ID = id }; return PartialView("Info_CsoportTanmenetei_Tab", csmodel); } [MvcRolePackageAuthorize(TanevEnum.Mind, KretaClaimPackages.AMImodul.ClaimValue)] public ActionResult GetCsoportMegtartottTanorai(int id) { AmiCsoportModel csmodel = new AmiCsoportModel() { ID = id }; return PartialView("Info_CsoportMegtartottTanorai_Tab", csmodel); } [MvcRolePackageAuthorize(TanevEnum.Mind, KretaClaimPackages.AMImodul.ClaimValue)] public ActionResult GetCsoportErtekelesei(int id) { AmiCsoportModel csmodel = new AmiCsoportModel() { ID = id }; return PartialView("Info_CsoportErtekelesei_Tab", csmodel); } public ActionResult GetPartialView(string dataType, int csoportId) { var model = OsztalyCsoportLogic.GetModelForPartialViewCsoport(dataType, csoportId); return PartialView("_TanuloSorolasPartialRowFunction", model); } public ActionResult OpenBesorolasModDatum(int tanuloId, int csoportId) { return PartialView(Constants.General.PopupView, OsztalyCsoportLogic.GetPopUpModelForBesorolasModDatumCsoport(tanuloId, csoportId)); } public ActionResult OpenKisorolasModDatum(int tanuloId, int csoportId) { return PartialView(Constants.General.PopupView, OsztalyCsoportLogic.GetPopUpModelForKisorolasModDatumCsoport(tanuloId, csoportId)); } public ActionResult OpenKisorolas(int tanuloId, int csoportId) { return PartialView(Constants.General.PopupView, OsztalyCsoportLogic.GetPopUpModelForKisorolasCsoport(tanuloId, csoportId)); } public List GetTabItems(AmiCsoportModel model) { const string CsoportController = Constants.Controllers.CsoportAmi; var items = new List(); items.Add(new TabStripItemModel { ItemId = "1", ItemName = StringResourcesUtil.GetString(161), Area = "OsztalyCsoport", Controller = CsoportController, Action = "GetCsoportBaseProperties", RouteParameters = new Dictionary() { { "Id", model.ID.ToString() } } }); items.Add(new TabStripItemModel { ItemId = "2", ItemName = TanuloResource.Novendekek, Area = "OsztalyCsoport", Controller = CsoportController, Action = "GetCsoportTanuloi", RouteParameters = new Dictionary() { { "Id", model.ID.ToString() } } }); items.Add(new TabStripItemModel { ItemId = "3", ItemName = StringResourcesUtil.GetString(164)/*Foglalkozások*/, Area = "OsztalyCsoport", Controller = CsoportController, Action = "GetCsoportFoglalkozasai", RouteParameters = new Dictionary() { { "Id", model.ID.ToString() } } }); if (!ClaimData.IsSzirIntezmeny) { items.Add(new TabStripItemModel { ItemId = "4", ItemName = StringResourcesUtil.GetString(165)/*Órarendi órák*/, Area = "OsztalyCsoport", Controller = CsoportController, Action = "GetCsoportOrarendiOrai", RouteParameters = new Dictionary() { { "Id", model.ID.ToString() } }, IsETTFDisabled = true }); items.Add(new TabStripItemModel { ItemId = "5", ItemName = StringResourcesUtil.GetString(166)/*Tanmenetek*/, Area = "OsztalyCsoport", Controller = CsoportController, Action = "GetCsoportTanmenetei", RouteParameters = new Dictionary() { { "Id", model.ID.ToString() } }, IsETTFDisabled = true }); items.Add(new TabStripItemModel { ItemId = "6", ItemName = StringResourcesUtil.GetString(167)/*Megtartott tanórák*/, Area = "OsztalyCsoport", Controller = CsoportController, Action = "GetCsoportMegtartottTanorai", RouteParameters = new Dictionary() { { "Id", model.ID.ToString() } }, IsETTFDisabled = true }); items.Add(new TabStripItemModel { ItemId = "7", ItemName = StringResourcesUtil.GetString(1701)/*Értékelések*/, Area = "OsztalyCsoport", Controller = CsoportController, Action = "GetCsoportErtekelesei", RouteParameters = new Dictionary() { { "Id", model.ID.ToString() } }, IsETTFDisabled = true }); } return items; } #region Export public ActionResult ExportCsoportokMindenAdata([FromUri] CsoportSearchModel model) { return OsztalyCsoportLogic.ExportCsoportokMindenAdata(OktNevelesiKategoriaEnum.AlapfokuMuveszetoktatas, model); } public ActionResult ExportCsoportbaJaroTanulok([FromUri] CsoportSearchModel model) { return OsztalyCsoportLogic.ExportCsoportbaJaroTanulok(OktNevelesiKategoriaEnum.AlapfokuMuveszetoktatas, model); } #endregion Export } }