From 740b2d54b82d228e7cf11b11912908adee40f2ce Mon Sep 17 00:00:00 2001 From: Nakorn Rientrakrunchai Date: Thu, 12 Mar 2020 10:12:42 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=88=E0=B8=B1=E0=B8=94=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2=E0=B8=84=E0=B9=89?= =?UTF-8?q?=E0=B8=99=E0=B8=AB=E0=B8=B2=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=8A?= =?UTF-8?q?=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=9E=E0=B8=99=E0=B8=B1=E0=B8=81?= =?UTF-8?q?=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ApiControllers/search_employeeControllers.cs | 108 ++++++++ EF/_BaseViewModel2.cs | 4 +- EF/_IBaseViewModel2.cs | 4 +- EXCEL/external_employee@search_employee.xlsx | Bin 0 -> 8913 bytes .../eva_adjust_postponementService.cs | 2 +- .../eva_adjust_postponement_detailService.cs | 2 +- ...djust_postponement_detail_normalService.cs | 2 +- ...st_postponement_detail_normal_02Service.cs | 2 +- ...adjust_postponement_detail_quotaService.cs | 2 +- ...ust_postponement_detail_quota_02Service.cs | 2 +- .../eva_adjust_postponement_normalService.cs | 2 +- .../eva_adjust_postponement_quotaService.cs | 2 +- .../eva_create_evaluationService.cs | 2 +- .../eva_create_evaluation_detailService.cs | 2 +- ...eate_evaluation_detail_agreementService.cs | 4 +- ...create_evaluation_detail_processService.cs | 4 +- ...reate_evaluation_detail_review01Service.cs | 2 +- ...reate_evaluation_detail_review02Service.cs | 2 +- ...reate_evaluation_detail_review03Service.cs | 2 +- ...reate_evaluation_detail_review04Service.cs | 2 +- ..._create_evaluation_detail_statusService.cs | 2 +- ...reate_evaluation_detail_summary1Service.cs | 2 +- ...reate_evaluation_detail_summary2Service.cs | 2 +- .../eva_evaluation_achievementService.cs | 2 +- ...a_evaluation_achievement_processService.cs | 2 +- ..._evaluation_achievement_process2Service.cs | 2 +- .../eva_evaluation_behaviorService.cs | 2 +- .../eva_evaluation_behavior_processService.cs | 2 +- ...eva_evaluation_behavior_process2Service.cs | 2 +- .../eva_evaluation_groupService.cs | 6 +- .../eva_evaluation_group_detailService.cs | 4 +- .../eva_level_score/eva_level_scoreService.cs | 6 +- .../eva_level_score_basicService.cs | 2 +- .../eva_performance_planService.cs | 6 +- .../eva_performance_plan_detailService.cs | 6 +- .../eva_promoted_percentageService.cs | 6 +- .../eva_salary_cylinderService.cs | 4 +- .../Isearch_employeeService.cs | 24 ++ .../search_employeeInputModel.cs | 36 +++ .../search_employeeReportRequestModel.cs | 21 ++ .../search_employeeSearchModel.cs | 27 ++ .../search_employee/search_employeeService.cs | 100 ++++++++ .../search_employeeViewModel.cs | 35 +++ .../search_employeeWithSelectionViewModel.cs | 14 + Startup.cs | 6 + .../search_employeeViewControllers.cs | 66 +++++ .../search_employee.cshtml | 82 ++++++ tb320eva.xml | 36 +++ .../eva_create_evaluation_detail.js | 2 +- wwwroot/js/search_employee/search_employee.js | 240 ++++++++++++++++++ 50 files changed, 847 insertions(+), 52 deletions(-) create mode 100644 ApiControllers/search_employeeControllers.cs create mode 100644 EXCEL/external_employee@search_employee.xlsx create mode 100644 Models/search_employee/Isearch_employeeService.cs create mode 100644 Models/search_employee/search_employeeInputModel.cs create mode 100644 Models/search_employee/search_employeeReportRequestModel.cs create mode 100644 Models/search_employee/search_employeeSearchModel.cs create mode 100644 Models/search_employee/search_employeeService.cs create mode 100644 Models/search_employee/search_employeeViewModel.cs create mode 100644 Models/search_employee/search_employeeWithSelectionViewModel.cs create mode 100644 ViewControllers/search_employeeViewControllers.cs create mode 100644 Views/search_employeeView/search_employee.cshtml create mode 100644 wwwroot/js/search_employee/search_employee.js diff --git a/ApiControllers/search_employeeControllers.cs b/ApiControllers/search_employeeControllers.cs new file mode 100644 index 0000000..64a0611 --- /dev/null +++ b/ApiControllers/search_employeeControllers.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Logging; +using TTSW.Controllers; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; +using System.Data; +using Microsoft.Extensions.Configuration; +using System.IO; + +namespace TodoAPI2.Controllers +{ + //[Authorize] + [Produces("application/json")] + [Route("api/search_employee")] + public class search_employeeController : BaseController + { + #region Private Variables + private ILogger _logger; + private Isearch_employeeService _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public search_employeeController(ILogger logger, Isearch_employeeService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + + /// + /// Get Blank Item + /// + /// + /// + /// Return a blank item + /// Returns the item + /// Error Occurred + [HttpGet("GetBlankItem")] + [ProducesResponseType(typeof(search_employeeWithSelectionViewModel), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetBlankItem() + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.GetBlankItem(); + + return Ok(result); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Get list items by search + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("GetListBySearch")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetListBySearch(search_employeeSearchModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListBySearch(model)); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + + } +} diff --git a/EF/_BaseViewModel2.cs b/EF/_BaseViewModel2.cs index df5fcf6..ce92058 100644 --- a/EF/_BaseViewModel2.cs +++ b/EF/_BaseViewModel2.cs @@ -8,9 +8,9 @@ namespace TTSW.EF public class BaseViewModel2 : IBaseViewModel2 { public Key id { get; set; } - public DateTime Created {get; set;} + public DateTime? Created {get; set;} - public DateTime Updated {get; set;} + public DateTime? Updated {get; set;} public bool isActive { get; set;} } } diff --git a/EF/_IBaseViewModel2.cs b/EF/_IBaseViewModel2.cs index d7d75d3..e8fe04b 100644 --- a/EF/_IBaseViewModel2.cs +++ b/EF/_IBaseViewModel2.cs @@ -8,9 +8,9 @@ namespace TTSW.EF public interface IBaseViewModel2 { - DateTime Created { get; set; } + DateTime? Created { get; set; } - DateTime Updated { get; set; } + DateTime? Updated { get; set; } bool isActive { get; set; } diff --git a/EXCEL/external_employee@search_employee.xlsx b/EXCEL/external_employee@search_employee.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..562f54997f51ed5da8e78904496fe0da50e6ea82 GIT binary patch literal 8913 zcmeHN1zTLn(jI~a_h1Q5aM$3L1a}hL-Q8^n)$&r%FxUV%00IC2AO+|jXP9b30RYi3000&M;hBc0jkTkZ zwWE%*o2`+97Ne_`B?$=T8Fe<`8KnLH%75_)l*A9pb~2-jU%!74-DHsbRwabMaRlte zq*V}T?~3awHqgj4GkeMmxknet!7=Bm#2o$R!Fo1qT4inZ1sL4Zq=+2m*VnG1O~}R6 z-Fryc_5wfFUR~`Z8=Fvw1z$%e!Z;0(Y**K*$S$@fELlQeii0cQyOFWbtBSGG(|}y8 zUdYq8*s&_Bx{Sd+P&A3YF^)B5ZbsvweX+qH0TV{%@eS8mJ5QeUqY{n2VuSr%l2oe$ zbv@g(uEDcq=D_F{)TNOXxTaRFS2FAbRY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C**1uTJO9GMGVf9xFlZRORhJ;bA?Y= z>E%l2**+*AdhK=A>avEDmFm>Y0TXm68)UAM21D8FHT0cZ-i1ixJfmO6>MPuU|MrUb z^~7kW%gp4U#3S3zJEGzEhllz*2wVO;WeW9-0YZ=d^WlMi&(go^e>h4YFZEXie@%1# zTkvO{1bOA3lAgZ`{x$XUXTfF&?e_mCf_~NWYd+u)O(&4^5x-;yeii>#F#N4gi3b5CHhw8u_dEUp?QS#Xr6LllZ^ GetListByfullname(string fullname); + List GetListBySearch(search_employeeSearchModel model); + + search_employeeWithSelectionViewModel GetBlankItem(); + + + + } +} + diff --git a/Models/search_employee/search_employeeInputModel.cs b/Models/search_employee/search_employeeInputModel.cs new file mode 100644 index 0000000..212276b --- /dev/null +++ b/Models/search_employee/search_employeeInputModel.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class search_employeeInputModel + { + + public int? id { get; set; } + + public Guid? eva_evaluation_group_id { get; set; } + + public string employee_number { get; set; } + + public string fullname { get; set; } + + public string position_name { get; set; } + + public string level_name { get; set; } + + public int? org_id { get; set; } + + public string remark { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/search_employee/search_employeeReportRequestModel.cs b/Models/search_employee/search_employeeReportRequestModel.cs new file mode 100644 index 0000000..ec413a6 --- /dev/null +++ b/Models/search_employee/search_employeeReportRequestModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class search_employeeReportRequestModel : search_employeeSearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/search_employee/search_employeeSearchModel.cs b/Models/search_employee/search_employeeSearchModel.cs new file mode 100644 index 0000000..eae3121 --- /dev/null +++ b/Models/search_employee/search_employeeSearchModel.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class search_employeeSearchModel + { + + public int id { get; set; } + + public Guid? eva_evaluation_group_id { get; set; } + + public string fullname { get; set; } + + public int? org_id { get; set; } + + } +} + diff --git a/Models/search_employee/search_employeeService.cs b/Models/search_employee/search_employeeService.cs new file mode 100644 index 0000000..373851a --- /dev/null +++ b/Models/search_employee/search_employeeService.cs @@ -0,0 +1,100 @@ +using AutoMapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; +using System.IO; +using System.Web; +using System.Net; +using TTSW.Configure; +using Microsoft.Extensions.Options; +using System.Data; + +namespace TodoAPI2.Models +{ + public class search_employeeService : Isearch_employeeService + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + private Iexternal_employeeService emp; + + public search_employeeService(IBaseRepository2 repository, + IMyDatabase mydb, + Iexternal_linkageService inext, + Iexternal_employeeService inemp) + { + db = mydb; + ext = inext; + _repository = repository; + emp = inemp; + } + + public search_employeeWithSelectionViewModel GetBlankItem() + { + var i = new search_employeeWithSelectionViewModel(); + i.item_eva_evaluation_group_id = (from x in _repository.Context.eva_evaluation_group orderby x.thegroup select x).ToList(); + i.item_org_id = (from x in ext.GetDepartmentData() orderby x.external_name select x).ToList(); + + + return i; + } + + public List GetListByfullname(string fullname) + { + var model = new search_employeeSearchModel(); + model.fullname = fullname; + return GetListBySearch(model); + } + + public List GetListBySearch(search_employeeSearchModel model) + { + var allemp = emp.GetListByemployee_type(null, null).ToList(); + + var data = ( + from m_search_employee in allemp + + join fk_eva_evaluation_group1_detail in _repository.Context.eva_evaluation_group_detail on m_search_employee.id equals fk_eva_evaluation_group1_detail.employee_id + into eva_evaluation_groupResult1_detail + from fk_eva_evaluation_groupResult1_detail in eva_evaluation_groupResult1_detail.DefaultIfEmpty() + + //join fk_eva_evaluation_group1 in _repository.Context.eva_evaluation_group on fk_eva_evaluation_groupResult1_detail.evaluation_group_id equals fk_eva_evaluation_group1.id + //into eva_evaluation_groupResult1 + //from fk_eva_evaluation_groupResult1 in eva_evaluation_groupResult1.DefaultIfEmpty() + + where 1 == 1 + && ((fk_eva_evaluation_groupResult1_detail != null && fk_eva_evaluation_groupResult1_detail.evaluation_group_id == model.eva_evaluation_group_id) || !model.eva_evaluation_group_id.HasValue) + && (string.IsNullOrEmpty(model.fullname) || (!string.IsNullOrEmpty(m_search_employee.fullname) && (m_search_employee.fullname.Contains(model.fullname)))) + && (m_search_employee.department_id == model.org_id || !model.org_id.HasValue) + + orderby m_search_employee.fullname + select new search_employeeViewModel() + { + id = m_search_employee.id, + eva_evaluation_group_id = fk_eva_evaluation_groupResult1_detail != null ? fk_eva_evaluation_groupResult1_detail.evaluation_group_id : null, + employee_number = m_search_employee.employee_no, + fullname = m_search_employee.fullname, + position_name = m_search_employee.position_name, + level_name = m_search_employee.position_level_text, + org_id = m_search_employee.department_id, + remark = m_search_employee.user_email, + + eva_evaluation_group_id_eva_evaluation_group_code = null, + org_id_external_linkage_external_name = m_search_employee.department_name, + + isActive = true, + Created = null, + Updated = null + } + ).ToList(); + + return data; + } + } +} + diff --git a/Models/search_employee/search_employeeViewModel.cs b/Models/search_employee/search_employeeViewModel.cs new file mode 100644 index 0000000..78f941b --- /dev/null +++ b/Models/search_employee/search_employeeViewModel.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class search_employeeViewModel : BaseViewModel2 + { + + public Guid? eva_evaluation_group_id { get; set; } + + public string employee_number { get; set; } + + public string fullname { get; set; } + + public string position_name { get; set; } + + public string level_name { get; set; } + + public int? org_id { get; set; } + + public string remark { get; set; } + + public string eva_evaluation_group_id_eva_evaluation_group_code { get; set; } + public string org_id_external_linkage_external_name { get; set; } + + } +} \ No newline at end of file diff --git a/Models/search_employee/search_employeeWithSelectionViewModel.cs b/Models/search_employee/search_employeeWithSelectionViewModel.cs new file mode 100644 index 0000000..9b0c492 --- /dev/null +++ b/Models/search_employee/search_employeeWithSelectionViewModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class search_employeeWithSelectionViewModel: search_employeeViewModel + { + public List item_eva_evaluation_group_id { get; set; } + public List item_org_id { get; set; } + + } +} \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index 18434df..0061ef4 100644 --- a/Startup.cs +++ b/Startup.cs @@ -282,6 +282,8 @@ namespace Test01 services.AddScoped(); + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -485,6 +487,10 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); + //cfg.CreateMap(); + //cfg.CreateMap(); + //cfg.CreateMap(); + }); #endregion diff --git a/ViewControllers/search_employeeViewControllers.cs b/ViewControllers/search_employeeViewControllers.cs new file mode 100644 index 0000000..32f4b3c --- /dev/null +++ b/ViewControllers/search_employeeViewControllers.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using TodoAPI2.Models; +using STAFF_API.Models; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Configuration; +using TodoAPI2.Controllers; + +namespace TodoAPI2.Controllers +{ + public class search_employeeViewController : Controller + { + private ILogger _logger; + private Isearch_employeeService _repository; + private IConfiguration Configuration { get; set; } + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public search_employeeViewController(ILogger logger, Isearch_employeeService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + public IActionResult search_employee() + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + return View(); + } + + public IActionResult search_employee_d() + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + return View(); + } + + //public IActionResult search_employee_report() + //{ + // if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + //} + + //public IActionResult search_employee_inline() + //{ + // if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + //} + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} + + diff --git a/Views/search_employeeView/search_employee.cshtml b/Views/search_employeeView/search_employee.cshtml new file mode 100644 index 0000000..3892f48 --- /dev/null +++ b/Views/search_employeeView/search_employee.cshtml @@ -0,0 +1,82 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration +@{ + ViewData["Title"] = "search_employee"; + Layout = "_LayoutDirect"; +} + + +
+
+
+ @Configuration["SiteInformation:modulename"] +
+
+
+ +
+
+ +
+
ค้นหารายชื่อ บุคคลากร
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+ + +
+
+
+ + + + + + + + + + + + + + +
+
+ + +@section FooterPlaceHolder{ + + +} + diff --git a/tb320eva.xml b/tb320eva.xml index 50b871e..a701d69 100644 --- a/tb320eva.xml +++ b/tb320eva.xml @@ -3589,6 +3589,34 @@ Returns the item Error Occurred + + + Default constructure for dependency injection + + + + + + + + Get Blank Item + + + + Return a blank item + Returns the item + Error Occurred + + + + Get list items by search + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + Default constructure for dependency injection @@ -3837,6 +3865,14 @@ + + + Default constructure for dependency injection + + + + + Default constructure for dependency injection diff --git a/wwwroot/js/eva_create_evaluation_detail/eva_create_evaluation_detail.js b/wwwroot/js/eva_create_evaluation_detail/eva_create_evaluation_detail.js index 498c24b..608c4a9 100644 --- a/wwwroot/js/eva_create_evaluation_detail/eva_create_evaluation_detail.js +++ b/wwwroot/js/eva_create_evaluation_detail/eva_create_evaluation_detail.js @@ -53,7 +53,7 @@ function eva_create_evaluation_detail_InitialForm(s) { //================= Form Mode Setup and Flow ========================================= function eva_create_evaluation_detail_GoCreate() { - window_open(appsite + "/external_employeeview/external_employee"); + window_open(appsite + "/search_employeeview/search_employee"); // Incase model popup //eva_create_evaluation_detail_SetCreateForm(true); diff --git a/wwwroot/js/search_employee/search_employee.js b/wwwroot/js/search_employee/search_employee.js new file mode 100644 index 0000000..278c140 --- /dev/null +++ b/wwwroot/js/search_employee/search_employee.js @@ -0,0 +1,240 @@ +var search_employee_editMode = "CREATE"; +var search_employee_API = "/api/search_employee/"; + +//================= Search Customizaiton ========================================= + +function search_employee_GetSearchParameter() { + var search_employeeSearchObject = new Object(); +search_employeeSearchObject.eva_evaluation_group_id = $("#s_search_employee_eva_evaluation_group_id").val(); +search_employeeSearchObject.fullname = $("#s_search_employee_fullname").val(); +search_employeeSearchObject.org_id = $("#s_search_employee_org_id").val(); + + return search_employeeSearchObject; +} + +function search_employee_FeedDataToSearchForm(data) { +DropDownClearFormAndFeedWithData($("#s_search_employee_eva_evaluation_group_id"), data, "id", "thegroup", "item_eva_evaluation_group_id", data.eva_evaluation_group_id); +$("#s_search_employee_fullname").val(data.fullname); +DropDownClearFormAndFeedWithData($("#s_search_employee_org_id"), data, "id", "external_name", "item_org_id", data.org_id); + +} + +//================= Form Data Customizaiton ========================================= + +function search_employee_FeedDataToForm(data) { +$("#search_employee_id").val(data.id); +DropDownClearFormAndFeedWithData($("#search_employee_eva_evaluation_group_id"), data, "id", "thegroup", "item_eva_evaluation_group_id", data.eva_evaluation_group_id); +$("#search_employee_employee_number").val(data.employee_number); +$("#search_employee_fullname").val(data.fullname); +$("#search_employee_position_name").val(data.position_name); +$("#search_employee_level_name").val(data.level_name); +DropDownClearFormAndFeedWithData($("#search_employee_org_id"), data, "id", "external_name", "item_org_id", data.org_id); +$("#search_employee_remark").val(data.remark); + +} + +function search_employee_GetFromForm() { + var search_employeeObject = new Object(); +search_employeeObject.id = $("#search_employee_id").val(); +search_employeeObject.eva_evaluation_group_id = $("#search_employee_eva_evaluation_group_id").val(); +search_employeeObject.employee_number = $("#search_employee_employee_number").val(); +search_employeeObject.fullname = $("#search_employee_fullname").val(); +search_employeeObject.position_name = $("#search_employee_position_name").val(); +search_employeeObject.level_name = $("#search_employee_level_name").val(); +search_employeeObject.org_id = $("#search_employee_org_id").val(); +search_employeeObject.remark = $("#search_employee_remark").val(); + + + return search_employeeObject; +} + +function search_employee_InitialForm(s) { + var successFunc = function (result) { + search_employee_FeedDataToForm(result); + search_employee_FeedDataToSearchForm(result); + if (s) { + // Incase model popup + $("#search_employeeModel").modal("show"); + } + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + search_employee_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Form Mode Setup and Flow ========================================= + +function search_employee_GoCreate() { + // Incase model popup + search_employee_SetCreateForm(true); + + // Incase open new page + //window_open(appsite + "/search_employeeView/search_employee_d"); +} + +function search_employee_GoEdit(a) { + // Incase model popup + search_employee_SetEditForm(a); + + // Incase open new page + //window_open(appsite + "/search_employeeView/search_employee_d?id=" + a); +} + +function search_employee_SetEditForm(a) { + var successFunc = function (result) { + search_employee_editMode = "UPDATE"; + search_employee_FeedDataToForm(result); + $("#search_employeeModel").modal("show"); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + search_employee_API + a, successFunc, AlertDanger); +} + +function search_employee_SetCreateForm(s) { + search_employee_editMode = "CREATE"; + search_employee_InitialForm(s); +} + +function search_employee_RefreshTable() { + // Incase model popup + search_employee_DoSearch(); + + // Incase open new page + //window.parent.search_employee_DoSearch(); +} + +//================= Update and Delete ========================================= + +var search_employee_customValidation = function (group) { + return ""; +}; + +function search_employee_PutUpdate() { + if (!ValidateForm('search_employee', search_employee_customValidation)) + { + return; + } + + var data = search_employee_GetFromForm(); + + //Update Mode + if (search_employee_editMode === "UPDATE") { + var successFunc1 = function (result) { + $("#search_employeeModel").modal("hide"); + AlertSuccess(result.code+" "+result.message); + search_employee_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxPutRequest(apisite + search_employee_API + data.id, data, successFunc1, AlertDanger); + } + // Create mode + else { + var successFunc2 = function (result) { + $("#search_employeeModel").modal("hide"); + AlertSuccess(result.code+" "+result.message); + search_employee_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxPostRequest(apisite + search_employee_API, data, successFunc2, AlertDanger); + } +} + +function search_employee_GoDelete(a) { + if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) { + var successFunc = function (result) { + $("#search_employeeModel").modal("hide"); + AlertSuccess(result.code+" "+result.message); + search_employee_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxDeleteRequest(apisite + search_employee_API + a, null, successFunc, AlertDanger); + } +} + +//================= Data Table ========================================= + +var search_employeeTableV; + +var search_employee_setupTable = function (result) { + tmp = '"'; + search_employeeTableV = $('#search_employeeTable').DataTable({ + "processing": true, + "serverSide": false, + "data": result, + "select": { + "style": 'multi' + }, + "columns": [ + { "data": "" }, + { "data": "employee_number" }, + { "data": "fullname" }, + { "data": "position_name" }, + { "data": "level_name" }, + { "data": "org_id_external_linkage_external_name" }, + { "data": "remark" }, + ], + "columnDefs": [ + { + targets: 0, + data: "", + defaultContent: '', + orderable: false, + className: 'select-checkbox' + }], + "language": { + "url": appsite + "/DataTables-1.10.16/thai.json" + }, + "paging": true, + "searching": false + }); + + endLoad(); +}; + +function search_employee_SelectAll(){ + search_employeeTableV.rows().select(); +} + +function search_employee_DeselectAll(){ + search_employeeTableV.rows().deselect(); +} + +function search_employee_InitiateDataTable() { + startLoad(); + var p = $.param(search_employee_GetSearchParameter()); + AjaxGetRequest(apisite + "/api/search_employee/GetListBySearch?"+p, search_employee_setupTable, AlertDanger); +} + +function search_employee_DoSearch() { + var p = $.param(search_employee_GetSearchParameter()); + var search_employee_reload = function (result) { + search_employeeTableV.destroy(); + search_employee_setupTable(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + "/api/search_employee/GetListBySearch?"+p, search_employee_reload, AlertDanger); +} + +function search_employee_GetSelect(f) { + var search_employee_selectitem = []; + $.each(search_employeeTableV.rows('.selected').data(), function (key, value) { + search_employee_selectitem.push(value[f]); + }); + //alert(search_employee_selectitem); + window_close(); + window.parent.AddMultiple(search_employee_selectitem); +} + +//================= File Upload ========================================= + + + +//================= Multi-Selection Function ========================================= + + +