]> git.uio.no Git - u/erikhf/frm.git/commitdiff
merge
authorJulie Hill Roa <julie.hill.roa@gmail.com>
Sun, 6 Dec 2015 16:46:52 +0000 (17:46 +0100)
committerJulie Hill Roa <julie.hill.roa@gmail.com>
Sun, 6 Dec 2015 16:46:52 +0000 (17:46 +0100)
1  2 
src/components/search/search.ts
src/components/sidebar/sidebar.html
src/components/sidebar/sidebar.ts

Simple merge
index ba5e4eead62be9d8650651318be83fdcf6a19d7b,267e49b839dc55479c8ac0d8069684cfdb8d25e8..31e648fbb3b1d519d610269533bd3bc7d7b31a6d
  
          </form>
  
-         <!--
  
-         <form [ng-form-model]="form">
-             <ul ng-control-group="groups">
-                 <li *ng-for="#group of ctrlGroups; #i = index"><input ng-control="{{i}}"></li>
-             </ul>
-         </form>
- -->
-         <section *ng-if="!editmode">
-             <h2>Organisation Unit</h2>
-             <label for="actOrgUnitName">Name</label>
+         <section id="nonedit" *ng-if="!editmode">
+             <label class="label-text" for="actOrgUnitName">Name</label>
  
-             <p id="actOrgUnitName">{{(form.controls.name.value) || "[None]"}}</p>
+             <p id="actOrgUnitName">{{(form.controls.name.value) || "[None]"}}</p><hr>
  
-             <label for="actOrgUnitShortName">Short Name</label>
+             <label class="label-text" for="actOrgUnitShortName">Short Name</label>
  
-             <p id="actOrgUnitShortName">{{(form.controls.shortName.value)||["None"]}}</p>
+             <p id="actOrgUnitShortName">{{(form.controls.shortName.value)||["None"]}}</p><hr>
  
-             <label for="actOrgUnitDescription">Description</label>
+             <label class="label-text" for="actOrgUnitDescription">Description</label>
  
-             <p id="actOrgUnitDescription">{{(form.controls.description.value)||"None"}}</p>
+             <p id="actOrgUnitDescription">{{(form.controls.description.value)||"None"}}</p><hr>
  
-             <label for="actOrgUnitCode">Code</label>
+             <label class="label-text" for="actOrgUnitCode">Code</label>
  
-             <p id="actOrgUnitCode">{{(form.controls.code.value)||["None"]}}</p>
+             <p id="actOrgUnitCode">{{(form.controls.code.value)||["None"]}}</p><hr>
  
-             <label for="actOrgUnitOpeningDate">Opening Date</label>
+             <label class="label-text" for="actOrgUnitOpeningDate">Opening Date</label>
  
-             <p id="actOrgUnitOpeningDate">{{form.controls.openingDate.value||["None"]}}</p>
+             <p id="actOrgUnitOpeningDate">{{form.controls.openingDate.value||["None"]}}</p><hr>
  
-             <label for="actOrgUnitClosingDate">Closed Date</label>
+             <label class="label-text" for="actOrgUnitClosingDate">Closed Date</label>
  
-             <p id="actOrgUnitClosingDate">{{form.controls.closedDate.value||["None"]}}</p>
+             <p id="actOrgUnitClosingDate">{{form.controls.closedDate.value||["None"]}}</p><hr>
  
-             <label for="actOrgUnitURL">Url</label>
+             <label class="label-text" for="actOrgUnitURL">Url</label>
  
-             <p id="actOrgUnitURL">{{(form.controls.url.value) ||["None"]}}</p>
+             <p id="actOrgUnitURL">{{(form.controls.url.value) ||["None"]}}</p><hr>
  
 +            <fieldset>
 +                <legend>Coordinates</legend>
 +                <div *ng-if="featureType.value == 'POINT'" class="form-group">
 +                    <label>Latitude</label>
 +                    <p>{{form.controls.lat.value}}</p>
 +                    <label>Longitude</label>
 +                    <p>{{form.controls.lng.value}}</p>
 +                </div>
 +                <div *ng-if="featureType.value == 'NONE'" class="alert alert-danger">
 +                    <p>This organisation unit has no associated coordinates</p>
 +                </div>
 +                <div *ng-if="featureType.value == 'POLYGON' || featureType.value == 'MULTI_POLYGON'">
 +                    <p>polygon</p>
 +                </div>
 +
 +            </fieldset>
 +
 +            <fieldset>
 +                <legend>Contact Information</legend>
 +                <label>Contact person</label>
 +                <p>{{form.controls.contactPerson.value || ["None"]}}</p>
 +                <label>Address</label>
 +                <p>{{form.controls.address.value || ["None"]}}</p>
 +                <label>E-mail</label>
 +                <p>{{form.controls.email.value || ["None"]}}</p>
 +                <label>Phone number</label>
 +                <p>{{form.controls.phoneNumber.vaule || ["None"]}}</p>
 +            </fieldset>
              <button class="btn btn-default" (click)="editmode = !editmode">Edit</button>
          </section>
  
