Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #829 from harimayco/patch-money
Browse files Browse the repository at this point in the history
fix form type money parameter
  • Loading branch information
fherryfherry authored Sep 20, 2017
2 parents 9b9dbfa + 57ad0ae commit 1d4580a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
8 changes: 7 additions & 1 deletion docs/en/form-money.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ Input text with auto money number format
```php
$this->form[] = ['label'=>'Price','name'=>'price','type'=>'money'];
```
### Custom Money Format
```php
$this->form[] = ['label'=>'Price','name'=>'price','type'=>'money', 'priceformat_parameters' => ['prefix' => 'Rp. ', 'thousandsSeparator' => '.', 'centsSeparator' => ',', 'centsLimit' => 2 ]];
// Rp. 1.000,00
```
Add `priceformat_parameters` attribute value with [JQuery Price Format parameters](http://flaviosilveira.com/Jquery-Price-Format/)

## What's Next
- [Form Input Type: number](./form-number.md)

## Table Of Contents
- [Back To Index](./index.md)
- [Back To Index](./index.md)
21 changes: 10 additions & 11 deletions src/views/default/type_components/money/asset.blade.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
@push('bottom')
<script>
$(function() {
$('.inputMoney').priceFormat({
prefix: '',
@if($form['dec_point'])
thousandsSeparator: '{!! $form['dec_point']?: '' !!}',
@foreach($forms as $form)
@if($form['type'] == $type)
$('.inputMoney#{{ $form['name'] }}').priceFormat({!! json_encode(array_merge(array(
'prefix' => '',
'thousandsSeparator' => $form['dec_point'] ? : ',',
'centsLimit' => $form['decimals'] ? : '0',
'clearOnEmpty' => false,
), (array)$form['priceformat_parameters']
)) !!});
@endif
@if($form['decimals'])
centsLimit: {!! $form['decimals'] !!},
@else
centsLimit: 0,
@endif
clearOnEmpty:true,
});
@endforeach
});
</script>
@endpush

0 comments on commit 1d4580a

Please sign in to comment.