Commit bb19e308 by peema_phongam

interview dept

parent 7af3e659
'use strict'
angular.module('APS_INTERVIEW').controller('APS_FORM_INTERVIEW_DHAS_DEPT', ['$scope', '$http', '$sce', 'InterviewcandidateCtrl', function($scope, $http, $sce, InterviewcandidateCtrl){
$scope.candidateid = $('input[name="candidateid"]').val()
$scope.committeeid = $('input[name="committeeid"]').val()
$scope.notedit = ($('input[name="notedit"]').val() == 'true')
$scope.lang = $('input[name="lang"]').val()
$scope.contextPath = ''
$scope.headdata = {}
$scope.formdata = {}
let question = new Question()
$scope.examdata = {}
$scope.score2 = ''
$scope.score3 = ''
$scope.score4 = ''
let DocumentContainer
let WindowObject
$scope.comment = [{
comment:'',
appropriate:0
}]
$scope.apsform = [{
topic : "บุคลิคลักษณะ กิริยามารยาท การแต่งกาย",
score : 0
},{
topic : "มนุษย์สัมพันธ์",
score : 0
},{
topic : "การสื่อข้อความ การตอบคำถาม การใช้คำพูด",
score : 0
},{
topic : "ประวัติการศึกษา และการฝึกอบรม",
score : 0
},{
topic : "ภูมิหลัง และสถานภาพทางครอบครัว",
score : 0
},{
topic : "ประสบการณ์ ลักษณะงานที่ผ่านมา",
score : 0
},{
topic : "ความรอบรู้เรื่องในงานที่สมัคร ความรู้ทางเทคนิค และวิธีปฏิบัติ",
score : 0
},{
topic : "ความสามารถพิเศษที่เอื้อต่องานที่สมัคร",
score : 0
},{
topic : "สติปัญญา ความคิดริเริ่ม ความคิดเห็น ไหวพริบ การแก้ปัญหาเหตุผล",
score : 0
},{
topic : "ทัศนคติดความมุ่งหมายในชีวิต การงาน และสังคมรอบข้าง",
score : 0
}]
$scope.myparam = {
candidateid: $scope.candidateid,
committeeid: $scope.committeeid
};
InterviewcandidateCtrl.manageInterviewForm.query($scope.myparam).$promise.then(function(data){
$scope.headdata = data.header
$scope.formdata = data.apsform
setFormAPS()
console.log(data)
})
let setFormAPS = () => {
if($scope.formdata.form == ''){
$scope.formdata.form = $scope.apsform
}else {
$scope.formdata.form = jQuery.parseJSON($scope.formdata.form)
}
if($scope.formdata.comment == ''){
$scope.formdata.comment = $scope.comment
}else {
$scope.formdata.comment = jQuery.parseJSON($scope.formdata.comment)
}
}
$scope.getSumScore = () => {
let result = 0
if($scope.formdata.form != undefined){
for(var i = 0; i <$scope.formdata.form.length; i++){
let form = $scope.formdata.form[i];
result += parseInt(form.score)
}
}
return result;
}
$scope.getSumScoreByScore = (score) => {
let result = 0
if($scope.formdata.form != undefined){
for(var i = 0; i <$scope.formdata.form.length; i++){
let form = $scope.formdata.form[i];
if(form.score == score){
result += parseInt(form.score)
}
}
}
return result;
}
$scope.addComment = () => {
let data = {
comment : ''
}
$scope.formdata.comment.push(data)
}
$scope.delComment = () => {
$scope.formdata.comment.pop()
}
$scope.saveDraff = () => {
if (confirm(MyCode[1])){
$scope.sendparam = $scope.sendparam = setParam('0')
InterviewcandidateCtrl.manageInterviewForm.save(JSON.stringify($scope.sendparam))
.$promise.then(function(){
alert(MyCode[18]);
window.opener.location.reload();
});
}
}
$scope.save = () => {
if(chkData()){
if (confirm(MyCode[1])){
$scope.sendparam = setParam('1')
InterviewcandidateCtrl.manageInterviewForm.save(JSON.stringify($scope.sendparam))
.$promise.then(function(){
alert(MyCode[18]);
window.opener.location.reload();
});
}
}else{
alert('กรุณากรอกข้อมูลให้ครบถ้วน')
}
}
let setParam = (type) => {
let param = {
headdata: $scope.headdata
,apsform: $scope.formdata
,savetype: type
}
return param
}
let chkData = () => {
let result = true
let objlist = $scope.formdata.form.filter((form) => form.score == 0)
if (objlist.length>0){
result = false
}
let objlist2 = $scope.formdata.comment.filter((comment) => comment.comment == 0)
if (objlist2.length>0){
result = false
}
let objlist3 = $scope.formdata.comment.filter((appropriate) => appropriate.appropriate == 0)
if (objlist3.length>0){
result = false
}
return result
}
$scope.goprint = function(){
hidelement();
promisePrint().then((obj) => {
WindowObject.focus();
console.log(WindowObject);
// window.close();
WindowObject.print();
})
}
function promisePrint(){
return new Promise((resolve, reject) => {
DocumentContainer = document.getElementById('target_warpper');
WindowObject = window.open('', 'PrintWindow', 'width=1200,height=666,top=10,right=10,toolbars=no,scrollbars=no,status=no,resizable=yes,scale=98%');
WindowObject.document.writeln('<!DOCTYPE html>');
WindowObject.document.writeln('<html><head><title></title>');
WindowObject.document.writeln(`<link rel="stylesheet" type="text/css" href="${$scope.contextPath}/EMPVIEW/css/APP_UP/style_apsup.css">`);
WindowObject.document.writeln(`<link rel="stylesheet" type="text/css" href="${$scope.contextPath}/EMPVIEW/css/APS_Interview/style_printInterview.css">`);
WindowObject.document.writeln(`<link rel="stylesheet" type="text/css" href="${$scope.contextPath}/CSS/Bootstrap/css/bootstrap.css">`);
WindowObject.document.writeln(`<link rel="stylesheet" type="text/css" href="${$scope.contextPath}/CSS/EMPVIEW_LAYOUT.min.css">`);
WindowObject.document.writeln(`<link rel="stylesheet" type="text/css" href="${$scope.contextPath}/CSS/font-awesome.css">`);
WindowObject.document.writeln('</head><body>');
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.writeln('</body></html>');
WindowObject.document.close();
setTimeout(() => resolve(WindowObject), 1000)
})
}
function hidelement(){
let txt = ''
let chk = false
$(".score1").each(function(){
if($(this).hasClass("ng-hide")){
$(this).hide()
}
});
$(".score2").each(function(){
chk = $(this).prop('checked');
if(chk){
$(this).parents("td").append("<i class='fa fa-check-square-o right dis-block'></i>");
}
else{
$(this).parents("td").append("<i class='fa fa-square-o right dis-block'></i>");
}
$(this).hide();
});
$(".score3").each(function(){
chk = $(this).prop('checked');
if(chk){
$(this).parents(".chk").append("<i class='fa fa-check-square-o right dis-block'></i>");
}
else{
$(this).parents(".chk").append("<i class='fa fa-square-o right dis-block'></i>");
}
$(this).hide();
});
$("textarea").each(function(){
txt = $(this).val()
if(txt ==''){
$(this).parents(".showtxt").find("label").removeClass('hide')
$(this).parents(".showtxt").find("label").clone().appendTo($(this).parents(".showtxt"))
}else{
$(this).parents(".showtxt").find("label").removeClass('txt-underline hide')
$(this).parents(".showtxt").find("label").addClass('txt-underline2')
$(this).parents(".showtxt").find("label").text(txt)
}
$(this).hide()
});
$('.btn').hide()
$('.icon-btn').hide()
}
}]);
......@@ -165,7 +165,7 @@ angular.module('APS_INTERVIEW').controller('listCandidate', ['$scope', '$http',
pageName = "../APS_FORM_INTERVIEW_DHAS.jsp";
} else if ($scope.dbName.toUpperCase() === ("DHAS")) {
pageName = "../APS_FORM_INTERVIEW_DHAS_DEPT.jsp";
// pageName = "../APS_FORM_INTERVIEW_DHAS_CHAIRMAN.jsp";
// pageName = "../APS_FORM_INTERVIEW_DHAS_RESULT.jsp";
// pageName = "../APS_FORM_INTERVIEW_DHAS.jsp";
} else if ($scope.dbName.toUpperCase() === ("ITE")) {
pageName = "../APS_FORM_INTERVIEW_ITE.jsp";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment