<commit_before>'use strict';

/* jshint -W098 */
angular.module('socio').controller('Socio.Credito.BuscarController',
    function ($scope, $state, CreditoService) {

        var paginationOptions = {
            page: 1,
            pageSize: 10
        };

        $scope.filterOptions = {
            filterText: undefined,
            estado: true
        };

        $scope.gridOptions = {
            data: [],
            enableRowSelection: true,
            enableRowHeaderSelection: false,
            multiSelect: false,

            paginationPageSizes: [10, 25, 50],
            paginationPageSize: 10,
            useExternalPagination: true,
            useExternalSorting: true,

            columnDefs: [
                {
                  name: 'documento',
                  displayName: 'DOCUMENTO',
                  cellTemplate: '<div ng-class="col.colIndex()" class="ngCellText" style="text-align: left;">' +
                  '<span ng-show="row.entity.socio.personaNatural" ng-bind-template="{{row.entity.socio.personaNatural.tipoDocumento.abreviatura}}:{{row.entity.socio.personaNatural.numeroDocumento}}"></span>' +
                  '<span ng-show="row.entity.socio.personaJuridica" ng-bind-template="{{row.entity.socio.personaJuridica.tipoDocumento.abreviatura}}:{{row.entity.socio.personaJuridica.numeroDocumento}}"></span>' +
                  '</div>',
                  width: '13%'
                },
                {
                  name: 'cliente',
                  displayName: 'CLIENTE',
                  cellTemplate: '<div ng-class="col.colIndex()" class="ngCellText" style="text-align: left;">' +
                  '<span ng-show="row.entity.socio.personaNatural" ng-bind-template="{{row.entity.socio.personaNatural.apellidoPaterno}} {{row.entity.socio.personaNatural.apellidoMaterno}}, {{row.entity.socio.personaNatural.nombres}}"></span>' +
                  '<span ng-show="row.entity.socio.personaJuridica" ng-bind-template="{{row.entity.socio.personaJuridica.razonSocial}}"></span>' +
                  '</div>',
                  width: '23%'
                },
                {field: 'fechaCreacion', displayName: 'F.Inicio', cellFilter: 'date : "dd/MM/yyyy"', width: '10%'},
                {field: 'fechaLimitePago', displayName: 'F.Vence', cellFilter: 'date : "dd/MM/yyyy"', width: '10%'},
                {field: 'moneda.simbolo', displayName: 'M.', width: '5%'},
                {field: 'monto', displayName: 'Desembolsado', cellFilter: 'number: 2', width: '15%'},
                {field: 'interes', displayName: 'Interes', cellFilter: 'number: 2', width: '10%'},
                {field: 'estado', displayName: 'ESTADO', cellFilter: 'si_no : "activo" | uppercase'},
                {
                    name: 'edit',
                    displayName: 'Edit',
                    cellTemplate: '' +
                    '<div style="text-align: center; padding-top: 5px;">' +
                    '<button type="button" ng-click="grid.appScope.gridActions.edit(row.entity)" class="btn btn-info btn-xs">' +
                    '<i class="pficon pficon-edit"></i>' +
                    '<span>&nbsp;Editar</span>' +
                    '</button>' +
                    '</div>'
                }
            ],
            onRegisterApi: function (gridApi) {
                $scope.gridApi = gridApi;
                $scope.gridApi.core.on.sortChanged($scope, function (grid, sortColumns) {
                    console.log('Order by. Not available.');
                });
                gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
                    paginationOptions.page = newPage;
                    paginationOptions.pageSize = pageSize;
                    $scope.search();
                });
            }
        };

        $scope.gridActions = {
            edit: function (row) {
                $state.go('^.editar', {credito: row.id});
            }
        };

        $scope.search = function () {
            var ft = $scope.filterOptions.filterText;
            var desde = (paginationOptions.page * paginationOptions.pageSize) - paginationOptions.pageSize;
            var hasta = paginationOptions.pageSize;

          CreditoService.findByFilterText(ft, ['ACTIVO'], desde, hasta).then(function (response) {
                $scope.gridOptions.data = response;
          });
          CreditoService.count(ft).then(function (response) {
                $scope.gridOptions.totalItems = response;
          });
        };

    }
);<commit_msg>buscar sobregiros<commit_after>'use strict';

