stockor 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +15 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +97 -193
- data/client/skr/Extension.coffee +8 -4
- data/client/skr/api.js +21 -0
- data/client/skr/api.scss +148 -0
- data/client/skr/api/Components/AddressForm.cjsx +47 -0
- data/client/skr/api/Components/Base.coffee +7 -0
- data/client/skr/api/Components/SaleHistory.cjsx +32 -0
- data/client/skr/api/Components/SingleItemCart.cjsx +30 -0
- data/client/skr/api/Models/Base.coffee +10 -0
- data/client/skr/api/Models/Cart.coffee +40 -0
- data/client/skr/api/Models/Sale.coffee +43 -0
- data/client/skr/api/Models/SalesHistory.coffee +17 -0
- data/client/skr/api/Models/Sku.coffee +16 -0
- data/client/skr/api/SingleItemCheckout.cjsx +99 -0
- data/client/skr/api/namespace.js +6 -0
- data/client/skr/api/onReady.coffee +23 -0
- data/client/skr/components/CreditCardForm.cjsx +35 -0
- data/client/skr/components/CustomerFinder.cjsx +0 -3
- data/client/skr/components/InvoiceFinder.cjsx +1 -0
- data/client/skr/components/LatexSnippets.cjsx +65 -0
- data/client/skr/components/LocationChooser.cjsx +5 -1
- data/client/skr/components/PrintButton.cjsx +33 -0
- data/client/skr/components/PrintFormChooser.cjsx +10 -10
- data/client/skr/components/SalesOrderFinder.cjsx +2 -1
- data/client/skr/components/SystemSettings.cjsx +69 -9
- data/client/skr/components/address/index.js +1 -0
- data/client/skr/models/Address.coffee +3 -0
- data/client/skr/models/CreditCard.coffee +49 -0
- data/client/skr/models/CreditCardGateway.coffee +27 -0
- data/client/skr/models/Invoice.coffee +13 -5
- data/client/skr/models/Location.coffee +6 -4
- data/client/skr/models/Payment.coffee +33 -13
- data/client/skr/models/SalesOrder.coffee +7 -3
- data/client/skr/models/SequentialId.coffee +17 -0
- data/client/skr/models/Sku.coffee +1 -1
- data/client/skr/models/TimeEntry.coffee +3 -4
- data/client/skr/models/mixins/PrintSupport.coffee +4 -1
- data/client/skr/models/mixins/SkuLine.coffee +1 -1
- data/client/skr/screens/customer-maint/CustomerMaint.cjsx +1 -2
- data/client/skr/screens/customer-projects/CustomerProjects.cjsx +7 -3
- data/client/skr/screens/customer-projects/index.scss +1 -0
- data/client/skr/screens/fresh-books-import/ApiInfo.cjsx +1 -1
- data/client/skr/screens/gl-accounts/GlAccounts.cjsx +1 -1
- data/client/skr/screens/gl-transactions/GlTransactions.cjsx +1 -1
- data/client/skr/screens/invoice/Invoice.cjsx +9 -17
- data/client/skr/screens/invoice/Payment.cjsx +94 -13
- data/client/skr/screens/invoice/index.scss +32 -0
- data/client/skr/screens/locations/Locations.cjsx +3 -2
- data/client/skr/screens/payment-category/PaymentCategory.cjsx +1 -1
- data/client/skr/screens/payments/Payments.cjsx +5 -4
- data/client/skr/screens/sale-report/SaleReport.cjsx +73 -0
- data/client/skr/screens/sale-report/index.js +5 -0
- data/client/skr/screens/sale-report/index.scss +9 -0
- data/client/skr/screens/sales-order/SalesOrder.cjsx +4 -4
- data/client/skr/screens/sku-maint/SkuMaint.cjsx +5 -0
- data/client/skr/screens/sku-maint/SkuUomList.cjsx +45 -56
- data/client/skr/screens/sku-maint/index.scss +33 -13
- data/client/skr/screens/time-invoicing/TimeInvoicing.cjsx +2 -2
- data/client/skr/screens/time-tracking/EditEntry.cjsx +2 -4
- data/client/skr/screens/time-tracking/TimeTracking.cjsx +1 -1
- data/client/skr/screens/vendor-maint/VendorMaint.cjsx +1 -1
- data/client/skr/vendor/index.js +2438 -0
- data/config/lanes.rb +10 -3
- data/config/routes.rb +9 -7
- data/config/screens.rb +39 -13
- data/db/migrate/20160517032350_create_remove_location_logos.rb +11 -0
- data/db/migrate/20160531014306_create_public_skus.rb +7 -0
- data/db/migrate/20160604195848_create_null_addresses.rb +9 -0
- data/db/migrate/20160605024432_create_sku_associations_views.rb +48 -0
- data/db/migrate/20160608023553_create_invoice_payments.rb +9 -0
- data/db/migrate/20160620010455_add_payments_to_inv_details.rb +54 -0
- data/db/schema.sql +206 -38
- data/db/seed.rb +6 -0
- data/lib/skr.rb +1 -1
- data/lib/skr/access_roles.rb +6 -1
- data/lib/skr/concerns/has_gl_transaction.rb +8 -0
- data/lib/skr/concerns/inv_extensions.rb +11 -0
- data/lib/skr/concerns/is_order_like.rb +3 -3
- data/lib/skr/concerns/visible_id_identifier.rb +3 -8
- data/lib/skr/configuration.rb +2 -0
- data/lib/skr/extension.rb +6 -0
- data/lib/skr/handlers/credit_card_gateway.rb +31 -0
- data/lib/skr/handlers/invoice_from_time_entries.rb +12 -26
- data/lib/skr/handlers/sales.rb +44 -0
- data/lib/skr/handlers/sequential_ids.rb +46 -0
- data/lib/skr/handlers/skus.rb +36 -0
- data/lib/skr/jobs/fresh_books/import.rb +3 -1
- data/lib/skr/merchant_gateway.rb +37 -0
- data/lib/skr/models/address.rb +7 -5
- data/lib/skr/models/bank_account.rb +12 -0
- data/lib/skr/models/business_entity.rb +1 -1
- data/lib/skr/models/gl_transaction.rb +3 -0
- data/lib/skr/models/inv_line.rb +7 -2
- data/lib/skr/models/inventory_adjustment.rb +0 -5
- data/lib/skr/models/invoice.rb +25 -36
- data/lib/skr/models/location.rb +1 -1
- data/lib/skr/models/payment.rb +56 -10
- data/lib/skr/models/po_receipt.rb +0 -8
- data/lib/skr/models/sales_order.rb +7 -2
- data/lib/skr/models/sequential_id.rb +6 -1
- data/lib/skr/models/sku.rb +3 -0
- data/lib/skr/print.rb +1 -0
- data/lib/skr/print/context.rb +19 -0
- data/lib/skr/print/form.rb +7 -1
- data/lib/skr/version.rb +1 -1
- data/npm-build/package.json +26 -0
- data/npm-build/vendor.js +10 -0
- data/npm-build/webpack.config.js +25 -0
- data/spec/fixtures/skr/bank_account.yml +9 -0
- data/spec/fixtures/skr/customer.yml +10 -0
- data/spec/fixtures/skr/inv_line.yml +12 -0
- data/spec/fixtures/skr/invoice.yml +17 -0
- data/spec/fixtures/skr/payment_category.yml +6 -0
- data/spec/fixtures/skr/sales_order.yml +1 -1
- data/spec/fixtures/skr/sku.yml +10 -0
- data/spec/fixtures/skr/sku_loc.yml +4 -0
- data/spec/fixtures/skr/uom.yml +6 -0
- data/spec/server/handlers/invoice_from_time_entries_spec.rb +13 -6
- data/spec/server/handlers/sequential_ids_spec.rb +22 -0
- data/spec/server/models/invoice_spec.rb +36 -0
- data/spec/server/models/payment_spec.rb +50 -22
- data/spec/server/models/sales_order_spec.rb +12 -0
- data/spec/server/print/form_spec.rb +20 -4
- data/spec/skr/api/SingleItemCheckoutSpec.cjsx +10 -0
- data/spec/skr/screens/sale-report/SaleReportSpec.coffee +5 -0
- data/stockor.gemspec +5 -4
- data/templates/print/layout.tex.erb +1 -1
- data/templates/print/packages/INSTALL +7 -0
- data/templates/print/packages/qrcode.sty +3051 -0
- data/templates/print/packages/svgnam.def +186 -0
- data/templates/print/packages/x11nam.def +352 -0
- data/templates/print/packages/xcolor.pro +58 -0
- data/templates/print/packages/xcolor.sty +1460 -0
- data/templates/print/types/invoice/default.tex.erb +2 -0
- data/templates/print/types/invoice/labor.tex.erb +2 -1
- data/templates/print/types/invoice/ticket.tex.erb +41 -0
- data/templates/print/types/payment/default.tex.erb +13 -12
- metadata +78 -12
@@ -1,28 +1,109 @@
|
|
1
|
+
##=require skr/vendor
|
2
|
+
|
1
3
|
class Skr.Screens.Invoice.Payment extends Lanes.React.Component
|
2
4
|
|
5
|
+
statics:
|
6
|
+
onPayment: (modal, ev) ->
|
7
|
+
{invoice, payment} = modal.refs.body
|
8
|
+
payment.save(include: 'invoice').then (pymnt) ->
|
9
|
+
invoice.amount_paid = invoice.amount_paid.minus(pymnt.amount)
|
10
|
+
modal.hide() unless pymnt.hasErrors
|
11
|
+
|
12
|
+
display: (viewport, invoice) ->
|
13
|
+
viewport.displayModal
|
14
|
+
title: "Accept Payment", size: 'lg',
|
15
|
+
onCancel: (m) ->
|
16
|
+
unsaved = invoice.payments.filter (pymnt) -> not pymnt.isNew()
|
17
|
+
invoice.payments.remove(unsaved)
|
18
|
+
m.hide()
|
19
|
+
onOk: @onPayment, className: "invoice-payment"
|
20
|
+
invoice: invoice
|
21
|
+
body: Skr.Screens.Invoice.Payment
|
22
|
+
|
23
|
+
getInitialState: ->
|
24
|
+
type: 'credit-card'
|
25
|
+
|
3
26
|
dataObjects:
|
4
27
|
invoice: 'props'
|
5
|
-
|
6
|
-
|
7
|
-
|
28
|
+
payment: ->
|
29
|
+
payment = @props.invoice.payments.find (pymnt) -> pymnt.isNew()
|
30
|
+
payment ||= this.props.invoice.payments.add({
|
31
|
+
amount: @props.invoice.open_amount
|
32
|
+
})
|
33
|
+
payment
|
8
34
|
|
9
35
|
onEnter: -> @props.modal.onButton()
|
10
36
|
|
11
|
-
|
12
|
-
|
37
|
+
onTypeChange: (ev) ->
|
38
|
+
@setState(type: ev.target.value)
|
39
|
+
|
40
|
+
visitPayment: (payment) ->
|
41
|
+
@props.modal.hide()
|
42
|
+
Lanes.Screens.Definitions.all.get('payments')
|
43
|
+
.display(props: {payment: payment})
|
44
|
+
|
45
|
+
PreviousPayments: (props) ->
|
46
|
+
previous = props.invoice.payments.filter (pymnt) -> not pymnt.isNew()
|
47
|
+
return null if _.isEmpty(previous)
|
48
|
+
|
49
|
+
<BS.Table striped bordered condensed className="prior-payments">
|
50
|
+
<thead>
|
51
|
+
<tr>
|
52
|
+
<th>ID</th>
|
53
|
+
<th>Date</th>
|
54
|
+
<th>Info</th>
|
55
|
+
<th className="align-right">Amount</th>
|
56
|
+
</tr>
|
57
|
+
</thead>
|
58
|
+
<tbody>
|
59
|
+
{for pym in previous
|
60
|
+
<tr key={pym.id}>
|
61
|
+
<td><a onClick={_.partial(@visitPayment, pym)}>{pym.visible_id}</a></td>
|
62
|
+
<td>{Lanes.u.format.shortDateTime(pym.date)}</td>
|
63
|
+
<td>{pym.describe()}</td>
|
64
|
+
<td className="align-right">{Lanes.u.format.currency(pym.amount)}</td>
|
65
|
+
</tr>}
|
66
|
+
</tbody>
|
67
|
+
</BS.Table>
|
68
|
+
|
69
|
+
NewPayment: (props) ->
|
70
|
+
{invoice} = props
|
71
|
+
return null if invoice.isPaidInFull()
|
72
|
+
|
73
|
+
<div className="new-payment">
|
74
|
+
<BS.FormGroup className="toggles">
|
75
|
+
<BS.Radio onChange={@onTypeChange}
|
76
|
+
checked={@state.type is 'cash'}
|
77
|
+
name="type" value="cash" inline>Cash</BS.Radio>
|
78
|
+
<BS.Radio onChange={@onTypeChange}
|
79
|
+
checked={@state.type is 'credit-card'}
|
80
|
+
name="type" value="credit-card" inline>Credit Card</BS.Radio>
|
81
|
+
</BS.FormGroup>
|
82
|
+
|
13
83
|
<BS.Row>
|
84
|
+
{<Skr.Components.CreditCardForm
|
85
|
+
card={@payment.credit_card } /> if @state.type is 'credit-card'}
|
86
|
+
</BS.Row>
|
87
|
+
|
88
|
+
<LC.ErrorDisplay model={@payment} />
|
14
89
|
|
90
|
+
<BS.Row className="input-fields">
|
15
91
|
<LC.DisplayValue name='total' getValue={->
|
16
|
-
|
17
|
-
} model={
|
92
|
+
Lanes.u.format.currency(@total)
|
93
|
+
} model={invoice} align='right' />
|
18
94
|
|
19
95
|
<LC.DisplayValue name='prev_amount_paid' label='Amount Paid' getValue={->
|
20
|
-
|
21
|
-
} model={
|
22
|
-
|
23
|
-
<LC.Input label='Amount' editOnly autoFocus getValue={->
|
24
|
-
_.sprintf('%0.2f', Number(@amount_paid))
|
25
|
-
} onEnter={@onEnter} name='amount_paid' align='right' model={@invoice} />
|
96
|
+
Lanes.u.format.currency(@amount_paid)
|
97
|
+
} model={invoice} align='right' />
|
26
98
|
|
99
|
+
<LC.NumberInput label='Amount' editOnly autoFocus getValue={->
|
100
|
+
Lanes.u.format.currency(@amount)
|
101
|
+
} onEnter={@onEnter} name='amount' align='right' model={@payment} />
|
27
102
|
</BS.Row>
|
103
|
+
</div>
|
104
|
+
|
105
|
+
render: ->
|
106
|
+
<LC.ScreenWrapper identifier="payment">
|
107
|
+
<@PreviousPayments invoice={@invoice} />
|
108
|
+
<@NewPayment invoice={@invoice} />
|
28
109
|
</LC.ScreenWrapper>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
.invoice {
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
}
|
6
|
+
|
7
|
+
.invoice-payment {
|
8
|
+
.credit-card-form {
|
9
|
+
display: flex;
|
10
|
+
justify-content: space-around;
|
11
|
+
align-items: center;
|
12
|
+
}
|
13
|
+
|
14
|
+
.input-fields {
|
15
|
+
display: flex;
|
16
|
+
justify-content: space-around;
|
17
|
+
margin-top: 15px;
|
18
|
+
padding-top: 15px;
|
19
|
+
border-top: 2px solid lightgray;
|
20
|
+
}
|
21
|
+
|
22
|
+
.toggles {
|
23
|
+
display: flex;
|
24
|
+
justify-content: flex-end;
|
25
|
+
align-items: center;
|
26
|
+
label {
|
27
|
+
input{ margin-top: 0; }
|
28
|
+
display: flex;
|
29
|
+
align-items: center;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Skr.Screens.Locations extends Skr.Screens.Base
|
2
2
|
|
3
3
|
syncOptions:
|
4
|
-
include: [ 'address' ]
|
4
|
+
include: [ 'address', 'logo' ]
|
5
5
|
|
6
6
|
dataObjects:
|
7
7
|
location: ->
|
@@ -18,11 +18,12 @@ class Skr.Screens.Locations extends Skr.Screens.Base
|
|
18
18
|
<SC.ScreenControls commands={@state.commands} />
|
19
19
|
<BS.Row>
|
20
20
|
<SC.LocationChooser label='Code' editOnly displayFinder
|
21
|
+
syncOptions={@syncOptions}
|
21
22
|
commands={@state.commands} model={@location} name="code" />
|
22
23
|
<LC.Input sm=6 name='name' model={@location} />
|
23
24
|
</BS.Row>
|
24
25
|
<BS.Row>
|
25
|
-
<LC.
|
26
|
+
<LC.ImageAsset sm=3 model={@location} name='logo' label='Logo' size='thumb' />
|
26
27
|
</BS.Row>
|
27
28
|
<BS.Row>
|
28
29
|
<SC.Address lg=6 model={@location.address} />
|
@@ -15,7 +15,7 @@ class Skr.Screens.PaymentCategory extends Skr.Screens.Base
|
|
15
15
|
<SC.ScreenControls commands={@state.commands} />
|
16
16
|
<BS.Row>
|
17
17
|
|
18
|
-
<SC.PaymentCategoryFinder name='code'
|
18
|
+
<SC.PaymentCategoryFinder name='code' editOnly
|
19
19
|
commands={@state.commands} model={@category} />
|
20
20
|
|
21
21
|
<LC.Input sm=9 name='name' model={@category} />
|
@@ -32,15 +32,16 @@ class Skr.Screens.Payments extends Skr.Screens.Base
|
|
32
32
|
<LC.ScreenWrapper identifier="payments">
|
33
33
|
<SC.ScreenControls commands={@state.commands} />
|
34
34
|
<BS.Row>
|
35
|
-
<LC.RecordFinder ref="finder" sm=3 autoFocus
|
35
|
+
<LC.RecordFinder ref="finder" sm=3 autoFocus editOnly
|
36
36
|
commands={@state.commands} model={@category}
|
37
37
|
label='Payment ID' name='visible_id' model={@payment} query={@query}
|
38
38
|
/>
|
39
|
-
<SC.
|
39
|
+
<SC.LocationChooser hideSingle sm=2 model={@payment} />
|
40
|
+
<SC.BankAccountFinder selectField name='bank_account'
|
40
41
|
model={@payment} />
|
41
42
|
<SC.PaymentCategoryFinder selectField name='category' labelField='code'
|
42
43
|
model={@payment} />
|
43
|
-
<LC.DateTime
|
44
|
+
<LC.DateTime name='date' format='ddd, MMM Do YYYY'
|
44
45
|
sm=3 model={@payment} />
|
45
46
|
</BS.Row>
|
46
47
|
<BS.Row>
|
@@ -50,7 +51,7 @@ class Skr.Screens.Payments extends Skr.Screens.Base
|
|
50
51
|
<LC.NumberInput smOffset=1 sm=3 name="amount" align='right' model={@payment} />
|
51
52
|
</BS.Row>
|
52
53
|
<BS.Row>
|
53
|
-
<LC.
|
54
|
+
<LC.TextArea smOffset=2 sm=6 name="address" model={@payment} />
|
54
55
|
</BS.Row>
|
55
56
|
<BS.Row>
|
56
57
|
<LC.Input sm=12 name="notes" model={@payment} />
|
@@ -0,0 +1,73 @@
|
|
1
|
+
class Filters extends Lanes.Models.State
|
2
|
+
|
3
|
+
session:
|
4
|
+
start_at: type: 'date', default: -> _.moment().subtract(1, 'week').toDate()
|
5
|
+
end_at: type: 'date', default: -> new Date()
|
6
|
+
sku: type: 'state'
|
7
|
+
customer: type: 'state'
|
8
|
+
|
9
|
+
derived:
|
10
|
+
query: deps: ['start_at', 'end_at', 'sku', 'customer'], fn: ->
|
11
|
+
options =
|
12
|
+
with: {'with_details': true}
|
13
|
+
query:
|
14
|
+
invoice_date:
|
15
|
+
op: 'in', value: [ @start_at.toISOString(), @end_at.toISOString() ]
|
16
|
+
if @sku
|
17
|
+
options['with']['with_sku_id'] = @sku.id
|
18
|
+
if @customer
|
19
|
+
options['query']['customer_id'] = @customer.id
|
20
|
+
new Lanes.Models.Query
|
21
|
+
title: 'Lines', src: Skr.Models.Invoice
|
22
|
+
syncOptions: options
|
23
|
+
fields: [
|
24
|
+
{ id: 'id', visible: false }
|
25
|
+
{ id: 'visible_id', title: 'Invoice #', fixedWidth: 100}
|
26
|
+
{ id: 'invoice_date', title: 'Date', format: Lanes.u.format.shortDate, fixedWidth: 100 }
|
27
|
+
{ id: 'customer_code', title: 'Customer', fixedWidth: 120}
|
28
|
+
|
29
|
+
{ id: 'customer_name' }
|
30
|
+
{
|
31
|
+
id: 'invoice_total', title: 'Total', fixedWidth: 120,
|
32
|
+
textAlign: 'right', format: Lanes.u.format.currency
|
33
|
+
}
|
34
|
+
]
|
35
|
+
|
36
|
+
|
37
|
+
class Skr.Screens.SaleReport extends Skr.Screens.Base
|
38
|
+
|
39
|
+
dataObjects:
|
40
|
+
filters: -> new Filters
|
41
|
+
|
42
|
+
resetQuery: ->
|
43
|
+
@filters.clear()
|
44
|
+
|
45
|
+
onPrint: (isPrinting) ->
|
46
|
+
@setState({isPrinting})
|
47
|
+
if isPrinting
|
48
|
+
@filters.query.results.loadFully()
|
49
|
+
|
50
|
+
|
51
|
+
render: ->
|
52
|
+
props = {sm:3, xs: 4, writable: true, editOnly: true, model: @filters, step: 15}
|
53
|
+
<LC.ScreenWrapper flexVertical identifier="sales-report">
|
54
|
+
<BS.Panel header={
|
55
|
+
<LC.PanelHeader title="Sales Report">
|
56
|
+
<SC.PrintButton onPrint={@onPrint} iconOnly />
|
57
|
+
<LC.Icon onClick={@resetQuery} type="repeat" noPrint />
|
58
|
+
</LC.PanelHeader>
|
59
|
+
}>
|
60
|
+
<BS.Row>
|
61
|
+
<LC.DateTime {...props} name="start_at"/>
|
62
|
+
<LC.DateTime {...props} name="end_at"/>
|
63
|
+
<SC.SkuFinder {...props}
|
64
|
+
parentModel={@filters} associationName='sku' />
|
65
|
+
<SC.CustomerFinder {...props} name='code'
|
66
|
+
parentModel={@filters} associationName='customer' />
|
67
|
+
|
68
|
+
</BS.Row>
|
69
|
+
</BS.Panel>
|
70
|
+
<LC.Grid
|
71
|
+
renderCompleteResults={@state.isPrinting}
|
72
|
+
query={@filters.query} />
|
73
|
+
</LC.ScreenWrapper>
|
@@ -26,8 +26,9 @@ class Skr.Screens.SalesOrder extends Lanes.React.Screen
|
|
26
26
|
syncOptions={@syncOptions} model={@sales_order}
|
27
27
|
commands={@state.commands} />
|
28
28
|
|
29
|
-
<SC.CustomerFinder
|
30
|
-
|
29
|
+
<SC.CustomerFinder
|
30
|
+
syncOptions={ include: ['billing_address', 'shipping_address' ] }
|
31
|
+
selectField sm=3 xs=4 model={@sales_order} />
|
31
32
|
|
32
33
|
<LC.Input sm=3 xs=4 name='po_num' model={@sales_order} />
|
33
34
|
|
@@ -43,8 +44,7 @@ class Skr.Screens.SalesOrder extends Lanes.React.Screen
|
|
43
44
|
</BS.Row>
|
44
45
|
|
45
46
|
<BS.Row>
|
46
|
-
<LC.
|
47
|
-
type='textarea'
|
47
|
+
<LC.TextArea sm=12
|
48
48
|
name="notes"
|
49
49
|
model={@sales_order} />
|
50
50
|
</BS.Row>
|
@@ -34,6 +34,11 @@ class Skr.Screens.SkuMaint extends Skr.Screens.Base
|
|
34
34
|
<Skr.Screens.SkuMaint.SkuUomList label={"UOMs"} model={@sku} name='uoms' sm=4 />
|
35
35
|
</BS.Row>
|
36
36
|
<BS.Row>
|
37
|
+
<LC.ToggleField sm=2
|
38
|
+
label="Is Public?"
|
39
|
+
name="is_public"
|
40
|
+
model={@sku} />
|
41
|
+
|
37
42
|
<LC.ToggleField sm=2
|
38
43
|
label="Other Charge?"
|
39
44
|
name="is_other_charge"
|
@@ -11,7 +11,7 @@ class UomList extends Lanes.Models.State
|
|
11
11
|
@expanded = expanded or @uoms.first()
|
12
12
|
|
13
13
|
save: ->
|
14
|
-
@sku.associations.replace(@sku, 'uoms', uoms)
|
14
|
+
@sku.associations.replace(@sku, 'uoms', @uoms)
|
15
15
|
@sku.default_uom_code = @default.code
|
16
16
|
|
17
17
|
add: ->
|
@@ -60,18 +60,16 @@ class UomEdit extends Lanes.React.Component
|
|
60
60
|
</span>
|
61
61
|
</div>
|
62
62
|
|
63
|
-
<BS.Panel ref="panel"
|
63
|
+
<BS.Panel ref="panel" collapsible
|
64
64
|
expanded={@list.expanded is @uom} header={header}>
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
model={@props.uom} wrapperClassName="col-xs-6"/>
|
74
|
-
|
65
|
+
<BS.Row>
|
66
|
+
<LC.Input type="text" label='Code'
|
67
|
+
name='code' model={@props.uom} xs=4 />
|
68
|
+
<LC.NumberInput type="number" label='Size' name='size' format='#,###'
|
69
|
+
model={@props.uom} xs=3 />
|
70
|
+
<LC.NumberInput type="text" label='Price' name='price'
|
71
|
+
model={@props.uom} xs=5 />
|
72
|
+
</BS.Row>
|
75
73
|
</BS.Panel>
|
76
74
|
|
77
75
|
|
@@ -121,11 +119,6 @@ class Skr.Screens.SkuMaint.SkuUomList extends Lanes.React.Component
|
|
121
119
|
getInitialState: ->
|
122
120
|
editing: false
|
123
121
|
|
124
|
-
renderDisplayValue: ->
|
125
|
-
value = @model.uoms.map (uom) ->
|
126
|
-
uom.combined
|
127
|
-
<span>{value.join(', ')}</span>
|
128
|
-
|
129
122
|
onEdit: (selected = @model.uoms.first()) ->
|
130
123
|
@setState
|
131
124
|
editing: new UomList(@model)
|
@@ -151,6 +144,7 @@ class Skr.Screens.SkuMaint.SkuUomList extends Lanes.React.Component
|
|
151
144
|
|
152
145
|
<BS.Popover
|
153
146
|
ref="popover"
|
147
|
+
className='sm'
|
154
148
|
id='sku-edit-uoms'
|
155
149
|
title={header} placement='left'>
|
156
150
|
|
@@ -167,43 +161,38 @@ class Skr.Screens.SkuMaint.SkuUomList extends Lanes.React.Component
|
|
167
161
|
</div>
|
168
162
|
</BS.Popover>
|
169
163
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
<BS.Col {...colProps}>
|
175
|
-
<div className={classNames}>
|
176
|
-
<label className='control-label'>
|
177
|
-
<div className="title">{label}</div>
|
178
|
-
</label>
|
179
|
-
<div className="input-group">
|
180
|
-
<div className="read-only form-control value" name={@props.name}>
|
181
|
-
<ul>
|
182
|
-
{@model.uoms.map (uom) =>
|
183
|
-
<UOMToken key={uom.cid} uom=uom onEdit={@onEdit} />}
|
184
|
-
</ul>
|
185
|
-
</div>
|
186
|
-
<span className="input-group-btn">
|
187
|
-
<BS.OverlayTrigger
|
188
|
-
trigger="click"
|
189
|
-
ref="overlay"
|
190
|
-
rootClose
|
191
|
-
arrowOffsetTop={'130px'}
|
192
|
-
container={@}
|
193
|
-
show={@state.editing}
|
194
|
-
onExit={@onCancel}
|
195
|
-
placement="left"
|
196
|
-
overlay={@renderEditingPopup()}>
|
197
|
-
|
198
|
-
<BS.Button ref="addButton" onClick={ =>
|
199
|
-
@onEdit(@model.uoms.first())}
|
200
|
-
>
|
201
|
-
<LC.Icon type="gear" />
|
202
|
-
</BS.Button>
|
203
|
-
</BS.OverlayTrigger>
|
204
|
-
|
205
|
-
</span>
|
206
|
-
</div>
|
164
|
+
renderDisplay: ->
|
165
|
+
value = @model.uoms.map (uom) ->
|
166
|
+
uom.combined
|
167
|
+
<span>{value.join(', ')}</span>
|
207
168
|
|
208
|
-
|
209
|
-
|
169
|
+
renderEdit: (props) ->
|
170
|
+
classNames = _.classnames('sku-uom-list', props.className)
|
171
|
+
|
172
|
+
<div className={classNames}>
|
173
|
+
<ul className="form-control">
|
174
|
+
{@model.uoms.map (uom) =>
|
175
|
+
<UOMToken key={uom.cid} uom=uom onEdit={@onEdit} />}
|
176
|
+
</ul>
|
177
|
+
<span className="input-group-btn">
|
178
|
+
|
179
|
+
<BS.OverlayTrigger
|
180
|
+
classNames={classNames}
|
181
|
+
trigger="click"
|
182
|
+
ref="overlay"
|
183
|
+
rootClose
|
184
|
+
arrowOffsetTop={'130px'}
|
185
|
+
container={@}
|
186
|
+
show={@state.editing}
|
187
|
+
onExit={@onCancel}
|
188
|
+
placement="left"
|
189
|
+
overlay={@renderEditingPopup()}>
|
190
|
+
|
191
|
+
<BS.Button ref="addButton" onClick={ =>
|
192
|
+
@onEdit(@model.uoms.first())}
|
193
|
+
>
|
194
|
+
<LC.Icon type="gear" />
|
195
|
+
</BS.Button>
|
196
|
+
</BS.OverlayTrigger>
|
197
|
+
</span>
|
198
|
+
</div>
|