NameL3ss

prueba_importer

Jul 8th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.84 KB | None | 0 0
  1. $(document).ready(function(){
  2. $("#addNewTag").click(function(){
  3. var total_child_divs = $(".route_form form").children('div').length;
  4. $(".new_guide_item").append("<div class=\"new-ibox inner clearfix\" id=\"product_$total_child_divs">" + $(".new-ibox").html() + "</div>");
  5. });
  6. });
  7.  
  8. var count = 1;
  9. $('.new-ibox').each(function() {
  10. $(this).attr('id', 'product_' + count);
  11. count++;
  12. });
  13.  
  14. $(document).ready(function(){
  15. $("#addNewProduct").click(function(){
  16. var total_child_divs = $(".route_form form").children('div').length;
  17. $(".new_guide_item").append("<div class=\"new-ibox inner clearfix\" id=\"product_" + total_child_divs + "\">" + $(".new-ibox").html() + "<div class='col-md-12 text-right' style='padding: 10px'><a class='btn btn-danger' style='text-decoration: none' onclick=\"$("#product_" + total_child_divs").remove()\" id=\"button_" + total_child_divs + "\">Remove Product</a></div></div>");
  18. });
  19.  
  20. });
  21.  
  22.  
  23. $(document).ready(function(){
  24. $("#addNewProduct").click(function(){
  25. var total_child_divs = $(".route_form form").children('div').length;
  26.  
  27. var remove_el = $('#product_' + total_child_divs').remove();
  28. $(".new_guide_item").append("<div class=\"new-ibox inner clearfix\" id=\"product_" + total_child_divs + "\">" + $(".new-ibox").html() + "<div class='col-md-12 text-right' style='padding: 10px'><a class='btn btn-danger' style='text-decoration: none' id=\"button_" + total_child_divs + "\">Remove Product</a></div></div>");
  29. }
  30.  
  31. console.log(remove_el);
  32. );
  33.  
  34. });
  35.  
  36.  
  37.  
  38.  
  39. @data.each{|x| x["importer_attributes"].sort_by{|im| im["col"].to_i }.each{|im_a| im_a.to_a.each{|k| pp k[1] } unless x["importer_attributes"].nil? } }
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. *************************************************************
  47. Get Importer's Config By Account
  48.  
  49. http://localhost:3000/api/importer/v1/get_account_importer/1
  50.  
  51. [
  52. {
  53. "_id": {
  54. "$oid": "5cdc939f75a9e6646cebd379"
  55. },
  56. "account_id": 1,
  57. "append_routes": false,
  58. "cache_policy": "none",
  59. "check_guide_no_route": true,
  60. "check_status": false,
  61. "col_step": "",
  62. "create_routes": true,
  63. "encoding": "UTF-8",
  64. "extension": "",
  65. "header_row": 0,
  66. "importer_attributes": [
  67. {
  68. "_id": {
  69. "$oid": "5cdc93ab75a9e6646cebd37a"
  70. },
  71. "col": 1,
  72. "force_create": false,
  73. "is_group": false,
  74. "is_tag": false,
  75. "label": "Contact ID",
  76. "multiple_columns": [],
  77. "name": "contact_id",
  78. "row": null
  79. },
  80. {
  81. "_id": {
  82. "$oid": "5cdc93ac75a9e6646cebd37b"
  83. },
  84. "col": 2,
  85. "force_create": false,
  86. "is_group": false,
  87. "is_tag": false,
  88. "label": "identifier",
  89. "multiple_columns": [],
  90. "name": "identifier",
  91. "row": null
  92. }
  93. ],
  94. "is_default": true,
  95. "matrix_example": null,
  96. "row_step": null,
  97. "version": null
  98. },
  99. {
  100. "_id": {
  101. "$oid": "5cdc950875a9e67200487868"
  102. },
  103. "account_id": 1,
  104. "append_routes": false,
  105. "cache_policy": "none",
  106. "check_guide_no_route": true,
  107. "check_status": false,
  108. "col_step": "",
  109. "create_routes": false,
  110. "encoding": "UTF-8",
  111. "extension": "",
  112. "header_row": 0,
  113. "importer_attributes": [
  114. {
  115. "_id": {
  116. "$oid": "5cdc93ab75a9e6646cebd37a"
  117. },
  118. "col": 1,
  119. "force_create": false,
  120. "is_group": false,
  121. "is_tag": true,
  122. "label": "identifier",
  123. "multiple_columns": [],
  124. "name": "contact_phone",
  125. "row": null
  126. },
  127. {
  128. "_id": {
  129. "$oid": "5cdda37675a9e6093b882274"
  130. },
  131. "col": 2,
  132. "force_create": true,
  133. "is_group": false,
  134. "is_tag": false,
  135. "label": "service_time",
  136. "multiple_columns": [],
  137. "name": "service_time",
  138. "row": null
  139. },
  140. {
  141. "_id": {
  142. "$oid": "5cdd800175a9e6822a930747"
  143. },
  144. "col": 3,
  145. "force_create": false,
  146. "is_group": false,
  147. "is_tag": false,
  148. "label": "priority",
  149. "multiple_columns": [],
  150. "name": "priority",
  151. "row": null
  152. },
  153. {
  154. "_id": {
  155. "$oid": "5ce5482575a9e66ee595ecae"
  156. },
  157. "col": 4,
  158. "force_create": false,
  159. "is_group": true,
  160. "is_tag": false,
  161. "label": "load",
  162. "multiple_columns": [],
  163. "name": "load",
  164. "row": null
  165. },
  166. {
  167. "_id": {
  168. "$oid": "5ce559d275a9e6aad8ffef4d"
  169. },
  170. "col": 5,
  171. "force_create": false,
  172. "is_group": true,
  173. "is_tag": false,
  174. "label": "status",
  175. "multiple_columns": [],
  176. "name": "substatus_code",
  177. "row": null
  178. }
  179. ],
  180. "is_default": null,
  181. "matrix_example": null,
  182. "row_step": null,
  183. "version": null
  184. }
  185. ]
  186.  
  187. *** Get Importer Config ***
  188.  
  189. http://localhost:3000/api/importer/v1/importer_config/5cdc939f75a9e6646cebd379
  190.  
  191. [
  192. {
  193. "_id": {
  194. "$oid": "5cdc939f75a9e6646cebd379"
  195. },
  196. "account_id": 1,
  197. "append_routes": false,
  198. "cache_policy": "none",
  199. "check_guide_no_route": true,
  200. "check_status": false,
  201. "col_step": "",
  202. "create_routes": true,
  203. "encoding": "UTF-8",
  204. "extension": "",
  205. "header_row": 0,
  206. "importer_attributes": [
  207. {
  208. "_id": {
  209. "$oid": "5cdc93ab75a9e6646cebd37a"
  210. },
  211. "col": 1,
  212. "force_create": false,
  213. "is_group": false,
  214. "is_tag": false,
  215. "label": "Contact ID",
  216. "multiple_columns": [],
  217. "name": "contact_id",
  218. "row": null
  219. },
  220. {
  221. "_id": {
  222. "$oid": "5cdc93ac75a9e6646cebd37b"
  223. },
  224. "col": 2,
  225. "force_create": false,
  226. "is_group": false,
  227. "is_tag": false,
  228. "label": "identifier",
  229. "multiple_columns": [],
  230. "name": "identifier",
  231. "row": null
  232. }
  233. ],
  234. "is_default": true,
  235. "matrix_example": null,
  236. "row_step": null,
  237. "version": null
  238. }
  239. ]
  240.  
  241.  
  242. *** Update Importer Config ***
  243.  
  244. http://localhost:3000/api/importer/v1/importer_config/5cdc939f75a9e6646cebd379
  245.  
  246.  
  247. {
  248. "importer_config": {
  249. "append_routes": true,
  250. "cache_policy": "none",
  251. "check_guide_no_route": true,
  252. "check_status": false,
  253. "col_step": "",
  254. "create_routes": "false",
  255. "encoding": "UTF-8",
  256. "extension": "",
  257. "header_row": 0,
  258. "importer_attributes": [
  259. {
  260. "_id": "5cdc93ab75a9e6646cebd37a",
  261. "col": 1,
  262. "force_create": false,
  263. "is_group": false,
  264. "is_tag": false,
  265. "label": "Contact ID",
  266. "multiple_columns": [],
  267. "name": "contact_id",
  268. "row": null
  269. },
  270. {
  271. "_id": "5cdc93ac75a9e6646cebd37b",
  272. "col": 2,
  273. "force_create": false,
  274. "is_group": false,
  275. "is_tag": false,
  276. "label": "identifier",
  277. "multiple_columns": [],
  278. "name": "identifier",
  279. "row": null
  280. }
  281. ],
  282. "is_default": true,
  283. "matrix_example": [],
  284. "row_step": null,
  285. "version": null
  286. }
  287. }
  288.  
  289. {
  290. "status": "ok",
  291. "response": {
  292. "update": "El importador ha sido actualizado"
  293. }
  294. }
  295.  
  296. {
  297. "status": "error",
  298. "response": {
  299. "update": "Error la columna 1 esta en uso"
  300. }
  301. }
  302.  
  303. {
  304. "status": "error",
  305. "response": {
  306. "update": "Error contact_id ya esta en uso"
  307. }
  308. }
  309.  
  310.  
  311. *** Create Custom Importer ***
  312.  
  313. http://localhost:3000/api/importer/v1/create_custom_importer/1
  314.  
  315. {
  316. "status": "ok",
  317. "response": {
  318. "update": "El importador Custom ha sido creado correctamente"
  319. }
  320. }
  321.  
  322. {
  323. "status": "error",
  324. "response": {
  325. "create_custom_importer": "Error! La cuenta 1 ya posee un importador customizado"
  326. }
  327. }
  328.  
  329.  
  330. ***** Create Custom Attribute *****
  331.  
  332.  
  333. http://localhost:3000/api/importer/v1/create_custom_attribute/1
  334. {
  335. "importer_attribute": {
  336. "col": 25,
  337. "label": "priority",
  338. "name": "priority"
  339. }
  340. }
  341.  
  342. {
  343. "status": "error",
  344. "response": {
  345. "create_custom_attribute": "La columna seleccionada se encuentra ocupada"
  346. }
  347. }
  348.  
  349. {
  350. "status": "error",
  351. "response": {
  352. "update": "Error priority ya esta en uso"
  353. }
  354. }
  355.  
  356. {
  357. "status": "ok",
  358. "response": {
  359. "create_custom_attribute": "La columna ha sido agregada correctamente"
  360. }
  361. }
Add Comment
Please, Sign In to add comment