several 'required' flags added to jdl and re-import

This commit is contained in:
Michael Hoennig 2019-04-12 16:43:16 +02:00
parent 4dbbd5ecde
commit 39950f0d69
28 changed files with 190 additions and 126 deletions

View File

@ -37,6 +37,7 @@
"relationshipType": "many-to-one", "relationshipType": "many-to-one",
"otherEntityName": "membership", "otherEntityName": "membership",
"otherEntityRelationshipName": "asset", "otherEntityRelationshipName": "asset",
"relationshipValidateRules": "required",
"relationshipName": "member", "relationshipName": "member",
"otherEntityField": "id" "otherEntityField": "id"
} }

View File

@ -67,17 +67,17 @@
} }
], ],
"relationships": [ "relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "membership",
"otherEntityRelationshipName": "customer",
"relationshipName": "membership"
},
{ {
"relationshipType": "one-to-many", "relationshipType": "one-to-many",
"otherEntityName": "customerContact", "otherEntityName": "customerContact",
"otherEntityRelationshipName": "customer", "otherEntityRelationshipName": "customer",
"relationshipName": "role" "relationshipName": "role"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "membership",
"otherEntityRelationshipName": "customer",
"relationshipName": "membership"
} }
], ],
"changelogDate": "20190403083735", "changelogDate": "20190403083735",

View File

@ -30,6 +30,7 @@
"relationshipType": "many-to-one", "relationshipType": "many-to-one",
"otherEntityName": "customer", "otherEntityName": "customer",
"otherEntityRelationshipName": "membership", "otherEntityRelationshipName": "membership",
"relationshipValidateRules": "required",
"relationshipName": "customer", "relationshipName": "customer",
"otherEntityField": "prefix" "otherEntityField": "prefix"
} }

View File

@ -37,6 +37,7 @@
"relationshipType": "many-to-one", "relationshipType": "many-to-one",
"otherEntityName": "membership", "otherEntityName": "membership",
"otherEntityRelationshipName": "share", "otherEntityRelationshipName": "share",
"relationshipValidateRules": "required",
"relationshipName": "member", "relationshipName": "member",
"otherEntityField": "id" "otherEntityField": "id"
} }

View File

