rails_trade 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (435) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +165 -0
  3. data/README.md +47 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/config/rails_trade_manifest.js +1 -0
  6. data/app/assets/javascripts/controllers/rails_trade_admin/buyers/index.js +15 -0
  7. data/app/assets/javascripts/controllers/rails_trade_admin/buyers/overdue.js +15 -0
  8. data/app/assets/javascripts/controllers/rails_trade_admin/cart_items/create.js +3 -0
  9. data/app/assets/javascripts/controllers/rails_trade_admin/cart_items/index.js +80 -0
  10. data/app/assets/javascripts/controllers/rails_trade_admin/cart_items/only.js +45 -0
  11. data/app/assets/javascripts/controllers/rails_trade_admin/orders/new.js +29 -0
  12. data/app/assets/javascripts/controllers/rails_trade_admin/payment_methods/edit.js +1 -0
  13. data/app/assets/javascripts/controllers/rails_trade_admin/payment_methods/index.js +1 -0
  14. data/app/assets/javascripts/controllers/rails_trade_admin/payment_methods/new.js +1 -0
  15. data/app/assets/javascripts/controllers/rails_trade_admin/payment_methods/unverified.js +1 -0
  16. data/app/assets/javascripts/controllers/rails_trade_admin/payments/index.js +0 -0
  17. data/app/assets/javascripts/controllers/rails_trade_admin/payments/new.js +1 -0
  18. data/app/assets/javascripts/controllers/rails_trade_admin/promote_buyers/edit.js +31 -0
  19. data/app/assets/javascripts/controllers/rails_trade_admin/promote_buyers/new.js +31 -0
  20. data/app/assets/javascripts/controllers/rails_trade_admin/promote_goods/index.js +1 -0
  21. data/app/assets/javascripts/controllers/rails_trade_admin/promotes/edit.js +2 -0
  22. data/app/assets/javascripts/controllers/rails_trade_admin/promotes/index.js +1 -0
  23. data/app/assets/javascripts/controllers/rails_trade_admin/promotes/new.js +2 -0
  24. data/app/assets/javascripts/controllers/rails_trade_admin/serves/edit.js +2 -0
  25. data/app/assets/javascripts/controllers/rails_trade_admin/serves/index.js +1 -0
  26. data/app/assets/javascripts/controllers/rails_trade_admin/serves/new.js +4 -0
  27. data/app/assets/javascripts/controllers/rails_trade_my/cart_items/create.js +3 -0
  28. data/app/assets/javascripts/controllers/rails_trade_my/cart_items/index.js +65 -0
  29. data/app/controllers/areas_controller.rb +18 -0
  30. data/app/controllers/buyers_controller.rb +8 -0
  31. data/app/controllers/concerns/controller_order_types.rb +92 -0
  32. data/app/controllers/goods_controller.rb +90 -0
  33. data/app/controllers/payments_controller.rb +50 -0
  34. data/app/controllers/providers_controller.rb +8 -0
  35. data/app/controllers/the_trade_admin/addresses_controller.rb +75 -0
  36. data/app/controllers/the_trade_admin/areas_controller.rb +50 -0
  37. data/app/controllers/the_trade_admin/base_controller.rb +5 -0
  38. data/app/controllers/the_trade_admin/buyers_controller.rb +37 -0
  39. data/app/controllers/the_trade_admin/cart_item_serves_controller.rb +63 -0
  40. data/app/controllers/the_trade_admin/cart_items_controller.rb +123 -0
  41. data/app/controllers/the_trade_admin/order_payments_controller.rb +52 -0
  42. data/app/controllers/the_trade_admin/orders_controller.rb +103 -0
  43. data/app/controllers/the_trade_admin/payment_methods_controller.rb +111 -0
  44. data/app/controllers/the_trade_admin/payment_orders_controller.rb +56 -0
  45. data/app/controllers/the_trade_admin/payment_references_controller.rb +54 -0
  46. data/app/controllers/the_trade_admin/payment_strategies_controller.rb +50 -0
  47. data/app/controllers/the_trade_admin/payments_controller.rb +89 -0
  48. data/app/controllers/the_trade_admin/produces_controller.rb +66 -0
  49. data/app/controllers/the_trade_admin/promote_buyers_controller.rb +39 -0
  50. data/app/controllers/the_trade_admin/promote_charges_controller.rb +62 -0
  51. data/app/controllers/the_trade_admin/promote_goods_controller.rb +50 -0
  52. data/app/controllers/the_trade_admin/promotes_controller.rb +105 -0
  53. data/app/controllers/the_trade_admin/providers_controller.rb +121 -0
  54. data/app/controllers/the_trade_admin/refunds_controller.rb +60 -0
  55. data/app/controllers/the_trade_admin/serve_charges_controller.rb +67 -0
  56. data/app/controllers/the_trade_admin/serves_controller.rb +107 -0
  57. data/app/controllers/the_trade_my/addresses_controller.rb +50 -0
  58. data/app/controllers/the_trade_my/base_controller.rb +13 -0
  59. data/app/controllers/the_trade_my/buyers_controller.rb +35 -0
  60. data/app/controllers/the_trade_my/cart_items_controller.rb +71 -0
  61. data/app/controllers/the_trade_my/order_items_controller.rb +49 -0
  62. data/app/controllers/the_trade_my/orders_controller.rb +161 -0
  63. data/app/controllers/the_trade_my/payment_methods_controller.rb +76 -0
  64. data/app/controllers/the_trade_my/providers_controller.rb +44 -0
  65. data/app/models/rails_trade/address.rb +14 -0
  66. data/app/models/rails_trade/area.rb +65 -0
  67. data/app/models/rails_trade/cart_item.rb +185 -0
  68. data/app/models/rails_trade/cart_item_serve.rb +16 -0
  69. data/app/models/rails_trade/concerns/good_able.rb +63 -0
  70. data/app/models/rails_trade/concerns/order_able.rb +48 -0
  71. data/app/models/rails_trade/concerns/promote_fee.rb +54 -0
  72. data/app/models/rails_trade/concerns/serve_fee.rb +41 -0
  73. data/app/models/rails_trade/concerns/summary_service.rb +67 -0
  74. data/app/models/rails_trade/concerns/the_payment.rb +88 -0
  75. data/app/models/rails_trade/concerns/the_refund.rb +36 -0
  76. data/app/models/rails_trade/concerns/the_trade_buyer.rb +50 -0
  77. data/app/models/rails_trade/concerns/the_trade_user.rb +23 -0
  78. data/app/models/rails_trade/good_partner.rb +8 -0
  79. data/app/models/rails_trade/good_produce.rb +14 -0
  80. data/app/models/rails_trade/order.rb +111 -0
  81. data/app/models/rails_trade/order_item.rb +88 -0
  82. data/app/models/rails_trade/order_promote.rb +23 -0
  83. data/app/models/rails_trade/order_serve.rb +23 -0
  84. data/app/models/rails_trade/order_shipment.rb +10 -0
  85. data/app/models/rails_trade/payment.rb +135 -0
  86. data/app/models/rails_trade/payment_interface/payment_interface_base.rb +8 -0
  87. data/app/models/rails_trade/payment_interface/the_alipay.rb +49 -0
  88. data/app/models/rails_trade/payment_interface/the_paypal.rb +103 -0
  89. data/app/models/rails_trade/payment_interface/the_stripe.rb +73 -0
  90. data/app/models/rails_trade/payment_interface/the_wxpay.rb +56 -0
  91. data/app/models/rails_trade/payment_method.rb +57 -0
  92. data/app/models/rails_trade/payment_methods/alipay_method.rb +7 -0
  93. data/app/models/rails_trade/payment_methods/bank_method.rb +7 -0
  94. data/app/models/rails_trade/payment_methods/stripe_method.rb +57 -0
  95. data/app/models/rails_trade/payment_order.rb +75 -0
  96. data/app/models/rails_trade/payment_reference.rb +15 -0
  97. data/app/models/rails_trade/payment_strategy.rb +16 -0
  98. data/app/models/rails_trade/payments/alipay_payment.rb +12 -0
  99. data/app/models/rails_trade/payments/bank_payment.rb +15 -0
  100. data/app/models/rails_trade/payments/hand_payment.rb +13 -0
  101. data/app/models/rails_trade/payments/paypal_payment.rb +8 -0
  102. data/app/models/rails_trade/payments/stripe_payment.rb +7 -0
  103. data/app/models/rails_trade/payments/wxpay_payment.rb +14 -0
  104. data/app/models/rails_trade/produce.rb +18 -0
  105. data/app/models/rails_trade/promote.rb +40 -0
  106. data/app/models/rails_trade/promote_buyer.rb +9 -0
  107. data/app/models/rails_trade/promote_charge.rb +17 -0
  108. data/app/models/rails_trade/promote_charges/single_promote_charge.rb +7 -0
  109. data/app/models/rails_trade/promote_charges/total_promote_charge.rb +7 -0
  110. data/app/models/rails_trade/promote_good.rb +9 -0
  111. data/app/models/rails_trade/promotes/amount_promote.rb +4 -0
  112. data/app/models/rails_trade/promotes/number_promote.rb +4 -0
  113. data/app/models/rails_trade/provider.rb +25 -0
  114. data/app/models/rails_trade/refund.rb +63 -0
  115. data/app/models/rails_trade/refunds/alipay_refund.rb +33 -0
  116. data/app/models/rails_trade/refunds/bank_refund.rb +5 -0
  117. data/app/models/rails_trade/refunds/hand_refund.rb +5 -0
  118. data/app/models/rails_trade/refunds/paypal_refund.rb +32 -0
  119. data/app/models/rails_trade/refunds/stripe_refund.rb +26 -0
  120. data/app/models/rails_trade/refunds/wxpay_refund.rb +40 -0
  121. data/app/models/rails_trade/serve.rb +44 -0
  122. data/app/models/rails_trade/serve_charge.rb +37 -0
  123. data/app/models/rails_trade/serve_charges/single_serve_charge.rb +7 -0
  124. data/app/models/rails_trade/serve_charges/total_serve_charge.rb +7 -0
  125. data/app/models/rails_trade/serve_good.rb +9 -0
  126. data/app/models/rails_trade/serves/number_serve.rb +4 -0
  127. data/app/models/rails_trade/serves/quantity_serve.rb +4 -0
  128. data/app/models/rails_trade/shipment.rb +8 -0
  129. data/app/views/buyers/_show.html.erb +7 -0
  130. data/app/views/buyers/show.js.erb +1 -0
  131. data/app/views/goods/_choose.html.erb +36 -0
  132. data/app/views/goods/_good.html.erb +17 -0
  133. data/app/views/goods/_good_item.html.erb +17 -0
  134. data/app/views/goods/_nav.html.erb +18 -0
  135. data/app/views/goods/_search.html.erb +6 -0
  136. data/app/views/goods/index.html.erb +34 -0
  137. data/app/views/goods/index/_product.html.erb +14 -0
  138. data/app/views/goods/item.html.erb +47 -0
  139. data/app/views/goods/produce.html.erb +48 -0
  140. data/app/views/goods/show.html.erb +2 -0
  141. data/app/views/goods/show/_basic.html.erb +23 -0
  142. data/app/views/goods/show/_carousel.html.erb +35 -0
  143. data/app/views/goods/show/_items.html.erb +32 -0
  144. data/app/views/goods/show/_sales.html.erb +17 -0
  145. data/app/views/goods/show/_side.html.erb +19 -0
  146. data/app/views/goods/taxon/_breadcrumb.html.erb +8 -0
  147. data/app/views/goods/taxon/_nav.html.erb +19 -0
  148. data/app/views/goods/taxon/_nav_.html.erb +18 -0
  149. data/app/views/goods/taxon/_nav_last.html.erb +19 -0
  150. data/app/views/layouts/rails_trade_admin/base.html.erb +25 -0
  151. data/app/views/layouts/rails_trade_my/base.html.erb +28 -0
  152. data/app/views/rails_trade_admin/addresses/_address.html.erb +24 -0
  153. data/app/views/rails_trade_admin/addresses/_edit.html.erb +13 -0
  154. data/app/views/rails_trade_admin/addresses/_form.html.erb +23 -0
  155. data/app/views/rails_trade_admin/addresses/_new.html.erb +13 -0
  156. data/app/views/rails_trade_admin/addresses/create.js.erb +2 -0
  157. data/app/views/rails_trade_admin/addresses/destroy.js.erb +1 -0
  158. data/app/views/rails_trade_admin/addresses/edit.js.erb +39 -0
  159. data/app/views/rails_trade_admin/addresses/index.html.erb +41 -0
  160. data/app/views/rails_trade_admin/addresses/new.js.erb +52 -0
  161. data/app/views/rails_trade_admin/addresses/show.html.erb +4 -0
  162. data/app/views/rails_trade_admin/addresses/update.js.erb +2 -0
  163. data/app/views/rails_trade_admin/areas/_form.html.erb +9 -0
  164. data/app/views/rails_trade_admin/areas/edit.html.erb +16 -0
  165. data/app/views/rails_trade_admin/areas/index.html.erb +43 -0
  166. data/app/views/rails_trade_admin/areas/new.html.erb +11 -0
  167. data/app/views/rails_trade_admin/areas/show.html.erb +1 -0
  168. data/app/views/rails_trade_admin/base/_nav.html.erb +24 -0
  169. data/app/views/rails_trade_admin/base/_nav_bar.html.erb +23 -0
  170. data/app/views/rails_trade_admin/base/_nav_payment.html.erb +25 -0
  171. data/app/views/rails_trade_admin/buyers/_form.html.erb +17 -0
  172. data/app/views/rails_trade_admin/buyers/_menu.html.erb +5 -0
  173. data/app/views/rails_trade_admin/buyers/_search_form.html.erb +11 -0
  174. data/app/views/rails_trade_admin/buyers/edit.html.erb +6 -0
  175. data/app/views/rails_trade_admin/buyers/index.html.erb +46 -0
  176. data/app/views/rails_trade_admin/buyers/new.html.erb +5 -0
  177. data/app/views/rails_trade_admin/buyers/orders.html.erb +134 -0
  178. data/app/views/rails_trade_admin/buyers/overdue.html.erb +49 -0
  179. data/app/views/rails_trade_admin/buyers/show.html.erb +4 -0
  180. data/app/views/rails_trade_admin/cart_item_serves/_check.html.erb +12 -0
  181. data/app/views/rails_trade_admin/cart_item_serves/_index.html.erb +37 -0
  182. data/app/views/rails_trade_admin/cart_item_serves/_new.html.erb +14 -0
  183. data/app/views/rails_trade_admin/cart_item_serves/_serve.html.erb +16 -0
  184. data/app/views/rails_trade_admin/cart_item_serves/_single.html.erb +10 -0
  185. data/app/views/rails_trade_admin/cart_item_serves/_single_table.html.erb +29 -0
  186. data/app/views/rails_trade_admin/cart_item_serves/_total.html.erb +10 -0
  187. data/app/views/rails_trade_admin/cart_item_serves/_total_table.html.erb +26 -0
  188. data/app/views/rails_trade_admin/cart_item_serves/add.js.erb +47 -0
  189. data/app/views/rails_trade_admin/cart_item_serves/create.js.erb +3 -0
  190. data/app/views/rails_trade_admin/cart_item_serves/destroy.js.erb +50 -0
  191. data/app/views/rails_trade_admin/cart_item_serves/index.js.erb +50 -0
  192. data/app/views/rails_trade_admin/cart_item_serves/new.js.erb +5 -0
  193. data/app/views/rails_trade_admin/cart_item_serves/single.js.erb +55 -0
  194. data/app/views/rails_trade_admin/cart_item_serves/total.js.erb +55 -0
  195. data/app/views/rails_trade_admin/cart_items/_additions.html.erb +20 -0
  196. data/app/views/rails_trade_admin/cart_items/_filter.html.erb +15 -0
  197. data/app/views/rails_trade_admin/cart_items/_good_price.html.erb +10 -0
  198. data/app/views/rails_trade_admin/cart_items/_order_price.html.erb +27 -0
  199. data/app/views/rails_trade_admin/cart_items/_retail_price.html.erb +4 -0
  200. data/app/views/rails_trade_admin/cart_items/_single_price.html.erb +28 -0
  201. data/app/views/rails_trade_admin/cart_items/_total_price.html.erb +9 -0
  202. data/app/views/rails_trade_admin/cart_items/destroy.js.erb +1 -0
  203. data/app/views/rails_trade_admin/cart_items/error.html.erb +3 -0
  204. data/app/views/rails_trade_admin/cart_items/index.html.erb +104 -0
  205. data/app/views/rails_trade_admin/cart_items/only.html.erb +72 -0
  206. data/app/views/rails_trade_admin/cart_items/total.js.erb +11 -0
  207. data/app/views/rails_trade_admin/cart_items/update.js.erb +11 -0
  208. data/app/views/rails_trade_admin/goods/_form.html.erb +7 -0
  209. data/app/views/rails_trade_admin/goods/_item.html.erb +6 -0
  210. data/app/views/rails_trade_admin/goods/_new.html.erb +11 -0
  211. data/app/views/rails_trade_admin/goods/_show.html.erb +24 -0
  212. data/app/views/rails_trade_admin/goods/_show_tr.html.erb +24 -0
  213. data/app/views/rails_trade_admin/goods/create.js.erb +2 -0
  214. data/app/views/rails_trade_admin/goods/destroy.js.erb +1 -0
  215. data/app/views/rails_trade_admin/goods/edit.html.erb +16 -0
  216. data/app/views/rails_trade_admin/goods/edit.js.erb +8 -0
  217. data/app/views/rails_trade_admin/goods/edit_items.html.erb +43 -0
  218. data/app/views/rails_trade_admin/goods/edit_pic.html.erb +32 -0
  219. data/app/views/rails_trade_admin/goods/edit_promote.html.erb +64 -0
  220. data/app/views/rails_trade_admin/goods/index.html.erb +32 -0
  221. data/app/views/rails_trade_admin/goods/new.html.erb +14 -0
  222. data/app/views/rails_trade_admin/goods/new.js.erb +8 -0
  223. data/app/views/rails_trade_admin/goods/show.js.erb +5 -0
  224. data/app/views/rails_trade_admin/goods/update.js.erb +2 -0
  225. data/app/views/rails_trade_admin/order_payments/_index.html.erb +44 -0
  226. data/app/views/rails_trade_admin/order_payments/_new.html.erb +44 -0
  227. data/app/views/rails_trade_admin/order_payments/_payment_orders.html.erb +17 -0
  228. data/app/views/rails_trade_admin/order_payments/_payments.html.erb +19 -0
  229. data/app/views/rails_trade_admin/order_payments/create.js.erb +2 -0
  230. data/app/views/rails_trade_admin/order_payments/create_fail.js.erb +1 -0
  231. data/app/views/rails_trade_admin/order_payments/destroy.js.erb +2 -0
  232. data/app/views/rails_trade_admin/order_payments/index.js.erb +8 -0
  233. data/app/views/rails_trade_admin/order_payments/new.js.erb +8 -0
  234. data/app/views/rails_trade_admin/orders/_addresses.html.erb +36 -0
  235. data/app/views/rails_trade_admin/orders/_filter.html.erb +20 -0
  236. data/app/views/rails_trade_admin/orders/_form.html.erb +17 -0
  237. data/app/views/rails_trade_admin/orders/_invoice_addresses.html.erb +36 -0
  238. data/app/views/rails_trade_admin/orders/_item.html.erb +10 -0
  239. data/app/views/rails_trade_admin/orders/_new_items.html.erb +70 -0
  240. data/app/views/rails_trade_admin/orders/_search_form.html.erb +7 -0
  241. data/app/views/rails_trade_admin/orders/edit.html.erb +1 -0
  242. data/app/views/rails_trade_admin/orders/index.html.erb +61 -0
  243. data/app/views/rails_trade_admin/orders/new.html.erb +23 -0
  244. data/app/views/rails_trade_admin/orders/payments.html.erb +50 -0
  245. data/app/views/rails_trade_admin/orders/refresh.js.erb +7 -0
  246. data/app/views/rails_trade_admin/orders/show.html.erb +89 -0
  247. data/app/views/rails_trade_admin/payment_methods/_edit.html.erb +6 -0
  248. data/app/views/rails_trade_admin/payment_methods/_form.html.erb +5 -0
  249. data/app/views/rails_trade_admin/payment_methods/_index_layout.html.erb +15 -0
  250. data/app/views/rails_trade_admin/payment_methods/_new.html.erb +13 -0
  251. data/app/views/rails_trade_admin/payment_methods/_payment_method.html.erb +25 -0
  252. data/app/views/rails_trade_admin/payment_methods/_search_form.html.erb +22 -0
  253. data/app/views/rails_trade_admin/payment_methods/create.js.erb +2 -0
  254. data/app/views/rails_trade_admin/payment_methods/destroy.js.erb +1 -0
  255. data/app/views/rails_trade_admin/payment_methods/edit.html.erb +15 -0
  256. data/app/views/rails_trade_admin/payment_methods/edit.js.erb +8 -0
  257. data/app/views/rails_trade_admin/payment_methods/index.html.erb +23 -0
  258. data/app/views/rails_trade_admin/payment_methods/mine.html.erb +23 -0
  259. data/app/views/rails_trade_admin/payment_methods/new.html.erb +15 -0
  260. data/app/views/rails_trade_admin/payment_methods/new.js.erb +7 -0
  261. data/app/views/rails_trade_admin/payment_methods/unverified.html.erb +60 -0
  262. data/app/views/rails_trade_admin/payment_methods/update.js.erb +2 -0
  263. data/app/views/rails_trade_admin/payment_orders/_index.html.erb +31 -0
  264. data/app/views/rails_trade_admin/payment_orders/_new.html.erb +24 -0
  265. data/app/views/rails_trade_admin/payment_orders/_orders.html.erb +27 -0
  266. data/app/views/rails_trade_admin/payment_orders/cancel.js.erb +2 -0
  267. data/app/views/rails_trade_admin/payment_orders/create.js.erb +2 -0
  268. data/app/views/rails_trade_admin/payment_orders/create_fail.js.erb +1 -0
  269. data/app/views/rails_trade_admin/payment_orders/new.js.erb +6 -0
  270. data/app/views/rails_trade_admin/payment_orders/raise_fail.js.erb +1 -0
  271. data/app/views/rails_trade_admin/payment_orders/update.js.erb +2 -0
  272. data/app/views/rails_trade_admin/payment_orders/update_fail.js.erb +2 -0
  273. data/app/views/rails_trade_admin/payment_references/_form.html.erb +20 -0
  274. data/app/views/rails_trade_admin/payment_references/_new.html.erb +11 -0
  275. data/app/views/rails_trade_admin/payment_references/destroy.js.erb +1 -0
  276. data/app/views/rails_trade_admin/payment_references/edit.html.erb +6 -0
  277. data/app/views/rails_trade_admin/payment_references/index.html.erb +25 -0
  278. data/app/views/rails_trade_admin/payment_references/new.js.erb +8 -0
  279. data/app/views/rails_trade_admin/payment_references/show.html.erb +4 -0
  280. data/app/views/rails_trade_admin/payment_strategies/_form.html.erb +5 -0
  281. data/app/views/rails_trade_admin/payment_strategies/edit.html.erb +13 -0
  282. data/app/views/rails_trade_admin/payment_strategies/index.html.erb +37 -0
  283. data/app/views/rails_trade_admin/payment_strategies/new.html.erb +13 -0
  284. data/app/views/rails_trade_admin/payments/_form.html.erb +12 -0
  285. data/app/views/rails_trade_admin/payments/_item.html.erb +49 -0
  286. data/app/views/rails_trade_admin/payments/_search_form.html.erb +15 -0
  287. data/app/views/rails_trade_admin/payments/analyze.js.erb +12 -0
  288. data/app/views/rails_trade_admin/payments/dashboard.html.erb +4 -0
  289. data/app/views/rails_trade_admin/payments/edit.html.erb +15 -0
  290. data/app/views/rails_trade_admin/payments/index.html.erb +60 -0
  291. data/app/views/rails_trade_admin/payments/new.html.erb +17 -0
  292. data/app/views/rails_trade_admin/payments/show.html.erb +4 -0
  293. data/app/views/rails_trade_admin/promote_buyers/_form.html.erb +6 -0
  294. data/app/views/rails_trade_admin/promote_buyers/_promote_buyer.json.jbuilder +2 -0
  295. data/app/views/rails_trade_admin/promote_buyers/edit.html.erb +14 -0
  296. data/app/views/rails_trade_admin/promote_buyers/index.html.erb +42 -0
  297. data/app/views/rails_trade_admin/promote_buyers/index.json.jbuilder +1 -0
  298. data/app/views/rails_trade_admin/promote_buyers/new.html.erb +13 -0
  299. data/app/views/rails_trade_admin/promote_buyers/show.html.erb +0 -0
  300. data/app/views/rails_trade_admin/promote_buyers/show.json.jbuilder +1 -0
  301. data/app/views/rails_trade_admin/promote_charges/_edit.html.erb +13 -0
  302. data/app/views/rails_trade_admin/promote_charges/_form.html.erb +6 -0
  303. data/app/views/rails_trade_admin/promote_charges/_new.html.erb +13 -0
  304. data/app/views/rails_trade_admin/promote_charges/_search_form.html.erb +9 -0
  305. data/app/views/rails_trade_admin/promote_charges/edit.js.erb +8 -0
  306. data/app/views/rails_trade_admin/promote_charges/index.html.erb +49 -0
  307. data/app/views/rails_trade_admin/promote_charges/new.js.erb +8 -0
  308. data/app/views/rails_trade_admin/promote_goods/_form.html.erb +4 -0
  309. data/app/views/rails_trade_admin/promote_goods/_promote_good.json.jbuilder +2 -0
  310. data/app/views/rails_trade_admin/promote_goods/edit.html.erb +14 -0
  311. data/app/views/rails_trade_admin/promote_goods/index.html.erb +37 -0
  312. data/app/views/rails_trade_admin/promote_goods/index.json.jbuilder +1 -0
  313. data/app/views/rails_trade_admin/promote_goods/new.html.erb +13 -0
  314. data/app/views/rails_trade_admin/promote_goods/show.html.erb +0 -0
  315. data/app/views/rails_trade_admin/promote_goods/show.json.jbuilder +1 -0
  316. data/app/views/rails_trade_admin/promotes/_form.html.erb +9 -0
  317. data/app/views/rails_trade_admin/promotes/edit.html.erb +9 -0
  318. data/app/views/rails_trade_admin/promotes/index.html.erb +65 -0
  319. data/app/views/rails_trade_admin/promotes/new.html.erb +9 -0
  320. data/app/views/rails_trade_admin/promotes/show.html.erb +4 -0
  321. data/app/views/rails_trade_admin/providers/_form.html.erb +6 -0
  322. data/app/views/rails_trade_admin/providers/_product.html.erb +12 -0
  323. data/app/views/rails_trade_admin/providers/_side.html.erb +8 -0
  324. data/app/views/rails_trade_admin/providers/area.html.erb +1 -0
  325. data/app/views/rails_trade_admin/providers/channel.html.erb +46 -0
  326. data/app/views/rails_trade_admin/providers/edit.html.erb +16 -0
  327. data/app/views/rails_trade_admin/providers/index.html.erb +27 -0
  328. data/app/views/rails_trade_admin/providers/new.html.erb +21 -0
  329. data/app/views/rails_trade_admin/providers/posts.html.erb +41 -0
  330. data/app/views/rails_trade_admin/providers/products.html.erb +23 -0
  331. data/app/views/rails_trade_admin/providers/show.html.erb +60 -0
  332. data/app/views/rails_trade_admin/refunds/_form.html.erb +17 -0
  333. data/app/views/rails_trade_admin/refunds/_logs_table.html.erb +33 -0
  334. data/app/views/rails_trade_admin/refunds/_new.html.erb +18 -0
  335. data/app/views/rails_trade_admin/refunds/_search_form.html.erb +13 -0
  336. data/app/views/rails_trade_admin/refunds/edit.html.erb +6 -0
  337. data/app/views/rails_trade_admin/refunds/index.html.erb +57 -0
  338. data/app/views/rails_trade_admin/refunds/logs.js.erb +8 -0
  339. data/app/views/rails_trade_admin/refunds/new.html.erb +5 -0
  340. data/app/views/rails_trade_admin/refunds/new.js.erb +8 -0
  341. data/app/views/rails_trade_admin/refunds/show.html.erb +4 -0
  342. data/app/views/rails_trade_admin/serve_charges/_edit.html.erb +13 -0
  343. data/app/views/rails_trade_admin/serve_charges/_form.html.erb +10 -0
  344. data/app/views/rails_trade_admin/serve_charges/_new.html.erb +13 -0
  345. data/app/views/rails_trade_admin/serve_charges/_search_form.html.erb +10 -0
  346. data/app/views/rails_trade_admin/serve_charges/edit.js.erb +7 -0
  347. data/app/views/rails_trade_admin/serve_charges/index.html.erb +56 -0
  348. data/app/views/rails_trade_admin/serve_charges/new.js.erb +8 -0
  349. data/app/views/rails_trade_admin/serves/_form.html.erb +9 -0
  350. data/app/views/rails_trade_admin/serves/edit.html.erb +9 -0
  351. data/app/views/rails_trade_admin/serves/index.html.erb +80 -0
  352. data/app/views/rails_trade_admin/serves/new.html.erb +9 -0
  353. data/app/views/rails_trade_my/addresses/_edit.html.erb +31 -0
  354. data/app/views/rails_trade_my/addresses/_form.html.erb +23 -0
  355. data/app/views/rails_trade_my/addresses/_new.html.erb +11 -0
  356. data/app/views/rails_trade_my/addresses/create.js.erb +2 -0
  357. data/app/views/rails_trade_my/addresses/destroy.js.erb +1 -0
  358. data/app/views/rails_trade_my/addresses/edit.js.erb +39 -0
  359. data/app/views/rails_trade_my/addresses/index.html.erb +44 -0
  360. data/app/views/rails_trade_my/addresses/new.js.erb +39 -0
  361. data/app/views/rails_trade_my/addresses/show.html.erb +4 -0
  362. data/app/views/rails_trade_my/addresses/update.js.erb +2 -0
  363. data/app/views/rails_trade_my/base/_nav.html.erb +22 -0
  364. data/app/views/rails_trade_my/buyers/_form.html.erb +5 -0
  365. data/app/views/rails_trade_my/buyers/edit.html.erb +2 -0
  366. data/app/views/rails_trade_my/buyers/show.html.erb +21 -0
  367. data/app/views/rails_trade_my/cart_items/_additions.html.erb +22 -0
  368. data/app/views/rails_trade_my/cart_items/_single_price.html.erb +6 -0
  369. data/app/views/rails_trade_my/cart_items/_total_price.html.erb +8 -0
  370. data/app/views/rails_trade_my/cart_items/destroy.js.erb +1 -0
  371. data/app/views/rails_trade_my/cart_items/index.html.erb +69 -0
  372. data/app/views/rails_trade_my/cart_items/total.js.erb +11 -0
  373. data/app/views/rails_trade_my/cart_items/update.js.erb +8 -0
  374. data/app/views/rails_trade_my/my/index.html.erb +17 -0
  375. data/app/views/rails_trade_my/order_items/_form.html.erb +17 -0
  376. data/app/views/rails_trade_my/order_items/edit.html.erb +6 -0
  377. data/app/views/rails_trade_my/order_items/index.html.erb +25 -0
  378. data/app/views/rails_trade_my/order_items/new.html.erb +5 -0
  379. data/app/views/rails_trade_my/order_items/show.html.erb +8 -0
  380. data/app/views/rails_trade_my/orders/_date_form.html.erb +23 -0
  381. data/app/views/rails_trade_my/orders/_edit.html.erb +10 -0
  382. data/app/views/rails_trade_my/orders/_edit_payment_type.html.erb +13 -0
  383. data/app/views/rails_trade_my/orders/_form.html.erb +4 -0
  384. data/app/views/rails_trade_my/orders/destroy.js.erb +1 -0
  385. data/app/views/rails_trade_my/orders/edit.js.erb +4 -0
  386. data/app/views/rails_trade_my/orders/edit_payment_type.js.erb +6 -0
  387. data/app/views/rails_trade_my/orders/fail.html.erb +11 -0
  388. data/app/views/rails_trade_my/orders/index.html.erb +55 -0
  389. data/app/views/rails_trade_my/orders/index.json.jbuilder +9 -0
  390. data/app/views/rails_trade_my/orders/new.html.erb +41 -0
  391. data/app/views/rails_trade_my/orders/refresh.js.erb +7 -0
  392. data/app/views/rails_trade_my/orders/show.html.erb +103 -0
  393. data/app/views/rails_trade_my/orders/success.html.erb +12 -0
  394. data/app/views/rails_trade_my/orders/update.js.erb +3 -0
  395. data/app/views/rails_trade_my/orders/update_payment_type.js.erb +3 -0
  396. data/app/views/rails_trade_my/orders/wxpay_pay.js.erb +16 -0
  397. data/app/views/rails_trade_my/orders/wxpay_pay_err.js.erb +5 -0
  398. data/app/views/rails_trade_my/payment_methods/_edit.html.erb +13 -0
  399. data/app/views/rails_trade_my/payment_methods/_form.html.erb +5 -0
  400. data/app/views/rails_trade_my/payment_methods/_index.html.erb +25 -0
  401. data/app/views/rails_trade_my/payment_methods/_item.html.erb +10 -0
  402. data/app/views/rails_trade_my/payment_methods/_new.html.erb +13 -0
  403. data/app/views/rails_trade_my/payment_methods/create.js.erb +3 -0
  404. data/app/views/rails_trade_my/payment_methods/destroy.js.erb +1 -0
  405. data/app/views/rails_trade_my/payment_methods/edit.js.erb +8 -0
  406. data/app/views/rails_trade_my/payment_methods/index.html.erb +1 -0
  407. data/app/views/rails_trade_my/payment_methods/index.js.erb +1 -0
  408. data/app/views/rails_trade_my/payment_methods/new.js.erb +8 -0
  409. data/app/views/rails_trade_my/payment_methods/show.html.erb +4 -0
  410. data/app/views/rails_trade_my/payment_methods/update.js.erb +2 -0
  411. data/app/views/rails_trade_my/providers/_form.html.erb +5 -0
  412. data/app/views/rails_trade_my/providers/_provider.html.erb +20 -0
  413. data/app/views/rails_trade_my/providers/edit.html.erb +2 -0
  414. data/app/views/rails_trade_my/providers/index.html.erb +12 -0
  415. data/app/views/rails_trade_my/providers/new.html.erb +10 -0
  416. data/app/views/rails_trade_my/providers/show.html.erb +13 -0
  417. data/app/views/rails_trade_my/users/_form.html.erb +17 -0
  418. data/app/views/rails_trade_my/users/edit.html.erb +44 -0
  419. data/app/views/rails_trade_my/users/show.html.erb +18 -0
  420. data/config/locales/en.yml +85 -0
  421. data/config/locales/zh.yml +75 -0
  422. data/config/routes.rb +118 -0
  423. data/db/migrate/20150514135720_create_providers.rb +59 -0
  424. data/db/migrate/20170601014520_create_payments.rb +52 -0
  425. data/db/migrate/20170602061859_create_payment_references.rb +12 -0
  426. data/db/migrate/20170702234123_create_orders.rb +56 -0
  427. data/db/migrate/20170714080032_create_payment_strategies.rb +77 -0
  428. data/db/migrate/20171115063702_create_promote_buyers.rb +31 -0
  429. data/db/schema.rb +94 -0
  430. data/lib/rails_trade.rb +22 -0
  431. data/lib/rails_trade/config.rb +12 -0
  432. data/lib/rails_trade/engine.rb +30 -0
  433. data/lib/rails_trade/version.rb +3 -0
  434. data/lib/tasks/the_trade_tasks.rake +4 -0
  435. metadata +491 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 79869fd94d1d309bcb742d29ff7802e24a5dbe575bb592a958fd36c9a9a1ce50
