import {Component,OnInit, ElementRef, NgZone, ViewChild} from '@angular/core';
import { trigger, transition, animate, style } from '@angular/animations';
import {MyserviceService} from '../myservice.service'
@Component({
  selector: 'app-treatmentauthorization',
  templateUrl: './treatmentauthorization.page.html',
  styleUrls: ['./treatmentauthorization.page.scss'],
})
export class TreatmentauthorizationPage implements OnInit {
  shownGroup = null;
  treatment_authorization:any;
  constructor(public myservice : MyserviceService) { 
    this.shownGroup = 0;
    this.treatment_authorization = {
       "message":"success",
        "data" :[
        { 
        "name":"TreatmentAuthorizations2019511114723687",
        "treatment_type":"Tube feeding",
        "treatment_description":"test",
        "expiry_date":"06/21/2019",
        "times_per_day":"2",
        "time_of_first_treat":"11:47:00",
        "dte_of_first_treat":"11/6/2019"
        },
        {
        "name":"TreatmentAuthorizations201951014481192",
        "treatment_type":"Radiation therapy",
        "treatment_description":"test",
        "expiry_date":"06/21/2019",
        "times_per_day":"2",
        "time_of_first_treat":"14:48",
        "dte_of_first_treat":"10/6/2019"
        },
        {
        "name":"TreatmentAuthorizations2019510121528700",
        "treatment_type":"Vaccine therapy",
        "treatment_description":"test",
        "expiry_date":"06/21/2019",
        "times_per_day":"2",
        "time_of_first_treat":"14:48:00",
        "dte_of_first_treat":"10/6/2019"
        },
        {
        "name":"TreatmentAuthorizations20195714285491",
        "treatment_type":"Inhalation",
        "treatment_description":"test",
        "expiry_date":"06/21/2019",
        "times_per_day":"2",
        "time_of_first_treat":"14:29:00",
        "dte_of_first_treat":"7/6/2019"
        },
        {
        "name":"TreatmentAuthorizations20195713131612",
        "treatment_type":"Chemotherapy",
        "treatment_description":"test",
        "expiry_date":"06/20/2019",
        "times_per_day":"3",
        "time_of_first_treat":"13:01:00",
        "dte_of_first_treat":"7/6/2019 "
        }
        ]
      }
     this.get_treatmentAuthorizationDetails();
  }

  ngOnInit() {
  }
  isGroupShown(group) {
    return this.shownGroup === group;
    }
    toggleGroup(group) {
      if (this.isGroupShown(group)) {
      this.shownGroup = null;
      } else {
      this.shownGroup = group;
      }
      }
      get_treatmentAuthorizationDetails() {
        this.treatment_authorization = this.myservice.ObjArray(this.treatment_authorization.data);
        console.log(this.treatment_authorization);
      }
}
