Commit 42546162 authored by dgoud-nisum-com's avatar dgoud-nisum-com Committed by rbonthala-nisum-com

Name validation and default shift is shown in shift details screen (#139)

parent d2823a8d
......@@ -340,6 +340,13 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}
return false;
}
function validateTextFields(name){
var pattern = /^[a-zA-Z\s]*$/;
if(pattern.test(name)){
return true;
}
return false;
}
$scope.validateFields = function(){
var today = new Date();
......@@ -373,6 +380,9 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}else if(empName == ""){
$scope.alertMsg = "Employee Name is mandatory";
document.getElementById('empName').focus();
}else if(empName !="" && !validateTextFields(empName)){
$scope.alertMsg = "Please enter alphabets only";
document.getElementById('empName').focus();
}else if(gender == "") {
$scope.alertMsg = "Gender is mandatory";
document.getElementById('gender').focus();
......
......@@ -201,6 +201,13 @@ myApp.controller("domainController",
}
}
}
function validateTextFields(name){
var pattern = /^[a-zA-Z\s]*$/;
if(pattern.test(name)){
return true;
}
return false;
}
function AddDomainController($scope, $mdDialog, dataToPass,gridOptionsData, employees) {
console.log("employees", employees);
......@@ -448,6 +455,9 @@ myApp.controller("domainController",
}else if(domainName == "" || undefined){
$scope.alertMsg = "Please enter a Domain Name";
document.getElementById('domainName').focus();
}else if(domainName !="" && !validateTextFields(domainName)){
$scope.alertMsg = "Please enter alphabets only";
document.getElementById('domainName').focus();
}else if(deliveryManagers.length <= 0){
$scope.alertMsg = "Please select a deliveryManagers";
document.getElementById('selectDeliveryLeads').focus();
......@@ -471,6 +481,9 @@ myApp.controller("domainController",
}else if(domainName == "" || undefined) {
$scope.alertMsg = "Please enter a Domain Name";
document.getElementById('domainName').focus();
}else if(domainName !="" && !validateTextFields(domainName)){
$scope.alertMsg = "Please enter alphabets only";
document.getElementById('domainName').focus();
}else if(deliveryManagers.length <= 0){
$scope.alertMsg = "Please select a deliveryManagers";
document.getElementById('selectDeliveryLeads').focus();
......
......@@ -1181,7 +1181,10 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
if (projectName == "") {
$scope.alertMsg = "Project Name is mandatory";
document.getElementById('projectName').focus();
} else if (account == undefined || account == "") {
}else if(projectName !="" && !validateTextFields(projectName)){
$scope.alertMsg = "Please enter alphabets only";
document.getElementById('projectName').focus();
}else if (account == undefined || account == "") {
$scope.alertMsg = "Account is mandatory";
document.getElementById('account').focus();
......@@ -1549,5 +1552,12 @@ myApp.controller("projectController", function ($scope, myFactory, exportUiGridS
}
return false;
}
function validateTextFields(name){
var pattern = /^[a-zA-Z\s]*$/;
if(pattern.test(name)){
return true;
}
return false;
}
}
});
......@@ -73,8 +73,8 @@ myApp.controller("shiftDetailsController",function($scope, myFactory,exportUiGri
$scope.shifts = myFactory.getShifts(); //["Shift 1(09:00 AM - 06:00 PM)","Shift 2(03:30 PM - 12:30 PM)", "Shift 3(09:00 PM - 06:00 AM)"];
var shiftV = $scope.shiftValue;
if(shiftV == undefined ||shiftV==""){
shiftV="Shift 2(03:30 PM - 12:30 PM)";
if(shiftV == undefined || shiftV==""){
shiftV="Shift 1(09:00 AM - 06:00 PM)";
}
$scope.shiftValue=shiftV;
$scope.selectedshiftValue=shiftV;
......
......@@ -335,6 +335,9 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
if(accountName == undefined || accountName == ""){
$scope.alertMsg = "Please enter the account Name";
document.getElementById('accountName').focus();
}else if(accountName !="" && !validateTextFields(accountName)){
$scope.alertMsg = "Please enter alphabets only";
document.getElementById('accountName').focus();
}else if(industryType == undefined || industryType == ""){
$scope.alertMsg = "Please enter the industry type";
document.getElementById('industryType').focus();
......@@ -356,6 +359,9 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
if(accountName == undefined || accountName == ""){
$scope.alertMsg = "Please enter the account Name";
document.getElementById('accountName').focus();
}else if(accountName !="" && !validateTextFields(accountName)){
$scope.alertMsg = "Please enter alphabets only";
document.getElementById('accountName').focus();
}else if(industryType == undefined || industryType == ""){
$scope.alertMsg = "Please enter the industry type";
document.getElementById('industryType').focus();
......@@ -430,6 +436,13 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
return arr.indexOf(item) == pos;
})
}
function validateTextFields(name){
var pattern = /^[a-zA-Z\s]*$/;
if(pattern.test(name)){
return true;
}
return false;
}
}
});
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