datacorrection change

This commit is contained in:
venbatechnologies@gmail.com 2018-08-21 11:24:35 +05:30
parent 15a73cff5c
commit bbd0fab01f
2 changed files with 23 additions and 12 deletions

View File

@ -130,25 +130,34 @@ app.controller('datacorrectionCtrl', ["$scope","$rootScope","toaster", "$filter"
$scope.updatestatus = function (myModel, form, loading)
{
//alert(myModel.ID)
$scope.updatestatus = function (myModel, form, loading)
{
//alert(myModel.Reason);
var firstError = null;
if (form.$invalid) {
var field = null, firstError = null;
for (field in form) {
if (field[0] != '$') {
if (firstError === null && !form[field].$valid) {
firstError = form[field].$name;
}
if (form[field].$pristine) {
form[field].$dirty = true;
}
}
}
angular.element('.ng-invalid[name=' + firstError + ']').focus();
swal("Please Enter Reason!", "", "error");
} else {
var d = new Date(myModel.Date);
// console.log(d.getUTCDate()); // Hours
// console.log(d.getUTCMonth());
// console.log(d.getUTCFullYear());
var mdate = d.getUTCDate() + 1;
var mmonth = d.getUTCMonth() + 1;
var myear = d.getUTCFullYear();
var CDate = mdate+"-"+mmonth+"-"+myear;
//console.log(CDate)
var IsActive = '';
if(myModel.IsActive == true)
@ -189,8 +198,10 @@ else if(myModel.IsActive == false)
$scope.close();
});
}
};
};

View File

@ -73,7 +73,7 @@
<div class="col-md-3 form-group" >
<div class="col-md-3 form-group" ng-class="{'has-error':p.Reason.$dirty && p.Reason.$invalid, 'has-success':p.Reason.$valid}">
<label>
Reason to Deactivate <span class="symbol required"></span>
</label>