รวม code แก้ op 4 ข้อ

This commit is contained in:
Nakorn Rientrakrunchai
2020-05-14 21:17:29 +07:00
parent 0db3cc87b0
commit da69b4fee4
22 changed files with 1152 additions and 35 deletions

View File

@@ -0,0 +1,320 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using TTSW.Controllers;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
namespace TodoAPI2.Controllers
{
//[Authorize]
[Produces("application/json")]
[Route("api/eva_idp_plan_owner")]
public class eva_idp_plan_ownerController : BaseController
{
#region Private Variables
private ILogger<eva_idp_plan_ownerController> _logger;
private Ieva_idp_plan_ownerService _repository;
private IConfiguration Configuration { get; set; }
#endregion
#region Properties
#endregion
/// <summary>
/// Default constructure for dependency injection
/// </summary>
/// <param name="repository"></param>
/// <param name="configuration"></param>
/// <param name="logger"></param>
public eva_idp_plan_ownerController(ILogger<eva_idp_plan_ownerController> logger, Ieva_idp_plan_ownerService repository, IConfiguration configuration)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
}
/// <summary>
/// Get specific item by id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return Get specific item by id</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("{id}")]
[ProducesResponseType(typeof(eva_idp_plan_ownerWithSelectionViewModel), 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}");
}
}
/// <summary>
/// Get Blank Item
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return a blank item</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetBlankItem")]
[ProducesResponseType(typeof(eva_idp_plan_ownerWithSelectionViewModel), 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}");
}
}
/// <summary>
/// Get list items by create_evaluation_detail_id
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("")]
[ProducesResponseType(typeof(List<eva_idp_plan_ownerViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetList(int? create_evaluation_detail_id)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListBycreate_evaluation_detail_id(create_evaluation_detail_id));
}
catch (Exception ex)
{
_logger.LogCritical($"Exception in IActionResult GetList.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
/// <summary>
/// Get list items by search
/// </summary>
/// <remarks>
/// </remarks>
/// <returns>Return list of items by specifced keyword</returns>
/// <response code="200">Returns the item</response>
/// <response code="500">Error Occurred</response>
[HttpGet("GetListBySearch")]
[ProducesResponseType(typeof(List<eva_idp_plan_ownerViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(eva_idp_plan_ownerSearchModel 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}");
}
}
/// <summary>
/// Create new item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPost("")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Insert([FromBody] eva_idp_plan_ownerInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Insert(model);
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);
}
/// <summary>
/// Update item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("{id}")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Update(int id, [FromBody] eva_idp_plan_ownerInputModel model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var result = _repository.Update(id, model);
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);
}
/// <summary>
/// Delete item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="id"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[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);
}
/// <summary>
/// Update multiple item
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="model"></param>
/// <returns>Response Result Message</returns>
/// <response code="200">Response Result Message</response>
/// <response code="400">If the model is invalid</response>
/// <response code="500">Error Occurred</response>
[HttpPut("UpdateMultiple")]
[ProducesResponseType(typeof(CommonResponseMessage), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult UpdateMultiple([FromBody] List<eva_idp_plan_ownerInputModel> model)
{
if (ModelState.IsValid)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
string rowCount = _repository.UpdateMultiple(model);
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);
}
}
}

Binary file not shown.

View File

@@ -170,7 +170,7 @@ namespace TodoAPI2.Models
existingEntity.supervisor1 = model.supervisor1;
existingEntity.supervisor1_result = model.supervisor1_result;
existingEntity.supervisor1_remark = model.supervisor1_remark;
existingEntity.supervisor1_date = model.supervisor1_date;
existingEntity.supervisor1_date = DateTime.Now;
var updated = _repository.Update(id, existingEntity);

View File

@@ -168,7 +168,7 @@ namespace TodoAPI2.Models
existingEntity.supervisor2 = model.supervisor2;
existingEntity.supervisor2_result = model.supervisor2_result;
existingEntity.supervisor2_remark = model.supervisor2_remark;
existingEntity.supervisor2_date = model.supervisor2_date;
existingEntity.supervisor2_date = DateTime.Now;
var updated = _repository.Update(id, existingEntity);

View File

@@ -0,0 +1,28 @@
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_idp_plan_ownerService : IBaseService<int, eva_idp_plan_ownerInputModel, eva_idp_plan_ownerViewModel>
{
new eva_idp_plan_ownerViewModel Insert(eva_idp_plan_ownerInputModel model);
new eva_idp_plan_ownerViewModel Update(int id, eva_idp_plan_ownerInputModel model);
List<eva_idp_plan_ownerViewModel> GetListBycreate_evaluation_detail_id(int? create_evaluation_detail_id);
List<eva_idp_plan_ownerViewModel> GetListBySearch(eva_idp_plan_ownerSearchModel model);
string UpdateMultiple(List<eva_idp_plan_ownerInputModel> model);
eva_idp_plan_ownerWithSelectionViewModel GetWithSelection(int id);
eva_idp_plan_ownerWithSelectionViewModel GetBlankItem();
}
}

View File

