{"action":"created","comment":{"url":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/comments/140641742","pull_request_review_id":64748054,"id":140641742,"diff_hunk":"@@ -0,0 +1,120 @@\n+import React, {Component} from 'react'\n+import {\n+  TextField,\n+  Table,\n+  TableBody,\n+  TableHeader,\n+  TableHeaderColumn,\n+  TableRow,\n+  TableRowColumn,\n+  RaisedButton,\n+} from 'material-ui'\n+\n+import './CenterAdmin.css'\n+\n+import api from '../api'\n+  \n+\n+class CenterAdmin extends Component{\n+    constructor (props) {\n+        super(props)\n+        this.state = {\n+            loading: true,\n+            productList: [],\n+            filteredProdcuts: [],\n+            newProduct: '',\n+            filter: '',\n+            selected: []\n+        }\n+    }\n+\n+    componentDidMount() {\n+        const { id } = this.props.match.params\n+        const product = api.getProductosByAcopioId(id).then(({data: productList}) => {\n+          this.setState(() => ({ productList, filteredProdcuts: productList }))\n+        })\n+\n+        product.then(() => {\n+            this.setState(() => ({ loading: false }))\n+        })\n+    }\n+    onChangeFilte = (evt, filter) => {\n+      const { productList } = this.state\n+      const inputValue = filter.trim().toLowerCase()\n+      const inputLength = inputValue.length\n+      const filteredProducts =  inputLength === 0 ? productList : productList.filter(({nombre}) =>\n+        nombre.toLowerCase().slice(0, inputLength) === filter\n+      )\n+      this.setState(() => ({ filteredProducts, filter }))\n+    }\n+\n+    onRowSelection = (selected) => {\n+      window.requestAnimationFrame(() => {\n+        this.setState(() => ({ selected }))\n+      })\n+    }\n+\n+    onSave = () => {\n+      const { id } = this.props.match.params\n+      const { newProduct } = this.state\n+      api.saveProducto({\n+        acopioId: id,\n+        nombre: newProduct\n+      }).then((res) => {\n+        window.location.reload()\n+      })\n+    }\n+    onDelete = () => {\n+      const { selected, filteredProdcuts } = this.state\n+      if (selected === 'none') return\n+      this.setState(() => ({ loading: true }))\n+      const toDelete = (selected === 'all' ? filteredProdcuts : selected.map(index => filteredProdcuts[index])).map(({ id }) => id)\n+\n+      const serial = fn =>\n+        fn.reduce((promise, fn) =>\n+          promise.then(result => fn().then(Array.prototype.concat.bind(result))),\n+          Promise.resolve([]))\n+      const fns = toDelete.map(id => () => api.deleteProducto(id))\n+      serial(fns).then((res) => {\n+        window.location.reload()","path":"src/screens/CenterAdmin.js","position":79,"original_position":79,"commit_id":"2387caddee3791a5188f5172526d0a2a6354ef4f","original_commit_id":"2387caddee3791a5188f5172526d0a2a6354ef4f","user":{"login":"jeduan","id":37972,"avatar_url":"https://avatars1.githubusercontent.com/u/37972?v=4","gravatar_id":"","url":"https://api.github.com/users/jeduan","html_url":"https://github.com/jeduan","followers_url":"https://api.github.com/users/jeduan/followers","following_url":"https://api.github.com/users/jeduan/following{/other_user}","gists_url":"https://api.github.com/users/jeduan/gists{/gist_id}","starred_url":"https://api.github.com/users/jeduan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeduan/subscriptions","organizations_url":"https://api.github.com/users/jeduan/orgs","repos_url":"https://api.github.com/users/jeduan/repos","events_url":"https://api.github.com/users/jeduan/events{/privacy}","received_events_url":"https://api.github.com/users/jeduan/received_events","type":"User","site_admin":false},"body":"Puedes usar react-router aqui?","created_at":"2017-09-23T21:05:42Z","updated_at":"2017-09-23T21:06:39Z","html_url":"https://github.com/Skycatch/acopio-ui/pull/61#discussion_r140641742","pull_request_url":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/61","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/comments/140641742"},"html":{"href":"https://github.com/Skycatch/acopio-ui/pull/61#discussion_r140641742"},"pull_request":{"href":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/61"}}},"pull_request":{"url":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/61","id":142727951,"html_url":"https://github.com/Skycatch/acopio-ui/pull/61","diff_url":"https://github.com/Skycatch/acopio-ui/pull/61.diff","patch_url":"https://github.com/Skycatch/acopio-ui/pull/61.patch","issue_url":"https://api.github.com/repos/Skycatch/acopio-ui/issues/61","number":61,"state":"open","locked":false,"title":"Add needs to center","user":{"login":"Ikana","id":634704,"avatar_url":"https://avatars1.githubusercontent.com/u/634704?v=4","gravatar_id":"","url":"https://api.github.com/users/Ikana","html_url":"https://github.com/Ikana","followers_url":"https://api.github.com/users/Ikana/followers","following_url":"https://api.github.com/users/Ikana/following{/other_user}","gists_url":"https://api.github.com/users/Ikana/gists{/gist_id}","starred_url":"https://api.github.com/users/Ikana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ikana/subscriptions","organizations_url":"https://api.github.com/users/Ikana/orgs","repos_url":"https://api.github.com/users/Ikana/repos","events_url":"https://api.github.com/users/Ikana/events{/privacy}","received_events_url":"https://api.github.com/users/Ikana/received_events","type":"User","site_admin":false},"body":"Adds a control screen for a collection center under the path control/{collection center id}","created_at":"2017-09-23T20:19:08Z","updated_at":"2017-09-23T21:06:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bdc770e4cdbbfde3ce891629ae467ed4ca22e365","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/61/commits","review_comments_url":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/61/comments","review_comment_url":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Skycatch/acopio-ui/issues/61/comments","statuses_url":"https://api.github.com/repos/Skycatch/acopio-ui/statuses/2387caddee3791a5188f5172526d0a2a6354ef4f","head":{"label":"Ikana:add-needs-to-center","ref":"add-needs-to-center","sha":"2387caddee3791a5188f5172526d0a2a6354ef4f","user":{"login":"Ikana","id":634704,"avatar_url":"https://avatars1.githubusercontent.com/u/634704?v=4","gravatar_id":"","url":"https://api.github.com/users/Ikana","html_url":"https://github.com/Ikana","followers_url":"https://api.github.com/users/Ikana/followers","following_url":"https://api.github.com/users/Ikana/following{/other_user}","gists_url":"https://api.github.com/users/Ikana/gists{/gist_id}","starred_url":"https://api.github.com/users/Ikana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ikana/subscriptions","organizations_url":"https://api.github.com/users/Ikana/orgs","repos_url":"https://api.github.com/users/Ikana/repos","events_url":"https://api.github.com/users/Ikana/events{/privacy}","received_events_url":"https://api.github.com/users/Ikana/received_events","type":"User","site_admin":false},"repo":{"id":104577772,"name":"acopio-ui","full_name":"Ikana/acopio-ui","owner":{"login":"Ikana","id":634704,"avatar_url":"https://avatars1.githubusercontent.com/u/634704?v=4","gravatar_id":"","url":"https://api.github.com/users/Ikana","html_url":"https://github.com/Ikana","followers_url":"https://api.github.com/users/Ikana/followers","following_url":"https://api.github.com/users/Ikana/following{/other_user}","gists_url":"https://api.github.com/users/Ikana/gists{/gist_id}","starred_url":"https://api.github.com/users/Ikana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ikana/subscriptions","organizations_url":"https://api.github.com/users/Ikana/orgs","repos_url":"https://api.github.com/users/Ikana/repos","events_url":"https://api.github.com/users/Ikana/events{/privacy}","received_events_url":"https://api.github.com/users/Ikana/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Ikana/acopio-ui","description":"UI para centros de acopio","fork":true,"url":"https://api.github.com/repos/Ikana/acopio-ui","forks_url":"https://api.github.com/repos/Ikana/acopio-ui/forks","keys_url":"https://api.github.com/repos/Ikana/acopio-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ikana/acopio-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ikana/acopio-ui/teams","hooks_url":"https://api.github.com/repos/Ikana/acopio-ui/hooks","issue_events_url":"https://api.github.com/repos/Ikana/acopio-ui/issues/events{/number}","events_url":"https://api.github.com/repos/Ikana/acopio-ui/events","assignees_url":"https://api.github.com/repos/Ikana/acopio-ui/assignees{/user}","branches_url":"https://api.github.com/repos/Ikana/acopio-ui/branches{/branch}","tags_url":"https://api.github.com/repos/Ikana/acopio-ui/tags","blobs_url":"https://api.github.com/repos/Ikana/acopio-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ikana/acopio-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ikana/acopio-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ikana/acopio-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ikana/acopio-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/Ikana/acopio-ui/languages","stargazers_url":"https://api.github.com/repos/Ikana/acopio-ui/stargazers","contributors_url":"https://api.github.com/repos/Ikana/acopio-ui/contributors","subscribers_url":"https://api.github.com/repos/Ikana/acopio-ui/subscribers","subscription_url":"https://api.github.com/repos/Ikana/acopio-ui/subscription","commits_url":"https://api.github.com/repos/Ikana/acopio-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ikana/acopio-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ikana/acopio-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ikana/acopio-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ikana/acopio-ui/contents/{+path}","compare_url":"https://api.github.com/repos/Ikana/acopio-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ikana/acopio-ui/merges","archive_url":"https://api.github.com/repos/Ikana/acopio-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ikana/acopio-ui/downloads","issues_url":"https://api.github.com/repos/Ikana/acopio-ui/issues{/number}","pulls_url":"https://api.github.com/repos/Ikana/acopio-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/Ikana/acopio-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/Ikana/acopio-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ikana/acopio-ui/labels{/name}","releases_url":"https://api.github.com/repos/Ikana/acopio-ui/releases{/id}","deployments_url":"https://api.github.com/repos/Ikana/acopio-ui/deployments","created_at":"2017-09-23T15:27:43Z","updated_at":"2017-09-23T15:27:44Z","pushed_at":"2017-09-23T21:04:25Z","git_url":"git://github.com/Ikana/acopio-ui.git","ssh_url":"git@github.com:Ikana/acopio-ui.git","clone_url":"https://github.com/Ikana/acopio-ui.git","svn_url":"https://github.com/Ikana/acopio-ui","homepage":null,"size":388,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"Skycatch:develop","ref":"develop","sha":"1725a2f71623391ff4bc1e74b9818a231c227291","user":{"login":"Skycatch","id":3791031,"avatar_url":"https://avatars0.githubusercontent.com/u/3791031?v=4","gravatar_id":"","url":"https://api.github.com/users/Skycatch","html_url":"https://github.com/Skycatch","followers_url":"https://api.github.com/users/Skycatch/followers","following_url":"https://api.github.com/users/Skycatch/following{/other_user}","gists_url":"https://api.github.com/users/Skycatch/gists{/gist_id}","starred_url":"https://api.github.com/users/Skycatch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Skycatch/subscriptions","organizations_url":"https://api.github.com/users/Skycatch/orgs","repos_url":"https://api.github.com/users/Skycatch/repos","events_url":"https://api.github.com/users/Skycatch/events{/privacy}","received_events_url":"https://api.github.com/users/Skycatch/received_events","type":"Organization","site_admin":false},"repo":{"id":104270460,"name":"acopio-ui","full_name":"Skycatch/acopio-ui","owner":{"login":"Skycatch","id":3791031,"avatar_url":"https://avatars0.githubusercontent.com/u/3791031?v=4","gravatar_id":"","url":"https://api.github.com/users/Skycatch","html_url":"https://github.com/Skycatch","followers_url":"https://api.github.com/users/Skycatch/followers","following_url":"https://api.github.com/users/Skycatch/following{/other_user}","gists_url":"https://api.github.com/users/Skycatch/gists{/gist_id}","starred_url":"https://api.github.com/users/Skycatch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Skycatch/subscriptions","organizations_url":"https://api.github.com/users/Skycatch/orgs","repos_url":"https://api.github.com/users/Skycatch/repos","events_url":"https://api.github.com/users/Skycatch/events{/privacy}","received_events_url":"https://api.github.com/users/Skycatch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Skycatch/acopio-ui","description":"UI para centros de acopio","fork":false,"url":"https://api.github.com/repos/Skycatch/acopio-ui","forks_url":"https://api.github.com/repos/Skycatch/acopio-ui/forks","keys_url":"https://api.github.com/repos/Skycatch/acopio-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Skycatch/acopio-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Skycatch/acopio-ui/teams","hooks_url":"https://api.github.com/repos/Skycatch/acopio-ui/hooks","issue_events_url":"https://api.github.com/repos/Skycatch/acopio-ui/issues/events{/number}","events_url":"https://api.github.com/repos/Skycatch/acopio-ui/events","assignees_url":"https://api.github.com/repos/Skycatch/acopio-ui/assignees{/user}","branches_url":"https://api.github.com/repos/Skycatch/acopio-ui/branches{/branch}","tags_url":"https://api.github.com/repos/Skycatch/acopio-ui/tags","blobs_url":"https://api.github.com/repos/Skycatch/acopio-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Skycatch/acopio-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Skycatch/acopio-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/Skycatch/acopio-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Skycatch/acopio-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/Skycatch/acopio-ui/languages","stargazers_url":"https://api.github.com/repos/Skycatch/acopio-ui/stargazers","contributors_url":"https://api.github.com/repos/Skycatch/acopio-ui/contributors","subscribers_url":"https://api.github.com/repos/Skycatch/acopio-ui/subscribers","subscription_url":"https://api.github.com/repos/Skycatch/acopio-ui/subscription","commits_url":"https://api.github.com/repos/Skycatch/acopio-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/Skycatch/acopio-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/Skycatch/acopio-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/Skycatch/acopio-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/Skycatch/acopio-ui/contents/{+path}","compare_url":"https://api.github.com/repos/Skycatch/acopio-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Skycatch/acopio-ui/merges","archive_url":"https://api.github.com/repos/Skycatch/acopio-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Skycatch/acopio-ui/downloads","issues_url":"https://api.github.com/repos/Skycatch/acopio-ui/issues{/number}","pulls_url":"https://api.github.com/repos/Skycatch/acopio-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/Skycatch/acopio-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/Skycatch/acopio-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Skycatch/acopio-ui/labels{/name}","releases_url":"https://api.github.com/repos/Skycatch/acopio-ui/releases{/id}","deployments_url":"https://api.github.com/repos/Skycatch/acopio-ui/deployments","created_at":"2017-09-20T21:41:36Z","updated_at":"2017-09-23T06:52:57Z","pushed_at":"2017-09-23T21:06:04Z","git_url":"git://github.com/Skycatch/acopio-ui.git","ssh_url":"git@github.com:Skycatch/acopio-ui.git","clone_url":"https://github.com/Skycatch/acopio-ui.git","svn_url":"https://github.com/Skycatch/acopio-ui","homepage":null,"size":391,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":18,"forks":13,"open_issues":18,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/61"},"html":{"href":"https://github.com/Skycatch/acopio-ui/pull/61"},"issue":{"href":"https://api.github.com/repos/Skycatch/acopio-ui/issues/61"},"comments":{"href":"https://api.github.com/repos/Skycatch/acopio-ui/issues/61/comments"},"review_comments":{"href":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/61/comments"},"review_comment":{"href":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Skycatch/acopio-ui/pulls/61/commits"},"statuses":{"href":"https://api.github.com/repos/Skycatch/acopio-ui/statuses/2387caddee3791a5188f5172526d0a2a6354ef4f"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"jeduan"}}