From 664926ab8ab6947f3bef26d1b20b8d210ebf9af0 Mon Sep 17 00:00:00 2001 From: JHipster Bot Date: Thu, 31 Dec 2020 07:12:01 +0000 Subject: [PATCH 1/2] Add JDL Model `CCWAPP` See https://start.jhipster.tech/jdl-studio/#!/view/ef85c763-04ea-464f-8b58-e9723b993d50 --- ccwapp.jh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 ccwapp.jh diff --git a/ccwapp.jh b/ccwapp.jh new file mode 100644 index 0000000..4e743c1 --- /dev/null +++ b/ccwapp.jh @@ -0,0 +1,48 @@ + +application { + config { + baseName CCWApplication, + applicationType monolith, + packageName com.finca.ccw, + authenticationType jwt, + prodDatabaseType mysql, + clientFramework angular + } + entities * +} + +entity Employee { + EmployeeID String required + UnitID String required + FirstName String required + LastName String required + EmailAddress String required + Login String +} + +entity CollectionTracking { + EmployeeID String required + UnitID String required + EmployeeName String required + BusinessProposal String required + SubProposal String required + MobileNo String required + RelationId String required + AccountNo String required + AccountTitle String required + NoOfVisits Integer required + OsAmount BigDecimal required + OsProfit BigDecimal required + OdDays String required + LoanOfficer String required + VisitedBy String required + PptDate LocalDate required + Remakrs String required + + +} + +relationship OneToMany { + Employee to CollectionTracking +} + \ No newline at end of file From 491c395c71298681413933e5311e2484fb4fd7df Mon Sep 17 00:00:00 2001 From: JHipster Bot Date: Thu, 31 Dec 2020 07:12:20 +0000 Subject: [PATCH 2/2] Generate entities from JDL Model `CCWAPP` See https://start.jhipster.tech/jdl-studio/#!/view/ef85c763-04ea-464f-8b58-e9723b993d50 --- .jhipster/CollectionTracking.json | 110 +++ .jhipster/Employee.json | 53 ++ .yo-rc.json | 15 +- pom.xml | 25 +- .../finca/ccw/config/CacheConfiguration.java | 3 + .../finca/ccw/domain/CollectionTracking.java | 382 +++++++++ .../java/com/finca/ccw/domain/Employee.java | 194 +++++ .../CollectionTrackingRepository.java | 12 + .../ccw/repository/EmployeeRepository.java | 12 + .../web/rest/CollectionTrackingResource.java | 123 +++ .../finca/ccw/web/rest/EmployeeResource.java | 121 +++ .../20201231071304_added_entity_Employee.xml | 70 ++ ...071404_added_entity_CollectionTracking.xml | 117 +++ ..._entity_constraints_CollectionTracking.xml | 18 + .../fake-data/collection_tracking.csv | 11 + .../config/liquibase/fake-data/employee.csv | 11 + .../resources/config/liquibase/master.xml | 3 + .../resources/i18n/messages_fr.properties | 21 + .../app/core/language/language.constants.ts | 1 + ...tion-tracking-delete-dialog.component.html | 24 + ...ection-tracking-delete-dialog.component.ts | 30 + .../collection-tracking-detail.component.html | 100 +++ .../collection-tracking-detail.component.ts | 22 + .../collection-tracking-update.component.html | 254 ++++++ .../collection-tracking-update.component.ts | 141 ++++ .../collection-tracking.component.html | 99 +++ .../collection-tracking.component.ts | 55 ++ .../collection-tracking.module.ts | 21 + .../collection-tracking.route.ts | 83 ++ .../collection-tracking.service.ts | 75 ++ .../employee-delete-dialog.component.html | 24 + .../employee-delete-dialog.component.ts | 26 + .../employee/employee-detail.component.html | 50 ++ .../employee/employee-detail.component.ts | 22 + .../employee/employee-update.component.html | 92 +++ .../employee/employee-update.component.ts | 90 +++ .../entities/employee/employee.component.html | 71 ++ .../entities/employee/employee.component.ts | 49 ++ .../app/entities/employee/employee.module.ts | 16 + .../app/entities/employee/employee.route.ts | 83 ++ .../app/entities/employee/employee.service.ts | 38 + src/main/webapp/app/entities/entity.module.ts | 8 + .../app/layouts/navbar/navbar.component.html | 12 + .../language/find-language-from-key.pipe.ts | 1 + .../shared/model/collection-tracking.model.ts | 48 ++ .../webapp/app/shared/model/employee.model.ts | 25 + .../webapp/i18n/en/collectionTracking.json | 39 + src/main/webapp/i18n/en/employee.json | 28 + src/main/webapp/i18n/en/global.json | 2 + src/main/webapp/i18n/fr/activate.json | 9 + src/main/webapp/i18n/fr/audits.json | 28 + .../webapp/i18n/fr/collectionTracking.json | 39 + src/main/webapp/i18n/fr/configuration.json | 10 + src/main/webapp/i18n/fr/employee.json | 28 + src/main/webapp/i18n/fr/error.json | 14 + src/main/webapp/i18n/fr/global.json | 142 ++++ src/main/webapp/i18n/fr/health.json | 29 + src/main/webapp/i18n/fr/home.json | 19 + src/main/webapp/i18n/fr/login.json | 19 + src/main/webapp/i18n/fr/logs.json | 11 + src/main/webapp/i18n/fr/metrics.json | 102 +++ src/main/webapp/i18n/fr/password.json | 12 + src/main/webapp/i18n/fr/register.json | 24 + src/main/webapp/i18n/fr/reset.json | 26 + src/main/webapp/i18n/fr/sessions.json | 15 + src/main/webapp/i18n/fr/settings.json | 32 + src/main/webapp/i18n/fr/user-management.json | 30 + .../ccw/domain/CollectionTrackingTest.java | 23 + .../com/finca/ccw/domain/EmployeeTest.java | 23 + .../com/finca/ccw/service/MailServiceIT.java | 1 + .../rest/CollectionTrackingResourceIT.java | 738 ++++++++++++++++++ .../ccw/web/rest/EmployeeResourceIT.java | 339 ++++++++ ...n-tracking-delete-dialog.component.spec.ts | 65 ++ ...llection-tracking-detail.component.spec.ts | 37 + ...llection-tracking-update.component.spec.ts | 61 ++ .../collection-tracking.component.spec.ts | 49 ++ .../collection-tracking.service.spec.ts | 178 +++++ .../employee-delete-dialog.component.spec.ts | 65 ++ .../employee-detail.component.spec.ts | 37 + .../employee-update.component.spec.ts | 61 ++ .../employee/employee.component.spec.ts | 49 ++ .../employee/employee.service.spec.ts | 112 +++ .../resources/i18n/messages_fr.properties | 1 + webpack/webpack.common.js | 3 +- webpack/webpack.prod.js | 3 +- 85 files changed, 5338 insertions(+), 26 deletions(-) create mode 100644 .jhipster/CollectionTracking.json create mode 100644 .jhipster/Employee.json create mode 100644 src/main/java/com/finca/ccw/domain/CollectionTracking.java create mode 100644 src/main/java/com/finca/ccw/domain/Employee.java create mode 100644 src/main/java/com/finca/ccw/repository/CollectionTrackingRepository.java create mode 100644 src/main/java/com/finca/ccw/repository/EmployeeRepository.java create mode 100644 src/main/java/com/finca/ccw/web/rest/CollectionTrackingResource.java create mode 100644 src/main/java/com/finca/ccw/web/rest/EmployeeResource.java create mode 100644 src/main/resources/config/liquibase/changelog/20201231071304_added_entity_Employee.xml create mode 100644 src/main/resources/config/liquibase/changelog/20201231071404_added_entity_CollectionTracking.xml create mode 100644 src/main/resources/config/liquibase/changelog/20201231071404_added_entity_constraints_CollectionTracking.xml create mode 100644 src/main/resources/config/liquibase/fake-data/collection_tracking.csv create mode 100644 src/main/resources/config/liquibase/fake-data/employee.csv create mode 100644 src/main/resources/i18n/messages_fr.properties create mode 100644 src/main/webapp/app/entities/collection-tracking/collection-tracking-delete-dialog.component.html create mode 100644 src/main/webapp/app/entities/collection-tracking/collection-tracking-delete-dialog.component.ts create mode 100644 src/main/webapp/app/entities/collection-tracking/collection-tracking-detail.component.html create mode 100644 src/main/webapp/app/entities/collection-tracking/collection-tracking-detail.component.ts create mode 100644 src/main/webapp/app/entities/collection-tracking/collection-tracking-update.component.html create mode 100644 src/main/webapp/app/entities/collection-tracking/collection-tracking-update.component.ts create mode 100644 src/main/webapp/app/entities/collection-tracking/collection-tracking.component.html create mode 100644 src/main/webapp/app/entities/collection-tracking/collection-tracking.component.ts create mode 100644 src/main/webapp/app/entities/collection-tracking/collection-tracking.module.ts create mode 100644 src/main/webapp/app/entities/collection-tracking/collection-tracking.route.ts create mode 100644 src/main/webapp/app/entities/collection-tracking/collection-tracking.service.ts create mode 100644 src/main/webapp/app/entities/employee/employee-delete-dialog.component.html create mode 100644 src/main/webapp/app/entities/employee/employee-delete-dialog.component.ts create mode 100644 src/main/webapp/app/entities/employee/employee-detail.component.html create mode 100644 src/main/webapp/app/entities/employee/employee-detail.component.ts create mode 100644 src/main/webapp/app/entities/employee/employee-update.component.html create mode 100644 src/main/webapp/app/entities/employee/employee-update.component.ts create mode 100644 src/main/webapp/app/entities/employee/employee.component.html create mode 100644 src/main/webapp/app/entities/employee/employee.component.ts create mode 100644 src/main/webapp/app/entities/employee/employee.module.ts create mode 100644 src/main/webapp/app/entities/employee/employee.route.ts create mode 100644 src/main/webapp/app/entities/employee/employee.service.ts create mode 100644 src/main/webapp/app/shared/model/collection-tracking.model.ts create mode 100644 src/main/webapp/app/shared/model/employee.model.ts create mode 100644 src/main/webapp/i18n/en/collectionTracking.json create mode 100644 src/main/webapp/i18n/en/employee.json create mode 100644 src/main/webapp/i18n/fr/activate.json create mode 100644 src/main/webapp/i18n/fr/audits.json create mode 100644 src/main/webapp/i18n/fr/collectionTracking.json create mode 100644 src/main/webapp/i18n/fr/configuration.json create mode 100644 src/main/webapp/i18n/fr/employee.json create mode 100644 src/main/webapp/i18n/fr/error.json create mode 100644 src/main/webapp/i18n/fr/global.json create mode 100644 src/main/webapp/i18n/fr/health.json create mode 100644 src/main/webapp/i18n/fr/home.json create mode 100644 src/main/webapp/i18n/fr/login.json create mode 100644 src/main/webapp/i18n/fr/logs.json create mode 100644 src/main/webapp/i18n/fr/metrics.json create mode 100644 src/main/webapp/i18n/fr/password.json create mode 100644 src/main/webapp/i18n/fr/register.json create mode 100644 src/main/webapp/i18n/fr/reset.json create mode 100644 src/main/webapp/i18n/fr/sessions.json create mode 100644 src/main/webapp/i18n/fr/settings.json create mode 100644 src/main/webapp/i18n/fr/user-management.json create mode 100644 src/test/java/com/finca/ccw/domain/CollectionTrackingTest.java create mode 100644 src/test/java/com/finca/ccw/domain/EmployeeTest.java create mode 100644 src/test/java/com/finca/ccw/web/rest/CollectionTrackingResourceIT.java create mode 100644 src/test/java/com/finca/ccw/web/rest/EmployeeResourceIT.java create mode 100644 src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-delete-dialog.component.spec.ts create mode 100644 src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-detail.component.spec.ts create mode 100644 src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-update.component.spec.ts create mode 100644 src/test/javascript/spec/app/entities/collection-tracking/collection-tracking.component.spec.ts create mode 100644 src/test/javascript/spec/app/entities/collection-tracking/collection-tracking.service.spec.ts create mode 100644 src/test/javascript/spec/app/entities/employee/employee-delete-dialog.component.spec.ts create mode 100644 src/test/javascript/spec/app/entities/employee/employee-detail.component.spec.ts create mode 100644 src/test/javascript/spec/app/entities/employee/employee-update.component.spec.ts create mode 100644 src/test/javascript/spec/app/entities/employee/employee.component.spec.ts create mode 100644 src/test/javascript/spec/app/entities/employee/employee.service.spec.ts create mode 100644 src/test/resources/i18n/messages_fr.properties diff --git a/.jhipster/CollectionTracking.json b/.jhipster/CollectionTracking.json new file mode 100644 index 0000000..c0cea88 --- /dev/null +++ b/.jhipster/CollectionTracking.json @@ -0,0 +1,110 @@ +{ + "name": "CollectionTracking", + "fields": [ + { + "fieldName": "employeeID", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "unitID", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "employeeName", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "businessProposal", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "subProposal", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "mobileNo", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "relationId", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "accountNo", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "accountTitle", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "noOfVisits", + "fieldType": "Integer", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "osAmount", + "fieldType": "BigDecimal", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "osProfit", + "fieldType": "BigDecimal", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "odDays", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "loanOfficer", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "visitedBy", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "pptDate", + "fieldType": "LocalDate", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "remakrs", + "fieldType": "String", + "fieldValidateRules": ["required"] + } + ], + "relationships": [ + { + "relationshipType": "many-to-one", + "otherEntityName": "employee", + "otherEntityRelationshipName": "collectionTracking", + "relationshipName": "employee", + "otherEntityField": "id" + } + ], + "changelogDate": "20201231071404", + "entityTableName": "collection_tracking", + "dto": "no", + "pagination": "no", + "service": "no", + "jpaMetamodelFiltering": false, + "fluentMethods": true, + "readOnly": false, + "embedded": false, + "clientRootFolder": "", + "applications": ["CCWApplication"] +} diff --git a/.jhipster/Employee.json b/.jhipster/Employee.json new file mode 100644 index 0000000..69180d6 --- /dev/null +++ b/.jhipster/Employee.json @@ -0,0 +1,53 @@ +{ + "name": "Employee", + "fields": [ + { + "fieldName": "employeeID", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "unitID", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "firstName", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "lastName", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "emailAddress", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "login", + "fieldType": "String" + } + ], + "relationships": [ + { + "relationshipType": "one-to-many", + "otherEntityName": "collectionTracking", + "otherEntityRelationshipName": "employee", + "relationshipName": "collectionTracking" + } + ], + "changelogDate": "20201231071304", + "entityTableName": "employee", + "dto": "no", + "pagination": "no", + "service": "no", + "jpaMetamodelFiltering": false, + "fluentMethods": true, + "readOnly": false, + "embedded": false, + "clientRootFolder": "", + "applications": ["CCWApplication"] +} diff --git a/.yo-rc.json b/.yo-rc.json index fbe2171..49f74cd 100644 --- a/.yo-rc.json +++ b/.yo-rc.json @@ -5,7 +5,7 @@ "baseName": "CCWApplication", "packageName": "com.finca.ccw", "packageFolder": "com/finca/ccw", - "serverPort": 8080, + "serverPort": "8080", "serviceDiscoveryType": false, "authenticationType": "jwt", "uaaBaseName": "../uaa", @@ -21,10 +21,10 @@ "buildTool": "maven", "useSass": true, "clientPackageManager": "npm", - "testFrameworks": ["cucumber"], + "testFrameworks": [], "enableTranslation": true, "nativeLanguage": "en", - "languages": ["en"], + "languages": ["en", "fr"], "clientFramework": "angularX", "jhiPrefix": "jhi", "jhipsterVersion": "6.10.5", @@ -36,9 +36,14 @@ "dtoSuffix": "DTO", "otherModules": [], "blueprints": [], - "prettierJava": true + "prettierJava": true, + "skipUserManagement": false, + "skipClient": false, + "skipServer": false, + "clientThemeVariant": "" }, "git-provider": "GitHub", "git-company": "ask4abid", - "repository-name": "CCW-application" + "repository-name": "CCW-application", + "entities": ["Employee", "CollectionTracking"] } diff --git a/pom.xml b/pom.xml index 53b81cd..1968205 100644 --- a/pom.xml +++ b/pom.xml @@ -247,6 +247,12 @@ org.springframework.boot spring-boot-starter-test test + + + org.junit.vintage + junit-vintage-engine + + org.springframework.boot @@ -307,30 +313,11 @@ io.dropwizard.metrics metrics-core - - - io.cucumber - cucumber-junit - test - - - io.cucumber - cucumber-spring - test - spring-boot:run - - - src/test/resources/ - - - src/test/features - - org.apache.maven.plugins diff --git a/src/main/java/com/finca/ccw/config/CacheConfiguration.java b/src/main/java/com/finca/ccw/config/CacheConfiguration.java index 4c5730c..9cc094f 100644 --- a/src/main/java/com/finca/ccw/config/CacheConfiguration.java +++ b/src/main/java/com/finca/ccw/config/CacheConfiguration.java @@ -47,6 +47,9 @@ public JCacheManagerCustomizer cacheManagerCustomizer() { createCache(cm, com.finca.ccw.domain.User.class.getName()); createCache(cm, com.finca.ccw.domain.Authority.class.getName()); createCache(cm, com.finca.ccw.domain.User.class.getName() + ".authorities"); + createCache(cm, com.finca.ccw.domain.Employee.class.getName()); + createCache(cm, com.finca.ccw.domain.Employee.class.getName() + ".collectionTrackings"); + createCache(cm, com.finca.ccw.domain.CollectionTracking.class.getName()); // jhipster-needle-ehcache-add-entry }; } diff --git a/src/main/java/com/finca/ccw/domain/CollectionTracking.java b/src/main/java/com/finca/ccw/domain/CollectionTracking.java new file mode 100644 index 0000000..5d88dd7 --- /dev/null +++ b/src/main/java/com/finca/ccw/domain/CollectionTracking.java @@ -0,0 +1,382 @@ +package com.finca.ccw.domain; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A CollectionTracking. + */ +@Entity +@Table(name = "collection_tracking") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class CollectionTracking implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @NotNull + @Column(name = "employee_id", nullable = false) + private String employeeID; + + @NotNull + @Column(name = "unit_id", nullable = false) + private String unitID; + + @NotNull + @Column(name = "employee_name", nullable = false) + private String employeeName; + + @NotNull + @Column(name = "business_proposal", nullable = false) + private String businessProposal; + + @NotNull + @Column(name = "sub_proposal", nullable = false) + private String subProposal; + + @NotNull + @Column(name = "mobile_no", nullable = false) + private String mobileNo; + + @NotNull + @Column(name = "relation_id", nullable = false) + private String relationId; + + @NotNull + @Column(name = "account_no", nullable = false) + private String accountNo; + + @NotNull + @Column(name = "account_title", nullable = false) + private String accountTitle; + + @NotNull + @Column(name = "no_of_visits", nullable = false) + private Integer noOfVisits; + + @NotNull + @Column(name = "os_amount", precision = 21, scale = 2, nullable = false) + private BigDecimal osAmount; + + @NotNull + @Column(name = "os_profit", precision = 21, scale = 2, nullable = false) + private BigDecimal osProfit; + + @NotNull + @Column(name = "od_days", nullable = false) + private String odDays; + + @NotNull + @Column(name = "loan_officer", nullable = false) + private String loanOfficer; + + @NotNull + @Column(name = "visited_by", nullable = false) + private String visitedBy; + + @NotNull + @Column(name = "ppt_date", nullable = false) + private LocalDate pptDate; + + @NotNull + @Column(name = "remakrs", nullable = false) + private String remakrs; + + @ManyToOne + @JsonIgnoreProperties(value = "collectionTrackings", allowSetters = true) + private Employee employee; + + // jhipster-needle-entity-add-field - JHipster will add fields here + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getEmployeeID() { + return employeeID; + } + + public CollectionTracking employeeID(String employeeID) { + this.employeeID = employeeID; + return this; + } + + public void setEmployeeID(String employeeID) { + this.employeeID = employeeID; + } + + public String getUnitID() { + return unitID; + } + + public CollectionTracking unitID(String unitID) { + this.unitID = unitID; + return this; + } + + public void setUnitID(String unitID) { + this.unitID = unitID; + } + + public String getEmployeeName() { + return employeeName; + } + + public CollectionTracking employeeName(String employeeName) { + this.employeeName = employeeName; + return this; + } + + public void setEmployeeName(String employeeName) { + this.employeeName = employeeName; + } + + public String getBusinessProposal() { + return businessProposal; + } + + public CollectionTracking businessProposal(String businessProposal) { + this.businessProposal = businessProposal; + return this; + } + + public void setBusinessProposal(String businessProposal) { + this.businessProposal = businessProposal; + } + + public String getSubProposal() { + return subProposal; + } + + public CollectionTracking subProposal(String subProposal) { + this.subProposal = subProposal; + return this; + } + + public void setSubProposal(String subProposal) { + this.subProposal = subProposal; + } + + public String getMobileNo() { + return mobileNo; + } + + public CollectionTracking mobileNo(String mobileNo) { + this.mobileNo = mobileNo; + return this; + } + + public void setMobileNo(String mobileNo) { + this.mobileNo = mobileNo; + } + + public String getRelationId() { + return relationId; + } + + public CollectionTracking relationId(String relationId) { + this.relationId = relationId; + return this; + } + + public void setRelationId(String relationId) { + this.relationId = relationId; + } + + public String getAccountNo() { + return accountNo; + } + + public CollectionTracking accountNo(String accountNo) { + this.accountNo = accountNo; + return this; + } + + public void setAccountNo(String accountNo) { + this.accountNo = accountNo; + } + + public String getAccountTitle() { + return accountTitle; + } + + public CollectionTracking accountTitle(String accountTitle) { + this.accountTitle = accountTitle; + return this; + } + + public void setAccountTitle(String accountTitle) { + this.accountTitle = accountTitle; + } + + public Integer getNoOfVisits() { + return noOfVisits; + } + + public CollectionTracking noOfVisits(Integer noOfVisits) { + this.noOfVisits = noOfVisits; + return this; + } + + public void setNoOfVisits(Integer noOfVisits) { + this.noOfVisits = noOfVisits; + } + + public BigDecimal getOsAmount() { + return osAmount; + } + + public CollectionTracking osAmount(BigDecimal osAmount) { + this.osAmount = osAmount; + return this; + } + + public void setOsAmount(BigDecimal osAmount) { + this.osAmount = osAmount; + } + + public BigDecimal getOsProfit() { + return osProfit; + } + + public CollectionTracking osProfit(BigDecimal osProfit) { + this.osProfit = osProfit; + return this; + } + + public void setOsProfit(BigDecimal osProfit) { + this.osProfit = osProfit; + } + + public String getOdDays() { + return odDays; + } + + public CollectionTracking odDays(String odDays) { + this.odDays = odDays; + return this; + } + + public void setOdDays(String odDays) { + this.odDays = odDays; + } + + public String getLoanOfficer() { + return loanOfficer; + } + + public CollectionTracking loanOfficer(String loanOfficer) { + this.loanOfficer = loanOfficer; + return this; + } + + public void setLoanOfficer(String loanOfficer) { + this.loanOfficer = loanOfficer; + } + + public String getVisitedBy() { + return visitedBy; + } + + public CollectionTracking visitedBy(String visitedBy) { + this.visitedBy = visitedBy; + return this; + } + + public void setVisitedBy(String visitedBy) { + this.visitedBy = visitedBy; + } + + public LocalDate getPptDate() { + return pptDate; + } + + public CollectionTracking pptDate(LocalDate pptDate) { + this.pptDate = pptDate; + return this; + } + + public void setPptDate(LocalDate pptDate) { + this.pptDate = pptDate; + } + + public String getRemakrs() { + return remakrs; + } + + public CollectionTracking remakrs(String remakrs) { + this.remakrs = remakrs; + return this; + } + + public void setRemakrs(String remakrs) { + this.remakrs = remakrs; + } + + public Employee getEmployee() { + return employee; + } + + public CollectionTracking employee(Employee employee) { + this.employee = employee; + return this; + } + + public void setEmployee(Employee employee) { + this.employee = employee; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof CollectionTracking)) { + return false; + } + return id != null && id.equals(((CollectionTracking) o).id); + } + + @Override + public int hashCode() { + return 31; + } + + // prettier-ignore + @Override + public String toString() { + return "CollectionTracking{" + + "id=" + getId() + + ", employeeID='" + getEmployeeID() + "'" + + ", unitID='" + getUnitID() + "'" + + ", employeeName='" + getEmployeeName() + "'" + + ", businessProposal='" + getBusinessProposal() + "'" + + ", subProposal='" + getSubProposal() + "'" + + ", mobileNo='" + getMobileNo() + "'" + + ", relationId='" + getRelationId() + "'" + + ", accountNo='" + getAccountNo() + "'" + + ", accountTitle='" + getAccountTitle() + "'" + + ", noOfVisits=" + getNoOfVisits() + + ", osAmount=" + getOsAmount() + + ", osProfit=" + getOsProfit() + + ", odDays='" + getOdDays() + "'" + + ", loanOfficer='" + getLoanOfficer() + "'" + + ", visitedBy='" + getVisitedBy() + "'" + + ", pptDate='" + getPptDate() + "'" + + ", remakrs='" + getRemakrs() + "'" + + "}"; + } +} diff --git a/src/main/java/com/finca/ccw/domain/Employee.java b/src/main/java/com/finca/ccw/domain/Employee.java new file mode 100644 index 0000000..77dfa67 --- /dev/null +++ b/src/main/java/com/finca/ccw/domain/Employee.java @@ -0,0 +1,194 @@ +package com.finca.ccw.domain; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.Set; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A Employee. + */ +@Entity +@Table(name = "employee") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class Employee implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @NotNull + @Column(name = "employee_id", nullable = false) + private String employeeID; + + @NotNull + @Column(name = "unit_id", nullable = false) + private String unitID; + + @NotNull + @Column(name = "first_name", nullable = false) + private String firstName; + + @NotNull + @Column(name = "last_name", nullable = false) + private String lastName; + + @NotNull + @Column(name = "email_address", nullable = false) + private String emailAddress; + + @Column(name = "login") + private String login; + + @OneToMany(mappedBy = "employee") + @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) + private Set collectionTrackings = new HashSet<>(); + + // jhipster-needle-entity-add-field - JHipster will add fields here + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getEmployeeID() { + return employeeID; + } + + public Employee employeeID(String employeeID) { + this.employeeID = employeeID; + return this; + } + + public void setEmployeeID(String employeeID) { + this.employeeID = employeeID; + } + + public String getUnitID() { + return unitID; + } + + public Employee unitID(String unitID) { + this.unitID = unitID; + return this; + } + + public void setUnitID(String unitID) { + this.unitID = unitID; + } + + public String getFirstName() { + return firstName; + } + + public Employee firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public Employee lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getEmailAddress() { + return emailAddress; + } + + public Employee emailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public String getLogin() { + return login; + } + + public Employee login(String login) { + this.login = login; + return this; + } + + public void setLogin(String login) { + this.login = login; + } + + public Set getCollectionTrackings() { + return collectionTrackings; + } + + public Employee collectionTrackings(Set collectionTrackings) { + this.collectionTrackings = collectionTrackings; + return this; + } + + public Employee addCollectionTracking(CollectionTracking collectionTracking) { + this.collectionTrackings.add(collectionTracking); + collectionTracking.setEmployee(this); + return this; + } + + public Employee removeCollectionTracking(CollectionTracking collectionTracking) { + this.collectionTrackings.remove(collectionTracking); + collectionTracking.setEmployee(null); + return this; + } + + public void setCollectionTrackings(Set collectionTrackings) { + this.collectionTrackings = collectionTrackings; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof Employee)) { + return false; + } + return id != null && id.equals(((Employee) o).id); + } + + @Override + public int hashCode() { + return 31; + } + + // prettier-ignore + @Override + public String toString() { + return "Employee{" + + "id=" + getId() + + ", employeeID='" + getEmployeeID() + "'" + + ", unitID='" + getUnitID() + "'" + + ", firstName='" + getFirstName() + "'" + + ", lastName='" + getLastName() + "'" + + ", emailAddress='" + getEmailAddress() + "'" + + ", login='" + getLogin() + "'" + + "}"; + } +} diff --git a/src/main/java/com/finca/ccw/repository/CollectionTrackingRepository.java b/src/main/java/com/finca/ccw/repository/CollectionTrackingRepository.java new file mode 100644 index 0000000..1338457 --- /dev/null +++ b/src/main/java/com/finca/ccw/repository/CollectionTrackingRepository.java @@ -0,0 +1,12 @@ +package com.finca.ccw.repository; + +import com.finca.ccw.domain.CollectionTracking; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data repository for the CollectionTracking entity. + */ +@SuppressWarnings("unused") +@Repository +public interface CollectionTrackingRepository extends JpaRepository {} diff --git a/src/main/java/com/finca/ccw/repository/EmployeeRepository.java b/src/main/java/com/finca/ccw/repository/EmployeeRepository.java new file mode 100644 index 0000000..2ef2141 --- /dev/null +++ b/src/main/java/com/finca/ccw/repository/EmployeeRepository.java @@ -0,0 +1,12 @@ +package com.finca.ccw.repository; + +import com.finca.ccw.domain.Employee; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data repository for the Employee entity. + */ +@SuppressWarnings("unused") +@Repository +public interface EmployeeRepository extends JpaRepository {} diff --git a/src/main/java/com/finca/ccw/web/rest/CollectionTrackingResource.java b/src/main/java/com/finca/ccw/web/rest/CollectionTrackingResource.java new file mode 100644 index 0000000..2150970 --- /dev/null +++ b/src/main/java/com/finca/ccw/web/rest/CollectionTrackingResource.java @@ -0,0 +1,123 @@ +package com.finca.ccw.web.rest; + +import com.finca.ccw.domain.CollectionTracking; +import com.finca.ccw.repository.CollectionTrackingRepository; +import com.finca.ccw.web.rest.errors.BadRequestAlertException; +import io.github.jhipster.web.util.HeaderUtil; +import io.github.jhipster.web.util.ResponseUtil; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Optional; +import javax.validation.Valid; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +/** + * REST controller for managing {@link com.finca.ccw.domain.CollectionTracking}. + */ +@RestController +@RequestMapping("/api") +@Transactional +public class CollectionTrackingResource { + private final Logger log = LoggerFactory.getLogger(CollectionTrackingResource.class); + + private static final String ENTITY_NAME = "collectionTracking"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final CollectionTrackingRepository collectionTrackingRepository; + + public CollectionTrackingResource(CollectionTrackingRepository collectionTrackingRepository) { + this.collectionTrackingRepository = collectionTrackingRepository; + } + + /** + * {@code POST /collection-trackings} : Create a new collectionTracking. + * + * @param collectionTracking the collectionTracking to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new collectionTracking, or with status {@code 400 (Bad Request)} if the collectionTracking has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/collection-trackings") + public ResponseEntity createCollectionTracking(@Valid @RequestBody CollectionTracking collectionTracking) + throws URISyntaxException { + log.debug("REST request to save CollectionTracking : {}", collectionTracking); + if (collectionTracking.getId() != null) { + throw new BadRequestAlertException("A new collectionTracking cannot already have an ID", ENTITY_NAME, "idexists"); + } + CollectionTracking result = collectionTrackingRepository.save(collectionTracking); + return ResponseEntity + .created(new URI("/api/collection-trackings/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /collection-trackings} : Updates an existing collectionTracking. + * + * @param collectionTracking the collectionTracking to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated collectionTracking, + * or with status {@code 400 (Bad Request)} if the collectionTracking is not valid, + * or with status {@code 500 (Internal Server Error)} if the collectionTracking couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/collection-trackings") + public ResponseEntity updateCollectionTracking(@Valid @RequestBody CollectionTracking collectionTracking) + throws URISyntaxException { + log.debug("REST request to update CollectionTracking : {}", collectionTracking); + if (collectionTracking.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + CollectionTracking result = collectionTrackingRepository.save(collectionTracking); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, collectionTracking.getId().toString())) + .body(result); + } + + /** + * {@code GET /collection-trackings} : get all the collectionTrackings. + * + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of collectionTrackings in body. + */ + @GetMapping("/collection-trackings") + public List getAllCollectionTrackings() { + log.debug("REST request to get all CollectionTrackings"); + return collectionTrackingRepository.findAll(); + } + + /** + * {@code GET /collection-trackings/:id} : get the "id" collectionTracking. + * + * @param id the id of the collectionTracking to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the collectionTracking, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/collection-trackings/{id}") + public ResponseEntity getCollectionTracking(@PathVariable Long id) { + log.debug("REST request to get CollectionTracking : {}", id); + Optional collectionTracking = collectionTrackingRepository.findById(id); + return ResponseUtil.wrapOrNotFound(collectionTracking); + } + + /** + * {@code DELETE /collection-trackings/:id} : delete the "id" collectionTracking. + * + * @param id the id of the collectionTracking to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/collection-trackings/{id}") + public ResponseEntity deleteCollectionTracking(@PathVariable Long id) { + log.debug("REST request to delete CollectionTracking : {}", id); + collectionTrackingRepository.deleteById(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/java/com/finca/ccw/web/rest/EmployeeResource.java b/src/main/java/com/finca/ccw/web/rest/EmployeeResource.java new file mode 100644 index 0000000..36b749e --- /dev/null +++ b/src/main/java/com/finca/ccw/web/rest/EmployeeResource.java @@ -0,0 +1,121 @@ +package com.finca.ccw.web.rest; + +import com.finca.ccw.domain.Employee; +import com.finca.ccw.repository.EmployeeRepository; +import com.finca.ccw.web.rest.errors.BadRequestAlertException; +import io.github.jhipster.web.util.HeaderUtil; +import io.github.jhipster.web.util.ResponseUtil; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Optional; +import javax.validation.Valid; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +/** + * REST controller for managing {@link com.finca.ccw.domain.Employee}. + */ +@RestController +@RequestMapping("/api") +@Transactional +public class EmployeeResource { + private final Logger log = LoggerFactory.getLogger(EmployeeResource.class); + + private static final String ENTITY_NAME = "employee"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final EmployeeRepository employeeRepository; + + public EmployeeResource(EmployeeRepository employeeRepository) { + this.employeeRepository = employeeRepository; + } + + /** + * {@code POST /employees} : Create a new employee. + * + * @param employee the employee to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new employee, or with status {@code 400 (Bad Request)} if the employee has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/employees") + public ResponseEntity createEmployee(@Valid @RequestBody Employee employee) throws URISyntaxException { + log.debug("REST request to save Employee : {}", employee); + if (employee.getId() != null) { + throw new BadRequestAlertException("A new employee cannot already have an ID", ENTITY_NAME, "idexists"); + } + Employee result = employeeRepository.save(employee); + return ResponseEntity + .created(new URI("/api/employees/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /employees} : Updates an existing employee. + * + * @param employee the employee to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated employee, + * or with status {@code 400 (Bad Request)} if the employee is not valid, + * or with status {@code 500 (Internal Server Error)} if the employee couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/employees") + public ResponseEntity updateEmployee(@Valid @RequestBody Employee employee) throws URISyntaxException { + log.debug("REST request to update Employee : {}", employee); + if (employee.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + Employee result = employeeRepository.save(employee); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, employee.getId().toString())) + .body(result); + } + + /** + * {@code GET /employees} : get all the employees. + * + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of employees in body. + */ + @GetMapping("/employees") + public List getAllEmployees() { + log.debug("REST request to get all Employees"); + return employeeRepository.findAll(); + } + + /** + * {@code GET /employees/:id} : get the "id" employee. + * + * @param id the id of the employee to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the employee, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/employees/{id}") + public ResponseEntity getEmployee(@PathVariable Long id) { + log.debug("REST request to get Employee : {}", id); + Optional employee = employeeRepository.findById(id); + return ResponseUtil.wrapOrNotFound(employee); + } + + /** + * {@code DELETE /employees/:id} : delete the "id" employee. + * + * @param id the id of the employee to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/employees/{id}") + public ResponseEntity deleteEmployee(@PathVariable Long id) { + log.debug("REST request to delete Employee : {}", id); + employeeRepository.deleteById(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/resources/config/liquibase/changelog/20201231071304_added_entity_Employee.xml b/src/main/resources/config/liquibase/changelog/20201231071304_added_entity_Employee.xml new file mode 100644 index 0000000..ee3fad8 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20201231071304_added_entity_Employee.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20201231071404_added_entity_CollectionTracking.xml b/src/main/resources/config/liquibase/changelog/20201231071404_added_entity_CollectionTracking.xml new file mode 100644 index 0000000..f391c0b --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20201231071404_added_entity_CollectionTracking.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20201231071404_added_entity_constraints_CollectionTracking.xml b/src/main/resources/config/liquibase/changelog/20201231071404_added_entity_constraints_CollectionTracking.xml new file mode 100644 index 0000000..b21c4f5 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20201231071404_added_entity_constraints_CollectionTracking.xml @@ -0,0 +1,18 @@ + + + + + + + + + diff --git a/src/main/resources/config/liquibase/fake-data/collection_tracking.csv b/src/main/resources/config/liquibase/fake-data/collection_tracking.csv new file mode 100644 index 0000000..cdc4d6a --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/collection_tracking.csv @@ -0,0 +1,11 @@ +id;employee_id;unit_id;employee_name;business_proposal;sub_proposal;mobile_no;relation_id;account_no;account_title;no_of_visits;os_amount;os_profit;od_days;loan_officer;visited_by;ppt_date;remakrs +1;Identity;Summit;Handmade;Product;Ecuador Technician;bluetooth exploit;solutions compressing;Investment Account;withdrawal;31768;54559;7719;overriding frictionless;olive;Rustic Director;2020-12-30;North Dakota +2;input pixel;Points Dynamic homogeneous;SMS bandwidth;Garden Associate Concrete;lime;deposit Suriname Tasty Rubber Bacon;bandwidth;success Cuban Peso Peso Convertible strategy;copying;63793;33747;52066;Chicken;Sausages Automotive Wooden;Associate cross-platform Home Loan Account;2020-12-30;Officer +3;morph logistical JSON;Tasty;synthesizing;Ohio China virtual;connecting;plum European Monetary Unit (E.M.U.-6);solutions Granite Persistent;Diverse;channels;23013;95305;72004;Shoes;cyan Comoro Franc Shoes;Metrics tan;2020-12-30;Marketing +4;Falls Mission;Tasty integrated XSS;Handcrafted Metal Car cross-platform;override;Integration;backing up online;e-tailers;overriding Sports Fish;Louisiana;31725;48342;82482;middleware aggregate sky blue;Montana solid state application;e-enable Steel;2020-12-30;Nevada +5;Sausages Unbranded Fiji;withdrawal;moderator protocol;Gambia Central generate;Creative fault-tolerant innovate;Sports Gorgeous Rubber Sausages California;Unbranded Gambia unleash;Steel synergies;Credit Card Account;11615;26612;64204;connecting bypass Uganda Shilling;Decentralized Surinam Dollar;Auto Loan Account;2020-12-30;parallelism Small Concrete Table +6;Soft Croatia Cheese;Movies Licensed Cotton Keyboard;Handmade Steel Bacon Crescent;Rustic;Niger;protocol Group;Sleek invoice;Configurable Baby;Factors withdrawal;18541;14656;37568;Cross-platform Data Fantastic Steel Sausages;mobile Central e-markets;contextually-based Dynamic;2020-12-30;Berkshire +7;Sports encompassing;Officer Pants Jewelery;Dynamic;withdrawal orchid repurpose;Metrics;Bacon modular web services;haptic Metal Jewelery;Uzbekistan Sum Assistant Comoro Franc;Soft red payment;22404;38045;6949;Avon;Sleek Soft Chips;Dynamic;2020-12-30;protocol Metal +8;interface card Intelligent;Outdoors Handmade Rubber Sausages;models Agent;withdrawal Adaptive Frozen;Cedi;deposit connect;Azerbaijanian Manat harness;Turnpike;Progressive Costa Rican Colon;24911;63731;2476;copy Oklahoma;grey Rand Namibia Dollar indexing;black Bedfordshire invoice;2020-12-30;Phased 24/7 +9;Shirt solid state Central;HTTP Orchestrator Rhode Island;Ergonomic Fresh Car Illinois New Hampshire;rich;Shoals Plastic Internal;uniform;dynamic;optical;protocol Investor;8193;75891;68896;Berkshire drive Islands;Nevada Baby Books;CFP Franc Automotive;2020-12-31;Cambridgeshire Personal Loan Account Games +10;solutions;North Carolina bandwidth;JBOD maximize Vanuatu;Fort Sleek copying;Credit Card Account neural;Strategist haptic;drive Center;Personal Loan Account copying;engage Computers;19421;87579;15990;Plastic Assurance invoice;global Home Loan Account;wireless Cheese;2020-12-30;back-end withdrawal Checking Account diff --git a/src/main/resources/config/liquibase/fake-data/employee.csv b/src/main/resources/config/liquibase/fake-data/employee.csv new file mode 100644 index 0000000..745851e --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/employee.csv @@ -0,0 +1,11 @@ +id;employee_id;unit_id;first_name;last_name;email_address;login +1;calculate Investment Account;Soft Investment Account port;Lora;Hessel;Realigned;Tuna Granite +2;leading-edge;withdrawal;Kevon;Botsford;silver bypassing Home;bandwidth-monitored Sleek +3;monitor payment Switchable;dot-com;Jenifer;Krajcik;indigo orchestrate;Global +4;Germany National Albania;Singapore;Unique;MacGyver;Berkshire;Plastic +5;Concrete;Codes specifically reserved for testing purposes lime;Madaline;Lesch;frictionless Factors;deposit Decentralized Home Loan Account +6;Fish ROI Sausages;Designer payment;Jadyn;Dicki;infrastructures 24 hour Sleek;Cambridgeshire Illinois +7;Small Concrete Chicken;Won Bacon invoice;Cedrick;Erdman;Table;auxiliary microchip Concrete +8;1080p;Bedfordshire;Hipolito;Russel;Kids Checking Account;National +9;Pants;withdrawal;Christop;Abernathy;Rustic Personal Loan Account;Ball Investor +10;Soft Crest Practical Wooden Towels;monetize Pataca;Kadin;Fadel;Group De-engineered;communities incentivize payment diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml index 6b937fe..73115e3 100644 --- a/src/main/resources/config/liquibase/master.xml +++ b/src/main/resources/config/liquibase/master.xml @@ -14,7 +14,10 @@ + + + diff --git a/src/main/resources/i18n/messages_fr.properties b/src/main/resources/i18n/messages_fr.properties new file mode 100644 index 0000000..198d6ee --- /dev/null +++ b/src/main/resources/i18n/messages_fr.properties @@ -0,0 +1,21 @@ +# Error page +error.title=Votre demande ne peut être traitée +error.subtitle=Désolé, une erreur s'est produite. +error.status=Statut : +error.message=Message : + +# Activation email +email.activation.title=Activation de votre compte CCWApplication +email.activation.greeting=Cher {0} +email.activation.text1=Votre compte CCWApplication a été créé, pour l'activer merci de cliquer sur le lien ci-dessous : +email.activation.text2=Cordialement, +email.signature=CCWApplication. + +# Creation email +email.creation.text1=Votre compte CCWApplication a été créé, merci de cliquer sur le lien ci-dessous pour y accéder : + +# Reset email +email.reset.title=CCWApplication Réinitialisation de mot de passe +email.reset.greeting=Cher {0} +email.reset.text1=Un nouveau mot de passe pour votre compte CCWApplication a été demandé, veuillez cliquer sur le lien ci-dessous pour le réinitialiser : +email.reset.text2=Cordialement, diff --git a/src/main/webapp/app/core/language/language.constants.ts b/src/main/webapp/app/core/language/language.constants.ts index aa07208..0679ebb 100644 --- a/src/main/webapp/app/core/language/language.constants.ts +++ b/src/main/webapp/app/core/language/language.constants.ts @@ -4,5 +4,6 @@ */ export const LANGUAGES: string[] = [ 'en', + 'fr', // jhipster-needle-i18n-language-constant - JHipster will add/remove languages in this array ]; diff --git a/src/main/webapp/app/entities/collection-tracking/collection-tracking-delete-dialog.component.html b/src/main/webapp/app/entities/collection-tracking/collection-tracking-delete-dialog.component.html new file mode 100644 index 0000000..39860c5 --- /dev/null +++ b/src/main/webapp/app/entities/collection-tracking/collection-tracking-delete-dialog.component.html @@ -0,0 +1,24 @@ +
+ + + + + +
diff --git a/src/main/webapp/app/entities/collection-tracking/collection-tracking-delete-dialog.component.ts b/src/main/webapp/app/entities/collection-tracking/collection-tracking-delete-dialog.component.ts new file mode 100644 index 0000000..3c154f2 --- /dev/null +++ b/src/main/webapp/app/entities/collection-tracking/collection-tracking-delete-dialog.component.ts @@ -0,0 +1,30 @@ +import { Component } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { JhiEventManager } from 'ng-jhipster'; + +import { ICollectionTracking } from 'app/shared/model/collection-tracking.model'; +import { CollectionTrackingService } from './collection-tracking.service'; + +@Component({ + templateUrl: './collection-tracking-delete-dialog.component.html', +}) +export class CollectionTrackingDeleteDialogComponent { + collectionTracking?: ICollectionTracking; + + constructor( + protected collectionTrackingService: CollectionTrackingService, + public activeModal: NgbActiveModal, + protected eventManager: JhiEventManager + ) {} + + cancel(): void { + this.activeModal.dismiss(); + } + + confirmDelete(id: number): void { + this.collectionTrackingService.delete(id).subscribe(() => { + this.eventManager.broadcast('collectionTrackingListModification'); + this.activeModal.close(); + }); + } +} diff --git a/src/main/webapp/app/entities/collection-tracking/collection-tracking-detail.component.html b/src/main/webapp/app/entities/collection-tracking/collection-tracking-detail.component.html new file mode 100644 index 0000000..409af04 --- /dev/null +++ b/src/main/webapp/app/entities/collection-tracking/collection-tracking-detail.component.html @@ -0,0 +1,100 @@ +
+
+
+

