BasicConfig.Controller.js 1.1 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
'use strict'

angular.module('RECRUIT').controller('BasicConfig', function ($scope, $mdDialog, RecService, $filter, SwapLang) {
  $scope.lang = getLang();
  $scope.HrSwlang = SwapLang
  $scope.basicConfig = {}

  $scope.lstPhoneFormat = [
    {
      "id": "1",
      "regex": "/^0{1}\\d{8,9}$/",
      "format": "0XXXXXXXX / 0XXXXXXXXXX"
    },
    {
      "id": "2",
      "regex": "/^0{1}\\d{1,2}-{1}\\d{3}-{1}\\d{4}$/",
      "format": "0X-XXX-XXXX / 0XX-XXX-XXXX"

    },
    {
      "id": "3",
      "regex": "/^0?\\d{2}[-]?\\d{7}$/",
      "format": "0X-XXXXXXX / 0XX-XXXXXXX"
    }
  ]

  $scope.init = function () {
    RecService.ManageConfig.query({cname: 'BASIC'}).$promise.then(function (data) {
      $scope.basicConfig = data.result
    })
  }
  $scope.init()


  $scope.submit = function () {
    $scope.HrSwlang.getConfirm(1).then(function () {
      RecService.ManageConfig.save($scope.basicConfig).$promise.then(function () {
        $scope.HrSwlang.getAlert(18).then(function () {
          $scope.init()
        })
      }, function () {
        $scope.HrSwlang.getAlert(17)
      })
    })

  };


})