ปรับปรุง รายงานประวัติการเลื่อนเงินเดือนรายบุคคล #1

This commit is contained in:
LAPTOP-KB8JC2K2\acer
2021-03-24 20:53:25 +07:00
parent aa9be494f7
commit 4859e4bdbd
16 changed files with 870 additions and 0 deletions

View File

@@ -0,0 +1,164 @@
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/vw_eva_performance_plan")]
public class vw_eva_performance_planController : BaseController
{
#region Private Variables
private ILogger<vw_eva_performance_planController> _logger;
private Ivw_eva_performance_planService _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 vw_eva_performance_planController(ILogger<vw_eva_performance_planController> logger, Ivw_eva_performance_planService 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(vw_eva_performance_planWithSelectionViewModel), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult Get(Guid 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(vw_eva_performance_planWithSelectionViewModel), 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 fiscal_year
/// </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<vw_eva_performance_planViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetList(int? fiscal_year)
{
try
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
return Ok(_repository.GetListByfiscal_year(fiscal_year));
}
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<vw_eva_performance_planViewModel>), 200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
//[ValidateAntiForgeryToken]
public IActionResult GetListBySearch(vw_eva_performance_planSearchModel 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}");
}
}
}
}

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 Ivw_eva_performance_planService
{
List<vw_eva_performance_planViewModel> GetListByfiscal_year(int? fiscal_year);
List<vw_eva_performance_planViewModel> GetListBySearch(vw_eva_performance_planSearchModel model);
vw_eva_performance_planWithSelectionViewModel GetWithSelection(Guid id);
vw_eva_performance_planWithSelectionViewModel GetBlankItem();
eva_performance_planEntity GetEntity(Guid id);
DataContext GetContext();
}
}

View File

@@ -0,0 +1,26 @@
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 vw_eva_performance_planInputModel
{
public Guid? id { get; set; }
public int? fiscal_year { get; set; }
public int? theTime { 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 vw_eva_performance_planReportRequestModel : vw_eva_performance_planSearchModel
{
public string filetype { get; set; }
public string contentType { get { return MyHelper.GetContentType(filetype); } }
}
}

View File

@@ -0,0 +1,25 @@
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 vw_eva_performance_planSearchModel
{
public Guid id { get; set; }
public int? fiscal_year { get; set; }
public int? theTime { get; set; }
}
}

View File

