From afc4429e63213243dea58303678a5e80d1169ce9 Mon Sep 17 00:00:00 2001 From: nakorn Date: Tue, 16 Nov 2021 18:07:33 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=83=E0=B8=AB?= =?UTF-8?q?=E0=B9=89=20=E0=B8=9C=E0=B8=B9=E0=B9=89=E0=B8=9B=E0=B8=A3?= =?UTF-8?q?=E0=B8=B0=E0=B9=80=E0=B8=A1=E0=B8=B4=E0=B8=99=E0=B8=AA=E0=B8=B9?= =?UTF-8?q?=E0=B8=87=E0=B8=AA=E0=B8=B8=E0=B8=94=20=E0=B8=9E=E0=B8=B4?= =?UTF-8?q?=E0=B9=80=E0=B8=A8=E0=B8=A9=20=E0=B8=9B=E0=B8=A3=E0=B8=B0?= =?UTF-8?q?=E0=B9=80=E0=B8=A1=E0=B8=B4=E0=B8=99=E0=B9=84=E0=B8=94=E0=B9=89?= =?UTF-8?q?=E0=B9=81=E0=B8=A5=E0=B9=89=E0=B8=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e_evaluation_detail_review05Controllers.cs | 361 ++++++++++++++++++ ...eva_create_evaluation_detail_review05.xlsx | Bin 0 -> 10670 bytes ...create_evaluation_detail_processService.cs | 24 +- ...reate_evaluation_detail_review04Service.cs | 48 +-- ...reate_evaluation_detail_review05Service.cs | 32 ++ ...te_evaluation_detail_review05InputModel.cs | 32 ++ ...ation_detail_review05ReportRequestModel.cs | 21 + ...e_evaluation_detail_review05SearchModel.cs | 23 ++ ...reate_evaluation_detail_review05Service.cs | 307 +++++++++++++++ ...ate_evaluation_detail_review05ViewModel.cs | 32 ++ ...n_detail_review05WithSelectionViewModel.cs | 13 + ..._create_evaluation_detail_statusService.cs | 18 + Startup.cs | 6 + ...create_evaluation_detail_process_d2.cshtml | 86 ++++- tb320eva.xml | 108 ++++++ ...eva_create_evaluation_detail_process_d2.js | 35 ++ ...eva_create_evaluation_detail_review05_d.js | 106 +++++ 17 files changed, 1220 insertions(+), 32 deletions(-) create mode 100644 ApiControllers/eva_create_evaluation_detail_review05Controllers.cs create mode 100644 EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_review05.xlsx create mode 100644 Models/eva_create_evaluation_detail_review05/Ieva_create_evaluation_detail_review05Service.cs create mode 100644 Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05InputModel.cs create mode 100644 Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05ReportRequestModel.cs create mode 100644 Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05SearchModel.cs create mode 100644 Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05Service.cs create mode 100644 Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05ViewModel.cs create mode 100644 Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05WithSelectionViewModel.cs create mode 100644 wwwroot/js/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05_d.js diff --git a/ApiControllers/eva_create_evaluation_detail_review05Controllers.cs b/ApiControllers/eva_create_evaluation_detail_review05Controllers.cs new file mode 100644 index 0000000..5428b4f --- /dev/null +++ b/ApiControllers/eva_create_evaluation_detail_review05Controllers.cs @@ -0,0 +1,361 @@ +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; +using System.Net; + +namespace TodoAPI2.Controllers +{ + //[Authorize] + [Produces("application/json")] + [Route("api/eva_create_evaluation_detail_review05")] + public class eva_create_evaluation_detail_review05Controller : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_create_evaluation_detail_review05Service _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_create_evaluation_detail_review05Controller(ILogger logger, Ieva_create_evaluation_detail_review05Service repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + /// + /// Get specific item by id + /// + /// + /// + /// Return Get specific item by id + /// Returns the item + /// Error Occurred + [HttpGet("{id}")] + [ProducesResponseType(typeof(eva_create_evaluation_detail_review05WithSelectionViewModel), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Get(int id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.GetWithSelection(id); + + return Ok(result); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult Get.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Get Blank Item + /// + /// + /// + /// Return a blank item + /// Returns the item + /// Error Occurred + [HttpGet("GetBlankItem")] + [ProducesResponseType(typeof(eva_create_evaluation_detail_review05WithSelectionViewModel), 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 create_evaluation_id + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetList(int? create_evaluation_id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListBycreate_evaluation_id(create_evaluation_id)); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetList.", 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(eva_create_evaluation_detail_review05SearchModel 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}"); + } + } + + + /// + /// Create new item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPost("")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Insert([FromBody] eva_create_evaluation_detail_review05InputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.Insert(model, true); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"เพิ่มข้อมูล เรียบร้อย"; + message.data = result; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while insert.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Update item + /// + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("{id}")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Update(int id, [FromBody] eva_create_evaluation_detail_review05InputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.Update(id, model, true); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"แก้ไขข้อมูล เรียบร้อย"; + message.data = result; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while update {id.ToString()}.", ex); + return StatusCode(500, $"{id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Delete item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpDelete("{id}")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Delete(int id) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + _repository.Delete(id); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"ลบข้อมูล เรียบร้อย"; + message.data = null; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while delete {id.ToString()}.", ex); + return StatusCode(500, $"{id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Update multiple item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("UpdateMultiple")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult UpdateMultiple([FromBody] List model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + string rowCount = _repository.UpdateMultiple(model, true); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = "ปรับปรุงข้อมูลเรียบร้อย จำนวน "+rowCount+" รายการ"; + message.data = null; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while UpdateMultiple.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Refresh AutoField of all items + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("RefreshAutoField")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult RefreshAutoField() + { + if (ModelState.IsValid) + { + try + { + //if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + _repository.RefreshAutoFieldOfAllData(); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"ปรับปรุง Auto Field ของทุก record เรียบร้อย"; + message.data = null; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while RefreshAutoField.", ex); + return StatusCode(500, $"มีปัญหาระหว่างการปรับปรุง Auto Field. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + + + } +} diff --git a/EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_review05.xlsx b/EXCEL/eva_create_evaluation_detail@eva_create_evaluation_detail_review05.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..c2edf5c35182430b859e7439a72cd41ccb92f70b GIT binary patch literal 10670 zcmeHtg;yNg^7UYY6D&Bv-Q696yF-w{LU3nr3l^LJ!9%d%L4v!4;O?%$A-Kagx%a&< z?{e?&FL}y4R1mLpj#^h-blryeMpv2A82NKl zsnfC0z060cz}yn8sH)fqt}Hy%qa)yWHM~OIoC&iP`6D?M4%b&Cj;;0+r5*9&FcAr= zX8IpR(AP72LcJZj(DHPycqY8yAT=fexh3tUCRKJ0Ey^!x&cvF`371iH*cB@EUvEfc zcl*Y$vkWRM@%bf4MBkJ^71*+qpm2mBqF1nCpOC)x2eMEsHuTl8BX!P!y^Z&z@ftGL z%W7PW?gRoyV#a6okWW*bPxm={@=C**`t;2Al`at&b z+oYLnvBw_GZxNhB(BCWqmKqK)&WM~#p|=r_&$M`Of8yRIphZvc^2Vgk0Y12caO2AO z&rx6lQ1&I9EN3nviLQ(1(H1kZ#Yk3?j?oAoAUb<|gaN4hMW)r7tQ2Pu?kPYo2?T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n z-%JMOB_q4|fo-+3uWZqQ>2hb(0$5=c!1;;DYGoN+k#BdAOn^`EHpwBTe3wJkmr^X! zFt}UYWX8~-RU*f&9+(F!Zt8J?u71Ab9@b+e-uVD~e&-<`!xZHk8ZY8TvyQl6_4Cf) z*WNOXU~2@!X%AtI`6;u4YdEDnVblpBd-hv0v&Gc%(3{EAR#w4>^|Q|N6HirN=4*r3 z98}8>l@G}OrY{sU6C{QE=RIft{=5Et{f8ZBD)N5?`0H+%e;fX~euik`Kla8vHGH~5 z;J4`jB)~n{FYwg(uYJ|urjQykBzFGaUDl^KPn&JOk${i|@Bh_$dy4Y3e*GKe8q&mr zpggT+KLvQY%Ki>_q+R?*9RA5ppB| literal 0 HcmV?d00001 diff --git a/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs b/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs index a2f27d1..8763068 100644 --- a/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs +++ b/Models/eva_create_evaluation_detail_process/eva_create_evaluation_detail_processService.cs @@ -197,7 +197,8 @@ namespace TodoAPI2.Models m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id, m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id, path, - special_person), + special_person, + m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id), role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief, m_eva_create_evaluation_detail_process.chief, @@ -205,7 +206,8 @@ namespace TodoAPI2.Models m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id, m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id, path, - special_person), + special_person, + m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id), remark_hrm_work_record = fk_external_employee.remark_hrm_work_record + GetWorkTimeText(fk_external_employee.packing_date, end_date), @@ -475,6 +477,7 @@ namespace TodoAPI2.Models status_supervisor1A = m_eva_create_evaluation_detail_process.status_supervisor1A, status_supervisor2A = m_eva_create_evaluation_detail_process.status_supervisor2A, + status_supervisor3A = m_eva_create_evaluation_detail_process.status_supervisor3A, role_code = getRoleCodeSearch(emp_id, m_eva_create_evaluation_detail_process.chief, m_eva_create_evaluation_detail_process.chief, @@ -482,7 +485,8 @@ namespace TodoAPI2.Models m_eva_create_evaluation_detail_process.supervisor1_id.HasValue? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id, m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id, m_eva_create_evaluation_detail_process.status_chief, - special_person + special_person, + m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id ), role_desc = getRoleName(emp_id, m_eva_create_evaluation_detail_process.chief, @@ -491,13 +495,16 @@ namespace TodoAPI2.Models m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id, m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id, path, - special_person), + special_person, + m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id + ), status_self_click_date = m_eva_create_evaluation_detail_process.status_self_click_date, status_chief_click_date = m_eva_create_evaluation_detail_process.status_chief_click_date, status_supervisor_click_date = m_eva_create_evaluation_detail_process.status_supervisor_click_date, status_supervisor1A_click_date = m_eva_create_evaluation_detail_process.status_supervisor1A_click_date, status_supervisor2A_click_date = m_eva_create_evaluation_detail_process.status_supervisor2A_click_date, + status_supervisor3A_click_date = m_eva_create_evaluation_detail_process.status_supervisor3A_click_date, plan_round_year = checkNull(fk_planResult.theTime)+"/"+checkNull(fk_planResult.fiscal_year), @@ -519,7 +526,7 @@ namespace TodoAPI2.Models return ""; } - private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person) + private string getRoleCode(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person, int? supervisor3A) { if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && path == "d2") return "2"; else if (emp_id == chief) return "1"; @@ -527,11 +534,12 @@ namespace TodoAPI2.Models else if (emp_id == supervisor2) return "2"; else if (emp_id == supervisor1A) return "3"; else if (emp_id == supervisor2A) return "4"; + else if (emp_id == supervisor3A) return "5"; if (((int?[])special_person).Contains(emp_id)) return "99"; return ""; } - private string getRoleCodeSearch(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string status_chief, object special_person) + private string getRoleCodeSearch(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string status_chief, object special_person, int? supervisor3A) { if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && status_chief=="Y") return "2"; else if (emp_id == chief) return "1"; @@ -539,11 +547,12 @@ namespace TodoAPI2.Models else if (emp_id == supervisor2) return "2"; else if (emp_id == supervisor1A) return "3"; else if (emp_id == supervisor2A) return "4"; + else if (emp_id == supervisor3A) return "5"; if (((int?[])special_person).Contains(emp_id)) return "99"; return ""; } - private string getRoleName(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person) + private string getRoleName(int? emp_id, int? chief, int? supervisor1, int? supervisor2, int? supervisor1A, int? supervisor2A, string path, object special_person, int? supervisor3A) { if ((emp_id == chief || emp_id == supervisor1) && chief == supervisor2 && path == "d2") return "ผู้ประเมินสูงสุด"; else if (emp_id == chief) return "ผู้ประเมิน"; @@ -551,6 +560,7 @@ namespace TodoAPI2.Models else if (emp_id == supervisor2) return "ผู้ประเมินสูงสุด"; else if (emp_id == supervisor1A) return "ผู้บังคับบัญชาเหนือขึ้นไป"; else if (emp_id == supervisor2A) return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)"; + else if (emp_id == supervisor3A) return "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (พิเศษ)"; if (((int?[])special_person).Contains(emp_id)) return "ผู้ตรวจสอบ"; return ""; } diff --git a/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04Service.cs b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04Service.cs index 94d8e7c..fce4ed7 100644 --- a/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04Service.cs +++ b/Models/eva_create_evaluation_detail_review04/eva_create_evaluation_detail_review04Service.cs @@ -20,14 +20,14 @@ namespace TodoAPI2.Models public class eva_create_evaluation_detail_review04Service : Ieva_create_evaluation_detail_review04Service { private IBaseRepository2 _repository; - private IMyDatabase db; - private Iexternal_linkageService ext; + private IMyDatabase db; + private Iexternal_linkageService ext; public eva_create_evaluation_detail_review04Service(IBaseRepository2 repository, IMyDatabase mydb, Iexternal_linkageService inext) { _repository = repository; - db = mydb; - ext = inext; + db = mydb; + ext = inext; } #region Private Functions @@ -47,7 +47,7 @@ namespace TodoAPI2.Models { return Mapper.Map>(entities); } - + #endregion #region Public Functions @@ -79,12 +79,12 @@ namespace TodoAPI2.Models public List GetListBycreate_evaluation_id(int? create_evaluation_id) { - var model = new eva_create_evaluation_detail_review04SearchModel(); + var model = new eva_create_evaluation_detail_review04SearchModel(); model.create_evaluation_id = create_evaluation_id; return GetListBySearch(model); } - public List GetListBySearch(eva_create_evaluation_detail_review04SearchModel model) + public List GetListBySearch(eva_create_evaluation_detail_review04SearchModel model) { var data = ( from m_eva_create_evaluation_detail_review04 in _repository.Context.eva_create_evaluation_detail @@ -94,7 +94,7 @@ namespace TodoAPI2.Models from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty() - where 1==1 + where 1 == 1 //&& (m_eva_create_evaluation_detail_review04.id == model.id || !model.id.HasValue) && (m_eva_create_evaluation_detail_review04.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue) @@ -129,10 +129,10 @@ namespace TodoAPI2.Models int? newkey = 0; var x = (from i in _repository.Context.eva_create_evaluation_detail - orderby i.id descending - select i).Take(1).ToList(); + orderby i.id descending + select i).Take(1).ToList(); - if(x.Count > 0) + if (x.Count > 0) { newkey = x[0].id + 1; } @@ -148,7 +148,7 @@ namespace TodoAPI2.Models var inserted = _repository.Insert(entity); - + return Get(inserted.id); } @@ -168,23 +168,23 @@ namespace TodoAPI2.Models return Get(updated.id); } else - throw new NotificationException("No data to update"); + throw new NotificationException("No data to update"); } - public string UpdateMultiple(List model) + public string UpdateMultiple(List model) { - foreach(var i in model) + foreach (var i in model) { if (i.active_mode == "1" && i.id.HasValue) // update - { + { var existingEntity = _repository.Get(i.id.Value); if (existingEntity != null) { - existingEntity.create_evaluation_id = i.create_evaluation_id; - existingEntity.supervisor2A = i.supervisor2A; - existingEntity.supervisor2A_result = i.supervisor2A_result; - existingEntity.supervisor2A_remark = i.supervisor2A_remark; - existingEntity.supervisor2A_date = i.supervisor2A_date; + existingEntity.create_evaluation_id = i.create_evaluation_id; + existingEntity.supervisor2A = i.supervisor2A; + existingEntity.supervisor2A_result = i.supervisor2A_result; + existingEntity.supervisor2A_remark = i.supervisor2A_remark; + existingEntity.supervisor2A_date = i.supervisor2A_date; _repository.UpdateWithoutCommit(i.id.Value, existingEntity); @@ -197,15 +197,15 @@ namespace TodoAPI2.Models _repository.InsertWithoutCommit(entity); } else if (i.active_mode == "0" && i.id.HasValue) // remove - { + { _repository.DeleteWithoutCommit(i.id.Value); } else if (i.active_mode == "0" && !i.id.HasValue) { // nothing to do - } + } } - _repository.Context.SaveChanges(); + _repository.Context.SaveChanges(); return model.Count().ToString(); } diff --git a/Models/eva_create_evaluation_detail_review05/Ieva_create_evaluation_detail_review05Service.cs b/Models/eva_create_evaluation_detail_review05/Ieva_create_evaluation_detail_review05Service.cs new file mode 100644 index 0000000..2132d25 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review05/Ieva_create_evaluation_detail_review05Service.cs @@ -0,0 +1,32 @@ +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; + +namespace TodoAPI2.Models +{ + public interface Ieva_create_evaluation_detail_review05Service : IBaseService2 + { + new eva_create_evaluation_detail_review05ViewModel Insert(eva_create_evaluation_detail_review05InputModel model, bool is_force_save); + new eva_create_evaluation_detail_review05ViewModel Update(int id, eva_create_evaluation_detail_review05InputModel model, bool is_force_save); + List GetListBycreate_evaluation_id(int? create_evaluation_id); + List GetListBySearch(eva_create_evaluation_detail_review05SearchModel model); + + string UpdateMultiple(List model, bool is_force_save); + eva_create_evaluation_detail_review05WithSelectionViewModel GetWithSelection(int id); + eva_create_evaluation_detail_review05WithSelectionViewModel GetBlankItem(); + + void RefreshAutoFieldOfAllData(); + eva_create_evaluation_detailEntity GetEntity(int id); + DataContext GetContext(); + + + + } +} + diff --git a/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05InputModel.cs b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05InputModel.cs new file mode 100644 index 0000000..10bfdb9 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05InputModel.cs @@ -0,0 +1,32 @@ +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 eva_create_evaluation_detail_review05InputModel + { + + public int? id { get; set; } + + public int? create_evaluation_id { get; set; } + + public int? supervisor3A { get; set; } + + public string supervisor3A_result { get; set; } + + public string supervisor3A_remark { get; set; } + + public DateTime? supervisor3A_date { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05ReportRequestModel.cs b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05ReportRequestModel.cs new file mode 100644 index 0000000..b09f758 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05ReportRequestModel.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 eva_create_evaluation_detail_review05ReportRequestModel : eva_create_evaluation_detail_review05SearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05SearchModel.cs b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05SearchModel.cs new file mode 100644 index 0000000..eb7b0b8 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05SearchModel.cs @@ -0,0 +1,23 @@ +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 eva_create_evaluation_detail_review05SearchModel + { + + public int id { get; set; } + + public int? create_evaluation_id { get; set; } + + } +} + diff --git a/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05Service.cs b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05Service.cs new file mode 100644 index 0000000..b3793b8 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05Service.cs @@ -0,0 +1,307 @@ +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 eva_create_evaluation_detail_review05Service : Ieva_create_evaluation_detail_review05Service + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + + public eva_create_evaluation_detail_review05Service(IBaseRepository2 repository, IMyDatabase mydb, Iexternal_linkageService inext) + { + _repository = repository; + db = mydb; + ext = inext; + } + + #region Private Functions + private eva_create_evaluation_detailEntity GetEntity(eva_create_evaluation_detail_review05InputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_create_evaluation_detail_review05ViewModel GetDto(eva_create_evaluation_detailEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public eva_create_evaluation_detail_review05ViewModel Get(int id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + + public eva_create_evaluation_detailEntity GetEntity(int id) + { + var entity = _repository.Get(id); + + return entity; + } + + public DataContext GetContext() + { + return _repository.Context; + } + + public eva_create_evaluation_detail_review05WithSelectionViewModel GetWithSelection(int id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + i.item_supervisor3A_result = (from x in ext.GetAgreeDisagree() select x).ToList(); + + + return i; + } + public eva_create_evaluation_detail_review05WithSelectionViewModel GetBlankItem() + { + var i = new eva_create_evaluation_detail_review05WithSelectionViewModel(); + i.item_supervisor3A_result = (from x in ext.GetAgreeDisagree() select x).ToList(); + + + return i; + } + + public List GetListBycreate_evaluation_id(int? create_evaluation_id) + { + var model = new eva_create_evaluation_detail_review05SearchModel(); + model.create_evaluation_id = create_evaluation_id; + return GetListBySearch(model); + } + + public List GetListBySearch(eva_create_evaluation_detail_review05SearchModel model) + { + var data = ( + from m_eva_create_evaluation_detail_review05 in _repository.Context.eva_create_evaluation_detail + + join fk_external_linkage3 in ext.GetAgreeDisagree() on m_eva_create_evaluation_detail_review05.supervisor3A_result equals fk_external_linkage3.external_code + into external_linkageResult3 + from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty() + + + where + 1 == 1 + && (!model.create_evaluation_id.HasValue || m_eva_create_evaluation_detail_review05.create_evaluation_id == model.create_evaluation_id) + + + orderby m_eva_create_evaluation_detail_review05.created descending + select new eva_create_evaluation_detail_review05ViewModel() + { + id = m_eva_create_evaluation_detail_review05.id, + create_evaluation_id = m_eva_create_evaluation_detail_review05.create_evaluation_id, + supervisor3A = m_eva_create_evaluation_detail_review05.supervisor3A, + supervisor3A_result = m_eva_create_evaluation_detail_review05.supervisor3A_result, + supervisor3A_remark = m_eva_create_evaluation_detail_review05.supervisor3A_remark, + supervisor3A_date = m_eva_create_evaluation_detail_review05.supervisor3A_date, + + supervisor3A_result_external_linkage_external_name = fk_external_linkageResult3.external_name, + + isActive = m_eva_create_evaluation_detail_review05.isActive, + Created = m_eva_create_evaluation_detail_review05.created, + Updated = m_eva_create_evaluation_detail_review05.updated + } + ).Take(1000).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + + public int GetNewPrimaryKey() + { + int? newkey = 0; + + var x = (from i in _repository.Context.eva_create_evaluation_detail + orderby i.id descending + select i).Take(1).ToList(); + + if (x.Count > 0) + { + newkey = x[0].id + 1; + } + + return newkey.Value; + } + + + public eva_create_evaluation_detail_review05ViewModel Insert(eva_create_evaluation_detail_review05InputModel model, bool is_force_save) + { + var entity = GetEntity(model); + entity.id = GetNewPrimaryKey(); + + + //entity.SetAutoField(_repository.Context); + + if (is_force_save) + { + var inserted = _repository.Insert(entity); + //entity.DoAfterInsertUpdate(_repository.Context); + return Get(inserted.id); + } + else + { + _repository.InsertWithoutCommit(entity); + //entity.DoAfterInsertUpdate(_repository.Context); + return Mapper.Map(entity); + } + } + + public eva_create_evaluation_detail_review05ViewModel Update(int id, eva_create_evaluation_detail_review05InputModel model, bool is_force_save) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + existingEntity.create_evaluation_id = model.create_evaluation_id; + existingEntity.supervisor3A = model.supervisor3A; + existingEntity.supervisor3A_result = model.supervisor3A_result; + existingEntity.supervisor3A_remark = model.supervisor3A_remark; + existingEntity.supervisor3A_date = model.supervisor3A_date; + + //existingEntity.SetAutoField(_repository.Context); + + if (is_force_save) + { + var updated = _repository.Update(id, existingEntity); + //existingEntity.DoAfterInsertUpdate(_repository.Context); + return Get(updated.id); + } + else + { + _repository.UpdateWithoutCommit(id, existingEntity); + //existingEntity.DoAfterInsertUpdate(_repository.Context); + return Mapper.Map(existingEntity); + } + } + else + throw new NotificationException("No data to update"); + } + + public string UpdateMultiple(List model, bool is_force_save) + { + foreach (var i in model) + { + if (i.active_mode == "1" && i.id.HasValue) // update + { + var existingEntity = _repository.Get(i.id.Value); + if (existingEntity != null) + { + existingEntity.create_evaluation_id = i.create_evaluation_id; + existingEntity.supervisor3A = i.supervisor3A; + existingEntity.supervisor3A_result = i.supervisor3A_result; + existingEntity.supervisor3A_remark = i.supervisor3A_remark; + existingEntity.supervisor3A_date = i.supervisor3A_date; + + //existingEntity.SetAutoField(_repository.Context); + _repository.UpdateWithoutCommit(i.id.Value, existingEntity); + } + } + else if (i.active_mode == "1" && !i.id.HasValue) // add + { + var entity = GetEntity(i); + entity.id = GetNewPrimaryKey(); + //entity.SetAutoField(_repository.Context); + _repository.InsertWithoutCommit(entity); + } + else if (i.active_mode == "0" && i.id.HasValue) // remove + { + _repository.DeleteWithoutCommit(i.id.Value); + } + else if (i.active_mode == "0" && !i.id.HasValue) + { + // nothing to do + } + } + if (is_force_save) + { + _repository.Context.SaveChanges(); + } + + return model.Count().ToString(); + } + + public eva_create_evaluation_detail_review05ViewModel SetAsActive(int id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public eva_create_evaluation_detail_review05ViewModel SetAsInactive(int id) + { + var updated = _repository.SetAsInActive(id); + + return Get(updated.id); + } + public void Delete(int id) + { + _repository.Delete(id); + + return; + } + + public void RefreshAutoFieldOfAllData() + { + //var all_items = from i in _repository.Context.eva_create_evaluation_detail + // select i; + //foreach (var item in all_items) + //{ + // item.SetAutoField(_repository.Context); + //} + //_repository.Context.SaveChanges(); + } + + private Dictionary GetLookupForLog() + { + var i = new Dictionary(); + + + i.Add("create_evaluation_id", "แบบประเมิน"); + i.Add("supervisor3A", "ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)"); + i.Add("supervisor3A_result", "ผลการประเมิน"); + i.Add("supervisor3A_result_external_linkage_external_name", "ผลการประเมิน"); + i.Add("supervisor3A_remark", "ความเห็นผู้ประเมินสูงสุด"); + i.Add("supervisor3A_date", "วันที่ประเมิน"); + i.Add("txt_supervisor3A_date", "วันที่ประเมิน"); + + return i; + } + + #endregion + + #region Match Item + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05ViewModel.cs b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05ViewModel.cs new file mode 100644 index 0000000..4c48c81 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05ViewModel.cs @@ -0,0 +1,32 @@ +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 eva_create_evaluation_detail_review05ViewModel : BaseViewModel2 + { + + public int? create_evaluation_id { get; set; } + + public int? supervisor3A { get; set; } + + public string supervisor3A_result { get; set; } + + public string supervisor3A_remark { get; set; } + + public DateTime? supervisor3A_date { get; set; } + + public string txt_supervisor3A_date { get { return MyHelper.GetDateStringForReport(this.supervisor3A_date); } } + + public string supervisor3A_result_external_linkage_external_name { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05WithSelectionViewModel.cs b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05WithSelectionViewModel.cs new file mode 100644 index 0000000..66a9747 --- /dev/null +++ b/Models/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05WithSelectionViewModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class eva_create_evaluation_detail_review05WithSelectionViewModel: eva_create_evaluation_detail_review05ViewModel + { + public List item_supervisor3A_result { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs index 26fdbc2..89f18ed 100644 --- a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs +++ b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs @@ -350,6 +350,24 @@ namespace TodoAPI2.Models noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString(); add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด)", model.employee_id, existingEntity.id, 2); } + else if (model.status_mode == "next5") + { + existingEntity.status_supervisor3A_click_date = DateTime.Now; + + noti_to_employee_id2 = owner_eva_employee_id; + noti_message2 = "แบบประเมินของ {0} ได้รับการประเมินเรียบร้อยแล้ว"; + noti_url2 = "/eva/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (พิเศษ) อนุมัติแบบประเมินแล้ว", model.employee_id, existingEntity.id, 2); + } + else if (model.status_mode == "back5") + { + existingEntity.status_supervisor3A_click_date = DateTime.Now; + existingEntity.status_supervisor2A_click_date = null; + noti_to_employee_id = current_eva.supervisor2_id; + noti_message = "แบบประเมินของ {0} ถูกตีกลับ"; + noti_url = "/eva/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d2?id=" + existingEntity.id.ToString(); + add_history(DateTime.Now, "แบบประเมินถูกตีกลับ โดย ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (พิเศษ)", model.employee_id, existingEntity.id, 2); + } if (need_noti) { diff --git a/Startup.cs b/Startup.cs index 1f47a9f..52a3ccf 100644 --- a/Startup.cs +++ b/Startup.cs @@ -271,6 +271,8 @@ namespace Test01 services.AddScoped(); + services.AddScoped(); + services.AddScoped(); services.AddScoped(); @@ -542,6 +544,10 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); diff --git a/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml b/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml index c99e51d..7b76146 100644 --- a/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml +++ b/Views/eva_create_evaluation_detail_processView/eva_create_evaluation_detail_process_d2.cshtml @@ -589,7 +589,7 @@

- + @@ -599,6 +599,57 @@ +
+ +
+
ความเห็น ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (พิเศษ)
+
+
+ +
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ +
+
+ + + + + + + +
+
+ +
+ @section FooterPlaceHolder{ @@ -610,6 +661,7 @@ + @@ -623,6 +675,7 @@ eva_create_evaluation_detail_review02_SetEditForm(id); eva_create_evaluation_detail_review03_SetEditForm(id); eva_create_evaluation_detail_review04_SetEditForm(id); + eva_create_evaluation_detail_review05_SetEditForm(id); eva_create_evaluation_detail_status_SetEditForm(id); eva_idp_plan_InitiateDataTable(id); @@ -638,6 +691,7 @@ SetupValidationRemark("eva_create_evaluation_detail_review02"); SetupValidationRemark("eva_create_evaluation_detail_review03"); SetupValidationRemark("eva_create_evaluation_detail_review04"); + SetupValidationRemark("eva_create_evaluation_detail_review05"); SetupValidationRemark("eva_idp_plan"); }); @@ -680,6 +734,17 @@ } } + function Oneva_create_evaluation_detail_review05_supervisor3A_resultChanged(a) { + if ($(a).val() == "Y") { + $("#eva_create_evaluation_detail_review05_supervisor3A_remark").attr("iRequire", "false"); + $("#eva_create_evaluation_detail_review05_supervisor3A_remark").css('border-color', ''); + $("#review05x").hide(); + } else { + $("#eva_create_evaluation_detail_review05_supervisor3A_remark").attr("iRequire", "true"); + $("#review05x").show(); + } + } + function searchVacation_GetFromForm() { var searchVacationObject = new Object(); searchVacationObject.start_date = formatDateForGetParameter(getDate($("#date_from").val())); @@ -751,6 +816,14 @@ }, 2000); } + function savereview05() { + saveAll(); + setTimeout(function () { + eva_create_evaluation_detail_review05_PutUpdate(true); + endLoad(); + }, 2000); + } + function saveStatus(s) { if (s === "next2" || s === "back2") { if (!ValidateForm('eva_create_evaluation_detail_review02', eva_create_evaluation_detail_review02_customValidation)) { @@ -785,6 +858,17 @@ eva_create_evaluation_detail_status_PutUpdate(s); }, 2000); } + else if (s === "next5") { + if (!ValidateForm('eva_create_evaluation_detail_review05', eva_create_evaluation_detail_review05_customValidation)) { + return; + } + startLoad(); + saveAll(); + eva_create_evaluation_detail_review05_PutUpdate(false); + setTimeout(function () { + eva_create_evaluation_detail_status_PutUpdate(s); + }, 2000); + } } function saveAll() { diff --git a/tb320eva.xml b/tb320eva.xml index 6d592d5..b7f7826 100644 --- a/tb320eva.xml +++ b/tb320eva.xml @@ -1756,6 +1756,114 @@ If the model is invalid Error Occurred + + + Default constructure for dependency injection + + + + + + + + Get specific item by id + + + + Return Get specific item by id + Returns the item + Error Occurred + + + + Get Blank Item + + + + Return a blank item + Returns the item + Error Occurred + + + + Get list items by create_evaluation_id + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Get list items by search + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Create new item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update item + + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Delete item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update multiple item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Refresh AutoField of all items + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + Default constructure for dependency injection diff --git a/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d2.js b/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d2.js index f054b9a..bc5fb61 100644 --- a/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d2.js +++ b/wwwroot/js/eva_create_evaluation_detail_process/eva_create_evaluation_detail_process_d2.js @@ -217,6 +217,13 @@ function setPageByRoleAndStatus(role_code, status_self, status_chief, status_sup $("#btnd02").hide(); $("#btnd03").hide(); + $("#eva_create_evaluation_detail_review05_supervisor3A_result").attr("disabled", true); + //$("#eva_create_evaluation_detail_review05_supervisor3A_date").attr("disabled", true); + $("#eva_create_evaluation_detail_review05_supervisor3A_remark").attr("disabled", true); + $("#btne01").hide(); + $("#btne02").hide(); + $("#btne03").hide(); + setViewOfComment(status_supervisor, status_supervisor1A, status_supervisor2A); if (role_code === "2") { // ความเห็น ความเห็นผู้ประเมินสูงสุด @@ -300,6 +307,34 @@ function setPageByRoleAndStatus(role_code, status_self, status_chief, status_sup $(".myeditor").attr("disabled", true); } } + + else if (role_code === "5") { // ความเห็น ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (พิเศษ) + + $("#eva_create_evaluation_detail_review05_supervisor3A_result").show(); + + if (status_supervisor1A === "Y" && status_supervisor === "Y" && status_chief === "Y" && status_self === "Y") { + $("#eva_create_evaluation_detail_review05_supervisor3A_result").attr("disabled", false); + //$("#eva_create_evaluation_detail_review05_supervisor3A_date").attr("disabled", false); + $("#eva_create_evaluation_detail_review05_supervisor3A_remark").attr("disabled", false); + $("#btne01").show(); + $("#btne02").show(); + //$("#btne03").show(); + $(".myeditor").attr("disabled", false); + } else { + $("#thestatus3A").text("(ผู้รับการประเมิน หรือ ผู้ประเมิน หรือ ผู้ประเมินสูงสุด หรือ ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง หรือ ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (สูงสุด) ยังไม่ส่งแบบประเมิน คุณจึงไม่สามารถให้ความเห็นได้)"); + } + if (status_supervisor3A === "Y") { + $("#eva_create_evaluation_detail_review05_supervisor3A_result").attr("disabled", true); + //$("#eva_create_evaluation_detail_review05_supervisor3A_date").attr("disabled", true); + $("#eva_create_evaluation_detail_review05_supervisor3A_remark").attr("disabled", true); + $("#btne01").hide(); + $("#btne02").hide(); + $("#btne03").hide(); + $("#thestatus3A").text("(ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง (พิเศษ) ส่งแบบประเมินแล้ว)"); + $(".myeditor").attr("disabled", true); + } + } + else if (role_code === "99") { // ผู้ตรวจสอบ diff --git a/wwwroot/js/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05_d.js b/wwwroot/js/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05_d.js new file mode 100644 index 0000000..09d0f5b --- /dev/null +++ b/wwwroot/js/eva_create_evaluation_detail_review05/eva_create_evaluation_detail_review05_d.js @@ -0,0 +1,106 @@ +var eva_create_evaluation_detail_review05_editMode = "CREATE"; +var eva_create_evaluation_detail_review05_API = "/api/eva_create_evaluation_detail_review05/"; + +//================= Form Data Customizaiton ========================================= + +function eva_create_evaluation_detail_review05_FeedDataToForm(data) { +$("#eva_create_evaluation_detail_review05_id").val(data.id); +$("#eva_create_evaluation_detail_review05_create_evaluation_id").val(data.create_evaluation_id); +$("#eva_create_evaluation_detail_review05_supervisor3A").val(data.supervisor3A); +DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_review05_supervisor3A_result"), data, "id", "external_name", "item_supervisor3A_result", data.supervisor3A_result); +$("#eva_create_evaluation_detail_review05_supervisor3A_remark").val(data.supervisor3A_remark); +$("#eva_create_evaluation_detail_review05_supervisor3A_date").val(formatDate(data.supervisor3A_date)); + +} + +function eva_create_evaluation_detail_review05_GetFromForm() { + var eva_create_evaluation_detail_review05Object = new Object(); +eva_create_evaluation_detail_review05Object.id = $("#eva_create_evaluation_detail_review05_id").val(); +eva_create_evaluation_detail_review05Object.create_evaluation_id = $("#eva_create_evaluation_detail_review05_create_evaluation_id").val(); +eva_create_evaluation_detail_review05Object.supervisor3A = $("#eva_create_evaluation_detail_review05_supervisor3A").val(); +eva_create_evaluation_detail_review05Object.supervisor3A_result = $("#eva_create_evaluation_detail_review05_supervisor3A_result").val(); +eva_create_evaluation_detail_review05Object.supervisor3A_remark = $("#eva_create_evaluation_detail_review05_supervisor3A_remark").val(); +eva_create_evaluation_detail_review05Object.supervisor3A_date = getDate($("#eva_create_evaluation_detail_review05_supervisor3A_date").val()); + + + return eva_create_evaluation_detail_review05Object; +} + +function eva_create_evaluation_detail_review05_InitialForm() { + var successFunc = function (result) { + eva_create_evaluation_detail_review05_FeedDataToForm(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_create_evaluation_detail_review05_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Form Mode Setup and Flow ========================================= + +function eva_create_evaluation_detail_review05_SetEditForm(a) { + var successFunc = function (result) { + eva_create_evaluation_detail_review05_editMode = "UPDATE"; + eva_create_evaluation_detail_review05_FeedDataToForm(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_create_evaluation_detail_review05_API + a, successFunc, AlertDanger); +} + +function eva_create_evaluation_detail_review05_SetCreateForm() { + eva_create_evaluation_detail_review05_editMode = "CREATE"; + eva_create_evaluation_detail_review05_InitialForm(); +} + +//================= Update and Delete ========================================= + +var eva_create_evaluation_detail_review05_customValidation = function (group) { + return ""; +}; + +function eva_create_evaluation_detail_review05_PutUpdate() { + if (!ValidateForm('eva_create_evaluation_detail_review05', eva_create_evaluation_detail_review05_customValidation)) + { + return; + } + var data = eva_create_evaluation_detail_review05_GetFromForm(); + + //Update Mode + if (eva_create_evaluation_detail_review05_editMode === "UPDATE") { + var successFunc1 = function (result) { + AlertSuccess(result.code+" "+result.message); + endLoad(); + }; + startLoad(); + AjaxPutRequest(apisite + eva_create_evaluation_detail_review05_API + data.id, data, successFunc1, AlertDanger); + } + // Create mode + else { + var successFunc2 = function (result) { + AlertSuccess(result.code+" "+result.message); + endLoad(); + }; + startLoad(); + AjaxPostRequest(apisite + eva_create_evaluation_detail_review05_API, data, successFunc2, AlertDanger); + } +} + +function eva_create_evaluation_detail_review05_GoDelete(a) { + if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) { + var successFunc = function (result) { + AlertSuccess(result.code+" "+result.message); + eva_create_evaluation_detail_review05_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxDeleteRequest(apisite + eva_create_evaluation_detail_review05_API + a, null, successFunc, AlertDanger); + } +} + +//================= File Upload ========================================= + + + +//================= Multi-Selection Function ========================================= + +