stockor 0.1.9 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +254 -72
  4. data/Guardfile +1 -1
  5. data/README.md +24 -3
  6. data/app.json +28 -0
  7. data/client/skr/Extension.coffee +18 -0
  8. data/client/skr/components/BankAccountFinder.cjsx +34 -0
  9. data/client/skr/components/Currency.cjsx +19 -0
  10. data/client/skr/components/CustomerFinder.cjsx +37 -0
  11. data/client/skr/components/CustomerLink.cjsx +13 -0
  12. data/client/skr/components/CustomerProjectFinder.cjsx +49 -0
  13. data/client/skr/components/GlAccountChooser.cjsx +38 -0
  14. data/client/skr/components/InvoiceFinder.cjsx +37 -0
  15. data/client/skr/components/InvoiceLink.cjsx +13 -0
  16. data/client/skr/components/LocationChooser.cjsx +37 -0
  17. data/client/skr/components/PaymentCategoryFinder.cjsx +34 -0
  18. data/client/skr/components/PrintFormChooser.cjsx +29 -0
  19. data/client/skr/components/SalesOrderFinder.cjsx +38 -0
  20. data/client/skr/components/ScreenControls.cjsx +20 -0
  21. data/client/skr/components/SkuFinder.cjsx +30 -0
  22. data/client/skr/components/SkuLines.cjsx +76 -0
  23. data/client/skr/components/SystemSettings.cjsx +26 -0
  24. data/client/skr/components/TermsChooser.cjsx +40 -0
  25. data/client/skr/components/ToolbarButton.cjsx +7 -0
  26. data/client/skr/components/TotalsLine.cjsx +21 -0
  27. data/client/skr/components/TriStateIcon.cjsx +12 -0
  28. data/client/skr/components/UOMChooser.cjsx +24 -0
  29. data/client/skr/components/UserPreferences.cjsx +30 -0
  30. data/client/skr/components/VendorFinder.cjsx +40 -0
  31. data/client/skr/components/address/Address.cjsx +10 -10
  32. data/client/skr/components/styles.scss +16 -0
  33. data/client/skr/index.js +3 -1
  34. data/client/skr/models/Address.coffee +9 -1
  35. data/client/skr/models/BankAccount.coffee +17 -0
  36. data/client/skr/models/Base.coffee +6 -0
  37. data/client/skr/models/Customer.coffee +17 -10
  38. data/client/skr/models/CustomerProject.coffee +29 -0
  39. data/client/skr/models/GlAccount.coffee +22 -10
  40. data/client/skr/models/GlManualEntry.coffee +4 -2
  41. data/client/skr/models/GlPeriod.coffee +4 -6
  42. data/client/skr/models/GlPosting.coffee +7 -7
  43. data/client/skr/models/GlTransaction.coffee +3 -3
  44. data/client/skr/models/IaLine.coffee +9 -9
  45. data/client/skr/models/IaReason.coffee +4 -4
  46. data/client/skr/models/InvLine.coffee +30 -11
  47. data/client/skr/models/InventoryAdjustment.coffee +8 -6
  48. data/client/skr/models/Invoice.coffee +89 -18
  49. data/client/skr/models/Location.coffee +27 -6
  50. data/client/skr/models/Payment.coffee +36 -0
  51. data/client/skr/models/PaymentCategory.coffee +12 -0
  52. data/client/skr/models/PaymentTerm.coffee +17 -4
  53. data/client/skr/models/PickTicket.coffee +7 -5
  54. data/client/skr/models/PoLine.coffee +15 -15
  55. data/client/skr/models/PoReceipt.coffee +8 -6
  56. data/client/skr/models/PorLine.coffee +11 -11
  57. data/client/skr/models/PricingProvider.coffee +6 -0
  58. data/client/skr/models/PtLine.coffee +13 -13
  59. data/client/skr/models/PurchaseOrder.coffee +11 -9
  60. data/client/skr/models/SalesOrder.coffee +59 -22
  61. data/client/skr/models/Sku.coffee +17 -15
  62. data/client/skr/models/SkuLoc.coffee +14 -9
  63. data/client/skr/models/SkuTran.coffee +10 -10
  64. data/client/skr/models/SkuVendor.coffee +9 -9
  65. data/client/skr/models/SoLine.coffee +27 -20
  66. data/client/skr/models/TimeEntry.coffee +75 -0
  67. data/client/skr/models/Uom.coffee +27 -6
  68. data/client/skr/models/Vendor.coffee +14 -12
  69. data/client/skr/models/VoLine.coffee +11 -11
  70. data/client/skr/models/Voucher.coffee +7 -5
  71. data/client/skr/models/mixins/HasVisibleId.coffee +7 -0
  72. data/client/skr/models/mixins/PrintSupport.coffee +6 -0
  73. data/client/skr/models/mixins/SkuLine.coffee +61 -0
  74. data/client/skr/screens/Commands.coffee +29 -0
  75. data/client/skr/screens/bank-maint/BankMaint.cjsx +43 -0
  76. data/client/skr/screens/bank-maint/index.js +5 -0
  77. data/client/skr/screens/chart-of-accounts/ChartOfAccounts.cjsx +40 -0
  78. data/client/skr/screens/chart-of-accounts/index.js +1 -0
  79. data/client/skr/screens/chart-of-accounts/index.scss +12 -0
  80. data/client/skr/screens/customer-maint/CustomerMaint.cjsx +35 -36
  81. data/client/skr/screens/customer-projects/CustomerProjects.cjsx +70 -0
  82. data/client/skr/screens/customer-projects/index.js +5 -0
  83. data/client/skr/screens/customer-projects/index.scss +25 -0
  84. data/client/skr/screens/fresh-books-import/ApiInfo.cjsx +35 -0
  85. data/client/skr/screens/fresh-books-import/ChooseRecords.cjsx +116 -0
  86. data/client/skr/screens/fresh-books-import/FreshBooksImport.cjsx +31 -0
  87. data/client/skr/screens/fresh-books-import/Import.coffee +52 -0
  88. data/client/skr/screens/fresh-books-import/ViewRecords.cjsx +96 -0
  89. data/client/skr/screens/fresh-books-import/index.js +1 -0
  90. data/client/skr/screens/fresh-books-import/index.scss +39 -0
  91. data/client/skr/screens/gl-accounts/GlAccounts.cjsx +31 -0
  92. data/client/skr/screens/gl-accounts/index.js +5 -0
  93. data/client/skr/screens/gl-transactions/GlTransactions.cjsx +46 -0
  94. data/client/skr/screens/gl-transactions/index.js +1 -0
  95. data/client/skr/screens/gl-transactions/index.scss +12 -0
  96. data/client/skr/screens/invoice/Invoice.cjsx +92 -0
  97. data/client/skr/screens/invoice/Payment.cjsx +28 -0
  98. data/client/skr/screens/invoice/index.js +5 -0
  99. data/client/skr/screens/locations/Locations.cjsx +31 -0
  100. data/client/skr/screens/locations/index.js +5 -0
  101. data/client/skr/screens/payment-category/PaymentCategory.cjsx +28 -0
  102. data/client/skr/screens/payment-category/index.js +5 -0
  103. data/client/skr/screens/payment-category/index.scss +9 -0
  104. data/client/skr/screens/payment-terms/PaymentTerms.cjsx +28 -0
  105. data/client/skr/screens/payment-terms/index.js +5 -0
  106. data/client/skr/screens/payment-terms/index.scss +9 -0
  107. data/client/skr/screens/payments/Payments.cjsx +59 -0
  108. data/client/skr/screens/payments/index.js +5 -0
  109. data/client/skr/screens/sales-order/SalesOrder.cjsx +68 -0
  110. data/client/skr/screens/sales-order/index.js +1 -5
  111. data/client/skr/screens/sku-maint/SkuMaint.cjsx +53 -0
  112. data/client/skr/screens/sku-maint/SkuUomList.cjsx +209 -0
  113. data/client/skr/screens/sku-maint/index.js +2 -5
  114. data/client/skr/screens/sku-maint/index.scss +37 -6
  115. data/client/skr/screens/time-invoicing/TimeInvoicing.cjsx +156 -0
  116. data/client/skr/screens/time-invoicing/index.js +5 -0
  117. data/client/skr/screens/time-invoicing/index.scss +7 -0
  118. data/client/skr/screens/time-tracking/EditEntry.cjsx +54 -0
  119. data/client/skr/screens/time-tracking/Entries.coffee +132 -0
  120. data/client/skr/screens/time-tracking/Header.cjsx +71 -0
  121. data/client/skr/screens/time-tracking/Popover.cjsx +70 -0
  122. data/client/skr/screens/time-tracking/PopoverMiniControls.cjsx +25 -0
  123. data/client/skr/screens/time-tracking/TimeTracking.cjsx +63 -0
  124. data/client/skr/screens/time-tracking/WeekSummary.cjsx +16 -0
  125. data/client/skr/screens/time-tracking/index.js +1 -0
  126. data/client/skr/screens/time-tracking/index.scss +126 -0
  127. data/client/skr/screens/vendor-maint/VendorMaint.cjsx +45 -0
  128. data/client/skr/screens/vendor-maint/index.js +1 -5
  129. data/client/skr/styles.scss +1 -13
  130. data/config/puma.rb +4 -0
  131. data/config/routes.rb +21 -9
  132. data/config/screens.rb +147 -32
  133. data/db/migrate/20140202194700_create_skr_gl_transaction_details.rb +35 -0
  134. data/db/migrate/20140220031800_create_skr_locations.rb +2 -0
  135. data/db/migrate/20140220190836_create_skr_vendors.rb +1 -0
  136. data/db/migrate/20140220203029_create_skr_customers.rb +3 -2
  137. data/db/migrate/20140224034759_create_skr_skus.rb +2 -3
  138. data/db/migrate/20140322223912_create_skr_sales_orders.rb +4 -3
  139. data/db/migrate/20140322223920_create_skr_so_lines.rb +4 -5
  140. data/db/migrate/20140323001446_create_so_details_view.rb +7 -5
  141. data/db/migrate/20140327202209_create_skr_pt_lines.rb +2 -2
  142. data/db/migrate/20140327214000_create_customer_project.rb +16 -0
  143. data/db/migrate/20140327223002_create_time_entries.rb +17 -0
  144. data/db/migrate/20140327224000_create_skr_invoices.rb +5 -1
  145. data/db/migrate/20140327224002_create_skr_inv_lines.rb +3 -1
  146. data/db/migrate/20140422024010_create_skr_inv_details_view.rb +1 -1
  147. data/db/migrate/20151121211323_create_customer_project_details_views.rb +31 -0
  148. data/db/migrate/20160216142845_create_gl_account_balances_view.rb +20 -0
  149. data/db/migrate/20160229002044_create_bank_accounts.rb +18 -0
  150. data/db/migrate/20160229041711_create_payments.rb +33 -0
  151. data/db/migrate/20160307022705_create_create_combined_uom_views.rb +18 -0
  152. data/db/schema.sql +639 -140
  153. data/db/seed/chart_of_accounts.yml +8 -6
  154. data/db/seed/payment_categories.yml +12 -0
  155. data/db/seed/skus.yml +32 -0
  156. data/db/seed.rb +21 -0
  157. data/lib/skr/access_roles.rb +19 -6
  158. data/lib/skr/concerns/has_sku_loc_lines.rb +0 -16
  159. data/lib/skr/concerns/inv_extensions.rb +24 -0
  160. data/lib/skr/concerns/is_sku_loc_line.rb +3 -4
  161. data/lib/skr/concerns/so_extensions.rb +8 -0
  162. data/lib/skr/concerns/visible_id_identifier.rb +1 -1
  163. data/lib/skr/db/migration_helpers.rb +2 -4
  164. data/lib/skr/extension.rb +11 -4
  165. data/lib/skr/handlers/fresh_books_import.rb +20 -0
  166. data/lib/skr/handlers/invoice_from_time_entries.rb +49 -0
  167. data/lib/skr/jobs/fresh_books/base.rb +54 -0
  168. data/lib/skr/jobs/fresh_books/import.rb +151 -0
  169. data/lib/skr/jobs/fresh_books/retrieve.rb +62 -0
  170. data/lib/skr/model.rb +5 -0
  171. data/lib/skr/models/address.rb +1 -1
  172. data/lib/skr/models/bank_account.rb +13 -0
  173. data/lib/skr/models/business_entity.rb +3 -0
  174. data/lib/skr/models/customer.rb +1 -1
  175. data/lib/skr/models/customer_project.rb +22 -0
  176. data/lib/skr/models/gl_account.rb +13 -3
  177. data/lib/skr/models/gl_period.rb +6 -0
  178. data/lib/skr/models/gl_posting.rb +7 -4
  179. data/lib/skr/models/gl_transaction.rb +19 -33
  180. data/lib/skr/models/ia_line.rb +1 -1
  181. data/lib/skr/models/inv_line.rb +33 -15
  182. data/lib/skr/models/invoice.rb +47 -20
  183. data/lib/skr/models/location.rb +7 -1
  184. data/lib/skr/models/payment.rb +49 -0
  185. data/lib/skr/models/payment_category.rb +11 -0
  186. data/lib/skr/models/payment_term.rb +1 -1
  187. data/lib/skr/models/por_line.rb +1 -1
  188. data/lib/skr/models/pt_line.rb +1 -1
  189. data/lib/skr/models/sales_order.rb +9 -9
  190. data/lib/skr/models/sku_loc.rb +1 -1
  191. data/lib/skr/models/sku_tran.rb +6 -11
  192. data/lib/skr/models/so_line.rb +22 -12
  193. data/lib/skr/models/time_entry.rb +36 -0
  194. data/lib/skr/models/uom.rb +11 -10
  195. data/lib/skr/models/user_proxy.rb +1 -1
  196. data/lib/skr/number.rb +25 -0
  197. data/lib/skr/print/form.rb +46 -0
  198. data/lib/skr/print/template.rb +48 -0
  199. data/lib/skr/print.rb +11 -0
  200. data/lib/skr/string.rb +11 -0
  201. data/lib/skr/version.rb +1 -1
  202. data/lib/skr.rb +9 -0
  203. data/spec/fixtures/skr/address.yml +164 -4
  204. data/spec/fixtures/skr/bank_account.yml +8 -0
  205. data/spec/fixtures/skr/customer.yml +30 -4
  206. data/spec/fixtures/skr/customer_project.yml +20 -0
  207. data/spec/fixtures/skr/gl_account.yml +19 -1
  208. data/spec/fixtures/skr/gl_period.yml +3 -0
  209. data/spec/fixtures/skr/gl_posting.yml +22 -1
  210. data/spec/fixtures/skr/gl_transaction.yml +4 -1
  211. data/spec/fixtures/skr/inv_line.yml +35 -0
  212. data/spec/fixtures/skr/invoice.yml +13 -2
  213. data/spec/fixtures/skr/location.yml +5 -0
  214. data/spec/fixtures/skr/payment.yml +10 -0
  215. data/spec/fixtures/skr/payment_category.yml +8 -0
  216. data/spec/fixtures/skr/payment_term.yml +37 -3
  217. data/spec/fixtures/skr/sales_order.yml +12 -1
  218. data/spec/fixtures/skr/sku.yml +78 -1
  219. data/spec/fixtures/skr/sku_loc.yml +42 -1
  220. data/spec/fixtures/skr/sku_tran.yml +24 -1
  221. data/spec/fixtures/skr/so_line.yml +32 -0
  222. data/spec/fixtures/skr/time_entry.yml +82 -0
  223. data/spec/fixtures/skr/uom.yml +52 -1
  224. data/spec/fixtures/skr/vendor.yml +28 -1
  225. data/spec/fixtures/stockor.png +0 -0
  226. data/spec/server/bank_account_spec.rb +10 -0
  227. data/spec/server/customer_project_spec.rb +10 -0
  228. data/spec/server/handlers/invoice_from_time_entries_spec.rb +49 -0
  229. data/spec/server/jobs/fresh_books/import_spec.rb +69 -0
  230. data/spec/server/jobs/fresh_books/retrieve_spec.rb +37 -0
  231. data/spec/server/models/address_spec.rb +4 -3
  232. data/spec/server/models/gl_transaction_spec.rb +3 -3
  233. data/spec/server/models/inv_line_spec.rb +83 -3
  234. data/spec/server/models/invoice_spec.rb +32 -3
  235. data/spec/server/models/payment_spec.rb +40 -0
  236. data/spec/server/models/sales_order_spec.rb +1 -1
  237. data/spec/server/models/so_line_spec.rb +3 -3
  238. data/spec/server/models/spec_helper_spec.rb +1 -1
  239. data/spec/server/payment_spec.rb +10 -0
  240. data/spec/server/print/form_spec.rb +47 -0
  241. data/spec/server/print/template_spec.rb +36 -0
  242. data/spec/server/spec_helper.rb +14 -1
  243. data/spec/server/time_entry_spec.rb +10 -0
  244. data/spec/skr/components/SkuLinesSpec.coffee +61 -0
  245. data/spec/skr/models/BankAccountSpec.coffee +5 -0
  246. data/spec/skr/models/CustomerProjectSpec.coffee +5 -0
  247. data/spec/skr/models/CustomerSpec.coffee +2 -2
  248. data/spec/skr/models/PaymentSpec.coffee +5 -0
  249. data/spec/skr/models/SalesOrderSpec.coffee +21 -5
  250. data/spec/skr/models/SoLineSpec.coffee +7 -2
  251. data/spec/skr/models/TimeEntrySpec.coffee +5 -0
  252. data/spec/skr/screens/bank-maint/BankMaintSpec.coffee +5 -0
  253. data/spec/skr/screens/customer-projects/CustomerProjectsSpec.coffee +5 -0
  254. data/spec/skr/screens/fresh-books-import/FreshBooksImportSpec.coffee +1 -0
  255. data/spec/skr/screens/gl-accounts/GlAccountsSpec.coffee +5 -0
  256. data/spec/skr/screens/invoice/InvoiceSpec.coffee +5 -0
  257. data/spec/skr/screens/locations/LocationsSpec.coffee +5 -0
  258. data/spec/skr/screens/payment-category/PaymentCategorySpec.coffee +5 -0
  259. data/spec/skr/screens/payment-terms/PaymentTermsSpec.coffee +5 -0
  260. data/spec/skr/screens/payments/PaymentsSpec.coffee +5 -0
  261. data/spec/skr/screens/time-invoicing/TimeInvoicingSpec.coffee +5 -0
  262. data/spec/skr/screens/time-tracking/TimeTrackingSpec.coffee +14 -0
  263. data/spec/vcr/freshbooks.yml +698 -0
  264. data/stockor.gemspec +5 -1
  265. data/templates/print/fonts/GnuMICR.otf +0 -0
  266. data/templates/print/layout.tex.erb +39 -0
  267. data/templates/print/packages/booktabs.sty +182 -0
  268. data/templates/print/packages/fancybox.sty +966 -0
  269. data/templates/print/packages/fancyhdr.sty +485 -0
  270. data/templates/print/packages/graphbox.sty +129 -0
  271. data/templates/print/packages/lastpage.sty +283 -0
  272. data/templates/print/packages/lastpage209.sty +70 -0
  273. data/templates/print/packages/marginnote.sty +412 -0
  274. data/templates/print/packages/multirow.sty +159 -0
  275. data/templates/print/packages/rotating.sty +282 -0
  276. data/templates/print/packages/tabu.sty +2557 -0
  277. data/templates/print/packages/textpos.sty +361 -0
  278. data/templates/print/packages/varwidth.sty +318 -0
  279. data/templates/print/partials/address.tex.erb +6 -0
  280. data/templates/print/partials/bill_to_ship_to.tex.erb +13 -0
  281. data/templates/print/partials/header.tex.erb +13 -0
  282. data/templates/print/partials/invoice_paid_state.tex.erb +2 -0
  283. data/templates/print/partials/old/inv_lines_grouping.tex.erb +8 -0
  284. data/templates/print/partials/old/labor_lines_footer.tex.erb +18 -0
  285. data/templates/print/partials/skus_table.tex.erb +32 -0
  286. data/templates/print/partials/skus_table_col_hdr.tex.erb +8 -0
  287. data/templates/print/partials/skus_table_footer.tex.erb +5 -0
  288. data/templates/print/partials/skus_table_group_footer.tex.erb +4 -0
  289. data/templates/print/partials/skus_table_invoice_footer.tex.erb +25 -0
  290. data/templates/print/partials/skus_table_invoice_info_line.tex.erb +16 -0
  291. data/templates/print/partials/skus_table_labor_col_hdr.tex.erb +8 -0
  292. data/templates/print/partials/skus_table_labor_group_footer.tex.erb +7 -0
  293. data/templates/print/partials/skus_table_labor_line.tex.erb +11 -0
  294. data/templates/print/partials/skus_table_line.tex.erb +6 -0
  295. data/templates/print/partials/skus_table_other_charge_lines.tex.erb +7 -0
  296. data/templates/print/partials/so_info_line.tex.erb +14 -0
  297. data/templates/print/types/invoice/default.tex.erb +13 -0
  298. data/templates/print/types/invoice/labor.tex.erb +33 -0
  299. data/templates/print/types/payment/default.tex.erb +64 -0
  300. data/templates/print/types/sales-order/default.tex.erb +8 -0
  301. metadata +252 -15
  302. data/client/skr/components/address/address.html +0 -20
  303. data/client/skr/models/mixins/CodeField.coffee +0 -5
  304. data/client/skr/screens/customer-maint/index.scss +0 -11
  305. data/client/skr/screens/customer-maint/layout.html +0 -32
  306. data/client/skr/screens/sales-order/SalesOrder.coffee +0 -30
  307. data/client/skr/screens/sales-order/index.scss +0 -8
  308. data/client/skr/screens/sales-order/layout.html +0 -30
  309. data/client/skr/screens/sku-maint/SkuMaint.coffee +0 -18
  310. data/client/skr/screens/sku-maint/layout.html +0 -16
  311. data/client/skr/screens/vendor-maint/VendorMaint.coffee +0 -28
  312. data/client/skr/screens/vendor-maint/index.scss +0 -8
  313. data/client/skr/screens/vendor-maint/layout.html +0 -32