@ -211,8 +211,8 @@ pitest {
threads = 4 threads = 4
// Do not set these limit even lower, they are already pretty bad values! // Do not set these limit even lower, they are already pretty bad values!
// 83%*73% means that only ~60% of the code properly covered by automated tests. // 83%*78% means that only ~66% of the code is properly covered by automated tests.
mutationThreshold = 73 mutationThreshold = 78
coverageThreshold = 83 coverageThreshold = 83
outputFormats = ['XML', 'HTML'] outputFormats = ['XML', 'HTML']

View File

@ -44,7 +44,7 @@ public class Asset implements Serializable {
private String comment; private String comment;
@NotNull @NotNull
@ManyToOne @ManyToOne(optional = false)
@JsonIgnoreProperties("assets") @JsonIgnoreProperties("assets")
private Membership member; private Membership member;

View File

@ -1,15 +1,12 @@
package org.hostsharing.hsadminng.domain; package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set;
import java.util.Objects; import java.util.Objects;
import java.util.Set;
/** /**
* A Customer. * A Customer.
@ -58,10 +55,12 @@ public class Customer implements Serializable {
@Column(name = "billing_salutation", length = 80) @Column(name = "billing_salutation", length = 80)
private String billingSalutation; private String billingSalutation;
@OneToMany(mappedBy = "customer")
private Set<Membership> memberships = new HashSet<>();
@OneToMany(mappedBy = "customer") @OneToMany(mappedBy = "customer")
private Set<CustomerContact> roles = new HashSet<>(); private Set<CustomerContact> roles = new HashSet<>();
@OneToMany(mappedBy = "customer")
private Set<Membership> memberships = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() { public Long getId() {
return id; return id;
@ -162,31 +161,6 @@ public class Customer implements Serializable {
this.billingSalutation = billingSalutation; this.billingSalutation = billingSalutation;
} }
public Set<Membership> getMemberships() {
return memberships;
}
public Customer memberships(Set<Membership> memberships) {
this.memberships = memberships;
return this;
}
public Customer addMembership(Membership membership) {
this.memberships.add(membership);
membership.setCustomer(this);
return this;
}
public Customer removeMembership(Membership membership) {
this.memberships.remove(membership);
membership.setCustomer(null);
return this;
}
public void setMemberships(Set<Membership> memberships) {
this.memberships = memberships;
}
public Set<CustomerContact> getRoles() { public Set<CustomerContact> getRoles() {
return roles; return roles;
} }
@ -211,6 +185,31 @@ public class Customer implements Serializable {
public void setRoles(Set<CustomerContact> customerContacts) { public void setRoles(Set<CustomerContact> customerContacts) {
this.roles = customerContacts; this.roles = customerContacts;
} }
public Set<Membership> getMemberships() {
return memberships;
}
public Customer memberships(Set<Membership> memberships) {
this.memberships = memberships;
return this;
}
public Customer addMembership(Membership membership) {
this.memberships.add(membership);
membership.setCustomer(this);
return this;
}
public Customer removeMembership(Membership membership) {
this.memberships.remove(membership);
membership.setCustomer(null);
return this;
}
public void setMemberships(Set<Membership> memberships) {
this.memberships = memberships;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override @Override

View File

@ -41,7 +41,7 @@ public class Membership implements Serializable {
private Set<Asset> assets = new HashSet<>(); private Set<Asset> assets = new HashSet<>();
@NotNull @NotNull
@ManyToOne @ManyToOne(optional = false)
@JsonIgnoreProperties("memberships") @JsonIgnoreProperties("memberships")
private Customer customer; private Customer customer;

View File

@ -45,7 +45,7 @@ public class Share implements Serializable {
private String comment; private String comment;
@NotNull @NotNull
@ManyToOne @ManyToOne(optional = false)
@JsonIgnoreProperties("shares") @JsonIgnoreProperties("shares")
private Membership member; private Membership member;

View File

@ -1,9 +1,14 @@
package org.hostsharing.hsadminng.service; package org.hostsharing.hsadminng.service;
import java.util.List; import io.github.jhipster.service.QueryService;
import org.hostsharing.hsadminng.domain.Customer;
import javax.persistence.criteria.JoinType; import org.hostsharing.hsadminng.domain.CustomerContact_;
import org.hostsharing.hsadminng.domain.Customer_;
import org.hostsharing.hsadminng.domain.Membership_;
import org.hostsharing.hsadminng.repository.CustomerRepository;
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerMapper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
@ -12,14 +17,8 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import io.github.jhipster.service.QueryService; import javax.persistence.criteria.JoinType;
import java.util.List;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.domain.*; // for static metamodels
import org.hostsharing.hsadminng.repository.CustomerRepository;
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerMapper;
/** /**
* Service for executing complex queries for Customer entities in the database. * Service for executing complex queries for Customer entities in the database.
@ -110,14 +109,14 @@ public class CustomerQueryService extends QueryService<Customer> {
if (criteria.getBillingSalutation() != null) { if (criteria.getBillingSalutation() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingSalutation(), Customer_.billingSalutation)); specification = specification.and(buildStringSpecification(criteria.getBillingSalutation(), Customer_.billingSalutation));
} }
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id)));
}
if (criteria.getRoleId() != null) { if (criteria.getRoleId() != null) {
specification = specification.and(buildSpecification(criteria.getRoleId(), specification = specification.and(buildSpecification(criteria.getRoleId(),
root -> root.join(Customer_.roles, JoinType.LEFT).get(CustomerContact_.id))); root -> root.join(Customer_.roles, JoinType.LEFT).get(CustomerContact_.id)));
} }
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id)));
}
} }
return specification; return specification;
} }

View File

@ -1,15 +1,13 @@
package org.hostsharing.hsadminng.service.dto; package org.hostsharing.hsadminng.service.dto;
import java.io.Serializable;
import java.util.Objects;
import io.github.jhipster.service.filter.BooleanFilter;
import io.github.jhipster.service.filter.DoubleFilter;
import io.github.jhipster.service.filter.Filter; import io.github.jhipster.service.filter.Filter;
import io.github.jhipster.service.filter.FloatFilter;
import io.github.jhipster.service.filter.IntegerFilter; import io.github.jhipster.service.filter.IntegerFilter;
import io.github.jhipster.service.filter.LongFilter; import io.github.jhipster.service.filter.LongFilter;
import io.github.jhipster.service.filter.StringFilter; import io.github.jhipster.service.filter.StringFilter;
import java.io.Serializable;
import java.util.Objects;
/** /**
* Criteria class for the Customer entity. This class is used in CustomerResource to * Criteria class for the Customer entity. This class is used in CustomerResource to
* receive all the possible filtering options from the Http GET request parameters. * receive all the possible filtering options from the Http GET request parameters.
@ -38,10 +36,10 @@ public class CustomerCriteria implements Serializable {
private StringFilter billingSalutation; private StringFilter billingSalutation;
private LongFilter membershipId;
private LongFilter roleId; private LongFilter roleId;
private LongFilter membershipId;
public LongFilter getId() { public LongFilter getId() {
return id; return id;
} }
@ -106,14 +104,6 @@ public class CustomerCriteria implements Serializable {
this.billingSalutation = billingSalutation; this.billingSalutation = billingSalutation;
} }
public LongFilter getMembershipId() {
return membershipId;
}
public void setMembershipId(LongFilter membershipId) {
this.membershipId = membershipId;
}
public LongFilter getRoleId() { public LongFilter getRoleId() {
return roleId; return roleId;
} }
@ -122,6 +112,14 @@ public class CustomerCriteria implements Serializable {
this.roleId = roleId; this.roleId = roleId;
} }
public LongFilter getMembershipId() {
return membershipId;
}
public void setMembershipId(LongFilter membershipId) {
this.membershipId = membershipId;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
@ -141,8 +139,8 @@ public class CustomerCriteria implements Serializable {
Objects.equals(contractualSalutation, that.contractualSalutation) && Objects.equals(contractualSalutation, that.contractualSalutation) &&
Objects.equals(billingAddress, that.billingAddress) && Objects.equals(billingAddress, that.billingAddress) &&
Objects.equals(billingSalutation, that.billingSalutation) && Objects.equals(billingSalutation, that.billingSalutation) &&
Objects.equals(membershipId, that.membershipId) && Objects.equals(roleId, that.roleId) &&
Objects.equals(roleId, that.roleId); Objects.equals(membershipId, that.membershipId);
} }
@Override @Override
@ -156,8 +154,8 @@ public class CustomerCriteria implements Serializable {
contractualSalutation, contractualSalutation,
billingAddress, billingAddress,
billingSalutation, billingSalutation,
membershipId, roleId,
roleId membershipId
); );
} }
@ -172,8 +170,8 @@ public class CustomerCriteria implements Serializable {
(contractualSalutation != null ? "contractualSalutation=" + contractualSalutation + ", " : "") + (contractualSalutation != null ? "contractualSalutation=" + contractualSalutation + ", " : "") +
(billingAddress != null ? "billingAddress=" + billingAddress + ", " : "") + (billingAddress != null ? "billingAddress=" + billingAddress + ", " : "") +
(billingSalutation != null ? "billingSalutation=" + billingSalutation + ", " : "") + (billingSalutation != null ? "billingSalutation=" + billingSalutation + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
(roleId != null ? "roleId=" + roleId + ", " : "") + (roleId != null ? "roleId=" + roleId + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
"}"; "}";
} }

View File

@ -1,9 +1,9 @@
package org.hostsharing.hsadminng.service.mapper; package org.hostsharing.hsadminng.service.mapper;
import org.hostsharing.hsadminng.domain.*; import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.service.dto.CustomerDTO; import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.mapstruct.Mapper;
import org.mapstruct.*; import org.mapstruct.Mapping;
/** /**
* Mapper for the entity Customer and its DTO CustomerDTO. * Mapper for the entity Customer and its DTO CustomerDTO.
@ -12,8 +12,8 @@ import org.mapstruct.*;
public interface CustomerMapper extends EntityMapper<CustomerDTO, Customer> { public interface CustomerMapper extends EntityMapper<CustomerDTO, Customer> {
@Mapping(target = "memberships", ignore = true)
@Mapping(target = "roles", ignore = true) @Mapping(target = "roles", ignore = true)
@Mapping(target = "memberships", ignore = true)
Customer toEntity(CustomerDTO customerDTO); Customer toEntity(CustomerDTO customerDTO);
default Customer fromId(Long id) { default Customer fromId(Long id) {

View File

@ -63,13 +63,10 @@ entity Asset {
} }
relationship OneToMany { relationship OneToMany {
Customer to Membership{customer(prefix)}, Contact{role} to CustomerContact{contact(email) required},
Membership to Share{member}, Customer{role} to CustomerContact{customer(prefix) required},
Membership to Asset{member} Customer to Membership{customer(prefix) required},
} Membership to Share{member required},
Membership to Asset{member required}
relationship ManyToOne {
CustomerContact{contact(email) required} to Contact{role},
CustomerContact{customer(prefix) required} to Customer{role}
} }

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog <databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="now" value="now()" dbms="h2"/> <property name="now" value="now()" dbms="h2"/>
@ -30,7 +28,7 @@
</column> </column>
<column name="customer_id" type="bigint"> <column name="customer_id" type="bigint">
<constraints nullable="true" /> <constraints nullable="false"/>
</column> </column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove--> <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog <databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="now" value="now()" dbms="h2"/> <property name="now" value="now()" dbms="h2"/>
@ -38,7 +36,7 @@
</column> </column>
<column name="member_id" type="bigint"> <column name="member_id" type="bigint">
<constraints nullable="true" /> <constraints nullable="false"/>
</column> </column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove--> <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog <databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="now" value="now()" dbms="h2"/> <property name="now" value="now()" dbms="h2"/>
@ -38,7 +36,7 @@
</column> </column>
<column name="member_id" type="bigint"> <column name="member_id" type="bigint">
<constraints nullable="true" /> <constraints nullable="false"/>
</column> </column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove--> <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->

View File

@ -71,11 +71,18 @@
<div class="form-group"> <div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.member" for="field_member">Member</label> <label class="form-control-label" jhiTranslate="hsadminNgApp.asset.member" for="field_member">Member</label>
<select class="form-control" id="field_member" name="member" [(ngModel)]="asset.memberId" > <select class="form-control" id="field_member" name="member" [(ngModel)]="asset.memberId" required>
<option [ngValue]="null"></option> <option *ngIf="!editForm.value.member" [ngValue]="null" selected></option>
<option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.id}}</option> <option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.id}}</option>
</select> </select>
</div> </div>
<div [hidden]="!(editForm.controls.member?.dirty && editForm.controls.member?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.member?.errors?.required"
jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div> </div>
<div> <div>
<button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()"> <button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">

View File

@ -64,7 +64,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.contractualAddress" <label class="form-control-label" jhiTranslate="hsadminNgApp.customer.contractualAddress"
for="field_contractualAddress">Contractual Address X</label> for="field_contractualAddress">Contractual Address</label>
<textarea class="form-control" name="contractualAddress" id="field_contractualAddress" rows="3" <textarea class="form-control" name="contractualAddress" id="field_contractualAddress" rows="3"
[(ngModel)]="customer.contractualAddress" required maxlength="400"></textarea> [(ngModel)]="customer.contractualAddress" required maxlength="400"></textarea>
<div [hidden]="!(editForm.controls.contractualAddress?.dirty && editForm.controls.contractualAddress?.invalid)"> <div [hidden]="!(editForm.controls.contractualAddress?.dirty && editForm.controls.contractualAddress?.invalid)">

View File

@ -1,4 +1,4 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
@NgModule({ @NgModule({
@ -35,6 +35,58 @@ import { RouterModule } from '@angular/router';
{ {
path: 'customer', path: 'customer',
loadChildren: './customer/customer.module#HsadminNgCustomerModule' loadChildren: './customer/customer.module#HsadminNgCustomerModule'
},
{
path: 'customer',
loadChildren: './customer/customer.module#HsadminNgCustomerModule'
},
{
path: 'membership',
loadChildren: './membership/membership.module#HsadminNgMembershipModule'
},
{
path: 'share',
loadChildren: './share/share.module#HsadminNgShareModule'
},
{
path: 'asset',
loadChildren: './asset/asset.module#HsadminNgAssetModule'
},
{
path: 'customer',
loadChildren: './customer/customer.module#HsadminNgCustomerModule'
},
{
path: 'membership',
loadChildren: './membership/membership.module#HsadminNgMembershipModule'
},
{
path: 'share',
loadChildren: './share/share.module#HsadminNgShareModule'
},
{
path: 'asset',
loadChildren: './asset/asset.module#HsadminNgAssetModule'
},
{
path: 'customer',
loadChildren: './customer/customer.module#HsadminNgCustomerModule'
},
{
path: 'membership',
loadChildren: './membership/membership.module#HsadminNgMembershipModule'
},
{
path: 'share',
loadChildren: './share/share.module#HsadminNgShareModule'
},
{
path: 'asset',
loadChildren: './asset/asset.module#HsadminNgAssetModule'
},
{
path: 'membership',
loadChildren: './membership/membership.module#HsadminNgMembershipModule'
} }
/* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */ /* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */
]) ])