Collection Tracking {{ collectionTracking.id }}

+ +
+ + + +
+
Employee ID
+
+ {{ collectionTracking.employeeID }} +
+
Unit ID
+
+ {{ collectionTracking.unitID }} +
+
Employee Name
+
+ {{ collectionTracking.employeeName }} +
+
Business Proposal
+
+ {{ collectionTracking.businessProposal }} +
+
Sub Proposal
+
+ {{ collectionTracking.subProposal }} +
+
Mobile No
+
+ {{ collectionTracking.mobileNo }} +
+
Relation Id
+
+ {{ collectionTracking.relationId }} +
+
Account No
+
+ {{ collectionTracking.accountNo }} +
+
Account Title
+
+ {{ collectionTracking.accountTitle }} +
+
No Of Visits
+
+ {{ collectionTracking.noOfVisits }} +
+
Os Amount
+
+ {{ collectionTracking.osAmount }} +
+
Os Profit
+
+ {{ collectionTracking.osProfit }} +
+
Od Days
+
+ {{ collectionTracking.odDays }} +
+
Loan Officer
+
+ {{ collectionTracking.loanOfficer }} +
+
Visited By
+
+ {{ collectionTracking.visitedBy }} +
+
Ppt Date
+
+ {{ collectionTracking.pptDate }} +
+
Remakrs
+
+ {{ collectionTracking.remakrs }} +
+
Employee
+
+ +
+
+ + + + +
+
+
diff --git a/src/main/webapp/app/entities/collection-tracking/collection-tracking-detail.component.ts b/src/main/webapp/app/entities/collection-tracking/collection-tracking-detail.component.ts new file mode 100644 index 0000000..acc253b --- /dev/null +++ b/src/main/webapp/app/entities/collection-tracking/collection-tracking-detail.component.ts @@ -0,0 +1,22 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { ICollectionTracking } from 'app/shared/model/collection-tracking.model'; + +@Component({ + selector: 'jhi-collection-tracking-detail', + templateUrl: './collection-tracking-detail.component.html', +}) +export class CollectionTrackingDetailComponent implements OnInit { + collectionTracking: ICollectionTracking | null = null; + + constructor(protected activatedRoute: ActivatedRoute) {} + + ngOnInit(): void { + this.activatedRoute.data.subscribe(({ collectionTracking }) => (this.collectionTracking = collectionTracking)); + } + + previousState(): void { + window.history.back(); + } +} diff --git a/src/main/webapp/app/entities/collection-tracking/collection-tracking-update.component.html b/src/main/webapp/app/entities/collection-tracking/collection-tracking-update.component.html new file mode 100644 index 0000000..3831033 --- /dev/null +++ b/src/main/webapp/app/entities/collection-tracking/collection-tracking-update.component.html @@ -0,0 +1,254 @@ +
+
+
+