@@ -0,0 +1,49 @@
1
+ class Skr.Components.CustomerProjectFinder extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ onModelSet: React.PropTypes.func
5
+ commands: React.PropTypes.object
6
+ autoFocus: React.PropTypes.bool
7
+ name: React.PropTypes.string
8
+ selectField: React.PropTypes.bool
9
+
10
+ getDefaultProps: ->
11
+ autoFocus: false, label: 'Project Code', name: 'code'
12
+
13
+ dataObjects:
14
+ query: ->
15
+ new Lanes.Models.Query({
16
+ autoRetrieve: true, syncOptions:
17
+ include: [ 'customer', 'sku' ]
18
+ with: ['with_details']
19
+ title: 'Customer Project'
20
+ src: Skr.Models.CustomerProject, fields: [
21
+ { id:'id', visible: false }
22
+ { id: 'code', fixedWidth: 120 }
23
+ { id: 'po_num', flex: 1 }
24
+ { id: 'description', flex: 2 }
25
+ { id: 'customer_code', fixedWidth: 140 }
26
+ ]
27
+ })
28
+
29
+ select: (model, proj) ->
30
+ if @props.onModelSet
31
+ @props.onModelSet(proj)
32
+ else
33
+ model.set(customer_project: proj)
34
+
35
+ render: ->
36
+ props = _.clone(@props)
37
+
38
+ if props.selectField
39
+ <LC.SelectField sm=2
40
+ labelField="code"
41
+ {...props}
42
+ model={@props.model}
43
+ />
44
+ else
45
+ <LC.RecordFinder ref="finder" sm=3 autoFocus
46
+ query={@query}
47
+ {...props}
48
+ model={@props.model}
49
+ />
@@ -0,0 +1,38 @@
1
+ class Skr.Components.GlAccountChooser extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ model: Lanes.PropTypes.Model
5
+
6
+ label: React.PropTypes.string
7
+ name: React.PropTypes.string
8
+
9
+ getDefaultProps: ->
10
+ label: 'Account', name: 'gl_account'
11
+
12
+ dataObjects:
13
+ query: ->
14
+ new Lanes.Models.Query({
15
+ syncOptions: @props.syncOptions, autoRetrieve: true
16
+ src: Skr.Models.GlAccount.all, fields: [
17
+ {id:'id', visible: false}
18
+ {id: 'number', fixedWidth: 130 }
19
+ 'name', 'description'
20
+ ]
21
+ })
22
+
23
+ render: ->
24
+ props = _.clone(@props)
25
+
26
+ if props.finderField
27
+ <LC.RecordFinder ref="finder"
28
+ commands={@props.commands}
29
+ query={@query}
30
+ {...props} />
31
+ else
32
+ <LC.SelectField
33
+ queryModel={Skr.Models.GlAccount}
34
+ choices={Skr.Models.GlAccount.all.models}
35
+ labelField="combined_name"
36
+ model={@props.model}
37
+ {...props}
38
+ />
@@ -0,0 +1,37 @@
1
+ class Skr.Components.InvoiceFinder extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ commands: React.PropTypes.object
5
+ autoFocus: React.PropTypes.bool
6
+
7
+ getDefaultProps: ->
8
+ autoFocus: true, name: 'visible_id', label: 'Invoice #'
9
+
10
+ dataObjects:
11
+ query: ->
12
+ new Lanes.Models.Query({
13
+ initialFieldIndex: 1
14
+ title: 'Invoice'
15
+ syncOptions: Lanes.Models.Query.mergedSyncOptions(
16
+ @props.syncOptions, { with: [ 'with_details' ] }
17
+ ), autoRetrieve: true
18
+ src: Skr.Models.Invoice, fields: [
19
+ { id: 'id', visible: false }
20
+ { id: 'visible_id', title: 'Invoice #', fixedWidth: 100}
21
+ { id: 'customer_code', title: 'Customer', fixedWidth: 120}
22
+ { id: 'invoice_date', fixedWidth: 120}
23
+ { id: 'po_num', title: 'PO', fixedWidth: 120}
24
+ { id: 'notes', flex: 1}
25
+ {
26
+ id: 'invoice_total', title: 'Total', fixedWidth: 120,
27
+ textAlign: 'right', format: Lanes.u.format.currency
28
+ }
29
+ ]
30
+ })
31
+
32
+ render: ->
33
+ <LC.RecordFinder ref="finder" sm=2
34
+ name='customer'
35
+ {...@props}
36
+ query={@query}
37
+ />
@@ -0,0 +1,13 @@
1
+ class Skr.Components.InvoiceLink extends Lanes.React.Component
2
+ propTypes:
3
+ onClick: React.PropTypes.func
4
+ invoice: React.PropTypes.instanceOf(Skr.Models.Invoice)
5
+
6
+ onClick: ->
7
+ @props.onClick?()
8
+ @props.invoice.withAssociations(['lines']).then =>
9
+ Lanes.Screens.Definitions.all.get('invoice')
10
+ .display(props: {invoice: @props.invoice})
11
+
12
+ render: ->
13
+ <a href='#' onClick={@onClick}>{@props.invoice.visible_id}</a>
@@ -0,0 +1,37 @@
1
+ class Skr.Components.LocationChooser extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ onModelSet: React.PropTypes.func
5
+ name: React.PropTypes.string
6
+
7
+ getDefaultProps: ->
8
+ label: 'Location', name: 'location'
9
+
10
+ dataObjects:
11
+ query: ->
12
+ new Lanes.Models.Query({
13
+ autoRetrieve: true
14
+ syncOptions: Lanes.Models.Query.mergedSyncOptions(
15
+ @props.syncOptions, { include: [ 'address' ] }
16
+ )
17
+ src: Skr.Models.Location, fields: [
18
+ {id:'id', visible: false}
19
+ { id: 'code', fixedWidth: 130 }
20
+ 'name'
21
+ ]
22
+ })
23
+
24
+ render: ->
25
+ props = _.clone(@props)
26
+ if props.displayFinder
27
+ <LC.RecordFinder ref="finder" sm=3 autoFocus
28
+ commands={@state.commands}
29
+ collection={Skr.Models.Location.all}
30
+ query={@query}
31
+ {...props} />
32
+ else
33
+ <LC.SelectField
34
+ {...props}
35
+ choices={Skr.Models.Location.all.models}
36
+ labelField='code'
37
+ model={@props.model} />
@@ -0,0 +1,34 @@
1
+ class Skr.Components.PaymentCategoryFinder extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ model: Lanes.PropTypes.Model
5
+ commands: React.PropTypes.object
6
+ autoFocus: React.PropTypes.bool
7
+ name: React.PropTypes.string
8
+ selectField: React.PropTypes.bool
9
+
10
+ getDefaultProps: ->
11
+ autoFocus: false, label: 'Payment Category', name: 'payment_category'
12
+
13
+ dataObjects:
14
+ query: ->
15
+ new Lanes.Models.Query({
16
+ syncOptions: @props.syncOptions, autoRetrieve: true
17
+ src: Skr.Models.PaymentCategory, fields: [
18
+ {id:'id', visible: false}
19
+ {id:'gl_account_id', visible: false}
20
+ {id:'code', fixedWidth: 130 },
21
+ {id:'name', flex: 1}
22
+ ]
23
+ })
24
+
25
+ render: ->
26
+ props = _.clone(@props)
27
+
28
+ if props.selectField
29
+ <LC.SelectField queryModel={Skr.Models.PaymentCategory} sm=2 {...props} />
30
+ else
31
+ <LC.RecordFinder ref="finder" sm=3 autoFocus
32
+ commands={@props.commands}
33
+ query={@query}
34
+ {...props} />
@@ -0,0 +1,29 @@
1
+ class Skr.Components.PrintFormChooser extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ label: React.PropTypes.string.isRequired
5
+ model: Lanes.PropTypes.Model.isRequired
6
+ choices: React.PropTypes.array
7
+
8
+ getDefaultProps: ->
9
+ name: 'form'
10
+
11
+ onChange: (val) ->
12
+ if @props.onChange
13
+ @props.onChange?(val, @props)
14
+ else
15
+ @props.model[@props.name] = val
16
+
17
+ renderValue: (value) ->
18
+ value
19
+
20
+ render: ->
21
+ choices = @props.choices || @props.model.constructor.Templates
22
+ value = @props.value or @props.model[@props.name]
23
+ <LC.FieldWrapper {...@props} value={value}>
24
+ <Lanes.Vendor.ReactWidgets.DropdownList
25
+ data={choices}
26
+ value={value}
27
+ onChange={@onChange}
28
+ />
29
+ </LC.FieldWrapper>
@@ -0,0 +1,38 @@
1
+ class Skr.Components.SalesOrderFinder extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ onModelSet: React.PropTypes.func
5
+ commands: React.PropTypes.object
6
+ name: React.PropTypes.string
7
+ autoFocus: React.PropTypes.bool
8
+
9
+ getDefaultProps: ->
10
+ editing: true
11
+ autoFocus: true, name: 'visible_id', label: 'Sales Order #'
12
+
13
+ dataObjects:
14
+ query: ->
15
+ new Lanes.Models.Query({
16
+ initialFieldIndex: 1, title: 'Sales Order', autoRetrieve: true
17
+ syncOptions: Lanes.Models.Query.mergedSyncOptions(
18
+ @props.syncOptions, { with: [ 'with_details' ] }
19
+ )
20
+ src: Skr.Models.SalesOrder, fields: [
21
+ { id: 'id', visible: false }
22
+ { id: 'visible_id', title: 'SO #', fixedWidth: 100}
23
+ { id: 'customer_code', title: 'Customer', fixedWidth: 120}
24
+ { id: 'order_date', fixedWidth: 120}
25
+ { id: 'po_num', title: 'PO', fixedWidth: 120}
26
+ { id: 'notes', flex: 1}
27
+ {
28
+ id: 'order_total', title: 'Total', textAlign: 'right', fixedWidth: 120,
29
+ format: Lanes.u.format.currency
30
+ }
31
+ ]
32
+ })
33
+
34
+ render: ->
35
+ <LC.RecordFinder ref="finder" sm=2
36
+ {...@props}
37
+ query={@query}
38
+ />
@@ -0,0 +1,20 @@
1
+ class SC.ScreenControls extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ commands: React.PropTypes.instanceOf(Lanes.Screens.Commands).isRequired
5
+ toolbar: React.PropTypes.bool
6
+ errors: React.PropTypes.bool
7
+ networkActivity: React.PropTypes.bool
8
+ toolbarProps: React.PropTypes.object
9
+
10
+ PrintButton: ->
11
+ return null unless @props.commands.canPrint?()
12
+ <SC.ToolbarButton onClick={@props.commands.printModel} className='print'>
13
+ <LC.Icon type="print" />Print
14
+ </SC.ToolbarButton>
15
+
16
+ render: ->
17
+ <Lanes.Screens.CommonComponents {...@props}>
18
+ <@PrintButton />
19
+ {@props.children}
20
+ </Lanes.Screens.CommonComponents>
@@ -0,0 +1,30 @@
1
+ class Skr.Components.SkuFinder extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ model: Lanes.PropTypes.Model.isRequired
5
+ onModelSet: React.PropTypes.func
6
+ commands: React.PropTypes.object
7
+ autoFocus: React.PropTypes.bool
8
+ name: React.PropTypes.string
9
+ selectField: React.PropTypes.bool
10
+
11
+ getDefaultProps: ->
12
+ autoFocus: false, label: 'SKU', name: 'code'
13
+
14
+ dataObjects:
15
+ query: ->
16
+ new Lanes.Models.Query({
17
+ syncOptions: @props.syncOptions, autoRetrieve: true
18
+ src: Skr.Models.Sku, fields: [
19
+ {id:'id', visible: false}
20
+ 'code'
21
+ { id: 'description', flex: 2}
22
+ ]
23
+ })
24
+
25
+ render: ->
26
+ props = _.extend( {}, @props )
27
+ if @props.selectField
28
+ <LC.SelectField labelField="code" displayFallback={@model.sku_code} {...props} />
29
+ else
30
+ <LC.RecordFinder commands={@props.commands} query={@query} {...props} />
@@ -0,0 +1,76 @@
1
+ class Skr.Components.SkuLines extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ lines: Lanes.PropTypes.Collection.isRequired
5
+ commands: React.PropTypes.object.isRequired
6
+ location: Lanes.PropTypes.Model.isRequired
7
+ saveImmediately: React.PropTypes.func.isRequired
8
+
9
+ componentWillMount: ->
10
+ @createQuery(@props.lines)
11
+
12
+ componentWillReceiveProps: (nextProps) ->
13
+ @createQuery(nextProps.lines) if nextProps.lines
14
+
15
+ createQuery: (lines) ->
16
+ @query = new Lanes.Models.Query
17
+ title: 'Lines'
18
+ defaultSort: false
19
+ src: lines, fields: [
20
+ { id:'id', visible: false }
21
+ { id: 'sku_code', fixedWidth: 150 }
22
+ { id: 'description', flex: 2 }
23
+ {
24
+ id: 'uom', title: 'UOM', query: false, fixedWidth: 100,
25
+ format: (v, r, q) -> v?.combined_uom
26
+ sortBy: (a, b) ->
27
+ Lanes.u.comparator(a.uom_size, b.uom_size) or
28
+ Lanes.u.comparator(a.uom_code, b.uom_code)
29
+ }
30
+ { id: 'qty', textAlign: 'center', fixedWidth: 100 }
31
+ {
32
+ id: 'price', textAlign: 'right', fixedWidth: 130,
33
+ format: (v, r, q) -> v?.toFixed(2)
34
+ }
35
+ ]
36
+
37
+ onSkuChange: (sku, options) ->
38
+ options.model.set({sku})
39
+ _.defer =>
40
+ _.dom(@, 'input[name="qty"]').focusAndSelect() if @isMounted()
41
+
42
+ editors: ->
43
+ sku_code: ({model, props}) =>
44
+ options = {
45
+ with: {in_location: props.location.id}
46
+ include: ['sku_locs', 'uoms']
47
+ }
48
+ <SC.SkuFinder
49
+ writable
50
+ setSelection={@onSkuChange}
51
+ name='sku' model={model}
52
+ selectField unstyled syncOptions={options} />
53
+
54
+ uom: ({model}) ->
55
+ <SC.UOMChooser writable unstyled model={model} />
56
+
57
+ onSelectionChange: (model) ->
58
+ return unless model and @props.commands.isEditing()
59
+ new _.Promise (res, rej) ->
60
+ model.withAssociations([
61
+ 'sku_loc', 'sku', 'uom_choices'
62
+ ]).then -> res(model)
63
+
64
+ render: ->
65
+ <LC.Grid query={@query}
66
+ ref='grid'
67
+ commands={@props.commands}
68
+ autoLoadQuery={false}
69
+ expandY={true}
70
+ columEditors={@editors()}
71
+ editorProps={location: @props.location, syncImmediatly: @props.saveImmediately}
72
+ onSelectionChange={@onSelectionChange}
73
+ allowDelete={true}
74
+ allowCreate={true}
75
+ editor={true}
76
+ />
@@ -0,0 +1,26 @@
1
+ class Skr.Components.SystemSettings extends Lanes.React.Component
2
+
3
+ dataObjects:
4
+ banks: ->
5
+ Skr.Models.BankAccount.Collection.fetch()
6
+
7
+ setBankAccount: (value) ->
8
+ Lanes.config.system_settings
9
+ .setValueForExtension('skr', 'bank_account_id', value.id)
10
+ @forceUpdate()
11
+
12
+ getBankAccount: ->
13
+ id = Lanes.config.system_settings.forExtension('skr').bank_account_id
14
+ if id then {id} else undefined
15
+
16
+ render: ->
17
+ <BS.Row className="skr-system-settings">
18
+
19
+ <SC.BankAccountFinder selectField
20
+ sm=3 label="Default Bank Account"
21
+ choices={this.banks.models}
22
+ setSelection={@setBankAccount}
23
+ getSelection={@getBankAccount}
24
+ />
25
+
26
+ </BS.Row>
@@ -0,0 +1,40 @@
1
+ class Skr.Components.TermsChooser extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ model: Lanes.PropTypes.Model.isRequired
5
+ label: React.PropTypes.string
6
+ name: React.PropTypes.string
7
+ useFinder: React.PropTypes.bool
8
+
9
+ getDefaultProps: ->
10
+ label: 'Payment Terms', name: 'terms'
11
+
12
+ dataObjects:
13
+ query: ->
14
+ new Lanes.Models.Query({
15
+ syncOptions: @props.syncOptions, autoRetrieve: true
16
+ src: Skr.Models.PaymentTerm, fields: [
17
+ { id:'id', visible: false}
18
+ { id: 'code', fixedWidth: 130 },
19
+ 'description',
20
+ { id: 'days', fixedWidth: 80 }
21
+ { id: 'discount_days', label: 'Disc Days', fixedWidth: 80 }
22
+ { id: 'discount_amount', label: 'Disc Amt', fixedWidth: 80 }
23
+
24
+ ]
25
+ })
26
+
27
+ render: ->
28
+ if @props.useFinder
29
+ <LC.RecordFinder ref="finder"
30
+ collection={Skr.Models.PaymentTerm.all}
31
+ commands={@props.commands}
32
+ query={@query}
33
+ {...@props} />
34
+ else
35
+ <LC.SelectField sm=3
36
+ choices={Skr.Models.PaymentTerm.all.models}
37
+ labelField="code"
38
+ {...@props}
39
+ fetchWhenOpen={false}
40
+ model={@props.model} />
@@ -0,0 +1,7 @@
1
+ class Skr.Components.ToolbarButton extends Lanes.React.BaseComponent
2
+
3
+ render: ->
4
+ cn = _.classnames "navbar-btn", "control", @props.classNames
5
+ <BS.Button navItem componentClass="button" {...@props} className={cn}>
6
+ {@props.children}
7
+ </BS.Button>
@@ -0,0 +1,21 @@
1
+ class Skr.Components.TotalsLine extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ model: Lanes.PropTypes.Model.isRequired
5
+ attribute: React.PropTypes.string
6
+ label: React.PropTypes.string
7
+
8
+ getDefaultProps: ->
9
+ attribute: 'total', label: 'Total:'
10
+
11
+ render: ->
12
+ <BS.Row className='totals'>
13
+ <BS.Col lg=11 sm=10 xs=9 className="text-right">
14
+ <h4>{@props.label}</h4>
15
+ </BS.Col>
16
+ <BS.Col lg=1 sm=2 xs=3 className="total">
17
+ <h4>
18
+ <Skr.Components.Currency amount={@model[@props.attribute]} />
19
+ </h4>
20
+ </BS.Col>
21
+ </BS.Row>
@@ -0,0 +1,12 @@
1
+ ICON_TYPES =
2
+ all: 'check-square'
3
+ some: 'check-square-o'
4
+ none: 'square-o'
5
+
6
+ class Skr.Components.TriState extends Lanes.React.Component
7
+
8
+ propTypes:
9
+ type: React.PropTypes.oneOf(_.keys(ICON_TYPES)).isRequired
10
+
11
+ render: ->
12
+ <LC.Icon type={ICON_TYPES[@props.type]} />
@@ -0,0 +1,24 @@
1
+ class Skr.Components.UOMChooser extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ model: Lanes.PropTypes.Model.isRequired
5
+
6
+
7
+ getDefaultProps: ->
8
+ label: 'UOM'
9
+
10
+ render: ->
11
+ props = _.clone(@props)
12
+ props.choices ||= @props.model.uom_choices.models
13
+ <LC.SelectField
14
+ key="uom"
15
+ syncOptions={with: 'with_combined_uom'}
16
+ displayFallback={@props.model.uom.combined_uom}
17
+ editOnly writable unstyled
18
+ model={@props.model}
19
+ fetchWhenOpen={false}
20
+ queryOrder={size: 'desc'}
21
+ labelField="combined_uom"
22
+ name="uom"
23
+ {...props}
24
+ />
@@ -0,0 +1,30 @@
1
+ class Skr.Components.UserPreferences extends Lanes.React.Component
2
+ dataObjects:
3
+ user: -> Lanes.current_user
4
+ projects: -> new Skr.Models.CustomerProject.Collection
5
+
6
+ componentWillMount: -> @projects.ensureLoaded()
7
+
8
+ setProject: (project) ->
9
+ @user.options = _.extend({}, @user.options, {project_id: project.id})
10
+
11
+ getProject: ->
12
+ return unless @user.options?.project_id
13
+ { id: @user.options.project_id, label: @projects.get(@user.options.project_id)?.code }
14
+
15
+ render: ->
16
+ <BS.Row className="skr-preferences">
17
+
18
+ <LC.SelectField xs=4
19
+ fetchWhenOpen={false}
20
+ label='Default Customer Project'
21
+ labelField='code'
22
+ model={@user}
23
+ name='options'
24
+ choices={@projects.models}
25
+ setSelection={@setProject}
26
+ getSelection={@getProject}
27
+ queryModel={Skr.Models.CustomerProject}
28
+ />
29
+
30
+ </BS.Row>
@@ -0,0 +1,40 @@
1
+ class Skr.Components.VendorFinder extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ model: Lanes.PropTypes.Model.isRequired
5
+ commands: React.PropTypes.object
6
+ autoFocus: React.PropTypes.bool
7
+ name: React.PropTypes.string
8
+ selectField: React.PropTypes.bool
9
+
10
+ getDefaultProps: ->
11
+ autoFocus: false, name: 'vendor', label: 'Vendor Code'
12
+
13
+ dataObjects:
14
+ query: ->
15
+ new Lanes.Models.Query({
16
+ title: 'Vendors'
17
+ syncOptions: @props.syncOptions, autoRetrieve: true
18
+ src: Skr.Models.Vendor, fields: [
19
+ {id:'id', visible: false}
20
+ 'code', 'name',
21
+ { id: 'notes', flex: 2}
22
+
23
+ ]
24
+ })
25
+
26
+ render: ->
27
+ if @props.selectField
28
+ <LC.SelectField sm=2
29
+ label="Vendor"
30
+ name="vendor"
31
+ labelField="code"
32
+ model={@props.model}
33
+ {...@props} />
34
+ else
35
+ <LC.RecordFinder sm=3 autoFocus
36
+ model={@props.model}
37
+ name='vendor'
38
+ commands={@state.commands}
39
+ query={@query}
40
+ {...@props} />
@@ -18,34 +18,34 @@ class Skr.Components.Address extends Lanes.React.Component
18
18
  {@renderTitle() if @props.title}