View File

@ -38,11 +38,19 @@
<div class="form-group"> <div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.customer" for="field_customer">Customer</label> <label class="form-control-label" jhiTranslate="hsadminNgApp.membership.customer" for="field_customer">Customer</label>
<select class="form-control" id="field_customer" name="customer" [(ngModel)]="membership.customerId" > <select class="form-control" id="field_customer" name="customer" [(ngModel)]="membership.customerId"
<option [ngValue]="null"></option> required>
<option *ngIf="!editForm.value.customer" [ngValue]="null" selected></option>
<option [ngValue]="customerOption.id" *ngFor="let customerOption of customers; trackBy: trackCustomerById">{{customerOption.prefix}}</option> <option [ngValue]="customerOption.id" *ngFor="let customerOption of customers; trackBy: trackCustomerById">{{customerOption.prefix}}</option>
</select> </select>
</div> </div>
<div [hidden]="!(editForm.controls.customer?.dirty && editForm.controls.customer?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.customer?.errors?.required"
jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div> </div>
<div> <div>
<button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()"> <button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">

View File

@ -67,11 +67,18 @@
<div class="form-group"> <div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.member" for="field_member">Member</label> <label class="form-control-label" jhiTranslate="hsadminNgApp.share.member" for="field_member">Member</label>
<select class="form-control" id="field_member" name="member" [(ngModel)]="share.memberId" > <select class="form-control" id="field_member" name="member" [(ngModel)]="share.memberId" required>
<option [ngValue]="null"></option> <option *ngIf="!editForm.value.member" [ngValue]="null" selected></option>
<option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.id}}</option> <option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.id}}</option>
</select> </select>
</div> </div>
<div [hidden]="!(editForm.controls.member?.dirty && editForm.controls.member?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.member?.errors?.required"
jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div> </div>
<div> <div>
<button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()"> <button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">

