<commit_before>/**
 * Account module
 */
angular.module( 'bookie.fiscal_year', [
  'ui.state',
  'ngResource',
  'ngGrid'
])
.config(function config($stateProvider){
  $stateProvider.state('fiscal_years', {
    url: '/fiscal_years',
    views: {
      "main":{
        controller: "FiscalYearsCtrl",
        templateUrl: "fiscal_year/fiscal_years.tpl.html"
      }
    }
  }).state('fiscal_year', {
    url: '/fiscal_year?fiscalYearId',
    views:{
      "main":{
        controller: "FiscalYearCtrl",
        templateUrl: "fiscal_year/fiscal_year.tpl.html"
      }
    }
  });
})
.controller( 'FiscalYearsCtrl', function FiscalYearsCtrl( $scope, FiscalYearRes, $state, $rootScope) {
  $rootScope.loggedIn = true;
  $scope.fiscal_years = FiscalYearRes.query();
  $scope.newFiscalYear = function(){
    $state.transitionTo('fiscal_year');
  };
  $scope.editFiscalYear = function(fiscal_year){
    $state.transitionTo('fiscal_year', {fiscalYearId: fiscal_year.id});
  };
})
.controller('FiscalYearCtrl', function FiscalYearCtrl($scope, FiscalYearRes, $state, $stateParams, $rootScope){
  $rootScope.loggedIn = true;
  $scope.fiscalYearId = parseInt($stateParams.fiscalYearId, 10);
  if($scope.fiscalYearId){
    $scope.fiscal_year = FiscalYearRes.get({id: $scope.fiscalYearId});
  }else{
    $scope.fiscal_year = new FiscalYearRes();
  }

  $scope.cancel = function(){
    $state.transitionTo("fiscal_years");
  };

  $scope.submit = function(){
    if($scope.accountId){
      $scope.fiscal_year.$update(function(response){
        $state.transitionTo('fiscal_years');
      });
    }else{
      $scope.fiscal_year.$save(function(response){
        $state.transitionTo('fiscal_years');
      }, function(response){
        $scope.start_date_errors = response.data.start_date;
        $scope.end_date_errors = response.data.end_date;
      });
    }
  };
})
.factory( 'FiscalYearRes', function ( $resource, CompanyService )  {<commit_msg>View for fiscal year working<commit_after>/**
 * Account module
 */
angular.module( 'bookie.fiscal_year', [
  'ui.state',
  'ngResource',
  'ngGrid'
])
.config(function config($stateProvider){
  $stateProvider.state('fiscal_years', {
    url: '/fiscal_years',
    views: {
      "main":{
        controller: "FiscalYearsCtrl",
        templateUrl: "fiscal_year/fiscal_years.tpl.html"
      }
    }
  }).state('fiscal_year', {
    url: '/fiscal_year?fiscalYearId',
    views:{
      "main":{
        controller: "FiscalYearCtrl",
        templateUrl: "fiscal_year/fiscal_year.tpl.html"
      }
    }
  });
})
.controller( 'FiscalYearsCtrl', function FiscalYearsCtrl( $scope, FiscalYearRes, $state, $rootScope) {
  $rootScope.loggedIn = true;
  $scope.fiscal_years = FiscalYearRes.query();
  $scope.newFiscalYear = function(){
    $state.transitionTo('fiscal_year');
  };
  $scope.editFiscalYear = function(fiscal_year){
    $state.transitionTo('fiscal_year', {fiscalYearId: fiscal_year.id});
  };
})
.controller('FiscalYearCtrl', function FiscalYearCtrl($scope, FiscalYearRes, $state, $stateParams, $rootScope){
  $rootScope.loggedIn = true;
  $scope.fiscalYearId = parseInt($stateParams.fiscalYearId, 10);
  if($scope.fiscalYearId){
    $scope.fiscal_year = FiscalYearRes.get({id: $scope.fiscalYearId});
  }else{
    $scope.fiscal_year = new FiscalYearRes();
  }

  $scope.cancel = function(){
    $state.transitionTo("fiscal_years");
  };

  $scope.submit = function(){
    if($scope.accountId){
      $scope.fiscal_year.$update(function(response){
        $state.transitionTo('fiscal_years');
      }, function(response){
        $scope.start_date_errors = response.data.start_date;
        $scope.end_date_errors = response.data.end_date;
      });
    }else{
      $scope.fiscal_year.$save(function(response){
        $state.transitionTo('fiscal_years');
      }, function(response){
        $scope.start_date_errors = response.data.start_date;
        $scope.end_date_errors = response.data.end_date;
      });
    }
  };
})
.factory( 'FiscalYearRes', function ( $resource, CompanyService )  {
{'fraction_non_alphanumeric': 0.15939514129895885, 'fraction_numerical': 0.0009915716410510659, 'mean_word_length': 3.7978596908442332, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5546044', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1441, 'n_words': 187}