@@ -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_idp_plan_ownerInputModel
{
public int? id { get; set; }
public int? create_evaluation_detail_id { get; set; }
public string develop { get; set; }
public string development_method { get; set; }
public DateTime? start_date { get; set; }
public DateTime? end_date { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -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_idp_plan_ownerReportRequestModel : eva_idp_plan_ownerSearchModel
{
public string filetype { get; set; }
public string contentType { get { return MyHelper.GetContentType(filetype); } }
}
}

View File

@@ -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_idp_plan_ownerSearchModel
{
public int id { get; set; }
public int? create_evaluation_detail_id { get; set; }
}
}

View File

@@ -0,0 +1,249 @@
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_idp_plan_ownerService : Ieva_idp_plan_ownerService
{
private IBaseRepository2<eva_idp_planEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
public eva_idp_plan_ownerService(IBaseRepository2<eva_idp_planEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext)
{
_repository = repository;
db = mydb;
ext = inext;
}
#region Private Functions
private eva_idp_planEntity GetEntity(eva_idp_plan_ownerInputModel model)
{
return Mapper.Map<eva_idp_planEntity>(model);
}
private List<eva_idp_planEntity> GetEntityList(List<eva_idp_plan_ownerInputModel> models)
{
return Mapper.Map<List<eva_idp_planEntity>>(models);
}
private eva_idp_plan_ownerViewModel GetDto(eva_idp_planEntity entity)
{
return Mapper.Map<eva_idp_plan_ownerViewModel>(entity);
}
private List<eva_idp_plan_ownerViewModel> GetDtoList(List<eva_idp_planEntity> entities)
{
return Mapper.Map<List<eva_idp_plan_ownerViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public eva_idp_plan_ownerViewModel Get(int id)
{
var entity = _repository.Get(id);
return GetDto(entity);
}
public eva_idp_plan_ownerWithSelectionViewModel GetWithSelection(int id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<eva_idp_plan_ownerWithSelectionViewModel>(entity);
return i;
}
public eva_idp_plan_ownerWithSelectionViewModel GetBlankItem()
{
var i = new eva_idp_plan_ownerWithSelectionViewModel();
return i;
}
public List<eva_idp_plan_ownerViewModel> GetListBycreate_evaluation_detail_id(int? create_evaluation_detail_id)
{
var model = new eva_idp_plan_ownerSearchModel();
model.create_evaluation_detail_id = create_evaluation_detail_id;
return GetListBySearch(model);
}
public List<eva_idp_plan_ownerViewModel> GetListBySearch(eva_idp_plan_ownerSearchModel model)
{
var data = (
from m_eva_idp_plan_owner in _repository.Context.eva_idp_plan
where 1==1
//&& (m_eva_idp_plan_owner.id == model.id || !model.id.HasValue)
&& (m_eva_idp_plan_owner.create_evaluation_detail_id == model.create_evaluation_detail_id || !model.create_evaluation_detail_id.HasValue)
orderby m_eva_idp_plan_owner.created descending
select new eva_idp_plan_ownerViewModel()
{
id = m_eva_idp_plan_owner.id,
create_evaluation_detail_id = m_eva_idp_plan_owner.create_evaluation_detail_id,
develop = m_eva_idp_plan_owner.develop,
development_method = m_eva_idp_plan_owner.development_method,
start_date = m_eva_idp_plan_owner.start_date,
end_date = m_eva_idp_plan_owner.end_date,
isActive = m_eva_idp_plan_owner.isActive,
Created = m_eva_idp_plan_owner.created,
Updated = m_eva_idp_plan_owner.updated
}
).Take(100).ToList();
return data;
}
#endregion
#region Manipulation Functions
public int GetNewPrimaryKey()
{
int? newkey = 0;
var x = (from i in _repository.Context.eva_idp_plan
orderby i.id descending
select i).Take(1).ToList();
if(x.Count > 0)
{
newkey = x[0].id + 1;
}
return newkey.Value;
}
public eva_idp_plan_ownerViewModel Insert(eva_idp_plan_ownerInputModel model)
{
var entity = GetEntity(model);
entity.id = GetNewPrimaryKey();
var inserted = _repository.Insert(entity);
return Get(inserted.id);
}
public eva_idp_plan_ownerViewModel Update(int id, eva_idp_plan_ownerInputModel model)
{
var existingEntity = _repository.Get(id);
if (existingEntity != null)
{
existingEntity.create_evaluation_detail_id = model.create_evaluation_detail_id;
existingEntity.develop = model.develop;
existingEntity.development_method = model.development_method;
existingEntity.start_date = model.start_date;
existingEntity.end_date = model.end_date;
var updated = _repository.Update(id, existingEntity);
return Get(updated.id);
}
else
throw new NotificationException("No data to update");
}
public string UpdateMultiple(List<eva_idp_plan_ownerInputModel> 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_detail_id = i.create_evaluation_detail_id;
existingEntity.develop = i.develop;
existingEntity.development_method = i.development_method;
existingEntity.start_date = i.start_date;
existingEntity.end_date = i.end_date;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}
}
else if (i.active_mode == "1" && !i.id.HasValue) // add
{
var entity = GetEntity(i);
entity.id = GetNewPrimaryKey();
_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();
return model.Count().ToString();
}
public eva_idp_plan_ownerViewModel SetAsActive(int id)
{
var updated = _repository.SetAsActive(id);
return Get(updated.id);
}
public eva_idp_plan_ownerViewModel SetAsInactive(int id)
{
var updated = _repository.SetAsInActive(id);
return Get(updated.id);
}
public void Delete(int id)
{
_repository.Delete(id);
return;
}
private Dictionary<string,string> GetLookupForLog()
{
var i = new Dictionary<string, string>();
i.Add("create_evaluation_detail_id", "create_evaluation_detail_id");
i.Add("develop", "ความรู้/ทักษะ/สมรรถนะที่ต้องได้รับการพัฒนา");
i.Add("development_method", "วิธีการพัฒนา");
i.Add("start_date", "ช่วงเวลาเริ่มต้นพัฒนา");
i.Add("txt_start_date", "ช่วงเวลาเริ่มต้นพัฒนา");
i.Add("end_date", "ช่วงเวลาสิ้นสุดพัฒนา");
i.Add("txt_end_date", "ช่วงเวลาสิ้นสุดพัฒนา");
return i;
}
#endregion
#region Match Item
#endregion
#endregion
}
}

