From bfb9c80face77f46570119776bf49cc8b8b46f3d Mon Sep 17 00:00:00 2001 From: nakorn Date: Tue, 3 May 2022 15:27:30 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B8=E0=B8=87=20=E0=B8=A5=E0=B8=B3=E0=B8=94?= =?UTF-8?q?=E0=B8=B1=E0=B8=9A=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=AD=E0=B8=99?= =?UTF-8?q?=E0=B8=B8=E0=B8=A1=E0=B8=B1=E0=B8=95=E0=B8=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...st_quota_update_final_statusControllers.cs | 275 ++++ ...a_adjust_quota_update_statusControllers.cs | 1 + ...0220502040427_AddFinalApprover.Designer.cs | 1270 +++++++++++++++++ Migrations/20220502040427_AddFinalApprover.cs | 62 + Migrations/DataContextModelSnapshot.cs | 13 + .../eva_adjust_postponement_quotaService.cs | 2 + .../eva_adjust_postponement_quotaViewModel.cs | 2 + ...adjust_quota_update_final_statusService.cs | 25 + ...ust_quota_update_final_statusInputModel.cs | 30 + ...a_update_final_statusReportRequestModel.cs | 21 + ...st_quota_update_final_statusSearchModel.cs | 23 + ...adjust_quota_update_final_statusService.cs | 237 +++ ...just_quota_update_final_statusViewModel.cs | 31 + ...date_final_statusWithSelectionViewModel.cs | 14 + .../eva_adjust_quota_update_statusService.cs | 7 + .../Iexternal_linkageService.cs | 1 + .../external_linkageService.cs | 27 +- Startup.cs | 6 + .../eva_adjust_postponement_quota_d.cshtml | 74 +- ...va_adjust_quota_update_final_status.cshtml | 118 ++ .../eva_adjust_quota_update_status.cshtml | 7 + tb320eva.csproj | 2 + tb320eva.xml | 73 + ...ust_postponement_detail_quota_02_inline.js | 4 +- .../eva_adjust_postponement_quota_d.js | 10 + .../eva_adjust_quota_update_final_status.js | 267 ++++ .../eva_adjust_quota_update_status.js | 16 +- 27 files changed, 2608 insertions(+), 10 deletions(-) create mode 100644 ApiControllers/eva_adjust_quota_update_final_statusControllers.cs create mode 100644 Migrations/20220502040427_AddFinalApprover.Designer.cs create mode 100644 Migrations/20220502040427_AddFinalApprover.cs create mode 100644 Models/eva_adjust_quota_update_final_status/Ieva_adjust_quota_update_final_statusService.cs create mode 100644 Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusInputModel.cs create mode 100644 Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusReportRequestModel.cs create mode 100644 Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusSearchModel.cs create mode 100644 Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusService.cs create mode 100644 Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusViewModel.cs create mode 100644 Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusWithSelectionViewModel.cs create mode 100644 Views/eva_adjust_quota_update_final_statusView/eva_adjust_quota_update_final_status.cshtml create mode 100644 wwwroot/js/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_status.js diff --git a/ApiControllers/eva_adjust_quota_update_final_statusControllers.cs b/ApiControllers/eva_adjust_quota_update_final_statusControllers.cs new file mode 100644 index 0000000..b933210 --- /dev/null +++ b/ApiControllers/eva_adjust_quota_update_final_statusControllers.cs @@ -0,0 +1,275 @@ +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_adjust_quota_update_final_status")] + public class eva_adjust_quota_update_final_statusController : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_adjust_quota_update_final_statusService _repository; + private Iexternal_employeeService emp; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + /// + public eva_adjust_quota_update_final_statusController(ILogger logger, + Ieva_adjust_quota_update_final_statusService repository, IConfiguration configuration, + Iexternal_employeeService inemp) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + emp = inemp; + } + + /// + /// Get specific item by id + /// + /// + /// + /// Return Get specific item by id + /// Returns the item + /// Error Occurred + [HttpGet("{id}")] + [ProducesResponseType(typeof(eva_adjust_quota_update_final_statusWithSelectionViewModel), 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_adjust_quota_update_final_statusWithSelectionViewModel), 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 quota_final_status_note + /// + /// + /// + /// 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(string quota_final_status_note) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListByquota_final_status_note(quota_final_status_note)); + } + 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_adjust_quota_update_final_statusSearchModel 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}"); + } + } + + /// + /// Download Report + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("eva_adjust_quota_update_final_status_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult eva_adjust_quota_update_final_status_report(eva_adjust_quota_update_final_statusReportRequestModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var httpclient = new WebClient(); + string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL"); + string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite"); + string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username"); + string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password"); + + string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}"; + + if (model.filetype == "xlsx") + { + url += "&ignorePagination=true"; + } + + var data = httpclient.DownloadData(url); + var stream = new MemoryStream(data); + + return File(stream, model.contentType); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while GetReport.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + + + /// + /// 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_adjust_quota_update_final_statusInputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + + int? e = null; + + if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"])) + { + var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]); + var theEmp = emp.GetEmployeeForLogin(Convert.ToInt32(loginid)); + if (theEmp != null) + { + e = theEmp.id; + } + else + { + return Unauthorized(); + } + } + else + { + return Unauthorized(); + } + + var result = _repository.Update(id, model, true, e); + 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); + } + + + } +} diff --git a/ApiControllers/eva_adjust_quota_update_statusControllers.cs b/ApiControllers/eva_adjust_quota_update_statusControllers.cs index 9ae1d8a..8ae0ff6 100644 --- a/ApiControllers/eva_adjust_quota_update_statusControllers.cs +++ b/ApiControllers/eva_adjust_quota_update_statusControllers.cs @@ -41,6 +41,7 @@ namespace TodoAPI2.Controllers /// /// /// + /// public eva_adjust_quota_update_statusController(ILogger logger, Ieva_adjust_quota_update_statusService repository, IConfiguration configuration, Iexternal_employeeService inemp) diff --git a/Migrations/20220502040427_AddFinalApprover.Designer.cs b/Migrations/20220502040427_AddFinalApprover.Designer.cs new file mode 100644 index 0000000..bac1eeb --- /dev/null +++ b/Migrations/20220502040427_AddFinalApprover.Designer.cs @@ -0,0 +1,1270 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using TTSW.EF; + +namespace tb320eva.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20220502040427_AddFinalApprover")] + partial class AddFinalApprover + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) + .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("TodoAPI2.Models.activity_log_evaEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("causer_id"); + + b.Property("causer_type") + .HasMaxLength(191); + + b.Property("created_at"); + + b.Property("description") + .HasMaxLength(32000); + + b.Property("ip_address") + .HasMaxLength(191); + + b.Property("log_name") + .HasMaxLength(191); + + b.Property("mac_address") + .HasMaxLength(191); + + b.Property("properties") + .HasMaxLength(32000); + + b.Property("subject_id"); + + b.Property("subject_type") + .HasMaxLength(191); + + b.Property("updated_at"); + + b.HasKey("id"); + + b.ToTable("activity_log_eva"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b => + { + b.Property("id"); + + b.Property("command_no") + .HasMaxLength(4000); + + b.Property("create_evaluation_id"); + + b.Property("created"); + + b.Property("fiscal_year"); + + b.Property("imported_date"); + + b.Property("imported_file") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("limit"); + + b.Property("limit_frame"); + + b.Property("limit_frame_quota"); + + b.Property("limit_quota"); + + b.Property("managed_by"); + + b.Property("percentage"); + + b.Property("postponement_status") + .HasMaxLength(5); + + b.Property("postponement_status_by") + .HasMaxLength(255); + + b.Property("postponement_status_date"); + + b.Property("postponement_status_note") + .HasMaxLength(1000); + + b.Property("quota_final_status") + .HasMaxLength(5); + + b.Property("quota_final_status_by") + .HasMaxLength(255); + + b.Property("quota_final_status_date"); + + b.Property("quota_final_status_note") + .HasMaxLength(1000); + + b.Property("quota_status") + .HasMaxLength(5); + + b.Property("quota_status_by") + .HasMaxLength(255); + + b.Property("quota_status_date"); + + b.Property("quota_status_note") + .HasMaxLength(1000); + + b.Property("quota_status_submit_to"); + + b.Property("report_type") + .HasMaxLength(1000); + + b.Property("theDate"); + + b.Property("theRound"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_id"); + + b.ToTable("eva_adjust_postponement"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b => + { + b.Property("id"); + + b.Property("achievement_final"); + + b.Property("adjust_postponement_id"); + + b.Property("adjust_postponement_quota_id"); + + b.Property("competency_final"); + + b.Property("cost_living"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("employee_no_at_this_time") + .HasMaxLength(1000); + + b.Property("fullname_at_this_time") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("is_for_postponement"); + + b.Property("level_score_final") + .HasMaxLength(255); + + b.Property("level_this_time") + .HasMaxLength(1000); + + b.Property("middle"); + + b.Property("migration_eva_result") + .HasMaxLength(1000); + + b.Property("migration_total_score"); + + b.Property("new_cost_living"); + + b.Property("new_sarary"); + + b.Property("new_sarary_with_quota"); + + b.Property("order_at_this_time"); + + b.Property("org_at_this_time"); + + b.Property("other_money_at_this_time"); + + b.Property("position_allowance_at_this_time"); + + b.Property("position_this_time") + .HasMaxLength(1000); + + b.Property("promoted_percentage"); + + b.Property("receive_quota"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("reward_new"); + + b.Property("reward_new2"); + + b.Property("reward_old"); + + b.Property("sarary"); + + b.Property("score_final"); + + b.Property("total_promote"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("adjust_postponement_id"); + + b.HasIndex("adjust_postponement_quota_id"); + + b.ToTable("eva_adjust_postponement_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("evaluation_group_id"); + + b.Property("isActive"); + + b.Property("performance_plan_id"); + + b.Property("score1"); + + b.Property("score2"); + + b.Property("supervisor1_id"); + + b.Property("supervisor2_id"); + + b.Property("supervisor3_id"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("evaluation_group_id"); + + b.HasIndex("performance_plan_id"); + + b.ToTable("eva_create_evaluation"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b => + { + b.Property("id"); + + b.Property("Final_summary_chief"); + + b.Property("Final_summary_competency_chief"); + + b.Property("Final_summary_competency_supervisor"); + + b.Property("Final_summary_competency_supervisor1A"); + + b.Property("Final_summary_competency_supervisor2A"); + + b.Property("Final_summary_competency_supervisor3A"); + + b.Property("Final_summary_supervisor"); + + b.Property("Final_summary_supervisor1A"); + + b.Property("Final_summary_supervisor2A"); + + b.Property("Final_summary_supervisor3A"); + + b.Property("achievement_chief"); + + b.Property("achievement_supervisor"); + + b.Property("achievement_supervisor1A"); + + b.Property("achievement_supervisor2A"); + + b.Property("achievement_supervisor3A"); + + b.Property("chief"); + + b.Property("chief_a"); + + b.Property("chief_a_date"); + + b.Property("chief_a_reject_reason") + .HasMaxLength(1000); + + b.Property("chief_a_remark") + .HasMaxLength(1000); + + b.Property("chief_a_result") + .HasMaxLength(1); + + b.Property("competency_chief"); + + b.Property("competency_supervisor"); + + b.Property("competency_supervisor1A"); + + b.Property("competency_supervisor2A"); + + b.Property("competency_supervisor3A"); + + b.Property("create_evaluation_id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("eva_employee_id"); + + b.Property("help_org_id"); + + b.Property("isActive"); + + b.Property("level_score_chief") + .HasMaxLength(255); + + b.Property("level_score_supervisor") + .HasMaxLength(255); + + b.Property("level_score_supervisor1A") + .HasMaxLength(255); + + b.Property("level_score_supervisor2A") + .HasMaxLength(255); + + b.Property("level_score_supervisor3A") + .HasMaxLength(255); + + b.Property("order_of_data"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("score_chief"); + + b.Property("score_supervisor"); + + b.Property("score_supervisor1A"); + + b.Property("score_supervisor2A"); + + b.Property("score_supervisor3A"); + + b.Property("status_chief") + .HasMaxLength(1); + + b.Property("status_chief_a") + .HasMaxLength(1); + + b.Property("status_chief_a_click_date"); + + b.Property("status_chief_click_date"); + + b.Property("status_self") + .HasMaxLength(1); + + b.Property("status_self_a") + .HasMaxLength(1); + + b.Property("status_self_a_click_date"); + + b.Property("status_self_click_date"); + + b.Property("status_supervisor") + .HasMaxLength(1); + + b.Property("status_supervisor1A") + .HasMaxLength(1); + + b.Property("status_supervisor1A_click_date"); + + b.Property("status_supervisor2A") + .HasMaxLength(1); + + b.Property("status_supervisor2A_click_date"); + + b.Property("status_supervisor3A") + .HasMaxLength(1); + + b.Property("status_supervisor3A_click_date"); + + b.Property("status_supervisor_a") + .HasMaxLength(1); + + b.Property("status_supervisor_a_click_date"); + + b.Property("status_supervisor_click_date"); + + b.Property("supervisor1"); + + b.Property("supervisor1A"); + + b.Property("supervisor1A_date"); + + b.Property("supervisor1A_remark") + .HasMaxLength(1000); + + b.Property("supervisor1A_result") + .HasMaxLength(1); + + b.Property("supervisor1_date"); + + b.Property("supervisor1_id"); + + b.Property("supervisor1_remark") + .HasMaxLength(1000); + + b.Property("supervisor1_result") + .HasMaxLength(1); + + b.Property("supervisor2"); + + b.Property("supervisor2A"); + + b.Property("supervisor2A_date"); + + b.Property("supervisor2A_remark") + .HasMaxLength(1000); + + b.Property("supervisor2A_result") + .HasMaxLength(1); + + b.Property("supervisor2_date"); + + b.Property("supervisor2_id"); + + b.Property("supervisor2_remark") + .HasMaxLength(1000); + + b.Property("supervisor2_result") + .HasMaxLength(1); + + b.Property("supervisor3A"); + + b.Property("supervisor3A_date"); + + b.Property("supervisor3A_remark") + .HasMaxLength(1000); + + b.Property("supervisor3A_result") + .HasMaxLength(1); + + b.Property("supervisor3_id"); + + b.Property("total_summary_chief"); + + b.Property("total_summary_competency_chief"); + + b.Property("total_summary_competency_supervisor"); + + b.Property("total_summary_competency_supervisor1A"); + + b.Property("total_summary_competency_supervisor2A"); + + b.Property("total_summary_competency_supervisor3A"); + + b.Property("total_summary_supervisor"); + + b.Property("total_summary_supervisor1A"); + + b.Property("total_summary_supervisor2A"); + + b.Property("total_summary_supervisor3A"); + + b.Property("updated"); + + b.Property("work_period"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_id"); + + b.ToTable("eva_create_evaluation_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detail_historyEntity", b => + { + b.Property("id"); + + b.Property("action_detail") + .HasMaxLength(4000); + + b.Property("action_dt"); + + b.Property("action_emp_id"); + + b.Property("created"); + + b.Property("evaluation_detail_id"); + + b.Property("history_group"); + + b.Property("isActive"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("evaluation_detail_id"); + + b.ToTable("eva_create_evaluation_detail_history"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b => + { + b.Property("id"); + + b.Property("achievement") + .HasMaxLength(16000); + + b.Property("achievement_line1") + .HasMaxLength(16000); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("score"); + + b.Property("score2"); + + b.Property("score3"); + + b.Property("score4"); + + b.Property("sumary"); + + b.Property("sumary2"); + + b.Property("sumary3"); + + b.Property("sumary4"); + + b.Property("target_score1") + .HasMaxLength(255); + + b.Property("target_score2") + .HasMaxLength(255); + + b.Property("target_score3") + .HasMaxLength(255); + + b.Property("target_score4") + .HasMaxLength(255); + + b.Property("target_score5") + .HasMaxLength(255); + + b.Property("thefile") + .HasMaxLength(1000); + + b.Property("updated"); + + b.Property("weight"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_detail_id"); + + b.ToTable("eva_evaluation_achievement"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_attachEntity", b => + { + b.Property("id"); + + b.Property("achievement_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("the_file") + .HasMaxLength(1000); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("achievement_id"); + + b.ToTable("eva_evaluation_achievement_attach"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_detailEntity", b => + { + b.Property("id"); + + b.Property("achievement_detail") + .HasMaxLength(16000); + + b.Property("achievement_id"); + + b.Property("achievement_order"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("achievement_id"); + + b.ToTable("eva_evaluation_achievement_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b => + { + b.Property("id"); + + b.Property("behavior") + .HasMaxLength(16000); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("score"); + + b.Property("score2"); + + b.Property("score3"); + + b.Property("score4"); + + b.Property("sumary"); + + b.Property("sumary2"); + + b.Property("sumary3"); + + b.Property("sumary4"); + + b.Property("target_score1") + .HasMaxLength(255); + + b.Property("target_score2") + .HasMaxLength(255); + + b.Property("target_score3") + .HasMaxLength(255); + + b.Property("target_score4") + .HasMaxLength(255); + + b.Property("target_score5") + .HasMaxLength(255); + + b.Property("updated"); + + b.Property("weight"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_detail_id"); + + b.ToTable("eva_evaluation_behavior"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_groupEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("main_dept_id"); + + b.Property("percentage"); + + b.Property("thegroup") + .HasMaxLength(255); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_evaluation_group"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("evaluation_group_id"); + + b.Property("isActive"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("evaluation_group_id"); + + b.ToTable("eva_evaluation_group_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b => + { + b.Property("id"); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("indicators") + .HasMaxLength(4000); + + b.Property("isActive"); + + b.Property("mission_detail") + .HasMaxLength(4000); + + b.Property("mission_no"); + + b.Property("target") + .HasMaxLength(4000); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_detail_id"); + + b.ToTable("eva_evaluation_operating_agreement"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_idp_planEntity", b => + { + b.Property("id"); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("develop") + .HasMaxLength(1000); + + b.Property("development_method") + .HasMaxLength(1000); + + b.Property("end_date"); + + b.Property("isActive"); + + b.Property("period_text") + .HasMaxLength(1000); + + b.Property("start_date"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_idp_plan"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_level_scoreEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("detail") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("max_score"); + + b.Property("min_score"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_level_score"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_level_score_detailEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("group_guid"); + + b.Property("isActive"); + + b.Property("level_score_id"); + + b.Property("max_percentage"); + + b.Property("max_value"); + + b.Property("min_percentage"); + + b.Property("min_value"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("group_guid"); + + b.HasIndex("level_score_id"); + + b.ToTable("eva_level_score_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b => + { + b.Property("id"); + + b.Property("cost_of_living"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("frame_group_guid"); + + b.Property("help_org_id"); + + b.Property("isActive"); + + b.Property("level_text") + .HasMaxLength(1000); + + b.Property("monthly_remuneration"); + + b.Property("order_of_data"); + + b.Property("org_id"); + + b.Property("position_allowance"); + + b.Property("position_text") + .HasMaxLength(1000); + + b.Property("salary"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("frame_group_guid"); + + b.ToTable("eva_limit_frame_employee"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("frame_plan_guid"); + + b.Property("group_guid"); + + b.Property("isActive"); + + b.Property("limit_frame_295"); + + b.Property("main_dept_id"); + + b.Property("remark") + .HasMaxLength(4000); + + b.Property("remark2") + .HasMaxLength(4000); + + b.Property("total_salary"); + + b.Property("total_salary_limit"); + + b.Property("total_salary_limit_rounded"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("frame_plan_guid"); + + b.HasIndex("group_guid"); + + b.ToTable("eva_limit_frame_group"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("executed_date"); + + b.Property("isActive"); + + b.Property("limit_frame_005"); + + b.Property("limit_frame_005_total"); + + b.Property("limit_frame_005_total_rounded"); + + b.Property("plan_guid"); + + b.Property("salary_adjustment_date"); + + b.Property("status_chief") + .HasMaxLength(1); + + b.Property("status_self") + .HasMaxLength(1); + + b.Property("supervisor1"); + + b.Property("supervisor1_date"); + + b.Property("supervisor1_remark") + .HasMaxLength(1000); + + b.Property("supervisor1_result") + .HasMaxLength(1); + + b.Property("total_salary"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("plan_guid"); + + b.ToTable("eva_limit_frame_plan"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_planEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("end_leave"); + + b.Property("fiscal_year"); + + b.Property("isActive"); + + b.Property("percent"); + + b.Property("remark") + .HasMaxLength(500); + + b.Property("start_leave"); + + b.Property("theTime"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_performance_plan"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("end_date"); + + b.Property("isActive"); + + b.Property("list_no"); + + b.Property("performance_plan_id"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("start_date"); + + b.Property("step") + .HasMaxLength(1000); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("performance_plan_id"); + + b.ToTable("eva_performance_plan_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("detail") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("level_score_id"); + + b.Property("max_score"); + + b.Property("min_score"); + + b.Property("promoted_percentage"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("level_score_id"); + + b.ToTable("eva_promoted_percentage"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_salary_cylinderEntity", b => + { + b.Property("id"); + + b.Property("cost_living"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("middle"); + + b.Property("monthly_compensation"); + + b.Property("position_allowance"); + + b.Property("position_level"); + + b.Property("position_type"); + + b.Property("salary_max"); + + b.Property("temporary_min"); + + b.Property("themax"); + + b.Property("themin"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_salary_cylinder"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_setup_permissionEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("isActive"); + + b.Property("remark") + .HasMaxLength(4000); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_setup_permission"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation") + .WithMany() + .HasForeignKey("create_evaluation_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement") + .WithMany() + .HasForeignKey("adjust_postponement_id"); + + b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement_quota") + .WithMany() + .HasForeignKey("adjust_postponement_quota_id") + .HasConstraintName("FK_eva_adjust_postponement_detail_eva_adjust_postponement_adj~1"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group") + .WithMany() + .HasForeignKey("evaluation_group_id"); + + b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan") + .WithMany() + .HasForeignKey("performance_plan_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation_create_evaluation_id") + .WithMany() + .HasForeignKey("create_evaluation_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detail_historyEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail_evaluation_detail_id") + .WithMany() + .HasForeignKey("evaluation_detail_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail") + .WithMany() + .HasForeignKey("create_evaluation_detail_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_attachEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_evaluation_achievementEntity", "eva_evaluation_achievement_achievement_id") + .WithMany() + .HasForeignKey("achievement_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievement_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_evaluation_achievementEntity", "eva_evaluation_achievement") + .WithMany() + .HasForeignKey("achievement_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail") + .WithMany() + .HasForeignKey("create_evaluation_detail_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group") + .WithMany() + .HasForeignKey("evaluation_group_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail_create_evaluation_detail_id") + .WithMany() + .HasForeignKey("create_evaluation_detail_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_level_score_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group_group_guid") + .WithMany() + .HasForeignKey("group_guid"); + + b.HasOne("TodoAPI2.Models.eva_level_scoreEntity", "eva_level_score_level_score_id") + .WithMany() + .HasForeignKey("level_score_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_limit_frame_groupEntity", "eva_limit_frame_group_frame_group_guid") + .WithMany() + .HasForeignKey("frame_group_guid"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_limit_frame_planEntity", "eva_limit_frame_plan_frame_plan_guid") + .WithMany() + .HasForeignKey("frame_plan_guid"); + + b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group_group_guid") + .WithMany() + .HasForeignKey("group_guid"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan_plan_guid") + .WithMany() + .HasForeignKey("plan_guid"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan") + .WithMany() + .HasForeignKey("performance_plan_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_level_scoreEntity", "eva_level_score") + .WithMany() + .HasForeignKey("level_score_id"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20220502040427_AddFinalApprover.cs b/Migrations/20220502040427_AddFinalApprover.cs new file mode 100644 index 0000000..ec48cd0 --- /dev/null +++ b/Migrations/20220502040427_AddFinalApprover.cs @@ -0,0 +1,62 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace tb320eva.Migrations +{ + public partial class AddFinalApprover : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "quota_final_status", + table: "eva_adjust_postponement", + maxLength: 5, + nullable: true); + + migrationBuilder.AddColumn( + name: "quota_final_status_by", + table: "eva_adjust_postponement", + maxLength: 255, + nullable: true); + + migrationBuilder.AddColumn( + name: "quota_final_status_date", + table: "eva_adjust_postponement", + nullable: true); + + migrationBuilder.AddColumn( + name: "quota_final_status_note", + table: "eva_adjust_postponement", + maxLength: 1000, + nullable: true); + + migrationBuilder.AddColumn( + name: "quota_status_submit_to", + table: "eva_adjust_postponement", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "quota_final_status", + table: "eva_adjust_postponement"); + + migrationBuilder.DropColumn( + name: "quota_final_status_by", + table: "eva_adjust_postponement"); + + migrationBuilder.DropColumn( + name: "quota_final_status_date", + table: "eva_adjust_postponement"); + + migrationBuilder.DropColumn( + name: "quota_final_status_note", + table: "eva_adjust_postponement"); + + migrationBuilder.DropColumn( + name: "quota_status_submit_to", + table: "eva_adjust_postponement"); + } + } +} diff --git a/Migrations/DataContextModelSnapshot.cs b/Migrations/DataContextModelSnapshot.cs index f275b44..2821683 100644 --- a/Migrations/DataContextModelSnapshot.cs +++ b/Migrations/DataContextModelSnapshot.cs @@ -101,6 +101,17 @@ namespace tb320eva.Migrations b.Property("postponement_status_note") .HasMaxLength(1000); + b.Property("quota_final_status") + .HasMaxLength(5); + + b.Property("quota_final_status_by") + .HasMaxLength(255); + + b.Property("quota_final_status_date"); + + b.Property("quota_final_status_note") + .HasMaxLength(1000); + b.Property("quota_status") .HasMaxLength(5); @@ -112,6 +123,8 @@ namespace tb320eva.Migrations b.Property("quota_status_note") .HasMaxLength(1000); + b.Property("quota_status_submit_to"); + b.Property("report_type") .HasMaxLength(1000); diff --git a/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaService.cs b/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaService.cs index 903ff0f..584c1e2 100644 --- a/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaService.cs +++ b/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaService.cs @@ -142,6 +142,8 @@ namespace TodoAPI2.Models managed_by = m_eva_adjust_postponement_quota.managed_by, limit = m_eva_adjust_postponement_quota.limit, + quota_status_submit_to = m_eva_adjust_postponement_quota.quota_status_submit_to, + managed_by_external_linkage_external_name = fk_external_linkageResult7.fullname, isActive = m_eva_adjust_postponement_quota.isActive, diff --git a/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaViewModel.cs b/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaViewModel.cs index d40a1d6..f6ab4ba 100644 --- a/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaViewModel.cs +++ b/Models/eva_adjust_postponement_quota/eva_adjust_postponement_quotaViewModel.cs @@ -34,5 +34,7 @@ namespace TodoAPI2.Models public string managed_by_external_linkage_external_name { get; set; } + public int? quota_status_submit_to { get; set; } + } } \ No newline at end of file diff --git a/Models/eva_adjust_quota_update_final_status/Ieva_adjust_quota_update_final_statusService.cs b/Models/eva_adjust_quota_update_final_status/Ieva_adjust_quota_update_final_statusService.cs new file mode 100644 index 0000000..411913c --- /dev/null +++ b/Models/eva_adjust_quota_update_final_status/Ieva_adjust_quota_update_final_statusService.cs @@ -0,0 +1,25 @@ +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_adjust_quota_update_final_statusService + { + new eva_adjust_quota_update_final_statusViewModel Update(int id, eva_adjust_quota_update_final_statusInputModel model, bool is_force_save, int? updateby); + List GetListByquota_final_status_note(string quota_final_status_note); + List GetListBySearch(eva_adjust_quota_update_final_statusSearchModel model); + + eva_adjust_quota_update_final_statusWithSelectionViewModel GetWithSelection(int id); + eva_adjust_quota_update_final_statusWithSelectionViewModel GetBlankItem(); + eva_adjust_postponementEntity GetEntity(int id); + DataContext GetContext(); + } +} + diff --git a/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusInputModel.cs b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusInputModel.cs new file mode 100644 index 0000000..6a436ba --- /dev/null +++ b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusInputModel.cs @@ -0,0 +1,30 @@ +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_adjust_quota_update_final_statusInputModel + { + + public int? id { get; set; } + + public string quota_final_status { get; set; } + + public DateTime? quota_final_status_date { get; set; } + + public int? quota_final_status_by { get; set; } + + public string quota_final_status_note { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusReportRequestModel.cs b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusReportRequestModel.cs new file mode 100644 index 0000000..e3865b9 --- /dev/null +++ b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusReportRequestModel.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_adjust_quota_update_final_statusReportRequestModel : eva_adjust_quota_update_final_statusSearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusSearchModel.cs b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusSearchModel.cs new file mode 100644 index 0000000..7d93865 --- /dev/null +++ b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusSearchModel.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_adjust_quota_update_final_statusSearchModel + { + + public int id { get; set; } + + public string quota_final_status_note { get; set; } + + } +} + diff --git a/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusService.cs b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusService.cs new file mode 100644 index 0000000..62325f9 --- /dev/null +++ b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusService.cs @@ -0,0 +1,237 @@ +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_adjust_quota_update_final_statusService : Ieva_adjust_quota_update_final_statusService + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + private Iexternal_employeeService emp; + + public eva_adjust_quota_update_final_statusService(IBaseRepository2 repository, + IMyDatabase mydb, Iexternal_linkageService inext, + Iexternal_employeeService inemp) + { + _repository = repository; + db = mydb; + ext = inext; + emp = inemp; + } + + #region Private Functions + private eva_adjust_postponementEntity GetEntity(eva_adjust_quota_update_final_statusInputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_adjust_quota_update_final_statusViewModel GetDto(eva_adjust_postponementEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public eva_adjust_quota_update_final_statusViewModel Get(int id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + + public eva_adjust_postponementEntity GetEntity(int id) + { + var entity = _repository.Get(id); + + return entity; + } + + public DataContext GetContext() + { + return _repository.Context; + } + + public eva_adjust_quota_update_final_statusWithSelectionViewModel GetWithSelection(int id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + i.item_quota_final_status = (from x in ext.GetAgreeDisagree5() select x).ToList(); + i.item_quota_final_status_by = (from x in emp.GetAllEmployee() select x).ToList(); + + + return i; + } + public eva_adjust_quota_update_final_statusWithSelectionViewModel GetBlankItem() + { + var i = new eva_adjust_quota_update_final_statusWithSelectionViewModel(); + i.item_quota_final_status = (from x in ext.GetAgreeDisagree5() select x).ToList(); + i.item_quota_final_status_by = (from x in emp.GetAllEmployee() select x).ToList(); + + + return i; + } + + public List GetListByquota_final_status_note(string quota_final_status_note) + { + var model = new eva_adjust_quota_update_final_statusSearchModel(); + model.quota_final_status_note = quota_final_status_note; + return GetListBySearch(model); + } + + public List GetListBySearch(eva_adjust_quota_update_final_statusSearchModel model) + { + var data = ( + from m_eva_adjust_quota_update_final_status in _repository.Context.eva_adjust_postponement + + join fk_external_linkage1 in ext.GetAgreeDisagree5() on m_eva_adjust_quota_update_final_status.quota_final_status equals fk_external_linkage1.external_code + into external_linkageResult1 + from fk_external_linkageResult1 in external_linkageResult1.DefaultIfEmpty() + + join fk_external_linkage3 in emp.GetAllEmployee() on m_eva_adjust_quota_update_final_status.quota_final_status_by equals fk_external_linkage3.id + into external_linkageResult3 + from fk_external_linkageResult3 in external_linkageResult3.DefaultIfEmpty() + + + where + 1 == 1 + && (string.IsNullOrEmpty(model.quota_final_status_note) || m_eva_adjust_quota_update_final_status.quota_final_status_note.Contains(model.quota_final_status_note)) + + + orderby m_eva_adjust_quota_update_final_status.created descending + select new eva_adjust_quota_update_final_statusViewModel() + { + id = m_eva_adjust_quota_update_final_status.id, + quota_final_status = m_eva_adjust_quota_update_final_status.quota_final_status, + quota_final_status_date = m_eva_adjust_quota_update_final_status.quota_final_status_date, + quota_final_status_by = m_eva_adjust_quota_update_final_status.quota_final_status_by, + quota_final_status_note = m_eva_adjust_quota_update_final_status.quota_final_status_note, + + quota_final_status_external_linkage_external_name = fk_external_linkageResult1.external_name, + quota_final_status_by_external_linkage_external_name = fk_external_linkageResult3.fullname, + + isActive = m_eva_adjust_quota_update_final_status.isActive, + Created = m_eva_adjust_quota_update_final_status.created, + Updated = m_eva_adjust_quota_update_final_status.updated + } + ).Take(1000).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + + public int GetNewPrimaryKey() + { + int? newkey = 0; + + var x = (from i in _repository.Context.eva_adjust_postponement + orderby i.id descending + select i).Take(1).ToList(); + + if(x.Count > 0) + { + newkey = x[0].id + 1; + } + + return newkey.Value; + } + + + public eva_adjust_quota_update_final_statusViewModel Update(int id, + eva_adjust_quota_update_final_statusInputModel model, bool is_force_save, int? updateby) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + existingEntity.quota_final_status = model.quota_final_status; + existingEntity.quota_final_status_date = DateTime.Now; + existingEntity.quota_final_status_by = updateby; + existingEntity.quota_final_status_note = model.quota_final_status_note; + + if (model.quota_final_status == "N") + { + existingEntity.quota_status = "W"; + existingEntity.quota_status_note = existingEntity.quota_final_status_note; + } + + var updated = _repository.Update(id, existingEntity); + return Get(updated.id); + } + else + throw new NotificationException("No data to update"); + } + + + public eva_adjust_quota_update_final_statusViewModel SetAsActive(int id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public eva_adjust_quota_update_final_statusViewModel SetAsInactive(int id) + { + var updated = _repository.SetAsInActive(id); + + return Get(updated.id); + } + public void Delete(int id) + { + _repository.Delete(id); + + return; + } + + + private Dictionary GetLookupForLog() + { + var i = new Dictionary(); + + + i.Add("quota_final_status", "สถานะการปรับเลื่อนเงินเดือน"); + i.Add("quota_final_status_external_linkage_external_name", "สถานะการปรับเลื่อนเงินเดือน"); + i.Add("quota_final_status_date", "วันที่"); + i.Add("txt_quota_final_status_date", "วันที่"); + i.Add("quota_final_status_by", "ปรับสถานะโดย"); + i.Add("quota_final_status_by_external_linkage_external_name", "ปรับสถานะโดย"); + i.Add("quota_final_status_note", "หมายเหตุ"); + + return i; + } + + #endregion + + #region Match Item + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusViewModel.cs b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusViewModel.cs new file mode 100644 index 0000000..dcd7b12 --- /dev/null +++ b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusViewModel.cs @@ -0,0 +1,31 @@ +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_adjust_quota_update_final_statusViewModel : BaseViewModel2 + { + + public string quota_final_status { get; set; } + + public DateTime? quota_final_status_date { get; set; } + + public string txt_quota_final_status_date { get { return MyHelper.GetDateStringForReport(this.quota_final_status_date); } } + + public int? quota_final_status_by { get; set; } + + public string quota_final_status_note { get; set; } + + public string quota_final_status_external_linkage_external_name { get; set; } + public string quota_final_status_by_external_linkage_external_name { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusWithSelectionViewModel.cs b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusWithSelectionViewModel.cs new file mode 100644 index 0000000..4bfd21a --- /dev/null +++ b/Models/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_statusWithSelectionViewModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class eva_adjust_quota_update_final_statusWithSelectionViewModel: eva_adjust_quota_update_final_statusViewModel + { + public List item_quota_final_status { get; set; } + public List item_quota_final_status_by { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusService.cs b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusService.cs index 1995a94..6741fec 100644 --- a/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusService.cs +++ b/Models/eva_adjust_quota_update_status/eva_adjust_quota_update_statusService.cs @@ -175,6 +175,13 @@ namespace TodoAPI2.Models existingEntity.quota_status_date = DateTime.Now; existingEntity.quota_status_by = updateby; existingEntity.quota_status_note = model.quota_status_note; + existingEntity.quota_status_submit_to = model.quota_status_submit_to; + + if (model.quota_status == "Y") + { + existingEntity.quota_final_status = "W"; + existingEntity.quota_final_status_note = existingEntity.quota_status_note; + } var updated = _repository.Update(id, existingEntity); return Get(updated.id); diff --git a/Models/external_linkage/Iexternal_linkageService.cs b/Models/external_linkage/Iexternal_linkageService.cs index cfc0d80..a19757e 100644 --- a/Models/external_linkage/Iexternal_linkageService.cs +++ b/Models/external_linkage/Iexternal_linkageService.cs @@ -42,6 +42,7 @@ namespace TodoAPI2.Models List GetSalaryReportType(); List GetAgreeDisagree4(); + List GetAgreeDisagree5(); } } diff --git a/Models/external_linkage/external_linkageService.cs b/Models/external_linkage/external_linkageService.cs index 509abbb..0950891 100644 --- a/Models/external_linkage/external_linkageService.cs +++ b/Models/external_linkage/external_linkageService.cs @@ -314,7 +314,7 @@ namespace TodoAPI2.Models var k = new external_linkageViewModel(); k.external_id = 1; - k.external_code = ""; + k.external_code = "W"; k.external_name = "ระหว่างพิจารณา"; result.Add(k); @@ -333,6 +333,31 @@ namespace TodoAPI2.Models return result; } + public List GetAgreeDisagree5() + { + var result = new List(); + + var k = new external_linkageViewModel(); + k.external_id = 1; + k.external_code = "W"; + k.external_name = "ระหว่างพิจารณา"; + result.Add(k); + + var i = new external_linkageViewModel(); + i.external_id = 2; + i.external_code = "Y"; + i.external_name = "อนุมัติและแสดงแก่พนักงาน"; + result.Add(i); + + var j = new external_linkageViewModel(); + j.external_id = 3; + j.external_code = "N"; + j.external_name = "ตีกลับ"; + result.Add(j); + + return result; + } + public List GetDepartmentData() { var sql_parent = string.Format("select" + diff --git a/Startup.cs b/Startup.cs index 13d74d8..3fa311c 100644 --- a/Startup.cs +++ b/Startup.cs @@ -349,6 +349,8 @@ namespace Test01 services.AddScoped(); + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -667,6 +669,10 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); + + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); }); #endregion diff --git a/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml b/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml index 6c2b829..fed70ec 100644 --- a/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml +++ b/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml @@ -5,6 +5,55 @@ Layout = "_LayoutDirect"; } + + + +
@@ -76,7 +133,6 @@
-
@@ -162,7 +218,7 @@ - + @@ -174,8 +230,10 @@
- - + + + +
@@ -220,19 +278,25 @@ + } diff --git a/Views/eva_adjust_quota_update_final_statusView/eva_adjust_quota_update_final_status.cshtml b/Views/eva_adjust_quota_update_final_statusView/eva_adjust_quota_update_final_status.cshtml new file mode 100644 index 0000000..ccbaa2d --- /dev/null +++ b/Views/eva_adjust_quota_update_final_statusView/eva_adjust_quota_update_final_status.cshtml @@ -0,0 +1,118 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration +@{ + ViewData["Title"] = "eva_adjust_quota_update_final_status"; +} + + + +
+
+
+ @Configuration["SiteInformation:modulename"] +
+
+
+ +
+
+ +
+
ค้นหา eva_adjust_quota_update_final_status
+
+
+ +
+ + +
+ +
+ + + +
+ +
+
+ + + + + + + + + + + + + + + +
เครื่องมือ
+
+ +@section FooterPlaceHolder{ + + +} + diff --git a/Views/eva_adjust_quota_update_statusView/eva_adjust_quota_update_status.cshtml b/Views/eva_adjust_quota_update_statusView/eva_adjust_quota_update_status.cshtml index 4e4e67e..d9d67a0 100644 --- a/Views/eva_adjust_quota_update_statusView/eva_adjust_quota_update_status.cshtml +++ b/Views/eva_adjust_quota_update_statusView/eva_adjust_quota_update_status.cshtml @@ -43,6 +43,12 @@
+
+
+ + +
+
@@ -100,6 +106,7 @@ + diff --git a/tb320eva.csproj b/tb320eva.csproj index 63c801e..6f986c6 100644 --- a/tb320eva.csproj +++ b/tb320eva.csproj @@ -68,6 +68,7 @@ + @@ -89,6 +90,7 @@ + diff --git a/tb320eva.xml b/tb320eva.xml index 5c5c1de..8ee003f 100644 --- a/tb320eva.xml +++ b/tb320eva.xml @@ -957,6 +957,78 @@ 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 quota_final_status_note + + + + 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 + + + + Download Report + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Update item + + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + Default constructure for dependency injection @@ -964,6 +1036,7 @@ + diff --git a/wwwroot/js/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02_inline.js b/wwwroot/js/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02_inline.js index e8d2321..a44f849 100644 --- a/wwwroot/js/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02_inline.js +++ b/wwwroot/js/eva_adjust_postponement_detail_quota_02/eva_adjust_postponement_detail_quota_02_inline.js @@ -148,7 +148,7 @@ function eva_adjust_postponement_detail_quota_02_Get(a, blankItem) { tag += '

'; tag += '

'; tag += ''; tag += '

'; @@ -215,6 +215,8 @@ function eva_adjust_postponement_detail_quota_02_Get(a, blankItem) { Oneva_adjust_postponement_quota_limit_frame_quotaChange(); + showHideForm(); + //CalculateRemainQuota(false); endLoad(); }; diff --git a/wwwroot/js/eva_adjust_postponement_quota/eva_adjust_postponement_quota_d.js b/wwwroot/js/eva_adjust_postponement_quota/eva_adjust_postponement_quota_d.js index 940f138..c76fda6 100644 --- a/wwwroot/js/eva_adjust_postponement_quota/eva_adjust_postponement_quota_d.js +++ b/wwwroot/js/eva_adjust_postponement_quota/eva_adjust_postponement_quota_d.js @@ -3,6 +3,9 @@ var eva_adjust_postponement_quota_API = "/api/eva_adjust_postponement_quota/"; //================= Form Data Customizaiton ========================================= +var quota_status_submit_to = -1; +var managed_by = -1; + function eva_adjust_postponement_quota_FeedDataToForm(data) { $("#eva_adjust_postponement_quota_id").val(data.id); $("#eva_adjust_postponement_quota_fiscal_year").val(data.fiscal_year); @@ -17,6 +20,13 @@ function eva_adjust_postponement_quota_FeedDataToForm(data) { $("#eva_adjust_postponement_quota_limit").val(data.limit); DropDownClearFormAndFeedWithData($("#eva_adjust_postponement_quota_managed_by"), data, "id", "fullname", "item_managed_by", getCookie("emp_id")); //console.log($("#eva_adjust_postponement_quota_limit").val()); + + //console.log(data); + + quota_status_submit_to = data.quota_status_submit_to; + managed_by = data.managed_by; + + //console.log(getCookie("emp_id")); } function eva_adjust_postponement_quota_GetFromForm() { diff --git a/wwwroot/js/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_status.js b/wwwroot/js/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_status.js new file mode 100644 index 0000000..3f95e54 --- /dev/null +++ b/wwwroot/js/eva_adjust_quota_update_final_status/eva_adjust_quota_update_final_status.js @@ -0,0 +1,267 @@ +var eva_adjust_quota_update_final_status_editMode = "CREATE"; +var eva_adjust_quota_update_final_status_API = "/api/eva_adjust_quota_update_final_status/"; + +//================= Search Customizaiton ========================================= + +function eva_adjust_quota_update_final_status_GetSearchParameter() { + var eva_adjust_quota_update_final_statusSearchObject = new Object(); + eva_adjust_quota_update_final_statusSearchObject.quota_final_status_note = $("#s_eva_adjust_quota_update_final_status_quota_final_status_note").val(); + + return eva_adjust_quota_update_final_statusSearchObject; +} + +function eva_adjust_quota_update_final_status_FeedDataToSearchForm(data) { + $("#s_eva_adjust_quota_update_final_status_quota_final_status_note").val(data.quota_final_status_note); + +} + +//================= Form Data Customizaiton ========================================= + +function eva_adjust_quota_update_final_status_FeedDataToForm(data) { + //console.log(data); + $("#eva_adjust_quota_update_final_status_id").val(data.id); + DropDownClearFormAndFeedWithData($("#eva_adjust_quota_update_final_status_quota_final_status"), data, "external_code", "external_name", "item_quota_final_status", data.quota_final_status); + $("#eva_adjust_quota_update_final_status_quota_final_status_date").val(formatDate(data.quota_final_status_date)); + DropDownClearFormAndFeedWithData($("#eva_adjust_quota_update_final_status_quota_final_status_by"), data, "id", "fullname", "item_quota_final_status_by", data.quota_final_status_by); + $("#eva_adjust_quota_update_final_status_quota_final_status_note").val(data.quota_final_status_note); + + var statusfinalText = $("#eva_adjust_quota_update_final_status_quota_final_status option:selected").text(); + if ($("#eva_adjust_quota_update_final_status_quota_final_status_by option:selected").text() !== "") + statusfinalText += " โดย " + $("#eva_adjust_quota_update_final_status_quota_final_status_by option:selected").text(); + $("#statusfinalapprove").text(statusfinalText); +} + +function eva_adjust_quota_update_final_status_GetFromForm() { + var eva_adjust_quota_update_final_statusObject = new Object(); + eva_adjust_quota_update_final_statusObject.id = $("#eva_adjust_quota_update_final_status_id").val(); + eva_adjust_quota_update_final_statusObject.quota_final_status = $("#eva_adjust_quota_update_final_status_quota_final_status").val(); + eva_adjust_quota_update_final_statusObject.quota_final_status_date = getDate($("#eva_adjust_quota_update_final_status_quota_final_status_date").val()); + eva_adjust_quota_update_final_statusObject.quota_final_status_by = $("#eva_adjust_quota_update_final_status_quota_final_status_by").val(); + eva_adjust_quota_update_final_statusObject.quota_final_status_note = $("#eva_adjust_quota_update_final_status_quota_final_status_note").val(); + + + return eva_adjust_quota_update_final_statusObject; +} + +function eva_adjust_quota_update_final_status_InitialForm(s) { + var successFunc = function (result) { + eva_adjust_quota_update_final_status_FeedDataToForm(result); + eva_adjust_quota_update_final_status_FeedDataToSearchForm(result); + if (s) { + // Incase model popup + $("#eva_adjust_quota_update_final_statusModel").modal("show"); + } + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_adjust_quota_update_final_status_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Form Mode Setup and Flow ========================================= + +function eva_adjust_quota_update_final_status_GoCreate() { + // Incase model popup + eva_adjust_quota_update_final_status_SetCreateForm(true); + + // Incase open new page + //window_open(appsite + "/eva_adjust_quota_update_final_statusView/eva_adjust_quota_update_final_status_d"); +} + +function eva_adjust_quota_update_final_status_GoEdit(a, b) { + // Incase model popup + eva_adjust_quota_update_final_status_SetEditForm(a, b); + + // Incase open new page + //window_open(appsite + "/eva_adjust_quota_update_final_statusView/eva_adjust_quota_update_final_status_d?id=" + a); +} + +function eva_adjust_quota_update_final_status_SetEditForm(a, b) { + var successFunc = function (result) { + eva_adjust_quota_update_final_status_editMode = "UPDATE"; + eva_adjust_quota_update_final_status_FeedDataToForm(result); + if (b) $("#eva_adjust_quota_update_final_statusModel").modal("show"); + + showHideForm(); + + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + eva_adjust_quota_update_final_status_API + a, successFunc, AlertDanger); +} + +function eva_adjust_quota_update_final_status_SetCreateForm(s) { + eva_adjust_quota_update_final_status_editMode = "CREATE"; + eva_adjust_quota_update_final_status_InitialForm(s); +} + +function eva_adjust_quota_update_final_status_RefreshTable() { + // Incase model popup + eva_adjust_quota_update_final_status_DoSearch(); + + // Incase open new page + //window.parent.eva_adjust_quota_update_final_status_DoSearch(); +} + +//================= Update and Delete ========================================= + +function showHideForm() { + + //console.log($("#eva_adjust_quota_update_status_quota_status").val()); + //console.log($("#eva_adjust_quota_update_final_status_quota_final_status").val()); + + if ($("#eva_adjust_quota_update_status_quota_status").val() === "Y" && + $("#eva_adjust_quota_update_final_status_quota_final_status").val() !== "Y") { + //console.log("CON 1"); + } + else if ($("#eva_adjust_quota_update_status_quota_status").val() === "Y" && + $("#eva_adjust_quota_update_final_status_quota_final_status").val() === "Y") { + + $(".editQuota").prop('disabled', true); + $("#saveBtn").hide(); + + //console.log("CON 2"); + } + + $(".thesubmit").hide(); + $(".thesubmit2").hide(); + + if (parseInt(getCookie("emp_id")) === quota_status_submit_to) $(".thesubmit2").show(); + if (parseInt(getCookie("emp_id")) === managed_by) $(".thesubmit").show(); + + if ($("#eva_adjust_quota_update_status_quota_status").val() !== "Y") + { + $(".thesubmit2").hide(); + } +} + +var eva_adjust_quota_update_final_status_customValidation = function (group) { + return ""; +}; + +function eva_adjust_quota_update_final_status_PutUpdate() { + if (!ValidateForm('eva_adjust_quota_update_final_status', eva_adjust_quota_update_final_status_customValidation)) { + return; + } + + var data = eva_adjust_quota_update_final_status_GetFromForm(); + + //Update Mode + if (eva_adjust_quota_update_final_status_editMode === "UPDATE") { + var successFunc1 = function (result) { + $("#eva_adjust_quota_update_final_statusModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + //eva_adjust_quota_update_final_status_RefreshTable(); + + reloadQuotaStatus(); + + endLoad(); + }; + startLoad(); + AjaxPutRequest(apisite + eva_adjust_quota_update_final_status_API + data.id, data, successFunc1, AlertDanger); + } + // Create mode + else { + var successFunc2 = function (result) { + $("#eva_adjust_quota_update_final_statusModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + //eva_adjust_quota_update_final_status_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxPostRequest(apisite + eva_adjust_quota_update_final_status_API, data, successFunc2, AlertDanger); + } +} + +function eva_adjust_quota_update_final_status_GoDelete(a) { + if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) { + var successFunc = function (result) { + $("#eva_adjust_quota_update_final_statusModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + eva_adjust_quota_update_final_status_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxDeleteRequest(apisite + eva_adjust_quota_update_final_status_API + a, null, successFunc, AlertDanger); + } +} + +//================= Data Table ========================================= + +var eva_adjust_quota_update_final_statusTableV; + +var eva_adjust_quota_update_final_status_setupTable = function (result) { + tmp = '"'; + eva_adjust_quota_update_final_statusTableV = $('#eva_adjust_quota_update_final_statusTable').DataTable({ + "processing": true, + "serverSide": false, + "data": result, + //"select": { + // "style": 'multi' + //}, + "columns": [ + //{ "data": "" }, + { "data": "id" }, + { "data": "id" }, + { "data": "quota_final_status_external_linkage_external_name" }, + { "data": "txt_quota_final_status_date" }, + { "data": "quota_final_status_by_external_linkage_external_name" }, + { "data": "quota_final_status_note" }, + ], + "columnDefs": [ + { + "targets": 0, //1, + "data": "id", + "render": function (data, type, row, meta) { + return " "; + } + }, + //{ + // targets: 0, + // data: "", + // defaultContent: '', + // orderable: false, + // className: 'select-checkbox' + //} + ], + "language": { + "url": appsite + "/DataTables-1.10.16/thai.json" + }, + "paging": true, + "searching": false + }); + endLoad(); +}; + +function eva_adjust_quota_update_final_status_InitiateDataTable() { + startLoad(); + var p = $.param(eva_adjust_quota_update_final_status_GetSearchParameter()); + AjaxGetRequest(apisite + "/api/eva_adjust_quota_update_final_status/GetListBySearch?" + p, eva_adjust_quota_update_final_status_setupTable, AlertDanger); +} + +function eva_adjust_quota_update_final_status_DoSearch() { + var p = $.param(eva_adjust_quota_update_final_status_GetSearchParameter()); + var eva_adjust_quota_update_final_status_reload = function (result) { + eva_adjust_quota_update_final_statusTableV.destroy(); + eva_adjust_quota_update_final_status_setupTable(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + "/api/eva_adjust_quota_update_final_status/GetListBySearch?" + p, eva_adjust_quota_update_final_status_reload, AlertDanger); +} + +function eva_adjust_quota_update_final_status_GetSelect(f) { + var eva_adjust_quota_update_final_status_selectitem = []; + $.each(eva_adjust_quota_update_final_statusTableV.rows('.selected').data(), function (key, value) { + eva_adjust_quota_update_final_status_selectitem.push(value[f]); + }); + alert(eva_adjust_quota_update_final_status_selectitem); +} + +//================= File Upload ========================================= + + + +//================= Multi-Selection Function ========================================= + + + diff --git a/wwwroot/js/eva_adjust_quota_update_status/eva_adjust_quota_update_status.js b/wwwroot/js/eva_adjust_quota_update_status/eva_adjust_quota_update_status.js index 4da3796..d73f06b 100644 --- a/wwwroot/js/eva_adjust_quota_update_status/eva_adjust_quota_update_status.js +++ b/wwwroot/js/eva_adjust_quota_update_status/eva_adjust_quota_update_status.js @@ -19,7 +19,7 @@ function eva_adjust_quota_update_status_FeedDataToSearchForm(data) { function eva_adjust_quota_update_status_FeedDataToForm(data) { $("#eva_adjust_quota_update_status_id").val(data.id); - DropDownClearFormAndFeedWithData($("#eva_adjust_quota_update_status_quota_status"), data, "id", "external_name", "item_quota_status", data.quota_status); + DropDownClearFormAndFeedWithData($("#eva_adjust_quota_update_status_quota_status"), data, "external_code", "external_name", "item_quota_status", data.quota_status); $("#eva_adjust_quota_update_status_quota_status_date").val(formatDate(data.quota_status_date)); DropDownClearFormAndFeedWithData($("#eva_adjust_quota_update_status_quota_status_by"), data, "id", "fullname", "item_quota_status_by", data.quota_status_by); $("#eva_adjust_quota_update_status_quota_status_note").val(data.quota_status_note); @@ -80,7 +80,10 @@ function eva_adjust_quota_update_status_SetEditForm(a,b) { var successFunc = function (result) { eva_adjust_quota_update_status_editMode = "UPDATE"; eva_adjust_quota_update_status_FeedDataToForm(result); - if(b) $("#eva_adjust_quota_update_statusModel").modal("show"); + if (b) $("#eva_adjust_quota_update_statusModel").modal("show"); + + eva_adjust_quota_update_final_status_GoEdit(getUrlParameter('id'), false); + endLoad(); }; startLoad(); @@ -102,6 +105,10 @@ function eva_adjust_quota_update_status_RefreshTable() { //================= Update and Delete ========================================= +function reloadQuotaStatus() { + eva_adjust_quota_update_status_GoEdit(getUrlParameter('id'), false); +} + var eva_adjust_quota_update_status_customValidation = function (group) { return ""; }; @@ -124,7 +131,10 @@ function eva_adjust_quota_update_status_PutUpdate() { $("#eva_adjust_quota_update_statusModel").modal("hide"); AlertSuccess(result.code + " " + result.message); //eva_adjust_quota_update_status_RefreshTable(); - eva_adjust_quota_update_status_GoEdit(getUrlParameter('id'), false); + + + reloadQuotaStatus(); + endLoad(); }; startLoad();