@@ -0,0 +1,133 @@
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 vw_eva_performance_planService : Ivw_eva_performance_planService
{
private IBaseRepository<eva_performance_planEntity, Guid> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
public vw_eva_performance_planService(IBaseRepository<eva_performance_planEntity, Guid> repository, IMyDatabase mydb, Iexternal_linkageService inext)
{
_repository = repository;
db = mydb;
ext = inext;
}
#region Private Functions
private eva_performance_planEntity GetEntity(vw_eva_performance_planInputModel model)
{
return Mapper.Map<eva_performance_planEntity>(model);
}
private List<eva_performance_planEntity> GetEntityList(List<vw_eva_performance_planInputModel> models)
{
return Mapper.Map<List<eva_performance_planEntity>>(models);
}
private vw_eva_performance_planViewModel GetDto(eva_performance_planEntity entity)
{
return Mapper.Map<vw_eva_performance_planViewModel>(entity);
}
private List<vw_eva_performance_planViewModel> GetDtoList(List<eva_performance_planEntity> entities)
{
return Mapper.Map<List<vw_eva_performance_planViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public vw_eva_performance_planViewModel Get(Guid id)
{
var entity = _repository.Get(id);
return GetDto(entity);
}
public eva_performance_planEntity GetEntity(Guid id)
{
var entity = _repository.Get(id);
return entity;
}
public DataContext GetContext()
{
return _repository.Context;
}
public vw_eva_performance_planWithSelectionViewModel GetWithSelection(Guid id)
{
var entity = _repository.Get(id);
var i = Mapper.Map<vw_eva_performance_planWithSelectionViewModel>(entity);
return i;
}
public vw_eva_performance_planWithSelectionViewModel GetBlankItem()
{
var i = new vw_eva_performance_planWithSelectionViewModel();
return i;
}
public List<vw_eva_performance_planViewModel> GetListByfiscal_year(int? fiscal_year)
{
var model = new vw_eva_performance_planSearchModel();
model.fiscal_year = fiscal_year;
return GetListBySearch(model);
}
public List<vw_eva_performance_planViewModel> GetListBySearch(vw_eva_performance_planSearchModel model)
{
var data = (
from m_vw_eva_performance_plan in _repository.Context.eva_performance_plan
where
1 == 1
&& (!model.fiscal_year.HasValue || m_vw_eva_performance_plan.fiscal_year == model.fiscal_year)
&& (!model.theTime.HasValue || m_vw_eva_performance_plan.theTime == model.theTime)
orderby m_vw_eva_performance_plan.created descending
select new vw_eva_performance_planViewModel()
{
id = m_vw_eva_performance_plan.id,
fiscal_year = m_vw_eva_performance_plan.fiscal_year,
theTime = m_vw_eva_performance_plan.theTime,
isActive = m_vw_eva_performance_plan.isActive,
Created = m_vw_eva_performance_plan.created,
Updated = m_vw_eva_performance_plan.updated
}
).Take(1000).ToList();
return data;
}
#endregion
#endregion
}
}

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 vw_eva_performance_planViewModel : BaseViewModel2<Guid>
{
public int? fiscal_year { get; set; }
public int? theTime { get; set; }
}
}

View File

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

View File

@@ -325,6 +325,8 @@ namespace Test01
services.AddScoped<Ivw_limit_frame_planService, vw_limit_frame_planService>();
services.AddScoped<Ivw_eva_performance_planService, vw_eva_performance_planService>();
#endregion
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
@@ -604,6 +606,10 @@ namespace Test01
cfg.CreateMap<eva_limit_frame_planEntity, vw_limit_frame_planViewModel>();
cfg.CreateMap<eva_limit_frame_planEntity, vw_limit_frame_planWithSelectionViewModel>();
cfg.CreateMap<vw_limit_frame_planInputModel, eva_limit_frame_planEntity>();
cfg.CreateMap<eva_limit_frame_planEntity, vw_limit_frame_planViewModel>();
cfg.CreateMap<eva_limit_frame_planEntity, vw_limit_frame_planWithSelectionViewModel>();
});
#endregion

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using TodoAPI2.Models;
using STAFF_API.Models;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
using TodoAPI2.Controllers;
namespace TodoAPI2.Controllers
{
public class vw_eva_performance_planViewController : Controller
{
private ILogger<vw_eva_performance_planController> _logger;
private Ivw_eva_performance_planService _repository;
private IConfiguration Configuration { get; set; }
/// <summary>
/// Default constructure for dependency injection
/// </summary>
/// <param name="repository"></param>
/// <param name="configuration"></param>
/// <param name="logger"></param>
public vw_eva_performance_planViewController(ILogger<vw_eva_performance_planController> logger, Ivw_eva_performance_planService repository, IConfiguration configuration)
{
_logger = logger;
_repository = repository;
Configuration = configuration;
}
public IActionResult vw_eva_performance_plan()
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
return View();
}
public IActionResult vw_eva_performance_plan_d()
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
return View();
}
//public IActionResult vw_eva_performance_plan_report()
//{
// if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
// return View();
//}
//public IActionResult vw_eva_performance_plan_inline()
//{
// if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView
// return View();
//}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}

View File