View File

@ -1,5 +1,5 @@
import { IMembership } from 'app/shared/model/membership.model';
import { ICustomerContact } from 'app/shared/model/customer-contact.model'; import { ICustomerContact } from 'app/shared/model/customer-contact.model';
import { IMembership } from 'app/shared/model/membership.model';
export interface ICustomer { export interface ICustomer {
id?: number; id?: number;
@ -10,8 +10,8 @@ export interface ICustomer {
contractualSalutation?: string; contractualSalutation?: string;
billingAddress?: string; billingAddress?: string;
billingSalutation?: string; billingSalutation?: string;
memberships?: IMembership[];
roles?: ICustomerContact[]; roles?: ICustomerContact[];
memberships?: IMembership[];
} }
export class Customer implements ICustomer { export class Customer implements ICustomer {
@ -24,7 +24,7 @@ export class Customer implements ICustomer {
public contractualSalutation?: string, public contractualSalutation?: string,
public billingAddress?: string, public billingAddress?: string,
public billingSalutation?: string, public billingSalutation?: string,
public memberships?: IMembership[], public roles?: ICustomerContact[],
public roles?: ICustomerContact[] public memberships?: IMembership[]
) {} ) {}
} }

View File

@ -22,8 +22,8 @@
"contractualSalutation": "Contractual Salutation", "contractualSalutation": "Contractual Salutation",
"billingAddress": "Billing Address", "billingAddress": "Billing Address",
"billingSalutation": "Billing Salutation", "billingSalutation": "Billing Salutation",
"membership": "Membership", "role": "Role",
"role": "Role" "membership": "Membership"
} }
} }
} }

