This commit is contained in:
venbatechnologies@gmail.com 2018-08-11 16:54:02 +05:30
parent 6e46233da8
commit 9c6bff597e
2 changed files with 43 additions and 9 deletions

View File

@ -217,6 +217,10 @@ $scope.dayBookApprovalAccess = '';
if (response.data.typeNameStatus) { if (response.data.typeNameStatus) {
$scope.incomeExpenseName = response.data.typeList; $scope.incomeExpenseName = response.data.typeList;
$scope.incomeExpenseType = response.data.typeNameList; $scope.incomeExpenseType = response.data.typeNameList;
console.log($scope.incomeExpenseName)
console.log($scope.incomeExpenseType);
} else { } else {
} }
}); });
@ -224,19 +228,41 @@ $scope.dayBookApprovalAccess = '';
// parse the income and expense type from the list // parse the income and expense type from the list
$scope.getType = function (type) { $scope.getType = function (type) {
$scope.getIncomeTypes = $scope.incomeExpenseType.filter(function (val) { $scope.getIncomeTypes = $scope.incomeExpenseName.filter(function (val) {
return val.TypeID === 'I002' ? 1 : 0; return val.TypeID === 'I002' ? 1 : 0;
}); });
$scope.getExpenseTypes = $scope.incomeExpenseType.filter(function (val) { $scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) {
return val.TypeID === 'I001' ? 1 : 0; return val.TypeID === 'I001' ? 1 : 0;
}); });
$scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) {
return val.TypeID === 'I003' ? 1 : 0;
});
$scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) {
return val.TypeID === 'I004' ? 1 : 0;
});
$scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) {
return val.TypeID === 'I005' ? 1 : 0;
});
$scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) {
return val.TypeID === 'I006' ? 1 : 0;
});
$scope.myModelAdd.type = ''; $scope.myModelAdd.type = '';
$scope.getTypes = type === 'I002' ? $scope.getIncomeTypes : $scope.getExpenseTypes; $scope.getTypes = type === 'I002' ? $scope.getIncomeTypes : $scope.getExpenseTypes;
console.log($scope.getTypes)
}; };
$scope.editId = -1; $scope.editId = -1;
$scope.setEditId = function (P) { $scope.setEditId = function (P) {
// alert(id); //alert(id);
$scope.editId = P; $scope.editId = P;
} }
@ -274,12 +300,14 @@ $scope.dayBookApprovalAccess = '';
} }
$scope.copyModel = function (p) { $scope.copyModel = function (p) {
console.log(p); var inc = $scope.incomeExpenseType.filter((inc)=>inc.ID == p.Type);
console.log(inc);
$scope.incexp = inc[0];
$scope.myModel = { $scope.myModel = {
"id": p.ID, "id": p.ID,
"date": p.Date, "date": p.Date,
"incomeExpense": p.Name, "incomeExpense": p.Name,
"type": p.Type, "type" : $scope.incexp.ID,
"amount": p.Amount, "amount": p.Amount,
"status": p.Status, "status": p.Status,
"description": p.Description, "description": p.Description,
@ -288,6 +316,7 @@ $scope.dayBookApprovalAccess = '';
"voucherNumber": p.VoucherNumber, "voucherNumber": p.VoucherNumber,
"branch":p.BranchCode, "branch":p.BranchCode,
"name": p.Name "name": p.Name
} }
// alert(JSON.stringify($scope.myModel)); // alert(JSON.stringify($scope.myModel));
} }
@ -491,8 +520,13 @@ $scope.dayBookApprovalAccess = '';
// update a daybook entry details // update a daybook entry details
$scope.daybookeditUpdate = { $scope.daybookeditUpdate = {
submit: function (form, myModel) { submit: function (form, myModel) {
console.log(myModel.type);
//return false;
var firstError = null; var firstError = null;
if (form.$invalid) { if (form.$invalid) {
alert();
var field = null, firstError = null; var field = null, firstError = null;
for (field in form) { for (field in form) {
if (field[0] != '$') { if (field[0] != '$') {
@ -505,7 +539,7 @@ $scope.dayBookApprovalAccess = '';
} }
} }
angular.element('.ng-invalid[name=' + firstError + ']').focus(); angular.element('.ng-invalid[name=' + firstError + ']').focus();
// swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error"); swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
} else { } else {
// alert(JSON.stringify($scope.myModel));exit(); // alert(JSON.stringify($scope.myModel));exit();
$scope.disableEditButton = true; $scope.disableEditButton = true;

View File

@ -195,7 +195,7 @@
<div ng-init="copyModel(p)" class="container" style="background-color: rgb(248, 248, 248); <div ng-init="copyModel(p)" class="container" style="background-color: rgb(248, 248, 248);
border-radius: 6px;padding: 22px;"> border-radius: 6px;padding: 22px;">
<div class="row"> <div class="row">
<div class="col-md-4 form-group" ng-class="{'has-error':Form.editvoucherNumber.$dirty && Form.editvoucherNumber.$invalid, 'has-success':Form.editvoucherNumber.$valid}"> <div class="col-md-4 form-group" ng-class="{'has-error':Form.editvoucherNumber.$dirty && Form.editvoucherNumber.$invalid, 'has-success':Form.editvoucherNumber.$valid}">
<label> <label>
Voucher Number Voucher Number
</label> </label>
@ -242,11 +242,11 @@
<select class="form-control" tabindex="1" class="cs-select cs-skin-elastic" name="addType" ng-model="myModelAdd.type" required> <select class="form-control" tabindex="1" class="cs-select cs-skin-elastic" name="addType" ng-model="myModel.type" required>
<optgroup ng-repeat="typeName in incomeExpenseName" label="{{typeName.ListName}}"> <optgroup ng-repeat="typeName in incomeExpenseName" label="{{typeName.ListName}}">
<option ng-repeat="incexpType in incomeExpenseType" ng-if="typeName.ListCode == incexpType.TypeID" ng-selected="typeItem.ID == p.Type" value="{{typeItem.ID}}" value="{{incexpType.ID}}">{{incexpType.TypeName}}</option> <option ng-repeat="incexpType in incomeExpenseType" ng-if="typeName.ListCode == incexpType.TypeID" value="{{incexpType.ID}}" ng-selected="incexp.ID == incexpType.ID">{{incexpType.TypeName}}</option>
</optgroup> </optgroup>
<!-- <option value="" disabled selected>Select Type</option> <!-- <option value="" disabled selected>Select Type</option>