<commit_before>module = angular.module('impac.components.widgets-settings.forecast-payroll',[])
module.controller('SettingForecastPayrollCtrl', ($scope, $log, ImpacDashboardsSvc, ImpacMainSvc, ImpacWidgetsSvc) ->

  w = $scope.parentWidget
  w.selectedForecastPayroll = false

  $scope.toggleForecastPayroll = ->
    w.selectedForecastPayroll = !w.selectedForecastPayroll

  $scope.isToggleForecastPayroll = ->
    return w.selectedForecastPayroll

  # What will be passed to parentWidget
  setting = {}
  setting.key = "forecast_payroll"
  setting.isInitialized = false

  # initialization of selected organizations
  setting.initialize = ->
    ImpacDashboardsSvc.load().then(
      (config) ->
        currentDashboard = config.currentDashboard
        return unless w.metadata? && w.metadata.forecast_payroll?
        w.selectedForecastPayroll = w.metadata.forecast_payroll
        setting.isInitialized = true
    )

  setting.toMetadata = ->
    return { forecast_payroll: w.selectedForecastPayroll }

  w.settings.push(setting)

  # Setting is ready: trigger load content
  # ------------------------------------
  $scope.deferred.resolve($scope.parentWidget)
)

module.directive('settingForecastPayroll', ($templateCache) ->
  return {
    restrict: 'A',
    scope: {
      parentWidget: '='
      mode: '@?'
      deferred: '='
      onSelect: '&?'
    },
    template: $templateCache.get('widgets-settings/forecast-payroll.tmpl.html'),
    controller: 'SettingForecastPayrollCtrl'
  }
)
<commit_msg>[IMPAC-855] - Include code review suggestions<commit_after>module = angular.module('impac.components.widgets-settings.forecast-payroll',[])
module.controller('SettingForecastPayrollCtrl', ($scope, ImpacDashboardsSvc) ->

  w = $scope.parentWidget
  $scope.selectedForecastPayroll = false

  $scope.toggleForecastPayroll = ->
    $scope.selectedForecastPayroll = !$scope.selectedForecastPayroll

  $scope.isToggleForecastPayroll = ->
    return $scope.selectedForecastPayroll

  # What will be passed to parentWidget
  setting = {}
  setting.key = "forecast_payroll"
  setting.isInitialized = false

  # initialization of selected organizations
  setting.initialize = ->
    ImpacDashboardsSvc.load().then(
      (config) ->
        currentDashboard = config.currentDashboard
        return unless w.metadata? && w.metadata.forecast_payroll?
        $scope.selectedForecastPayroll = w.metadata.forecast_payroll
        setting.isInitialized = true
    )

  setting.toMetadata = ->
    return { forecast_payroll: $scope.selectedForecastPayroll }

  w.settings.push(setting)

  # Setting is ready: trigger load content
  # ------------------------------------
  $scope.deferred.resolve($scope.parentWidget)
)

module.directive('settingForecastPayroll', ($templateCache) ->
  return {
    restrict: 'A',
    scope: {
      parentWidget: '='
      mode: '@?'
      deferred: '='
      onSelect: '&?'
    },
    template: $templateCache.get('widgets-settings/forecast-payroll.tmpl.html'),
    controller: 'SettingForecastPayrollCtrl'
  }
)

{'fraction_non_alphanumeric': 0.13736444298389747, 'fraction_numerical': 0.000985869208018403, 'mean_word_length': 3.41799709724238, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '4744026', 'n_tokens_mistral': 918, 'n_tokens_neox': 903, 'n_words': 145}