TextInput $set doesn't work on Mask
TextInput::make('dp')
->label('DP')
->reactive()
->afterStateUpdated(function ($state, callable $get, callable $set, $component) {
$total = 0;
foreach ($get('invoice_items') as $item) {
$total += ($item['unit_price'] * $item['qty']);
}
$due = $total - $state;
$set('due_payment', $due);
})
->numeric()
->mask(
fn (TextInput\Mask $mask) => $mask
->patternBlocks([
'money' => fn (Mask $mask) => $mask
->numeric()
->thousandsSeparator(',')
->decimalSeparator('.'),
])
->pattern('Rp money'),
)
->required(),
TextInput::make('due_payment')
->label('Sisa Pembayaran')
->disabled()
->numeric()
->mask(
fn (TextInput\Mask $mask) => $mask
->patternBlocks([
'money' => fn (Mask $mask) => $mask
->numeric()
->thousandsSeparator(',')
->decimalSeparator('.'),
])
->pattern('Rp money'),
),Its doesn't set the due_payment, but when i remove the the Mask on due_payment its work