Sha256: f4c13ff27f2a093f088e72bf695eb6a74458e78530263c0807a79d124d22ff3f

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

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

    propTypes:
        onModelSet: React.PropTypes.func
        commands:   React.PropTypes.object
        autoFocus:  React.PropTypes.bool
        name:       React.PropTypes.string
        selectField:   React.PropTypes.bool

    getDefaultProps: ->
        autoFocus: false, label: 'Project Code', name: 'code'

    dataObjects:
        query: ->
            new Lanes.Models.Query({
                autoRetrieve: true, syncOptions:
                    include: [ 'customer', 'sku' ]
                    with: ['with_details']
                title: 'Customer Project'
                src: Skr.Models.CustomerProject, fields: [
                    { id:'id', visible: false     }
                    { id: 'code', fixedWidth: 120 }
                    { id: 'po_num', flex: 1       }
                    { id: 'description', flex: 2  }
                    { id: 'customer_code', fixedWidth: 140 }
                ]
            })

    select: (model, proj) ->
        if @props.onModelSet
            @props.onModelSet(proj)
        else
            model.set(customer_project: proj)

    render: ->
        props = _.clone(@props)

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

Version data entries

1 entries across 1 versions & 1 rubygems

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