Sha256: 1720298bd83cf68460e15c41db2249eb26b54f2bb772879a7e073c35f131baa4

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

class Skr.Components.CustomerFinder extends Lanes.React.Component

    propTypes:
        model:      Lanes.PropTypes.Model.isRequired
        commands:   React.PropTypes.object
        autoFocus:  React.PropTypes.bool
        name:       React.PropTypes.string
        selectField:   React.PropTypes.bool

    getDefaultProps: ->
        autoFocus: false, label: 'Customer Code', name: 'customer'

    dataObjects:
        query: ->
            new Lanes.Models.Query({
                syncOptions: @props.syncOptions, autoRetrieve: true
                src: Skr.Models.Customer, fields: [
                    {id:'id', visible: false}
                    { id: 'code', fixedWidth: 130 }, 'name', 'notes',
                    { id: 'open_balance', fixedWidth: 100, textAlign: 'right', format: (v) ->
                        if v then _.bigDecimal(v).toFixed(2) else '0.00'
                    }
                ]
            })

    render: ->
        props = _.clone(@props)
        if @model.hasAttribute('customer_code')
            props.defaultLabel = @model.customer_code

        if props.selectField
            <LC.SelectField sm=2 labelField="code" {...props} />
        else
            <LC.RecordFinder ref="finder" sm=3 autoFocus
                commands={@props.commands}
                query={@query}
                {...props} />

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stockor-0.2 client/skr/components/CustomerFinder.cjsx