@@ -26,6 +26,7 @@
<input class="form-control" type="hidden" id="s_rep_eva_self_review_all_employee_id" />
<div class="col-md-12">
<button class="btn btn-info" onclick="javascript:rep_eva_self_review_all_DoSearch('xlsx');">ดาวน์โหลดเป็น Excel</button>
<button class="btn btn-info" onclick="javascript:rep_eva_self_review_all_GoBack();">กลับ</button>
</div>
</div>
</div>

View File

@@ -0,0 +1,92 @@
@using Microsoft.Extensions.Configuration
@inject IConfiguration Configuration
@{
ViewData["Title"] = "vw_eva_performance_plan";
}
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>@Configuration["SiteInformation:modulename"]</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item "><a href="@Configuration["SiteInformation:mainsite"]">หน้าแรก</a></li>
<li class="breadcrumb-item "><a href="@Configuration["SiteInformation:mainsite"]@Configuration["SiteInformation:appsite"]">@Configuration["SiteInformation:modulename"]</a></li>
<li class="breadcrumb-item active">รายงานประวัติการเลื่อนเงินเดือนรายบุคคล</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<!-- general form elements -->
<div class="card card-primary">
<div class="card-body">
<div class="row">
<div class="form-group col-md-3">
<label id='lab_s_vw_eva_performance_plan_fiscal_year' for='s_vw_eva_performance_plan_fiscal_year'>ปีงบประมาณ</label>
<input class="form-control" type="number" id="s_vw_eva_performance_plan_fiscal_year" iLabel="ปีงบประมาณ" iRequire="false" iGroup="s_vw_eva_performance_plan" title='ปีงบประมาณ' placeholder='ปีงบประมาณ' />
</div>
<div class="form-group col-md-3">
<label id='lab_s_vw_eva_performance_plan_theTime' for='s_vw_eva_performance_plan_theTime'>รอบการประเมินที่</label>
<input class="form-control" type="number" id="s_vw_eva_performance_plan_theTime" iLabel="รอบการประเมินที่" iRequire="false" iGroup="s_vw_eva_performance_plan" title='รอบการประเมินที่' placeholder='รอบการประเมินที่' />
</div>
<div class="form-group col-sm-3">
<button class="btn btn-info" onclick="javascript:vw_eva_performance_plan_DoSearch();"><i class="fa fa-search" style="font-size: 14px;"></i> ค้นหา</button>
<button class="btn btn-info" onclick="javascript:vw_eva_performance_plan_GoAll();"><i class="fa fa-search" style="font-size: 14px;"></i> ดูรายการทั้งหมด</button>
</div>
</div>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
<!-- general form elements -->
<div class="card card-primary">
<div class="card-body">
<div class="row">
<div class="col-md-12">
<table id="vw_eva_performance_planTable" class="table table-hover text-nowrap">
<thead>
<tr>
<!--<th>เลือก</th>-->
<th>เครื่องมือ</th>
<th><label id='h_vw_eva_performance_plan_fiscal_year'>ปีงบประมาณ</label></th>
<th><label id='h_vw_eva_performance_plan_theTime'>รอบการประเมินที่</label></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div><!-- /.container-fluid -->
</section>
<!-- /.content -->
@section FooterPlaceHolder{
<script src="~/js/vw_eva_performance_plan/vw_eva_performance_plan.js"></script>
<script>
$(document).ready(function () {
vw_eva_performance_plan_InitiateDataTable();
vw_eva_performance_plan_InitialForm();
SetupValidationRemark("vw_eva_performance_plan");
});
</script>
}

View File

