Skip to content

Commit

Permalink
add sku
Browse files Browse the repository at this point in the history
  • Loading branch information
mhd-zaid committed Dec 3, 2023
1 parent 7e3dab8 commit e5fb1cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dashboard/src/components/EntityDetailsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const props = defineProps(['data', 'entityType'])
const downloadInvoice = async (orderId:string) => {
const template = document.getElementById('invoice-template')
if(template && (props.data.user.deletedAt === null) && (props.data.status !== 'payment pending') && (props.data.status !== 'payment failed')){
if(template && (props.data.user.disabled === false) && (props.data.status !== 'payment pending') && (props.data.status !== 'payment failed')){
template.style.display = 'block'
await html2pdf(template, {
margin: [1,1],
Expand All @@ -35,7 +35,7 @@ const downloadInvoice = async (orderId:string) => {
</h1>
</div>
<div class="mt-4 sm:ml-16 sm:mt-0 sm:flex-none">
<button v-if="(props.entityType === 'order') && (props.data.status !== 'payment pending') && (props.data.status !== 'payment failed') && (props.data.user.deletedAt === null)"
<button v-if="(props.entityType === 'order') && (props.data.status !== 'payment pending') && (props.data.status !== 'payment failed') && (props.data.user && props.data.user.disabled === false)"
v-on:click="downloadInvoice(props.data.id)"
type="button"
class="block rounded-md bg-red-700 px-3 py-2 text-center text-sm font-semibold text-white shadow-sm hover:bg-red-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
Expand Down
14 changes: 10 additions & 4 deletions dashboard/src/components/OrderPdf.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const paymentTotal = () => {
<div class="invoice-box">
<table>
<tr class="top">
<td colspan="3">
<td colspan="4">
<table>
<tr>
<td class="title">
Expand All @@ -37,6 +37,7 @@ const paymentTotal = () => {
/>
</td>
<td></td>
<td></td>
<td v-if="props.data.payment">
Facture #{{props.data.payment.id.toUpperCase() }}<br />
Généré le: {{ formatDate() }}<br />
Expand All @@ -47,7 +48,7 @@ const paymentTotal = () => {
</tr>

<tr class="information">
<td colspan="3">
<td colspan="4">
<table>
<tr>
<td>
Expand All @@ -56,6 +57,7 @@ const paymentTotal = () => {
75012 Paris
</td>
<td></td>
<td></td>
<td v-if="props.data.user">
{{ props.data.user.firstname }} {{ props.data.user.lastname.toUpperCase() }}<br />
{{ props.data.user.email }} <br />
Expand All @@ -71,22 +73,26 @@ const paymentTotal = () => {
<tr class="heading">
<td> Méthode de Payment :</td>
<td></td>
<td></td>
<td>Carte</td>
</tr>
<tr><br></tr>
<tr class="heading">
<td>Référence</td>
<td>Produit</td>
<td>Quantité</td>
<td>Prix Unitaire</td>
</tr>

<tr class="item" v-if="props.data.products" v-for="product in props.data.products">
<td>{{ product.sku }}</td>
<td>{{ product.name }} - {{ product.size }}</td>
<td>{{ product.Orders_Products.quantity }}</td>
<td> {{ (product.Orders_Products.price / 100).toFixed(2) }} €</td>
</tr>
<tr><br></tr>
<tr class="total">
<td></td>
<td></td>
<td></td>
<td>Total: {{ paymentTotal() }} </td>
Expand Down Expand Up @@ -136,7 +142,7 @@ a {
vertical-align: top;
}
.invoice-box table tr td:nth-child(3) {
.invoice-box table tr td:nth-child(4) {
text-align: right;
}
Expand Down Expand Up @@ -172,7 +178,7 @@ a {
border-bottom: none;
}
.invoice-box table tr.total td:nth-child(3) {
.invoice-box table tr.total td:nth-child(4) {
border-top: 2px solid #eee;
font-weight: bold;
}
Expand Down

0 comments on commit e5fb1cd

Please sign in to comment.