Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Forms\Components\TextInput::make('loan_amount')
- ->required()
- ->prefix('₱')
- ->label('Loan Amount')
- ->live(onBlur: true)
- ->numeric()
- ->afterStateUpdated(function ($state, $set, $get) {
- $loanType = $get('loan_type');
- switch ($loanType) {
- case 'Sangla Below 5,000':
- $set('copy_capitalBuildUp', 0.03);
- $set('copy_savings_deposit_2', 0.02);
- $set('copy_savings_deposit', 0.02);
- $set('copy_interest', 0.01);
- $set('copy_service_fee', 0.025);
- break;
- case 'Sangla Above 5,000':
- $set('copy_capitalBuildUp', 0.03);
- $set('copy_savings_deposit_2', 0.02);
- $set('copy_interest', 0.01);
- $set('copy_service_fee', 0.025);
- $set('copy_insurance', 0.85);
- break;
- }
- }),
- Forms\Components\TextInput::make('copy_capitalBuildUp')
- ->label('Capital Build Up')
- ->numeric()
- ->live()
- // I should use other method here since this was already define by loan amount, I need some triggers here that once it change it will update the capitalBuildUp
- ->afterStateUpdated(function($state, $get, $set){
- $loanAmount = $get('loan_amount');
- $total = $loanAmount * $state;
- $set('capitalBuildUp', 'test');
- }),
- Forms\Components\TextInput::make('capitalBuildUp')
- ->readOnly()
- ->label('Capital Build Up')
- ->numeric(),
Advertisement
Add Comment
Please, Sign In to add comment