Create or edit a Collection Tracking

+ +
+ + +
+ + +
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + + + This field should be a number. + +
+
+ +
+ + +
+ + This field is required. + + + This field should be a number. + +
+
+ +
+ + +
+ + This field is required. + + + This field should be a number. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ +
+ + + + +
+
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+
+ +
+ + + +
+
+
+
diff --git a/src/main/webapp/app/entities/collection-tracking/collection-tracking-update.component.ts b/src/main/webapp/app/entities/collection-tracking/collection-tracking-update.component.ts new file mode 100644 index 0000000..2c7387a --- /dev/null +++ b/src/main/webapp/app/entities/collection-tracking/collection-tracking-update.component.ts @@ -0,0 +1,141 @@ +import { Component, OnInit } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { FormBuilder, Validators } from '@angular/forms'; +import { ActivatedRoute } from '@angular/router'; +import { Observable } from 'rxjs'; + +import { ICollectionTracking, CollectionTracking } from 'app/shared/model/collection-tracking.model'; +import { CollectionTrackingService } from './collection-tracking.service'; +import { IEmployee } from 'app/shared/model/employee.model'; +import { EmployeeService } from 'app/entities/employee/employee.service'; + +@Component({ + selector: 'jhi-collection-tracking-update', + templateUrl: './collection-tracking-update.component.html', +}) +export class CollectionTrackingUpdateComponent implements OnInit { + isSaving = false; + employees: IEmployee[] = []; + pptDateDp: any; + + editForm = this.fb.group({ + id: [], + employeeID: [null, [Validators.required]], + unitID: [null, [Validators.required]], + employeeName: [null, [Validators.required]], + businessProposal: [null, [Validators.required]], + subProposal: [null, [Validators.required]], + mobileNo: [null, [Validators.required]], + relationId: [null, [Validators.required]], + accountNo: [null, [Validators.required]], + accountTitle: [null, [Validators.required]], + noOfVisits: [null, [Validators.required]], + osAmount: [null, [Validators.required]], + osProfit: [null, [Validators.required]], + odDays: [null, [Validators.required]], + loanOfficer: [null, [Validators.required]], + visitedBy: [null, [Validators.required]], + pptDate: [null, [Validators.required]], + remakrs: [null, [Validators.required]], + employee: [], + }); + + constructor( + protected collectionTrackingService: CollectionTrackingService, + protected employeeService: EmployeeService, + protected activatedRoute: ActivatedRoute, + private fb: FormBuilder + ) {} + + ngOnInit(): void { + this.activatedRoute.data.subscribe(({ collectionTracking }) => { + this.updateForm(collectionTracking); + + this.employeeService.query().subscribe((res: HttpResponse) => (this.employees = res.body || [])); + }); + } + + updateForm(collectionTracking: ICollectionTracking): void { + this.editForm.patchValue({ + id: collectionTracking.id, + employeeID: collectionTracking.employeeID, + unitID: collectionTracking.unitID, + employeeName: collectionTracking.employeeName, + businessProposal: collectionTracking.businessProposal, + subProposal: collectionTracking.subProposal, + mobileNo: collectionTracking.mobileNo, + relationId: collectionTracking.relationId, + accountNo: collectionTracking.accountNo, + accountTitle: collectionTracking.accountTitle, + noOfVisits: collectionTracking.noOfVisits, + osAmount: collectionTracking.osAmount, + osProfit: collectionTracking.osProfit, + odDays: collectionTracking.odDays, + loanOfficer: collectionTracking.loanOfficer, + visitedBy: collectionTracking.visitedBy, + pptDate: collectionTracking.pptDate, + remakrs: collectionTracking.remakrs, + employee: collectionTracking.employee, + }); + } + + previousState(): void { + window.history.back(); + } + + save(): void { + this.isSaving = true; + const collectionTracking = this.createFromForm(); + if (collectionTracking.id !== undefined) { + this.subscribeToSaveResponse(this.collectionTrackingService.update(collectionTracking)); + } else { + this.subscribeToSaveResponse(this.collectionTrackingService.create(collectionTracking)); + } + } + + private createFromForm(): ICollectionTracking { + return { + ...new CollectionTracking(), + id: this.editForm.get(['id'])!.value, + employeeID: this.editForm.get(['employeeID'])!.value, + unitID: this.editForm.get(['unitID'])!.value, + employeeName: this.editForm.get(['employeeName'])!.value, + businessProposal: this.editForm.get(['businessProposal'])!.value, + subProposal: this.editForm.get(['subProposal'])!.value, + mobileNo: this.editForm.get(['mobileNo'])!.value, + relationId: this.editForm.get(['relationId'])!.value, + accountNo: this.editForm.get(['accountNo'])!.value, + accountTitle: this.editForm.get(['accountTitle'])!.value, + noOfVisits: this.editForm.get(['noOfVisits'])!.value, + osAmount: this.editForm.get(['osAmount'])!.value, + osProfit: this.editForm.get(['osProfit'])!.value, + odDays: this.editForm.get(['odDays'])!.value, + loanOfficer: this.editForm.get(['loanOfficer'])!.value, + visitedBy: this.editForm.get(['visitedBy'])!.value, + pptDate: this.editForm.get(['pptDate'])!.value, + remakrs: this.editForm.get(['remakrs'])!.value, + employee: this.editForm.get(['employee'])!.value, + }; + } + + protected subscribeToSaveResponse(result: Observable>): void { + result.subscribe( + () => this.onSaveSuccess(), + () => this.onSaveError() + ); + } + + protected onSaveSuccess(): void { + this.isSaving = false; + this.previousState(); + } + + protected onSaveError(): void { + this.isSaving = false; + } + + trackById(index: number, item: IEmployee): any { + return item.id; + } +} diff --git a/src/main/webapp/app/entities/collection-tracking/collection-tracking.component.html b/src/main/webapp/app/entities/collection-tracking/collection-tracking.component.html new file mode 100644 index 0000000..97d0e38 --- /dev/null +++ b/src/main/webapp/app/entities/collection-tracking/collection-tracking.component.html @@ -0,0 +1,99 @@ +
+

+ Collection Trackings + + +