View File

@ -22,8 +22,8 @@
"contractualSalutation": "Contractual Salutation", "contractualSalutation": "Contractual Salutation",
"billingAddress": "Billing Address", "billingAddress": "Billing Address",
"billingSalutation": "Billing Salutation", "billingSalutation": "Billing Salutation",
"membership": "Membership", "role": "Role",
"role": "Role" "membership": "Membership"
} }
} }
} }

View File

@ -1,7 +1,7 @@
/* tslint:disable max-line-length */ /* tslint:disable max-line-length */
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http'; import { HttpResponse } from '@angular/common/http';
import { Observable, of } from 'rxjs'; import { of } from 'rxjs';
import { HsadminNgTestModule } from '../../../test.module'; import { HsadminNgTestModule } from '../../../test.module';
import { AssetUpdateComponent } from 'app/entities/asset/asset-update.component'; import { AssetUpdateComponent } from 'app/entities/asset/asset-update.component';

View File

@ -1,7 +1,7 @@
/* tslint:disable max-line-length */ /* tslint:disable max-line-length */
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http'; import { HttpResponse } from '@angular/common/http';
import { Observable, of } from 'rxjs'; import { of } from 'rxjs';
import { HsadminNgTestModule } from '../../../test.module'; import { HsadminNgTestModule } from '../../../test.module';
import { CustomerUpdateComponent } from 'app/entities/customer/customer-update.component'; import { CustomerUpdateComponent } from 'app/entities/customer/customer-update.component';

View File

@ -1,7 +1,7 @@
/* tslint:disable max-line-length */ /* tslint:disable max-line-length */
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http'; import { HttpResponse } from '@angular/common/http';
import { Observable, of } from 'rxjs'; import { of } from 'rxjs';
import { HsadminNgTestModule } from '../../../test.module'; import { HsadminNgTestModule } from '../../../test.module';
import { MembershipUpdateComponent } from 'app/entities/membership/membership-update.component'; import { MembershipUpdateComponent } from 'app/entities/membership/membership-update.component';

View File

@ -1,7 +1,7 @@
/* tslint:disable max-line-length */ /* tslint:disable max-line-length */
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http'; import { HttpResponse } from '@angular/common/http';
import { Observable, of } from 'rxjs'; import { of } from 'rxjs';
import { HsadminNgTestModule } from '../../../test.module'; import { HsadminNgTestModule } from '../../../test.module';
import { ShareUpdateComponent } from 'app/entities/share/share-update.component'; import { ShareUpdateComponent } from 'app/entities/share/share-update.component';