Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #18 from beohoang98/feature/partner_management
Browse files Browse the repository at this point in the history
fix/partner management
  • Loading branch information
Hoang Dan An authored Jul 29, 2020
2 parents a269a35 + 011d70a commit 8b45c35
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 38 deletions.
1 change: 1 addition & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@fortawesome/vue-fontawesome": "^0.1.10",
"axios": "^0.19.2",
"core-js": "^3.6.5",
"dayjs": "^1.8.31",
"element-theme-dark": "^1.0.3",
"element-ui": "^2.13.2",
"register-service-worker": "^1.7.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,27 @@
<template #header>
<h2>Total transaction</h2>
</template>
<p>{{ stat.transCount }}</p>
<p>{{ stat.trans_count }}</p>
</el-card>
</el-col>
<el-col>
<el-card>
<template #header>
<h2>Total amount</h2>
</template>
<p>{{ stat.transSum | vndFormat }}</p>
<p>{{ stat.trans_sum | vndFormat }}</p>
</el-card>
</el-col>
</el-row>
<el-divider />
<el-table :data="transactions"></el-table>
<el-table :data="transactions">
<el-table-column prop="id" label="ID" />
<el-table-column prop="createdAt" label="Created At">
<template :slot-scope="{ row: { createdAt } }">
{{ createdAt | datetime }}
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</el-dialog>
Expand Down Expand Up @@ -101,8 +108,8 @@ export default class PartnerDetailModal extends Vue {
newPassword: [{ type: "string", min: 6, required: false }],
};
stat = {
transCount: 0,
transSum: 0,
trans_count: 0,
trans_sum: 0,
};
handleOnClose() {
Expand Down Expand Up @@ -133,7 +140,7 @@ export default class PartnerDetailModal extends Vue {
.get(`/admin/partner/${this.partnerId}/transaction-total`)
.then(({ data }) => {
console.debug(data);
this.stat = data[0];
this.stat = data;
});
}
Expand Down
13 changes: 13 additions & 0 deletions packages/client/src/filters/date.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { VueConstructor } from "vue";
import dayjs from "dayjs";

export default {
install: (Vue: VueConstructor) => {
Vue.filter("date", (value: string | number) => {
return dayjs(value).format("DD MMM yyyy");
});
Vue.filter("datetime", (value: string | number) => {
return dayjs(value).format("DD/MM/yy HH:mm:ss");
});
},
};
65 changes: 35 additions & 30 deletions packages/client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1256,62 +1256,62 @@
"@types/yargs-parser" "*"

"@typescript-eslint/eslint-plugin@^3.7.0":
version "3.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.7.0.tgz#0f91aa3c83d019591719e597fbdb73a59595a263"
integrity sha512-4OEcPON3QIx0ntsuiuFP/TkldmBGXf0uKxPQlGtS/W2F3ndYm8Vgdpj/woPJkzUc65gd3iR+qi3K8SDQP/obFg==
version "3.7.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.7.1.tgz#d144c49a9a0ffe8dd704bb179c243df76c111bc9"
integrity sha512-3DB9JDYkMrc8Au00rGFiJLK2Ja9CoMP6Ut0sHsXp3ZtSugjNxvSSHTnKLfo4o+QmjYBJqEznDqsG1zj4F2xnsg==
dependencies:
"@typescript-eslint/experimental-utils" "3.7.0"
"@typescript-eslint/experimental-utils" "3.7.1"
debug "^4.1.1"
functional-red-black-tree "^1.0.1"
regexpp "^3.0.0"
semver "^7.3.2"
tsutils "^3.17.1"

"@typescript-eslint/experimental-utils@3.7.0":
version "3.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.7.0.tgz#0ee21f6c48b2b30c63211da23827725078d5169a"
integrity sha512-xpfXXAfZqhhqs5RPQBfAFrWDHoNxD5+sVB5A46TF58Bq1hRfVROrWHcQHHUM9aCBdy9+cwATcvCbRg8aIRbaHQ==
"@typescript-eslint/experimental-utils@3.7.1":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.7.1.tgz#ab036caaed4c870d22531d41f9352f3147364d61"
integrity sha512-TqE97pv7HrqWcGJbLbZt1v59tcqsSVpWTOf1AqrWK7n8nok2sGgVtYRuGXeNeLw3wXlLEbY1MKP3saB2HsO/Ng==
dependencies:
"@types/json-schema" "^7.0.3"
"@typescript-eslint/types" "3.7.0"
"@typescript-eslint/typescript-estree" "3.7.0"
"@typescript-eslint/types" "3.7.1"
"@typescript-eslint/typescript-estree" "3.7.1"
eslint-scope "^5.0.0"
eslint-utils "^2.0.0"

"@typescript-eslint/parser@^3.7.0":
version "3.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.7.0.tgz#3e9cd9df9ea644536feb6e5acdb8279ecff96ce9"
integrity sha512-2LZauVUt7jAWkcIW7djUc3kyW+fSarNEuM3RF2JdLHR9BfX/nDEnyA4/uWz0wseoWVZbDXDF7iF9Jc342flNqQ==
version "3.7.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.7.1.tgz#5d9ccecb116d12d9c6073e9861c57c9b1aa88128"
integrity sha512-W4QV/gXvfIsccN8225784LNOorcm7ch68Fi3V4Wg7gmkWSQRKevO4RrRqWo6N/Z/myK1QAiGgeaXN57m+R/8iQ==
dependencies:
"@types/eslint-visitor-keys" "^1.0.0"
"@typescript-eslint/experimental-utils" "3.7.0"
"@typescript-eslint/types" "3.7.0"
"@typescript-eslint/typescript-estree" "3.7.0"
"@typescript-eslint/experimental-utils" "3.7.1"
"@typescript-eslint/types" "3.7.1"
"@typescript-eslint/typescript-estree" "3.7.1"
eslint-visitor-keys "^1.1.0"

"@typescript-eslint/types@3.7.0":
version "3.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.7.0.tgz#09897fab0cb95479c01166b10b2c03c224821077"
integrity sha512-reCaK+hyKkKF+itoylAnLzFeNYAEktB0XVfSQvf0gcVgpz1l49Lt6Vo9x4MVCCxiDydA0iLAjTF/ODH0pbfnpg==
"@typescript-eslint/types@3.7.1":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.7.1.tgz#90375606b2fd73c1224fe9e397ee151e28fa1e0c"
integrity sha512-PZe8twm5Z4b61jt7GAQDor6KiMhgPgf4XmUb9zdrwTbgtC/Sj29gXP1dws9yEn4+aJeyXrjsD9XN7AWFhmnUfg==

"@typescript-eslint/typescript-estree@3.7.0":
version "3.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.7.0.tgz#66872e6da120caa4b64e6b4ca5c8702afc74738d"
integrity sha512-xr5oobkYRebejlACGr1TJ0Z/r0a2/HUf0SXqPvlgUMwiMqOCu/J+/Dr9U3T0IxpE5oLFSkqMx1FE/dKaZ8KsOQ==
"@typescript-eslint/typescript-estree@3.7.1":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.7.1.tgz#ce1ffbd0fa53f34d4ce851a7a364e392432f6eb3"
integrity sha512-m97vNZkI08dunYOr2lVZOHoyfpqRs0KDpd6qkGaIcLGhQ2WPtgHOd/eVbsJZ0VYCQvupKrObAGTOvk3tfpybYA==
dependencies:
"@typescript-eslint/types" "3.7.0"
"@typescript-eslint/visitor-keys" "3.7.0"
"@typescript-eslint/types" "3.7.1"
"@typescript-eslint/visitor-keys" "3.7.1"
debug "^4.1.1"
glob "^7.1.6"
is-glob "^4.0.1"
lodash "^4.17.15"
semver "^7.3.2"
tsutils "^3.17.1"

"@typescript-eslint/visitor-keys@3.7.0":
version "3.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.7.0.tgz#ac0417d382a136e4571a0b0dcfe52088cb628177"
integrity sha512-k5PiZdB4vklUpUX4NBncn5RBKty8G3ihTY+hqJsCdMuD0v4jofI5xuqwnVcWxfv6iTm2P/dfEa2wMUnsUY8ODw==
"@typescript-eslint/visitor-keys@3.7.1":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.7.1.tgz#b90191e74efdee656be8c5a30f428ed16dda46d1"
integrity sha512-xn22sQbEya+Utj2IqJHGLA3i1jDzR43RzWupxojbSWnj3nnPLavaQmWe5utw03CwYao3r00qzXfgJMGNkrzrAA==
dependencies:
eslint-visitor-keys "^1.1.0"

Expand Down Expand Up @@ -3654,6 +3654,11 @@ data-urls@^1.0.0, data-urls@^1.1.0:
whatwg-mimetype "^2.2.0"
whatwg-url "^7.0.0"

dayjs@^1.8.31:
version "1.8.31"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.8.31.tgz#0cd1114c2539dd5ad9428be0c38df6d4bb40b9d3"
integrity sha512-mPh1mslned+5PuIuiUfbw4CikHk6AEAf2Baxih+wP5fssv+wmlVhvgZ7mq+BhLt7Sr/Hc8leWDiwe6YnrpNt3g==

de-indent@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
Expand Down
5 changes: 3 additions & 2 deletions packages/server/src/modules/admin/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ export class AdminService {
id,
},
},
relations: ["transaction"],
});
}

Expand All @@ -243,8 +244,8 @@ export class AdminService {
.createQueryBuilder("log")
.where("log.client_id = :id", { id })
.leftJoin(Transaction, "trans", "trans.id = log.transaction_id")
.select("COUNT(log.client_id) as transCount")
.addSelect("SUM(trans.amount) as transSum")
.select("COUNT(log.client_id) as trans_count")
.addSelect("SUM(trans.amount) as trans_sum")
.groupBy("log.client_id")
.getRawOne();
}
Expand Down

1 comment on commit 8b45c35

@vercel
Copy link

@vercel vercel bot commented on 8b45c35 Jul 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.