<div class="col-md-12" ng-controller="CreateGroupController">
    <ul class="breadcrumb">
        <li ng-if="!centerid"><a href="#/groups">{{'label.anchor.groups' | translate}}</a></li>
        <li ng-if="centerid"><a href="#/centers">{{'label.anchor.centers' | translate}}</a></li>
        <li ng-if="centerid"><a href="#/viewcenter/{{centerid}}">{{'label.anchor.viewcenter' | translate}}</a></li>
        <li class="active">{{'label.anchor.creategroup' | translate}}</li>
    </ul>
	<form name="creategroupform" novalidate="" class="form-horizontal well" rc-submit="submit()">
	    <api-validate></api-validate>
	    <fieldset>
	        <legend class="bolder">{{'label.heading.creategroup' | translate}}</legend>
	        <div class="form-group">
	            <label class="control-label col-sm-2">
	                {{'label.input.office' | translate}}<span ng-show="forceOffice == null" class="required">*</span>
	            </label>

	            <div class="col-sm-3">
	                <div ng-show="forceOffice == null">
	                    <select chosen="offices" name="office" id="officeId" ng-model="formData.officeId"
	                            ng-options="office.id as office.name for office in offices" value="{{office.id}}"
	                            ng-change="changeOffice(formData.officeId)" class="form-control" required>
	                        <option value="">{{'label.menu.selectoffice' | translate}}</option>
	                    </select>
	                </div>
	                <div ng-show="forceOffice != null">
	                    <p class="form-control-static">{{forceOffice.name}}</p>
	                </div>
	            </div>
	            <div class="col-sm-2">
	                <form-validate valattributeform="creategroupform" valattribute="office"/>
	            </div>
	            <label class="control-label col-sm-2" for="externalId">{{'label.input.groupexternalid' | translate}}</label>
	            <div class="col-sm-3">
	                <input type="text" name="externalid" id="externalId" ng-model="formData.externalId" class="form-control"/>
	            </div>
	        </div>
	        <div class="form-group">
	            <label class="control-label col-sm-2" for="name">{{'label.input.name' | translate}}<span
	                    class="required">*</span></label>

	            <div class="col-sm-3">
	                <input type="text" id="name" name="name" ng-model="formData.name" class="form-control" required late-Validate/>
	            </div>
	            <div class="col-sm-2">
	                <form-validate valattributeform="creategroupform" valattribute="name"/>
	            </div>
	            <label class="control-label col-sm-2">{{'label.input.submittedon' | translate}}:</label>

	            <div class="col-sm-3">
	                <input id="submittedon" type="text" name="submittedon" datepicker-pop="dd MMMM yyyy"
	                       ng-model="first.submitondate" is-open="opened1" min="'2000-01-01'" max="restrictDate" class="form-control"/>
	            </div>
	        </div>
	        <div class="form-group">
	            <label class="control-label col-sm-2" for="staffId">{{'label.input.staff' | translate}}</label>

	            <div class="col-sm-3">
	                <select chosen="staffs" id="staffId" ng-model="formData.staffId" ng-disabled="response.uiDisplayConfigurations.createGroup.isReadOnlyField.staff && formData.staffId != null" class="form-control"
	                        ng-options="staff.id as staff.displayName for staff in staffs" value="{{staff.id}}">
	                    <option value="">{{'label.menu.selectone' | translate}}</option>
	                </select>
	            </div>
	        </div>
	        <div class="form-group">
	        	<label class="control-label col-sm-2" for="active">{{'label.input.active' | translate}}</label>
	        	<div class="col-sm-1">
	                <input type="checkbox" id="active" ng-model="formData.active" data-ng-change="setChoice()"
							ng-disabled="response.uiDisplayConfigurations.createGroup.isReadOnlyField.active">
	            </div>
		        <div data-ng-switch on="choice">
		            <div data-ng-switch-when="1">
		                <label class="control-label col-sm-2 col-md-offset-4">{{'label.input.activationdate' | translate}}<span class="required">*</span></label>

		                <div class="col-sm-3">
		                    <input id="activationDate" type="text" datepicker-pop="dd MMMM yyyy" ng-model="first.date"
		                           is-open="opened" min="'2000-01-01'" max="restrictDate" class="form-control"/>
		                </div>
		            </div>
		        </div>
	        </div>
	        <div class="form-group">
	            <label class="control-label col-sm-2" for="staffId">{{'label.input.addclients' | translate}}</label>
	            <div class="col-sm-9 col-md-9">
	                <div class="row">
	                    <div class="col-sm-4 col-md-4">
	                        <input id="clientMembers" type="text" data-ng-model="available" class="col-md-4 form-control" typeahead-on-select="viewClient(available)"
                                ng-autofocus="true" typeahead="client as client.displayName for client in addClients($viewValue)"/>
                            <div data-ng-show="available" class="paddedtop10">
                                <p>{{'label.heading.clientdetails' | translate}}</p>
                                <table class="table">
                                    <tr>
                                        <td width="35%">{{'label.heading.name' | translate}}</td>
                                        <td width="65%">{{client.displayName}}</td>
                                    </tr>
                                    <tr>
                                        <td>{{ 'label.heading.id' | translate }}</td>
                                        <td valign="top">{{client.id}}</td>
                                    </tr>
                                    <tr>
                                        <td>{{ 'label.heading.office' | translate }}</td>
                                        <td>{{client.officeName}}</td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <div class="col-sm-1 col-md-1">
                            <button ng-show="available" type="button" class="btn angled-btn btn-primary" data-ng-click="add()">
                                {{ 'label.button.add' | translate }}
                                <i class="icon-double-angle-right"></i></button>
                        </div>
	                    <div class="col-sm-5 col-md-5">
		                    <div ng-repeat="client in addedClients" class="paddedbottom">
	                            <div class="col-sm-10 col-md-10">
	                                <input disabled="" class="form-control input-xxlarge" placeholder={{client.displayName}}
	                                   type="text"/>
	                            </div>
	                            <div class="col-sm-2 col-md-2">
		                            <button type="button" class="btn angled-btn btn-primary" data-ng-click="sub(client.id)"><i
	                                    class="icon-remove"></i></button>
	                            </div>
	                        </div>
	                    </div>
	                </div>
	            </div>
	        </div>
	        <div class="col-md-offset-5">
	            <a id="cancel" ng-href="{{cancel}}" class="btn btn-default">{{'label.button.cancel' | translate}}</a>
	            <button id="save" type="submit" class="btn btn-primary" has-permission='CREATE_GROUP'>{{'label.button.save' | translate}}</button>
	        </div>
	    </fieldset>
	</form>
</div>