add-user.component.html 11.8 KB
<div class="container-fluid">

      <!-- navigation -->
      <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container-fluid">
          <site-menu></site-menu>
        </div>
      </nav>
     <!-- navigation -->
	 
	 <div class="clearfix"></div>
	 	 
      <!-- main-heading -->
      <div class="row">
		  <div class="col-sm-12 pageHeading">
		   <h4>Add User</h4> 
		  </div>
	  <!-- main-heading -->
	  
	  <!-- container -->
			<div class="col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3">       
				<div class="container-fluid main-full">
					<div class="row">				
						<div class="well">			
							<div class="row">
								<div class="col-sm-12">
								<div class="panel-body">
								 <!-- form -->
								<form class="form-horizontal" #addUserForm="ngForm" (ngSubmit)="addUser(addUserForm.value)" novalidate>
                                    <!--{{ addUserForm.value | json }} -->
									  <div class="form-group">
										<label for="Username" class="col-sm-4 control-label">User Name <span class="red">*</span> :</label>
										<div class="col-sm-7">
										  <input type="text" class="form-control input-sm" id="Username" name="username" #username ="ngModel" ngModel placeholder="" required maxlength="50">
                                            <div *ngIf="username.invalid && (username.dirty || username.touched)" class="alert alert-danger">
                                                <div *ngIf="username.errors.required">
                                                    Username is required.
                                                </div>
                                            </div>
										</div>
									  </div>
									  <div class="form-group">
										<label for="Password" class="col-sm-4 control-label">Password <span class="red">*</span> :</label>
										<div class="col-sm-7">
										  <input type="password" class="form-control input-sm" id="Password" name="password" ngModel #password ="ngModel" placeholder="" required maxlength="50" validateEqual="confirmPassword" reverse="true">
                                            <div *ngIf="password.invalid && (password.dirty || password.touched)" class="alert alert-danger">
                                                <div *ngIf="password.errors.required">
                                                    Password is required.
                                                </div>
                                            </div>
										</div>
									  </div>
									  <div class="form-group">
										<label for="ConfirmPassword" class="col-sm-4 control-label">Confirm Password <span class="red">*</span> :</label>
										<div class="col-sm-7">
										  <input type="password" class="form-control input-sm" id="ConfirmPassword" name="confirmPassword" ngModel #confirmPassword="ngModel" placeholder="" required validateEqual="password">
                                            <div *ngIf="confirmPassword.invalid && (confirmPassword.dirty || confirmPassword.touched)" class="alert alert-danger">
                                                <!--<div *ngIf="confirmPassword.errors.required">-->
                                                    Password not matched.
                                                <!--</div>-->
                                            </div>
										</div>
									  </div>
									  <div class="form-group">
										<label for="Email" class="col-sm-4 control-label">Email Id <span class="red">*</span> :</label>
										<div class="col-sm-7">
										  <input type="email" class="form-control" id="Email" name="email" ngModel #email="ngModel" placeholder="" required maxlength="50" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$">
                                            <div *ngIf="email.invalid && (email.dirty || email.touched)" class="alert alert-danger">
                                                <div *ngIf="email.errors.required">
                                                    EmailId is required.
                                                </div>
                                                <div *ngIf="email.errors.pattern">
                                                    Email pattern not valid.
                                                </div>
                                            </div>
                                            <!--<small [hidden]="email.valid || (email.pristine && !addUserForm.submitted)">
                                                Email is required (valid email pattern).
                                            </small>
                                            <pre *ngIf="username.errors">{{ email.errors | json }}</pre>-->
                                            
                                            
										</div>
									  </div>
                                       <div class="form-group">
										<label for="FirstName" class="col-sm-4 control-label">First Name <span class="red">*</span> :</label>
										<div class="col-sm-7">
										  <input class="form-control input-sm" id="FirstName" name="firstName" ngModel #firstName="ngModel" placeholder="" type="text" required maxlength="100">
                                            <div *ngIf="firstName.invalid && (firstName.dirty || firstName.touched)" class="alert alert-danger">
                                                <div *ngIf="firstName.errors.required">
                                                    FirstName is required.
                                                </div>
                                            </div>
										</div>
									  </div>
                                      <div class="form-group">
										<label for="LastName" class="col-sm-4 control-label">Last Name <span class="red">*</span> :</label>
										<div class="col-sm-7">
										  <input class="form-control input-sm" id="LastName" name="lastName" ngModel #lastName="ngModel" placeholder="" type="text" required maxlength="100">
                                            <div *ngIf="lastName.invalid && (lastName.dirty || lastName.touched)" class="alert alert-danger">
                                                <div *ngIf="lastName.errors.required">
                                                    LastName is required.
                                                </div>
                                            </div>
										</div>
									  </div>
                                      <div class="form-group">
										<label for="AccountNumber" class="col-sm-4 control-label">Account Number <span class="red">*</span> :</label>
										<div class="col-sm-7">
										  <select class="form-control input-sm" id="AccountNumber" name="accNumber" ngModel #accNumber="ngModel" required>
                                            <option>Select</option>
                                            <option *ngFor="let acc of accountNumbers" [value]="acc.Id">{{acc.AccountNo}}</option>
											<!--<option selected="">Select</option>
											<option>73-0022796</option>
											<option>73-0022794</option>
											<option>73-0022796</option>
											<option>73-0022796</option>-->
										</select>
                                            <div *ngIf="accNumber.invalid && (accNumber.dirty || accNumber.touched)" class="alert alert-danger">
                                                <div *ngIf="accNumber.errors.required">
                                                    Select an accountNumber.
                                                </div>
                                            </div>
										</div>
									  </div>
                                      <div class="form-group">
										<label for="UserType" class="col-sm-4 control-label">User Type <span class="red">*</span> :</label>
										<div class="col-sm-7">
										  <select class="form-control input-sm" id="UserType" name="userType" ngModel #userType="ngModel" required>
                                            <option>Select</option>
                                            <option *ngFor="let userType of userTypes" [value]="userType.Id">{{userType.Title}}</option>
                                          </select>
                                            <div *ngIf="userType.invalid && (userType.dirty || userType.touched)" class="alert alert-danger">
                                                <div *ngIf="userType.errors.required">
                                                    Select UserType.
                                                </div>
                                            </div>
										</div>
									  </div>
                                      <div class="form-group">
										<label for="ProductEdition" class="col-sm-4 control-label">Product Edition <span class="red">*</span> :</label>
										<div class="col-sm-7">
										  <select class="form-control input-sm" id="ProductEdition" name="productEdition" ngModel #productEdition="ngModel" required>
                                            <option>Select</option>
                                            <option *ngFor="let edition of productEditions" [value]="edition.Id">{{edition.Title}}</option>
										</select>
                                            <div *ngIf="productEdition.invalid && (productEdition.dirty || productEdition.touched)" class="alert alert-danger">
                                                <div *ngIf="productEdition.errors.required">
                                                    Select an edition.
                                                </div>
                                            </div>
										</div>
									  </div>									  
									  <div class="row">
										<div class="col-sm-12 marginTop20 text-center">
										  <button type="button" class="btn btn-primary btn-sm" [disabled]="!addUserForm.form.valid" data-toggle="modal" data-target="#mymodal"><i class="fa fa-plus-circle"></i> Add</button>
							<!--modal-->
							<div class="modal fade bs-example-modal-sm text-left" tabindex="-1" role="dialog" id="mymodal">
											  <div class="modal-dialog modal-sm" role="document">
												<div class="modal-content">
													  <div class="modal-header annotation-modal-header ui-draggable-handle">
														<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
														<h4 class="modal-title" id="">Alert</h4>
													  </div>
													  <div class="modal-body">
														<h5>Please enter a username</h5>	
													  </div>
														<div class="modal-footer">
															<div class="row">
																<div class="col-sm-12"><button class="btn btn-primary btn-sm">Ok</button></div>
															</div>
														</div>
													  
													</div><!-- /.modal-content -->
											  </div><!-- /.modal-dialog -->
											</div>

							<button class="btn btn-primary btn-sm"><i class="fa fa-refresh"></i> Reset</button>
							<button class="btn btn-primary btn-sm"><i class="fa fa-close"></i> Cancel</button>
										</div>
										
									  </div>
							</form>
							 <!-- form -->
						  </div>					
								</div>
							</div>
						</div>
					</div>
				</div>
			  </div>
			  <!-- container -->
    </div>


<script src="js/jquery-1.11.3.min.js"></script> 
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap-datetimepicker.min.js"></script>
<!--datepicker-->
 <script type="text/javascript">
  $(function() {
    $('#datetimepicker1, #datetimepicker2').datetimepicker({
      //language: 'pt-BR'
    });
  });
</script> 
<!--datepicker-->