jws-frontend/src/pages/05_quotation/preview/ViewHeader.vue
Methapon Metanipat c5d3897d76
feat: invoice (#174)
* feat: add 10 invoice

* feat: invoicelayout

* feat: invoicetable

* refactor: uew new table

* fix: columns missing

* feat: invoicebadgestatus

* feat: formatdate

#156

* refactor: watch pagesize and page

#159

* refector: filter status

#160

* feat: invoice stats

* fix: typo

* chore: cleanup

* refactor: add columns action

* refactor: add btn view invoice

* refactor: add query tab

* refactor: change set code invoice to function

* chore: change case

* refactor: add i18n netvalue

* refactor: add record colors of status invoice

* feat: add view card invoice

* chore: cleanpu

* refactor: handle i18n pay condition

* refactor: handle value by storage or by api

* refactor: add btnn preview

* refactor: function view doc example

* refactor: bind function view doc example

---------

Co-authored-by: Thanaphon Frappet <thanaphon@frappet.com>
Co-authored-by: nwpptrs <jay02499@gmail.com>
Co-authored-by: Methapon2001 <61303214+Methapon2001@users.noreply.github.com>
Co-authored-by: oat_dev <nattapon@frappet.com>
2025-01-14 11:34:20 +07:00

185 lines
4.5 KiB
Vue

<script lang="ts" setup>
import { dateFormat } from 'src/utils/datetime';
// NOTE: Import stores
import { formatAddress } from 'src/utils/address';
// NOTE Import Types
import { Branch } from 'src/stores/branch/types';
import { CustomerBranchRelation, Details } from 'src/stores/quotations/types';
// NOTE: Import Components
enum View {
Quotation,
Invoice,
Payment,
Receipt,
}
defineProps<{
branch: Branch;
customer: CustomerBranchRelation;
details: Details;
view: View;
}>();
function titleMode(mode: View): string {
if (mode === View.Quotation) {
return 'preview.title.quotation';
}
if (mode === View.Invoice) {
return 'preview.title.invoice';
}
if (mode === View.Payment) {
return 'preview.title.payment';
}
if (mode === View.Receipt) {
return 'preview.title.receipt';
}
return '';
}
</script>
<template>
<div class="row items-center q-mb-lg">
<div class="column" style="width: 50%">
<img src="/logo.png" width="192px" style="object-fit: scale-down" />
</div>
<div
class="column"
style="text-align: center; width: 50%; font-weight: 800; font-size: 24px"
>
{{ $t(titleMode(view)) }}
</div>
</div>
<article class="detail-card">
<section class="detail-customer-info">
<article>
<b>
{{ !!branch.virtual ? '' : $t('general.company') }} {{ branch.name }}
</b>
<span v-if="branch.province && branch.district && branch.subDistrict">
{{
formatAddress({
address: branch.address,
addressEN: branch.addressEN,
moo: branch.moo,
mooEN: branch.mooEN,
soi: branch.soi,
soiEN: branch.soiEN,
street: branch.street,
streetEN: branch.streetEN,
province: branch.province,
district: branch.district,
subDistrict: branch.subDistrict,
})
}}
</span>
<span>เลขประจำตวผเสยภาษ {{ branch.taxNo }}</span>
<span>เบอรโทร {{ branch.telephoneNo }}</span>
<span>{{ branch.webUrl }}</span>
</article>
<article>
<b>กค</b>
<span>
{{
formatAddress({
address: customer.address,
addressEN: customer.addressEN,
moo: customer.moo,
mooEN: customer.mooEN,
soi: customer.soi,
soiEN: customer.soiEN,
street: customer.street,
streetEN: customer.streetEN,
province: customer.province,
district: customer.district,
subDistrict: customer.subDistrict,
})
}}
</span>
<span>เลขประจำตวผเสยภาษ {{ customer.citizenId }}</span>
<span>เบอรโทร {{ customer.telephoneNo }}</span>
</article>
</section>
<section class="detail-quotation-info">
<div>
<div>{{ $t('general.itemNo', { msg: `${$t(titleMode(view))}` }) }}</div>
<div>{{ details.code }}</div>
</div>
<div>
<div>นทใบเสนอราคา</div>
<div>{{ dateFormat(details.createdAt, true, false, true) }}</div>
</div>
<div>
<div>ขาย</div>
<div>{{ details.createdBy }}</div>
</div>
<div>
<div>เงอนไขการชำระ</div>
<div>
{{ $t(`quotation.type.${details.payCondition}`) }}
</div>
</div>
<div>
<div>องาน</div>
<div>{{ details.workName }}</div>
</div>
<div>
<div>ดต</div>
<div>{{ details.contactName }}</div>
</div>
<div>
<div>นครบกำหนดชำระ</div>
<div>{{ dateFormat(details.dueDate, true, false, true) }}</div>
</div>
</section>
</article>
</template>
<style scoped>
.detail-card {
display: flex;
gap: 16px;
& > * {
flex-grow: 1;
}
& > :first-child {
max-width: 57.5%;
}
}
.detail-customer-info {
display: flex;
flex-direction: column;
gap: 16px;
& > * {
display: flex;
flex-direction: column;
& > :first-child {
color: var(--main);
}
}
}
.detail-quotation-info {
& > * {
display: flex;
& > :first-child {
color: var(--main);
}
& > * {
width: 50%;
}
}
}
</style>