4
+ data.tar.gz: a3677b595f761113163f73f14caea9b2593f28d5417c3866c7bef7649814d3ce
5
+ SHA512:
6
+ metadata.gz: 5628d0ccd6a19c839f3c6a44b199afff6d4ee0c9dd1b4e45a708c4baba5429afca66b28dccec0fcb209116bc652afe1c5cae47c2210d3d1275726922f00edb04
7
+ data.tar.gz: 39ebb407b45c5e77254ebe963cb67deb2d8b44a0979deb985b936a838844d5460ab91f2435bc16eedf9b35602035ac5390b1df666266b46d5b7b8287f576f8f1
data/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,47 @@
1
+ # RailsTrade
2
+
3
+
4
+
5
+ ## 核心模型
6
+
7
+ * good_type / good_id
8
+
9
+ 可进行售卖,出租的实体,将其关联 good 即可处理。`Good`模型会处理涉及由可交易产生的信息,比如价格、促销方式等。
10
+
11
+ * User/Buyer
12
+
13
+ #### 流程
14
+ CartItem -> Order(OrderItem) <=> Payment
15
+
16
+
17
+ QuotationItem -> Order(OrderItem)
18
+
19
+ ```
20
+ └ Promote
21
+ ```
22
+
23
+ #### 集成商品编辑信息
24
+ ```erb
25
+
26
+ ```
27
+
28
+ OrderItem <=> Shipment
29
+
30
+ * Buyer
31
+
32
+ * Provider
33
+
34
+ #### Dev
35
+ -[] support process to order by cart item ids
36
+
37
+ ### Warning
38
+ * Order: amount, received_amount
39
+ * Payment: total_amount, checked_amount
40
+ * PaymentOrder: check_amount
41
+
42
+ ### 依赖
43
+ * [default_form](https://github.com/qinmingyuan/default_form)
44
+ * [default_where](https://github.com/qinmingyuan/default_where)
45
+ * [the_audit](https://github.com/yougexiangfa/the_audit)
46
+ * [the_data](https://github.com/yougexiangfa/the_data)
47
+ * admin/payments
@@ -0,0 +1,37 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'TheTrade'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+
37
+ task default: :test
@@ -0,0 +1 @@
1
+ //= link_tree ../javascripts/controllers .js
@@ -0,0 +1,15 @@
1
+ $('#q_buyer_id').dropdown({
2
+ apiSettings: {
3
+ url: '/buyers/search?q={query}',
4
+ beforeSend: function(settings) {
5
+ return settings;
6
+ }
7
+ },
8
+ fields: {
9
+ name: 'name_detail',
10
+ value: 'id'
11
+ },
12
+ minCharacters: 2
13
+ });
14
+ $('#q_payment_strategy_id').dropdown();
15
+ $('#q_crm_permits\\.manager_id').dropdown();
@@ -0,0 +1,15 @@
1
+ $('#q_buyer_id').dropdown({
2
+ apiSettings: {
3
+ url: '/buyers/search?q={query}',
4
+ beforeSend: function(settings) {
5
+ return settings;
6
+ }
7
+ },
8
+ fields: {
9
+ name: 'name_detail',
10
+ value: 'id'
11
+ },
12
+ minCharacters: 2
13
+ });
14
+ $('#q_payment_strategy_id').dropdown();
15
+ $('#q_crm_permits\\.manager_id').dropdown();
@@ -0,0 +1,80 @@
1
+ function increase_quantity(cart_item_id){
2
+ var q = $('#quantity_' + cart_item_id);
3
+ var x = parseInt(q.val());
4
+ q.val(x + 1);
5
+ update_quantity(cart_item_id);
6
+ }
7
+
8
+ function decrease_quantity(cart_item_id){
9
+ var q = $('#quantity_' + cart_item_id);
10
+ var x = parseInt(q.val());
11
+ q.val(x - 1);
12
+ update_quantity(cart_item_id);
13
+ }
14
+
15
+ function update_quantity(cart_item_id){
16
+ var q = $('#quantity_' + cart_item_id);
17
+ var url = '/admin/cart_items/' + cart_item_id;
18
+ var params = {
19
+ method: 'PATCH',
20
+ credentials: 'include',
21
+ headers: {
22
+ 'Content-Type': 'application/json',
23
+ 'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
24
+ },
25
+ body: JSON.stringify({
26
+ quantity: q.val()
27
+ })
28
+ };
29
+ fetch(url, params).then(function(response) {
30
+ return response.text()
31
+ }).then(function(response) {
32
+ var script = document.createElement('script');
33
+ script.text = response;
34
+ document.head.appendChild(script).parentNode.removeChild(script);
35
+ }).catch(function(ex) {
36
+ console.log('parsing failed', ex)
37
+ })
38
+ }
39
+
40
+ $('input[name="cart_item_id"]').change(function(){
41
+ var search_path = window.location.search;
42
+ var total_url;
43
+ if (this.checked) {
44
+ total_url = '/admin/cart_items/total' + search_path + '&add_id=' + this.value;
45
+ } else {
46
+ total_url = '/admin/cart_items/total' + search_path + '&remove_id=' + this.value;
47
+ }
48
+ var params = {
49
+ credentials: 'include',
50
+ headers: {
51
+ 'Accept': 'application/javascript',
52
+ 'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
53
+ }
54
+ };
55
+ fetch(total_url, params).then(function(response) {
56
+ return response.text()
57
+ }).then(function(response) {
58
+ var script = document.createElement('script');
59
+ script.text = response;
60
+ document.head.appendChild(script).parentNode.removeChild(script);
61
+ }).catch(function(ex) {
62
+ console.log('parsing failed', ex)
63
+ })
64
+ });
65
+
66
+ $('.xx_popup').popup({
67
+ popup: '.ui.popup'
68
+ });
69
+
70
+ $('#user_id').dropdown({
71
+ onChange: function(value, text, $selectedItem){
72
+ var path = new URL(window.location.href);
73
+ path.searchParams.delete('good_type');
74
+ path.searchParams.delete('good_id');
75
+ console.log(path)
76
+ path.searchParams.set('user_id', value);
77
+ window.location.href = path;
78
+ }
79
+ });
80
+
@@ -0,0 +1,45 @@
1
+ function increase_quantity(cart_item_id){
2
+ var q = $('#quantity_' + cart_item_id);
3
+ var x = parseInt(q.val());
4
+ q.val(x + 1);
5
+ update_quantity(cart_item_id);
6
+ }
7
+
8
+ function decrease_quantity(cart_item_id){
9
+ var q = $('#quantity_' + cart_item_id);
10
+ var x = parseInt(q.val());
11
+ q.val(x - 1);
12
+ update_quantity(cart_item_id);
13
+ }
14
+
15
+ function update_quantity(cart_item_id){
16
+ var q = $('#quantity_' + cart_item_id);
17
+ var url = '/admin/cart_items/' + cart_item_id;
18
+ var params = {
19
+ method: 'PATCH',
20
+ credentials: 'include',
21
+ headers: {
22
+ 'Content-Type': 'application/json',
23
+ 'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
24
+ },
25
+ body: JSON.stringify({
26
+ quantity: q.val()
27
+ })
28
+ };
29
+ fetch(url, params).then(function(response) {
30
+ return response.text()
31
+ }).then(function(response) {
32
+ var script = document.createElement('script');
33
+ script.text = response;
34
+ document.head.appendChild(script).parentNode.removeChild(script);
35
+ }).catch(function(ex) {
36
+ console.log('parsing failed', ex)
37
+ })
38
+ }
39
+
40
+ $('.xx_popup').popup({
41
+ popup: '.ui.popup'
42
+ });
43
+
44
+
45
+
@@ -0,0 +1,29 @@
1
+ $('input[name="order[address_id]"]').change(function(){
2
+ var search_path = window.location.search;
3
+ var total_url;
4
+ var query_data = {
5
+ extra: {
6
+ zone: this.dataset['zone']
7
+ }
8
+ };
9
+ var query_result = $.param(query_data);
10
+ if (this.checked) {
11
+ total_url = '/admin/orders/refresh' + search_path + '&' + query_result;
12
+ }
13
+ var params = {
14
+ credentials: 'include',
15
+ headers: {
16
+ 'Accept': 'application/javascript',
17
+ 'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
18
+ }
19
+ };
20
+ fetch(total_url, params).then(function(response) {
21
+ return response.text()
22
+ }).then(function(response) {
23
+ var script = document.createElement('script');
24
+ script.text = response;
25
+ document.head.appendChild(script).parentNode.removeChild(script);
26
+ }).catch(function(ex) {
27
+ console.log('parsing failed', ex)
28
+ })
29
+ });