/* jshint -W098 */
angular.module('socio').controller('Socio.Credito.BuscarController',
  function ($scope, $state, CreditoService) {

    var paginationOptions = {
      page: 1,
      pageSize: 10
    };

    $scope.filterOptions = {
      filterText: undefined,
      estado: true
    };

    $scope.gridOptions = {
      data: [],
      enableRowSelection: true,
      enableRowHeaderSelection: false,
      multiSelect: false,

      paginationPageSizes: [10, 25, 50],
      paginationPageSize: 10,
      useExternalPagination: true,
      useExternalSorting: true,

      columnDefs: [
        {
          name: 'documento',
          displayName: 'DOCUMENTO',
          cellTemplate: '<div ng-class="col.colIndex()" class="ngCellText" style="text-align: left;">' +
          '<span ng-show="row.entity.socio.personaNatural" ng-bind-template="{{row.entity.socio.personaNatural.tipoDocumento.abreviatura}}:{{row.entity.socio.personaNatural.numeroDocumento}}"></span>' +
          '<span ng-show="row.entity.socio.personaJuridica" ng-bind-template="{{row.entity.socio.personaJuridica.tipoDocumento.abreviatura}}:{{row.entity.socio.personaJuridica.numeroDocumento}}"></span>' +
          '</div>',
          width: '13%'
        },
        {
          name: 'cliente',
          displayName: 'CLIENTE',
          cellTemplate: '<div ng-class="col.colIndex()" class="ngCellText" style="text-align: left;">' +
          '<span ng-show="row.entity.socio.personaNatural" ng-bind-template="{{row.entity.socio.personaNatural.apellidoPaterno}} {{row.entity.socio.personaNatural.apellidoMaterno}}, {{row.entity.socio.personaNatural.nombres}}"></span>' +
          '<span ng-show="row.entity.socio.personaJuridica" ng-bind-template="{{row.entity.socio.personaJuridica.razonSocial}}"></span>' +
          '</div>',
          width: '23%'
        },
        {field: 'fechaCreacion', displayName: 'F.Inicio', cellFilter: 'date : "dd/MM/yyyy"', width: '10%'},
        {field: 'fechaLimitePago', displayName: 'F.Vence', cellFilter: 'date : "dd/MM/yyyy"', width: '10%'},
        {field: 'moneda.simbolo', displayName: 'M.', width: '5%'},
        {field: 'monto', displayName: 'Desembolsado', cellFilter: 'number: 2', width: '15%'},
        {field: 'interes', displayName: 'Interes', cellFilter: 'number: 2', width: '10%'},
        {field: 'estado', displayName: 'ESTADO', cellFilter: 'si_no : "activo" | uppercase'},
        {
          name: 'edit',
          displayName: 'Edit',
          cellTemplate: '' +
          '<div style="text-align: center; padding-top: 5px;">' +
          '<button type="button" ng-click="grid.appScope.gridActions.edit(row.entity)" class="btn btn-info btn-xs">' +
          '<i class="pficon pficon-edit"></i>' +
          '<span>&nbsp;Editar</span>' +
          '</button>' +
          '</div>'
        }
      ],
      onRegisterApi: function (gridApi) {
        $scope.gridApi = gridApi;
        $scope.gridApi.core.on.sortChanged($scope, function (grid, sortColumns) {
          console.log('Order by. Not available.');
        });
        gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
          paginationOptions.page = newPage;
          paginationOptions.pageSize = pageSize;
          $scope.search();
        });
      }
    };

    $scope.gridActions = {
      edit: function (row) {
        $state.go('^.editar', {credito: row.id});
      }
    };

    $scope.search = function () {
      var ft = $scope.filterOptions.filterText;
      var desde = (paginationOptions.page * paginationOptions.pageSize) - paginationOptions.pageSize;
      var hasta = paginationOptions.pageSize;

      CreditoService.findByFilterText(ft, ['ACTIVO'], desde, hasta).then(function (response) {
        $scope.gridOptions.data = response;
      });
      CreditoService.count(ft).then(function (response) {
        $scope.gridOptions.totalItems = response;
      });
    };

  }
);
{'fraction_non_alphanumeric': 0.15716631480178278, 'fraction_numerical': 0.007037297677691766, 'mean_word_length': 2.19124251497006, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, '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': '6540831', 'n_tokens_mistral': 2678, 'n_tokens_neox': 2539, 'n_words': 409}