index 6e2beaa0e0a6fda2004cc6e35c0326e856f5571c,8159499273d570fe6631cabcfeed1abc04240f6c..f3bf2a09e2b8411b3acc11770e8cafbd3b4af2d9
@@@ -53,32 -72,8 +75,33 @@@ export class Sidebar 
      address: Control = new Control("");
      email: Control = new Control("");
      phoneNumber: Control = new Control("");
 -
+     exitButton: any;
 +    featureType: Control = new Control("");
 +    coordinates: Control = new Control("");
 +    ctrlGroups: Control[]= [new Control('')];
 +    groupsArray: ControlArray = new ControlArray(this.ctrlGroups);
 +
 +
 +    form: ControlGroup = new ControlGroup({
 +        organisationUnitGroups: this.groupsArray,
 +        id: this.id,
 +        name: this.name,
 +        shortName: this.shortName,
 +        description: this.description,
 +        code: this.code,
 +        openingDate: this.openingDate,
 +        closedDate: this.closedDate,
 +        url: this.url,
 +        lat: this.lat,
 +        lng: this.lng,
 +        parent: this.parent,
 +        contactPerson: this.contactPerson,
 +        address: this.address,
 +        email: this.email,
 +        phoneNumber: this.phoneNumber,
 +        featureType: this.featureType,
 +        coordinates: this.coordinates
 +    });
  
      constructor(http:Http, fb: FormBuilder) {
          this.http = http;
          this.active = false;
          this.coordinatePoint = false;
          this.tempmarker = new EventEmitter();
+         this.exitButton = document.getElementById("slideout")
  
 -        this.form = fb.group({
 -            "id": this.id,
 -            "name": this.name,
 -            "shortName": this.shortName,
 -            "description": this.description,
 -            "code": this.code,
 -            "openingDate": this.openingDate,
 -            "closedDate": this.closedDate,
 -            "url": this.url,
 -            "lat": this.lat,
 -            "lng": this.lng,
 -            "parent": this.parent,
 -            "contactPerson": this.contactPerson,
 -            "address": this.address,
 -            "email": this.email,
 -            "phoneNumber": this.phoneNumber
 -        });
          let instance = this;
          this.lat.valueChanges.observer({
              next: (value) => {
  
      }
  
+     exit(){
+         this.active = false;
+     }
++
 +    findOrgUnitSets(){
 +        let instance = this;
 +        this.http.get(dhisAPI + "/api/organisationUnitGroupSets?paging=false")
 +            .map(res => res.json())
 +            .map(res => res.organisationUnitGroupSets)
 +            .subscribe(res => this.addOrgUnitSets(instance, res))
 +    }
 +
 +    addOrgUnitSets(instance, res){
 +        instance.ctrlArray.removeAt(0);
 +        for( group in res){
 +            console.log(instance.form.controls);
 +            instance.groupsArray.push(new Control(''));
 +            instance.groupSets.push(res[group]);
 +
 +            this.http.get(dhisAPI + "/api/organisationUnitGroupSets/" + res[group].id)
 +                .map(res => res.json())
 +                .map(res => res.organisationUnitGroups)
 +                .subscribe(res => this.addOrgUnitGroup(instance, res))
 +
 +            //    instance.form.push(new Control(""));
 +        }
 +        console.log(instance.groupSets);
 +    }
 +
 +    addOrgUnitGroup(instance, res){
 +        let ar: Array<any> = [];
 +        for( group in res){
 +            ar.push(res[group]);
 +        }
 +        instance.groupsDoubleArray.push(ar);
 +
 +        console.log(instance.groupsDoubleArray);
 +    }
  }