View File

@@ -0,0 +1,33 @@
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_idp_plan_ownerViewModel : BaseViewModel2<int>
{
public int? create_evaluation_detail_id { get; set; }
public string develop { get; set; }
public string development_method { get; set; }
public DateTime? start_date { get; set; }
public string txt_start_date { get { return MyHelper.GetDateStringForReport(this.start_date); } }
public DateTime? end_date { get; set; }
public string txt_end_date { get { return MyHelper.GetDateStringForReport(this.end_date); } }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TodoAPI2.Models
{
public class eva_idp_plan_ownerWithSelectionViewModel: eva_idp_plan_ownerViewModel
{
}
}

View File

@@ -292,6 +292,8 @@ namespace Test01
services.AddScoped<IBaseRepository2<eva_temp_fingerscanEntity, string>, BaseRepository2<eva_temp_fingerscanEntity, string>>();
services.AddScoped<Ieva_temp_fingerscanService, eva_temp_fingerscanService>();
services.AddScoped<Ieva_idp_plan_ownerService, eva_idp_plan_ownerService>();
#endregion
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
@@ -499,6 +501,10 @@ namespace Test01
cfg.CreateMap<eva_idp_planEntity, eva_idp_planViewModel>();
cfg.CreateMap<eva_idp_planEntity, eva_idp_planWithSelectionViewModel>();
cfg.CreateMap<eva_idp_plan_ownerInputModel, eva_idp_planEntity>();
cfg.CreateMap<eva_idp_planEntity, eva_idp_plan_ownerViewModel>();
cfg.CreateMap<eva_idp_planEntity, eva_idp_plan_ownerWithSelectionViewModel>();
});
#endregion

View File

@@ -12,7 +12,6 @@
@Environment.GetEnvironmentVariable("JasperReportServer_MainURL")
@Environment.GetEnvironmentVariable("JasperReportServer_reportsite")
@Environment.GetEnvironmentVariable("JasperReportServer_username")
@Environment.GetEnvironmentVariable("JasperReportServer_password")
">
<title>@Environment.GetEnvironmentVariable("SiteInformation_sitename")</title>

View File

