directive.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. starter.directive('schedule', [
  2. function () {
  3. return {
  4. restrict: "E",
  5. scope: {
  6. data: "=source",
  7. },
  8. templateUrl: 'templates/template-schedule.html',
  9. controller: function ($scope, Schedule) {
  10. if ($scope.data.start_date != null) {
  11. var datetitle = "";
  12. $scope.isOver = false;
  13. if ($scope.data.end_date != null && new Date() > new Date($scope.data.end_date))
  14. $scope.isOver = true;
  15. // var currentDateTime = new Date();
  16. // var executeddTime = new Date(Date.parse($scope.data.execute_dd));
  17. // if (($scope.data.end_date != null && new Date(Date.parse($scope.data.end_date)) < currentDateTime) && currentDateTime > executeddTime ||
  18. // ($scope.data.repeat_type == 0 && $scope.data.start_date != null && new Date(Date.parse($scope.data.start_date)) < currentDateTime)) {
  19. // $scope.isOver = true;
  20. // } else {
  21. // $scope.isOver = false;
  22. // }
  23. //
  24. // if ($scope.data.execute_dd != null) {
  25. // var execute_temp = new Date(Date.parse($scope.data.execute_dd));
  26. // var minutes_str = execute_temp.getMinutes().toString();
  27. // var hours_str = execute_temp.getHours().toString();
  28. // if (parseInt(minutes_str) < 10) {
  29. // minutes_str = "0" + minutes_str;
  30. // }
  31. // if (parseInt(hours_str) < 10) {
  32. // hours_str = "0" + hours_str;
  33. // }
  34. // if (currentDateTime.getFullYear() == executeddTime.getFullYear() && currentDateTime.getMonth() == executeddTime.getMonth() &&
  35. // currentDateTime.getDate() == executeddTime.getDate()) {
  36. // datetitle = '今天' + " " + hours_str + ":" + minutes_str;
  37. // } else {
  38. // var year_str = "";
  39. // if (currentDateTime.getFullYear() != executeddTime.getFullYear()) {
  40. // year_str = executeddTime.getFullYear() + "年";
  41. // }
  42. // var Week = ['日', '一', '二', '三', '四', '五', '六'];
  43. // datetitle = year_str + (execute_temp.getMonth() + 1) + "月" + execute_temp.getDate() + "日 " + " 周" + Week[execute_temp.getDay()] + " " + hours_str + ":" + minutes_str;
  44. // }
  45. // }
  46. // $scope.execute_dd_title = datetitle;
  47. $scope.repeat_req_title = Schedule.getRepeatFreqTitle($scope.data.repeat_type, $scope.data.freq);
  48. }
  49. }
  50. }
  51. }
  52. ]);