+ + + + + +
+ No collectionTrackings found +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDEmployee IDUnit IDEmployee NameBusiness ProposalSub ProposalMobile NoRelation IdAccount NoAccount TitleNo Of VisitsOs AmountOs ProfitOd DaysLoan OfficerVisited ByPpt DateRemakrsEmployee
{{ collectionTracking.id }}{{ collectionTracking.employeeID }}{{ collectionTracking.unitID }}{{ collectionTracking.employeeName }}{{ collectionTracking.businessProposal }}{{ collectionTracking.subProposal }}{{ collectionTracking.mobileNo }}{{ collectionTracking.relationId }}{{ collectionTracking.accountNo }}{{ collectionTracking.accountTitle }}{{ collectionTracking.noOfVisits }}{{ collectionTracking.osAmount }}{{ collectionTracking.osProfit }}{{ collectionTracking.odDays }}{{ collectionTracking.loanOfficer }}{{ collectionTracking.visitedBy }}{{ collectionTracking.pptDate | date:'mediumDate' }}{{ collectionTracking.remakrs }} + + +
+ + + + + +
+
+
+
diff --git a/src/main/webapp/app/entities/collection-tracking/collection-tracking.component.ts b/src/main/webapp/app/entities/collection-tracking/collection-tracking.component.ts new file mode 100644 index 0000000..a8bb0fd --- /dev/null +++ b/src/main/webapp/app/entities/collection-tracking/collection-tracking.component.ts @@ -0,0 +1,55 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +import { Subscription } from 'rxjs'; +import { JhiEventManager } from 'ng-jhipster'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; + +import { ICollectionTracking } from 'app/shared/model/collection-tracking.model'; +import { CollectionTrackingService } from './collection-tracking.service'; +import { CollectionTrackingDeleteDialogComponent } from './collection-tracking-delete-dialog.component'; + +@Component({ + selector: 'jhi-collection-tracking', + templateUrl: './collection-tracking.component.html', +}) +export class CollectionTrackingComponent implements OnInit, OnDestroy { + collectionTrackings?: ICollectionTracking[]; + eventSubscriber?: Subscription; + + constructor( + protected collectionTrackingService: CollectionTrackingService, + protected eventManager: JhiEventManager, + protected modalService: NgbModal + ) {} + + loadAll(): void { + this.collectionTrackingService + .query() + .subscribe((res: HttpResponse) => (this.collectionTrackings = res.body || [])); + } + + ngOnInit(): void { + this.loadAll(); + this.registerChangeInCollectionTrackings(); + } + + ngOnDestroy(): void { + if (this.eventSubscriber) { + this.eventManager.destroy(this.eventSubscriber); + } + } + + trackId(index: number, item: ICollectionTracking): number { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + return item.id!; + } + + registerChangeInCollectionTrackings(): void { + this.eventSubscriber = this.eventManager.subscribe('collectionTrackingListModification', () => this.loadAll()); + } + + delete(collectionTracking: ICollectionTracking): void { + const modalRef = this.modalService.open(CollectionTrackingDeleteDialogComponent, { size: 'lg', backdrop: 'static' }); + modalRef.componentInstance.collectionTracking = collectionTracking; + } +} diff --git a/src/main/webapp/app/entities/collection-tracking/collection-tracking.module.ts b/src/main/webapp/app/entities/collection-tracking/collection-tracking.module.ts new file mode 100644 index 0000000..f1fdd2b --- /dev/null +++ b/src/main/webapp/app/entities/collection-tracking/collection-tracking.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { CcwApplicationSharedModule } from 'app/shared/shared.module'; +import { CollectionTrackingComponent } from './collection-tracking.component'; +import { CollectionTrackingDetailComponent } from './collection-tracking-detail.component'; +import { CollectionTrackingUpdateComponent } from './collection-tracking-update.component'; +import { CollectionTrackingDeleteDialogComponent } from './collection-tracking-delete-dialog.component'; +import { collectionTrackingRoute } from './collection-tracking.route'; + +@NgModule({ + imports: [CcwApplicationSharedModule, RouterModule.forChild(collectionTrackingRoute)], + declarations: [ + CollectionTrackingComponent, + CollectionTrackingDetailComponent, + CollectionTrackingUpdateComponent, + CollectionTrackingDeleteDialogComponent, + ], + entryComponents: [CollectionTrackingDeleteDialogComponent], +}) +export class CcwApplicationCollectionTrackingModule {} diff --git a/src/main/webapp/app/entities/collection-tracking/collection-tracking.route.ts b/src/main/webapp/app/entities/collection-tracking/collection-tracking.route.ts new file mode 100644 index 0000000..460a959 --- /dev/null +++ b/src/main/webapp/app/entities/collection-tracking/collection-tracking.route.ts @@ -0,0 +1,83 @@ +import { Injectable } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +import { Resolve, ActivatedRouteSnapshot, Routes, Router } from '@angular/router'; +import { Observable, of, EMPTY } from 'rxjs'; +import { flatMap } from 'rxjs/operators'; + +import { Authority } from 'app/shared/constants/authority.constants'; +import { UserRouteAccessService } from 'app/core/auth/user-route-access-service'; +import { ICollectionTracking, CollectionTracking } from 'app/shared/model/collection-tracking.model'; +import { CollectionTrackingService } from './collection-tracking.service'; +import { CollectionTrackingComponent } from './collection-tracking.component'; +import { CollectionTrackingDetailComponent } from './collection-tracking-detail.component'; +import { CollectionTrackingUpdateComponent } from './collection-tracking-update.component'; + +@Injectable({ providedIn: 'root' }) +export class CollectionTrackingResolve implements Resolve { + constructor(private service: CollectionTrackingService, private router: Router) {} + + resolve(route: ActivatedRouteSnapshot): Observable | Observable { + const id = route.params['id']; + if (id) { + return this.service.find(id).pipe( + flatMap((collectionTracking: HttpResponse) => { + if (collectionTracking.body) { + return of(collectionTracking.body); + } else { + this.router.navigate(['404']); + return EMPTY; + } + }) + ); + } + return of(new CollectionTracking()); + } +} + +export const collectionTrackingRoute: Routes = [ + { + path: '', + component: CollectionTrackingComponent, + data: { + authorities: [Authority.USER], + pageTitle: 'ccwApplicationApp.collectionTracking.home.title', + }, + canActivate: [UserRouteAccessService], + }, + { + path: ':id/view', + component: CollectionTrackingDetailComponent, + resolve: { + collectionTracking: CollectionTrackingResolve, + }, + data: { + authorities: [Authority.USER], + pageTitle: 'ccwApplicationApp.collectionTracking.home.title', + }, + canActivate: [UserRouteAccessService], + }, + { + path: 'new', + component: CollectionTrackingUpdateComponent, + resolve: { + collectionTracking: CollectionTrackingResolve, + }, + data: { + authorities: [Authority.USER], + pageTitle: 'ccwApplicationApp.collectionTracking.home.title', + }, + canActivate: [UserRouteAccessService], + }, + { + path: ':id/edit', + component: CollectionTrackingUpdateComponent, + resolve: { + collectionTracking: CollectionTrackingResolve, + }, + data: { + authorities: [Authority.USER], + pageTitle: 'ccwApplicationApp.collectionTracking.home.title', + }, + canActivate: [UserRouteAccessService], + }, +]; diff --git a/src/main/webapp/app/entities/collection-tracking/collection-tracking.service.ts b/src/main/webapp/app/entities/collection-tracking/collection-tracking.service.ts new file mode 100644 index 0000000..1e40bf3 --- /dev/null +++ b/src/main/webapp/app/entities/collection-tracking/collection-tracking.service.ts @@ -0,0 +1,75 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import * as moment from 'moment'; + +import { DATE_FORMAT } from 'app/shared/constants/input.constants'; +import { SERVER_API_URL } from 'app/app.constants'; +import { createRequestOption } from 'app/shared/util/request-util'; +import { ICollectionTracking } from 'app/shared/model/collection-tracking.model'; + +type EntityResponseType = HttpResponse; +type EntityArrayResponseType = HttpResponse; + +@Injectable({ providedIn: 'root' }) +export class CollectionTrackingService { + public resourceUrl = SERVER_API_URL + 'api/collection-trackings'; + + constructor(protected http: HttpClient) {} + + create(collectionTracking: ICollectionTracking): Observable { + const copy = this.convertDateFromClient(collectionTracking); + return this.http + .post(this.resourceUrl, copy, { observe: 'response' }) + .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res))); + } + + update(collectionTracking: ICollectionTracking): Observable { + const copy = this.convertDateFromClient(collectionTracking); + return this.http + .put(this.resourceUrl, copy, { observe: 'response' }) + .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res))); + } + + find(id: number): Observable { + return this.http + .get(`${this.resourceUrl}/${id}`, { observe: 'response' }) + .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res))); + } + + query(req?: any): Observable { + const options = createRequestOption(req); + return this.http + .get(this.resourceUrl, { params: options, observe: 'response' }) + .pipe(map((res: EntityArrayResponseType) => this.convertDateArrayFromServer(res))); + } + + delete(id: number): Observable> { + return this.http.delete(`${this.resourceUrl}/${id}`, { observe: 'response' }); + } + + protected convertDateFromClient(collectionTracking: ICollectionTracking): ICollectionTracking { + const copy: ICollectionTracking = Object.assign({}, collectionTracking, { + pptDate: + collectionTracking.pptDate && collectionTracking.pptDate.isValid() ? collectionTracking.pptDate.format(DATE_FORMAT) : undefined, + }); + return copy; + } + + protected convertDateFromServer(res: EntityResponseType): EntityResponseType { + if (res.body) { + res.body.pptDate = res.body.pptDate ? moment(res.body.pptDate) : undefined; + } + return res; + } + + protected convertDateArrayFromServer(res: EntityArrayResponseType): EntityArrayResponseType { + if (res.body) { + res.body.forEach((collectionTracking: ICollectionTracking) => { + collectionTracking.pptDate = collectionTracking.pptDate ? moment(collectionTracking.pptDate) : undefined; + }); + } + return res; + } +} diff --git a/src/main/webapp/app/entities/employee/employee-delete-dialog.component.html b/src/main/webapp/app/entities/employee/employee-delete-dialog.component.html new file mode 100644 index 0000000..eeb8831 --- /dev/null +++ b/src/main/webapp/app/entities/employee/employee-delete-dialog.component.html @@ -0,0 +1,24 @@ +
+ + + + + +
diff --git a/src/main/webapp/app/entities/employee/employee-delete-dialog.component.ts b/src/main/webapp/app/entities/employee/employee-delete-dialog.component.ts new file mode 100644 index 0000000..32e3bdb --- /dev/null +++ b/src/main/webapp/app/entities/employee/employee-delete-dialog.component.ts @@ -0,0 +1,26 @@ +import { Component } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { JhiEventManager } from 'ng-jhipster'; + +import { IEmployee } from 'app/shared/model/employee.model'; +import { EmployeeService } from './employee.service'; + +@Component({ + templateUrl: './employee-delete-dialog.component.html', +}) +export class EmployeeDeleteDialogComponent { + employee?: IEmployee; + + constructor(protected employeeService: EmployeeService, public activeModal: NgbActiveModal, protected eventManager: JhiEventManager) {} + + cancel(): void { + this.activeModal.dismiss(); + } + + confirmDelete(id: number): void { + this.employeeService.delete(id).subscribe(() => { + this.eventManager.broadcast('employeeListModification'); + this.activeModal.close(); + }); + } +} diff --git a/src/main/webapp/app/entities/employee/employee-detail.component.html b/src/main/webapp/app/entities/employee/employee-detail.component.html new file mode 100644 index 0000000..753f9b9 --- /dev/null +++ b/src/main/webapp/app/entities/employee/employee-detail.component.html @@ -0,0 +1,50 @@ +
+
+
+

Employee {{ employee.id }}

+ +
+ + + +
+
Employee ID
+
+ {{ employee.employeeID }} +
+
Unit ID
+
+ {{ employee.unitID }} +
+
First Name
+
+ {{ employee.firstName }} +
+
Last Name
+
+ {{ employee.lastName }} +
+
Email Address
+
+ {{ employee.emailAddress }} +
+
Login
+
+ {{ employee.login }} +
+
+ + + + +
+
+
diff --git a/src/main/webapp/app/entities/employee/employee-detail.component.ts b/src/main/webapp/app/entities/employee/employee-detail.component.ts new file mode 100644 index 0000000..a5756f6 --- /dev/null +++ b/src/main/webapp/app/entities/employee/employee-detail.component.ts @@ -0,0 +1,22 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { IEmployee } from 'app/shared/model/employee.model'; + +@Component({ + selector: 'jhi-employee-detail', + templateUrl: './employee-detail.component.html', +}) +export class EmployeeDetailComponent implements OnInit { + employee: IEmployee | null = null; + + constructor(protected activatedRoute: ActivatedRoute) {} + + ngOnInit(): void { + this.activatedRoute.data.subscribe(({ employee }) => (this.employee = employee)); + } + + previousState(): void { + window.history.back(); + } +} diff --git a/src/main/webapp/app/entities/employee/employee-update.component.html b/src/main/webapp/app/entities/employee/employee-update.component.html new file mode 100644 index 0000000..bb64ac1 --- /dev/null +++ b/src/main/webapp/app/entities/employee/employee-update.component.html @@ -0,0 +1,92 @@ +
+
+
+

Create or edit a Employee

+ +
+ + +
+ + +
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+ + This field is required. + +
+
+ +
+ + +
+
+ +
+ + + +
+
+
+
diff --git a/src/main/webapp/app/entities/employee/employee-update.component.ts b/src/main/webapp/app/entities/employee/employee-update.component.ts new file mode 100644 index 0000000..ad7a615 --- /dev/null +++ b/src/main/webapp/app/entities/employee/employee-update.component.ts @@ -0,0 +1,90 @@ +import { Component, OnInit } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { FormBuilder, Validators } from '@angular/forms'; +import { ActivatedRoute } from '@angular/router'; +import { Observable } from 'rxjs'; + +import { IEmployee, Employee } from 'app/shared/model/employee.model'; +import { EmployeeService } from './employee.service'; + +@Component({ + selector: 'jhi-employee-update', + templateUrl: './employee-update.component.html', +}) +export class EmployeeUpdateComponent implements OnInit { + isSaving = false; + + editForm = this.fb.group({ + id: [], + employeeID: [null, [Validators.required]], + unitID: [null, [Validators.required]], + firstName: [null, [Validators.required]], + lastName: [null, [Validators.required]], + emailAddress: [null, [Validators.required]], + login: [], + }); + + constructor(protected employeeService: EmployeeService, protected activatedRoute: ActivatedRoute, private fb: FormBuilder) {} + + ngOnInit(): void { + this.activatedRoute.data.subscribe(({ employee }) => { + this.updateForm(employee); + }); + } + + updateForm(employee: IEmployee): void { + this.editForm.patchValue({ + id: employee.id, + employeeID: employee.employeeID, + unitID: employee.unitID, + firstName: employee.firstName, + lastName: employee.lastName, + emailAddress: employee.emailAddress, + login: employee.login, + }); + } + + previousState(): void { + window.history.back(); + } + + save(): void { + this.isSaving = true; + const employee = this.createFromForm(); + if (employee.id !== undefined) { + this.subscribeToSaveResponse(this.employeeService.update(employee)); + } else { + this.subscribeToSaveResponse(this.employeeService.create(employee)); + } + } + + private createFromForm(): IEmployee { + return { + ...new Employee(), + id: this.editForm.get(['id'])!.value, + employeeID: this.editForm.get(['employeeID'])!.value, + unitID: this.editForm.get(['unitID'])!.value, + firstName: this.editForm.get(['firstName'])!.value, + lastName: this.editForm.get(['lastName'])!.value, + emailAddress: this.editForm.get(['emailAddress'])!.value, + login: this.editForm.get(['login'])!.value, + }; + } + + protected subscribeToSaveResponse(result: Observable>): void { + result.subscribe( + () => this.onSaveSuccess(), + () => this.onSaveError() + ); + } + + protected onSaveSuccess(): void { + this.isSaving = false; + this.previousState(); + } + + protected onSaveError(): void { + this.isSaving = false; + } +} diff --git a/src/main/webapp/app/entities/employee/employee.component.html b/src/main/webapp/app/entities/employee/employee.component.html new file mode 100644 index 0000000..928b629 --- /dev/null +++ b/src/main/webapp/app/entities/employee/employee.component.html @@ -0,0 +1,71 @@ +
+

+ Employees + + +