@@ -143,6 +143,57 @@
</div>
</div>
<div class="modal fade" id="eva_idp_plan_ownerModel" style="z-index:1500" tabindex="-1" role="dialog" aria-labelledby="eva_idp_plan_ownerModelLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="eva_idp_plan_ownerModelLabel">บันทึกข้อมูล แผนพัฒนาการปฏิบัติงานรายบุคคล</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<input class="form-control" type="hidden" id="eva_idp_plan_owner_create_evaluation_detail_id" />
<div class='row'>
<div class="form-group col-md-6">
<label id="lab_eva_idp_plan_owner_develop" for="eva_idp_plan_owner_develop">ความรู้/ทักษะ/สมรรถนะที่ต้องได้รับการพัฒนา</label>
<textarea class="form-control" rows="4" cols="50" id="eva_idp_plan_owner_develop" iLabel="ความรู้/ทักษะ/สมรรถนะที่ต้องได้รับการพัฒนา" iRequire="true" iGroup="eva_idp_plan_owner"></textarea>
</div>
<div class="form-group col-md-6">
<label id="lab_eva_idp_plan_owner_development_method" for="eva_idp_plan_owner_development_method">วิธีการพัฒนา</label>
<textarea class="form-control" rows="4" cols="50" id="eva_idp_plan_owner_development_method" iLabel="วิธีการพัฒนา" iRequire="false" iGroup="eva_idp_plan_owner"></textarea>
</div>
</div>
<div class='row'>
<div class="form-group col-md-6">
<label id="lab_eva_idp_plan_owner_start_date" for="eva_idp_plan_owner_start_date">ช่วงเวลาเริ่มต้นพัฒนา</label>
<input class="form-control" type="text" id="eva_idp_plan_owner_start_date" data-provide="datepicker" data-date-language="th-th" iLabel="ช่วงเวลาเริ่มต้นพัฒนา" iRequire="false" iGroup="eva_idp_plan_owner" />
</div>
<div class="form-group col-md-6">
<label id="lab_eva_idp_plan_owner_end_date" for="eva_idp_plan_owner_end_date">ช่วงเวลาสิ้นสุดพัฒนา</label>
<input class="form-control" type="text" id="eva_idp_plan_owner_end_date" data-provide="datepicker" data-date-language="th-th" iLabel="ช่วงเวลาสิ้นสุดพัฒนา" iRequire="false" iGroup="eva_idp_plan_owner" />
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">ยกเลิก</button>
<button type="button" class="btn btn-primary" onclick="javascript:eva_idp_plan_owner_PutUpdate()">บันทึก</button>
</div>
</div>
</div>
</div>
<div class="row page-title">
<div class="col-md-5">
<div class="page-title">
@@ -297,6 +348,38 @@
<p style="display:none;" id="sum_b"></p>
<br />
<section class="wrapper">
<div class="title"><div class="line"></div>แผนพัฒนาการปฏิบัติงานรายบุคคล</div>
<div class="tools">
<div class="row">
<input class="form-control" type="hidden" id="s_eva_idp_plan_owner_create_evaluation_detail_id" />
<div class="col-md-3">
<button class="btn btn-info" onclick="javascript:eva_idp_plan_owner_GoCreate();"><i class="fa fa-plus" style="font-size: 14px;"></i> เพิ่มรายการ</button>
</div>
</div>
</div>
<table id="eva_idp_plan_ownerTable" class="display table table-bordered table-striped">
<thead>
<tr>
<th>เครื่องมือ</th>
<th><label id='h_eva_idp_plan_owner_develop'>ความรู้/ทักษะ/สมรรถนะที่ต้องได้รับการพัฒนา</label></th>
<th><label id='h_eva_idp_plan_owner_development_method'>วิธีการพัฒนา</label></th>
<th><label id='h_eva_idp_plan_owner_start_date'>ช่วงเวลาเริ่มต้นพัฒนา</label></th>
<th><label id='h_eva_idp_plan_owner_end_date'>ช่วงเวลาสิ้นสุดพัฒนา</label></th>
</tr>
</thead>
<tbody></tbody>
</table>
</section>
<br />
<section class="wrapper">
<div class="title col-md-12"><div class="line"></div>ส่งข้อตกลงการประเมิน</div>
@@ -321,6 +404,7 @@
<script src="~/js/eva_evaluation_achievement/eva_evaluation_achievement.js"></script>
<script src="~/js/eva_evaluation_behavior/eva_evaluation_behavior.js"></script>
<script src="~/js/eva_create_evaluation_detail_status/eva_create_evaluation_detail_status_d.js"></script>
<script src="~/js/eva_idp_plan_owner/eva_idp_plan_owner.js"></script>
<script>
$(document).ready(function () {
var id = getUrlParameter("id");
@@ -331,12 +415,16 @@
eva_evaluation_behavior_InitiateDataTable(id);
eva_evaluation_behavior_InitialForm();
eva_create_evaluation_detail_status_SetEditForm(id);
eva_idp_plan_owner_InitiateDataTable(id);
eva_idp_plan_owner_InitialForm();
} else {
eva_create_evaluation_detail_agreement_SetCreateForm();
}
SetupValidationRemark("eva_create_evaluation_detail_agreement");
SetupValidationRemark("eva_evaluation_achievement");
SetupValidationRemark("eva_evaluation_behavior");
SetupValidationRemark("eva_idp_plan_owner");
});
</script>
}

View File

@@ -171,7 +171,7 @@
<th>ลำดับ</th>
<th width="30%"><label>ผลสัมฤทธิ์ตัวชี้วัดผลงาน</label></th>
<th><label>น้ำหนัก</label></th>
<th><label>น้ำหนัก (%)</label></th>
<th><label>1</label></th>
<th><label>2</label></th>
@@ -179,7 +179,7 @@
<th><label>4</label></th>
<th><label>5</label></th>
<th width="10%"><label>คะแนน</label></th>
<th width="10%"><label>คะแนน (ระบุ 1.00-5.00)</label></th>
<th width="10%"><label>รวมคะแนน</label></th>
</tr>
@@ -229,13 +229,13 @@
<tr>
<th>ลำดับ</th>
<th><label>พฤติกรรมการปฏิบัติงาน</label></th>
<th width="10%"><label>น้ำหนัก</label></th>
<th width="10%"><label>น้ำหนัก (%)</label></th>
<th width="7%"><label>1</label></th>
<th width="7%"><label>2</label></th>
<th width="7%"><label>3</label></th>
<th width="7%"><label>4</label></th>
<th width="7%"><label>5</label></th>
<th width="15%"><label>คะแนน</label></th>
<th width="15%"><label>คะแนน (ระบุ 1.00-5.00)</label></th>
<th width="10%"><label>รวมคะแนน</label></th>
</tr>
</thead>
@@ -282,7 +282,7 @@
<thead>
<tr>
<th><label>คะแนนประเมิน</label></th>
<th><label>น้ำหนัก</label></th>
<th><label>น้ำหนัก (%)</label></th>
<th><label>คะแนน</label></th>
<th><label>รวมคะแนน</label></th>
</tr>
@@ -340,7 +340,7 @@
<div class='row'>
<div class="form-group col-md-6">
<label id="lab_eva_create_evaluation_detail_review01_supervisor1_date" for="eva_create_evaluation_detail_review01_supervisor1_date">วันที่ประเมิน</label>
<input class="form-control" type="text" id="eva_create_evaluation_detail_review01_supervisor1_date" data-provide="datepicker" data-date-language="th-th" iLabel="วันที่ประเมิน" iRequire="true" iGroup="eva_create_evaluation_detail_review01" />
<input disabled class="form-control" type="text" id="eva_create_evaluation_detail_review01_supervisor1_date" data-provide="datepicker" data-date-language="th-th" iLabel="วันที่ประเมิน" iRequire="false" iGroup="eva_create_evaluation_detail_review01" />
</div>
</div>
<div class='row'>