@@ -4794,6 +4794,54 @@
<response code="200">Returns the item</response>
<response code="500">Error Occurred</response>
</member>
<member name="M:TodoAPI2.Controllers.vw_eva_performance_planController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.vw_eva_performance_planController},TodoAPI2.Models.Ivw_eva_performance_planService,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.vw_eva_performance_planController.Get(System.Guid)">
<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.vw_eva_performance_planController.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.vw_eva_performance_planController.GetList(System.Nullable{System.Int32})">
<summary>
Get list items by fiscal_year
</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.vw_eva_performance_planController.GetListBySearch(TodoAPI2.Models.vw_eva_performance_planSearchModel)">
<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.vw_limit_frame_planController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.vw_limit_frame_planController},TodoAPI2.Models.Ivw_limit_frame_planService,Microsoft.Extensions.Configuration.IConfiguration)">
<summary>
Default constructure for dependency injection
@@ -5292,6 +5340,14 @@
<param name="configuration"></param>
<param name="logger"></param>
</member>
<member name="M:TodoAPI2.Controllers.vw_eva_performance_planViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.vw_eva_performance_planController},TodoAPI2.Models.Ivw_eva_performance_planService,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.vw_limit_frame_planViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.vw_limit_frame_planController},TodoAPI2.Models.Ivw_limit_frame_planService,Microsoft.Extensions.Configuration.IConfiguration)">
<summary>
Default constructure for dependency injection

View File

