[sibebar] added polygon
[u/erikhf/frm.git] / src / components / sidebar / sidebar.html
index 788efa4..f019dd8 100644 (file)
-<div class="sideBar">
-    <div *ng-if="activeOrgUnit">
-        <div class="form-group">
-            <label>Name</label>
-            <input class="form-control" type="text" [(ng-model)]="activeOrgUnit.name" [disabled]="!editmode">
-        </div>
-        <div class="form-group">
-            <label>Shortname</label>
-            <input class="form-control" type="text" [(ng-model)]="activeOrgUnit.shortName" [disabled]="!editmode">
-        </div>
-        <fieldset class="form-group">
-            <legend>Group(s)</legend>
-            <div *ng-for="#group of activeOrgUnit.organisationUnitGroups">
-                <input class="form-control" type="text" [(ng-model)]="group.name" [disabled]="!editmode">
+<div>
+    <div [hidden]="!active" class="form-background" style="overflow-y:auto; position:relative; float:right; ">
+        <form *ng-if="editmode" [(ng-form-model)]="form" (ng-submit)="onSubmit()" #of="form">
+            <h2>{{newObject?"Add new Organizational Unit":"Update Organizational Unit"}}</h2>
+
+            <div class="form-group">
+                <label>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>
+
             </div>
-        </fieldset>
-        <button class="btn btn-default" (click)="editmode = !editmode">Edit</button>
+            <div class="form-group">
+                <label>Short Name</label>
+                <input class="form-control" type="text" ng-control="shortName" #shortname="form">
+
+                <p [hidden]="shortname.valid || shortname.untouched" class="alert alert-danger">
+                    Short name is required
+                </p>
+            </div>
+
+            <div class="form-group">
+                <label>Description</label>
+                <textarea class="form-control" ng-control="description" rows="3"></textarea>
+            </div>
+            <div class="form-group">
+                <label>Code</label>
+                <input class="form-control" type="text" ng-control="code">
+            </div>
+
+            <div class="form-group">
+                <label>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>
+            </div>
+            <div class="form-group">
+                <label>Closed Date</label>
+                <input class="form-control" type="date" ng-control="closedDate">
+            </div>
+            <div class="form-group">
+                <label>URL</label>
+                <input class="form-control" type="url" ng-control="url" #url="form">
+
+                <p [hidden]="url.valid" class="alert alert-danger">The specified URL is not valid</p>
+            </div>
+            <fieldset class="form-group">
+                <Legend>Coordinates</Legend>
+                <div *ng-if="featureType.value == 'POINT'" class="form-group">
+                    <label>Latitude</label>
+                    <input class="form-control" type="number" ng-control="lat" #lat="form" step="any" max="90" min="-90"/>
+                    <label>Longitude</label>
+                    <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>
+                </div>
+            </fieldset>
+
+
+            <fieldset class="form-group">
+                <legend>Contact information</legend>
+                <label>Contact person</label>
+                <input class="form-control" type="text" ng-control="contactPerson"/>
+                <label>Address</label>
+                <input class="form-control" type="text" ng-control="address"/>
+                <label>E-mail</label>
+                <input class="form-control" type="email" ng-control="email"/>
+                <label>Phone number</label>
+                <input class="form-control" type="text" ng-control="phoneNumber"/>
+            </fieldset>
+            <button type="button" (click)="cancel()" class="btn btn-default">Cancel</button>
+            <button type="submit" [disabled]="!of.form.valid" class="btn btn-default">{{newObject? "Add":"Update"}}
+            </button>
+
+        </form>
+
+
+        <section *ng-if="!editmode">
+            <h2>Organisation Unit</h2>
+            <label for="actOrgUnitName">Name</label>
+
+            <p id="actOrgUnitName">{{(form.controls.name.value) || "[None]"}}</p>
+
+            <label for="actOrgUnitShortName">Short Name</label>
+
+            <p id="actOrgUnitShortName">{{(form.controls.shortName.value)||["None"]}}</p>
+
+            <label for="actOrgUnitDescription">Description</label>
+
+            <p id="actOrgUnitDescription">{{(form.controls.description.value)||"None"}}</p>
+
+            <label for="actOrgUnitCode">Code</label>
+
+            <p id="actOrgUnitCode">{{(form.controls.code.value)||["None"]}}</p>
+
+            <label for="actOrgUnitOpeningDate">Opening Date</label>
+
+            <p id="actOrgUnitOpeningDate">{{form.controls.openingDate.value||["None"]}}</p>
+
+            <label for="actOrgUnitClosingDate">Closed Date</label>
+
+            <p id="actOrgUnitClosingDate">{{form.controls.closedDate.value||["None"]}}</p>
+
+            <label for="actOrgUnitURL">Url</label>
+
+            <p id="actOrgUnitURL">{{(form.controls.url.value) ||["None"]}}</p>
+
+            <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>
+
     </div>
 </div>
\ No newline at end of file