View File

@@ -23,23 +23,23 @@
<div class='row'>
<div class="form-group col-md-6">
<label id="lab_eva_idp_plan_develop" for="eva_idp_plan_develop">ความรู้/ทักษะ/สมรรถนะที่ต้องได้รับการพัฒนา</label>
<textarea class="form-control" rows="4" cols="50" id="eva_idp_plan_develop" iLabel="ความรู้/ทักษะ/สมรรถนะที่ต้องได้รับการพัฒนา" iRequire="true" iGroup="eva_idp_plan"></textarea>
<textarea disabled class="form-control" rows="4" cols="50" id="eva_idp_plan_develop" iLabel="ความรู้/ทักษะ/สมรรถนะที่ต้องได้รับการพัฒนา" iRequire="true" iGroup="eva_idp_plan"></textarea>
</div>
<div class="form-group col-md-6">
<label id="lab_eva_idp_plan_development_method" for="eva_idp_plan_development_method">วิธีการพัฒนา</label>
<textarea class="form-control" rows="4" cols="50" id="eva_idp_plan_development_method" iLabel="วิธีการพัฒนา" iRequire="true" iGroup="eva_idp_plan"></textarea>
<textarea disabled class="form-control" rows="4" cols="50" id="eva_idp_plan_development_method" iLabel="วิธีการพัฒนา" iRequire="false" iGroup="eva_idp_plan"></textarea>
</div>
</div>
<div class='row'>
<div class="form-group col-md-6">
<label id="lab_eva_idp_plan_start_date" for="eva_idp_plan_start_date">ช่วงเวลาเริ่มต้นพัฒนา</label>
<input class="form-control" type="text" id="eva_idp_plan_start_date" data-provide="datepicker" data-date-language="th-th" iLabel="ช่วงเวลาเริ่มต้นพัฒนา" iRequire="true" iGroup="eva_idp_plan" />
<input disabled class="form-control" type="text" id="eva_idp_plan_start_date" data-provide="datepicker" data-date-language="th-th" iLabel="ช่วงเวลาเริ่มต้นพัฒนา" iRequire="false" iGroup="eva_idp_plan" />
</div>
<div class="form-group col-md-6">
<label id="lab_eva_idp_plan_end_date" for="eva_idp_plan_end_date">ช่วงเวลาสิ้นสุดพัฒนา</label>
<input class="form-control" type="text" id="eva_idp_plan_end_date" data-provide="datepicker" data-date-language="th-th" iLabel="ช่วงเวลาสิ้นสุดพัฒนา" iRequire="true" iGroup="eva_idp_plan" />
<input disabled class="form-control" type="text" id="eva_idp_plan_end_date" data-provide="datepicker" data-date-language="th-th" iLabel="ช่วงเวลาสิ้นสุดพัฒนา" iRequire="false" iGroup="eva_idp_plan" />
</div>
</div>
@@ -47,7 +47,7 @@
</div>
</div>
</div>
<div class="modal-footer">
<div class="modal-footer" style="display:none;">
<button type="button" class="btn btn-secondary" data-dismiss="modal">ยกเลิก</button>
<button type="button" class="btn btn-primary" onclick="javascript:eva_idp_plan_PutUpdate()">บันทึก</button>
</div>
@@ -234,7 +234,7 @@
<th><label>คะแนน</label></th>
<th><label>รวมคะแนน</label></th>
<th><label>คะแนน</label></th>
<th><label>คะแนน <br />(ระบุ 1.00-5.00)</label></th>
<th><label>รวมคะแนน</label></th>
</tr>
@@ -292,7 +292,7 @@
<th width="7%"><label>5</label></th>
<th width="8%"><label>คะแนน</label></th>
<th width="8%"><label>รวมคะแนน</label></th>
<th width="13%"><label>คะแนน</label></th>
<th width="13%"><label>คะแนน <br/>(ระบุ 1.00-5.00)</label></th>
<th width="8%"><label>รวมคะแนน</label></th>
</tr>
</thead>
@@ -384,7 +384,7 @@
<section class="wrapper">
<div class="title"><div class="line"></div>แผนพัฒนาการปฏิบัติงานรายบุคคล</div>
<div class="tools">
<div class="tools" style="display:none;">
<div class="row">
<input class="form-control" type="hidden" id="s_eva_idp_plan_create_evaluation_detail_id" />
@@ -399,7 +399,6 @@
<table id="eva_idp_planTable" class="display table table-bordered table-striped">
<thead>
<tr>
<th>เครื่องมือ</th>
<th><label id='h_eva_idp_plan_develop'>ความรู้/ทักษะ/สมรรถนะที่ต้องได้รับการพัฒนา</label></th>
<th><label id='h_eva_idp_plan_development_method'>วิธีการพัฒนา</label></th>
<th><label id='h_eva_idp_plan_start_date'>ช่วงเวลาเริ่มต้นพัฒนา</label></th>
@@ -466,7 +465,7 @@
<div class="form-group col-md-6">
<label id="lab_eva_create_evaluation_detail_review02_supervisor2_date" for="eva_create_evaluation_detail_review02_supervisor2_date">วันที่ประเมิน</label>
<input class="form-control" type="text" id="eva_create_evaluation_detail_review02_supervisor2_date" data-provide="datepicker" data-date-language="th-th" iLabel="วันที่ประเมิน" iRequire="true" iGroup="eva_create_evaluation_detail_review02" />
<input disabled class="form-control" type="text" id="eva_create_evaluation_detail_review02_supervisor2_date" data-provide="datepicker" data-date-language="th-th" iLabel="วันที่ประเมิน" iRequire="false" iGroup="eva_create_evaluation_detail_review02" />
</div>
</div>
<div class='row'>