19
19
  <BS.Row>
20
20
  <BS.Col xs=12>
21
- <LC.TextField name="name" model={@model} />
21
+ <LC.Input name="name" model={@model} />
22
22
  </BS.Col>
23
23
  </BS.Row>
24
24
  <BS.Row>
25
25
  <BS.Col sm=6>
26
- <LC.TextField name="phone" model={@model} />
26
+ <LC.Input name="phone" model={@model} />
27
27
  </BS.Col>
28
28
  <BS.Col sm=6>
29
- <LC.TextField name="email" model={@model} />
29
+ <LC.Input name="email" model={@model} />
30
30
  </BS.Col>
31
31
  </BS.Row>
32
32
  <BS.Row>
33
33
  <BS.Col md=6>
34
- <LC.TextField name="line1" model={@model} />
34
+ <LC.Input name="line1" model={@model} />
35
35
  </BS.Col>
36
36
  <BS.Col md=6>
37
- <LC.TextField name="line2" model={@model} />
37
+ <LC.Input name="line2" model={@model} />
38
38
  </BS.Col>
39
39
  </BS.Row>
40
40
  <BS.Row>
41
41
  <BS.Col md=7>
42
- <LC.TextField name="city" model={@model} />
42
+ <LC.Input name="city" model={@model} />
43
43
  </BS.Col>
44
- <BS.Col sm=8 md=3>
45
- <LC.TextField name="state" model={@model} />
44
+ <BS.Col xs=8 md=3>
45
+ <LC.Input name="state" model={@model} />
46
46
  </BS.Col>
47
- <BS.Col sm=4 md=2>
48
- <LC.TextField name="postal_code" model={@model} />
47
+ <BS.Col xs=4 md=2>
48
+ <LC.Input name="postal_code" model={@model} />
49
49
  </BS.Col>
50
50
  </BS.Row>
51
51
  </BS.Col>