Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.44 KB | None | 0 0
  1. <h2>CreateNewEmployee</h2>
  2.  
  3. <table class="table" style="width: 100%">
  4. <tr>
  5. <td style="text-align: left; width: 20%;">
  6. <label class="labelsytle">
  7. First Name
  8. </label>
  9. </td>
  10. <td style="text-align: left;">
  11. <input class="form-control" name="search" ng- model="Empdet.FirstName" placeholder="Enter First Name" style="border-radius: 5px;" />
  12. </td>
  13. </tr>
  14. <tr>
  15. <td style="text-align: left;">
  16. <label class="labelsytle">
  17. Last Name
  18. </label>
  19. </td>
  20. <td style="text-align: left;">
  21. <input class="form-control" name="search" ng-model="Empdet.LastName" placeholder="Enter Last Name" style="border-radius: 5px;" />
  22. </td>
  23. </tr>
  24. <tr>
  25. <td style="text-align: left;">
  26. <label class="labelsytle">
  27. Email
  28. </label>
  29. </td>
  30. <td style="text-align: left;">
  31. <input class="form-control" name="search" ng-model="Empdet.Email" placeholder="Enter Email" style="border-radius: 5px;" />
  32. </td>
  33. </tr>
  34. <tr>
  35. <td style="text-align: left;">
  36. <label class="labelsytle" for="file">
  37. PhotoFile
  38. </label>
  39. </td>
  40. <td style="text-align: left;">
  41. <form action="" method="post" enctype="multipart/form-data">
  42. <input class="form-control" name="file" type="file" ng-model="Empdet.PhotoFile" id="file" style="border-radius: 5px;"/>
  43. </form>
  44. </td>
  45. </tr>
  46. <tr>
  47. <td style="text-align: left;">
  48. <label class="labelsytle">
  49. PhotoText
  50. </label>
  51. </td>
  52. <td style="text-align: left;">
  53. <input class="form-control" name="search" ng-model="Empdet.PhotoText" placeholder="Enter PhotoText" style="border-radius: 5px;" />
  54. </td>
  55. </tr>
  56. <tr>
  57. <td style="text-align: left;">
  58. <label class="labelsytle">
  59. Age
  60. </label>
  61. </td>
  62. <td style="text-align: left;">
  63. <input class="form-control" name="search" ng-model="Empdet.Age" placeholder="Enter Age" style="border-radius: 5px;" />
  64. </td>
  65. </tr>
  66.  
  67. <tr style="display: block; text-align: center; width: 5%; margin: 0 auto;">
  68. <td style="text-align: left; width: 25px;" colspan="4">
  69. <button class="btn btn-primary" type="button" ng-click="SaveEmpdet(Empdet)" style="border-radius: 5px; font-family: Consolas;">SAVE</button></td>
  70.  
  71. <td style="text-align: left; width: 25px;">
  72. <button class="btn btn-primary" type="button" ng-click="Cancel()" style="border-radius: 5px; font-family: Consolas;">CANCEL</button></td>
  73. </tr>
  74.  
  75.  
  76. </table>
  77.  
  78. angular.module('MyEmployee.controllers', ['ngDialog', 'ui.bootstrap'])
  79. .controller("EmployeeDetailController", function ($scope, EmployeeFactory, ngDialog) {
  80. $scope.Empdet = {}
  81. $scope.Empdet.FirstName = '';
  82. $scope.Empdet.LastName = '';
  83. $scope.Empdet.Email = '';
  84. $scope.Empdet.PhotoFile = '';
  85. $scope.Empdet.PhotoText = '';
  86. $scope.Empdet.Age = '';
  87. $scope.Empdet.Id = 0;
  88.  
  89. $scope.EditEmployeeShow = true;
  90. $scope.ShowDeletePopup = true;
  91. $scope.ShowAlert = true;
  92.  
  93. $scope.SaveEmpdet = function (newEmpdet) {
  94. console.log('save clicked')
  95. EmployeeFactory.SaveNewEmployee(newEmpdet)
  96. $scope.Empdet={};
  97. $scope.ShowAlert = false;
  98. $scope.EditEmployeeShow = true;
  99. $scope.SelectEmployeeList();
  100. };
  101.  
  102. $scope.closeAlert = function () {
  103. $scope.ShowAlert = true;
  104. };
  105.  
  106. $scope.Cancel = function () {
  107. console.log('cancel clicked')
  108. };
  109.  
  110. $scope.DeleteEmployee = function (Id) {
  111. console.log('Delete clicked')
  112. console.log(Id);
  113. EmployeeFactory.DeleteEmployee(Id);
  114. $scope.SelectEmployeeList();
  115. };
  116.  
  117. $scope.init = function(){
  118. $scope.SelectEmployeeList();
  119. }
  120.  
  121. $scope.SelectEmployeeList = function () {
  122. console.log('Select in controller')
  123. EmployeeFactory.SelectEmployeeList().success(function (response) {
  124. console.log('response.IsSuccessful');
  125. console.log(response.Data);
  126.  
  127. $scope.IsSuccessful = response.IsSuccessful;
  128. if ($scope.IsSuccessful) {
  129. $scope.EmpdetList = response.Data;
  130. console.log('$scope.EmpdetList');
  131. console.log($scope.EmpdetList);
  132. $scope.CanClearMessage = true;
  133. } else {
  134. $scope.SuccessMessage = '';
  135. $scope.ErrorMessage = response.ReasonForFailure;
  136. $scope.CanClearMessage = true;
  137. }
  138.  
  139. //$scope.tableParams = new ngTableParams({
  140. // page: 1, // show first page
  141. // count: 10, // count per page
  142. // sorting: {
  143. // //name: 'asc' // initial sorting
  144. // },
  145. // filter: {
  146. // //name: 'asc' // initial sorting
  147. // }
  148.  
  149. //}, {
  150. // total: $scope.GetLists.length, // length of data
  151. // getData: function ($defer, params) {
  152. // var filteredData = params.filter() ? $filter('filter')($scope.GetLists, params.filter()) : $scope.GetLists;
  153. // var orderedData = params.sorting() ? $filter('orderBy')(filteredData, params.orderBy()) : $scope.GetLists;
  154. // $defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
  155. // }
  156. //});
  157.  
  158.  
  159. });
  160. }
  161. })
  162.  
  163. <h2>EmpdetList</h2>
  164.  
  165. <table class="table table-bordered table-hover table-striped" ng-table="tableParams" show-filter="true">
  166. <tr ng-repeat="Empdet in EmpdetList">
  167. <td data-title="'Id'" filter="{ 'Id': 'text' }" sortable="'Id'">{{Empdet.Id}}</td>
  168. <td data-title="'FirstName'" sortable="'FirstName'" filter="{ 'FirstName': 'text' }">{{Empdet.FirstName}}</td>
  169. <td data-title="'LastName'" sortable="'LastName'" filter="{ 'LastName': 'text' }" >{{Empdet.LastName}}</td>
  170. <td data-title="'Email'" sortable="'Email'" filter="{ 'Email': 'text' }">{{Empdet.Email}}</td>
  171. <td data-title="'PhotoFile'" sortable="'PhotoFile'" filter="{ 'PhotoFile': 'text' }"><img src="{{Empdet.PhotoFile}}"/></td>
  172. <td data-title="'PhotoText'" sortable="'PhotoText'" filter="{ 'PhotoText': 'text' }">{{Empdet.PhotoText}}</td>
  173. <td data-title="'Age'" sortable="'Age'" filter="{ 'Age': 'text' }">{{Empdet.Age}}</td>
  174.  
  175. <td data-title="'Action'">
  176. <div data-toggle="modal" data-id="{{Empdet.Id}}" data-index="{{$index}}" data-name="{{Empdet.Id}}" ng-click="DeleteEmployee(Empdet.Id)" title='Click to delete the Account' class="open-confirm-delete fa fa-trash-o deleterow" style="height: 24px!important;">
  177. </div>
  178. </td>
  179.  
  180. </tr>
  181. </table>
  182.  
  183. @*<div class="modal fade" collapse ="ShowDeletePopup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  184. <div class="modal-dialog">
  185. <div class="modal-content">
  186. <div class="modal-header">
  187. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  188. <h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>
  189. </div>
  190. <div class="modal-body">
  191. <input type="hidden" name="name" id="name" value="" />
  192. <p>
  193. Do you want to Delete
  194. <label id="name1"></label>
  195. ?
  196. </p>
  197. </div>
  198. <div class="modal-footer">
  199. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  200. <button type="button" id="deletebutton" class="btn btn-danger danger" ng-click="DeleteEmployee(selected.Id)" data-dismiss="modal">Delete</button>
  201. </div>
  202. </div>
  203. </div>
  204. </div>*@
  205.  
  206.  
  207. @*<div id="confirmModal" aria-hidden="true">
  208. <div class="modal-dialog" >
  209. <div class="modal-header">
  210. <h3 class="modal-title">Confirm Delete</h3>
  211. </div>
  212. <div class="modal-body">
  213. Are you sure to delete the Account {{ selected.Empdet.Id }}
  214. </div>
  215. <div class="modal-footer">
  216. <button class="btn btn-primary" ng-click="DeleteEmployee()">Delete</button>
  217. <button class="btn btn-warning" data-dismiss="modal">Cancel</button>
  218. </div>
  219. </div>
  220. </div>*@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement