{"action":"created","comment":{"url":"https://api.github.com/repos/danliris/dl-ui/pulls/comments/226814568","pull_request_review_id":166736052,"id":226814568,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjgxNDU2OA==","diff_hunk":"@@ -19,93 +19,151 @@ export class View {\n         var id = params.id;\n         this.poExId = id;\n         this.data = await this.service.getById(id);\n-        this.kurs = await this.service.getKurs(this.data.currency.code, this.data.date);\n+        var kurs = await this.service.getKurs(this.data.Currency.Code, new Date(this.data.OrderDate).toLocaleDateString());\n+        this.kurs=kurs[0];\n \n-        var getUsedBudget = [];\n-        var getPRById = [];\n-        var listPR = this.data.items.map((item) => {\n-            return item.prId.toString()\n-        });\n-        var listPrIds = listPR.filter(function (elem, index, self) {\n-            return index == self.indexOf(elem);\n-        })\n-        listPrIds.map((id) => {\n-            getPRById.push(this.service.getPRById(id, [\"no\", \"items.refNo\", \"items.quantity\", \"items.budgetPrice\", \"items.product.code\"]))\n-        });\n+        if(this.data.Currency){\n+            this.selectedCurrency=this.data.Currency;\n+        }\n \n-        for (var item of this.data.items) {\n-            getUsedBudget.push(this.service.getListUsedBudget(item.prNo, item.prRefNo, item.product.code, this.data.no))\n+        if(this.data.Supplier){\n+            this.selectedSupplier=this.data.Supplier;\n         }\n \n-        var poIds = this.data.items.map(function (item) {\n-            return item.poId;\n-        });\n-        poIds = poIds.filter(function (elem, index, self) {\n-            return index == self.indexOf(elem);\n-        })\n+        if(this.data.IncomeTax){\n+            this.selectedIncomeTax=this.data.IncomeTax;\n+        }\n+\n+        if (!this.data.IsPosted) {\n+            this.hasDelete = true;\n+            this.hasEdit = true;\n+        }\n+        if (this.data.IsPosted) {\n+            this.hasUnpost = true;\n+        }\n \n-        var getStatusPo = [];\n-        for (var poId of poIds) {\n-            getStatusPo.push(this.service.getPoId(poId, [\"status.value\"]))\n+        var getUsedBudget = [];\n+        for(var item of this.data.Items){\n+            getUsedBudget.push(this.service.getPoId(item.POId));\n         }\n-        return Promise.all(getStatusPo)\n-            .then((listStatusPo) => {\n-                return Promise.all(getPRById)\n-                    .then((listPR) => {\n-                        return Promise.all(getUsedBudget)\n-                            .then((listUsedBudget) => {\n-                                listUsedBudget = [].concat.apply([], listUsedBudget);\n-                                for (var item of this.data.items) {\n-                                    var pr = listPR.find((pr) => pr.no.toString() == item.prNo.toString());\n-                                    var prItem = pr.items.find((prItem) => prItem.product.code.toString() === item.product.code.toString() && prItem.refNo === item.prRefNo)\n-\n-                                    var budgetUsed = 0;\n-                                    if (listUsedBudget.length > 0) {\n-                                        var prevAmount = listUsedBudget.find((budget) => budget.prNo == item.prNo && budget.refNo == item.refNo && budget.product == item.product.code);\n-                                        if (prevAmount) {\n-                                            budgetUsed = budgetUsed + prevAmount.totalAmount;\n-                                        }\n-                                    }\n-                                    item.budgetUsed = budgetUsed;\n-                                    item.totalBudget = prItem.quantity * prItem.budgetPrice;\n-                                }\n-\n-                                if (this.data.status.value === 0) {\n-                                    isVoid = true;\n-                                }\n-                                if (listStatusPo.find(po => { return po.status.value > 3 }) != undefined) {\n-                                    isArriving = true;\n-                                }\n-                                if (!this.data.isPosted) {\n-                                    this.hasDelete = true;\n-                                    this.hasEdit = true;\n-                                }\n-                                if (this.data.isPosted && !isVoid && !isArriving && !this.data.isClosed) {\n-                                    this.hasUnpost = true;\n-                                }\n-\n-                                if (this.data.supplier) {\n-                                    this.selectedSupplier = this.data.supplier;\n-                                }\n-                                if (this.data.currency) {\n-                                    this.selectedCurrency = this.data.currency;\n-                                }\n-                                if (this.data.vat) {\n-                                    this.selectedVat = this.data.vat;\n-                                }\n-\n-                                return this.data;\n-                            })\n-                    })\n-            })\n+        var pr=[];\n+        var initial=[];\n+        var remaining=[];\n+        return Promise.all(getUsedBudget)\n+            .then((listUsedBudget) => {\n+                for(var item of this.data.Items){","path":"src/modules/garment-purchasing/purchase-order-external/view.js","position":109,"original_position":109,"commit_id":"5c0dd16ab2d59d62550b4150f76ab66d955c21f8","original_commit_id":"5c0dd16ab2d59d62550b4150f76ab66d955c21f8","user":{"login":"houndci-bot","id":6697940,"node_id":"MDQ6VXNlcjY2OTc5NDA=","avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"'for of' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).","created_at":"2018-10-20T03:04:58Z","updated_at":"2018-10-20T03:05:00Z","html_url":"https://github.com/danliris/dl-ui/pull/1810#discussion_r226814568","pull_request_url":"https://api.github.com/repos/danliris/dl-ui/pulls/1810","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/danliris/dl-ui/pulls/comments/226814568"},"html":{"href":"https://github.com/danliris/dl-ui/pull/1810#discussion_r226814568"},"pull_request":{"href":"https://api.github.com/repos/danliris/dl-ui/pulls/1810"}}},"pull_request":{"url":"https://api.github.com/repos/danliris/dl-ui/pulls/1810","id":224447689,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0NDQ3Njg5","html_url":"https://github.com/danliris/dl-ui/pull/1810","diff_url":"https://github.com/danliris/dl-ui/pull/1810.diff","patch_url":"https://github.com/danliris/dl-ui/pull/1810.patch","issue_url":"https://api.github.com/repos/danliris/dl-ui/issues/1810","number":1810,"state":"open","locked":false,"title":"Migration Garment External PO","user":{"login":"achensetyawati","id":20510625,"node_id":"MDQ6VXNlcjIwNTEwNjI1","avatar_url":"https://avatars1.githubusercontent.com/u/20510625?v=4","gravatar_id":"","url":"https://api.github.com/users/achensetyawati","html_url":"https://github.com/achensetyawati","followers_url":"https://api.github.com/users/achensetyawati/followers","following_url":"https://api.github.com/users/achensetyawati/following{/other_user}","gists_url":"https://api.github.com/users/achensetyawati/gists{/gist_id}","starred_url":"https://api.github.com/users/achensetyawati/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/achensetyawati/subscriptions","organizations_url":"https://api.github.com/users/achensetyawati/orgs","repos_url":"https://api.github.com/users/achensetyawati/repos","events_url":"https://api.github.com/users/achensetyawati/events{/privacy}","received_events_url":"https://api.github.com/users/achensetyawati/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-20T03:04:44Z","updated_at":"2018-10-20T03:05:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b60a5124814965ce98f57860bf01f99867098e5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/danliris/dl-ui/pulls/1810/commits","review_comments_url":"https://api.github.com/repos/danliris/dl-ui/pulls/1810/comments","review_comment_url":"https://api.github.com/repos/danliris/dl-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/danliris/dl-ui/issues/1810/comments","statuses_url":"https://api.github.com/repos/danliris/dl-ui/statuses/5c0dd16ab2d59d62550b4150f76ab66d955c21f8","head":{"label":"achensetyawati:migration","ref":"migration","sha":"5c0dd16ab2d59d62550b4150f76ab66d955c21f8","user":{"login":"achensetyawati","id":20510625,"node_id":"MDQ6VXNlcjIwNTEwNjI1","avatar_url":"https://avatars1.githubusercontent.com/u/20510625?v=4","gravatar_id":"","url":"https://api.github.com/users/achensetyawati","html_url":"https://github.com/achensetyawati","followers_url":"https://api.github.com/users/achensetyawati/followers","following_url":"https://api.github.com/users/achensetyawati/following{/other_user}","gists_url":"https://api.github.com/users/achensetyawati/gists{/gist_id}","starred_url":"https://api.github.com/users/achensetyawati/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/achensetyawati/subscriptions","organizations_url":"https://api.github.com/users/achensetyawati/orgs","repos_url":"https://api.github.com/users/achensetyawati/repos","events_url":"https://api.github.com/users/achensetyawati/events{/privacy}","received_events_url":"https://api.github.com/users/achensetyawati/received_events","type":"User","site_admin":false},"repo":{"id":137016115,"node_id":"MDEwOlJlcG9zaXRvcnkxMzcwMTYxMTU=","name":"dl-ui","full_name":"achensetyawati/dl-ui","private":false,"owner":{"login":"achensetyawati","id":20510625,"node_id":"MDQ6VXNlcjIwNTEwNjI1","avatar_url":"https://avatars1.githubusercontent.com/u/20510625?v=4","gravatar_id":"","url":"https://api.github.com/users/achensetyawati","html_url":"https://github.com/achensetyawati","followers_url":"https://api.github.com/users/achensetyawati/followers","following_url":"https://api.github.com/users/achensetyawati/following{/other_user}","gists_url":"https://api.github.com/users/achensetyawati/gists{/gist_id}","starred_url":"https://api.github.com/users/achensetyawati/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/achensetyawati/subscriptions","organizations_url":"https://api.github.com/users/achensetyawati/orgs","repos_url":"https://api.github.com/users/achensetyawati/repos","events_url":"https://api.github.com/users/achensetyawati/events{/privacy}","received_events_url":"https://api.github.com/users/achensetyawati/received_events","type":"User","site_admin":false},"html_url":"https://github.com/achensetyawati/dl-ui","description":"Dan Liris ui with Aurelia","fork":true,"url":"https://api.github.com/repos/achensetyawati/dl-ui","forks_url":"https://api.github.com/repos/achensetyawati/dl-ui/forks","keys_url":"https://api.github.com/repos/achensetyawati/dl-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/achensetyawati/dl-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/achensetyawati/dl-ui/teams","hooks_url":"https://api.github.com/repos/achensetyawati/dl-ui/hooks","issue_events_url":"https://api.github.com/repos/achensetyawati/dl-ui/issues/events{/number}","events_url":"https://api.github.com/repos/achensetyawati/dl-ui/events","assignees_url":"https://api.github.com/repos/achensetyawati/dl-ui/assignees{/user}","branches_url":"https://api.github.com/repos/achensetyawati/dl-ui/branches{/branch}","tags_url":"https://api.github.com/repos/achensetyawati/dl-ui/tags","blobs_url":"https://api.github.com/repos/achensetyawati/dl-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/achensetyawati/dl-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/achensetyawati/dl-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/achensetyawati/dl-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/achensetyawati/dl-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/achensetyawati/dl-ui/languages","stargazers_url":"https://api.github.com/repos/achensetyawati/dl-ui/stargazers","contributors_url":"https://api.github.com/repos/achensetyawati/dl-ui/contributors","subscribers_url":"https://api.github.com/repos/achensetyawati/dl-ui/subscribers","subscription_url":"https://api.github.com/repos/achensetyawati/dl-ui/subscription","commits_url":"https://api.github.com/repos/achensetyawati/dl-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/achensetyawati/dl-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/achensetyawati/dl-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/achensetyawati/dl-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/achensetyawati/dl-ui/contents/{+path}","compare_url":"https://api.github.com/repos/achensetyawati/dl-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/achensetyawati/dl-ui/merges","archive_url":"https://api.github.com/repos/achensetyawati/dl-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/achensetyawati/dl-ui/downloads","issues_url":"https://api.github.com/repos/achensetyawati/dl-ui/issues{/number}","pulls_url":"https://api.github.com/repos/achensetyawati/dl-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/achensetyawati/dl-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/achensetyawati/dl-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/achensetyawati/dl-ui/labels{/name}","releases_url":"https://api.github.com/repos/achensetyawati/dl-ui/releases{/id}","deployments_url":"https://api.github.com/repos/achensetyawati/dl-ui/deployments","created_at":"2018-06-12T04:16:43Z","updated_at":"2018-07-20T09:31:49Z","pushed_at":"2018-10-20T03:03:57Z","git_url":"git://github.com/achensetyawati/dl-ui.git","ssh_url":"git@github.com:achensetyawati/dl-ui.git","clone_url":"https://github.com/achensetyawati/dl-ui.git","svn_url":"https://github.com/achensetyawati/dl-ui","homepage":null,"size":7607,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"danliris:migration","ref":"migration","sha":"2bed23bb9c5bbd5056db7865931353441de0f65b","user":{"login":"danliris","id":20855729,"node_id":"MDQ6VXNlcjIwODU1NzI5","avatar_url":"https://avatars0.githubusercontent.com/u/20855729?v=4","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"repo":{"id":64897822,"node_id":"MDEwOlJlcG9zaXRvcnk2NDg5NzgyMg==","name":"dl-ui","full_name":"danliris/dl-ui","private":false,"owner":{"login":"danliris","id":20855729,"node_id":"MDQ6VXNlcjIwODU1NzI5","avatar_url":"https://avatars0.githubusercontent.com/u/20855729?v=4","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"html_url":"https://github.com/danliris/dl-ui","description":"Dan Liris ui with Aurelia","fork":false,"url":"https://api.github.com/repos/danliris/dl-ui","forks_url":"https://api.github.com/repos/danliris/dl-ui/forks","keys_url":"https://api.github.com/repos/danliris/dl-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danliris/dl-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danliris/dl-ui/teams","hooks_url":"https://api.github.com/repos/danliris/dl-ui/hooks","issue_events_url":"https://api.github.com/repos/danliris/dl-ui/issues/events{/number}","events_url":"https://api.github.com/repos/danliris/dl-ui/events","assignees_url":"https://api.github.com/repos/danliris/dl-ui/assignees{/user}","branches_url":"https://api.github.com/repos/danliris/dl-ui/branches{/branch}","tags_url":"https://api.github.com/repos/danliris/dl-ui/tags","blobs_url":"https://api.github.com/repos/danliris/dl-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danliris/dl-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danliris/dl-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/danliris/dl-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danliris/dl-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/danliris/dl-ui/languages","stargazers_url":"https://api.github.com/repos/danliris/dl-ui/stargazers","contributors_url":"https://api.github.com/repos/danliris/dl-ui/contributors","subscribers_url":"https://api.github.com/repos/danliris/dl-ui/subscribers","subscription_url":"https://api.github.com/repos/danliris/dl-ui/subscription","commits_url":"https://api.github.com/repos/danliris/dl-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/danliris/dl-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/danliris/dl-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/danliris/dl-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/danliris/dl-ui/contents/{+path}","compare_url":"https://api.github.com/repos/danliris/dl-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danliris/dl-ui/merges","archive_url":"https://api.github.com/repos/danliris/dl-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danliris/dl-ui/downloads","issues_url":"https://api.github.com/repos/danliris/dl-ui/issues{/number}","pulls_url":"https://api.github.com/repos/danliris/dl-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/danliris/dl-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/danliris/dl-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danliris/dl-ui/labels{/name}","releases_url":"https://api.github.com/repos/danliris/dl-ui/releases{/id}","deployments_url":"https://api.github.com/repos/danliris/dl-ui/deployments","created_at":"2016-08-04T03:06:28Z","updated_at":"2018-10-03T05:14:10Z","pushed_at":"2018-10-20T03:04:45Z","git_url":"git://github.com/danliris/dl-ui.git","ssh_url":"git@github.com:danliris/dl-ui.git","clone_url":"https://github.com/danliris/dl-ui.git","svn_url":"https://github.com/danliris/dl-ui","homepage":null,"size":7715,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":42,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/danliris/dl-ui/pulls/1810"},"html":{"href":"https://github.com/danliris/dl-ui/pull/1810"},"issue":{"href":"https://api.github.com/repos/danliris/dl-ui/issues/1810"},"comments":{"href":"https://api.github.com/repos/danliris/dl-ui/issues/1810/comments"},"review_comments":{"href":"https://api.github.com/repos/danliris/dl-ui/pulls/1810/comments"},"review_comment":{"href":"https://api.github.com/repos/danliris/dl-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/danliris/dl-ui/pulls/1810/commits"},"statuses":{"href":"https://api.github.com/repos/danliris/dl-ui/statuses/5c0dd16ab2d59d62550b4150f76ab66d955c21f8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"houndci-bot"}}