2323import com .angkorteam .fintech .Page ;
2424import com .angkorteam .fintech .Session ;
2525import com .angkorteam .fintech .ddl .MOffice ;
26- import com .angkorteam .fintech .ddl .MSavingsProduct ;
2726import com .angkorteam .fintech .ddl .MStaff ;
2827import com .angkorteam .fintech .dto .Function ;
2928import com .angkorteam .fintech .dto .builder .ClientBuilder ;
3029import com .angkorteam .fintech .dto .builder .FamilyMemberBuilder ;
31- import com .angkorteam .fintech .dto .enums .DepositType ;
3230import com .angkorteam .fintech .dto .enums .LegalForm ;
3331import com .angkorteam .fintech .helper .ClientHelper ;
3432import com .angkorteam .fintech .layout .Size ;
@@ -222,24 +220,6 @@ public class ClientCreatePage extends Page {
222220 protected Date submittedOnValue ;
223221 protected DateTextField submittedOnField ;
224222
225- protected UIRow row12 ;
226-
227- protected UIBlock externalIdBlock ;
228- protected UIContainer externalIdIContainer ;
229- protected String externalIdValue ;
230- protected TextField <String > externalIdField ;
231-
232- protected UIBlock openSavingsAccountBlock ;
233- protected UIContainer openSavingsAccountIContainer ;
234- protected Boolean openSavingsAccountValue ;
235- protected CheckBox openSavingsAccountField ;
236-
237- protected UIBlock savingsAccountBlock ;
238- protected UIContainer savingsAccountIContainer ;
239- protected SingleChoiceProvider savingsAccountProvider ;
240- protected Option savingsAccountValue ;
241- protected Select2SingleChoice <Option > savingsAccountField ;
242-
243223 protected UIRow row13 ;
244224
245225 protected UIBlock familyMemberBlock ;
@@ -425,7 +405,7 @@ protected void initComponent() {
425405 this .remarkIContainer .add (this .remarkField );
426406 this .remarkIContainer .newFeedback ("remarkFeedback" , this .remarkField );
427407
428- this .row10Block1 = this .row10 .newUIBlock ("row10lock1 " , Size .Six_6 );
408+ this .row10Block1 = this .row10 .newUIBlock ("row10Block1 " , Size .Six_6 );
429409
430410 this .row11 = UIRow .newUIRow ("row11" , this .form );
431411
@@ -447,26 +427,6 @@ protected void initComponent() {
447427 this .submittedOnIContainer .add (this .submittedOnField );
448428 this .submittedOnIContainer .newFeedback ("submittedOnFeedback" , this .submittedOnField );
449429
450- this .row12 = UIRow .newUIRow ("row12" , this .form );
451-
452- this .openSavingsAccountBlock = this .row12 .newUIBlock ("openSavingsAccountBlock" , Size .Four_4 );
453- this .openSavingsAccountIContainer = this .openSavingsAccountBlock .newUIContainer ("openSavingsAccountIContainer" );
454- this .openSavingsAccountField = new CheckBox ("openSavingsAccountField" , new PropertyModel <>(this , "openSavingsAccountValue" ));
455- this .openSavingsAccountIContainer .add (this .openSavingsAccountField );
456- this .openSavingsAccountIContainer .newFeedback ("openSavingsAccountFeedback" , this .openSavingsAccountField );
457-
458- this .externalIdBlock = this .row12 .newUIBlock ("externalIdBlock" , Size .Four_4 );
459- this .externalIdIContainer = this .externalIdBlock .newUIContainer ("externalIdIContainer" );
460- this .externalIdField = new TextField <>("externalIdField" , new PropertyModel <>(this , "externalIdValue" ));
461- this .externalIdIContainer .add (this .externalIdField );
462- this .externalIdIContainer .newFeedback ("externalIdFeedback" , this .externalIdField );
463-
464- this .savingsAccountBlock = this .row12 .newUIBlock ("savingsAccountBlock" , Size .Four_4 );
465- this .savingsAccountIContainer = this .savingsAccountBlock .newUIContainer ("savingsAccountIContainer" );
466- this .savingsAccountField = new Select2SingleChoice <>("savingsAccountField" , new PropertyModel <>(this , "savingsAccountValue" ), this .savingsAccountProvider );
467- this .savingsAccountIContainer .add (this .savingsAccountField );
468- this .savingsAccountIContainer .newFeedback ("savingsAccountFeedback" , this .savingsAccountField );
469-
470430 this .row13 = UIRow .newUIRow ("row13" , this .form );
471431
472432 this .familyMemberBlock = this .row13 .newUIBlock ("familyMemberBlock" , Size .Twelve_12 );
@@ -487,7 +447,6 @@ protected void initComponent() {
487447 @ Override
488448 protected void initData () {
489449 StringGenerator generator = SpringBean .getBean (StringGenerator .class );
490- this .externalIdValue = generator .externalId ();
491450 this .popupModel = Maps .newHashMap ();
492451
493452 this .officeProvider = new SingleChoiceProvider (MOffice .NAME , MOffice .Field .ID , MOffice .Field .NAME );
@@ -507,9 +466,6 @@ protected void initData() {
507466
508467 this .constitutionProvider = new ConstitutionProvider ();
509468
510- this .savingsAccountProvider = new SingleChoiceProvider (MSavingsProduct .NAME , MSavingsProduct .Field .ID , MSavingsProduct .Field .NAME );
511- this .savingsAccountProvider .applyWhere ("deposit_type_enum" , MSavingsProduct .Field .DEPOSIT_TYPE_ENUM + " = " + DepositType .Saving .getLiteral ());
512-
513469 this .familyMemberColumn = Lists .newLinkedList ();
514470 this .familyMemberColumn .add (new TextColumn (Model .of ("Relationship" ), "relationship" , "relationship" , this ::familyMemberColumn ));
515471 this .familyMemberColumn .add (new TextColumn (Model .of ("First Name" ), "firstName" , "firstName" , this ::familyMemberColumn ));
@@ -532,13 +488,6 @@ protected void initData() {
532488
533489 @ Override
534490 protected void configureMetaData () {
535- this .savingsAccountField .setLabel (Model .of ("Savings Account" ));
536- this .savingsAccountField .add (new OnChangeAjaxBehavior ());
537-
538- this .externalIdField .setLabel (Model .of ("External ID" ));
539- this .externalIdField .add (new OnChangeAjaxBehavior ());
540-
541- this .openSavingsAccountField .add (new OnChangeAjaxBehavior (this ::openSavingsAccountFieldUpdate ));
542491
543492 this .submittedOnField .setLabel (Model .of ("Submitted On" ));
544493 this .submittedOnField .add (new OnChangeAjaxBehavior ());
@@ -607,7 +556,6 @@ protected void configureMetaData() {
607556 legalFormFieldUpdate (null );
608557 officeFieldUpdate (null );
609558 activeFieldUpdate (null );
610- openSavingsAccountFieldUpdate (null );
611559 }
612560
613561 protected boolean familyMemberAddLinkClick (AjaxLink <Void > link , AjaxRequestTarget target ) {
@@ -670,15 +618,6 @@ protected void modalWindowClose(String popupName, String signalId, AjaxRequestTa
670618 target .add (this .familyMemberTable );
671619 }
672620
673- protected boolean openSavingsAccountFieldUpdate (AjaxRequestTarget target ) {
674- boolean visible = this .openSavingsAccountValue == null ? false : this .openSavingsAccountValue ;
675- this .savingsAccountIContainer .setVisible (visible );
676- if (target != null ) {
677- target .add (this .savingsAccountBlock );
678- }
679- return false ;
680- }
681-
682621 protected boolean activeFieldUpdate (AjaxRequestTarget target ) {
683622 boolean visible = this .activeValue == null ? false : this .activeValue ;
684623 this .activationDateIContainer .setVisible (visible );
@@ -745,6 +684,8 @@ protected boolean legalFormFieldUpdate(AjaxRequestTarget target) {
745684 }
746685
747686 protected void saveButtonSubmit (Button button ) {
687+ StringGenerator generator = SpringBean .getBean (StringGenerator .class );
688+
748689 LegalForm legalForm = null ;
749690 if (this .legalFormValue != null ) {
750691 legalForm = LegalForm .valueOf (this .legalFormValue .getId ());
@@ -785,15 +726,12 @@ protected void saveButtonSubmit(Button button) {
785726 if (this .clientTypeValue != null ) {
786727 builder .withClientTypeId (this .clientTypeValue .getId ());
787728 }
788- builder .withExternalId (this . externalIdValue );
729+ builder .withExternalId (generator . externalId () );
789730 boolean active = this .activeValue == null ? false : this .activeValue ;
790731 if (active ) {
791732 builder .withActivationDate (this .activationDateValue );
792733 }
793734 builder .withActive (active );
794- if (this .openSavingsAccountValue != null && this .openSavingsAccountValue ) {
795- builder .withSavingsProductId (this .savingsAccountValue .getId ());
796- }
797735 builder .withSubmittedOnDate (this .submittedOnValue );
798736
799737 for (Map <String , Object > item : this .familyMemberValue ) {
0 commit comments