diff --git a/bo/src/layouts/default.vue b/bo/src/layouts/default.vue
index 2044612..d6dfd13 100644
--- a/bo/src/layouts/default.vue
+++ b/bo/src/layouts/default.vue
@@ -4,7 +4,7 @@ import TopBar from '@/components/TopBar.vue';
-
+
diff --git a/bo/src/router/index.ts b/bo/src/router/index.ts
index 44fedb9..e14302d 100644
--- a/bo/src/router/index.ts
+++ b/bo/src/router/index.ts
@@ -29,6 +29,8 @@ const router = createRouter({
{ path: 'products-datail/', component: () => import('../components/admin/ProductDetailView.vue'), name: 'product-detail' },
{ path: 'product-card-full/', component: () => import('../components/customer/PageProductCardFull.vue'), name: 'product-card-full' },
{ path: 'addresses', component: () => import('../components/customer/PageAddresses.vue'), name: 'addresses' },
+ { path: 'customer-data', component: () => import('../components/customer/PageCustomerData.vue'), name: 'customer-data' },
+ { path: 'create-account', component: () => import('../components/customer/PageCreateAccount.vue'), name: 'create-account' },
{ path: 'cart', component: () => import('../components/customer/PageCart.vue'), name: 'cart' },
{ path: 'cart1', component: () => import('../components/customer/Cart1.vue'), name: 'cart1' },
{ path: 'products-list', component: () => import('../components/customer/PageProductsList.vue'), name: 'products-list' },
diff --git a/bo/src/stores/address.ts b/bo/src/stores/address.ts
index 6e0859a..489ba73 100644
--- a/bo/src/stores/address.ts
+++ b/bo/src/stores/address.ts
@@ -86,10 +86,10 @@ export const useAddressStore = defineStore('address', () => {
function updateAddress(id: number, formData: AddressFormData): boolean {
const index = addresses.value.findIndex(a => a.id === id)
- if (index === -1) return false
+ if (index === -1) return false
const existing = addresses.value[index]
- if (!existing) return false
+ if (!existing) return false
addresses.value[index] = {
id: existing.id,
diff --git a/bo/src/stores/auth.ts b/bo/src/stores/auth.ts
index 7d6ee18..3afea09 100644
--- a/bo/src/stores/auth.ts
+++ b/bo/src/stores/auth.ts
@@ -77,14 +77,42 @@ export const useAuthStore = defineStore('auth', () => {
password: string,
confirm_password: string,
lang?: string,
+ company_name?: string,
+ company_email?: string,
+ company_address?: {
+ street: string
+ zipCode: string
+ city: string
+ country: string
+ },
+ regon?: string,
+ nip?: string,
+ vat?: string,
+ billing_address?: {
+ street: string
+ zipCode: string
+ city: string
+ country: string
+ },
) {
loading.value = true
error.value = null
try {
+ const body: any = { first_name, last_name, email, password, confirm_password, lang: lang || 'en' }
+
+ // Add company information if provided
+ if (company_name) body.company_name = company_name
+ if (company_email) body.company_email = company_email
+ if (company_address) body.company_address = company_address
+ if (regon) body.regon = regon
+ if (nip) body.nip = nip
+ if (vat) body.vat = vat
+ if (billing_address) body.billing_address = billing_address
+
await useFetchJson('/api/v1/public/auth/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ first_name, last_name, email, password, confirm_password, lang: lang || 'en' }),
+ body: JSON.stringify(body),
})
return { success: true, requiresVerification: true }
diff --git a/bo/src/stores/cart.ts b/bo/src/stores/cart.ts
index 6adc9ec..e2e9577 100644
--- a/bo/src/stores/cart.ts
+++ b/bo/src/stores/cart.ts
@@ -8,7 +8,7 @@ export interface CartItem {
image: string
price: number
quantity: number
- product_number:string
+ product_number: string
}
export interface DeliveryMethod {
@@ -24,7 +24,7 @@ export const useCartStore = defineStore('cart', () => {
const selectedDeliveryMethodId = ref(null)
const shippingCost = ref(0)
const vatRate = ref(0.23) // 23% VAT
-
+ const currentPage = ref(1)
const deliveryMethods = ref([
{ id: 1, name: 'Standard Delivery', price: 0, description: '5-7 business days' },
{ id: 2, name: 'Express Delivery', price: 15, description: '2-3 business days' },
@@ -66,7 +66,20 @@ export const useCartStore = defineStore('cart', () => {
}
}
-
+ function deleteProduct(id: number): boolean {
+ const index = items.value.findIndex(a => a.id === id)
+ if (index === -1) return false
+
+ items.value.splice(index, 1)
+ resetProductPagination()
+
+ return true
+ }
+
+ function resetProductPagination() {
+ currentPage.value = 1
+ }
+
function removeItem(itemId: number) {
const index = items.value.findIndex(i => i.id === itemId)
if (index !== -1) {
@@ -106,6 +119,7 @@ export const useCartStore = defineStore('cart', () => {
vatAmount,
orderTotal,
itemCount,
+ deleteProduct,
updateQuantity,
removeItem,
clearCart,
diff --git a/bo/src/stores/customer.ts b/bo/src/stores/customer.ts
new file mode 100644
index 0000000..eefaa08
--- /dev/null
+++ b/bo/src/stores/customer.ts
@@ -0,0 +1,46 @@
+import { defineStore } from 'pinia'
+import { ref, computed } from 'vue'
+import type { Address } from './address'
+
+export interface CustomerData {
+ companyName: string
+ companyEmail: string
+ companyAddress: string
+ regon: string
+ nip: string
+ vat: string
+ billingAddressId: number | null
+ companyAddressId: number | null
+}
+
+export const useCustomerStore = defineStore('customer', () => {
+ const customer = ref(null)
+ const loading = ref(false)
+ const error = ref(null)
+
+ const hasAccount = computed(() => customer.value !== null)
+
+ function setCustomer(data: CustomerData) {
+ customer.value = data
+ }
+
+ function clearCustomer() {
+ customer.value = null
+ }
+
+ function updateCustomer(data: Partial) {
+ if (customer.value) {
+ customer.value = { ...customer.value, ...data }
+ }
+ }
+
+ return {
+ customer,
+ loading,
+ error,
+ hasAccount,
+ setCustomer,
+ clearCustomer,
+ updateCustomer
+ }
+})
\ No newline at end of file