Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. Get_Patient_plan_schedule_By_PATIENT_PLAN_ID_Subscription = new Subscription();
  2. data_params: Params_Get_Patient_plan_schedule_By_PATIENT_PLAN_ID = new Params_Get_Patient_plan_schedule_By_PATIENT_PLAN_ID();
  3.  
  4. this.entry.My_Patient_plan_schedules = [];
  5. this.data_params.PATIENT_PLAN_ID=this.entry.PATIENT_PLAN_ID;
  6. fetchData(){
  7. this.entry.My_Patient_plan_schedules = [];
  8. this.data_params.PATIENT_PLAN_ID=this.entry.PATIENT_PLAN_ID;
  9. this.Get_Patient_plan_schedule_By_PATIENT_PLAN_ID_Subscription=this.proxy.Get_Patient_plan_schedule_By_PATIENT_PLAN_ID(this.data_params)
  10. .subscribe(result => {
  11. if (result != null) {
  12. result.forEach((element: any) => {
  13. this.entry.My_Patient_plan_schedules.push(element);
  14. });
  15. }
  16. })
  17. }
  18. Add_Patient_plan_schedule(entry) {
  19. if (entry.My_Patient_plan_schedules == null) {
  20. entry.My_Patient_plan_schedules = [];
  21. }
  22. if (entry.My_Patient_plan_schedules.filter(e => e.PATIENT_PLAN_SCHEDULE_ID === -1).length > 0) {
  23. return;
  24. }
  25. const child = new Patient_plan_schedule();
  26. child.PATIENT_PLAN_SCHEDULE_ID = -1;
  27. child.PATIENT_PLAN_ID = entry.PATIENT_PLAN_ID;
  28. entry.My_Patient_plan_schedules.unshift(child);
  29. }
  30.  
  31. Edit_Patient_plan_schedule(entry: Patient_plan, Patient_plan_schedule: Patient_plan_schedule) {
  32. this.proxy.Edit_Patient_plan_schedule(Patient_plan_schedule).subscribe((result) => {
  33. if (result != null) {
  34.  
  35. this.CmSvc.ShowMessage('Done');
  36. entry.My_Patient_plan_schedules.splice(entry.My_Patient_plan_schedules.indexOf(Patient_plan_schedule), 1);
  37. const newEntry: any = result;
  38. entry.My_Patient_plan_schedules.unshift(newEntry);
  39. }
  40. });
  41. }
  42.  
  43. Delete_Patient_plan_schedule(entry: Patient_plan, Patient_plan_schedule: Patient_plan_schedule) {
  44. const dialogRef = this.dialog.open(DeleteConfirmationComponent);
  45. dialogRef.afterClosed().subscribe(response => {
  46. if (response) {
  47. const _params_Delete_Patient_plan_schedule = new Params_Delete_Patient_plan_schedule();
  48. _params_Delete_Patient_plan_schedule.PATIENT_PLAN_SCHEDULE_ID = Patient_plan_schedule.PATIENT_PLAN_SCHEDULE_ID;
  49. this.proxy.Delete_Patient_plan_schedule(_params_Delete_Patient_plan_schedule).subscribe(data => {
  50. if (data === "") {
  51. entry.My_Patient_plan_schedules.splice(entry.My_Patient_plan_schedules.indexOf(Patient_plan_schedule), 1);
  52. }
  53. });
  54. }
  55. });
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement