From c372832ce5a934ab30afbe4a570654b34abc0d6a Mon Sep 17 00:00:00 2001 From: goutham-M Date: Sat, 9 Nov 2013 12:47:04 +0530 Subject: [PATCH] validation is added to admin --- app/global-translations/locale-en.json | 6 +- .../organization/ManageFundsController.js | 10 ++- .../product/CreateChargeController.js | 2 +- .../product/EditSavingProductController.js | 5 +- .../system/CreateDataTableController.js | 14 ++++- .../controllers/system/EditCodeController.js | 6 ++ .../system/EditDataTableController.js | 13 +++- app/views/administration/addrole.html | 14 +---- app/views/administration/createuser.html | 31 +++------- app/views/administration/edituser.html | 20 +++--- app/views/organization/createemployee.html | 14 +---- app/views/organization/createholiday.html | 17 +++-- app/views/organization/createoffice.html | 10 +-- app/views/organization/editemployee.html | 14 +---- app/views/organization/editoffice.html | 10 +-- app/views/organization/managefunds.html | 11 +++- app/views/products/createcharge.html | 38 +++++++----- app/views/products/createloanproduct.html | 62 +++++++++---------- app/views/products/createsavingproduct.html | 39 +++++++----- app/views/products/editcharge.html | 22 ++++--- app/views/products/editloanproduct.html | 57 +++++++++-------- app/views/products/editsavingproduct.html | 39 +++++++----- .../products/productmix/addproductmix.html | 7 ++- app/views/system/addcode.html | 8 +-- app/views/system/createdatatable.html | 20 +++--- app/views/system/createreport.html | 17 +++-- app/views/system/editcode.html | 15 +++-- app/views/system/editdatatable.html | 9 ++- app/views/system/editreport.html | 15 ++--- app/views/system/viewreport.html | 4 +- 30 files changed, 286 insertions(+), 263 deletions(-) diff --git a/app/global-translations/locale-en.json b/app/global-translations/locale-en.json index 2765dc45..c32bda05 100644 --- a/app/global-translations/locale-en.json +++ b/app/global-translations/locale-en.json @@ -166,6 +166,8 @@ "table.heading.associatedwith":"Associated With", "button.createdatatable":"Create Datatable", "label.edit.datatable":"Edit Datatable", + "label.columntypeerr":"Type require", + "label.columnnameerr":"Column name require", "#view datatable":"", "table.heading.fieldname":"Field Name", @@ -275,6 +277,7 @@ "label.loan.offiecer.unassigneddate":"Unassigned Date:", "label.loan.application":"New Loan Application", "label.loanpurpose":"Loan Purpose", + "label.select.product":"Select product", "form.legend.new.loan.application":"New Loan Application", "form.legend.new.jlg.loan.application":"New JLG Loan Application", @@ -576,6 +579,7 @@ "label.addcode":"Add Code", "label.editcode":"Edit Code", "label.code.name":"Name", + "label.codevalueerror":"Code value require", "#Admin system reports":"", "table.heading.reportname":"Report Name", @@ -625,7 +629,7 @@ "label.select.apptableName":"Select", "label.datatable.multiRow":"Multi Row", "label.column.name":"Column Name", - "label.select.columnType":"Type", + "label.select.columnType":"Select type", "datatable.column.type.string":"String", "datatable.column.type.number":"Number", "datatable.column.type.decimal":"Decimal", diff --git a/app/scripts/controllers/organization/ManageFundsController.js b/app/scripts/controllers/organization/ManageFundsController.js index 82257812..bfc71fec 100644 --- a/app/scripts/controllers/organization/ManageFundsController.js +++ b/app/scripts/controllers/organization/ManageFundsController.js @@ -2,6 +2,7 @@ mifosX.controllers = _.extend(module, { ManageFundsController: function(scope, location, resourceFactory) { + scope.funderror = false; resourceFactory.fundsResource.getAllFunds(function(data){ scope.funds = data; }); @@ -9,9 +10,12 @@ scope.addFund = function (){ if(scope.newfund != undefined ) { - resourceFactory.fundsResource.save({'name':scope.newfund} , function(data){ - location.path('/managefunds'); - }); + scope.funderror = false; + resourceFactory.fundsResource.save({'name':scope.newfund} , function(data){ + location.path('/managefunds'); + }); + } else { + scope.funderror = true; } scope.newfund = undefined; diff --git a/app/scripts/controllers/product/CreateChargeController.js b/app/scripts/controllers/product/CreateChargeController.js index 57477167..66eda822 100644 --- a/app/scripts/controllers/product/CreateChargeController.js +++ b/app/scripts/controllers/product/CreateChargeController.js @@ -3,7 +3,7 @@ CreateChargeController: function(scope, resourceFactory,location) { scope.template = []; scope.formData = {}; - resourceFactory.chargeTemplateResource.getChargeTemplates(function(data) { + resourceFactory.chargeTemplateResource.get(function(data) { scope.template = data; scope.showChargePaymentByField = true; scope.chargeCalculationTypeOptions = data.chargeCalculationTypeOptions; diff --git a/app/scripts/controllers/product/EditSavingProductController.js b/app/scripts/controllers/product/EditSavingProductController.js index 7eab00d8..cc680c6d 100644 --- a/app/scripts/controllers/product/EditSavingProductController.js +++ b/app/scripts/controllers/product/EditSavingProductController.js @@ -24,7 +24,6 @@ nominalAnnualInterestRate : data.nominalAnnualInterestRate, minRequiredOpeningBalance : data.minRequiredOpeningBalance, lockinPeriodFrequency : data.lockinPeriodFrequency, - lockinPeriodFrequencyType : data.lockinPeriodFrequencyType.id, withdrawalFeeForTransfers : data.withdrawalFeeForTransfers == true ? 'true' : 'false', interestCompoundingPeriodType : data.interestCompoundingPeriodType.id, interestPostingPeriodType : data.interestPostingPeriodType.id, @@ -33,6 +32,10 @@ accountingRule : data.accountingRule.id, } + if (data.lockinPeriodFrequencyType) { + scope.formData.lockinPeriodFrequencyType = data.lockinPeriodFrequencyType.id; + } + if(scope.formData.accountingRule == 1){ scope.formData.savingsReferenceAccountId = scope.assetAccountOptions[0].id; scope.formData.savingsControlAccountId = scope.liabilityAccountOptions[0].id; diff --git a/app/scripts/controllers/system/CreateDataTableController.js b/app/scripts/controllers/system/CreateDataTableController.js index 5f8d6618..f338fa26 100644 --- a/app/scripts/controllers/system/CreateDataTableController.js +++ b/app/scripts/controllers/system/CreateDataTableController.js @@ -3,6 +3,10 @@ CreateDataTableController: function(scope, routeParams , resourceFactory, location) { scope.columns = []; + scope.columnnameerror = false; + scope.columntypeerror = false; + scope.datatableTemplate = {}; + scope.labelerror = "requiredfield"; resourceFactory.codeResources.getAllCodes({}, function(data) { scope.codes = data; @@ -10,10 +14,18 @@ scope.addColumn = function () { if (scope.datatableTemplate.columnName && scope.datatableTemplate.columnType) { + scope.columnnameerror = false; + scope.columntypeerror = false; scope.columns.push({name:scope.datatableTemplate.columnName, type:scope.datatableTemplate.columnType, mandatory:false}); scope.datatableTemplate.columnName = undefined; scope.datatableTemplate.columnType = undefined; - } + } else if (!scope.datatableTemplate.columnName) { + scope.columnnameerror = true; + scope.labelerror = "columnnameerr"; + } else if (scope.datatableTemplate.columnName) { + scope.columntypeerror = true; + scope.labelerror = "columntypeerr"; + } }; scope.removeColumn = function (index) { diff --git a/app/scripts/controllers/system/EditCodeController.js b/app/scripts/controllers/system/EditCodeController.js index ffede942..7fe1b35d 100644 --- a/app/scripts/controllers/system/EditCodeController.js +++ b/app/scripts/controllers/system/EditCodeController.js @@ -4,6 +4,8 @@ scope.codevalues = []; scope.newcodevalues = []; scope.newEle = undefined; + scope.codevalueerror = false; + scope.newEle = {}; resourceFactory.codeResources.get({codeId: routeParams.id} , function(data) { scope.code = data; @@ -17,10 +19,14 @@ scope.addCv = function(){ if(scope.newEle != undefined && scope.newEle.hasOwnProperty('name')) { + scope.codevalueerror = true; resourceFactory.codeValueResource.save({codeId: routeParams.id},this.newEle,function(data){ scope.stat=false; location.path('/viewcode/'+routeParams.id); }); + } else if (!scope.newEle.name) { + scope.codevalueerror = true; + scope.labelerror = "codevalueerror"; } }; diff --git a/app/scripts/controllers/system/EditDataTableController.js b/app/scripts/controllers/system/EditDataTableController.js index 7b61b9fa..8f7216ee 100644 --- a/app/scripts/controllers/system/EditDataTableController.js +++ b/app/scripts/controllers/system/EditDataTableController.js @@ -5,6 +5,9 @@ scope.columns = []; scope.dropColumns = []; scope.formData = {}; + scope.columnnameerror = false; + scope.columntypeerror = false; + scope.datatableTemplate = {}; resourceFactory.codeResources.getAllCodes({}, function(data) { scope.codes = data; @@ -52,10 +55,18 @@ scope.addColumn = function () { if (scope.datatableTemplate.columnName && scope.datatableTemplate.columnType) { + scope.columnnameerror = false; + scope.columntypeerror = false; scope.columns.push({name:scope.datatableTemplate.columnName, type:scope.datatableTemplate.columnType, mandatory:false}); scope.datatableTemplate.columnName = undefined; scope.datatableTemplate.columnType = undefined; - } + } else if (!scope.datatableTemplate.columnName) { + scope.columnnameerror = true; + scope.labelerror = "columnnameerr"; + } else if (scope.datatableTemplate.columnName) { + scope.columntypeerror = true; + scope.labelerror = "columntypeerr"; + } }; scope.removeColumn = function (index) { diff --git a/app/views/administration/addrole.html b/app/views/administration/addrole.html index b49c9051..fb84e609 100644 --- a/app/views/administration/addrole.html +++ b/app/views/administration/addrole.html @@ -6,7 +6,7 @@
  • {{'label.addrole' | translate}}
  • -
    +
    {{'label.addrole' | translate}} @@ -14,11 +14,7 @@
    - - - Required Field - - +
    @@ -26,11 +22,7 @@
    + + + @@ -47,27 +49,30 @@ @@ -75,7 +80,7 @@ @@ -83,12 +88,12 @@ @@ -395,7 +400,7 @@
    - +
    diff --git a/app/views/products/editcharge.html b/app/views/products/editcharge.html index fd63b995..aff1d1cf 100644 --- a/app/views/products/editcharge.html +++ b/app/views/products/editcharge.html @@ -1,53 +1,55 @@
    - +
    -
    +
    {{'label.editcharge' | translate}}
    - +
    - + +
    - +
    - +
    - +
    - +
    - +
    - + +
    diff --git a/app/views/products/editloanproduct.html b/app/views/products/editloanproduct.html index 61c7525e..7fa4a5be 100644 --- a/app/views/products/editloanproduct.html +++ b/app/views/products/editloanproduct.html @@ -7,7 +7,7 @@
  • {{'label.editloanproduct' | translate}}
  • - +
    - + - - + + +
    - - + + + - - + + +
    - +
    - +
    - + - +
    @@ -18,8 +18,9 @@
    @@ -45,11 +46,11 @@ @@ -78,18 +79,20 @@
    - - + + +
    - + - +
    @@ -98,16 +101,17 @@
    - + - - + + +
    - - + + +
    - + @@ -127,16 +131,17 @@
      -   +   +
    - + @@ -155,28 +160,30 @@
      -   +    +
    - -   -   +
    - + @@ -209,17 +216,17 @@
      -   +   - +
    - + - +
    - + @@ -231,7 +238,7 @@
    - + @@ -528,7 +535,7 @@
    {{'label.cancel' | translate}} - +
    \ No newline at end of file diff --git a/app/views/products/editsavingproduct.html b/app/views/products/editsavingproduct.html index 2342c959..f2875f8e 100644 --- a/app/views/products/editsavingproduct.html +++ b/app/views/products/editsavingproduct.html @@ -7,7 +7,7 @@
  • {{'label.editsavingproduct' | translate}}
  • -
    +
    @@ -18,16 +18,18 @@
    @@ -49,27 +51,30 @@
    - - + + +
    - - + + +
    @@ -77,7 +82,7 @@ @@ -85,12 +90,12 @@ @@ -397,7 +402,7 @@
    - +
    diff --git a/app/views/products/productmix/addproductmix.html b/app/views/products/productmix/addproductmix.html index f1842dda..ae334470 100644 --- a/app/views/products/productmix/addproductmix.html +++ b/app/views/products/productmix/addproductmix.html @@ -1,12 +1,13 @@ - +
    {{'label.addproductmix' | translate}}
    - + +
    diff --git a/app/views/system/addcode.html b/app/views/system/addcode.html index 06c0a5b4..f20553f2 100644 --- a/app/views/system/addcode.html +++ b/app/views/system/addcode.html @@ -5,18 +5,14 @@
  • {{'label.addcode' | translate}}
  • - +
    {{'label.addcode' | translate}}
    - - - Required Field - - +

    diff --git a/app/views/system/createdatatable.html b/app/views/system/createdatatable.html index c4adb98d..689e561a 100644 --- a/app/views/system/createdatatable.html +++ b/app/views/system/createdatatable.html @@ -5,24 +5,20 @@
  • {{'label.create.datatable' | translate}}
  • - +
    {{ 'label.create.datatable' | translate }}
    - - - Required Field - - +
    - @@ -31,6 +27,7 @@ +
    @@ -40,8 +37,8 @@
    s
    -    -    +    + + + {{ 'label.'+labelerror | translate }} + +
    diff --git a/app/views/system/createreport.html b/app/views/system/createreport.html index 7213086d..79dc1f3d 100644 --- a/app/views/system/createreport.html +++ b/app/views/system/createreport.html @@ -5,7 +5,7 @@
  • {{'label.createreport' | translate}}
  • - +
    - + - - + + +
    - - + + + - - + + +
    - +
    - +
    - + - +
    @@ -18,11 +18,7 @@
    - - - Required Field - - + @@ -68,14 +64,15 @@
    - + @@ -120,7 +117,7 @@
    - +
    \ No newline at end of file diff --git a/app/views/system/editcode.html b/app/views/system/editcode.html index d4e9c72f..c59bcccb 100644 --- a/app/views/system/editcode.html +++ b/app/views/system/editcode.html @@ -1,4 +1,4 @@ -
    +

    {{'label.editcode' | translate}}

    -      - {{ 'label.add' | translate }} +    +    + {{ 'label.add' | translate }} + + + {{'label.'+labelerror | translate}} + +
      {{ 'error.delete.failed' | translate }}

    -
    \ No newline at end of file + \ No newline at end of file diff --git a/app/views/system/editdatatable.html b/app/views/system/editdatatable.html index 0d49a7aa..ff83ccf2 100644 --- a/app/views/system/editdatatable.html +++ b/app/views/system/editdatatable.html @@ -7,7 +7,7 @@
  • {{'label.edit.datatable' | translate}}
  • - +
    {{ 'label.edit.datatable' | translate }} @@ -34,7 +34,7 @@
    -    +       + + + {{ 'label.'+labelerror | translate }} + +
    diff --git a/app/views/system/editreport.html b/app/views/system/editreport.html index ad117ef6..3dd9f67b 100644 --- a/app/views/system/editreport.html +++ b/app/views/system/editreport.html @@ -5,7 +5,7 @@
  • {{'label.editreport' | translate}}
  • - +
    - - + + +
    @@ -18,11 +18,7 @@
    - - - Required Field - - + @@ -74,8 +70,9 @@ @@ -108,7 +105,7 @@
    - +
    \ No newline at end of file diff --git a/app/views/system/viewreport.html b/app/views/system/viewreport.html index d466a046..f27762af 100644 --- a/app/views/system/viewreport.html +++ b/app/views/system/viewreport.html @@ -8,8 +8,8 @@
    - {{'button.edit' | translate} - + {{'button.edit' | translate}} +
    - - + + +