View File

@@ -2730,6 +2730,103 @@
<response code="400">If the model is invalid</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_idp_plan_ownerController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_idp_plan_ownerController},TodoAPI2.Models.Ieva_idp_plan_ownerService,Microsoft.Extensions.Configuration.IConfiguration)">
<summary>
Default constructure for dependency injection
</summary>
<param name="repository"></param>
<param name="configuration"></param>
<param name="logger"></param>
</member>
<member name="M:TodoAPI2.Controllers.eva_idp_plan_ownerController.Get(System.Int32)">
<summary>
Get specific item by id
</summary>
<remarks>
</remarks>
<returns>Return Get specific item by id</returns>
<response code="200">Returns the item</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_idp_plan_ownerController.GetBlankItem">
<summary>
Get Blank Item
</summary>
<remarks>
</remarks>
<returns>Return a blank item</returns>
<response code="200">Returns the item</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_idp_plan_ownerController.GetList(System.Nullable{System.Int32})">
<summary>
Get list items by create_evaluation_detail_id
</summary>
<remarks>
</remarks>
<returns>Return list of items by specifced keyword</returns>
<response code="200">Returns the item</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_idp_plan_ownerController.GetListBySearch(TodoAPI2.Models.eva_idp_plan_ownerSearchModel)">
<summary>
Get list items by search
</summary>
<remarks>
</remarks>
<returns>Return list of items by specifced keyword</returns>
<response code="200">Returns the item</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_idp_plan_ownerController.Insert(TodoAPI2.Models.eva_idp_plan_ownerInputModel)">
<summary>
Create new item
</summary>
<remarks>
</remarks>
<param name="model"></param>
<returns>Response Result Message</returns>
<response code="200">Response Result Message</response>
<response code="400">If the model is invalid</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_idp_plan_ownerController.Update(System.Int32,TodoAPI2.Models.eva_idp_plan_ownerInputModel)">
<summary>
Update item
</summary>
<remarks>
</remarks>
<param name="id"></param>
<param name="model"></param>
<returns>Response Result Message</returns>
<response code="200">Response Result Message</response>
<response code="400">If the model is invalid</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_idp_plan_ownerController.Delete(System.Int32)">
<summary>
Delete item
</summary>
<remarks>
</remarks>
<param name="id"></param>
<returns>Response Result Message</returns>
<response code="200">Response Result Message</response>
<response code="400">If the model is invalid</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_idp_plan_ownerController.UpdateMultiple(System.Collections.Generic.List{TodoAPI2.Models.eva_idp_plan_ownerInputModel})">
<summary>
Update multiple item
</summary>
<remarks>
</remarks>
<param name="model"></param>
<returns>Response Result Message</returns>
<response code="200">Response Result Message</response>
<response code="400">If the model is invalid</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.eva_level_scoreController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.eva_level_scoreController},TodoAPI2.Models.Ieva_level_scoreService,Microsoft.Extensions.Configuration.IConfiguration)">
<summary>
Default constructure for dependency injection

View File

@@ -46,9 +46,9 @@ $("#eva_create_evaluation_detail_process_search_employee_fullname").val(data.sea
//console.log(data);
item_level_score = data.item_level_score;
$("#w1").text(data.create_evaluation_score1.toFixed(2)+"%");
$("#w2").text(data.create_evaluation_score2.toFixed(2)+"%");
$("#w3").text((data.create_evaluation_score1+data.create_evaluation_score2).toFixed(2)+"%");
$("#w1").text(data.create_evaluation_score1.toFixed(2));
$("#w2").text(data.create_evaluation_score2.toFixed(2));
$("#w3").text((data.create_evaluation_score1+data.create_evaluation_score2).toFixed(2));
}

