|
|
@@ -10,7 +10,7 @@ |
|
|
|
:key="fee.name + indx" class="fee" |
|
|
|
> |
|
|
|
<label @click="() => edit = fee"> |
|
|
|
${{fee.amount}}{{ fee.perc ? ` ${fee.perc}%` : ''}} - {{fee.name}}<br> |
|
|
|
${{fee.amount/100}}{{ fee.perc ? ` ${fee.perc}%` : ''}} - {{fee.name}}<br> |
|
|
|
{{fee.type}} |
|
|
|
</label> |
|
|
|
<img width="21" height="21" src="/assets/image/icon/x-red.svg" |
|
|
@@ -37,9 +37,13 @@ |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
<script setup> |
|
|
|
import { ref, computed, onMounted } from 'vue' |
|
|
|
import FeeDialog from "./fee-dialog.vue" |
|
|
|
|
|
|
|
const props = defineProps(['user', 'fees']) |
|
|
|
let edit = ref(null) |
|
|
|
|
|
|
|
function newFee(fee, isDebit) { |
|
|
|
this.edit = null |
|
|
|
} |
|
|
@@ -52,15 +56,25 @@ function remove() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
export default { |
|
|
|
props: [ 'user', 'fees' ], |
|
|
|
emits: [ 'deleteFee', 'update' ], |
|
|
|
components: { FeeDialog }, |
|
|
|
methods: { newFee, newType, remove }, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
edit: null |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
function getEstimates() { |
|
|
|
const token = getCookie("skouter") |
|
|
|
|
|
|
|
return fetch(`/api/estimates`, |
|
|
|
{method: 'GET', |
|
|
|
headers: { |
|
|
|
"Accept": "application/json", |
|
|
|
"Authorization": `Bearer ${token}`, |
|
|
|
}, |
|
|
|
}).then(response => { |
|
|
|
if (response.ok) { return response.json() } |
|
|
|
}).then (result => { |
|
|
|
if (!result || !result.length) return // Exit if token is invalid or no fees are saved |
|
|
|
this.fees = result |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
// getEstimates() |
|
|
|
}) |
|
|
|
</script> |