Files
InvoiceShelf/resources/scripts/components/InvoicePublicPage.vue
Darko Gjorgjijoski ad5a7e51b9 Upgrade to Vite 8 and Tailwind CSS 4 (#595)
- Vite 6 → 8 (Rolldown bundler), laravel-vite-plugin 1 → 3, @vitejs/plugin-vue 5 → 6
- Tailwind CSS 3 → 4 with CSS-based config (@theme, @plugin, @utility)
- Add @tailwindcss/vite plugin, remove postcss/autoprefixer/sass
- Convert SCSS files to plain CSS (resources/sass → resources/css)
- Migrate tailwind.config.js to CSS @theme directives
- Rename deprecated utility classes (shadow-sm→shadow-xs, outline-none→outline-hidden,
  rounded-sm→rounded-xs, bg-gradient-to→bg-linear-to, ring→ring-3)
- Migrate opacity utilities to color modifiers (bg-opacity, text-opacity,
  border-opacity, ring-opacity → color/N syntax)
- Update primary color CSS vars to full rgb() values for TW4 color-mix()
- Fix border-l color specificity for sidebar navigation (TW4 default border
  color changed from gray-200 to currentColor)
- Fix invalid border color classes (border-grey-light, border-modal-bg, border--200)
- Add @reference directive for @apply in Vue component style blocks
- Convert Vue component <style lang="scss"> blocks to plain CSS
2026-04-02 15:59:15 +02:00

121 lines
2.8 KiB
Vue

I
<template>
<div class="h-screen overflow-y-auto min-h-0">
<div class="bg-linear-to-r from-primary-500 to-primary-400 h-5"></div>
<div
class="
relative
p-6
pb-28
px-4
md:px-6
w-full
md:w-auto md:max-w-xl
mx-auto
"
>
<BasePageHeader :title="pageTitle || ''">
<template #actions>
<div
class="
flex flex-col
md:flex-row
absolute
md:relative
bottom-2
left-0
px-4
md:px-0
w-full
md:space-x-4 md:space-y-0
space-y-2
"
>
<a :href="shareableLink" target="_blank" class="block w-full">
<BaseButton
variant="primary-outline"
class="justify-center w-full"
>
{{ $t('general.download_pdf') }}
</BaseButton>
</a>
<BaseButton
v-if="
invoiceData &&
invoiceData.paid_status !== 'PAID' &&
invoiceData.payment_module_enabled
"
variant="primary"
class="justify-center"
@click="payInvoice"
>
{{ $t('general.pay_invoice') }}
</BaseButton>
</div>
</template>
</BasePageHeader>
<InvoiceInformationCard :invoice="invoiceData" />
<div
v-if="!customerLogo"
class="flex items-center justify-center mt-4 text-gray-500 font-normal"
>
Powered by
<a href="https://invoiceshelf.com" target="_blank">
<img :src="getLogo()" class="h-4 ml-1 mb-1" />
</a>
</div>
</div>
</div>
</template>
<script setup>
import http from '@/scripts/http'
import { ref, reactive, computed, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import InvoiceInformationCard from '@/scripts/components/InvoiceInformationCard.vue'
let invoiceData = ref(null)
const route = useRoute()
const router = useRouter()
loadInvoice()
async function loadInvoice() {
let res = await http.get(`/customer/invoices/${route.params.hash}`)
invoiceData.value = res.data.data
}
const shareableLink = computed(() => {
return route.path + '?pdf'
})
function getLogo() {
const imgUrl = new URL('$images/logo-gray.png', import.meta.url)
return imgUrl
}
const customerLogo = computed(() => {
if (window.customer_logo) {
return window.customer_logo
}
return false
})
const pageTitle = computed(() => invoiceData.value?.invoice_number)
function payInvoice() {
router.push({
name: 'invoice.pay',
params: {
hash: route.params.hash,
company: invoiceData.value.company.slug,
},
})
}
</script>