Sha256: 9fa7e74f873738685c66631c27f8eb08fc4593af3ce50fa99bd6902c55931e6c

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

RenderPosting = (props) ->
    contents = _.map props.value, (posting, i) ->
        <span className='posting' key={i}>
            {posting.account_number}
            <SC.Currency amount={posting.amount} />
        </span>
    <div>{contents}</div>

class Transactions extends Skr.Models.Base

    query: new Lanes.Models.Query
        title: 'Lines', src: Skr.Models.GlTransaction
        syncOptions: { with: ['with_details'] }
        fields: [
            { id: 'id', visible: false }
            { id: 'created_at', title: 'Date', format: Lanes.u.format.shartDate, fixedWidth: 100 }
            { id: 'debit_details',  title: 'Debit',  component: RenderPosting }
            { id: 'credit_details', title: 'Credit', component: RenderPosting }
            { id: 'source_type', fixedWidth: 180  }
            { id: 'description' }
        ]

    associations:
        account: { model: "GlAccount" }

    events:
        'change:account': 'onAccountChange'

    onAccountChange: (account) ->
        acct_num = if @account?.number then "#{@account.number}%" else ''
        @query.syncOptions = { with: { with_details: acct_num } }
        @query.results.reload()

class Skr.Screens.GlTransactions extends Skr.Screens.Base

    modelForAccess: 'gl-transaction'

    dataObjects:
        transactions: -> new Transactions(account: @props.account)

    render: ->
        <LC.ScreenWrapper flexVertical identifier="gl-transactions">
            <h3>GL Transactions</h3>
            <SC.GlAccountChooser model={@transactions} name='account' editOnly sm={4} />
            <LC.Grid query={@transactions.query} />
        </LC.ScreenWrapper>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stockor-0.3.0 client/skr/screens/gl-transactions/GlTransactions.cjsx
stockor-0.2 client/skr/screens/gl-transactions/GlTransactions.cjsx