| @@ 1-84 (lines=84) @@ | ||
| 1 | "use strict"; |
|
| 2 | app.controller('staffProfileAmendController', ['$scope', '$element', function ($scope, $element, $rootScope) { |
|
| 3 | function Initialize(){ |
|
| 4 | var entryForm = {}; |
|
| 5 | $scope.entryForm = entryForm; |
|
| 6 | $scope.directiveDict = {}; |
|
| 7 | ||
| 8 | $scope.deptEditBox = {}; |
|
| 9 | $scope.sectionEditBox = {}; |
|
| 10 | } |
|
| 11 | Initialize(); |
|
| 12 | ||
| 13 | $scope.SetDefaultValue = function(scope, iElement, iAttrs, controller){ |
|
| 14 | // entryForm.StaffID = ""; |
|
| 15 | // entryForm.Surname = ""; |
|
| 16 | // entryForm.GivenName = ""; |
|
| 17 | // entryForm.ChineseName = ""; |
|
| 18 | ||
| 19 | controller.ngModel.DateOfBirth = new Date(0, 0, 0); |
|
| 20 | controller.ngModel.EmployeeDate = new Date(0, 0, 0); |
|
| 21 | } |
|
| 22 | ||
| 23 | $scope.EventListener = function(scope, iElement, iAttrs, controller){ |
|
| 24 | console.log("<"+iElement[0].tagName+">" +" Directive overried EventListener()"); |
|
| 25 | var prgmID = scope.programId; |
|
| 26 | var tagName = iElement[0].tagName.toLowerCase(); |
|
| 27 | var editMode = ""; |
|
| 28 | ||
| 29 | if(tagName == "entry") editMode = iAttrs.editMode; |
|
| 30 | ||
| 31 | if(!prgmID) |
|
| 32 | return; |
|
| 33 | ||
| 34 | var varName = prgmID;//tagName + prgmID + editMode; |
|
| 35 | varName = varName.toLowerCase(); |
|
| 36 | ||
| 37 | if($scope.directiveDict[varName] == null || typeof($scope.directiveDict[varName]) == "undefined"){ |
|
| 38 | $scope.directiveDict[varName] = scope; |
|
| 39 | } |
|
| 40 | ||
| 41 | // console.dir(scope); |
|
| 42 | // console.dir(iElement); |
|
| 43 | // console.dir(iAttrs); |
|
| 44 | // console.dir(controller); |
|
| 45 | ||
| 46 | //http://api.jquery.com/Types/#Event |
|
| 47 | //The standard events in the Document Object Model are: |
|
| 48 | // blur, focus, load, resize, scroll, unload, beforeunload, |
|
| 49 | // click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, |
|
| 50 | // change, select, submit, keydown, keypress, and keyup. |
|
| 51 | iElement.ready(function() { |
|
| 52 | ||
| 53 | }) |
|
| 54 | } |
|
| 55 | ||
| 56 | $scope.CustomSelectedToRecord = function(sRecord, rowScope, scope, iElement, controller){ |
|
| 57 | console.log("<"+iElement[0].tagName+">" +" Directive overried CustomPointedToRecord()"); |
|
| 58 | ||
| 59 | var tagName = iElement[0].tagName.toLowerCase(); |
|
| 60 | var prgmID = scope.programId.toLowerCase(); |
|
| 61 | ||
| 62 | if(prgmID == "hw01sm"){ |
|
| 63 | // asign the selected record to ng-model |
|
| 64 | $.extend(true, $scope.entryForm, sRecord) |
|
| 65 | } |
|
| 66 | ||
| 67 | if(prgmID == "dw01dp"){ |
|
| 68 | // asign the selected record to ng-model |
|
| 69 | $scope.entryForm.DeptCode = sRecord.DepartmentCode; |
|
| 70 | } |
|
| 71 | ||
| 72 | else if (prgmID == "dw02se"){ |
|
| 73 | $scope.entryForm.SectionCode = sRecord.SectionCode; |
|
| 74 | } |
|
| 75 | ||
| 76 | } |
|
| 77 | ||
| 78 | $scope.ValidateBuffer = function(scope, iElement, iAttrs, controller){ |
|
| 79 | controller.ngModel.FullName = controller.ngModel.LastName + ' ' + controller.ngModel.FirstName; |
|
| 80 | ||
| 81 | return true; |
|
| 82 | }; |
|
| 83 | ||
| 84 | }]); |
|
| @@ 1-84 (lines=84) @@ | ||
| 1 | "use strict"; |
|
| 2 | app.controller('staffProfileAmendController', ['$scope', '$element', function ($scope, $element, $rootScope) { |
|
| 3 | function Initialize(){ |
|
| 4 | var entryForm = {}; |
|
| 5 | $scope.entryForm = entryForm; |
|
| 6 | $scope.directiveDict = {}; |
|
| 7 | ||
| 8 | $scope.deptEditBox = {}; |
|
| 9 | $scope.sectionEditBox = {}; |
|
| 10 | } |
|
| 11 | Initialize(); |
|
| 12 | ||
| 13 | $scope.SetDefaultValue = function(scope, iElement, iAttrs, controller){ |
|
| 14 | // entryForm.StaffID = ""; |
|
| 15 | // entryForm.Surname = ""; |
|
| 16 | // entryForm.GivenName = ""; |
|
| 17 | // entryForm.ChineseName = ""; |
|
| 18 | ||
| 19 | controller.ngModel.DateOfBirth = new Date(0, 0, 0); |
|
| 20 | controller.ngModel.EmployeeDate = new Date(0, 0, 0); |
|
| 21 | } |
|
| 22 | ||
| 23 | $scope.EventListener = function(scope, iElement, iAttrs, controller){ |
|
| 24 | console.log("<"+iElement[0].tagName+">" +" Directive overried EventListener()"); |
|
| 25 | var prgmID = scope.programId; |
|
| 26 | var tagName = iElement[0].tagName.toLowerCase(); |
|
| 27 | var editMode = ""; |
|
| 28 | ||
| 29 | if(tagName == "entry") editMode = iAttrs.editMode; |
|
| 30 | ||
| 31 | if(!prgmID) |
|
| 32 | return; |
|
| 33 | ||
| 34 | var varName = prgmID;//tagName + prgmID + editMode; |
|
| 35 | varName = varName.toLowerCase(); |
|
| 36 | ||
| 37 | if($scope.directiveDict[varName] == null || typeof($scope.directiveDict[varName]) == "undefined"){ |
|
| 38 | $scope.directiveDict[varName] = scope; |
|
| 39 | } |
|
| 40 | ||
| 41 | // console.dir(scope); |
|
| 42 | // console.dir(iElement); |
|
| 43 | // console.dir(iAttrs); |
|
| 44 | // console.dir(controller); |
|
| 45 | ||
| 46 | //http://api.jquery.com/Types/#Event |
|
| 47 | //The standard events in the Document Object Model are: |
|
| 48 | // blur, focus, load, resize, scroll, unload, beforeunload, |
|
| 49 | // click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, |
|
| 50 | // change, select, submit, keydown, keypress, and keyup. |
|
| 51 | iElement.ready(function() { |
|
| 52 | ||
| 53 | }) |
|
| 54 | } |
|
| 55 | ||
| 56 | $scope.CustomSelectedToRecord = function(sRecord, rowScope, scope, iElement, controller){ |
|
| 57 | console.log("<"+iElement[0].tagName+">" +" Directive overried CustomPointedToRecord()"); |
|
| 58 | ||
| 59 | var tagName = iElement[0].tagName.toLowerCase(); |
|
| 60 | var prgmID = scope.programId.toLowerCase(); |
|
| 61 | ||
| 62 | if(prgmID == "hw01sm"){ |
|
| 63 | // asign the selected record to ng-model |
|
| 64 | $.extend(true, $scope.entryForm, sRecord) |
|
| 65 | } |
|
| 66 | ||
| 67 | if(prgmID == "dw01dp"){ |
|
| 68 | // asign the selected record to ng-model |
|
| 69 | $scope.entryForm.DeptCode = sRecord.DepartmentCode; |
|
| 70 | } |
|
| 71 | ||
| 72 | else if (prgmID == "dw02se"){ |
|
| 73 | $scope.entryForm.SectionCode = sRecord.SectionCode; |
|
| 74 | } |
|
| 75 | ||
| 76 | } |
|
| 77 | ||
| 78 | $scope.ValidateBuffer = function(scope, iElement, iAttrs, controller){ |
|
| 79 | controller.ngModel.FullName = controller.ngModel.LastName + ' ' + controller.ngModel.FirstName; |
|
| 80 | ||
| 81 | return true; |
|
| 82 | }; |
|
| 83 | ||
| 84 | }]); |
|
| @@ 1-84 (lines=84) @@ | ||
| 1 | "use strict"; |
|
| 2 | app.controller('staffProfileAmendController', ['$scope', '$element', function ($scope, $element, $rootScope) { |
|
| 3 | function Initialize(){ |
|
| 4 | var entryForm = {}; |
|
| 5 | $scope.entryForm = entryForm; |
|
| 6 | $scope.directiveDict = {}; |
|
| 7 | ||
| 8 | $scope.deptEditBox = {}; |
|
| 9 | $scope.sectionEditBox = {}; |
|
| 10 | } |
|
| 11 | Initialize(); |
|
| 12 | ||
| 13 | $scope.SetDefaultValue = function(scope, iElement, iAttrs, controller){ |
|
| 14 | // entryForm.StaffID = ""; |
|
| 15 | // entryForm.Surname = ""; |
|
| 16 | // entryForm.GivenName = ""; |
|
| 17 | // entryForm.ChineseName = ""; |
|
| 18 | ||
| 19 | controller.ngModel.DateOfBirth = new Date(0, 0, 0); |
|
| 20 | controller.ngModel.EmployeeDate = new Date(0, 0, 0); |
|
| 21 | } |
|
| 22 | ||
| 23 | $scope.EventListener = function(scope, iElement, iAttrs, controller){ |
|
| 24 | console.log("<"+iElement[0].tagName+">" +" Directive overried EventListener()"); |
|
| 25 | var prgmID = scope.programId; |
|
| 26 | var tagName = iElement[0].tagName.toLowerCase(); |
|
| 27 | var editMode = ""; |
|
| 28 | ||
| 29 | if(tagName == "entry") editMode = iAttrs.editMode; |
|
| 30 | ||
| 31 | if(!prgmID) |
|
| 32 | return; |
|
| 33 | ||
| 34 | var varName = prgmID;//tagName + prgmID + editMode; |
|
| 35 | varName = varName.toLowerCase(); |
|
| 36 | ||
| 37 | if($scope.directiveDict[varName] == null || typeof($scope.directiveDict[varName]) == "undefined"){ |
|
| 38 | $scope.directiveDict[varName] = scope; |
|
| 39 | } |
|
| 40 | ||
| 41 | // console.dir(scope); |
|
| 42 | // console.dir(iElement); |
|
| 43 | // console.dir(iAttrs); |
|
| 44 | // console.dir(controller); |
|
| 45 | ||
| 46 | //http://api.jquery.com/Types/#Event |
|
| 47 | //The standard events in the Document Object Model are: |
|
| 48 | // blur, focus, load, resize, scroll, unload, beforeunload, |
|
| 49 | // click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, |
|
| 50 | // change, select, submit, keydown, keypress, and keyup. |
|
| 51 | iElement.ready(function() { |
|
| 52 | ||
| 53 | }) |
|
| 54 | } |
|
| 55 | ||
| 56 | $scope.CustomSelectedToRecord = function(sRecord, rowScope, scope, iElement, controller){ |
|
| 57 | console.log("<"+iElement[0].tagName+">" +" Directive overried CustomPointedToRecord()"); |
|
| 58 | ||
| 59 | var tagName = iElement[0].tagName.toLowerCase(); |
|
| 60 | var prgmID = scope.programId.toLowerCase(); |
|
| 61 | ||
| 62 | if(prgmID == "hw01sm"){ |
|
| 63 | // asign the selected record to ng-model |
|
| 64 | $.extend(true, $scope.entryForm, sRecord) |
|
| 65 | } |
|
| 66 | ||
| 67 | if(prgmID == "dw01dp"){ |
|
| 68 | // asign the selected record to ng-model |
|
| 69 | $scope.entryForm.DeptCode = sRecord.DepartmentCode; |
|
| 70 | } |
|
| 71 | ||
| 72 | else if (prgmID == "dw02se"){ |
|
| 73 | $scope.entryForm.SectionCode = sRecord.SectionCode; |
|
| 74 | } |
|
| 75 | ||
| 76 | } |
|
| 77 | ||
| 78 | $scope.ValidateBuffer = function(scope, iElement, iAttrs, controller){ |
|
| 79 | controller.ngModel.FullName = controller.ngModel.LastName + ' ' + controller.ngModel.FirstName; |
|
| 80 | ||
| 81 | return true; |
|
| 82 | }; |
|
| 83 | ||
| 84 | }]); |
|