View File

@@ -185,9 +185,9 @@ function setPageByRoleAndStatus(role_code, status_self, status_chief, status_sup
$("#btn03").show();
$("#btnb01").show();
$("#btnb02").show();
$("#btnb03").show();
//$("#btnb03").show();
$("#eva_create_evaluation_detail_review02_supervisor2_result").attr("disabled", false);
$("#eva_create_evaluation_detail_review02_supervisor2_date").attr("disabled", false);
//$("#eva_create_evaluation_detail_review02_supervisor2_date").attr("disabled", false);
$("#eva_create_evaluation_detail_review02_supervisor2_remark").attr("disabled", false);
}else{
$("#thestatus").text("(ผู้รับการประเมิน หรือ ผู้ประเมิน ยังไม่ส่งแบบประเมิน คุณจึงไม่สามารถให้ความเห็นได้)");
@@ -214,7 +214,7 @@ function setPageByRoleAndStatus(role_code, status_self, status_chief, status_sup
$("#eva_create_evaluation_detail_review03_supervisor1A_remark").attr("disabled", false);
$("#btnc01").show();
$("#btnc02").show();
$("#btnc03").show();
//$("#btnc03").show();
}else{
$("#thestatus1A").text("(ผู้รับการประเมิน หรือ ผู้ประเมิน หรือ ผู้ประเมินสูงสุด ยังไม่ส่งแบบประเมิน คุณจึงไม่สามารถให้ความเห็นได้)");
}
@@ -237,7 +237,7 @@ function setPageByRoleAndStatus(role_code, status_self, status_chief, status_sup
$("#eva_create_evaluation_detail_review04_supervisor2A_remark").attr("disabled", false);
$("#btnd01").show();
$("#btnd02").show();
$("#btnd03").show();
//$("#btnd03").show();
}else{
$("#thestatus2A").text("(ผู้รับการประเมิน หรือ ผู้ประเมิน หรือ ผู้ประเมินสูงสุด หรือ ผู้บังคับบัญชาการเหนือขึ้นไปอีกชั้นหนึ่ง ยังไม่ส่งแบบประเมิน คุณจึงไม่สามารถให้ความเห็นได้)");
}

View File

@@ -125,7 +125,6 @@ function Oneva_evaluation_achievement_process_scoreChange(){
$("#h_eva_evaluation_achievement_process_score").text(total_achievement_score.toFixed(2));
var w1 = parseFloat($("#w1").text());
console.log(w1);
$("#eva_create_evaluation_detail_summary1_total_summary_chief").text((total_achievement * 20).toFixed(2));
$("#eva_create_evaluation_detail_summary1_Final_summary_chief").text((total_achievement * 20).toFixed(2));

View File

@@ -159,20 +159,13 @@ var eva_idp_plan_setupTable = function (result) {
"data": result,
"select": false,
"columns": [
{ "data": "id" },
{ "data": "develop" },
{ "data": "development_method" },
{ "data": "txt_start_date" },
{ "data": "txt_end_date" },
],
"columnDefs": [
{
"targets": 0,
"data": "id",
"render": function (data, type, row, meta) {
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:eva_idp_plan_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_idp_plan_GoDelete(" + tmp + data + tmp + ")'><i class='fa fa-trash-o '></i></button> ";
}
}],
],
"language": {
"url": appsite + "/DataTables-1.10.16/thai.json"
},

View File

@@ -0,0 +1,218 @@
var eva_idp_plan_owner_editMode = "CREATE";
var eva_idp_plan_owner_API = "/api/eva_idp_plan_owner/";
//================= Search Customizaiton =========================================
function eva_idp_plan_owner_GetSearchParameter() {
var eva_idp_plan_ownerSearchObject = new Object();
eva_idp_plan_ownerSearchObject.create_evaluation_detail_id = getUrlParameter("id");
return eva_idp_plan_ownerSearchObject;
}
function eva_idp_plan_owner_FeedDataToSearchForm(data) {
$("#s_eva_idp_plan_owner_create_evaluation_detail_id").val(data.create_evaluation_detail_id);
}
//================= Form Data Customizaiton =========================================
function eva_idp_plan_owner_FeedDataToForm(data) {
$("#eva_idp_plan_owner_id").val(data.id);
$("#eva_idp_plan_owner_create_evaluation_detail_id").val(data.create_evaluation_detail_id);
$("#eva_idp_plan_owner_develop").val(data.develop);
$("#eva_idp_plan_owner_development_method").val(data.development_method);
$("#eva_idp_plan_owner_start_date").val(formatDate(data.start_date));
$("#eva_idp_plan_owner_end_date").val(formatDate(data.end_date));
}
function eva_idp_plan_owner_GetFromForm() {
var eva_idp_plan_ownerObject = new Object();
eva_idp_plan_ownerObject.id = $("#eva_idp_plan_owner_id").val();
eva_idp_plan_ownerObject.create_evaluation_detail_id = getUrlParameter("id");
eva_idp_plan_ownerObject.develop = $("#eva_idp_plan_owner_develop").val();
eva_idp_plan_ownerObject.development_method = $("#eva_idp_plan_owner_development_method").val();
eva_idp_plan_ownerObject.start_date = getDate($("#eva_idp_plan_owner_start_date").val());
eva_idp_plan_ownerObject.end_date = getDate($("#eva_idp_plan_owner_end_date").val());
return eva_idp_plan_ownerObject;
}
function eva_idp_plan_owner_InitialForm(s) {
var successFunc = function (result) {
eva_idp_plan_owner_FeedDataToForm(result);
eva_idp_plan_owner_FeedDataToSearchForm(result);
if (s) {
// Incase model popup
$("#eva_idp_plan_ownerModel").modal("show");
}
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_idp_plan_owner_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function eva_idp_plan_owner_GoCreate() {
// Incase model popup
eva_idp_plan_owner_SetCreateForm(true);
// Incase open new page
//window_open(appsite + "/eva_idp_plan_ownerView/eva_idp_plan_owner_d");
}
function eva_idp_plan_owner_GoEdit(a) {
// Incase model popup
eva_idp_plan_owner_SetEditForm(a);
// Incase open new page
//window_open(appsite + "/eva_idp_plan_ownerView/eva_idp_plan_owner_d?id=" + a);
}
function eva_idp_plan_owner_SetEditForm(a) {
var successFunc = function (result) {
eva_idp_plan_owner_editMode = "UPDATE";
eva_idp_plan_owner_FeedDataToForm(result);
$("#eva_idp_plan_ownerModel").modal("show");
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_idp_plan_owner_API + a, successFunc, AlertDanger);
}
function eva_idp_plan_owner_SetCreateForm(s) {
eva_idp_plan_owner_editMode = "CREATE";
eva_idp_plan_owner_InitialForm(s);
}
function eva_idp_plan_owner_RefreshTable() {
// Incase model popup
eva_idp_plan_owner_DoSearch();
// Incase open new page
//window.parent.eva_idp_plan_owner_DoSearch();
}
//================= Update and Delete =========================================
var eva_idp_plan_owner_customValidation = function (group) {
return "";
};
function eva_idp_plan_owner_PutUpdate() {
if (!ValidateForm('eva_idp_plan_owner', eva_idp_plan_owner_customValidation))
{
return;
}
var data = eva_idp_plan_owner_GetFromForm();
//Update Mode
if (eva_idp_plan_owner_editMode === "UPDATE") {
var successFunc1 = function (result) {
$("#eva_idp_plan_ownerModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_idp_plan_owner_RefreshTable();
endLoad();
};
startLoad();
AjaxPutRequest(apisite + eva_idp_plan_owner_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
else {
var successFunc2 = function (result) {
$("#eva_idp_plan_ownerModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_idp_plan_owner_RefreshTable();
endLoad();
};
startLoad();
AjaxPostRequest(apisite + eva_idp_plan_owner_API, data, successFunc2, AlertDanger);
}
}
function eva_idp_plan_owner_GoDelete(a) {
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
var successFunc = function (result) {
$("#eva_idp_plan_ownerModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_idp_plan_owner_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + eva_idp_plan_owner_API + a, null, successFunc, AlertDanger);
}
}
//================= Data Table =========================================
var eva_idp_plan_ownerTableV;
var eva_idp_plan_owner_setupTable = function (result) {
tmp = '"';
eva_idp_plan_ownerTableV = $('#eva_idp_plan_ownerTable').DataTable({
"processing": true,
"serverSide": false,
"data": result,
"select": false,
"columns": [
{ "data": "id" },
{ "data": "develop" },
{ "data": "development_method" },
{ "data": "txt_start_date" },
{ "data": "txt_end_date" },
],
"columnDefs": [
{
"targets": 0,
"data": "id",
"render": function (data, type, row, meta) {
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:eva_idp_plan_owner_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_idp_plan_owner_GoDelete(" + tmp + data + tmp + ")'><i class='fa fa-trash-o '></i></button> ";
}
}],
"language": {
"url": appsite + "/DataTables-1.10.16/thai.json"
},
"paging": true,
"searching": false
});
endLoad();
};
function eva_idp_plan_owner_InitiateDataTable() {
startLoad();
var p = $.param(eva_idp_plan_owner_GetSearchParameter());
console.log(apisite + "/api/eva_idp_plan_owner/GetListBySearch?"+p);
AjaxGetRequest(apisite + "/api/eva_idp_plan_owner/GetListBySearch?"+p, eva_idp_plan_owner_setupTable, AlertDanger);
}
function eva_idp_plan_owner_DoSearch() {
var p = $.param(eva_idp_plan_owner_GetSearchParameter());
var eva_idp_plan_owner_reload = function (result) {
eva_idp_plan_ownerTableV.destroy();
eva_idp_plan_owner_setupTable(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_idp_plan_owner/GetListBySearch?"+p, eva_idp_plan_owner_reload, AlertDanger);
}
function eva_idp_plan_owner_GetSelect(f) {
var eva_idp_plan_owner_selectitem = [];
$.each(eva_idp_plan_ownerTableV.rows('.selected').data(), function (key, value) {
eva_idp_plan_owner_selectitem.push(value[f]);
});
alert(eva_idp_plan_owner_selectitem);
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================