Skip to content

Commit

Permalink
fix: tx weight on process order & add service registration
Browse files Browse the repository at this point in the history
  • Loading branch information
ciniiia committed Apr 27, 2022
1 parent e969bb0 commit 85830d3
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 38 deletions.
25 changes: 24 additions & 1 deletion src/components/Dialog/DialogDeleteConfirmation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,28 @@
</div>
<div align="center" class="pb-5">
<strong>Are you sure you want delete this {{ type }}?</strong>
<div class= "d-flex justify-space-between mt-3 px-16" >
<div>
<span
style="font-size: 12px"
> Estimated Transaction Weight </span>
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<v-icon
color="primary"
size="14"
v-bind="attrs"
v-on="on"
> mdi-alert-circle-outline
</v-icon>
</template>
<span style="font-size: 10px;">Total fee paid in DBIO to execute this transaction.</span>
</v-tooltip>
</div>
<span style="font-size: 12px;">
{{ Number(fee).toFixed(4) }} DBIO
</span>
</div>
</div>
<div class="d-flex justify-center pb-5">
<v-col lg="5" md="5" sm="8">
Expand Down Expand Up @@ -38,7 +60,8 @@ export default {
props: {
show: Boolean,
type: String
type: String,
fee: { type: [String, Number]}
},
methods: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
<template>
<div>
<template>
<v-card class="mt-10 px-10" v-if="specimenStatus === 'WetWork'">
<input
type="file"
style="display: none"
ref="encryptUploadGenome"
accept=".vcf"
/>
<div v-if="hasGenomeFile" class="d-flex mt-5 mb-5">
<v-row >
<v-col>
<b class="secondary--text card-header mb-2" style="display: block">VCF Data</b>
<div v-for="(file, idx) in files.genome" :key="idx + '-' + file.fileName + '-' + file.fileType">
<FileCard
:filename="file.fileName"
:ipfsUrl="getFileIpfsUrl(file)"
:view-only="submitted"
@edit="onEditClick('genome')"
@delete="onFileDelete('genome')"
/>
</div>
</v-col>
</v-row>
</div>
<div v-else class="mb-3 mt-3">
<div class= "d-flex justify-space-between">
<div class="mb-5 mt-5">
<span
Expand All @@ -26,33 +48,6 @@
</span>
</div>
</div>
</v-card>
</template>

<template>
<input
type="file"
style="display: none"
ref="encryptUploadGenome"
accept=".vcf"
/>
<div v-if="hasGenomeFile" class="d-flex mt-5 mb-5">
<v-row >
<v-col>
<b class="secondary--text card-header mb-2" style="display: block">VCF Data</b>
<div v-for="(file, idx) in files.genome" :key="idx + '-' + file.fileName + '-' + file.fileType">
<FileCard
:filename="file.fileName"
:ipfsUrl="getFileIpfsUrl(file)"
:view-only="submitted"
@edit="onEditClick('genome')"
@delete="onFileDelete('genome')"
/>
</div>
</v-col>
</v-row>
</div>
<div v-else class="mb-3 mt-3">
<v-btn
color="primary"
large
Expand Down Expand Up @@ -100,6 +95,30 @@
</v-row>
</div>
<div v-else class="mb-3">
<div class= "d-flex justify-space-between" v-if="!uploadReportDisabled">
<div class="mb-5 mt-5">
<span
style="font-size: 12px"
> Estimated Transaction Weight </span>
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<v-icon
color="primary"
size="14"
v-bind="attrs"
v-on="on"
> mdi-alert-circle-outline
</v-icon>
</template>
<span style="font-size: 10px;">Total fee paid in DBIO to execute this transaction.</span>
</v-tooltip>
</div>
<div class="mt-5">
<span style="font-size: 12px;">
{{ Number(fee).toFixed(4) }} DBIO
</span>
</div>
</div>
<v-btn
color="primary"
large
Expand Down Expand Up @@ -130,7 +149,7 @@
block
class="mt-6"
:disabled="isLoading"
@click="confirmationDialog = true"
@click="showConfirmationDialog"
>
Submit Result
<template v-slot:loader>
Expand Down Expand Up @@ -160,7 +179,7 @@
@close="reportUploadSucceedDialog = false"
/>

<Dialog :show="confirmationDialog" @close="!confirmationDialog">
<Dialog :show="confirmationDialog" @close="confirmationDialog = false">
<template v-slot:title>
<div></div>
</template>
Expand All @@ -169,6 +188,30 @@
<v-img v-bind:src="require('@/assets/debio-logo.png')" max-width="50" />
</div>
<div align="center" class="pb-5">Are you sure you want to submit the results?</div>
<div class= "d-flex justify-space-between px-5">
<div class="mt-5">
<span
style="font-size: 12px"
> Estimated Transaction Weight </span>
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<v-icon
color="primary"
size="14"
v-bind="attrs"
v-on="on"
> mdi-alert-circle-outline
</v-icon>
</template>
<span style="font-size: 10px;">Total fee paid in DBIO to execute this transaction.</span>
</v-tooltip>
</div>
<div class="mt-5">
<span style="font-size: 12px;">
{{ Number(fee).toFixed(4) }} DBIO
</span>
</div>
</div>
</template>
<template v-slot:actions>
<v-col col="12" md="6">
Expand All @@ -195,7 +238,7 @@ import { fulfillOrder } from "@/lib/polkadotProvider/command/orders"
import DialogAlert from "@/components/Dialog/DialogAlert"
import Dialog from "@/components/Dialog"
import Button from "@/components/Button"
import { submitTestResult, processDnaSample, submitTestResultFee } from "@/lib/polkadotProvider/command/geneticTesting"
import { submitTestResult, processDnaSample, submitTestResultFee, processDnaSampleFee } from "@/lib/polkadotProvider/command/geneticTesting"
import { queryDnaTestResults } from "@/lib/polkadotProvider/query/geneticTesting"
import localStorage from "@/lib/local-storage"
Expand Down Expand Up @@ -356,7 +399,7 @@ export default {
},
async getFee() {
const fee = await submitTestResultFee(this.api, this.pair, this.specimenNumber, this.nextStatus)
const fee = await submitTestResultFee(this.api, this.pair, this.specimenNumber)
this.fee = this.web3.utils.fromWei(String(fee.partialFee), "ether")
},
Expand Down Expand Up @@ -396,6 +439,13 @@ export default {
}
)
},
async showConfirmationDialog() {
const fee = await processDnaSampleFee(this.api, this.pair, this.specimenNumber, "ResultReady")
this.fee = this.web3.utils.fromWei(String(fee.partialFee), "ether")
this.confirmationDialog = true
},
async resultReady() {
this.isProcessing = true
Expand Down
15 changes: 12 additions & 3 deletions src/views/Dashboard/Lab/Registration/Services/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
</v-card-text>
</v-card>
<DialogDelete
:fee="fee"
:show="deleteConfirmation"
type="service"
@close="toggleDelete"
Expand All @@ -70,7 +71,7 @@
<script>
import { mapGetters, mapState } from "vuex"
import serviceHandler from "@/mixins/serviceHandler"
import { deleteService } from "@/lib/polkadotProvider/command/services"
import { deleteService, deleteServiceFee } from "@/lib/polkadotProvider/command/services"
import DialogDelete from "@/components/Dialog/DialogDeleteConfirmation"
export default {
Expand All @@ -84,7 +85,8 @@ export default {
data: () => ({
deleteConfirmation: false,
service: null
service: null,
fee: 0
}),
computed: {
Expand All @@ -109,14 +111,21 @@ export default {
this.$emit("edit-service", service)
},
toggleDelete(service) {
async toggleDelete(service) {
if (service) {
this.service = service
this.deleteConfirmation = true
} else {
this.service = null
this.deleteConfirmation = false
}
await this.getDeleteFee()
},
async getDeleteFee() {
const fee = await deleteServiceFee(this.api, this.pair, this.service.id)
this.fee = this.web3.utils.fromWei(String(fee.partialFee), "ether")
},
async deleteService() {
Expand Down
15 changes: 13 additions & 2 deletions src/views/Dashboard/Lab/Registration/Services/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,19 @@ export default {
clearServicesForm() {
this.$refs.serviceForm.resetValidation()
this.$refs.serviceForm.reset()
this.document.durationType = "Days"
this.document = {
category: "",
dnaCollectionProcess: "",
name: "",
currency: "DAI",
price: 0,
qcPrice: 0,
description: "",
longDescription: "",
duration: "",
durationType: "Days"
},
this.testResultSampleFile = ""
this.imageUrl = ""
this.fee = 0
},
Expand Down

0 comments on commit 85830d3

Please sign in to comment.