+ + + + + +
+ No employees found +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
IDEmployee IDUnit IDFirst NameLast NameEmail AddressLogin
{{ employee.id }}{{ employee.employeeID }}{{ employee.unitID }}{{ employee.firstName }}{{ employee.lastName }}{{ employee.emailAddress }}{{ employee.login }} +
+ + + + + +
+
+
+
diff --git a/src/main/webapp/app/entities/employee/employee.component.ts b/src/main/webapp/app/entities/employee/employee.component.ts new file mode 100644 index 0000000..ed92bc8 --- /dev/null +++ b/src/main/webapp/app/entities/employee/employee.component.ts @@ -0,0 +1,49 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +import { Subscription } from 'rxjs'; +import { JhiEventManager } from 'ng-jhipster'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; + +import { IEmployee } from 'app/shared/model/employee.model'; +import { EmployeeService } from './employee.service'; +import { EmployeeDeleteDialogComponent } from './employee-delete-dialog.component'; + +@Component({ + selector: 'jhi-employee', + templateUrl: './employee.component.html', +}) +export class EmployeeComponent implements OnInit, OnDestroy { + employees?: IEmployee[]; + eventSubscriber?: Subscription; + + constructor(protected employeeService: EmployeeService, protected eventManager: JhiEventManager, protected modalService: NgbModal) {} + + loadAll(): void { + this.employeeService.query().subscribe((res: HttpResponse) => (this.employees = res.body || [])); + } + + ngOnInit(): void { + this.loadAll(); + this.registerChangeInEmployees(); + } + + ngOnDestroy(): void { + if (this.eventSubscriber) { + this.eventManager.destroy(this.eventSubscriber); + } + } + + trackId(index: number, item: IEmployee): number { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + return item.id!; + } + + registerChangeInEmployees(): void { + this.eventSubscriber = this.eventManager.subscribe('employeeListModification', () => this.loadAll()); + } + + delete(employee: IEmployee): void { + const modalRef = this.modalService.open(EmployeeDeleteDialogComponent, { size: 'lg', backdrop: 'static' }); + modalRef.componentInstance.employee = employee; + } +} diff --git a/src/main/webapp/app/entities/employee/employee.module.ts b/src/main/webapp/app/entities/employee/employee.module.ts new file mode 100644 index 0000000..39065f9 --- /dev/null +++ b/src/main/webapp/app/entities/employee/employee.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { CcwApplicationSharedModule } from 'app/shared/shared.module'; +import { EmployeeComponent } from './employee.component'; +import { EmployeeDetailComponent } from './employee-detail.component'; +import { EmployeeUpdateComponent } from './employee-update.component'; +import { EmployeeDeleteDialogComponent } from './employee-delete-dialog.component'; +import { employeeRoute } from './employee.route'; + +@NgModule({ + imports: [CcwApplicationSharedModule, RouterModule.forChild(employeeRoute)], + declarations: [EmployeeComponent, EmployeeDetailComponent, EmployeeUpdateComponent, EmployeeDeleteDialogComponent], + entryComponents: [EmployeeDeleteDialogComponent], +}) +export class CcwApplicationEmployeeModule {} diff --git a/src/main/webapp/app/entities/employee/employee.route.ts b/src/main/webapp/app/entities/employee/employee.route.ts new file mode 100644 index 0000000..5c27f42 --- /dev/null +++ b/src/main/webapp/app/entities/employee/employee.route.ts @@ -0,0 +1,83 @@ +import { Injectable } from '@angular/core'; +import { HttpResponse } from '@angular/common/http'; +import { Resolve, ActivatedRouteSnapshot, Routes, Router } from '@angular/router'; +import { Observable, of, EMPTY } from 'rxjs'; +import { flatMap } from 'rxjs/operators'; + +import { Authority } from 'app/shared/constants/authority.constants'; +import { UserRouteAccessService } from 'app/core/auth/user-route-access-service'; +import { IEmployee, Employee } from 'app/shared/model/employee.model'; +import { EmployeeService } from './employee.service'; +import { EmployeeComponent } from './employee.component'; +import { EmployeeDetailComponent } from './employee-detail.component'; +import { EmployeeUpdateComponent } from './employee-update.component'; + +@Injectable({ providedIn: 'root' }) +export class EmployeeResolve implements Resolve { + constructor(private service: EmployeeService, private router: Router) {} + + resolve(route: ActivatedRouteSnapshot): Observable | Observable { + const id = route.params['id']; + if (id) { + return this.service.find(id).pipe( + flatMap((employee: HttpResponse) => { + if (employee.body) { + return of(employee.body); + } else { + this.router.navigate(['404']); + return EMPTY; + } + }) + ); + } + return of(new Employee()); + } +} + +export const employeeRoute: Routes = [ + { + path: '', + component: EmployeeComponent, + data: { + authorities: [Authority.USER], + pageTitle: 'ccwApplicationApp.employee.home.title', + }, + canActivate: [UserRouteAccessService], + }, + { + path: ':id/view', + component: EmployeeDetailComponent, + resolve: { + employee: EmployeeResolve, + }, + data: { + authorities: [Authority.USER], + pageTitle: 'ccwApplicationApp.employee.home.title', + }, + canActivate: [UserRouteAccessService], + }, + { + path: 'new', + component: EmployeeUpdateComponent, + resolve: { + employee: EmployeeResolve, + }, + data: { + authorities: [Authority.USER], + pageTitle: 'ccwApplicationApp.employee.home.title', + }, + canActivate: [UserRouteAccessService], + }, + { + path: ':id/edit', + component: EmployeeUpdateComponent, + resolve: { + employee: EmployeeResolve, + }, + data: { + authorities: [Authority.USER], + pageTitle: 'ccwApplicationApp.employee.home.title', + }, + canActivate: [UserRouteAccessService], + }, +]; diff --git a/src/main/webapp/app/entities/employee/employee.service.ts b/src/main/webapp/app/entities/employee/employee.service.ts new file mode 100644 index 0000000..0b61838 --- /dev/null +++ b/src/main/webapp/app/entities/employee/employee.service.ts @@ -0,0 +1,38 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { SERVER_API_URL } from 'app/app.constants'; +import { createRequestOption } from 'app/shared/util/request-util'; +import { IEmployee } from 'app/shared/model/employee.model'; + +type EntityResponseType = HttpResponse; +type EntityArrayResponseType = HttpResponse; + +@Injectable({ providedIn: 'root' }) +export class EmployeeService { + public resourceUrl = SERVER_API_URL + 'api/employees'; + + constructor(protected http: HttpClient) {} + + create(employee: IEmployee): Observable { + return this.http.post(this.resourceUrl, employee, { observe: 'response' }); + } + + update(employee: IEmployee): Observable { + return this.http.put(this.resourceUrl, employee, { observe: 'response' }); + } + + find(id: number): Observable { + return this.http.get(`${this.resourceUrl}/${id}`, { observe: 'response' }); + } + + query(req?: any): Observable { + const options = createRequestOption(req); + return this.http.get(this.resourceUrl, { params: options, observe: 'response' }); + } + + delete(id: number): Observable> { + return this.http.delete(`${this.resourceUrl}/${id}`, { observe: 'response' }); + } +} diff --git a/src/main/webapp/app/entities/entity.module.ts b/src/main/webapp/app/entities/entity.module.ts index f0e97d3..8756fbd 100644 --- a/src/main/webapp/app/entities/entity.module.ts +++ b/src/main/webapp/app/entities/entity.module.ts @@ -4,6 +4,14 @@ import { RouterModule } from '@angular/router'; @NgModule({ imports: [ RouterModule.forChild([ + { + path: 'employee', + loadChildren: () => import('./employee/employee.module').then(m => m.CcwApplicationEmployeeModule), + }, + { + path: 'collection-tracking', + loadChildren: () => import('./collection-tracking/collection-tracking.module').then(m => m.CcwApplicationCollectionTrackingModule), + }, /* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */ ]), ], diff --git a/src/main/webapp/app/layouts/navbar/navbar.component.html b/src/main/webapp/app/layouts/navbar/navbar.component.html index b73d112..15ccd52 100644 --- a/src/main/webapp/app/layouts/navbar/navbar.component.html +++ b/src/main/webapp/app/layouts/navbar/navbar.component.html @@ -27,6 +27,18 @@ diff --git a/src/main/webapp/app/shared/language/find-language-from-key.pipe.ts b/src/main/webapp/app/shared/language/find-language-from-key.pipe.ts index d01a5d7..736809c 100644 --- a/src/main/webapp/app/shared/language/find-language-from-key.pipe.ts +++ b/src/main/webapp/app/shared/language/find-language-from-key.pipe.ts @@ -4,6 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'; export class FindLanguageFromKeyPipe implements PipeTransform { private languages: { [key: string]: { name: string; rtl?: boolean } } = { en: { name: 'English' }, + fr: { name: 'Français' }, // jhipster-needle-i18n-language-key-pipe - JHipster will add/remove languages in this object }; diff --git a/src/main/webapp/app/shared/model/collection-tracking.model.ts b/src/main/webapp/app/shared/model/collection-tracking.model.ts new file mode 100644 index 0000000..4f2b68c --- /dev/null +++ b/src/main/webapp/app/shared/model/collection-tracking.model.ts @@ -0,0 +1,48 @@ +import { Moment } from 'moment'; +import { IEmployee } from 'app/shared/model/employee.model'; + +export interface ICollectionTracking { + id?: number; + employeeID?: string; + unitID?: string; + employeeName?: string; + businessProposal?: string; + subProposal?: string; + mobileNo?: string; + relationId?: string; + accountNo?: string; + accountTitle?: string; + noOfVisits?: number; + osAmount?: number; + osProfit?: number; + odDays?: string; + loanOfficer?: string; + visitedBy?: string; + pptDate?: Moment; + remakrs?: string; + employee?: IEmployee; +} + +export class CollectionTracking implements ICollectionTracking { + constructor( + public id?: number, + public employeeID?: string, + public unitID?: string, + public employeeName?: string, + public businessProposal?: string, + public subProposal?: string, + public mobileNo?: string, + public relationId?: string, + public accountNo?: string, + public accountTitle?: string, + public noOfVisits?: number, + public osAmount?: number, + public osProfit?: number, + public odDays?: string, + public loanOfficer?: string, + public visitedBy?: string, + public pptDate?: Moment, + public remakrs?: string, + public employee?: IEmployee + ) {} +} diff --git a/src/main/webapp/app/shared/model/employee.model.ts b/src/main/webapp/app/shared/model/employee.model.ts new file mode 100644 index 0000000..d25ca05 --- /dev/null +++ b/src/main/webapp/app/shared/model/employee.model.ts @@ -0,0 +1,25 @@ +import { ICollectionTracking } from 'app/shared/model/collection-tracking.model'; + +export interface IEmployee { + id?: number; + employeeID?: string; + unitID?: string; + firstName?: string; + lastName?: string; + emailAddress?: string; + login?: string; + collectionTrackings?: ICollectionTracking[]; +} + +export class Employee implements IEmployee { + constructor( + public id?: number, + public employeeID?: string, + public unitID?: string, + public firstName?: string, + public lastName?: string, + public emailAddress?: string, + public login?: string, + public collectionTrackings?: ICollectionTracking[] + ) {} +} diff --git a/src/main/webapp/i18n/en/collectionTracking.json b/src/main/webapp/i18n/en/collectionTracking.json new file mode 100644 index 0000000..e074064 --- /dev/null +++ b/src/main/webapp/i18n/en/collectionTracking.json @@ -0,0 +1,39 @@ +{ + "ccwApplicationApp": { + "collectionTracking": { + "home": { + "title": "Collection Trackings", + "createLabel": "Create a new Collection Tracking", + "createOrEditLabel": "Create or edit a Collection Tracking", + "notFound": "No Collection Trackings found" + }, + "created": "A new Collection Tracking is created with identifier {{ param }}", + "updated": "A Collection Tracking is updated with identifier {{ param }}", + "deleted": "A Collection Tracking is deleted with identifier {{ param }}", + "delete": { + "question": "Are you sure you want to delete Collection Tracking {{ id }}?" + }, + "detail": { + "title": "Collection Tracking" + }, + "employeeID": "Employee ID", + "unitID": "Unit ID", + "employeeName": "Employee Name", + "businessProposal": "Business Proposal", + "subProposal": "Sub Proposal", + "mobileNo": "Mobile No", + "relationId": "Relation Id", + "accountNo": "Account No", + "accountTitle": "Account Title", + "noOfVisits": "No Of Visits", + "osAmount": "Os Amount", + "osProfit": "Os Profit", + "odDays": "Od Days", + "loanOfficer": "Loan Officer", + "visitedBy": "Visited By", + "pptDate": "Ppt Date", + "remakrs": "Remakrs", + "employee": "Employee" + } + } +} diff --git a/src/main/webapp/i18n/en/employee.json b/src/main/webapp/i18n/en/employee.json new file mode 100644 index 0000000..fb70c47 --- /dev/null +++ b/src/main/webapp/i18n/en/employee.json @@ -0,0 +1,28 @@ +{ + "ccwApplicationApp": { + "employee": { + "home": { + "title": "Employees", + "createLabel": "Create a new Employee", + "createOrEditLabel": "Create or edit a Employee", + "notFound": "No Employees found" + }, + "created": "A new Employee is created with identifier {{ param }}", + "updated": "A Employee is updated with identifier {{ param }}", + "deleted": "A Employee is deleted with identifier {{ param }}", + "delete": { + "question": "Are you sure you want to delete Employee {{ id }}?" + }, + "detail": { + "title": "Employee" + }, + "employeeID": "Employee ID", + "unitID": "Unit ID", + "firstName": "First Name", + "lastName": "Last Name", + "emailAddress": "Email Address", + "login": "Login", + "collectionTracking": "Collection Tracking" + } + } +} diff --git a/src/main/webapp/i18n/en/global.json b/src/main/webapp/i18n/en/global.json index 0515005..1e2483f 100644 --- a/src/main/webapp/i18n/en/global.json +++ b/src/main/webapp/i18n/en/global.json @@ -7,6 +7,8 @@ "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)", "entities": { "main": "Entities", + "employee": "Employee", + "collectionTracking": "Collection Tracking", "jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)" }, "account": { diff --git a/src/main/webapp/i18n/fr/activate.json b/src/main/webapp/i18n/fr/activate.json new file mode 100644 index 0000000..7b29d28 --- /dev/null +++ b/src/main/webapp/i18n/fr/activate.json @@ -0,0 +1,9 @@ +{ + "activate": { + "title": "Activation", + "messages": { + "success": "Votre compte utilisateur a été activé. Merci de vous ", + "error": "Votre compte utilisateur n'a pas pu être activé. Utilisez le formulaire d'enregistrement pour en créer un nouveau." + } + } +} diff --git a/src/main/webapp/i18n/fr/audits.json b/src/main/webapp/i18n/fr/audits.json new file mode 100644 index 0000000..d67422c --- /dev/null +++ b/src/main/webapp/i18n/fr/audits.json @@ -0,0 +1,28 @@ +{ + "audits": { + "title": "Audits", + "filter": { + "title": "Filtrer par date", + "from": "De", + "to": "à", + "button": { + "weeks": "Semaines", + "today": "Aujourd'hui", + "clear": "Effacer", + "close": "Fermer" + } + }, + "table": { + "header": { + "principal": "Utilisateur", + "date": "Date", + "status": "Status", + "data": "Autres données" + }, + "data": { + "remoteAddress": "Adresse Distante :" + } + }, + "notFound": "Aucun audit trouvé" + } +} diff --git a/src/main/webapp/i18n/fr/collectionTracking.json b/src/main/webapp/i18n/fr/collectionTracking.json new file mode 100644 index 0000000..6a7e535 --- /dev/null +++ b/src/main/webapp/i18n/fr/collectionTracking.json @@ -0,0 +1,39 @@ +{ + "ccwApplicationApp": { + "collectionTracking": { + "home": { + "title": "CollectionTrackings", + "createLabel": "Créer un nouveau Collection Tracking", + "createOrEditLabel": "Créer ou éditer un Collection Tracking", + "notFound": "Aucun Collection Tracking trouvé" + }, + "created": "Un nouveau Collection Tracking a été créé avec l'identifiant {{ param }}", + "updated": "Le Collection Tracking avec l'identifiant {{ param }} a été mis à jour", + "deleted": "Le Collection Tracking avec l'identifiant {{ param }} a été supprimé", + "delete": { + "question": "Etes-vous certain de vouloir supprimer le Collection Tracking {{ id }} ?" + }, + "detail": { + "title": "Collection Tracking" + }, + "employeeID": "Employee ID", + "unitID": "Unit ID", + "employeeName": "Employee Name", + "businessProposal": "Business Proposal", + "subProposal": "Sub Proposal", + "mobileNo": "Mobile No", + "relationId": "Relation Id", + "accountNo": "Account No", + "accountTitle": "Account Title", + "noOfVisits": "No Of Visits", + "osAmount": "Os Amount", + "osProfit": "Os Profit", + "odDays": "Od Days", + "loanOfficer": "Loan Officer", + "visitedBy": "Visited By", + "pptDate": "Ppt Date", + "remakrs": "Remakrs", + "employee": "Employee" + } + } +} diff --git a/src/main/webapp/i18n/fr/configuration.json b/src/main/webapp/i18n/fr/configuration.json new file mode 100644 index 0000000..a9a014a --- /dev/null +++ b/src/main/webapp/i18n/fr/configuration.json @@ -0,0 +1,10 @@ +{ + "configuration": { + "title": "Configuration", + "filter": "Filtrer (par préfixe)", + "table": { + "prefix": "Préfixe", + "properties": "Propriétés" + } + } +} diff --git a/src/main/webapp/i18n/fr/employee.json b/src/main/webapp/i18n/fr/employee.json new file mode 100644 index 0000000..c179e9d --- /dev/null +++ b/src/main/webapp/i18n/fr/employee.json @@ -0,0 +1,28 @@ +{ + "ccwApplicationApp": { + "employee": { + "home": { + "title": "Employees", + "createLabel": "Créer un nouveau Employee", + "createOrEditLabel": "Créer ou éditer un Employee", + "notFound": "Aucun Employee trouvé" + }, + "created": "Un nouveau Employee a été créé avec l'identifiant {{ param }}", + "updated": "Le Employee avec l'identifiant {{ param }} a été mis à jour", + "deleted": "Le Employee avec l'identifiant {{ param }} a été supprimé", + "delete": { + "question": "Etes-vous certain de vouloir supprimer le Employee {{ id }} ?" + }, + "detail": { + "title": "Employee" + }, + "employeeID": "Employee ID", + "unitID": "Unit ID", + "firstName": "First Name", + "lastName": "Last Name", + "emailAddress": "Email Address", + "login": "Login", + "collectionTracking": "Collection Tracking" + } + } +} diff --git a/src/main/webapp/i18n/fr/error.json b/src/main/webapp/i18n/fr/error.json new file mode 100644 index 0000000..71622e5 --- /dev/null +++ b/src/main/webapp/i18n/fr/error.json @@ -0,0 +1,14 @@ +{ + "error": { + "title": "Page d'erreur !", + "http": { + "400": "Mauvaise requête.", + "403": "Vous n'avez pas les droits pour accéder à cette page.", + "404": "La page n'existe pas.", + "405": "Le verbe HTTP que vous avez utilisé n'est pas reconnu par cet URL.", + "500": "Erreur interne du serveur." + }, + "concurrencyFailure": "Un autre utilisateur a modifié ces données en même temps que vous. Vos changements n'ont pas été sauvegardés.", + "validation": "Erreur de validation côté serveur." + } +} diff --git a/src/main/webapp/i18n/fr/global.json b/src/main/webapp/i18n/fr/global.json new file mode 100644 index 0000000..76346a9 --- /dev/null +++ b/src/main/webapp/i18n/fr/global.json @@ -0,0 +1,142 @@ +{ + "global": { + "title": "CCWApplication", + "browsehappy": "Vous utilisez un ancien navigateur. Veuillez mettre à jour votre navigateur pour une meilleure expérience.", + "menu": { + "home": "Accueil", + "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)", + "entities": { + "main": "Entités", + "employee": "Employee", + "collectionTracking": "Collection Tracking", + "jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)" + }, + "account": { + "main": "Compte", + "settings": "Profil", + "password": "Mot de passe", + "sessions": "Sessions", + "login": "S'authentifier", + "logout": "Déconnexion", + "register": "Créer un compte" + }, + "admin": { + "main": "Administration", + "userManagement": "Gestion des utilisateurs", + "tracker": "Suivi des utilisateurs", + "metrics": "Métriques", + "health": "Diagnostics", + "configuration": "Configuration", + "logs": "Logs", + "audits": "Audits", + "apidocs": "API", + "database": "Base de données", + "jhipster-needle-menu-add-admin-element": "JHipster will add additional menu entries here (do not translate!)" + }, + "language": "Langue" + }, + "form": { + "username.label": "Nom d'utilisateur", + "username.placeholder": "Votre nom d'utilisateur", + "currentpassword.label": "Mot de passe actuel", + "currentpassword.placeholder": "Mot de passe actuel", + "newpassword.label": "Nouveau mot de passe", + "newpassword.placeholder": "Nouveau mot de passe", + "confirmpassword.label": "Confirmation du nouveau mot de passe", + "confirmpassword.placeholder": "Confirmation du nouveau mot de passe", + "email.label": "Email", + "email.placeholder": "Votre email" + }, + "messages": { + "info": { + "authenticated": { + "prefix": "Si vous voulez vous ", + "link": "connecter", + "suffix": ", vous pouvez utiliser les comptes par défaut :
- Administrateur (nom d'utilisateur=\"admin\" et mot de passe =\"admin\")
- Utilisateur (nom d'utilisateur=\"user\" et mot de passe =\"user\")." + }, + "register": { + "noaccount": "Vous n'avez pas encore de compte ?", + "link": "Créer un compte" + } + }, + "error": { + "dontmatch": "Le nouveau mot de passe et sa confirmation ne sont pas égaux !" + }, + "validate": { + "newpassword": { + "required": "Votre mot de passe est requis.", + "minlength": "Votre mot de passe doit comporter au moins 4 caractères.", + "maxlength": "Votre mot de passe ne doit pas comporter plus de 50 caractères.", + "strength": "Robustesse du mot de passe :" + }, + "confirmpassword": { + "required": "Votre confirmation du mot de passe est requise.", + "minlength": "Votre confirmation du mot de passe doit comporter au moins 4 caractères.", + "maxlength": "Votre confirmation du mot de passe ne doit pas comporter plus de 50 caractères." + }, + "email": { + "required": "Votre email est requis.", + "minlength": "Votre email doit comporter au moins 5 caractères.", + "maxlength": "Votre email ne doit pas comporter plus de 50 caractères.", + "invalid": "Votre email n'est pas valide." + } + } + }, + "field": { + "id": "ID" + }, + "ribbon": { + "dev": "Développement" + }, + "item-count": "Affichage {{first}} - {{second}} de {{total}} items." + }, + "entity": { + "action": { + "addblob": "Ajouter blob", + "addimage": "Ajouter image", + "back": "Retour", + "cancel": "Annuler", + "edit": "Editer", + "delete": "Supprimer", + "open": "Ouvrir", + "save": "Sauvegarder", + "view": "Voir" + }, + "detail": { + "field": "Champs", + "value": "Valeur" + }, + "delete": { + "title": "Confirmation de suppression" + }, + "validation": { + "required": "Ce champ est obligatoire.", + "minlength": "Ce champ doit faire au minimum {{min}} caractères.", + "maxlength": "Ce champ doit faire moins de {{max}} caractères.", + "min": "Ce champ doit être supérieur à {{min}}.", + "max": "Ce champ doit être inférieur à {{max}}.", + "minbytes": "Ce champ doit être supérieur à {{min}} bytes.", + "maxbytes": "Ce champ doit être inférieur à {{max}} bytes.", + "pattern": "Ce champ doit suivre l'expression régulière {{pattern}}.", + "number": "Ce champ doit être un nombre.", + "datetimelocal": "Ce champ doit être une date et une heure.", + "patternLogin": "Ce champ ne peut contenir que des lettres, des chiffres ou des adresses e-mail." + } + }, + "error": { + "internalServerError": "Erreur interne du serveur", + "server.not.reachable": "Serveur inaccessible", + "url.not.found": "Non trouvé", + "NotNull": "Le champ {{fieldName}} ne peut pas être vide !", + "Size": "Le champ {{fieldName}} ne respecte pas les critères minimum et maximum !", + "userexists": "Login déjà utilisé !", + "emailexists": "Email déjà utilisé !", + "idexists": "Une nouvelle entité {{entityName}} ne peut pas avoir d'identifiant !", + "idnull": "Identifiant invalide", + "file": { + "could.not.extract": "Impossible d'extraire le fichier", + "not.image": "Le fichier doit être une image et non du type \"{{ fileType }}\"" + } + }, + "footer": "Ceci est votre pied de page" +} diff --git a/src/main/webapp/i18n/fr/health.json b/src/main/webapp/i18n/fr/health.json new file mode 100644 index 0000000..71c0822 --- /dev/null +++ b/src/main/webapp/i18n/fr/health.json @@ -0,0 +1,29 @@ +{ + "health": { + "title": "Diagnostics", + "refresh.button": "Rafraîchir", + "stacktrace": "Stacktrace", + "details": { + "details": "Détails", + "properties": "Propriétés", + "name": "Nom", + "value": "Valeur", + "error": "Erreur" + }, + "indicator": { + "diskSpace": "Espace disque", + "mail": "Email", + "ping": "Application", + "db": "Base de données" + }, + "table": { + "service": "Nom du service", + "status": "État" + }, + "status": { + "UNKNOWN": "INCONNU", + "UP": "DISPONIBLE", + "DOWN": "HORS SERVICE" + } + } +} diff --git a/src/main/webapp/i18n/fr/home.json b/src/main/webapp/i18n/fr/home.json new file mode 100644 index 0000000..44dc4b9 --- /dev/null +++ b/src/main/webapp/i18n/fr/home.json @@ -0,0 +1,19 @@ +{ + "home": { + "title": "Bienvenue, Java Hipster !", + "subtitle": "Ceci est votre page d'accueil", + "logged": { + "message": "Vous êtes connecté en tant que \"{{username}}\"." + }, + "question": "Si vous avez des questions à propos de JHipster :", + "link": { + "homepage": "Page d'accueil de JHipster", + "stackoverflow": "JHipster sur Stack Overflow", + "bugtracker": "JHipster bug tracker", + "chat": "JHipster public chat room", + "follow": "Suivez @jhipster sur Twitter" + }, + "like": "Si vous aimez JHipster, donnez nous une étoile sur", + "github": "GitHub " + } +} diff --git a/src/main/webapp/i18n/fr/login.json b/src/main/webapp/i18n/fr/login.json new file mode 100644 index 0000000..f5aa2af --- /dev/null +++ b/src/main/webapp/i18n/fr/login.json @@ -0,0 +1,19 @@ +{ + "login": { + "title": "Authentification", + "form": { + "password": "Mot de passe", + "password.placeholder": "Votre mot de passe", + "rememberme": "Garder la session ouverte", + "button": "Connexion" + }, + "messages": { + "error": { + "authentication": "Erreur d'authentification ! Veuillez vérifier vos identifiants de connexion." + } + }, + "password": { + "forgot": "Avez-vous oublié votre mot de passe ?" + } + } +} diff --git a/src/main/webapp/i18n/fr/logs.json b/src/main/webapp/i18n/fr/logs.json new file mode 100644 index 0000000..e0acb27 --- /dev/null +++ b/src/main/webapp/i18n/fr/logs.json @@ -0,0 +1,11 @@ +{ + "logs": { + "title": "Logs", + "nbloggers": "Total de {{ total }} \"loggers\".", + "filter": "Filtrer", + "table": { + "name": "Nom", + "level": "Niveau" + } + } +} diff --git a/src/main/webapp/i18n/fr/metrics.json b/src/main/webapp/i18n/fr/metrics.json new file mode 100644 index 0000000..cbd5c4a --- /dev/null +++ b/src/main/webapp/i18n/fr/metrics.json @@ -0,0 +1,102 @@ +{ + "metrics": { + "title": "Métriques de l'application", + "refresh.button": "Rafraîchir", + "updating": "Mise à jour...", + "jvm": { + "title": "Métriques de la JVM", + "memory": { + "title": "Mémoire", + "total": "Mémoire totale", + "heap": "Mémoire \"Heap\"", + "nonheap": "Mémoire \"Non-Heap\"" + }, + "threads": { + "title": "Threads", + "all": "Tous", + "runnable": "Exécutable", + "timedwaiting": "Temps d'attente", + "waiting": "En attente", + "blocked": "Bloqué", + "dump": { + "title": "Threads dump", + "id": "Id :", + "blockedtime": "Temps bloqué", + "blockedcount": "Nb fois bloqué", + "waitedtime": "Temps d'attente", + "waitedcount": "Nb fois en attente", + "lockname": "Nom du process bloquant", + "stacktrace": "Stacktrace", + "show": "Afficher", + "hide": "Cacher" + } + }, + "gc": { + "title": "Garbage collections", + "marksweepcount": "Total de \"Mark Sweep\"", + "marksweeptime": "Temps \"Mark Sweep\"", + "scavengecount": "Total \"Scavenge\"", + "scavengetime": "Temps \"Scavenge\"" + }, + "http": { + "title": "Requêtes HTTP (temps en millisecondes)", + "active": "Requêtes actives :", + "total": "Requêtes totales :", + "table": { + "code": "Code", + "count": "Total", + "mean": "Médian", + "average": "Moyenne", + "max": "Max" + }, + "code": { + "ok": "Ok", + "notfound": "Non trouvé", + "servererror": "Erreur serveur" + } + } + }, + "servicesstats": { + "title": "Statistiques des services (temps en millisecondes)", + "table": { + "name": "Nom du server", + "count": "Total", + "mean": "Médian", + "min": "Min", + "max": "Max", + "p50": "p50", + "p75": "p75", + "p95": "p95", + "p99": "p99" + } + }, + "cache": { + "title": "Statistiques de cache", + "cachename": "Nom du cache", + "hits": "Données existantes", + "misses": "Données non existantes", + "gets": "Lectures", + "puts": "Écritures", + "removals": "Suppressions", + "evictions": "Évictions", + "hitPercent": "% données existantes", + "missPercent": "% données non existantes", + "averageGetTime": "Temps de lecture moyen (µs)", + "averagePutTime": "Temps d'écriture moyen (µs)", + "averageRemoveTime": "Temps de suppression moyen (µs)" + }, + "datasource": { + "usage": "Usage du Pool de connexion", + "title": "Statistiques du pool de connexions (temps en millisecondes)", + "name": "Utilisation du pool", + "count": "Total", + "mean": "Médian", + "min": "Min", + "max": "Max", + "p50": "p50", + "p75": "p75", + "p95": "p95", + "p99": "p99" + } + } +} diff --git a/src/main/webapp/i18n/fr/password.json b/src/main/webapp/i18n/fr/password.json new file mode 100644 index 0000000..1c5856b --- /dev/null +++ b/src/main/webapp/i18n/fr/password.json @@ -0,0 +1,12 @@ +{ + "password": { + "title": "Changer le mot de passe pour [{{username}}]", + "form": { + "button": "Sauvegarder" + }, + "messages": { + "error": "Une erreur est survenue ! Le mot de passe n'a pas pu être modifié.", + "success": "Le mot de passe a été modifié !" + } + } +} diff --git a/src/main/webapp/i18n/fr/register.json b/src/main/webapp/i18n/fr/register.json new file mode 100644 index 0000000..08eb09d --- /dev/null +++ b/src/main/webapp/i18n/fr/register.json @@ -0,0 +1,24 @@ +{ + "register": { + "title": "Création de compte utilisateur", + "form": { + "button": "Enregistrement" + }, + "messages": { + "validate": { + "login": { + "required": "Votre nom d'utilisateur est obligatoire.", + "minlength": "Votre nom d'utilisateur doit contenir plus d'un caractère.", + "maxlength": "Votre nom d'utilisateur ne peut pas contenir plus de 50 caractères.", + "pattern": "Votre nom d'utilisateur est invalide." + } + }, + "success": "Compte enregistré ! Merci de vérifier votre email de confirmation.", + "error": { + "fail": "Compte non créé ! Merci d'essayer à nouveau plus tard.", + "userexists": "Ce compte utilisateur existe déjà ! Veuillez en choisir un autre.", + "emailexists": "Cet email est déjà utilisé ! Veuillez en choisir un autre." + } + } + } +} diff --git a/src/main/webapp/i18n/fr/reset.json b/src/main/webapp/i18n/fr/reset.json new file mode 100644 index 0000000..df7c18f --- /dev/null +++ b/src/main/webapp/i18n/fr/reset.json @@ -0,0 +1,26 @@ +{ + "reset": { + "request": { + "title": "Réinitialiser son mot de passe", + "form": { + "button": "Réinitialiser le mot de passe" + }, + "messages": { + "info": "Veuillez renseigner l'adresse email utilisée pour vous enregistrer", + "success": "Veuillez vérifier vos nouveaux emails et suivre les instructions pour réinitialiser votre mot de passe." + } + }, + "finish": { + "title": "Réinitialisation du mot de passe", + "form": { + "button": "Réinitialiser le mot de passe" + }, + "messages": { + "info": "Choisir un nouveau mot de passe", + "success": "Votre mot de passe a été réinitialisé. Merci de ", + "keymissing": "La clef de réinitilisation est manquante", + "error": "Votre mot de passe n'a pas pu être réinitialisé. La demande de réinitialisation n'est valable que 24 heures." + } + } + } +} diff --git a/src/main/webapp/i18n/fr/sessions.json b/src/main/webapp/i18n/fr/sessions.json new file mode 100644 index 0000000..1771ca4 --- /dev/null +++ b/src/main/webapp/i18n/fr/sessions.json @@ -0,0 +1,15 @@ +{ + "sessions": { + "title": "Sessions actives de [{{username}}]", + "table": { + "ipaddress": "Adresse IP", + "useragent": "User Agent", + "date": "Date", + "button": "Invalider" + }, + "messages": { + "success": "La session a été invalidée !", + "error": "Une erreur est survenue ! La session ne peut pas être invalidée." + } + } +} diff --git a/src/main/webapp/i18n/fr/settings.json b/src/main/webapp/i18n/fr/settings.json new file mode 100644 index 0000000..e9581dd --- /dev/null +++ b/src/main/webapp/i18n/fr/settings.json @@ -0,0 +1,32 @@ +{ + "settings": { + "title": "Profil de l'utilisateur [{{username}}]", + "form": { + "firstname": "Prénom", + "firstname.placeholder": "Votre prénom", + "lastname": "Nom", + "lastname.placeholder": "Votre nom", + "language": "Langue", + "button": "Sauvegarder" + }, + "messages": { + "error": { + "fail": "Une erreur est survenue ! Votre profil n'a pas été sauvegardé.", + "emailexists": "Cet email est déjà utilisé ! Veuillez en choisir un autre." + }, + "success": "Votre profil a été sauvegardé !", + "validate": { + "firstname": { + "required": "Votre prénom est requis.", + "minlength": "Votre prénom doit comporter au moins un caractère.", + "maxlength": "Votre prénom ne doit pas comporter plus de 50 caractères." + }, + "lastname": { + "required": "Votre nom est requis.", + "minlength": "Votre nom doit comporter au moins un caractère.", + "maxlength": "Votre nom ne doit pas comporter plus de 50 caractères." + } + } + } + } +} diff --git a/src/main/webapp/i18n/fr/user-management.json b/src/main/webapp/i18n/fr/user-management.json new file mode 100644 index 0000000..93b6b1c --- /dev/null +++ b/src/main/webapp/i18n/fr/user-management.json @@ -0,0 +1,30 @@ +{ + "userManagement": { + "home": { + "title": "Utilisateurs", + "createLabel": "Créer un nouvel utilisateur", + "createOrEditLabel": "Créer ou éditer un utilisateur" + }, + "created": "L'utilisateur {{ param }} a été créé.", + "updated": "L'utilisateur {{ param }} a été mis à jour.", + "deleted": "L'utilisateur {{ param }} a été supprimé.", + "delete": { + "question": "Etes-vous certain de vouloir supprimer l'utilisateur {{ login }} ?" + }, + "detail": { + "title": "Utilisateur" + }, + "login": "Login", + "firstName": "Prénom", + "lastName": "Nom", + "email": "Email", + "activated": "Activé", + "deactivated": "Désactivé", + "profiles": "Droits", + "langKey": "Langue", + "createdBy": "Créé par", + "createdDate": "Créé le", + "lastModifiedBy": "Modifié par", + "lastModifiedDate": "Modifié le" + } +} diff --git a/src/test/java/com/finca/ccw/domain/CollectionTrackingTest.java b/src/test/java/com/finca/ccw/domain/CollectionTrackingTest.java new file mode 100644 index 0000000..a0cfcac --- /dev/null +++ b/src/test/java/com/finca/ccw/domain/CollectionTrackingTest.java @@ -0,0 +1,23 @@ +package com.finca.ccw.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.finca.ccw.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +public class CollectionTrackingTest { + + @Test + public void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(CollectionTracking.class); + CollectionTracking collectionTracking1 = new CollectionTracking(); + collectionTracking1.setId(1L); + CollectionTracking collectionTracking2 = new CollectionTracking(); + collectionTracking2.setId(collectionTracking1.getId()); + assertThat(collectionTracking1).isEqualTo(collectionTracking2); + collectionTracking2.setId(2L); + assertThat(collectionTracking1).isNotEqualTo(collectionTracking2); + collectionTracking1.setId(null); + assertThat(collectionTracking1).isNotEqualTo(collectionTracking2); + } +} diff --git a/src/test/java/com/finca/ccw/domain/EmployeeTest.java b/src/test/java/com/finca/ccw/domain/EmployeeTest.java new file mode 100644 index 0000000..c944ce4 --- /dev/null +++ b/src/test/java/com/finca/ccw/domain/EmployeeTest.java @@ -0,0 +1,23 @@ +package com.finca.ccw.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.finca.ccw.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +public class EmployeeTest { + + @Test + public void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(Employee.class); + Employee employee1 = new Employee(); + employee1.setId(1L); + Employee employee2 = new Employee(); + employee2.setId(employee1.getId()); + assertThat(employee1).isEqualTo(employee2); + employee2.setId(2L); + assertThat(employee1).isNotEqualTo(employee2); + employee1.setId(null); + assertThat(employee1).isNotEqualTo(employee2); + } +} diff --git a/src/test/java/com/finca/ccw/service/MailServiceIT.java b/src/test/java/com/finca/ccw/service/MailServiceIT.java index baca7d4..c98a4cc 100644 --- a/src/test/java/com/finca/ccw/service/MailServiceIT.java +++ b/src/test/java/com/finca/ccw/service/MailServiceIT.java @@ -42,6 +42,7 @@ public class MailServiceIT { private static final String[] languages = { "en", + "fr", // jhipster-needle-i18n-language-constant - JHipster will add/remove languages in this array }; private static final Pattern PATTERN_LOCALE_3 = Pattern.compile("([a-z]{2})-([a-zA-Z]{4})-([a-z]{2})"); diff --git a/src/test/java/com/finca/ccw/web/rest/CollectionTrackingResourceIT.java b/src/test/java/com/finca/ccw/web/rest/CollectionTrackingResourceIT.java new file mode 100644 index 0000000..1835055 --- /dev/null +++ b/src/test/java/com/finca/ccw/web/rest/CollectionTrackingResourceIT.java @@ -0,0 +1,738 @@ +package com.finca.ccw.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.finca.ccw.CcwApplicationApp; +import com.finca.ccw.domain.CollectionTracking; +import com.finca.ccw.repository.CollectionTrackingRepository; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.List; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link CollectionTrackingResource} REST controller. + */ +@SpringBootTest(classes = CcwApplicationApp.class) +@AutoConfigureMockMvc +@WithMockUser +public class CollectionTrackingResourceIT { + private static final String DEFAULT_EMPLOYEE_ID = "AAAAAAAAAA"; + private static final String UPDATED_EMPLOYEE_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_UNIT_ID = "AAAAAAAAAA"; + private static final String UPDATED_UNIT_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_EMPLOYEE_NAME = "AAAAAAAAAA"; + private static final String UPDATED_EMPLOYEE_NAME = "BBBBBBBBBB"; + + private static final String DEFAULT_BUSINESS_PROPOSAL = "AAAAAAAAAA"; + private static final String UPDATED_BUSINESS_PROPOSAL = "BBBBBBBBBB"; + + private static final String DEFAULT_SUB_PROPOSAL = "AAAAAAAAAA"; + private static final String UPDATED_SUB_PROPOSAL = "BBBBBBBBBB"; + + private static final String DEFAULT_MOBILE_NO = "AAAAAAAAAA"; + private static final String UPDATED_MOBILE_NO = "BBBBBBBBBB"; + + private static final String DEFAULT_RELATION_ID = "AAAAAAAAAA"; + private static final String UPDATED_RELATION_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_ACCOUNT_NO = "AAAAAAAAAA"; + private static final String UPDATED_ACCOUNT_NO = "BBBBBBBBBB"; + + private static final String DEFAULT_ACCOUNT_TITLE = "AAAAAAAAAA"; + private static final String UPDATED_ACCOUNT_TITLE = "BBBBBBBBBB"; + + private static final Integer DEFAULT_NO_OF_VISITS = 1; + private static final Integer UPDATED_NO_OF_VISITS = 2; + + private static final BigDecimal DEFAULT_OS_AMOUNT = new BigDecimal(1); + private static final BigDecimal UPDATED_OS_AMOUNT = new BigDecimal(2); + + private static final BigDecimal DEFAULT_OS_PROFIT = new BigDecimal(1); + private static final BigDecimal UPDATED_OS_PROFIT = new BigDecimal(2); + + private static final String DEFAULT_OD_DAYS = "AAAAAAAAAA"; + private static final String UPDATED_OD_DAYS = "BBBBBBBBBB"; + + private static final String DEFAULT_LOAN_OFFICER = "AAAAAAAAAA"; + private static final String UPDATED_LOAN_OFFICER = "BBBBBBBBBB"; + + private static final String DEFAULT_VISITED_BY = "AAAAAAAAAA"; + private static final String UPDATED_VISITED_BY = "BBBBBBBBBB"; + + private static final LocalDate DEFAULT_PPT_DATE = LocalDate.ofEpochDay(0L); + private static final LocalDate UPDATED_PPT_DATE = LocalDate.now(ZoneId.systemDefault()); + + private static final String DEFAULT_REMAKRS = "AAAAAAAAAA"; + private static final String UPDATED_REMAKRS = "BBBBBBBBBB"; + + @Autowired + private CollectionTrackingRepository collectionTrackingRepository; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restCollectionTrackingMockMvc; + + private CollectionTracking collectionTracking; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static CollectionTracking createEntity(EntityManager em) { + CollectionTracking collectionTracking = new CollectionTracking() + .employeeID(DEFAULT_EMPLOYEE_ID) + .unitID(DEFAULT_UNIT_ID) + .employeeName(DEFAULT_EMPLOYEE_NAME) + .businessProposal(DEFAULT_BUSINESS_PROPOSAL) + .subProposal(DEFAULT_SUB_PROPOSAL) + .mobileNo(DEFAULT_MOBILE_NO) + .relationId(DEFAULT_RELATION_ID) + .accountNo(DEFAULT_ACCOUNT_NO) + .accountTitle(DEFAULT_ACCOUNT_TITLE) + .noOfVisits(DEFAULT_NO_OF_VISITS) + .osAmount(DEFAULT_OS_AMOUNT) + .osProfit(DEFAULT_OS_PROFIT) + .odDays(DEFAULT_OD_DAYS) + .loanOfficer(DEFAULT_LOAN_OFFICER) + .visitedBy(DEFAULT_VISITED_BY) + .pptDate(DEFAULT_PPT_DATE) + .remakrs(DEFAULT_REMAKRS); + return collectionTracking; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static CollectionTracking createUpdatedEntity(EntityManager em) { + CollectionTracking collectionTracking = new CollectionTracking() + .employeeID(UPDATED_EMPLOYEE_ID) + .unitID(UPDATED_UNIT_ID) + .employeeName(UPDATED_EMPLOYEE_NAME) + .businessProposal(UPDATED_BUSINESS_PROPOSAL) + .subProposal(UPDATED_SUB_PROPOSAL) + .mobileNo(UPDATED_MOBILE_NO) + .relationId(UPDATED_RELATION_ID) + .accountNo(UPDATED_ACCOUNT_NO) + .accountTitle(UPDATED_ACCOUNT_TITLE) + .noOfVisits(UPDATED_NO_OF_VISITS) + .osAmount(UPDATED_OS_AMOUNT) + .osProfit(UPDATED_OS_PROFIT) + .odDays(UPDATED_OD_DAYS) + .loanOfficer(UPDATED_LOAN_OFFICER) + .visitedBy(UPDATED_VISITED_BY) + .pptDate(UPDATED_PPT_DATE) + .remakrs(UPDATED_REMAKRS); + return collectionTracking; + } + + @BeforeEach + public void initTest() { + collectionTracking = createEntity(em); + } + + @Test + @Transactional + public void createCollectionTracking() throws Exception { + int databaseSizeBeforeCreate = collectionTrackingRepository.findAll().size(); + // Create the CollectionTracking + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isCreated()); + + // Validate the CollectionTracking in the database + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeCreate + 1); + CollectionTracking testCollectionTracking = collectionTrackingList.get(collectionTrackingList.size() - 1); + assertThat(testCollectionTracking.getEmployeeID()).isEqualTo(DEFAULT_EMPLOYEE_ID); + assertThat(testCollectionTracking.getUnitID()).isEqualTo(DEFAULT_UNIT_ID); + assertThat(testCollectionTracking.getEmployeeName()).isEqualTo(DEFAULT_EMPLOYEE_NAME); + assertThat(testCollectionTracking.getBusinessProposal()).isEqualTo(DEFAULT_BUSINESS_PROPOSAL); + assertThat(testCollectionTracking.getSubProposal()).isEqualTo(DEFAULT_SUB_PROPOSAL); + assertThat(testCollectionTracking.getMobileNo()).isEqualTo(DEFAULT_MOBILE_NO); + assertThat(testCollectionTracking.getRelationId()).isEqualTo(DEFAULT_RELATION_ID); + assertThat(testCollectionTracking.getAccountNo()).isEqualTo(DEFAULT_ACCOUNT_NO); + assertThat(testCollectionTracking.getAccountTitle()).isEqualTo(DEFAULT_ACCOUNT_TITLE); + assertThat(testCollectionTracking.getNoOfVisits()).isEqualTo(DEFAULT_NO_OF_VISITS); + assertThat(testCollectionTracking.getOsAmount()).isEqualTo(DEFAULT_OS_AMOUNT); + assertThat(testCollectionTracking.getOsProfit()).isEqualTo(DEFAULT_OS_PROFIT); + assertThat(testCollectionTracking.getOdDays()).isEqualTo(DEFAULT_OD_DAYS); + assertThat(testCollectionTracking.getLoanOfficer()).isEqualTo(DEFAULT_LOAN_OFFICER); + assertThat(testCollectionTracking.getVisitedBy()).isEqualTo(DEFAULT_VISITED_BY); + assertThat(testCollectionTracking.getPptDate()).isEqualTo(DEFAULT_PPT_DATE); + assertThat(testCollectionTracking.getRemakrs()).isEqualTo(DEFAULT_REMAKRS); + } + + @Test + @Transactional + public void createCollectionTrackingWithExistingId() throws Exception { + int databaseSizeBeforeCreate = collectionTrackingRepository.findAll().size(); + + // Create the CollectionTracking with an existing ID + collectionTracking.setId(1L); + + // An entity with an existing ID cannot be created, so this API call must fail + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + // Validate the CollectionTracking in the database + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + public void checkEmployeeIDIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setEmployeeID(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkUnitIDIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setUnitID(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkEmployeeNameIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setEmployeeName(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkBusinessProposalIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setBusinessProposal(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkSubProposalIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setSubProposal(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkMobileNoIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setMobileNo(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkRelationIdIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setRelationId(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkAccountNoIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setAccountNo(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkAccountTitleIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setAccountTitle(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkNoOfVisitsIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setNoOfVisits(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkOsAmountIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setOsAmount(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkOsProfitIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setOsProfit(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkOdDaysIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setOdDays(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkLoanOfficerIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setLoanOfficer(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkVisitedByIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setVisitedBy(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkPptDateIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setPptDate(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkRemakrsIsRequired() throws Exception { + int databaseSizeBeforeTest = collectionTrackingRepository.findAll().size(); + // set the field null + collectionTracking.setRemakrs(null); + + // Create the CollectionTracking, which fails. + + restCollectionTrackingMockMvc + .perform( + post("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void getAllCollectionTrackings() throws Exception { + // Initialize the database + collectionTrackingRepository.saveAndFlush(collectionTracking); + + // Get all the collectionTrackingList + restCollectionTrackingMockMvc + .perform(get("/api/collection-trackings?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(collectionTracking.getId().intValue()))) + .andExpect(jsonPath("$.[*].employeeID").value(hasItem(DEFAULT_EMPLOYEE_ID))) + .andExpect(jsonPath("$.[*].unitID").value(hasItem(DEFAULT_UNIT_ID))) + .andExpect(jsonPath("$.[*].employeeName").value(hasItem(DEFAULT_EMPLOYEE_NAME))) + .andExpect(jsonPath("$.[*].businessProposal").value(hasItem(DEFAULT_BUSINESS_PROPOSAL))) + .andExpect(jsonPath("$.[*].subProposal").value(hasItem(DEFAULT_SUB_PROPOSAL))) + .andExpect(jsonPath("$.[*].mobileNo").value(hasItem(DEFAULT_MOBILE_NO))) + .andExpect(jsonPath("$.[*].relationId").value(hasItem(DEFAULT_RELATION_ID))) + .andExpect(jsonPath("$.[*].accountNo").value(hasItem(DEFAULT_ACCOUNT_NO))) + .andExpect(jsonPath("$.[*].accountTitle").value(hasItem(DEFAULT_ACCOUNT_TITLE))) + .andExpect(jsonPath("$.[*].noOfVisits").value(hasItem(DEFAULT_NO_OF_VISITS))) + .andExpect(jsonPath("$.[*].osAmount").value(hasItem(DEFAULT_OS_AMOUNT.intValue()))) + .andExpect(jsonPath("$.[*].osProfit").value(hasItem(DEFAULT_OS_PROFIT.intValue()))) + .andExpect(jsonPath("$.[*].odDays").value(hasItem(DEFAULT_OD_DAYS))) + .andExpect(jsonPath("$.[*].loanOfficer").value(hasItem(DEFAULT_LOAN_OFFICER))) + .andExpect(jsonPath("$.[*].visitedBy").value(hasItem(DEFAULT_VISITED_BY))) + .andExpect(jsonPath("$.[*].pptDate").value(hasItem(DEFAULT_PPT_DATE.toString()))) + .andExpect(jsonPath("$.[*].remakrs").value(hasItem(DEFAULT_REMAKRS))); + } + + @Test + @Transactional + public void getCollectionTracking() throws Exception { + // Initialize the database + collectionTrackingRepository.saveAndFlush(collectionTracking); + + // Get the collectionTracking + restCollectionTrackingMockMvc + .perform(get("/api/collection-trackings/{id}", collectionTracking.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(collectionTracking.getId().intValue())) + .andExpect(jsonPath("$.employeeID").value(DEFAULT_EMPLOYEE_ID)) + .andExpect(jsonPath("$.unitID").value(DEFAULT_UNIT_ID)) + .andExpect(jsonPath("$.employeeName").value(DEFAULT_EMPLOYEE_NAME)) + .andExpect(jsonPath("$.businessProposal").value(DEFAULT_BUSINESS_PROPOSAL)) + .andExpect(jsonPath("$.subProposal").value(DEFAULT_SUB_PROPOSAL)) + .andExpect(jsonPath("$.mobileNo").value(DEFAULT_MOBILE_NO)) + .andExpect(jsonPath("$.relationId").value(DEFAULT_RELATION_ID)) + .andExpect(jsonPath("$.accountNo").value(DEFAULT_ACCOUNT_NO)) + .andExpect(jsonPath("$.accountTitle").value(DEFAULT_ACCOUNT_TITLE)) + .andExpect(jsonPath("$.noOfVisits").value(DEFAULT_NO_OF_VISITS)) + .andExpect(jsonPath("$.osAmount").value(DEFAULT_OS_AMOUNT.intValue())) + .andExpect(jsonPath("$.osProfit").value(DEFAULT_OS_PROFIT.intValue())) + .andExpect(jsonPath("$.odDays").value(DEFAULT_OD_DAYS)) + .andExpect(jsonPath("$.loanOfficer").value(DEFAULT_LOAN_OFFICER)) + .andExpect(jsonPath("$.visitedBy").value(DEFAULT_VISITED_BY)) + .andExpect(jsonPath("$.pptDate").value(DEFAULT_PPT_DATE.toString())) + .andExpect(jsonPath("$.remakrs").value(DEFAULT_REMAKRS)); + } + + @Test + @Transactional + public void getNonExistingCollectionTracking() throws Exception { + // Get the collectionTracking + restCollectionTrackingMockMvc.perform(get("/api/collection-trackings/{id}", Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + public void updateCollectionTracking() throws Exception { + // Initialize the database + collectionTrackingRepository.saveAndFlush(collectionTracking); + + int databaseSizeBeforeUpdate = collectionTrackingRepository.findAll().size(); + + // Update the collectionTracking + CollectionTracking updatedCollectionTracking = collectionTrackingRepository.findById(collectionTracking.getId()).get(); + // Disconnect from session so that the updates on updatedCollectionTracking are not directly saved in db + em.detach(updatedCollectionTracking); + updatedCollectionTracking + .employeeID(UPDATED_EMPLOYEE_ID) + .unitID(UPDATED_UNIT_ID) + .employeeName(UPDATED_EMPLOYEE_NAME) + .businessProposal(UPDATED_BUSINESS_PROPOSAL) + .subProposal(UPDATED_SUB_PROPOSAL) + .mobileNo(UPDATED_MOBILE_NO) + .relationId(UPDATED_RELATION_ID) + .accountNo(UPDATED_ACCOUNT_NO) + .accountTitle(UPDATED_ACCOUNT_TITLE) + .noOfVisits(UPDATED_NO_OF_VISITS) + .osAmount(UPDATED_OS_AMOUNT) + .osProfit(UPDATED_OS_PROFIT) + .odDays(UPDATED_OD_DAYS) + .loanOfficer(UPDATED_LOAN_OFFICER) + .visitedBy(UPDATED_VISITED_BY) + .pptDate(UPDATED_PPT_DATE) + .remakrs(UPDATED_REMAKRS); + + restCollectionTrackingMockMvc + .perform( + put("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(updatedCollectionTracking)) + ) + .andExpect(status().isOk()); + + // Validate the CollectionTracking in the database + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeUpdate); + CollectionTracking testCollectionTracking = collectionTrackingList.get(collectionTrackingList.size() - 1); + assertThat(testCollectionTracking.getEmployeeID()).isEqualTo(UPDATED_EMPLOYEE_ID); + assertThat(testCollectionTracking.getUnitID()).isEqualTo(UPDATED_UNIT_ID); + assertThat(testCollectionTracking.getEmployeeName()).isEqualTo(UPDATED_EMPLOYEE_NAME); + assertThat(testCollectionTracking.getBusinessProposal()).isEqualTo(UPDATED_BUSINESS_PROPOSAL); + assertThat(testCollectionTracking.getSubProposal()).isEqualTo(UPDATED_SUB_PROPOSAL); + assertThat(testCollectionTracking.getMobileNo()).isEqualTo(UPDATED_MOBILE_NO); + assertThat(testCollectionTracking.getRelationId()).isEqualTo(UPDATED_RELATION_ID); + assertThat(testCollectionTracking.getAccountNo()).isEqualTo(UPDATED_ACCOUNT_NO); + assertThat(testCollectionTracking.getAccountTitle()).isEqualTo(UPDATED_ACCOUNT_TITLE); + assertThat(testCollectionTracking.getNoOfVisits()).isEqualTo(UPDATED_NO_OF_VISITS); + assertThat(testCollectionTracking.getOsAmount()).isEqualTo(UPDATED_OS_AMOUNT); + assertThat(testCollectionTracking.getOsProfit()).isEqualTo(UPDATED_OS_PROFIT); + assertThat(testCollectionTracking.getOdDays()).isEqualTo(UPDATED_OD_DAYS); + assertThat(testCollectionTracking.getLoanOfficer()).isEqualTo(UPDATED_LOAN_OFFICER); + assertThat(testCollectionTracking.getVisitedBy()).isEqualTo(UPDATED_VISITED_BY); + assertThat(testCollectionTracking.getPptDate()).isEqualTo(UPDATED_PPT_DATE); + assertThat(testCollectionTracking.getRemakrs()).isEqualTo(UPDATED_REMAKRS); + } + + @Test + @Transactional + public void updateNonExistingCollectionTracking() throws Exception { + int databaseSizeBeforeUpdate = collectionTrackingRepository.findAll().size(); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restCollectionTrackingMockMvc + .perform( + put("/api/collection-trackings") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(collectionTracking)) + ) + .andExpect(status().isBadRequest()); + + // Validate the CollectionTracking in the database + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + public void deleteCollectionTracking() throws Exception { + // Initialize the database + collectionTrackingRepository.saveAndFlush(collectionTracking); + + int databaseSizeBeforeDelete = collectionTrackingRepository.findAll().size(); + + // Delete the collectionTracking + restCollectionTrackingMockMvc + .perform(delete("/api/collection-trackings/{id}", collectionTracking.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List collectionTrackingList = collectionTrackingRepository.findAll(); + assertThat(collectionTrackingList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/java/com/finca/ccw/web/rest/EmployeeResourceIT.java b/src/test/java/com/finca/ccw/web/rest/EmployeeResourceIT.java new file mode 100644 index 0000000..fb775fb --- /dev/null +++ b/src/test/java/com/finca/ccw/web/rest/EmployeeResourceIT.java @@ -0,0 +1,339 @@ +package com.finca.ccw.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.finca.ccw.CcwApplicationApp; +import com.finca.ccw.domain.Employee; +import com.finca.ccw.repository.EmployeeRepository; +import java.util.List; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link EmployeeResource} REST controller. + */ +@SpringBootTest(classes = CcwApplicationApp.class) +@AutoConfigureMockMvc +@WithMockUser +public class EmployeeResourceIT { + private static final String DEFAULT_EMPLOYEE_ID = "AAAAAAAAAA"; + private static final String UPDATED_EMPLOYEE_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_UNIT_ID = "AAAAAAAAAA"; + private static final String UPDATED_UNIT_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_FIRST_NAME = "AAAAAAAAAA"; + private static final String UPDATED_FIRST_NAME = "BBBBBBBBBB"; + + private static final String DEFAULT_LAST_NAME = "AAAAAAAAAA"; + private static final String UPDATED_LAST_NAME = "BBBBBBBBBB"; + + private static final String DEFAULT_EMAIL_ADDRESS = "AAAAAAAAAA"; + private static final String UPDATED_EMAIL_ADDRESS = "BBBBBBBBBB"; + + private static final String DEFAULT_LOGIN = "AAAAAAAAAA"; + private static final String UPDATED_LOGIN = "BBBBBBBBBB"; + + @Autowired + private EmployeeRepository employeeRepository; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restEmployeeMockMvc; + + private Employee employee; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static Employee createEntity(EntityManager em) { + Employee employee = new Employee() + .employeeID(DEFAULT_EMPLOYEE_ID) + .unitID(DEFAULT_UNIT_ID) + .firstName(DEFAULT_FIRST_NAME) + .lastName(DEFAULT_LAST_NAME) + .emailAddress(DEFAULT_EMAIL_ADDRESS) + .login(DEFAULT_LOGIN); + return employee; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static Employee createUpdatedEntity(EntityManager em) { + Employee employee = new Employee() + .employeeID(UPDATED_EMPLOYEE_ID) + .unitID(UPDATED_UNIT_ID) + .firstName(UPDATED_FIRST_NAME) + .lastName(UPDATED_LAST_NAME) + .emailAddress(UPDATED_EMAIL_ADDRESS) + .login(UPDATED_LOGIN); + return employee; + } + + @BeforeEach + public void initTest() { + employee = createEntity(em); + } + + @Test + @Transactional + public void createEmployee() throws Exception { + int databaseSizeBeforeCreate = employeeRepository.findAll().size(); + // Create the Employee + restEmployeeMockMvc + .perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(employee))) + .andExpect(status().isCreated()); + + // Validate the Employee in the database + List employeeList = employeeRepository.findAll(); + assertThat(employeeList).hasSize(databaseSizeBeforeCreate + 1); + Employee testEmployee = employeeList.get(employeeList.size() - 1); + assertThat(testEmployee.getEmployeeID()).isEqualTo(DEFAULT_EMPLOYEE_ID); + assertThat(testEmployee.getUnitID()).isEqualTo(DEFAULT_UNIT_ID); + assertThat(testEmployee.getFirstName()).isEqualTo(DEFAULT_FIRST_NAME); + assertThat(testEmployee.getLastName()).isEqualTo(DEFAULT_LAST_NAME); + assertThat(testEmployee.getEmailAddress()).isEqualTo(DEFAULT_EMAIL_ADDRESS); + assertThat(testEmployee.getLogin()).isEqualTo(DEFAULT_LOGIN); + } + + @Test + @Transactional + public void createEmployeeWithExistingId() throws Exception { + int databaseSizeBeforeCreate = employeeRepository.findAll().size(); + + // Create the Employee with an existing ID + employee.setId(1L); + + // An entity with an existing ID cannot be created, so this API call must fail + restEmployeeMockMvc + .perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(employee))) + .andExpect(status().isBadRequest()); + + // Validate the Employee in the database + List employeeList = employeeRepository.findAll(); + assertThat(employeeList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + public void checkEmployeeIDIsRequired() throws Exception { + int databaseSizeBeforeTest = employeeRepository.findAll().size(); + // set the field null + employee.setEmployeeID(null); + + // Create the Employee, which fails. + + restEmployeeMockMvc + .perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(employee))) + .andExpect(status().isBadRequest()); + + List employeeList = employeeRepository.findAll(); + assertThat(employeeList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkUnitIDIsRequired() throws Exception { + int databaseSizeBeforeTest = employeeRepository.findAll().size(); + // set the field null + employee.setUnitID(null); + + // Create the Employee, which fails. + + restEmployeeMockMvc + .perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(employee))) + .andExpect(status().isBadRequest()); + + List employeeList = employeeRepository.findAll(); + assertThat(employeeList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkFirstNameIsRequired() throws Exception { + int databaseSizeBeforeTest = employeeRepository.findAll().size(); + // set the field null + employee.setFirstName(null); + + // Create the Employee, which fails. + + restEmployeeMockMvc + .perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(employee))) + .andExpect(status().isBadRequest()); + + List employeeList = employeeRepository.findAll(); + assertThat(employeeList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkLastNameIsRequired() throws Exception { + int databaseSizeBeforeTest = employeeRepository.findAll().size(); + // set the field null + employee.setLastName(null); + + // Create the Employee, which fails. + + restEmployeeMockMvc + .perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(employee))) + .andExpect(status().isBadRequest()); + + List employeeList = employeeRepository.findAll(); + assertThat(employeeList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkEmailAddressIsRequired() throws Exception { + int databaseSizeBeforeTest = employeeRepository.findAll().size(); + // set the field null + employee.setEmailAddress(null); + + // Create the Employee, which fails. + + restEmployeeMockMvc + .perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(employee))) + .andExpect(status().isBadRequest()); + + List employeeList = employeeRepository.findAll(); + assertThat(employeeList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void getAllEmployees() throws Exception { + // Initialize the database + employeeRepository.saveAndFlush(employee); + + // Get all the employeeList + restEmployeeMockMvc + .perform(get("/api/employees?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(employee.getId().intValue()))) + .andExpect(jsonPath("$.[*].employeeID").value(hasItem(DEFAULT_EMPLOYEE_ID))) + .andExpect(jsonPath("$.[*].unitID").value(hasItem(DEFAULT_UNIT_ID))) + .andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRST_NAME))) + .andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LAST_NAME))) + .andExpect(jsonPath("$.[*].emailAddress").value(hasItem(DEFAULT_EMAIL_ADDRESS))) + .andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN))); + } + + @Test + @Transactional + public void getEmployee() throws Exception { + // Initialize the database + employeeRepository.saveAndFlush(employee); + + // Get the employee + restEmployeeMockMvc + .perform(get("/api/employees/{id}", employee.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(employee.getId().intValue())) + .andExpect(jsonPath("$.employeeID").value(DEFAULT_EMPLOYEE_ID)) + .andExpect(jsonPath("$.unitID").value(DEFAULT_UNIT_ID)) + .andExpect(jsonPath("$.firstName").value(DEFAULT_FIRST_NAME)) + .andExpect(jsonPath("$.lastName").value(DEFAULT_LAST_NAME)) + .andExpect(jsonPath("$.emailAddress").value(DEFAULT_EMAIL_ADDRESS)) + .andExpect(jsonPath("$.login").value(DEFAULT_LOGIN)); + } + + @Test + @Transactional + public void getNonExistingEmployee() throws Exception { + // Get the employee + restEmployeeMockMvc.perform(get("/api/employees/{id}", Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + public void updateEmployee() throws Exception { + // Initialize the database + employeeRepository.saveAndFlush(employee); + + int databaseSizeBeforeUpdate = employeeRepository.findAll().size(); + + // Update the employee + Employee updatedEmployee = employeeRepository.findById(employee.getId()).get(); + // Disconnect from session so that the updates on updatedEmployee are not directly saved in db + em.detach(updatedEmployee); + updatedEmployee + .employeeID(UPDATED_EMPLOYEE_ID) + .unitID(UPDATED_UNIT_ID) + .firstName(UPDATED_FIRST_NAME) + .lastName(UPDATED_LAST_NAME) + .emailAddress(UPDATED_EMAIL_ADDRESS) + .login(UPDATED_LOGIN); + + restEmployeeMockMvc + .perform( + put("/api/employees").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(updatedEmployee)) + ) + .andExpect(status().isOk()); + + // Validate the Employee in the database + List employeeList = employeeRepository.findAll(); + assertThat(employeeList).hasSize(databaseSizeBeforeUpdate); + Employee testEmployee = employeeList.get(employeeList.size() - 1); + assertThat(testEmployee.getEmployeeID()).isEqualTo(UPDATED_EMPLOYEE_ID); + assertThat(testEmployee.getUnitID()).isEqualTo(UPDATED_UNIT_ID); + assertThat(testEmployee.getFirstName()).isEqualTo(UPDATED_FIRST_NAME); + assertThat(testEmployee.getLastName()).isEqualTo(UPDATED_LAST_NAME); + assertThat(testEmployee.getEmailAddress()).isEqualTo(UPDATED_EMAIL_ADDRESS); + assertThat(testEmployee.getLogin()).isEqualTo(UPDATED_LOGIN); + } + + @Test + @Transactional + public void updateNonExistingEmployee() throws Exception { + int databaseSizeBeforeUpdate = employeeRepository.findAll().size(); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restEmployeeMockMvc + .perform(put("/api/employees").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(employee))) + .andExpect(status().isBadRequest()); + + // Validate the Employee in the database + List employeeList = employeeRepository.findAll(); + assertThat(employeeList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + public void deleteEmployee() throws Exception { + // Initialize the database + employeeRepository.saveAndFlush(employee); + + int databaseSizeBeforeDelete = employeeRepository.findAll().size(); + + // Delete the employee + restEmployeeMockMvc + .perform(delete("/api/employees/{id}", employee.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List employeeList = employeeRepository.findAll(); + assertThat(employeeList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-delete-dialog.component.spec.ts b/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-delete-dialog.component.spec.ts new file mode 100644 index 0000000..56dc91c --- /dev/null +++ b/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-delete-dialog.component.spec.ts @@ -0,0 +1,65 @@ +import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { of } from 'rxjs'; +import { JhiEventManager } from 'ng-jhipster'; + +import { CcwApplicationTestModule } from '../../../test.module'; +import { MockEventManager } from '../../../helpers/mock-event-manager.service'; +import { MockActiveModal } from '../../../helpers/mock-active-modal.service'; +import { CollectionTrackingDeleteDialogComponent } from 'app/entities/collection-tracking/collection-tracking-delete-dialog.component'; +import { CollectionTrackingService } from 'app/entities/collection-tracking/collection-tracking.service'; + +describe('Component Tests', () => { + describe('CollectionTracking Management Delete Component', () => { + let comp: CollectionTrackingDeleteDialogComponent; + let fixture: ComponentFixture; + let service: CollectionTrackingService; + let mockEventManager: MockEventManager; + let mockActiveModal: MockActiveModal; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [CcwApplicationTestModule], + declarations: [CollectionTrackingDeleteDialogComponent], + }) + .overrideTemplate(CollectionTrackingDeleteDialogComponent, '') + .compileComponents(); + fixture = TestBed.createComponent(CollectionTrackingDeleteDialogComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(CollectionTrackingService); + mockEventManager = TestBed.get(JhiEventManager); + mockActiveModal = TestBed.get(NgbActiveModal); + }); + + describe('confirmDelete', () => { + it('Should call delete service on confirmDelete', inject( + [], + fakeAsync(() => { + // GIVEN + spyOn(service, 'delete').and.returnValue(of({})); + + // WHEN + comp.confirmDelete(123); + tick(); + + // THEN + expect(service.delete).toHaveBeenCalledWith(123); + expect(mockActiveModal.closeSpy).toHaveBeenCalled(); + expect(mockEventManager.broadcastSpy).toHaveBeenCalled(); + }) + )); + + it('Should not call delete service on clear', () => { + // GIVEN + spyOn(service, 'delete'); + + // WHEN + comp.cancel(); + + // THEN + expect(service.delete).not.toHaveBeenCalled(); + expect(mockActiveModal.dismissSpy).toHaveBeenCalled(); + }); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-detail.component.spec.ts b/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-detail.component.spec.ts new file mode 100644 index 0000000..82a061a --- /dev/null +++ b/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-detail.component.spec.ts @@ -0,0 +1,37 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; + +import { CcwApplicationTestModule } from '../../../test.module'; +import { CollectionTrackingDetailComponent } from 'app/entities/collection-tracking/collection-tracking-detail.component'; +import { CollectionTracking } from 'app/shared/model/collection-tracking.model'; + +describe('Component Tests', () => { + describe('CollectionTracking Management Detail Component', () => { + let comp: CollectionTrackingDetailComponent; + let fixture: ComponentFixture; + const route = ({ data: of({ collectionTracking: new CollectionTracking(123) }) } as any) as ActivatedRoute; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [CcwApplicationTestModule], + declarations: [CollectionTrackingDetailComponent], + providers: [{ provide: ActivatedRoute, useValue: route }], + }) + .overrideTemplate(CollectionTrackingDetailComponent, '') + .compileComponents(); + fixture = TestBed.createComponent(CollectionTrackingDetailComponent); + comp = fixture.componentInstance; + }); + + describe('OnInit', () => { + it('Should load collectionTracking on init', () => { + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.collectionTracking).toEqual(jasmine.objectContaining({ id: 123 })); + }); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-update.component.spec.ts b/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-update.component.spec.ts new file mode 100644 index 0000000..61f4030 --- /dev/null +++ b/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking-update.component.spec.ts @@ -0,0 +1,61 @@ +import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; +import { HttpResponse } from '@angular/common/http'; +import { FormBuilder } from '@angular/forms'; +import { of } from 'rxjs'; + +import { CcwApplicationTestModule } from '../../../test.module'; +import { CollectionTrackingUpdateComponent } from 'app/entities/collection-tracking/collection-tracking-update.component'; +import { CollectionTrackingService } from 'app/entities/collection-tracking/collection-tracking.service'; +import { CollectionTracking } from 'app/shared/model/collection-tracking.model'; + +describe('Component Tests', () => { + describe('CollectionTracking Management Update Component', () => { + let comp: CollectionTrackingUpdateComponent; + let fixture: ComponentFixture; + let service: CollectionTrackingService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [CcwApplicationTestModule], + declarations: [CollectionTrackingUpdateComponent], + providers: [FormBuilder], + }) + .overrideTemplate(CollectionTrackingUpdateComponent, '') + .compileComponents(); + + fixture = TestBed.createComponent(CollectionTrackingUpdateComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(CollectionTrackingService); + }); + + describe('save', () => { + it('Should call update service on save for existing entity', fakeAsync(() => { + // GIVEN + const entity = new CollectionTracking(123); + spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.updateForm(entity); + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(service.update).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + })); + + it('Should call create service on save for new entity', fakeAsync(() => { + // GIVEN + const entity = new CollectionTracking(); + spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.updateForm(entity); + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(service.create).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + })); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking.component.spec.ts b/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking.component.spec.ts new file mode 100644 index 0000000..18105e2 --- /dev/null +++ b/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking.component.spec.ts @@ -0,0 +1,49 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { of } from 'rxjs'; +import { HttpHeaders, HttpResponse } from '@angular/common/http'; + +import { CcwApplicationTestModule } from '../../../test.module'; +import { CollectionTrackingComponent } from 'app/entities/collection-tracking/collection-tracking.component'; +import { CollectionTrackingService } from 'app/entities/collection-tracking/collection-tracking.service'; +import { CollectionTracking } from 'app/shared/model/collection-tracking.model'; + +describe('Component Tests', () => { + describe('CollectionTracking Management Component', () => { + let comp: CollectionTrackingComponent; + let fixture: ComponentFixture; + let service: CollectionTrackingService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [CcwApplicationTestModule], + declarations: [CollectionTrackingComponent], + }) + .overrideTemplate(CollectionTrackingComponent, '') + .compileComponents(); + + fixture = TestBed.createComponent(CollectionTrackingComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(CollectionTrackingService); + }); + + it('Should call load all on init', () => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + spyOn(service, 'query').and.returnValue( + of( + new HttpResponse({ + body: [new CollectionTracking(123)], + headers, + }) + ) + ); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.query).toHaveBeenCalled(); + expect(comp.collectionTrackings && comp.collectionTrackings[0]).toEqual(jasmine.objectContaining({ id: 123 })); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking.service.spec.ts b/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking.service.spec.ts new file mode 100644 index 0000000..6ba959f --- /dev/null +++ b/src/test/javascript/spec/app/entities/collection-tracking/collection-tracking.service.spec.ts @@ -0,0 +1,178 @@ +import { TestBed, getTestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import * as moment from 'moment'; +import { DATE_FORMAT } from 'app/shared/constants/input.constants'; +import { CollectionTrackingService } from 'app/entities/collection-tracking/collection-tracking.service'; +import { ICollectionTracking, CollectionTracking } from 'app/shared/model/collection-tracking.model'; + +describe('Service Tests', () => { + describe('CollectionTracking Service', () => { + let injector: TestBed; + let service: CollectionTrackingService; + let httpMock: HttpTestingController; + let elemDefault: ICollectionTracking; + let expectedResult: ICollectionTracking | ICollectionTracking[] | boolean | null; + let currentDate: moment.Moment; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + expectedResult = null; + injector = getTestBed(); + service = injector.get(CollectionTrackingService); + httpMock = injector.get(HttpTestingController); + currentDate = moment(); + + elemDefault = new CollectionTracking( + 0, + 'AAAAAAA', + 'AAAAAAA', + 'AAAAAAA', + 'AAAAAAA', + 'AAAAAAA', + 'AAAAAAA', + 'AAAAAAA', + 'AAAAAAA', + 'AAAAAAA', + 0, + 0, + 0, + 'AAAAAAA', + 'AAAAAAA', + 'AAAAAAA', + currentDate, + 'AAAAAAA' + ); + }); + + describe('Service methods', () => { + it('should find an element', () => { + const returnedFromService = Object.assign( + { + pptDate: currentDate.format(DATE_FORMAT), + }, + elemDefault + ); + + service.find(123).subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(returnedFromService); + expect(expectedResult).toMatchObject(elemDefault); + }); + + it('should create a CollectionTracking', () => { + const returnedFromService = Object.assign( + { + id: 0, + pptDate: currentDate.format(DATE_FORMAT), + }, + elemDefault + ); + + const expected = Object.assign( + { + pptDate: currentDate, + }, + returnedFromService + ); + + service.create(new CollectionTracking()).subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'POST' }); + req.flush(returnedFromService); + expect(expectedResult).toMatchObject(expected); + }); + + it('should update a CollectionTracking', () => { + const returnedFromService = Object.assign( + { + employeeID: 'BBBBBB', + unitID: 'BBBBBB', + employeeName: 'BBBBBB', + businessProposal: 'BBBBBB', + subProposal: 'BBBBBB', + mobileNo: 'BBBBBB', + relationId: 'BBBBBB', + accountNo: 'BBBBBB', + accountTitle: 'BBBBBB', + noOfVisits: 1, + osAmount: 1, + osProfit: 1, + odDays: 'BBBBBB', + loanOfficer: 'BBBBBB', + visitedBy: 'BBBBBB', + pptDate: currentDate.format(DATE_FORMAT), + remakrs: 'BBBBBB', + }, + elemDefault + ); + + const expected = Object.assign( + { + pptDate: currentDate, + }, + returnedFromService + ); + + service.update(expected).subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'PUT' }); + req.flush(returnedFromService); + expect(expectedResult).toMatchObject(expected); + }); + + it('should return a list of CollectionTracking', () => { + const returnedFromService = Object.assign( + { + employeeID: 'BBBBBB', + unitID: 'BBBBBB', + employeeName: 'BBBBBB', + businessProposal: 'BBBBBB', + subProposal: 'BBBBBB', + mobileNo: 'BBBBBB', + relationId: 'BBBBBB', + accountNo: 'BBBBBB', + accountTitle: 'BBBBBB', + noOfVisits: 1, + osAmount: 1, + osProfit: 1, + odDays: 'BBBBBB', + loanOfficer: 'BBBBBB', + visitedBy: 'BBBBBB', + pptDate: currentDate.format(DATE_FORMAT), + remakrs: 'BBBBBB', + }, + elemDefault + ); + + const expected = Object.assign( + { + pptDate: currentDate, + }, + returnedFromService + ); + + service.query().subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush([returnedFromService]); + httpMock.verify(); + expect(expectedResult).toContainEqual(expected); + }); + + it('should delete a CollectionTracking', () => { + service.delete(123).subscribe(resp => (expectedResult = resp.ok)); + + const req = httpMock.expectOne({ method: 'DELETE' }); + req.flush({ status: 200 }); + expect(expectedResult); + }); + }); + + afterEach(() => { + httpMock.verify(); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/employee/employee-delete-dialog.component.spec.ts b/src/test/javascript/spec/app/entities/employee/employee-delete-dialog.component.spec.ts new file mode 100644 index 0000000..9180309 --- /dev/null +++ b/src/test/javascript/spec/app/entities/employee/employee-delete-dialog.component.spec.ts @@ -0,0 +1,65 @@ +import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { of } from 'rxjs'; +import { JhiEventManager } from 'ng-jhipster'; + +import { CcwApplicationTestModule } from '../../../test.module'; +import { MockEventManager } from '../../../helpers/mock-event-manager.service'; +import { MockActiveModal } from '../../../helpers/mock-active-modal.service'; +import { EmployeeDeleteDialogComponent } from 'app/entities/employee/employee-delete-dialog.component'; +import { EmployeeService } from 'app/entities/employee/employee.service'; + +describe('Component Tests', () => { + describe('Employee Management Delete Component', () => { + let comp: EmployeeDeleteDialogComponent; + let fixture: ComponentFixture; + let service: EmployeeService; + let mockEventManager: MockEventManager; + let mockActiveModal: MockActiveModal; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [CcwApplicationTestModule], + declarations: [EmployeeDeleteDialogComponent], + }) + .overrideTemplate(EmployeeDeleteDialogComponent, '') + .compileComponents(); + fixture = TestBed.createComponent(EmployeeDeleteDialogComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(EmployeeService); + mockEventManager = TestBed.get(JhiEventManager); + mockActiveModal = TestBed.get(NgbActiveModal); + }); + + describe('confirmDelete', () => { + it('Should call delete service on confirmDelete', inject( + [], + fakeAsync(() => { + // GIVEN + spyOn(service, 'delete').and.returnValue(of({})); + + // WHEN + comp.confirmDelete(123); + tick(); + + // THEN + expect(service.delete).toHaveBeenCalledWith(123); + expect(mockActiveModal.closeSpy).toHaveBeenCalled(); + expect(mockEventManager.broadcastSpy).toHaveBeenCalled(); + }) + )); + + it('Should not call delete service on clear', () => { + // GIVEN + spyOn(service, 'delete'); + + // WHEN + comp.cancel(); + + // THEN + expect(service.delete).not.toHaveBeenCalled(); + expect(mockActiveModal.dismissSpy).toHaveBeenCalled(); + }); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/employee/employee-detail.component.spec.ts b/src/test/javascript/spec/app/entities/employee/employee-detail.component.spec.ts new file mode 100644 index 0000000..0a781a5 --- /dev/null +++ b/src/test/javascript/spec/app/entities/employee/employee-detail.component.spec.ts @@ -0,0 +1,37 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; + +import { CcwApplicationTestModule } from '../../../test.module'; +import { EmployeeDetailComponent } from 'app/entities/employee/employee-detail.component'; +import { Employee } from 'app/shared/model/employee.model'; + +describe('Component Tests', () => { + describe('Employee Management Detail Component', () => { + let comp: EmployeeDetailComponent; + let fixture: ComponentFixture; + const route = ({ data: of({ employee: new Employee(123) }) } as any) as ActivatedRoute; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [CcwApplicationTestModule], + declarations: [EmployeeDetailComponent], + providers: [{ provide: ActivatedRoute, useValue: route }], + }) + .overrideTemplate(EmployeeDetailComponent, '') + .compileComponents(); + fixture = TestBed.createComponent(EmployeeDetailComponent); + comp = fixture.componentInstance; + }); + + describe('OnInit', () => { + it('Should load employee on init', () => { + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.employee).toEqual(jasmine.objectContaining({ id: 123 })); + }); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/employee/employee-update.component.spec.ts b/src/test/javascript/spec/app/entities/employee/employee-update.component.spec.ts new file mode 100644 index 0000000..1114931 --- /dev/null +++ b/src/test/javascript/spec/app/entities/employee/employee-update.component.spec.ts @@ -0,0 +1,61 @@ +import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; +import { HttpResponse } from '@angular/common/http'; +import { FormBuilder } from '@angular/forms'; +import { of } from 'rxjs'; + +import { CcwApplicationTestModule } from '../../../test.module'; +import { EmployeeUpdateComponent } from 'app/entities/employee/employee-update.component'; +import { EmployeeService } from 'app/entities/employee/employee.service'; +import { Employee } from 'app/shared/model/employee.model'; + +describe('Component Tests', () => { + describe('Employee Management Update Component', () => { + let comp: EmployeeUpdateComponent; + let fixture: ComponentFixture; + let service: EmployeeService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [CcwApplicationTestModule], + declarations: [EmployeeUpdateComponent], + providers: [FormBuilder], + }) + .overrideTemplate(EmployeeUpdateComponent, '') + .compileComponents(); + + fixture = TestBed.createComponent(EmployeeUpdateComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(EmployeeService); + }); + + describe('save', () => { + it('Should call update service on save for existing entity', fakeAsync(() => { + // GIVEN + const entity = new Employee(123); + spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.updateForm(entity); + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(service.update).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + })); + + it('Should call create service on save for new entity', fakeAsync(() => { + // GIVEN + const entity = new Employee(); + spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.updateForm(entity); + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(service.create).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + })); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/employee/employee.component.spec.ts b/src/test/javascript/spec/app/entities/employee/employee.component.spec.ts new file mode 100644 index 0000000..d9e459a --- /dev/null +++ b/src/test/javascript/spec/app/entities/employee/employee.component.spec.ts @@ -0,0 +1,49 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { of } from 'rxjs'; +import { HttpHeaders, HttpResponse } from '@angular/common/http'; + +import { CcwApplicationTestModule } from '../../../test.module'; +import { EmployeeComponent } from 'app/entities/employee/employee.component'; +import { EmployeeService } from 'app/entities/employee/employee.service'; +import { Employee } from 'app/shared/model/employee.model'; + +describe('Component Tests', () => { + describe('Employee Management Component', () => { + let comp: EmployeeComponent; + let fixture: ComponentFixture; + let service: EmployeeService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [CcwApplicationTestModule], + declarations: [EmployeeComponent], + }) + .overrideTemplate(EmployeeComponent, '') + .compileComponents(); + + fixture = TestBed.createComponent(EmployeeComponent); + comp = fixture.componentInstance; + service = fixture.debugElement.injector.get(EmployeeService); + }); + + it('Should call load all on init', () => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + spyOn(service, 'query').and.returnValue( + of( + new HttpResponse({ + body: [new Employee(123)], + headers, + }) + ) + ); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.query).toHaveBeenCalled(); + expect(comp.employees && comp.employees[0]).toEqual(jasmine.objectContaining({ id: 123 })); + }); + }); +}); diff --git a/src/test/javascript/spec/app/entities/employee/employee.service.spec.ts b/src/test/javascript/spec/app/entities/employee/employee.service.spec.ts new file mode 100644 index 0000000..a5800ba --- /dev/null +++ b/src/test/javascript/spec/app/entities/employee/employee.service.spec.ts @@ -0,0 +1,112 @@ +import { TestBed, getTestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { EmployeeService } from 'app/entities/employee/employee.service'; +import { IEmployee, Employee } from 'app/shared/model/employee.model'; + +describe('Service Tests', () => { + describe('Employee Service', () => { + let injector: TestBed; + let service: EmployeeService; + let httpMock: HttpTestingController; + let elemDefault: IEmployee; + let expectedResult: IEmployee | IEmployee[] | boolean | null; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + expectedResult = null; + injector = getTestBed(); + service = injector.get(EmployeeService); + httpMock = injector.get(HttpTestingController); + + elemDefault = new Employee(0, 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA'); + }); + + describe('Service methods', () => { + it('should find an element', () => { + const returnedFromService = Object.assign({}, elemDefault); + + service.find(123).subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(returnedFromService); + expect(expectedResult).toMatchObject(elemDefault); + }); + + it('should create a Employee', () => { + const returnedFromService = Object.assign( + { + id: 0, + }, + elemDefault + ); + + const expected = Object.assign({}, returnedFromService); + + service.create(new Employee()).subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'POST' }); + req.flush(returnedFromService); + expect(expectedResult).toMatchObject(expected); + }); + + it('should update a Employee', () => { + const returnedFromService = Object.assign( + { + employeeID: 'BBBBBB', + unitID: 'BBBBBB', + firstName: 'BBBBBB', + lastName: 'BBBBBB', + emailAddress: 'BBBBBB', + login: 'BBBBBB', + }, + elemDefault + ); + + const expected = Object.assign({}, returnedFromService); + + service.update(expected).subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'PUT' }); + req.flush(returnedFromService); + expect(expectedResult).toMatchObject(expected); + }); + + it('should return a list of Employee', () => { + const returnedFromService = Object.assign( + { + employeeID: 'BBBBBB', + unitID: 'BBBBBB', + firstName: 'BBBBBB', + lastName: 'BBBBBB', + emailAddress: 'BBBBBB', + login: 'BBBBBB', + }, + elemDefault + ); + + const expected = Object.assign({}, returnedFromService); + + service.query().subscribe(resp => (expectedResult = resp.body)); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush([returnedFromService]); + httpMock.verify(); + expect(expectedResult).toContainEqual(expected); + }); + + it('should delete a Employee', () => { + service.delete(123).subscribe(resp => (expectedResult = resp.ok)); + + const req = httpMock.expectOne({ method: 'DELETE' }); + req.flush({ status: 200 }); + expect(expectedResult); + }); + }); + + afterEach(() => { + httpMock.verify(); + }); + }); +}); diff --git a/src/test/resources/i18n/messages_fr.properties b/src/test/resources/i18n/messages_fr.properties new file mode 100644 index 0000000..2971be6 --- /dev/null +++ b/src/test/resources/i18n/messages_fr.properties @@ -0,0 +1 @@ +email.test.title=Activation de votre compte CCWApplication diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js index 8912ee6..4c33303 100644 --- a/webpack/webpack.common.js +++ b/webpack/webpack.common.js @@ -88,7 +88,8 @@ module.exports = (options) => ({ new MergeJsonWebpackPlugin({ output: { groupBy: [ - { pattern: "./src/main/webapp/i18n/en/*.json", fileName: "./i18n/en.json" } + { pattern: "./src/main/webapp/i18n/en/*.json", fileName: "./i18n/en.json" }, + { pattern: "./src/main/webapp/i18n/fr/*.json", fileName: "./i18n/fr.json" } // jhipster-needle-i18n-language-webpack - JHipster will add/remove languages in this array ] } diff --git a/webpack/webpack.prod.js b/webpack/webpack.prod.js index 16cdbc8..18c7b2b 100644 --- a/webpack/webpack.prod.js +++ b/webpack/webpack.prod.js @@ -124,7 +124,8 @@ module.exports = webpackMerge(commonConfig({ env: ENV }), { }), new MomentLocalesPlugin({ localesToKeep: [ - 'en' + 'en', + 'fr' // jhipster-needle-i18n-language-moment-webpack - JHipster will add/remove languages in this array ] }),