Fixed merge conflicts
authorYrjan A. F. Fraschetti <yrjanaff@1x-193-157-250-45.uio.no>
Thu, 10 Dec 2015 17:10:16 +0000 (18:10 +0100)
committerYrjan A. F. Fraschetti <yrjanaff@1x-193-157-250-45.uio.no>
Thu, 10 Dec 2015 17:10:16 +0000 (18:10 +0100)
package.json
src/components/app.html
src/components/map/map.ts
src/components/search/search.html
src/components/search/search.ts
src/components/sidebar/sidebar.html
src/components/sidebar/sidebar.ts
src/css/map.css

index 9e6b6ec..aaef61f 100644 (file)
@@ -16,7 +16,7 @@
   "license": "ISC",
   "dependencies": {
     "@reactivex/rxjs": "^5.0.0-alpha.10",
-    "angular2": "2.0.0-alpha.48",
+    "angular2": "2.0.0-alpha.44",
     "systemjs": "0.19.2"
   },
   "devDependencies": {
index f5ace35..c9c2e54 100644 (file)
@@ -2,7 +2,7 @@
 
 
     <div class="col-lg-9 col-md-8 col-xs-7"><mou-search (newsearch)="map.update($event)"></mou-search></div>
-    <div class="col-lg-3 col-md-4 col-xs-5 no-padding"><mou-sidebar (tempmarker)="map.tempMarker($event)" #sidebar></mou-sidebar></div>
+    <div class="col-lg-3 col-md-4 col-xs-5 no-padding"><mou-sidebar (tempmarker)="map.tempMarker($event)" (updateorg)="map.update($event)"#sidebar></mou-sidebar></div>
 
     <mou-map (newactive)="sidebar.update($event)" (neworg)="sidebar.add($event)"#map (toplevel)="showtoplevel()"></mou-map>
 </div>
index ddd0654..d3f72f8 100644 (file)
@@ -26,9 +26,12 @@ export class Map {
     popupON:boolean;
     popup:Object;
     COLORS:Object;
-    colornum: number;
-
+    colornum:number;
 
+    /**
+     * initializes all the global variabels
+     * @param http - for http requests
+     */
     constructor(http:Http) {
 
         this.activeId = null;
@@ -56,56 +59,102 @@ export class Map {
         this.currentMarker = null;
         this.isSearched = false;
         this.colornum = 0;
-        this.COLORS = ['#ede1bb', '#1d407e', '#ff512e', '#662d47','#3b3a35', '#419175', '#983e41', '#f3002d', '#b0a875', '#00bfb5', '#926851', '#47a0a4','#333f50','#6f007b'];
+        this.COLORS = ['#ede1bb', '#1d407e', '#ff512e', '#662d47', '#3b3a35', '#419175', '#983e41', '#f3002d', '#b0a875', '#00bfb5', '#926851', '#47a0a4', '#333f50', '#6f007b'];
         this.popupON = false;
         this.popup = null;
     }
 
 
+    /**
+     * Sets the global variabel
+     * @param id - id of the active marker 
+     */
     setActiveId(id) {
         this.activeId = id;
     }
 
+    /**
+     * returns the global map
+     * @returns {Object}
+     */
     getMap() {
         return this.map;
     }
 
+    /**
+     * returns global http
+     * @returns {Http}
+     */
     getHttp() {
         return this.http;
     }
 
+    /**
+     * Sets the avctive markers position
+     * @param latlng - position of the active marker
+     */
     setcurrentPos(latlng) {
         this.currentPos = latlng;
     }
 
+    /**
+     * returns the active markers position
+     * @returns {Object}
+     */
     getcurrentPos() {
         return this.currentPos;
     }
 
+    /**
+     * sets the parent of the avtive marker
+     * @param id - of the parent
+     */
     setParent(id) {
         this.parent = id;
     }
 
+    /**
+     * returns the actice markers parent
+     * @returns {Object}
+     */
     getParent() {
         return this.parent;
     }
 
+    /**
+     * sets a bool value for if the addListner for drilling down has runned (little hack)
+     * @param value - for the runned variabel
+     */
     setRunned(value) {
         this.runned = value;
     }
 
+    /**
+     * sets a bool value for if the addListner for drilling up has runned (little hack)
+     * @param value - for the upRunned variabel
+     */
     setupRunned(value) {
         this.uprunned = value;
     }
 
+    /**
+     * sets the current level in the org.unit hierarchy
+     * @param value - for the level variabel
+     */
     setLevel(value) {
         this.LEVEL = value;
     }
 
+    /**
+     * add level when drilling down (little hack for synconisity)
+     */
     addLevel() {
         this.LEVEL++;
     }
 
+    /**
+     * goes up level when drilling up (little hack for synconisity)
+     */
     upLevel() {
         this.LEVEL--;
     }
@@ -124,7 +173,7 @@ export class Map {
 
     /**
      * prints out error messages in the console
-     * @param error
+     * @param error - the error massage
      */
     logError(error) {
         console.error(error);
@@ -135,7 +184,7 @@ export class Map {
      * gets data from DHIS API
      * @param query - for what kind of data to retrieve
      * @param instance - this instance to use
-     * @param isParent - little hack to see if it is a parent you wish the children to
+     * @param isParent - little hack to see if you want to levels up (the parent of a parent)
      */
     getData(query, instance, isParent) {
         instance.http.get(dhisAPI + '/api/organisationUnits' + query)
@@ -147,7 +196,7 @@ export class Map {
     }
 
     /**
-     * Gets the number of levels the haiercy
+     * Gets the number of levels in the org.unit hierarchy from DHIS
      */
     getLevels() {
         this.http.get(dhisAPI + '/api/organisationUnitLevels')
@@ -158,11 +207,22 @@ export class Map {
             );
     }
 
+    /**
+     * Saves the data from getLevels() in a global variabel and gets all the data from the second level.
+     * @param res - result from getLevels()
+     * @param instance - witch scope we are in
+     */
     saveLevelTotalandGetdata(res, instance) {
         instance.allLevels = res.pager.total;
         instance.getData('?paging=false&level=2', instance, false);
     }
 
+    /**
+     * parses all the data from getData() and calles methods based on the incomming data.
+     * @param res - result from getData()
+     * @param instance - witch scope we are in
+     * @param isParent - if it is a parent we have asked for
+     */
     parseResult(res, instance, isParent) {
         if (isParent) {
             instance.setParent(res.parent.id);
@@ -191,6 +251,11 @@ export class Map {
         }
     }
 
+    /**
+     * creates and draws up the geojson polygons and adds listeners to them.
+     * @param item - an org.unit object
+     * @param instance - witch scope we are in
+     */
     drawPolygon(item, instance) {
         let feature;
         let incoming:string;
@@ -219,13 +284,15 @@ export class Map {
                     "title": item.name,
                     "name": item.name,
                     "id": item.id,
-                    "color":instance.COLORS[instance.colornum],
+                    "color": instance.COLORS[instance.colornum],
                     "icon": null
                 }
             };
-            if(instance.COLORS.length == instance.colornum){
+            if (instance.COLORS.length == instance.colornum) {
                 instance.colornum = 0;
-            }else{ instance.colornum++;}
+            } else {
+                instance.colornum++;
+            }
 
             if (unit.geometry.type == 'Point') {
                 unit.properties.icon = {
@@ -233,7 +300,7 @@ export class Map {
                     strokeColor: 'black',
                     scale: 4
                 };
-                instance.map.setCenter({lat:unit.geometry.coordinates[1],lng:unit.geometry.coordinates[0]});
+                instance.map.setCenter({lat: unit.geometry.coordinates[1], lng: unit.geometry.coordinates[0]});
             }
 
             this.map.data.addGeoJson(unit);
@@ -252,7 +319,7 @@ export class Map {
                     icon: icon
                 });
             });
-            if(instance.isSearched){
+            if (instance.isSearched) {
                 instance.seeDetails();
             }
             this.map.data.addListener('click', function (event) {
@@ -279,27 +346,30 @@ export class Map {
             });
 
 //slette ?? §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
-           /* this.map.data.addListener('mouseover', function (e) {


-                if(!instance.popupON) {
-                    instance.popupON = true;
-
-                    instance.popup = new google.maps.InfoWindow({
-                        content: e.feature.getProperty('name'),
-                        position: e.latLng
-                    });
-                    instance.popup.open(instance.map);
-
-                }
-            });

-            this.map.data.addListener('mouseout', function (event) {


-                instance.popupON = false;
-                instance.popup.open(null);

-            });*/
+            /* this.map.data.addListener('mouseover', function (e) {


+             if(!instance.popupON) {
+             instance.popupON = true;
+
+             instance.popup = new google.maps.InfoWindow({
+             content: e.feature.getProperty('name'),
+             position: e.latLng
+             });
+             instance.popup.open(instance.map);
+
+             }
+             });

+             this.map.data.addListener('mouseout', function (event) {


+             instance.popupON = false;
+             instance.popup.open(null);

+             });*/
 
         }
     }
 
-    drillDown(){
+    /**
+     * removes the polygon on current level and calles getData on one level down in the org.unit hierarchy
+     */
+    drillDown() {
         this.closeModal();
         let map = this.getMap();
         let id = this.activeId;
@@ -319,9 +389,10 @@ export class Map {
 
     }
 
-    drillUp(){
-
-
+    /**
+     *removes the plogons on the current level and calles the get data with tha parents id and set parent true. this to say that we want this parent's parent
+     */
+    drillUp() {
         this.setupRunned(true);
         this.upLevel();
         let instance = this;
@@ -339,6 +410,9 @@ export class Map {
         this.closeModal();
     }
 
+    /**
+     * focuses map and colors to the clicked marker/polygon and fires an event to sidebar with the id of the marker
+     */
     seeDetails() {
         let map = this.getMap();
         let id = this.activeId;
@@ -349,7 +423,7 @@ export class Map {
                 if (feature.getProperty('icon') !== null) {
                     feature.O.icon.strokeColor = 'red';
                 }
-                this.isSearched=false;
+                this.isSearched = false;
             }
             else {
                 feature.setProperty('color', 'gray');
@@ -361,6 +435,9 @@ export class Map {
         this.newactive.next(this.activeId);
     }
 
+    /**
+     * gets the position of the clicked position on the map, saves the parent and sends it in an event.
+     */
     addUnit() {
         this.closeModal();
         let pos = this.getcurrentPos();
@@ -375,6 +452,11 @@ export class Map {
         this.setRunned(false);
     }
 
+    /**
+     * triggered from an event in search and gets the search object from the DHIS API
+     * then calles mapupdate()
+     * @param event - event from an emitter
+     */
     update(event) {
         this.newactive.next(event);
         let map = this.getMap();
@@ -391,6 +473,12 @@ export class Map {
 
     }
 
+    /**
+     * updates varabels activeId, level and parent to matche the incomming object and gets all the children on the same level.
+     * Then it calles drawPolygon()
+     * @param res - org.unit object
+     * @param instance
+     */
     mapUpdate(res, instance) {
         this.setLevel(res.level);
         this.setActiveId(res.id);
@@ -408,6 +496,10 @@ export class Map {
 
     }
 
+    /**
+     * adds a temperary marker so the user can see an update of the latitude and longitude of a marker
+     * @param pos - position for the temp marker
+     */
     tempMarker(pos) {
         let map = this.map;
         if (this.currentMarker)
@@ -427,8 +519,9 @@ export class Map {
     }
 
 
-
-
+    /**
+     * closes the modal box over the map.
+     */
     closeModal() {
         $("#myModal").modal("hide");
         this.setRunned(false);
index c4f031b..dfb79b2 100644 (file)
@@ -1,8 +1,9 @@
 <div id="search">
 
+    <!-- Search bar -->
     <label class="sr-only" for="livesearch">Search</label>
 
-    <form id="myForm">
+    <form id="searchform">
         <div class="row">
             <input
                     mou-live-search
                     name="livesearch"
                     id="livesearch"
                     placeholder="Search"
-                    onblur= "this.placeholder = 'Search'"
+                    onblur="this.placeholder = 'Search'"
                     onfocus="this.placeholder = ''"
                     value=""/>
 
-            <button type="button" class="knapp col-md-2" (click)="toggle()" data-toggle="collapse" data-target="#dropdown-menu">
-                {{ visible ? '&xdtri;' : '&cross;' }}
+            <!--Show and empty filtermenu-->
+            <button type="button" class="filterbutton col-md-2" (click)="toggle()"
+                    data-toggle="collapse" data-target="#dropdown-menu">
+                {{ visible ? '&xdtri;' : '&khcy;' }}
             </button>
         </div>
     </form>
         <span [hidden]="hideDiv()">
             <div class="divresult col-md-10" id="divresult" [hidden]="checkOrgunits()">
                 <ul class="dropdown-menu result">
-                    <li><button type="button" class="btn btn-default emptyresult" (click)="emptyByClick()">
-                        <span class="glyphicon glyphicon-remove"></span></button></li>
+                    <li>
+                        <!--exit results-->
+                        <button type="button" class="btn btn-default emptyresult" (click)="emptyByClick()">
+                            <span class="glyphicon glyphicon-remove"></span></button>
+                    </li>
                     <li *ng-for="#orgunit of filteredOrgunits" id="orglist" (click)="getMoreInfo(orgunit)">
-                        <a id="left-menu" href="#">{{orgunit.name}}</a>
+                        <a id="left-menu" href="#"><span class="glyphicon glyphicon-map-marker glyresult"></span>  {{orgunit.name}}</a>
                     </li>
                     <li *ng-if="filteredOrgunits.length == 0">
-                        <p class="nomatch">  No matching results </p>
+                        <p class="nomatch"><span class="glyphicon glyphicon-info-sign glyinfo"></span>  No matching results </p>
                     </li>
                 </ul>
             </div>
 
         <!-- Filter selectors to be filled inn by getUnitGroupSets() -->
         <div id="dropdowndiv" class="btn-group collapse col-md-2">
-            <ul id="dropdown-menu" role="menu" class="dropdown-menu meny">
+            <ul id="dropdown-menu" role="menu" class="dropdown-menu filtermenu">
                 <li>Facility</li>
                 <li class="dropdown-header">Ownership</li>
                 <li>
-                    <select class="form-control filtervalg" id="ownershipSelector" (click)="setFilter()"></select>
+                    <select class="form-control filteroption" id="ownershipSelector" (click)="setFilter()"></select>
                 </li>
                 <li class="dropdown-header">Type</li>
                 <li>
-                    <select class="form-control filtervalg" id="typeSelector" (click)="setFilter()"></select>
+                    <select class="form-control filteroption" id="typeSelector" (click)="setFilter()"></select>
                 </li>
                 <li class="divider"></li>
                 <li>Location</li>
                 <li class="dropdown-header">Rural/Urban</li>
                 <li>
-                    <select class="form-control filtervalg" id="locationSelector" (click)="setFilter()"></select>
+                    <select class="form-control filteroption" id="locationSelector" (click)="setFilter()"></select>
                 </li>
             </ul>
         </div>
index da240da..c3aed55 100644 (file)
@@ -39,11 +39,11 @@ export class Search {
     getMoreInfo(orgunit) {
         this.orgunits = [];
         this.newsearch.next(orgunit.id);
-        return document.getElementById("myForm").reset();
+        return document.getElementById("searchform").reset();
 
     }
 
-    //pil opp og ned
+    //When filtermenu is open show x else show arraowdown
     toggle() {
         this.visible = !this.visible;
         if (this.visible) {
@@ -58,6 +58,7 @@ export class Search {
         this.checkOrgunits();
     }
 
+    //Hide results when search bar input is erased
     hideDiv() {
         if (this.searchBar.value == ""){
             //this.toggle();
@@ -65,9 +66,10 @@ export class Search {
         }
     }
 
+    //Click out results and empty the search bar
     emptyByClick(){
         this.orgunits = [];
-        return document.getElementById("myForm").reset();
+        return document.getElementById("searchform").reset();
     }
 
     //Gets all unit group sets (category groups) and the unit groups
index 80c864c..41e57b1 100644 (file)
@@ -1,17 +1,20 @@
 <div>
-    <div [hidden]="!active" class="form-background sidebar slide" style="overflow-y:auto; position:relative; float:right; ">
+    <div [hidden]="!active" class="form-background sidebar slide"
+         style="overflow-y:auto; position:relative; float:right; ">
 
-        <button id="slideout" class="btn btn-default" (click)="exit()"><span class="glyphicon glyphicon-chevron-right"></span> </button>
+        <button id="slideout" class="btn btn-default" (click)="exit()"><span
+                class="glyphicon glyphicon-chevron-right"></span></button>
 
         <form class="formsidebar" *ng-if="editmode" [(ng-form-model)]="form" (ng-submit)="onSubmit()" #of="form">
             <hr>
 
-            <legend>{{newObject?"Add new Organizational Unit":"Update Organizational Unit"}}</legend>
+            <legend><span class="glyphicon glyphicon-edit"></span> {{newObject?"Add new Organizational Unit":"Update Organizational Unit"}}</legend>
             <hr>
 
             <div class="form-group">
                 <label class="label-text">Name</label>
                 <input class="form-control" type="text" ng-control="name">
+
                 <p [hidden]="name.valid || name.untouched" class="alert alert-danger">
                     Name is required
                 </p>
@@ -39,7 +42,8 @@
                 <label class="label-text">Opening Date</label>
                 <input class="form-control" type="date" ng-control="openingDate" #openingDate="form">
 
-                <p [hidden]="openingdate.valid || openingdate.untouched" class="alert alert-danger">Opening date is required</p>
+                <p [hidden]="openingdate.valid || openingdate.untouched" class="alert alert-danger">Opening date is
+                    required</p>
             </div>
             <div class="form-group">
                 <label class="label-text">Closed Date</label>
             </div>
             <hr>
             <fieldset class="form-group">
-                <Legend>Coordinates</Legend>
+                <Legend><span class="glyphicon glyphicon-map-marker"></span> Coordinates</Legend>
                 <hr>
 
                 <div *ng-if="featureType.value == 'POINT'" class="form-group">
                     <label class="label-text">Latitude</label>
-                    <input class="form-control" type="number" ng-control="lat" #lat="form" step="any" max="90" min="-90"/>
+                    <input class="form-control" type="number" ng-control="lat" #lat="form" step="any" max="90"
+                           min="-90"/>
                     <label class="label-text">Longitude</label>
-                    <input class="form-control" type="number" ng-control="lng" #lng="form" step="any" max="180" min="-180"/>
+                    <input class="form-control" type="number" ng-control="lng" #lng="form" step="any" max="180"
+                           min="-180"/>
                 </div>
                 <div *ng-if="featureType.value == 'NONE'" class="alert alert-danger">
-                    <p>This organisation unit has no associated coordinates</p>
+                    <span class="glyphicon glyphicon-info-sign glyinfo"></span> <p>This organisation unit has no associated coordinates</p>
                 </div>
             </fieldset>
             <hr>
             <fieldset ng-control-group="organisationUnitGroups">
 
-                <legend>Groups</legend>
+                <legend><span class="glyphicon glyphicon-list-alt"></span> Groups</legend>
                 <hr>
 
                 <div class="form-group" *ng-for="#groupSet of groupSets; #i = index">
@@ -84,7 +90,7 @@
             <hr>
             <fieldset class="form-group">
 
-                <legend>Contact information</legend>
+                <legend> <span class="glyphicon glyphicon-phone-alt"></span> Contact information</legend>
                 <hr>
                 <label class="label-text">Contact person</label>
                 <input class="form-control" type="text" ng-control="contactPerson"/>
             </fieldset>
             <hr>
             <button type="button" (click)="cancel()" class="btn btn-default buttonsidebar">Cancel</button>
-            <button type="submit" [disabled]="!of.form.valid" class="btn btn-default buttonsidebar">{{newObject? "Add":"Update"}}
+            <button type="submit" [disabled]="!of.form.valid" class="btn btn-default buttonsidebar">{{newObject?"Add":"Update"}}
             </button>
 
         </form>
 
 
             <hr>
-            <legend>Facility</legend>
+            <legend><span class="glyphicon glyphicon-home"></span> Facility</legend>
             <hr>
 
             <label class="label-text" for="actOrgUnitName">Name</label>
+
             <p id="actOrgUnitName">{{(form.controls.name.value) || "[None]"}}</p>
 
             <label class="label-text" for="actOrgUnitShortName">Short Name</label>
+
             <p id="actOrgUnitShortName">{{(form.controls.shortName.value)||["None"]}}</p>
 
             <label class="label-text" for="actOrgUnitDescription">Description</label>
+
             <p id="actOrgUnitDescription">{{(form.controls.description.value)||"None"}}</p>
 
             <label class="label-text" for="actOrgUnitCode">Code</label>
+
             <p id="actOrgUnitCode">{{(form.controls.code.value)||["None"]}}</p>
 
             <label class="label-text" for="actOrgUnitOpeningDate">Opening Date</label>
+
             <p id="actOrgUnitOpeningDate">{{form.controls.openingDate.value||["None"]}}</p>
 
             <label class="label-text" for="actOrgUnitClosingDate">Closed Date</label>
+
             <p id="actOrgUnitClosingDate">{{form.controls.closedDate.value||["None"]}}</p>
 
             <label class="label-text" for="actOrgUnitURL">Url</label>
+
             <p id="actOrgUnitURL">{{(form.controls.url.value) ||["None"]}}</p>
             <hr>
 
 
             <fieldset>
-                <legend>Coordinates</legend>
+                <legend><span class="glyphicon glyphicon-map-marker"></span> Coordinates</legend>
                 <hr>
 
                 <div *ng-if="featureType.value == 'POINT'" class="form-group">
                     <label class="label-text">Latitude</label>
+
                     <p>{{form.controls.lat.value}}</p>
                     <label class="label-text">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>
+                    <span class="glyphicon glyphicon-info-sign glyinfo"></span> <p>This organisation unit has no associated coordinates</p>
                 </div>
                 <div *ng-if="featureType.value == 'POLYGON' || featureType.value == 'MULTI_POLYGON'">
                     <p>polygon</p>
             <hr>
 
             <fieldset>
-                <legend>Contact Information</legend>
+                <legend><span class="glyphicon glyphicon-phone-alt"></span> Contact Information</legend>
                 <hr>
 
                 <label class="label-text">Contact person</label>
+
                 <p>{{form.controls.contactPerson.value || ["None"]}}</p>
                 <label class="label-text">Address</label>
+
                 <p>{{form.controls.address.value || ["None"]}}</p>
                 <label class="label-text">E-mail</label>
+
                 <p>{{form.controls.email.value || ["None"]}}</p>
                 <label class="label-text">Phone number</label>
+
                 <p>{{form.controls.phoneNumber.vaule || ["None"]}}</p>
             </fieldset>
             <hr>
index 649a246..9ca4bd0 100644 (file)
@@ -6,7 +6,7 @@ declare var zone: Zone;
 @Component({
     selector: 'mou-sidebar',
     directives: [CORE_DIRECTIVES, FORM_DIRECTIVES, NgFor, NgModel, NgIf],
-    events: ['tempmarker'],
+    events: ['tempmarker','updateorg'],
     templateUrl: './components/sidebar/sidebar.html'
 })
 
@@ -71,6 +71,7 @@ export class Sidebar {
         this.active = false;
         this.coordinatePoint = false;
         this.tempmarker = new EventEmitter();
+        this.updateorg = new EventEmitter();
         this.exitButton = document.getElementById("slideout")
 
         let instance = this;
@@ -130,8 +131,8 @@ export class Sidebar {
             this.coordinatePoint = true;
             let coord = new Object();
             coord = JSON.parse(res["coordinates"]);
-            this.form.controls.lat.updateValue(coord[0]);
-            this.form.controls.lng.updateValue(coord[1]);
+            this.form.controls.lat.updateValue(coord[1]);
+            this.form.controls.lng.updateValue(coord[0]);
         }
         else{
             this.coordinatePoint = false;
@@ -169,11 +170,11 @@ export class Sidebar {
         });
 
         $.each(jsonObject.organisationUnitGroups, function(key, value){
-            if( value === "" || value === null){
+//            if( value === "" || value === null){
                 delete jsonObject.organisationUnitGroups[key];
-            } else {
-                jsonObject.organisationUnitGroups[key].id = value;
-            }
+  //          } else {
+  //              jsonObject.organisationUnitGroups[key].id = value;
+   //         }
         });
 
 
@@ -190,14 +191,14 @@ export class Sidebar {
             jsonObject.parent = {};
             jsonObject.parent.id = this.form.controls.parent.value;
             jsonObject.featureType="POINT";
-            jsonObject.coordinates="[" + this.form.controls.lat.value + ","+this.form.controls.lng.value+"]";
+            jsonObject.coordinates="[" + this.form.controls.lng.value + ","+this.form.controls.lat.value+"]";
             delete jsonObject["lat"];
             delete jsonObject["lng"];
             this.http.post(dhisAPI + "/api/organisationUnits/", JSON.stringify(jsonObject), {
                     headers: headers
                 })
                 .map(res => res.json())
-                .subscribe(res => console.log(res));
+                .subscribe(res => this.emitNewUpdatedObject(res));
         }else {
             this.http.put(dhisAPI + "/api/organisationUnits/" + this.form.controls.id.value, JSON.stringify(jsonObject), {
                     headers: headers
@@ -206,10 +207,19 @@ export class Sidebar {
                 .subscribe(res => console.log(res));
         }
 
+
+
+
+    }
+
+    emitNewUpdatedObject(obj){
+        console.log(obj);
+        this.updateorg.next(obj.response.lastImported);
     }
 
     cancel(){
         this.editmode = false;
+        this.tempmarker.next(null);
     }
 
 
index d011d85..9d1f0de 100644 (file)
@@ -28,7 +28,7 @@ html, body {
     max-width: 100%;
 }
 
-/* search input*/
+/* search bar and filter button */
 
 #livesearch{
     box-shadow: 8px 8px 8px rgba(0, 0, 0, 0.3);
@@ -63,7 +63,7 @@ html, body {
     background: white;
 }
 
-.knapp
+.filterbutton
 {
     border-radius: 0px 2px 2px 0px; /* top left, top right, bottom right, bottom left */
     box-shadow: 8px 8px 8px rgba(0, 0, 0, 0.3);
@@ -81,12 +81,16 @@ html, body {
     float: left;
 }
 
-.knapp:focus {
+.filterbutton:focus {
     outline:0;
 }
 
 /* search results */
 
+.nomatch{
+    margin-left: 20px;
+    font-size: 16px;
+}
 
 .divresult{
     padding:0;
@@ -151,6 +155,10 @@ html, body {
     background-color: #f5f5f5
 }
 
+.result > li:last-child {
+    border: none;
+}
+
 .emptyresult{
     float: right;
     border: 0;
@@ -168,7 +176,7 @@ html, body {
     margin: 0;
 
 }
-.meny{
+.filtermenu{
     border: none;
     border-top: 2px solid darkgrey;
     box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
@@ -182,13 +190,13 @@ html, body {
     margin-left: 2px;
 }
 
-.meny li{
+.filtermenu li{
     background-color: white;
     padding-left: 20px;
     padding-right: 20px;
 }
 
-.filtervalg{
+.filteroption{
     box-shadow: 0 0 1px darkgrey;
     margin-top: 5px;
     margin-bottom: 5px;
@@ -204,7 +212,7 @@ html, body {
     transition: all 0.15s;
 }
 
-.filtervalg:focus{
+.filteroption:focus{
     outline: 0;
 }
 .bootstrap-select .btn:focus {
@@ -219,10 +227,6 @@ html, body {
     color: white;
 }
 
-.nomatch{
-    margin-left: 20px;
-}
-
 /* sidebar */
 
 .ng-valid.ng-dirty {
@@ -332,3 +336,18 @@ label{
     margin: 0 !important;
 }
 
+.glyphicon{
+    font-size: 16px;
+    color: darkgrey;
+}
+.glyinfo{
+    font-size: 18px;
+    color: #DFC2C8;
+}
+
+.glyresult{
+    font-size: 14px;
+}
+
+
+