3f64577acf2e67180b971ebacc89c6308a3cb04f.svn-base 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. $(function () {
  2. 'use strict';
  3. BemsWebApplication.Popup.ConfirmDueDate = {
  4. create: function (viewModel) {
  5. //var dueDateDataSource = BWA.DataUtil.createDataSource({
  6. // dataSourceOptions: {
  7. // store: BemsWebApplication.odata.AvailableDueDate,
  8. // select: [ 'DueDate' ]
  9. // }
  10. //});
  11. var handleUpdate = viewModel.update,
  12. dataModel = viewModel.dataModel,
  13. popup = viewModel.popup;
  14. var popupVisible = ko.observable(false),
  15. toolbarItems = [
  16. { location: 'before', text: '차기작업확정일자' },
  17. { location: 'after', widget: 'button', options: { text: $G('save'), icon: 'save', clickAction: handleSave } },
  18. { location: 'after', widget: 'button', options: { text: $G('close'), icon: 'close', clickAction: handleClose } }
  19. ],
  20. popupOptions = {
  21. width: '400px',
  22. height: 'auto',
  23. //shading: false,
  24. shadingColor: 'rgba(0,0,0,0.0)',
  25. visible: popupVisible,
  26. closeOnOutsideClick: false,
  27. animation: utils.popup.createAnimation()
  28. };
  29. function handlePopupShown() {
  30. // ODATA load 방법
  31. //dueDateDataSource.load().done(function (result) {
  32. // utils.toast.show('Load done...');
  33. //});
  34. // params...
  35. var commonParameters = {
  36. SiteId: dataModel.SiteId(),
  37. WorkRequestId: dataModel.WorkRequestId()
  38. };
  39. // API 로드 방법
  40. BemsWebApplication.api.get('AvailableDueDate/GetAvailableDueDate', commonParameters).done(function (values) {
  41. var formatDate = new Date(values[0].DueDate);
  42. //formatDate.setDate(formatDate.getDate() - 2);
  43. dataModel.ConfirmDueDate(formatDate);
  44. });
  45. }
  46. function handleSave() {
  47. dataModel.IsConfirmDueDate(true);
  48. viewModel.dataModel.ConfirmDueDate(dataModel.ConfirmDueDate());
  49. popupVisible(false);
  50. }
  51. function handleClose() {
  52. dataModel.ConfirmDueDate(undefined);
  53. dataModel.IsConfirmDueDate(false);
  54. popupVisible(false);
  55. }
  56. return {
  57. popupVisible: popupVisible,
  58. popupOptions: popupOptions,
  59. toolbarItems: toolbarItems,
  60. handlePopupShown: handlePopupShown,
  61. show: function () {
  62. popupVisible(true);
  63. },
  64. hide: function () {
  65. popupVisible(false);
  66. }
  67. };
  68. }
  69. }
  70. });