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
@@ -0,0 +1 @@
|
|
1
|
+
//=require ./Address
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class Skr.Models.CreditCard extends Skr.Models.Base
|
2
|
+
|
3
|
+
props:
|
4
|
+
name: 'string'
|
5
|
+
number: 'string'
|
6
|
+
month: 'integer'
|
7
|
+
year: 'integer'
|
8
|
+
cvc: 'integer'
|
9
|
+
|
10
|
+
session:
|
11
|
+
parent: 'object'
|
12
|
+
expiry: 'string'
|
13
|
+
linkToAddress: 'object'
|
14
|
+
|
15
|
+
derived:
|
16
|
+
cardType:
|
17
|
+
deps: ['number'], fn: -> Skr.Vendor.Payment.fns.cardType(@number)
|
18
|
+
cardIsValid:
|
19
|
+
deps: ['name', 'number', 'month', 'year', 'cvc', 'cardType'], fn: ->
|
20
|
+
v = Skr.Vendor.Payment.fns
|
21
|
+
@name and _.trim(@name.length) > 2 and
|
22
|
+
@cardType and
|
23
|
+
v.validateCardNumber(@number) and
|
24
|
+
v.validateCardExpiry(@month, @year) and
|
25
|
+
v.validateCardCVC(@cvc, @cardType)
|
26
|
+
|
27
|
+
|
28
|
+
events:
|
29
|
+
'change:expiry': 'onExpiryChange'
|
30
|
+
'change:name': 'onNameChange'
|
31
|
+
|
32
|
+
initialize: ->
|
33
|
+
@listenTo(@linkToAddress, 'change:name', @onAddressNameChange) if @linkToAddress
|
34
|
+
|
35
|
+
onAddressNameChange: ->
|
36
|
+
if @name is @linkToAddress.previousAttributes().name
|
37
|
+
@name = @linkToAddress.name
|
38
|
+
|
39
|
+
onNameChange: ->
|
40
|
+
@parent.name = @name
|
41
|
+
|
42
|
+
onExpiryChange: ->
|
43
|
+
[@month, @year] = @expiry.split(' / ')
|
44
|
+
|
45
|
+
dataForSave: (options = {}) ->
|
46
|
+
attrs = super
|
47
|
+
# ActiveMerchant uses 'verification_value'
|
48
|
+
attrs.verification_value = attrs.cvc
|
49
|
+
attrs
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class Skr.Models.CreditCardGateway extends Skr.Models.Base
|
2
|
+
|
3
|
+
pubsub: false
|
4
|
+
|
5
|
+
props:
|
6
|
+
login: "string"
|
7
|
+
password: "string"
|
8
|
+
type: "string"
|
9
|
+
|
10
|
+
modelTypeIdentifier: -> 'credit-card-gateway'
|
11
|
+
|
12
|
+
@allTypes: ->
|
13
|
+
[
|
14
|
+
{id: 'authorize_net_gateway', name: 'AuthorizeNet' }
|
15
|
+
{id: 'balanced_gateway', name: 'Balanced' }
|
16
|
+
{id: 'card_stream_gateway', name: 'Card Stream' }
|
17
|
+
{id: 'first_pay_gateway', name: 'FirstPay' }
|
18
|
+
{id: 'global_transport_gateway', name: 'GlobalTransport' }
|
19
|
+
{id: 'link_point_gateway', name: 'Linkpoint' }
|
20
|
+
{id: 'paypal_express_gateway', name: 'Paypal Express' }
|
21
|
+
{id: 'paypal_gateway', name: 'Paypal' }
|
22
|
+
{id: 'sage_gateway', name: 'Sage' }
|
23
|
+
{id: 'sage_pay_gateway', name: 'SagePay' }
|
24
|
+
{id: 'secure_net_gateway', name: 'Secure Net' }
|
25
|
+
{id: 'secure_pay_gateway', name: 'Secure Pay' }
|
26
|
+
{id: 'stripe_gateway', name: 'Stripe' }
|
27
|
+
]
|
@@ -13,7 +13,6 @@ class Skr.Models.Invoice extends Skr.Models.Base
|
|
13
13
|
pick_ticket_id: "integer"
|
14
14
|
shipping_address_id:{type:"integer"}
|
15
15
|
billing_address_id: {type:"integer"}
|
16
|
-
amount_paid: {type:"bigdec", "default":"0"}
|
17
16
|
state: {type:"string"}
|
18
17
|
hash_code: {type:"string"}
|
19
18
|
invoice_date: {type:"date", default: ->
|
@@ -30,6 +29,7 @@ class Skr.Models.Invoice extends Skr.Models.Base
|
|
30
29
|
session:
|
31
30
|
customer_code: {type:"string"}
|
32
31
|
invoice_total: {type:"bigdec"}
|
32
|
+
amount_paid: {type:"bigdec", "default":"0"}
|
33
33
|
|
34
34
|
derived:
|
35
35
|
prev_amount_paid: deps:['updated_at'], fn: -> @amount_paid
|
@@ -58,6 +58,7 @@ class Skr.Models.Invoice extends Skr.Models.Base
|
|
58
58
|
pick_ticket: { model: "PickTicket", readOnly:true }
|
59
59
|
lines: { collection: "InvLine", inverse: 'invoice' }
|
60
60
|
gl_transactions: { collection: "GlTransaction", readOnly:true }
|
61
|
+
payments: { collection: "Payment", inverse: 'invoice' }
|
61
62
|
|
62
63
|
events:
|
63
64
|
'change:customer': 'onSetCustomer'
|
@@ -68,8 +69,8 @@ class Skr.Models.Invoice extends Skr.Models.Base
|
|
68
69
|
@unCacheDerived('total')
|
69
70
|
@unset('invoice_total')
|
70
71
|
|
71
|
-
onSetCustomer:
|
72
|
-
return if not
|
72
|
+
onSetCustomer: ->
|
73
|
+
return if not @customer or @customer.isNew() or @customer.id is @customer_id
|
73
74
|
for attr in ['terms_id']
|
74
75
|
@set(attr, newCustomer[attr])
|
75
76
|
@copyAssociationsFrom( newCustomer, 'billing_address', 'shipping_address')
|
@@ -89,15 +90,22 @@ class Skr.Models.Invoice extends Skr.Models.Base
|
|
89
90
|
@trigger('change', @, {})
|
90
91
|
|
91
92
|
copyAssociationsFrom: ( model, associations... ) ->
|
93
|
+
addrs = ['billing_address', 'shipping_address']
|
92
94
|
new _.Promise (res, rej) =>
|
93
95
|
model.withAssociations(associations).then =>
|
94
|
-
for name in
|
96
|
+
for name in addrs
|
97
|
+
@[name].set(
|
98
|
+
_.omit( @customer[name].serialize(), 'id' )
|
99
|
+
)
|
100
|
+
for name in _.without associations, addrs
|
95
101
|
@associations.replace(@, name, model[name])
|
96
102
|
res(@)
|
97
103
|
|
98
104
|
dataForSave: ->
|
99
105
|
# only send some associations
|
100
|
-
super(onlyAssociations: [
|
106
|
+
super(onlyAssociations: [
|
107
|
+
'lines', 'billing_address', 'shipping_address', 'payments', 'credit_card'
|
108
|
+
])
|
101
109
|
|
102
110
|
isPaidInFull: ->
|
103
111
|
@state == 'paid'
|
@@ -3,8 +3,6 @@ SHARED_COLLECTION = null
|
|
3
3
|
|
4
4
|
class Skr.Models.Location extends Skr.Models.Base
|
5
5
|
|
6
|
-
cacheDuration: [1, 'day']
|
7
|
-
|
8
6
|
mixins: [ 'FileSupport', 'HasCodeField' ]
|
9
7
|
|
10
8
|
props:
|
@@ -14,16 +12,20 @@ class Skr.Models.Location extends Skr.Models.Base
|
|
14
12
|
address_id: {type:"integer"}
|
15
13
|
is_active: {type:"boolean", "default":true}
|
16
14
|
gl_branch_code:{type:"string", "default":"01"}
|
17
|
-
|
18
|
-
options: "any"
|
15
|
+
options: "any"
|
19
16
|
|
20
17
|
associations:
|
21
18
|
address: { model: "Address" }
|
22
19
|
sku_locs: { collection: "SkuLoc" }
|
20
|
+
logo: { model: "Lanes.Models.Asset" }
|
23
21
|
|
24
22
|
@initialize: (data) ->
|
25
23
|
SHARED_DATA = data.locations
|
26
24
|
|
25
|
+
addChangeSet: (change) ->
|
26
|
+
if change.update.logo
|
27
|
+
change.update.logo[1] = change.update.logo[1].logo
|
28
|
+
super
|
27
29
|
|
28
30
|
Object.defineProperties Skr.Models.Location, {
|
29
31
|
all:
|
@@ -2,13 +2,18 @@ class Skr.Models.Payment extends Skr.Models.Base
|
|
2
2
|
|
3
3
|
props:
|
4
4
|
id: {type:"integer"}
|
5
|
-
visible_id: {type:"
|
5
|
+
visible_id: {type:"visible_id"}
|
6
6
|
hash_code: {type:"string"}
|
7
7
|
bank_account_id:{type:"integer"}
|
8
8
|
category_id: {type:"integer"}
|
9
9
|
vendor_id: "integer"
|
10
|
-
|
11
|
-
|
10
|
+
invoice_id: "integer"
|
11
|
+
location_id: {type:"integer", default: ->
|
12
|
+
Skr.Models.Location.default.id
|
13
|
+
}
|
14
|
+
amount: {type:"bigdec", required: true, default: ->
|
15
|
+
_.bigDecimal('0')
|
16
|
+
}
|
12
17
|
check_number: {type:"integer"}
|
13
18
|
date: {type:"date", default: ->
|
14
19
|
new Date
|
@@ -16,21 +21,36 @@ class Skr.Models.Payment extends Skr.Models.Base
|
|
16
21
|
name: {type: "string", required: true}
|
17
22
|
address: "string"
|
18
23
|
notes: "string"
|
24
|
+
metadata: "object"
|
19
25
|
|
20
26
|
mixins: [ 'PrintSupport', 'HasVisibleId' ]
|
21
27
|
|
28
|
+
derived:
|
29
|
+
is_incoming: deps:['invoice'], fn: -> !!@invoice
|
30
|
+
is_outgoing: deps:['is_incoming'], fn: -> !@is_incoming
|
31
|
+
|
22
32
|
associations:
|
23
|
-
category: { model: "PaymentCategory" }
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
33
|
+
category: { model: "PaymentCategory", readOnly: true}
|
34
|
+
invoice: { model: "Invoice", readOnly: true }
|
35
|
+
vendor: { model: "Vendor", readOnly: true }
|
36
|
+
bank_account: { model: "BankAccount", readOnly: true }
|
37
|
+
location: { model: "Location", readOnly: true, default: ->
|
38
|
+
Skr.Models.Location.all.get(@location_id) if @location_id
|
39
|
+
}
|
40
|
+
gl_transaction: { model: "GlTransaction", readOnly: true }
|
41
|
+
credit_card: { model: "CreditCard", inverse: 'payment' }
|
28
42
|
|
29
43
|
events:
|
30
44
|
'change:vendor': 'onSetVendor'
|
31
45
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
46
|
+
describe: ->
|
47
|
+
metadata = _.toSentence( _.map(@metadata, (value, key) ->
|
48
|
+
_.titleize(key) + ': ' + value
|
49
|
+
))
|
50
|
+
#{@name} #{metadata}"
|
51
|
+
|
52
|
+
onSetVendor: ->
|
53
|
+
return unless @vendor and @vendor.isPersistent()
|
54
|
+
@name = @vendor.name
|
55
|
+
@vendor.withAssociations(['billing_address']).then (v) =>
|
56
|
+
@address = v.billing_address.toString()
|
@@ -55,8 +55,8 @@ class Skr.Models.SalesOrder extends Skr.Models.Base
|
|
55
55
|
pick_tickets: { collection: "PickTicket", inverse: 'sales_order' }
|
56
56
|
|
57
57
|
events:
|
58
|
-
'change:customer': 'onCustomerChange'
|
59
58
|
'lines add remove change:total': 'onTotalChange'
|
59
|
+
'change:customer': 'onCustomerChange'
|
60
60
|
|
61
61
|
onTotalChange: ->
|
62
62
|
@trigger('change', @, {})
|
@@ -64,10 +64,14 @@ class Skr.Models.SalesOrder extends Skr.Models.Base
|
|
64
64
|
@unset('order_total')
|
65
65
|
|
66
66
|
onCustomerChange: ->
|
67
|
-
return
|
67
|
+
return if @customer.isProxy or not @isNew()
|
68
|
+
|
68
69
|
associations = ['billing_address', 'shipping_address']
|
69
70
|
for attr in ['terms_id']
|
70
71
|
@set(attr, @customer[attr])
|
72
|
+
|
71
73
|
@customer.withAssociations(associations).then =>
|
72
74
|
for name in associations
|
73
|
-
@
|
75
|
+
@[name].set(
|
76
|
+
_.omit( @customer[name].serialize(), 'id' )
|
77
|
+
)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Skr.Models.SequentialId extends Skr.Models.Base
|
2
|
+
|
3
|
+
props:
|
4
|
+
id: 'integer'
|
5
|
+
ids:
|
6
|
+
type: 'array', required: true, default: -> []
|
7
|
+
|
8
|
+
registerforPubSub: false
|
9
|
+
|
10
|
+
modelTypeIdentifier: ->
|
11
|
+
'sequential-ids'
|
12
|
+
|
13
|
+
updateValue: (id, count) ->
|
14
|
+
@ids = _.map @ids, (si) ->
|
15
|
+
si = _.clone si
|
16
|
+
si.count = parseInt(count) if si.id is id
|
17
|
+
si
|
@@ -5,7 +5,7 @@ class Skr.Models.Sku extends Skr.Models.Base
|
|
5
5
|
id: {type:"integer"}
|
6
6
|
default_vendor_id: {type:"integer"}
|
7
7
|
gl_asset_account_id: {type:"integer", default: ->
|
8
|
-
Skr.Models.GlAccount.default_ids
|
8
|
+
Skr.Models.GlAccount.default_ids?.asset
|
9
9
|
}
|
10
10
|
default_uom_code: {type:"string"}
|
11
11
|
code: {type:"code", required:true}
|
@@ -68,9 +68,8 @@ class Skr.Models.TimeEntry extends Skr.Models.Base
|
|
68
68
|
_.extend attrs, colorIndex: project.options.color
|
69
69
|
attrs
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
id: event.entryId,
|
71
|
+
setTimeFromCalEvent: (event) ->
|
72
|
+
return this.set(
|
74
73
|
start_at: event.start()
|
75
74
|
end_at: event.end()
|
76
|
-
|
75
|
+
)
|
@@ -1,6 +1,9 @@
|
|
1
1
|
Skr.Models.Mixins.PrintSupport = {
|
2
2
|
|
3
|
+
_mixinPrintFormIdentifier: ->
|
4
|
+
if @printFormIdentifier then @printFormIdentifier() else @modelTypeIdentifier()
|
5
|
+
|
3
6
|
pdfDownloadUrl: ->
|
4
|
-
"#{Lanes.config.api_path}/skr/print/#{@
|
7
|
+
"#{Lanes.config.api_path}/skr/print/#{@_mixinPrintFormIdentifier()}/#{@hash_code}.pdf"
|
5
8
|
|
6
9
|
}
|
@@ -15,6 +15,7 @@ class Skr.Screens.CustomerProjects extends Skr.Screens.Base
|
|
15
15
|
getHourlyRate: -> @project.rates?.hourly
|
16
16
|
setHourlyRate: (value) ->
|
17
17
|
@project.rates = _.extend({}, @project.rates, {hourly: value.replace(/[^0-9.]/g, '')})
|
18
|
+
|
18
19
|
ColorOption: (props) ->
|
19
20
|
<div className={"color-#{props.item.id}"}>{props.item.name}</div>
|
20
21
|
|
@@ -24,7 +25,7 @@ class Skr.Screens.CustomerProjects extends Skr.Screens.Base
|
|
24
25
|
getColorReadOnly: ->
|
25
26
|
index = @getColor()
|
26
27
|
color = _.find(Skr.Models.CustomerProject.COLORS, id: index)
|
27
|
-
<div className={"ro color-#{index}"}>{color?.name}</div>
|
28
|
+
<div className={"ro color-#{index}"}>{color?.name or ''}</div>
|
28
29
|
|
29
30
|
getColor: ->
|
30
31
|
@project.options?.color
|
@@ -48,14 +49,17 @@ class Skr.Screens.CustomerProjects extends Skr.Screens.Base
|
|
48
49
|
|
49
50
|
<LC.FieldWrapper sm=2
|
50
51
|
label="Entry Color"
|
52
|
+
model={@project}
|
53
|
+
name={'color'}
|
51
54
|
className="color-selection"
|
52
|
-
|
55
|
+
displayComponent={@getColorReadOnly}
|
53
56
|
>
|
54
57
|
<Lanes.Vendor.ReactWidgets.DropdownList
|
55
58
|
className='colors'
|
56
59
|
data={Skr.Models.CustomerProject.COLORS}
|
57
60
|
valueField='id' textField='name'
|
58
|
-
value={@getColor()}
|
61
|
+
value={@getColor()}
|
62
|
+
onChange={@setColor}
|
59
63
|
valueComponent={@ColorOption}
|
60
64
|
disabled={!@state.commands.isEditing()}
|
61
65
|
itemComponent={@ColorOption} />
|
@@ -23,7 +23,7 @@ class Skr.Screens.FreshBooksImport.ApiInfo extends Lanes.React.Component
|
|
23
23
|
<BS.Row>
|
24
24
|
<LC.Input name='api_key' label='API Key' sm=7 model={@import} />
|
25
25
|
<LC.Input name='domain' label='Company' sm=3 model={@import} />
|
26
|
-
<
|
26
|
+
<BS.FormGroup className='domain' sm=2 label=''>.freshbooks.com</BS.FormGroup>
|
27
27
|
</BS.Row>
|
28
28
|
<BS.Row>
|
29
29
|
<BS.Col smOffset=9 sm=2>
|
@@ -13,7 +13,7 @@ class Transactions extends Skr.Models.Base
|
|
13
13
|
syncOptions: { with: ['with_details'] }
|
14
14
|
fields: [
|
15
15
|
{ id: 'id', visible: false }
|
16
|
-
{ id: 'created_at', title: 'Date', format: Lanes.u.format.
|
16
|
+
{ id: 'created_at', title: 'Date', format: Lanes.u.format.shortDate, fixedWidth: 100 }
|
17
17
|
{ id: 'debit_details', title: 'Debit', component: RenderPosting }
|
18
18
|
{ id: 'credit_details', title: 'Credit', component: RenderPosting }
|
19
19
|
{ id: 'source_type', fixedWidth: 180 }
|
@@ -5,7 +5,7 @@ class Skr.Screens.Invoice extends Skr.Screens.Base
|
|
5
5
|
|
6
6
|
syncOptions:
|
7
7
|
with: [ 'with_details' ]
|
8
|
-
include: [ 'sales_order', 'billing_address', 'shipping_address', 'lines'
|
8
|
+
include: [ 'sales_order', 'billing_address', 'shipping_address', 'lines', 'payments' ]
|
9
9
|
|
10
10
|
dataObjects:
|
11
11
|
invoice: ->
|
@@ -18,29 +18,19 @@ class Skr.Screens.Invoice extends Skr.Screens.Base
|
|
18
18
|
commands: new Skr.Screens.Commands(this, modelName: 'invoice', print: true)
|
19
19
|
|
20
20
|
setSalesOrder: (so) -> @invoice.setFromSalesOrder(so)
|
21
|
-
onPayment: -> @invoice.save()
|
22
21
|
|
23
|
-
|
24
|
-
@context.viewport
|
25
|
-
title: "Accept Payment", autoHide: true, size: 'sm', onOk: @onPayment,
|
26
|
-
body: =>
|
27
|
-
<Skr.Screens.Invoice.Payment invoice={@invoice} />
|
22
|
+
showPayment: ->
|
23
|
+
Skr.Screens.Invoice.Payment.display(@context.viewport, @invoice)
|
28
24
|
|
29
25
|
PaymentButton: ->
|
30
|
-
return null if @invoice.isNew()
|
31
|
-
<SC.ToolbarButton onClick={@
|
26
|
+
return null if @invoice.isNew()
|
27
|
+
<SC.ToolbarButton onClick={@showPayment}>
|
32
28
|
<LC.Icon type="money" />Payment
|
33
29
|
</SC.ToolbarButton>
|
34
30
|
|
35
31
|
shouldSaveLinesImmediately: ->
|
36
32
|
not @invoice.isNew()
|
37
33
|
|
38
|
-
linesQueryBuilder: (attrs) ->
|
39
|
-
unless this.invoice.isNew()
|
40
|
-
sc = _.find attrs.fields, id: 'sku_code'
|
41
|
-
sc.editable = false
|
42
|
-
attrs
|
43
|
-
|
44
34
|
render: ->
|
45
35
|
<LC.ScreenWrapper identifier="invoice" flexVertical>
|
46
36
|
|
@@ -55,9 +45,11 @@ class Skr.Screens.Invoice extends Skr.Screens.Base
|
|
55
45
|
|
56
46
|
<SC.SalesOrderFinder autoFocus={false} sm=2 xs=3 editOnly={false}
|
57
47
|
onModelSet={@setSalesOrder} associationName='sales_order'
|
58
|
-
syncOptions={
|
48
|
+
syncOptions={ include: ['customer', 'billing_address', 'shipping_address' ] }
|
49
|
+
parentModel={@invoice} />
|
59
50
|
|
60
51
|
<SC.CustomerFinder
|
52
|
+
syncOptions={ include: ['billing_address', 'shipping_address' ] }
|
61
53
|
selectField sm=3 xs=6 model={@invoice} />
|
62
54
|
|
63
55
|
<SC.TermsChooser model={@invoice} sm=3 xs=6 />
|
@@ -78,7 +70,7 @@ class Skr.Screens.Invoice extends Skr.Screens.Base
|
|
78
70
|
</BS.Row>
|
79
71
|
|
80
72
|
<BS.Row>
|
81
|
-
<LC.
|
73
|
+
<LC.TextArea name="notes" model={@invoice} xs=12 />
|
82
74
|
</BS.Row>
|
83
75
|
|
84
76
|
<BS.Row>
|