client/skr/screens/invoice/Invoice.cjsx in stockor-0.3.0 vs client/skr/screens/invoice/Invoice.cjsx in stockor-0.4.0
- old
+ new
@@ -3,11 +3,11 @@
class Skr.Screens.Invoice extends Skr.Screens.Base
syncOptions:
with: [ 'with_details' ]
- include: [ 'sales_order', 'billing_address', 'shipping_address', 'lines' ]
+ include: [ 'sales_order', 'billing_address', 'shipping_address', 'lines', 'payments' ]
dataObjects:
invoice: ->
@loadOrCreateModel({
syncOptions: @syncOptions, klass: Skr.Models.Invoice,
@@ -16,33 +16,23 @@
getInitialState: ->
commands: new Skr.Screens.Commands(this, modelName: 'invoice', print: true)
setSalesOrder: (so) -> @invoice.setFromSalesOrder(so)
- onPayment: -> @invoice.save()
- getPayment: ->
- @context.viewport.displayModal
- title: "Accept Payment", autoHide: true, size: 'sm', onOk: @onPayment,
- body: =>
- <Skr.Screens.Invoice.Payment invoice={@invoice} />
+ showPayment: ->
+ Skr.Screens.Invoice.Payment.display(@context.viewport, @invoice)
PaymentButton: ->
- return null if @invoice.isNew() or @invoice.isPaidInFull()
- <SC.ToolbarButton onClick={@getPayment}>
+ return null if @invoice.isNew()
+ <SC.ToolbarButton onClick={@showPayment}>
<LC.Icon type="money" />Payment
</SC.ToolbarButton>
shouldSaveLinesImmediately: ->
not @invoice.isNew()
- linesQueryBuilder: (attrs) ->
- unless this.invoice.isNew()
- sc = _.find attrs.fields, id: 'sku_code'
- sc.editable = false
- attrs
-
render: ->
<LC.ScreenWrapper identifier="invoice" flexVertical>
<SC.ScreenControls commands={@state.commands}>
<@PaymentButton />
@@ -53,13 +43,15 @@
model={@invoice} commands={@state.commands}
syncOptions={@syncOptions} />
<SC.SalesOrderFinder autoFocus={false} sm=2 xs=3 editOnly={false}
onModelSet={@setSalesOrder} associationName='sales_order'
- syncOptions={@syncOptions} parentModel={@invoice} />
+ syncOptions={ include: ['customer', 'billing_address', 'shipping_address' ] }
+ parentModel={@invoice} />
<SC.CustomerFinder
+ syncOptions={ include: ['billing_address', 'shipping_address' ] }
selectField sm=3 xs=6 model={@invoice} />
<SC.TermsChooser model={@invoice} sm=3 xs=6 />
<LC.DisplayValue sm=2 xs=4
@@ -76,10 +68,10 @@
<SC.LocationChooser sm=3 xs=4
label='Src Location' model={@invoice} />
</BS.Row>
<BS.Row>
- <LC.Input sm=12 type='textarea' name="notes" model={@invoice} />
+ <LC.TextArea name="notes" model={@invoice} xs=12 />
</BS.Row>
<BS.Row>
<LC.FieldSet sm=12 title="Address" expanded={@invoice.isNew()}>
<SC.Address lg=6 title="Billing"