[sidebar] Update existing organizational unit
[u/erikhf/frm.git] / src / components / sidebar / sidebar.html
1 <div>
2     <div *ng-if="activeOrgUnit">
3         <form *ng-if="editmode" (ng-submit)="onSubmit()" #of="form">
4             <div class="form-group">
5                 <label>Name</label>
6                 <input class="form-control" type="text" [(ng-model)]="activeOrgUnit.name" required ng-control="name" #name="form">
7                 <p [hidden]="name.valid" class="alert alert-danger">
8                     Name is required
9                 </p>
10
11             </div>
12             <div class="form-group">
13                 <label>Short Name</label>
14                 <input class="form-control" type="text" [(ng-model)]="activeOrgUnit.shortName" required ng-control="shortname" #shortname="form">
15                 <p [hidden]="shortname.valid" class="alert alert-danger">
16                     Short name is required
17                 </p>
18             </div>
19
20             <div class="form-group">
21                 <label>Description</label>
22                 <textarea class="form-control" [(ng-model)]="activeOrgUnit.description" rows="3"></textarea>
23             </div>
24             <div class="form-group">
25                 <label>Code</label>
26                 <input class="form-control" type="text" [(ng-model)]="activeOrgUnit.code">
27             </div>
28             <div class="form-group">
29                 <label>Opening Date</label>
30                 <input class="form-control" type="date" [(ng-model)]="activeOrgUnit.openingDate" required ng-control="openingdate" #openingDate="form">
31                 <p [hidden]="openingdate.valid" class="alert alert-danger">Opening date is required</p>
32             </div>
33             <div class="form-group">
34                 <label>Closed Date</label>
35                 <input class="form-control" type="date" [(ng-model)]="activeOrgUnit.closedDate">
36             </div>
37             <div class="form-group">
38                 <label>URL</label>
39                 <input class="form-control" type="url" [(ng-model)]="activeOrgUnit.url" ng-control="url" #url="form">
40                 <p [hidden]="url.valid" class="alert alert-danger">The specified URL is not valid</p>
41             </div>
42             <fieldset class="form-group">
43                 <legend>Group(s)</legend>
44                 <div *ng-for="#group of activeOrgUnit.organisationUnitGroups">
45                     <input class="form-control" type="text" [(ng-model)]="group.name">
46                 </div>
47             </fieldset>
48             <button type="submit" [disabled]="!of.form.valid" class="btn btn-default">Save</button>
49
50         </form>
51
52         <section *ng-if="!editmode">
53             <label for="actOrgUnitName">Name</label>
54
55             <p id="actOrgUnitName">{{(activeOrgUnit.name) || "[None]"}}</p>
56
57             <label for="actOrgUnitShortName">Short Name</label>
58
59             <p id="actOrgUnitShortName">{{(activeOrgUnit.shortName)||["None"]}}</p>
60
61             <label for="actOrgUnitDescription">Description</label>
62
63             <p id="actOrgUnitDescription">{{(activeOrgUnit.description)||"None"}}</p>
64
65             <label for="actOrgUnitCode">Code</label>
66
67             <p id="actOrgUnitCode">{{(activeOrgUnit.code)||["None"]}}</p>
68
69             <label for="actOrgUnitOpeningDate">Opening Date</label>
70
71             <p id="actOrgUnitOpeningDate">{{activeOrgUnit.openingDate||["None"]}}</p>
72
73             <label for="actOrgUnitClosingDate">Closed Date</label>
74
75             <p id="actOrgUnitClosingDate">{{activeOrgUnit.closingDate||["None"]}}</p>
76
77             <label for="actOrgUnitURL">Url</label>
78
79             <p id="actOrgUnitURL">{{(activeOrgUnit.url) ||["None"]}}</p>
80
81             <label>Group(s)</label>
82             <ul *ng-for="#group of activeOrgUnit.organisationUnitGroups">
83                 <li>{{group.name}}</li>
84             </ul>
85         </section>
86         <button class="btn btn-default" (click)="editmode = !editmode">{{editmode ? "Cancel" : "Edit"}}</button>
87
88     </div>
89 </div>