@@ -2,6 +2,10 @@
//================= Search Customizaiton =========================================
function rep_eva_self_review_all_GoBack() {
window.location = appsite + "/vw_eva_performance_planView/vw_eva_performance_plan";
}
function rep_eva_self_review_all_GetSearchParameter(fileType) {
var rep_eva_self_review_allSearchObject = new Object();
rep_eva_self_review_allSearchObject.employee_id = $("#s_rep_eva_self_review_all_employee_id").val();

View File

@@ -0,0 +1,213 @@
var vw_eva_performance_plan_editMode = "CREATE";
var vw_eva_performance_plan_API = "/api/vw_eva_performance_plan/";
//================= Search Customizaiton =========================================
function vw_eva_performance_plan_GetSearchParameter() {
var vw_eva_performance_planSearchObject = new Object();
vw_eva_performance_planSearchObject.fiscal_year = $("#s_vw_eva_performance_plan_fiscal_year").val();
vw_eva_performance_planSearchObject.theTime = $("#s_vw_eva_performance_plan_theTime").val();
return vw_eva_performance_planSearchObject;
}
function vw_eva_performance_plan_FeedDataToSearchForm(data) {
$("#s_vw_eva_performance_plan_fiscal_year").val(data.fiscal_year);
$("#s_vw_eva_performance_plan_theTime").val(data.theTime);
}
//================= Form Data Customizaiton =========================================
function vw_eva_performance_plan_FeedDataToForm(data) {
$("#vw_eva_performance_plan_id").val(data.id);
$("#vw_eva_performance_plan_fiscal_year").val(data.fiscal_year);
$("#vw_eva_performance_plan_theTime").val(data.theTime);
}
function vw_eva_performance_plan_GetFromForm() {
var vw_eva_performance_planObject = new Object();
vw_eva_performance_planObject.id = $("#vw_eva_performance_plan_id").val();
vw_eva_performance_planObject.fiscal_year = $("#vw_eva_performance_plan_fiscal_year").val();
vw_eva_performance_planObject.theTime = $("#vw_eva_performance_plan_theTime").val();
return vw_eva_performance_planObject;
}
function vw_eva_performance_plan_InitialForm(s) {
var successFunc = function (result) {
vw_eva_performance_plan_FeedDataToForm(result);
vw_eva_performance_plan_FeedDataToSearchForm(result);
if (s) {
// Incase model popup
$("#vw_eva_performance_planModel").modal("show");
}
endLoad();
};
startLoad();
AjaxGetRequest(apisite + vw_eva_performance_plan_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function vw_eva_performance_plan_GoAll() {
window.location = appsite + "/rep_eva_self_review_allView/rep_eva_self_review_all_report";
}
function vw_eva_performance_plan_GoEdit(a) {
alert("กำลังจัดทำ");
}
function vw_eva_performance_plan_SetEditForm(a) {
var successFunc = function (result) {
vw_eva_performance_plan_editMode = "UPDATE";
vw_eva_performance_plan_FeedDataToForm(result);
$("#vw_eva_performance_planModel").modal("show");
endLoad();
};
startLoad();
AjaxGetRequest(apisite + vw_eva_performance_plan_API + a, successFunc, AlertDanger);
}
function vw_eva_performance_plan_SetCreateForm(s) {
vw_eva_performance_plan_editMode = "CREATE";
vw_eva_performance_plan_InitialForm(s);
}
function vw_eva_performance_plan_RefreshTable() {
// Incase model popup
vw_eva_performance_plan_DoSearch();
// Incase open new page
//window.parent.vw_eva_performance_plan_DoSearch();
}
//================= Update and Delete =========================================
var vw_eva_performance_plan_customValidation = function (group) {
return "";
};
function vw_eva_performance_plan_PutUpdate() {
if (!ValidateForm('vw_eva_performance_plan', vw_eva_performance_plan_customValidation)) {
return;
}
var data = vw_eva_performance_plan_GetFromForm();
//Update Mode
if (vw_eva_performance_plan_editMode === "UPDATE") {
var successFunc1 = function (result) {
$("#vw_eva_performance_planModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
vw_eva_performance_plan_RefreshTable();
endLoad();
};
startLoad();
AjaxPutRequest(apisite + vw_eva_performance_plan_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
else {
var successFunc2 = function (result) {
$("#vw_eva_performance_planModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
vw_eva_performance_plan_RefreshTable();
endLoad();
};
startLoad();
AjaxPostRequest(apisite + vw_eva_performance_plan_API, data, successFunc2, AlertDanger);
}
}
function vw_eva_performance_plan_GoDelete(a) {
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
var successFunc = function (result) {
$("#vw_eva_performance_planModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
vw_eva_performance_plan_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + vw_eva_performance_plan_API + a, null, successFunc, AlertDanger);
}
}
//================= Data Table =========================================
var vw_eva_performance_planTableV;
var vw_eva_performance_plan_setupTable = function (result) {
tmp = '"';
vw_eva_performance_planTableV = $('#vw_eva_performance_planTable').DataTable({
"processing": true,
"serverSide": false,
"data": result,
//"select": {
// "style": 'multi'
//},
"columns": [
//{ "data": "" },
{ "data": "id" },
{ "data": "fiscal_year" },
{ "data": "theTime" },
],
"columnDefs": [
{
"targets": 0, //1,
"data": "id",
"render": function (data, type, row, meta) {
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:vw_eva_performance_plan_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil-alt'></i></button> ";
}
},
//{
// targets: 0,
// data: "",
// defaultContent: '',
// orderable: false,
// className: 'select-checkbox'
//}
],
"language": {
"url": appsite + "/DataTables-1.10.16/thai.json"
},
"paging": true,
"searching": false
});
endLoad();
};
function vw_eva_performance_plan_InitiateDataTable() {
startLoad();
var p = $.param(vw_eva_performance_plan_GetSearchParameter());
AjaxGetRequest(apisite + "/api/vw_eva_performance_plan/GetListBySearch?" + p, vw_eva_performance_plan_setupTable, AlertDanger);
}
function vw_eva_performance_plan_DoSearch() {
var p = $.param(vw_eva_performance_plan_GetSearchParameter());
var vw_eva_performance_plan_reload = function (result) {
vw_eva_performance_planTableV.destroy();
vw_eva_performance_plan_setupTable(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/vw_eva_performance_plan/GetListBySearch?" + p, vw_eva_performance_plan_reload, AlertDanger);
}
function vw_eva_performance_plan_GetSelect(f) {
var vw_eva_performance_plan_selectitem = [];
$.each(vw_eva_performance_planTableV.rows('.selected').data(), function (key, value) {
vw_eva_performance_plan_selectitem.push(value[f]);
});
alert(vw_eva_performance_plan_selectitem);
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================