Compare commits
13 Commits
5663c4e126
...
19e3f6f0ed
| Author | SHA1 | Date | |
|---|---|---|---|
| 19e3f6f0ed | |||
| 46f4618301 | |||
| e335c3aa6f | |||
| 5ebf21c559 | |||
| 84b4c70ffb | |||
|
|
2fd9472db1 | ||
| 66df535317 | |||
| c97251c15b | |||
| fa85c34794 | |||
|
|
e0a86febc4 | ||
|
|
40154ec861 | ||
|
|
bb507036db | ||
| c59428adaa |
@@ -28,7 +28,7 @@ tmp_dir = "tmp"
|
|||||||
rerun = false
|
rerun = false
|
||||||
rerun_delay = 500
|
rerun_delay = 500
|
||||||
send_interrupt = false
|
send_interrupt = false
|
||||||
stop_on_error = false
|
stop_on_error = true
|
||||||
|
|
||||||
[color]
|
[color]
|
||||||
app = ""
|
app = ""
|
||||||
|
|||||||
@@ -29,10 +29,12 @@ func CartsHandlerRoutes(r fiber.Router) fiber.Router {
|
|||||||
handler := NewCartsHandler()
|
handler := NewCartsHandler()
|
||||||
|
|
||||||
r.Get("/add-new-cart", handler.AddNewCart)
|
r.Get("/add-new-cart", handler.AddNewCart)
|
||||||
|
r.Delete("/remove-cart", handler.RemoveCart)
|
||||||
r.Get("/change-cart-name", handler.ChangeCartName)
|
r.Get("/change-cart-name", handler.ChangeCartName)
|
||||||
r.Get("/retrieve-carts-info", handler.RetrieveCartsInfo)
|
r.Get("/retrieve-carts-info", handler.RetrieveCartsInfo)
|
||||||
r.Get("/retrieve-cart", handler.RetrieveCart)
|
r.Get("/retrieve-cart", handler.RetrieveCart)
|
||||||
r.Get("/add-product-to-cart", handler.AddProduct)
|
r.Get("/add-product-to-cart", handler.AddProduct)
|
||||||
|
r.Delete("/remove-product-from-cart", handler.RemoveProduct)
|
||||||
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
@@ -53,6 +55,29 @@ func (h *CartsHandler) AddNewCart(c fiber.Ctx) error {
|
|||||||
return c.JSON(response.Make(&new_cart, 0, i18n.T_(c, response.Message_OK)))
|
return c.JSON(response.Make(&new_cart, 0, i18n.T_(c, response.Message_OK)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *CartsHandler) RemoveCart(c fiber.Ctx) error {
|
||||||
|
userID, ok := localeExtractor.GetUserID(c)
|
||||||
|
if !ok {
|
||||||
|
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
|
||||||
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))
|
||||||
|
}
|
||||||
|
|
||||||
|
cart_id_attribute := c.Query("cart_id")
|
||||||
|
cart_id, err := strconv.Atoi(cart_id_attribute)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
|
||||||
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
|
||||||
|
}
|
||||||
|
|
||||||
|
err = h.cartsService.RemoveCart(userID, uint(cart_id))
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(responseErrors.GetErrorStatus(err)).
|
||||||
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.JSON(response.Make(nullable.GetNil(""), 0, i18n.T_(c, response.Message_OK)))
|
||||||
|
}
|
||||||
|
|
||||||
func (h *CartsHandler) ChangeCartName(c fiber.Ctx) error {
|
func (h *CartsHandler) ChangeCartName(c fiber.Ctx) error {
|
||||||
userID, ok := localeExtractor.GetUserID(c)
|
userID, ok := localeExtractor.GetUserID(c)
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -117,6 +142,7 @@ func (h *CartsHandler) RetrieveCart(c fiber.Ctx) error {
|
|||||||
return c.JSON(response.Make(cart, 0, i18n.T_(c, response.Message_OK)))
|
return c.JSON(response.Make(cart, 0, i18n.T_(c, response.Message_OK)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// adds or sets given amount of products to the cart
|
||||||
func (h *CartsHandler) AddProduct(c fiber.Ctx) error {
|
func (h *CartsHandler) AddProduct(c fiber.Ctx) error {
|
||||||
userID, ok := localeExtractor.GetUserID(c)
|
userID, ok := localeExtractor.GetUserID(c)
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -159,7 +185,59 @@ func (h *CartsHandler) AddProduct(c fiber.Ctx) error {
|
|||||||
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
|
||||||
}
|
}
|
||||||
|
|
||||||
err = h.cartsService.AddProduct(userID, uint(cart_id), uint(product_id), product_attribute_id, uint(amount))
|
set_amount_attribute := c.Query("set_amount")
|
||||||
|
set_amount, err := strconv.ParseBool(set_amount_attribute)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
|
||||||
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
|
||||||
|
}
|
||||||
|
|
||||||
|
err = h.cartsService.AddProduct(userID, uint(cart_id), uint(product_id), product_attribute_id, amount, set_amount)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(responseErrors.GetErrorStatus(err)).
|
||||||
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.JSON(response.Make(nullable.GetNil(""), 0, i18n.T_(c, response.Message_OK)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// removes product from the cart.
|
||||||
|
func (h *CartsHandler) RemoveProduct(c fiber.Ctx) error {
|
||||||
|
userID, ok := localeExtractor.GetUserID(c)
|
||||||
|
if !ok {
|
||||||
|
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
|
||||||
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))
|
||||||
|
}
|
||||||
|
|
||||||
|
cart_id_attribute := c.Query("cart_id")
|
||||||
|
cart_id, err := strconv.Atoi(cart_id_attribute)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
|
||||||
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
|
||||||
|
}
|
||||||
|
|
||||||
|
product_id_attribute := c.Query("product_id")
|
||||||
|
product_id, err := strconv.Atoi(product_id_attribute)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
|
||||||
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
|
||||||
|
}
|
||||||
|
|
||||||
|
product_attribute_id_attribute := c.Query("product_attribute_id")
|
||||||
|
var product_attribute_id *uint
|
||||||
|
if product_attribute_id_attribute == "" {
|
||||||
|
product_attribute_id = nil
|
||||||
|
} else {
|
||||||
|
val, err := strconv.Atoi(product_attribute_id_attribute)
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
|
||||||
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
|
||||||
|
}
|
||||||
|
uval := uint(val)
|
||||||
|
product_attribute_id = &uval
|
||||||
|
}
|
||||||
|
|
||||||
|
err = h.cartsService.RemoveProduct(userID, uint(cart_id), uint(product_id), product_attribute_id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return c.Status(responseErrors.GetErrorStatus(err)).
|
return c.Status(responseErrors.GetErrorStatus(err)).
|
||||||
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
package cartsRepo
|
package cartsRepo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
"git.ma-al.com/goc_daniel/b2b/app/db"
|
"git.ma-al.com/goc_daniel/b2b/app/db"
|
||||||
"git.ma-al.com/goc_daniel/b2b/app/model"
|
"git.ma-al.com/goc_daniel/b2b/app/model"
|
||||||
constdata "git.ma-al.com/goc_daniel/b2b/app/utils/const_data"
|
constdata "git.ma-al.com/goc_daniel/b2b/app/utils/const_data"
|
||||||
|
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UICartsRepo interface {
|
type UICartsRepo interface {
|
||||||
@@ -15,7 +19,8 @@ type UICartsRepo interface {
|
|||||||
RetrieveCartsInfo(user_id uint) ([]model.CustomerCart, error)
|
RetrieveCartsInfo(user_id uint) ([]model.CustomerCart, error)
|
||||||
RetrieveCart(user_id uint, cart_id uint) (*model.CustomerCart, error)
|
RetrieveCart(user_id uint, cart_id uint) (*model.CustomerCart, error)
|
||||||
CheckProductExists(product_id uint, product_attribute_id *uint) (bool, error)
|
CheckProductExists(product_id uint, product_attribute_id *uint) (bool, error)
|
||||||
AddProduct(user_id uint, cart_id uint, product_id uint, product_attribute_id *uint, amount uint) error
|
AddProduct(cart_id uint, product_id uint, product_attribute_id *uint, amount uint, set_amount bool) error
|
||||||
|
RemoveProduct(cart_id uint, product_id uint, product_attribute_id *uint) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type CartsRepo struct{}
|
type CartsRepo struct{}
|
||||||
@@ -129,14 +134,61 @@ func (repo *CartsRepo) CheckProductExists(product_id uint, product_attribute_id
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *CartsRepo) AddProduct(user_id uint, cart_id uint, product_id uint, product_attribute_id *uint, amount uint) error {
|
func (repo *CartsRepo) AddProduct(cart_id uint, product_id uint, product_attribute_id *uint, amount uint, set_amount bool) error {
|
||||||
product := model.CartProduct{
|
var product model.CartProduct
|
||||||
|
|
||||||
|
err := db.DB.
|
||||||
|
Where(&model.CartProduct{
|
||||||
|
CartID: cart_id,
|
||||||
|
ProductID: product_id,
|
||||||
|
ProductAttributeID: product_attribute_id,
|
||||||
|
}).
|
||||||
|
First(&product).Error
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
if amount < 1 {
|
||||||
|
return responseErrors.ErrAmountMustBePositive
|
||||||
|
} else if amount > constdata.MAX_AMOUNT_OF_PRODUCT_IN_CART {
|
||||||
|
return responseErrors.ErrAmountMustBeReasonable
|
||||||
|
}
|
||||||
|
|
||||||
|
product = model.CartProduct{
|
||||||
CartID: cart_id,
|
CartID: cart_id,
|
||||||
ProductID: product_id,
|
ProductID: product_id,
|
||||||
ProductAttributeID: product_attribute_id,
|
ProductAttributeID: product_attribute_id,
|
||||||
Amount: amount,
|
Amount: amount,
|
||||||
}
|
}
|
||||||
err := db.DB.Create(&product).Error
|
|
||||||
|
|
||||||
|
return db.DB.Create(&product).Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// Some other DB error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Product already exists in cart
|
||||||
|
if set_amount {
|
||||||
|
product.Amount = amount
|
||||||
|
} else {
|
||||||
|
product.Amount = product.Amount + amount
|
||||||
|
}
|
||||||
|
|
||||||
|
if product.Amount < 1 {
|
||||||
|
return responseErrors.ErrAmountMustBePositive
|
||||||
|
} else if product.Amount > constdata.MAX_AMOUNT_OF_PRODUCT_IN_CART {
|
||||||
|
return responseErrors.ErrAmountMustBeReasonable
|
||||||
|
}
|
||||||
|
|
||||||
|
return db.DB.Save(&product).Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *CartsRepo) RemoveProduct(cart_id uint, product_id uint, product_attribute_id *uint) error {
|
||||||
|
return db.DB.
|
||||||
|
Where(&model.CartProduct{
|
||||||
|
CartID: cart_id,
|
||||||
|
ProductID: product_id,
|
||||||
|
ProductAttributeID: product_attribute_id,
|
||||||
|
}).
|
||||||
|
Delete(&model.CartProduct{}).Error
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package localeSelectorRepo
|
|||||||
import (
|
import (
|
||||||
"git.ma-al.com/goc_daniel/b2b/app/db"
|
"git.ma-al.com/goc_daniel/b2b/app/db"
|
||||||
"git.ma-al.com/goc_daniel/b2b/app/model"
|
"git.ma-al.com/goc_daniel/b2b/app/model"
|
||||||
|
"git.ma-al.com/goc_daniel/b2b/app/model/dbmodel"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UILocaleSelectorRepo interface {
|
type UILocaleSelectorRepo interface {
|
||||||
@@ -25,7 +26,9 @@ func (r *LocaleSelectorRepo) GetLanguages() ([]model.Language, error) {
|
|||||||
func (r *LocaleSelectorRepo) GetCountriesAndCurrencies() ([]model.Country, error) {
|
func (r *LocaleSelectorRepo) GetCountriesAndCurrencies() ([]model.Country, error) {
|
||||||
var countries []model.Country
|
var countries []model.Country
|
||||||
err := db.Get().
|
err := db.Get().
|
||||||
Preload("PSCurrency").
|
Select("*").
|
||||||
|
Preload("Currency").
|
||||||
|
Joins("LEFT JOIN " + dbmodel.TableNamePsCountryLang + " AS cl ON cl." + dbmodel.PsCountryLangCols.IDCountry.Col() + " = b2b_countries.ps_id_country AND cl." + dbmodel.PsCountryLangCols.IDLang.Col() + " = 2").
|
||||||
Find(&countries).Error
|
Find(&countries).Error
|
||||||
return countries, err
|
return countries, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ func (s *CartsService) RetrieveCart(user_id uint, cart_id uint) (*model.Customer
|
|||||||
return s.repo.RetrieveCart(user_id, cart_id)
|
return s.repo.RetrieveCart(user_id, cart_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CartsService) AddProduct(user_id uint, cart_id uint, product_id uint, product_attribute_id *uint, amount uint) error {
|
func (s *CartsService) AddProduct(user_id uint, cart_id uint, product_id uint, product_attribute_id *uint, amount int, set_amount bool) error {
|
||||||
exists, err := s.repo.UserHasCart(user_id, cart_id)
|
exists, err := s.repo.UserHasCart(user_id, cart_id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -91,5 +91,17 @@ func (s *CartsService) AddProduct(user_id uint, cart_id uint, product_id uint, p
|
|||||||
return responseErrors.ErrProductOrItsVariationDoesNotExist
|
return responseErrors.ErrProductOrItsVariationDoesNotExist
|
||||||
}
|
}
|
||||||
|
|
||||||
return s.repo.AddProduct(user_id, cart_id, product_id, product_attribute_id, amount)
|
return s.repo.AddProduct(cart_id, product_id, product_attribute_id, uint(amount), set_amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *CartsService) RemoveProduct(user_id uint, cart_id uint, product_id uint, product_attribute_id *uint) error {
|
||||||
|
exists, err := s.repo.UserHasCart(user_id, cart_id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if !exists {
|
||||||
|
return responseErrors.ErrUserHasNoSuchCart
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.repo.RemoveProduct(cart_id, product_id, product_attribute_id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,6 +153,6 @@ func (s *EmailService) newUserAdminNotificationTemplate(userEmail, userName, bas
|
|||||||
// newUserAdminNotificationTemplate returns the HTML template for admin notification
|
// newUserAdminNotificationTemplate returns the HTML template for admin notification
|
||||||
func (s *EmailService) newOrderPlacedTemplate(userID uint) string {
|
func (s *EmailService) newOrderPlacedTemplate(userID uint) string {
|
||||||
buf := bytes.Buffer{}
|
buf := bytes.Buffer{}
|
||||||
emails.EmailNewOrderPlacedWrapper(view.EmailLayout[view.EmailNewOrderPlacedData]{LangID: constdata.ADMIN_NOTIFICATION_LANGUAGE, Data: view.EmailNewOrderPlacedData{UserID: userID}}).Render(context.Background(), &buf)
|
// emails.EmailNewOrderPlacedWrapper(view.EmailLayout[view.EmailNewOrderPlacedData]{LangID: constdata.ADMIN_NOTIFICATION_LANGUAGE, Data: view.EmailNewOrderPlacedData{UserID: userID}}).Render(context.Background(), &buf)
|
||||||
return buf.String()
|
return buf.String()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ var CATEGORY_BLACKLIST = []uint{250}
|
|||||||
|
|
||||||
const MAX_AMOUNT_OF_CARTS_PER_USER = 10
|
const MAX_AMOUNT_OF_CARTS_PER_USER = 10
|
||||||
const DEFAULT_NEW_CART_NAME = "new cart"
|
const DEFAULT_NEW_CART_NAME = "new cart"
|
||||||
|
const MAX_AMOUNT_OF_PRODUCT_IN_CART = 1024
|
||||||
|
|
||||||
const MAX_AMOUNT_OF_ADDRESSES_PER_USER = 10
|
const MAX_AMOUNT_OF_ADDRESSES_PER_USER = 10
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ var (
|
|||||||
ErrMaxAmtOfCartsReached = errors.New("maximal amount of carts reached")
|
ErrMaxAmtOfCartsReached = errors.New("maximal amount of carts reached")
|
||||||
ErrUserHasNoSuchCart = errors.New("user does not have cart with given id")
|
ErrUserHasNoSuchCart = errors.New("user does not have cart with given id")
|
||||||
ErrProductOrItsVariationDoesNotExist = errors.New("product or its variation with given ids does not exist")
|
ErrProductOrItsVariationDoesNotExist = errors.New("product or its variation with given ids does not exist")
|
||||||
|
ErrAmountMustBePositive = errors.New("amount must be positive")
|
||||||
|
ErrAmountMustBeReasonable = errors.New("amount must be reasonable")
|
||||||
|
|
||||||
// Typed errors for orders handler
|
// Typed errors for orders handler
|
||||||
ErrEmptyCart = errors.New("the cart is empty")
|
ErrEmptyCart = errors.New("the cart is empty")
|
||||||
@@ -205,6 +207,10 @@ func GetErrorCode(c fiber.Ctx, err error) string {
|
|||||||
return i18n.T_(c, "error.err_user_has_no_such_cart")
|
return i18n.T_(c, "error.err_user_has_no_such_cart")
|
||||||
case errors.Is(err, ErrProductOrItsVariationDoesNotExist):
|
case errors.Is(err, ErrProductOrItsVariationDoesNotExist):
|
||||||
return i18n.T_(c, "error.err_product_or_its_variation_does_not_exist")
|
return i18n.T_(c, "error.err_product_or_its_variation_does_not_exist")
|
||||||
|
case errors.Is(err, ErrAmountMustBePositive):
|
||||||
|
return i18n.T_(c, "error.err_amount_must_be_positive")
|
||||||
|
case errors.Is(err, ErrAmountMustBeReasonable):
|
||||||
|
return i18n.T_(c, "error.err_amount_must_be_reasonable")
|
||||||
|
|
||||||
case errors.Is(err, ErrEmptyCart):
|
case errors.Is(err, ErrEmptyCart):
|
||||||
return i18n.T_(c, "error.err_cart_is_empty")
|
return i18n.T_(c, "error.err_cart_is_empty")
|
||||||
@@ -292,6 +298,8 @@ func GetErrorStatus(err error) int {
|
|||||||
errors.Is(err, ErrMaxAmtOfCartsReached),
|
errors.Is(err, ErrMaxAmtOfCartsReached),
|
||||||
errors.Is(err, ErrUserHasNoSuchCart),
|
errors.Is(err, ErrUserHasNoSuchCart),
|
||||||
errors.Is(err, ErrProductOrItsVariationDoesNotExist),
|
errors.Is(err, ErrProductOrItsVariationDoesNotExist),
|
||||||
|
errors.Is(err, ErrAmountMustBePositive),
|
||||||
|
errors.Is(err, ErrAmountMustBeReasonable),
|
||||||
errors.Is(err, ErrEmptyCart),
|
errors.Is(err, ErrEmptyCart),
|
||||||
errors.Is(err, ErrUserHasNoSuchOrder),
|
errors.Is(err, ErrUserHasNoSuchOrder),
|
||||||
errors.Is(err, ErrInvalidReductionType),
|
errors.Is(err, ErrInvalidReductionType),
|
||||||
|
|||||||
6
bo/components.d.ts
vendored
6
bo/components.d.ts
vendored
@@ -11,7 +11,6 @@ export {}
|
|||||||
/* prettier-ignore */
|
/* prettier-ignore */
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
ButtonGoToProfile: typeof import('./src/components/customer-management/ButtonGoToProfile.vue')['default']
|
|
||||||
CartDetails: typeof import('./src/components/customer/CartDetails.vue')['default']
|
CartDetails: typeof import('./src/components/customer/CartDetails.vue')['default']
|
||||||
CategoryMenu: typeof import('./src/components/inner/CategoryMenu.vue')['default']
|
CategoryMenu: typeof import('./src/components/inner/CategoryMenu.vue')['default']
|
||||||
copy: typeof import('./src/components/admin/ProductDetailView copy.vue')['default']
|
copy: typeof import('./src/components/admin/ProductDetailView copy.vue')['default']
|
||||||
@@ -23,12 +22,16 @@ declare module 'vue' {
|
|||||||
FavoriteProducts: typeof import('./src/components/admin/FavoriteProducts.vue')['default']
|
FavoriteProducts: typeof import('./src/components/admin/FavoriteProducts.vue')['default']
|
||||||
LangSwitch: typeof import('./src/components/inner/LangSwitch.vue')['default']
|
LangSwitch: typeof import('./src/components/inner/LangSwitch.vue')['default']
|
||||||
PageAddresses: typeof import('./src/components/customer/PageAddresses.vue')['default']
|
PageAddresses: typeof import('./src/components/customer/PageAddresses.vue')['default']
|
||||||
|
PageCart: typeof import('./src/components/customer/PageCart.vue')['default']
|
||||||
PageCarts: typeof import('./src/components/customer/PageCarts.vue')['default']
|
PageCarts: typeof import('./src/components/customer/PageCarts.vue')['default']
|
||||||
|
PageCArts: typeof import('./src/components/customer/PageCArts.vue')['default']
|
||||||
|
PageCreateCart: typeof import('./src/components/customer/PageCreateCart.vue')['default']
|
||||||
PageOrders: typeof import('./src/components/customer/PageOrders.vue')['default']
|
PageOrders: typeof import('./src/components/customer/PageOrders.vue')['default']
|
||||||
PageProduct: typeof import('./src/components/customer/PageProduct.vue')['default']
|
PageProduct: typeof import('./src/components/customer/PageProduct.vue')['default']
|
||||||
PageProducts: typeof import('./src/components/admin/PageProducts.vue')['default']
|
PageProducts: typeof import('./src/components/admin/PageProducts.vue')['default']
|
||||||
PageProfileDetails: typeof import('./src/components/customer/PageProfileDetails.vue')['default']
|
PageProfileDetails: typeof import('./src/components/customer/PageProfileDetails.vue')['default']
|
||||||
PageProfileDetailsAddInfo: typeof import('./src/components/customer/PageProfileDetailsAddInfo.vue')['default']
|
PageProfileDetailsAddInfo: typeof import('./src/components/customer/PageProfileDetailsAddInfo.vue')['default']
|
||||||
|
PageSearchProducts: typeof import('./src/components/customer/PageSearchProducts.vue')['default']
|
||||||
PageStatistic: typeof import('./src/components/customer/PageStatistic.vue')['default']
|
PageStatistic: typeof import('./src/components/customer/PageStatistic.vue')['default']
|
||||||
Pl_PrivacyPolicyView: typeof import('./src/components/terms/pl_PrivacyPolicyView.vue')['default']
|
Pl_PrivacyPolicyView: typeof import('./src/components/terms/pl_PrivacyPolicyView.vue')['default']
|
||||||
Pl_TermsAndConditionsView: typeof import('./src/components/terms/pl_TermsAndConditionsView.vue')['default']
|
Pl_TermsAndConditionsView: typeof import('./src/components/terms/pl_TermsAndConditionsView.vue')['default']
|
||||||
@@ -45,6 +48,7 @@ declare module 'vue' {
|
|||||||
TopBar: typeof import('./src/components/TopBar.vue')['default']
|
TopBar: typeof import('./src/components/TopBar.vue')['default']
|
||||||
TopBarLogin: typeof import('./src/components/TopBarLogin.vue')['default']
|
TopBarLogin: typeof import('./src/components/TopBarLogin.vue')['default']
|
||||||
UAlert: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Alert.vue')['default']
|
UAlert: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Alert.vue')['default']
|
||||||
|
UApp: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/App.vue')['default']
|
||||||
UAvatar: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Avatar.vue')['default']
|
UAvatar: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Avatar.vue')['default']
|
||||||
UButton: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Button.vue')['default']
|
UButton: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Button.vue')['default']
|
||||||
UCard: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Card.vue')['default']
|
UCard: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Card.vue')['default']
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
import { TooltipProvider } from 'reka-ui'
|
import { TooltipProvider } from 'reka-ui'
|
||||||
import { RouterView } from 'vue-router'
|
import { RouterView, useRoute } from 'vue-router'
|
||||||
|
import DefaultLayout from '@/layouts/default.vue'
|
||||||
|
import EmptyLayout from '@/layouts/empty.vue'
|
||||||
|
import ManagementLayout from '@/layouts/management.vue'
|
||||||
import { useAuthStore } from './stores/customer/auth'
|
import { useAuthStore } from './stores/customer/auth'
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
|
const route = useRoute()
|
||||||
|
const layout = computed(() => (route.meta.layout as string) || 'default')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Suspense>
|
<Suspense>
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<RouterView />
|
<component :is="layout === 'empty' ? EmptyLayout : layout === 'management' ? ManagementLayout : DefaultLayout">
|
||||||
|
<RouterView v-slot="{ Component }">
|
||||||
|
<component :is="Component" />
|
||||||
|
</RouterView>
|
||||||
|
</component>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Default from '@/layouts/default.vue';
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="flex flex-col md:flex-row gap-10">
|
<div class="flex flex-col md:flex-row gap-10">
|
||||||
<CategoryMenu />
|
<CategoryMenu />
|
||||||
<div class="w-full flex flex-col items-center gap-4">
|
<div class="w-full flex flex-col items-center gap-4">
|
||||||
@@ -9,13 +8,11 @@
|
|||||||
<UPagination v-model:page="page" :total="total" :items-per-page="perPage" />
|
<UPagination v-model:page="page" :total="total" :items-per-page="perPage" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch, h, resolveComponent, computed } from 'vue'
|
import { ref, watch, h, resolveComponent, computed } from 'vue'
|
||||||
import { useFetchJson } from '@/composable/useFetchJson'
|
import { useFetchJson } from '@/composable/useFetchJson'
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import type { TableColumn } from '@nuxt/ui'
|
import type { TableColumn } from '@nuxt/ui'
|
||||||
import CategoryMenu from '../inner/CategoryMenu.vue'
|
import CategoryMenu from '../inner/CategoryMenu.vue'
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="flex items-center gap-2 mb-4">
|
<div class="flex items-center gap-2 mb-4">
|
||||||
<UIcon name="line-md:arrow-left" class="text-(--text-sky-light) dark:text-(--text-sky-dark)" />
|
<UIcon name="line-md:arrow-left" class="text-(--text-sky-light) dark:text-(--text-sky-dark)" />
|
||||||
<p class="cursor-pointer text-(--text-sky-light) dark:text-(--text-sky-dark)" @click="backFromProduct()">
|
<p class="cursor-pointer text-(--text-sky-light) dark:text-(--text-sky-dark)" @click="backFromProduct()">
|
||||||
@@ -190,12 +189,10 @@
|
|||||||
</UTabs>
|
</UTabs>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useEditable } from '@/composable/useConteditable';
|
import { useEditable } from '@/composable/useConteditable';
|
||||||
import Default from '@/layouts/default.vue';
|
|
||||||
import { langs } from '@/router/langs';
|
import { langs } from '@/router/langs';
|
||||||
import { useProductStore } from '@/stores/product';
|
import { useProductStore } from '@/stores/product';
|
||||||
import { useSettingsStore } from '@/stores/admin/settings';
|
import { useSettingsStore } from '@/stores/admin/settings';
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="flex items-center gap-2 mb-4">
|
<div class="flex items-center gap-2 mb-4">
|
||||||
<UIcon name="line-md:arrow-left" class="text-(--text-sky-light) dark:text-(--text-sky-dark)" />
|
<UIcon name="line-md:arrow-left" class="text-(--text-sky-light) dark:text-(--text-sky-dark)" />
|
||||||
<p class="cursor-pointer text-(--text-sky-light) dark:text-(--text-sky-dark)" @click="backFromProduct()">
|
<p class="cursor-pointer text-(--text-sky-light) dark:text-(--text-sky-dark)" @click="backFromProduct()">
|
||||||
@@ -154,11 +153,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class=""></div>
|
<div class=""></div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Default from '@/layouts/default.vue';
|
|
||||||
import { langs } from '@/router/langs';
|
import { langs } from '@/router/langs';
|
||||||
import { useProductStore } from '@/stores/admin/product';
|
import { useProductStore } from '@/stores/admin/product';
|
||||||
import { useSettingsStore } from '@/stores/admin/settings';
|
import { useSettingsStore } from '@/stores/admin/settings';
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="flex flex-col md:flex-row gap-10">
|
<div class="flex flex-col md:flex-row gap-10">
|
||||||
<div class="w-full flex flex-col items-center gap-4">
|
<div class="w-full flex flex-col items-center gap-4">
|
||||||
<UTable :data="usersList" :columns="columns" class="flex-1 w-full"
|
<UTable :data="usersList" :columns="columns" class="flex-1 w-full"
|
||||||
@@ -7,11 +6,9 @@
|
|||||||
<UPagination v-model:page="page" :total="total" :items-per-page="perPage" />
|
<UPagination v-model:page="page" :total="total" :items-per-page="perPage" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
import { ref, computed, watch, resolveComponent, h } from 'vue'
|
import { ref, computed, watch, resolveComponent, h } from 'vue'
|
||||||
import { useFetchJson } from '@/composable/useFetchJson'
|
import { useFetchJson } from '@/composable/useFetchJson'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default">
|
|
||||||
<div class="pt-70! flex flex-col items-center justify-center bg-gray-50 dark:bg-(--main-dark)">
|
<div class="pt-70! flex flex-col items-center justify-center bg-gray-50 dark:bg-(--main-dark)">
|
||||||
<h1 class="text-6xl font-bold text-black dark:text-white mb-14">Search Users</h1>
|
<h1 class="text-6xl font-bold text-black dark:text-white mb-14">Search Users</h1>
|
||||||
|
|
||||||
@@ -18,12 +17,10 @@
|
|||||||
No users found with that name or ID
|
No users found with that name or ID
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, watch, resolveComponent, h } from 'vue'
|
import { ref, computed, watch, resolveComponent, h } from 'vue'
|
||||||
import Default from '@/layouts/default.vue';
|
|
||||||
import type { TableColumn } from '@nuxt/ui';
|
import type { TableColumn } from '@nuxt/ui';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { useFetchJson } from '@/composable/useFetchJson';
|
import { useFetchJson } from '@/composable/useFetchJson';
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Management || 'div'">
|
|
||||||
<div>customer-management</div>
|
<div>customer-management</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Management from '@/layouts/management.vue';
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<h2
|
<h2
|
||||||
class="font-semibold text-black dark:text-white pb-6 text-2xl">
|
class="font-semibold text-black dark:text-white pb-6 text-2xl">
|
||||||
@@ -48,7 +47,6 @@
|
|||||||
</UButton>
|
</UButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -56,7 +54,6 @@ import { useCartStore } from '@/stores/customer/cart'
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
const cartStore = useCartStore()
|
const cartStore = useCartStore()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="flex flex-col gap-5 mb-6">
|
<div class="flex flex-col gap-5 mb-6">
|
||||||
<h1 class="text-2xl font-bold text-black dark:text-white">{{ t('Addresses') }}</h1>
|
<h1 class="text-2xl font-bold text-black dark:text-white">{{ t('Addresses') }}</h1>
|
||||||
@@ -72,8 +71,7 @@
|
|||||||
{{ t('Cancel') }}
|
{{ t('Cancel') }}
|
||||||
</UButton>
|
</UButton>
|
||||||
|
|
||||||
<UButton type="submit"
|
<UButton type="submit" color="info" class="cursor-pointer">
|
||||||
class="text-white bg-(--accent-blue-light) dark:bg-(--accent-blue-dark) hover:bg-(--accent-blue-dark) dark:hover:bg-(--accent-blue-light)">
|
|
||||||
{{ t('Save') }}
|
{{ t('Save') }}
|
||||||
</UButton>
|
</UButton>
|
||||||
</div>
|
</div>
|
||||||
@@ -103,14 +101,12 @@
|
|||||||
</template>
|
</template>
|
||||||
</UModal>
|
</UModal>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, computed, watch, onMounted } from 'vue'
|
import { ref, reactive, computed, watch, onMounted } from 'vue'
|
||||||
import { useCartStore } from '@/stores/customer/cart'
|
import { useCartStore } from '@/stores/customer/cart'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
import { currentCountry } from '@/router/langs'
|
import { currentCountry } from '@/router/langs'
|
||||||
|
|
||||||
type AddressFormState = Record<string, string>
|
type AddressFormState = Record<string, string>
|
||||||
@@ -230,9 +226,9 @@ function validate() {
|
|||||||
|
|
||||||
async function saveAddress() {
|
async function saveAddress() {
|
||||||
if (isEditing.value && editingAddressId.value) {
|
if (isEditing.value && editingAddressId.value) {
|
||||||
await cartStore.updateAddress(editingAddressId.value, currentCountryId.value, formData)
|
await cartStore.updateAddress(editingAddressId.value, currentCountry.value?.id || 2, formData)
|
||||||
} else {
|
} else {
|
||||||
await cartStore.addAddress(currentCountryId.value, formData)
|
await cartStore.addAddress(currentCountry.value?.id || 2, formData)
|
||||||
}
|
}
|
||||||
closeModal()
|
closeModal()
|
||||||
}
|
}
|
||||||
|
|||||||
17
bo/src/components/customer/PageCart.vue
Normal file
17
bo/src/components/customer/PageCart.vue
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<component :is="Default || 'div'">
|
||||||
|
<div class="flex flex-col gap-5 md:gap-10">
|
||||||
|
<h1 class="text-2xl font-bold text-black dark:text-white">
|
||||||
|
Shopping Cart
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</component>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import Default from '@/layouts/default.vue';
|
||||||
|
import { useCartStore } from '@/stores/customer/cart';
|
||||||
|
|
||||||
|
const cartStore =useCartStore()
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="flex flex-col gap-5 md:gap-10">
|
<div class="flex flex-col gap-5 md:gap-10">
|
||||||
<h1 class="text-2xl font-bold text-black dark:text-white">{{ t('Shopping Cart') }}</h1>
|
<h1 class="text-2xl font-bold text-black dark:text-white">{{ t('Shopping Cart') }}</h1>
|
||||||
<div class="flex flex-col lg:flex-row gap-5 md:gap-10">
|
<div class="flex flex-col lg:flex-row gap-5 md:gap-10">
|
||||||
@@ -18,128 +17,61 @@
|
|||||||
<img v-if="item.image" :src="item.image" :alt="item.name" class="w-full h-full object-cover" />
|
<img v-if="item.image" :src="item.image" :alt="item.name" class="w-full h-full object-cover" />
|
||||||
<UIcon v-else name="mdi:package-variant" class="text-2xl text-gray-400" />
|
<UIcon v-else name="mdi:package-variant" class="text-2xl text-gray-400" />
|
||||||
</div>
|
</div>
|
||||||
<p class="text-black dark:text-white text-sm font-medium">{{ item.name }}</p>
|
</div>
|
||||||
<p class="text-black dark:text-white">${{ item.price.toFixed(2) }}</p>
|
|
||||||
<p class="text-black dark:text-white font-medium">${{ (item.price * item.quantity).toFixed(2)
|
|
||||||
}}</p>
|
|
||||||
|
|
||||||
<div class="flex items-center justify-end gap-10">
|
<div class="w-full">
|
||||||
<UInputNumber v-model="item.quantity" :min="1"
|
<div
|
||||||
@update:model-value="(val: number) => cartStore.updateQuantity(item.id, val)" />
|
class="bg-(--second-light) dark:bg-(--main-dark) rounded-lg border border-(--border-light) dark:border-(--border-dark) overflow-hidden">
|
||||||
<div class="flex justify-center">
|
<h2
|
||||||
<button @click="removeItem(item.id)"
|
class="text-lg font-semibold text-black dark:text-white p-4 border-b border-(--border-light) dark:border-(--border-dark)">
|
||||||
class="p-2 text-red-500 bg-red-100 dark:bg-(--main-dark) rounded transition-colors"
|
{{ t('Your Carts') }}
|
||||||
:title="t('Remove')">
|
</h2>
|
||||||
<UIcon name="material-symbols:delete" class="text-[20px]" />
|
<div v-if="cartStore.carts?.length > 0"
|
||||||
</button>
|
class="divide-y divide-(--border-light) dark:divide-(--border-dark)">
|
||||||
|
<div v-for="cart in cartStore.carts" :key="cart.cart_id"
|
||||||
|
@click="cartStore.setActiveCart(cart.cart_id)"
|
||||||
|
class="p-4 cursor-pointer flex gap-2 items-center justify-between" :class="cartStore.activeCartId === cart.cart_id
|
||||||
|
? 'bg-blue-50 dark:bg-blue-900/20'
|
||||||
|
: 'hover:bg-gray-50 dark:hover:bg-gray-800 border-l-4 border-transparent'">
|
||||||
|
<div class="flex-1 min-w-0">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<p class="text-red-600 font-medium truncate">{{ cart.cart_id }}</p>
|
||||||
|
<p class="text-black dark:text-white font-medium truncate cursor-pointer"
|
||||||
|
@click="openCart(cart)">{{
|
||||||
|
cart.name }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<input type="checkbox" :checked="cartStore.activeCartId === cart.cart_id"
|
||||||
|
@change="toggleCart(cart.cart_id)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="p-8 text-center">
|
<div v-else class="p-8 text-center">
|
||||||
<UIcon name="mdi:cart-outline" class="text-6xl text-gray-300 dark:text-gray-600 mb-4" />
|
<UIcon name="mdi:cart-outline" class="text-4xl text-gray-300 dark:text-gray-600 mb-2" />
|
||||||
<p class="text-gray-500 dark:text-gray-400">{{ t('Your cart is empty') }}</p>
|
<p class="text-gray-500 dark:text-gray-400">{{ t('No carts yet') }}</p>
|
||||||
<RouterLink :to="{
|
|
||||||
name: 'customer-product', params: {
|
|
||||||
product_id: '51'
|
|
||||||
}
|
|
||||||
}" class="inline-block mt-4 text-(--text-sky-light) dark:text-(--text-sky-dark) hover:underline">
|
|
||||||
{{ t('Continue Shopping') }}
|
|
||||||
</RouterLink>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="lg:w-80">
|
|
||||||
<div
|
|
||||||
class="bg-(--second-light) dark:bg-(--main-dark) rounded-lg border border-(--border-light) dark:border-(--border-dark) p-6 sticky top-24">
|
|
||||||
<h2 class="text-lg font-semibold text-black dark:text-white mb-4">{{ t('Order Summary') }}</h2>
|
|
||||||
<div class="space-y-3 border-b border-(--border-light) dark:border-(--border-dark) pb-4 mb-4">
|
|
||||||
<div class="flex justify-between">
|
|
||||||
<span class="text-gray-600 dark:text-gray-400">{{ t('Products total') }}</span>
|
|
||||||
<span class="text-black dark:text-white">${{ cartStore.productsTotal.toFixed(2) }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between">
|
|
||||||
<span class="text-gray-600 dark:text-gray-400">{{ t('Shipping') }}</span>
|
|
||||||
<span class="text-black dark:text-white">
|
|
||||||
{{ cartStore.shippingCost > 0 ? `$${cartStore.shippingCost.toFixed(2)}` : t('Free') }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between">
|
|
||||||
<span class="text-gray-600 dark:text-gray-400">{{ t('VAT') }} ({{ (cartStore.vatRate * 100).toFixed(0)
|
|
||||||
}}%)</span>
|
|
||||||
<span class="text-black dark:text-white">${{ cartStore.vatAmount.toFixed(2) }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between mb-6">
|
|
||||||
<span class="text-black dark:text-white font-semibold text-lg">{{ t('Total') }}</span>
|
|
||||||
<span class="text-(--text-sky-light) dark:text-(--text-sky-dark) font-bold text-lg">${{
|
|
||||||
cartStore.orderTotal.toFixed(2) }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-3">
|
|
||||||
<UButton block color="primary" @click="placeOrder" :disabled="!canPlaceOrder"
|
|
||||||
class="bg-(--accent-blue-light) dark:bg-(--accent-blue-dark) text-white hover:bg-(--accent-blue-dark) dark:hover:bg-(--accent-blue-light) disabled:opacity-50 disabled:cursor-not-allowed">
|
|
||||||
{{ t('Place Order') }}
|
|
||||||
</UButton>
|
|
||||||
<UButton block variant="outline" color="neutral" @click="cancelOrder"
|
|
||||||
class="text-black dark:text-white border-(--border-light) dark:border-(--border-dark) hover:bg-gray-100 dark:hover:bg-gray-700">
|
|
||||||
{{ t('Cancel') }}
|
|
||||||
</UButton>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-5 md:gap-10">
|
|
||||||
<div class="flex-1">
|
<UModal v-model:open="showCreateModal">
|
||||||
<div
|
<template #header>
|
||||||
class="bg-(--second-light) dark:bg-(--main-dark) rounded-lg border border-(--border-light) dark:border-(--border-dark) p-6">
|
<h3 class="text-lg font-semibold text-black dark:text-white">{{ t('Create New Cart') }}</h3>
|
||||||
<h2 class="text-lg font-semibold text-black dark:text-white mb-4">{{ t('Select Delivery Address') }}</h2>
|
</template>
|
||||||
<div class="mb-4">
|
<template #body>
|
||||||
<UInput v-model="addressSearchQuery" type="text" :placeholder="t('Search address')"
|
<div class="flex flex-col gap-4">
|
||||||
|
<UInput v-model="newCartName" :placeholder="t('Cart name')"
|
||||||
class="w-full bg-white dark:bg-gray-800 text-black dark:text-white" />
|
class="w-full bg-white dark:bg-gray-800 text-black dark:text-white" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="addressStore.filteredAddresses.length > 0" class="space-y-3">
|
</template>
|
||||||
<label v-for="address in addressStore.filteredAddresses" :key="address.id"
|
<template #footer>
|
||||||
class="flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition-colors" :class="cartStore.selectedAddressId === address.id
|
<div class="flex justify-end gap-2">
|
||||||
? 'border-(--accent-blue-light) dark:border-(--accent-blue-dark) bg-blue-50 dark:bg-blue-900/20'
|
<UButton variant="outline" color="neutral" @click="showCreateModal = false">
|
||||||
: 'border-(--border-light) dark:border-(--border-dark) hover:border-gray-400'">
|
{{ t('Cancel') }}
|
||||||
<input type="radio" :value="address.id" v-model="selectedAddress"
|
</UButton>
|
||||||
class="mt-1 w-4 h-4 text-(--text-sky-light) dark:text-(--text-sky-dark)" />
|
<UButton color="primary" @click="createCart" :disabled="!newCartName.trim()"
|
||||||
<div class="flex-1">
|
class="bg-(--accent-blue-light) dark:bg-(--accent-blue-dark) text-white">
|
||||||
<p class="text-black dark:text-white font-medium">{{ address.street }}</p>
|
{{ t('Create') }}
|
||||||
<p class="text-gray-600 dark:text-gray-400 text-sm">{{ address.zipCode }}, {{ address.city }}</p>
|
</UButton>
|
||||||
<p class="text-gray-600 dark:text-gray-400 text-sm">{{ address.country }}</p>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div v-else class="text-center py-6">
|
|
||||||
<UIcon name="mdi:map-marker-outline" class="text-4xl text-gray-400 mb-2" />
|
|
||||||
<p class="text-gray-500 dark:text-gray-400">{{ t('No addresses found') }}</p>
|
|
||||||
<RouterLink :to="{ name: 'addresses' }"
|
|
||||||
class="inline-block mt-2 text-(--text-sky-light) dark:text-(--text-sky-dark) hover:underline">
|
|
||||||
{{ t('Add Address') }}
|
|
||||||
</RouterLink>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex-1">
|
|
||||||
<div
|
|
||||||
class="bg-(--second-light) dark:bg-(--main-dark) rounded-lg border border-(--border-light) dark:border-(--border-dark) p-6">
|
|
||||||
<h2 class="text-lg font-semibold text-black dark:text-white mb-4">{{ t('Delivery Method') }}</h2>
|
|
||||||
<div class="space-y-3">
|
|
||||||
<label v-for="method in cartStore.deliveryMethods" :key="method.id"
|
|
||||||
class="flex items-center gap-3 p-4 border rounded-lg cursor-pointer transition-colors" :class="cartStore.selectedDeliveryMethodId === method.id
|
|
||||||
? 'border-(--accent-blue-light) dark:border-(--accent-blue-dark) bg-blue-50 dark:bg-blue-900/20'
|
|
||||||
: 'border-(--border-light) dark:border-(--border-dark) hover:border-gray-400'">
|
|
||||||
<input type="radio" :value="method.id" v-model="selectedDeliveryMethod"
|
|
||||||
class="w-4 h-4 text-(--text-sky-light) dark:text-(--text-sky-dark)" />
|
|
||||||
<div class="flex-1">
|
|
||||||
<div class="flex justify-between items-center">
|
|
||||||
<span class="text-black dark:text-white font-medium">{{ method.name }}</span>
|
|
||||||
<span class="text-(--text-sky-light) dark:text-(--text-sky-dark) font-medium">
|
|
||||||
{{ method.price > 0 ? `$${method.price.toFixed(2)}` : t('Free') }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<p class="text-gray-500 dark:text-gray-400 text-sm">{{ method.description }}</p>
|
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -147,58 +79,45 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, watch } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { useCartStore } from '@/stores/customer/cart'
|
import { useCartStore } from '@/stores/customer/cart'
|
||||||
import { useAddressStore } from '@/stores/customer/address'
|
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
const cartStore = useCartStore()
|
const cartStore = useCartStore()
|
||||||
const addressStore = useAddressStore()
|
const addressStore = useAddressStore()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const selectedAddress = ref<number | null>(cartStore.selectedAddressId)
|
const cartStore = useCartStore()
|
||||||
const selectedDeliveryMethod = ref<number | null>(cartStore.selectedDeliveryMethodId)
|
const { t } = useI18n()
|
||||||
const addressSearchQuery = ref('')
|
|
||||||
|
|
||||||
watch(addressSearchQuery, (val) => {
|
const showCreateModal = ref(false)
|
||||||
addressStore.setSearchQuery(val)
|
const newCartName = ref('')
|
||||||
})
|
|
||||||
|
|
||||||
watch(selectedAddress, (newValue) => {
|
async function createCart() {
|
||||||
cartStore.setSelectedAddress(newValue)
|
await cartStore.addNewCart(newCartName.value)
|
||||||
})
|
newCartName.value = ''
|
||||||
|
showCreateModal.value = false
|
||||||
watch(selectedDeliveryMethod, (newValue) => {
|
|
||||||
if (newValue) {
|
|
||||||
cartStore.setDeliveryMethod(newValue)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const canPlaceOrder = computed(() => {
|
|
||||||
return cartStore.items.length > 0 &&
|
|
||||||
cartStore.selectedAddressId !== null &&
|
|
||||||
cartStore.selectedDeliveryMethodId !== null
|
|
||||||
})
|
|
||||||
function removeItem(itemId: number) {
|
|
||||||
cartStore.removeItem(itemId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function placeOrder() {
|
|
||||||
if (canPlaceOrder.value) {
|
onMounted(() => {
|
||||||
console.log('Placing order...')
|
cartStore.fetchCarts()
|
||||||
alert(t('Order placed successfully!'))
|
})
|
||||||
cartStore.clearCart()
|
|
||||||
router.push({ name: 'home' })
|
|
||||||
}
|
function openCart(cart) {
|
||||||
|
router.push({ name: 'customer-cart', params: { id: cart.cart_id } });
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelOrder() {
|
function toggleCart(cartId: number) {
|
||||||
router.back()
|
if (cartStore.activeCartId === cartId) {
|
||||||
|
cartStore.setActiveCart(null)
|
||||||
|
} else {
|
||||||
|
cartStore.setActiveCart(cartId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
Orders page
|
Orders page
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
</script>
|
</script>
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="flex md:flex-row flex-col justify-between gap-8 my-6">
|
<div class="flex md:flex-row flex-col justify-between gap-8 my-6">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
@@ -79,14 +78,12 @@
|
|||||||
<hr class="border-t border-(--border-light) dark:border-(--border-dark) mb-8" />
|
<hr class="border-t border-(--border-light) dark:border-(--border-dark) mb-8" />
|
||||||
<ProductVariants />
|
<ProductVariants />
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import ProductCustomization from './components/ProductCustomization.vue'
|
import ProductCustomization from './components/ProductCustomization.vue'
|
||||||
import ProductVariants from './components/ProductVariants.vue'
|
import ProductVariants from './components/ProductVariants.vue'
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
import { useFetchJson } from '@/composable/useFetchJson'
|
import { useFetchJson } from '@/composable/useFetchJson'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
interface Color {
|
interface Color {
|
||||||
@@ -172,21 +169,21 @@ if (productData.colors.length > 0) {
|
|||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
async function toggleFavorite() {
|
// async function toggleFavorite() {
|
||||||
const url = `/api/v1/restricted/product/favorite/${route.params.product_id}`
|
// const url = `/api/v1/restricted/product/favorite/${route.params.product_id}`
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
if (!productData.is_favorite) {
|
// if (!productData.is_favorite) {
|
||||||
await useFetchJson(url, { method: 'POST' })
|
// await useFetchJson(url, { method: 'POST' })
|
||||||
} else {
|
// } else {
|
||||||
await useFetchJson(url, { method: 'DELETE' })
|
// await useFetchJson(url, { method: 'DELETE' })
|
||||||
}
|
// }
|
||||||
|
|
||||||
productData.is_favorite = !productData.is_favorite
|
// productData.is_favorite = !productData.is_favorite
|
||||||
} catch (e: unknown) {
|
// } catch (e: unknown) {
|
||||||
console.error(e)
|
// console.error(e)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<suspense>
|
<suspense>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<!-- <UNavigationMenu orientation="vertical" :items="listing" class="data-[orientation=vertical]:w-48">
|
<!-- <UNavigationMenu orientation="vertical" :items="listing" class="data-[orientation=vertical]:w-48">
|
||||||
<template #item="{ item, active }">
|
<template #item="{ item, active }">
|
||||||
@@ -39,18 +38,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</suspense>
|
</suspense>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch, h, resolveComponent, computed } from 'vue'
|
import { ref, watch, h, resolveComponent, computed } from 'vue'
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import type { TableColumn } from '@nuxt/ui'
|
import type { TableColumn } from '@nuxt/ui'
|
||||||
import CategoryMenu from '../inner/CategoryMenu.vue'
|
import CategoryMenu from '../inner/CategoryMenu.vue'
|
||||||
import { useCustomerProductStore } from '@/stores/customer/customer-product'
|
import { useCustomerProductStore } from '@/stores/customer/customer-product'
|
||||||
import type { Product } from '@/stores/customer/customer-product'
|
import type { Product } from '@/stores/customer/customer-product'
|
||||||
|
import { useCartStore } from '@/stores/customer/cart'
|
||||||
|
import { useToast } from '@nuxt/ui/runtime/composables/useToast.js'
|
||||||
|
|
||||||
|
|
||||||
const customerProductStore = useCustomerProductStore()
|
const customerProductStore = useCustomerProductStore()
|
||||||
@@ -310,10 +309,9 @@ const columns: TableColumn<Product>[] = [
|
|||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
return h(UButton, {
|
return h(UButton, {
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
console.log('Clicked', row.original)
|
addToCart(row.original.product_id)
|
||||||
},
|
},
|
||||||
color: selectedCount.value.product_id !== row.original.product_id ? 'info' : 'primary',
|
color: selectedCount.value.product_id !== row.original.product_id ? 'info' : 'primary',
|
||||||
disabled: selectedCount.value.product_id !== row.original.product_id,
|
|
||||||
variant: 'solid'
|
variant: 'solid'
|
||||||
}, 'Add to cart')
|
}, 'Add to cart')
|
||||||
},
|
},
|
||||||
@@ -349,7 +347,7 @@ const columns: TableColumn<Product>[] = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const columnsChild: TableColumn<Payment>[] = [
|
const columnsChild: TableColumn<Product>[] = [
|
||||||
{
|
{
|
||||||
accessorKey: 'product_id',
|
accessorKey: 'product_id',
|
||||||
header: '',
|
header: '',
|
||||||
@@ -405,7 +403,7 @@ const columnsChild: TableColumn<Payment>[] = [
|
|||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
return h(UButton, {
|
return h(UButton, {
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
console.log('Clicked', row.original)
|
addToCart(row.original.product_id)
|
||||||
},
|
},
|
||||||
color: selectedCount.value.product_id !== row.original.product_id ? 'info' : 'primary',
|
color: selectedCount.value.product_id !== row.original.product_id ? 'info' : 'primary',
|
||||||
disabled: selectedCount.value.product_id !== row.original.product_id,
|
disabled: selectedCount.value.product_id !== row.original.product_id,
|
||||||
@@ -426,9 +424,47 @@ const columnsChild: TableColumn<Payment>[] = [
|
|||||||
variant: 'soft'
|
variant: 'soft'
|
||||||
}, () => 'Show product')
|
}, () => 'Show product')
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'counta',
|
||||||
|
header: '',
|
||||||
|
cell: ({ row }) => {
|
||||||
|
return h(UIcon, {
|
||||||
|
onClick: () => customerProductStore.toggleFavorite(row.original),
|
||||||
|
class: [
|
||||||
|
'cursor-pointer text-[20px] transition-transform duration-200 hover:scale-125',
|
||||||
|
row.original.is_favorite ? 'text-red-500' : 'text-blue-500'
|
||||||
|
],
|
||||||
|
name: 'material-symbols:favorite',
|
||||||
|
variant: 'soft',
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const cartStore = useCartStore()
|
||||||
|
const toast = useToast()
|
||||||
|
async function addToCart(product_id: number) {
|
||||||
|
if (!cartStore.activeCartId) {
|
||||||
|
toast.add({
|
||||||
|
title: "No cart selected",
|
||||||
|
description: "Please select a cart before adding products",
|
||||||
|
icon: "i-heroicons-exclamation-triangle",
|
||||||
|
duration: 5000
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const count = selectedCount.value.count || 1
|
||||||
|
await cartStore.addProduct(product_id, count)
|
||||||
|
|
||||||
|
toast.add({
|
||||||
|
title: "Product added to cart",
|
||||||
|
description: `Quantity: ${count}`,
|
||||||
|
icon: "i-heroicons-check-circle",
|
||||||
|
duration: 5000
|
||||||
|
})
|
||||||
|
}
|
||||||
watch(
|
watch(
|
||||||
() => route.query,
|
() => route.query,
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="flex flex-col gap-5 mb-6">
|
<div class="flex flex-col gap-5 mb-6">
|
||||||
<h1 class="text-2xl font-bold text-black dark:text-white">{{ t('Customer Data') }}</h1>
|
<h1 class="text-2xl font-bold text-black dark:text-white">{{ t('Customer Data') }}</h1>
|
||||||
@@ -97,7 +96,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -106,7 +104,6 @@ import { useRouter } from 'vue-router'
|
|||||||
import { useCustomerStore } from '@/stores/customer'
|
import { useCustomerStore } from '@/stores/customer'
|
||||||
import { useAddressStore } from '@/stores/customer/address'
|
import { useAddressStore } from '@/stores/customer/address'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const customerStore = useCustomerStore()
|
const customerStore = useCustomerStore()
|
||||||
const addressStore = useAddressStore()
|
const addressStore = useAddressStore()
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="max-w-2xl mx-auto">
|
<div class="max-w-2xl mx-auto">
|
||||||
<div class="flex flex-col gap-5 mb-6">
|
<div class="flex flex-col gap-5 mb-6">
|
||||||
@@ -109,7 +108,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -119,7 +117,6 @@ import { useCustomerStore } from '@/stores/customer'
|
|||||||
import { useAddressStore } from '@/stores/customer/address'
|
import { useAddressStore } from '@/stores/customer/address'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useCartStore } from '@/stores/customer/cart'
|
import { useCartStore } from '@/stores/customer/cart'
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const customerStore = useCustomerStore()
|
const customerStore = useCustomerStore()
|
||||||
const addressStore = useAddressStore()
|
const addressStore = useAddressStore()
|
||||||
|
|||||||
180
bo/src/components/customer/PageSearchProducts.vue
Normal file
180
bo/src/components/customer/PageSearchProducts.vue
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
<template>
|
||||||
|
<component :is="Default">
|
||||||
|
<div class="pt-70! flex flex-col items-center justify-center bg-gray-50 dark:bg-(--main-dark)">
|
||||||
|
<h1 class="text-6xl font-bold text-black dark:text-white mb-14">Search Products</h1>
|
||||||
|
|
||||||
|
<div class="w-full max-w-4xl">
|
||||||
|
<UInput icon="i-lucide-search" type="text" placeholder="Type product name or ID..."
|
||||||
|
v-model="searchQuery" class="w-full!" :ui="{ base: 'py-4! rounded-full!' }" />
|
||||||
|
</div>
|
||||||
|
<div v-if="products.length" class="mt-6">
|
||||||
|
<UTable :data="products" :columns="columns" class="flex-1 w-full" :ui="{
|
||||||
|
root: 'max-w-100wv overflow-auto!'
|
||||||
|
}" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p v-else-if="searchQuery">
|
||||||
|
No products found
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</component>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useFetchJson } from '@/composable/useFetchJson';
|
||||||
|
import Default from '@/layouts/default.vue';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
const searchQuery = ref('')
|
||||||
|
const products = ref([])
|
||||||
|
const loading = ref(false)
|
||||||
|
const error = ref<string | null>(null)
|
||||||
|
|
||||||
|
async function fetchProducts() {
|
||||||
|
loading.value = true
|
||||||
|
error.value = null
|
||||||
|
|
||||||
|
try {
|
||||||
|
const query = searchQuery.value
|
||||||
|
? `name=~${searchQuery.value}`
|
||||||
|
: ''
|
||||||
|
|
||||||
|
const result = await useFetchJson(
|
||||||
|
`/api/v1/restricted/list-products/get-listing?${query}`
|
||||||
|
)
|
||||||
|
|
||||||
|
products.value = result.items || result
|
||||||
|
} catch (e) {
|
||||||
|
error.value = 'Failed to load products'
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
watch(searchQuery, () => {
|
||||||
|
fetchProducts()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
import errorImg from '@/assets/error.svg'
|
||||||
|
import type { TableColumn } from '@nuxt/ui';
|
||||||
|
import type { Product } from '@/types/product';
|
||||||
|
// const columns: TableColumn<Product>[] = [
|
||||||
|
// {
|
||||||
|
// accessorKey: 'product_id',
|
||||||
|
// header: ({ column }) => {
|
||||||
|
// return h('div', { class: 'flex flex-col gap-1' }, [
|
||||||
|
// h('div', {
|
||||||
|
// class: 'flex items-center gap-2 cursor-pointer',
|
||||||
|
// onClick: () => {
|
||||||
|
// sortField.value = ['product_id', 'asc']
|
||||||
|
// }
|
||||||
|
// }, [
|
||||||
|
// h('span', 'ID'),
|
||||||
|
// h(UIcon, {
|
||||||
|
// name: getIcon('product_id')
|
||||||
|
// })
|
||||||
|
// ]),
|
||||||
|
|
||||||
|
// h(UInput, {
|
||||||
|
// placeholder: 'Search...',
|
||||||
|
// modelValue: filters.value[column.id] ?? '',
|
||||||
|
// 'onUpdate:modelValue': (val: string) => {
|
||||||
|
// updateFilter(column.id, val)
|
||||||
|
// },
|
||||||
|
// size: 'xs'
|
||||||
|
// })
|
||||||
|
// ])
|
||||||
|
// },
|
||||||
|
// // header: '#',
|
||||||
|
// cell: ({ row }) => `#${row.getValue('product_id') as number}`
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// accessorKey: 'image_link',
|
||||||
|
// header: 'Image',
|
||||||
|
// cell: ({ row }) => {
|
||||||
|
// return h('img', {
|
||||||
|
// src: row.getValue('image_link') as string,
|
||||||
|
// style: 'width:40px;height:40px;object-fit:cover;',
|
||||||
|
// onError: (e: Event) => {
|
||||||
|
// const target = e.target as HTMLImageElement
|
||||||
|
// target.src = errorImg
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// accessorKey: 'name',
|
||||||
|
// header: ({ column }) => {
|
||||||
|
// return h('div', { class: 'flex flex-col gap-1' }, [
|
||||||
|
// h('div', {
|
||||||
|
// class: 'flex items-center gap-2 cursor-pointer',
|
||||||
|
// onClick: () => {
|
||||||
|
// sortField.value = ['name', 'asc']
|
||||||
|
// }
|
||||||
|
// }, [
|
||||||
|
// h('span', 'Name'),
|
||||||
|
// h(UIcon, {
|
||||||
|
// name: getIcon('name')
|
||||||
|
// })
|
||||||
|
// ]),
|
||||||
|
|
||||||
|
// h(UInput, {
|
||||||
|
// placeholder: 'Search...',
|
||||||
|
// modelValue: filters.value[column.id] ?? '',
|
||||||
|
// 'onUpdate:modelValue': (val: string) => {
|
||||||
|
// updateFilter(column.id, val)
|
||||||
|
// },
|
||||||
|
// size: 'xs'
|
||||||
|
// })
|
||||||
|
// ])
|
||||||
|
// },
|
||||||
|
// cell: ({ row }) => row.getValue('name') as string,
|
||||||
|
// filterFn: (row, columnId, value) => {
|
||||||
|
// const name = row.getValue(columnId) as string
|
||||||
|
// return name.toLowerCase().includes(value.toLowerCase())
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// accessorKey: 'quantity',
|
||||||
|
// header: ({ }) => {
|
||||||
|
// return h('div', { class: 'flex flex-col gap-1' }, [
|
||||||
|
// h('div', {
|
||||||
|
// class: 'flex items-center gap-2 cursor-pointer',
|
||||||
|
// onClick: () => {
|
||||||
|
// sortField.value = ['quantity', 'asc']
|
||||||
|
// }
|
||||||
|
// }, [
|
||||||
|
// h('span', 'In stock'),
|
||||||
|
// h(UIcon, {
|
||||||
|
// name: getIcon('quantity')
|
||||||
|
// })
|
||||||
|
// ]),
|
||||||
|
// ])
|
||||||
|
// },
|
||||||
|
// cell: ({ row }) => row.getValue('quantity') as number
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// accessorKey: 'count',
|
||||||
|
// header: '',
|
||||||
|
// cell: ({ row }) => {
|
||||||
|
// return h(UButton, {
|
||||||
|
// onClick: () => {
|
||||||
|
// goToProduct(row.original.product_id, row.original.link_rewrite)
|
||||||
|
// },
|
||||||
|
// class: 'cursor-pointer',
|
||||||
|
// color: 'info',
|
||||||
|
// variant: 'soft'
|
||||||
|
// }, () => 'Show product')
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
input::placeholder {
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
Statistic page
|
Statistic page
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
</script>
|
</script>
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<div v-if="loading" class="flex justify-center py-8">
|
<div v-if="loading" class="flex justify-center py-8">
|
||||||
<ULoader />
|
<ULoader />
|
||||||
@@ -25,13 +24,11 @@
|
|||||||
</template>
|
</template>
|
||||||
</UTree>
|
</UTree>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { useFetchJson } from '@/composable/useFetchJson'
|
import { useFetchJson } from '@/composable/useFetchJson'
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
|
|
||||||
interface FileItemRaw {
|
interface FileItemRaw {
|
||||||
Name: string
|
Name: string
|
||||||
|
|||||||
@@ -34,11 +34,34 @@
|
|||||||
|
|
||||||
<div class="flex-1 flex flex-col">
|
<div class="flex-1 flex flex-col">
|
||||||
<div class="flex h-(--ui-header-height) shrink-0 items-center justify-between px-4 border-b border-default">
|
<div class="flex h-(--ui-header-height) shrink-0 items-center justify-between px-4 border-b border-default">
|
||||||
|
<div class="flex items-center gap-5">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<UButton icon="i-lucide-panel-left" color="neutral" variant="ghost" aria-label="Toggle sidebar"
|
<UButton icon="i-lucide-panel-left" color="neutral" variant="ghost" aria-label="Toggle sidebar"
|
||||||
@click="open = !open" />
|
@click="open = !open" />
|
||||||
<span class="text-[20px] font-medium">{{ pageTitle }}</span>
|
<span class="text-[20px] font-medium">{{ pageTitle }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<div v-if="cartStore.activeCart"
|
||||||
|
class="flex items-center gap-2 p-1 rounded-md bg-gray-100 dark:bg-gray-800">
|
||||||
|
<UIcon name="i-lucide-shopping-cart" />
|
||||||
|
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<p class="text-sm font-medium">
|
||||||
|
{{ cartStore.activeCart.name }}-
|
||||||
|
<span class="text-xs text-gray-400">
|
||||||
|
ID: {{ cartStore.activeCart.cart_id }}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span v-else class="text-sm text-red-400 flex gap-1 items-center">
|
||||||
|
<UIcon name="i-lucide-shopping-cart" />
|
||||||
|
No cart selected
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="hidden md:flex items-center gap-12">
|
<div class="hidden md:flex items-center gap-12">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
@@ -172,6 +195,7 @@ import LangSwitch from '@/components/inner/LangSwitch.vue'
|
|||||||
import ThemeSwitch from '@/components/inner/ThemeSwitch.vue'
|
import ThemeSwitch from '@/components/inner/ThemeSwitch.vue'
|
||||||
import type { LabelTrans, TopMenuItem } from '@/types'
|
import type { LabelTrans, TopMenuItem } from '@/types'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import { useCartStore } from '@/stores/customer/cart'
|
||||||
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -297,5 +321,11 @@ const userItems = computed<DropdownMenuItem[][]>(() => [
|
|||||||
]
|
]
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const cartStore = useCartStore()
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
cartStore.initCart()
|
||||||
|
})
|
||||||
|
|
||||||
defineShortcuts(extractShortcuts(teamsItems.value))
|
defineShortcuts(extractShortcuts(teamsItems.value))
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ const router = useRouter()
|
|||||||
const menu = ref<TopMenuItem[] | null>(null)
|
const menu = ref<TopMenuItem[] | null>(null)
|
||||||
|
|
||||||
const Id = Number(route.params.user_id)
|
const Id = Number(route.params.user_id)
|
||||||
|
|
||||||
async function cmGetTopMenu() {
|
async function cmGetTopMenu() {
|
||||||
try {
|
try {
|
||||||
const { items } = await useFetchJson<TopMenuItem[]>(`/api/v1/restricted/menu/get-top-menu?target_user_id=${Id}`)
|
const { items } = await useFetchJson<TopMenuItem[]>(`/api/v1/restricted/menu/get-top-menu?target_user_id=${Id}`)
|
||||||
@@ -191,7 +190,6 @@ async function cmGetTopMenu() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(route)
|
|
||||||
watch(
|
watch(
|
||||||
() => route.params.user_id,
|
() => route.params.user_id,
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@@ -13,13 +13,30 @@ await getSettings()
|
|||||||
|
|
||||||
const routes = await getRoutes()
|
const routes = await getRoutes()
|
||||||
let newRoutes = []
|
let newRoutes = []
|
||||||
|
|
||||||
|
function getLayoutFromComponent(path: string) {
|
||||||
|
const emptyLayouts = [
|
||||||
|
'LoginView.vue',
|
||||||
|
'RegisterView.vue',
|
||||||
|
'PasswordRecoveryView.vue',
|
||||||
|
'VerifyEmailView.vue',
|
||||||
|
'ResetPasswordForm.vue'
|
||||||
|
]
|
||||||
|
return emptyLayouts.some((name) => path.includes(name)) ? 'empty' : 'default'
|
||||||
|
}
|
||||||
|
|
||||||
for (let r of routes) {
|
for (let r of routes) {
|
||||||
const component = () => import(/* @vite-ignore */ `..${r.component}`)
|
const component = () => import(/* @vite-ignore */ `..${r.component}`)
|
||||||
|
const parsedMeta = r.meta ? JSON.parse(r.meta) : {}
|
||||||
|
const layout = parsedMeta.layout ?? getLayoutFromComponent(r.component)
|
||||||
newRoutes.push({
|
newRoutes.push({
|
||||||
path: r.path,
|
path: r.path,
|
||||||
component,
|
component,
|
||||||
name: r.name,
|
name: r.name,
|
||||||
meta: r.meta ? JSON.parse(r.meta) : {},
|
meta: {
|
||||||
|
...parsedMeta,
|
||||||
|
layout,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,15 +90,21 @@ async function setRoutes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const importedComponent = (await importer()).default
|
const importedComponent = (await importer()).default
|
||||||
|
const parsedMeta = item.meta ? JSON.parse(item.meta) : {}
|
||||||
|
const layout = parsedMeta.layout ?? getLayoutFromComponent(item.component)
|
||||||
|
|
||||||
router.addRoute('locale', {
|
router.addRoute('locale', {
|
||||||
path: item.path,
|
path: item.path,
|
||||||
component: importedComponent,
|
component: importedComponent,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
meta: item.meta ? JSON.parse(item.meta) : {}
|
meta: {
|
||||||
|
...parsedMeta,
|
||||||
|
layout,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(router);
|
||||||
// await router.replace(router.currentRoute.value.fullPath)
|
// await router.replace(router.currentRoute.value.fullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,21 +2,10 @@ import { defineStore } from 'pinia'
|
|||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { useFetchJson } from '@/composable/useFetchJson'
|
import { useFetchJson } from '@/composable/useFetchJson'
|
||||||
|
|
||||||
export interface CartItem {
|
export interface Cart {
|
||||||
id: number
|
|
||||||
productId: number
|
|
||||||
name: string
|
|
||||||
image: string
|
|
||||||
price: number
|
|
||||||
quantity: number
|
|
||||||
product_number: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DeliveryMethod {
|
|
||||||
id: number
|
id: number
|
||||||
name: string
|
name: string
|
||||||
price: number
|
items: any[]
|
||||||
description: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Address {
|
export interface Address {
|
||||||
@@ -29,17 +18,9 @@ export interface Address {
|
|||||||
export type AddressTemplate = Record<string, string>
|
export type AddressTemplate = Record<string, string>
|
||||||
|
|
||||||
export const useCartStore = defineStore('cart', () => {
|
export const useCartStore = defineStore('cart', () => {
|
||||||
const items = ref<CartItem[]>([])
|
const carts = ref<Cart[]>([])
|
||||||
const selectedAddressId = ref<number | null>(null)
|
const activeCartId = ref<number | null>(null)
|
||||||
const selectedDeliveryMethodId = ref<number | null>(null)
|
const error = ref<string | null>(null)
|
||||||
const shippingCost = ref(0)
|
|
||||||
const vatRate = ref(0.23) // 23% VAT
|
|
||||||
const currentPage = ref(1)
|
|
||||||
const deliveryMethods = ref<DeliveryMethod[]>([
|
|
||||||
{ id: 1, name: 'Standard Delivery', price: 0, description: '5-7 business days' },
|
|
||||||
{ id: 2, name: 'Express Delivery', price: 15, description: '2-3 business days' },
|
|
||||||
{ id: 3, name: 'Priority Delivery', price: 30, description: 'Next business day' }
|
|
||||||
])
|
|
||||||
|
|
||||||
const addresses = ref<Address[]>([])
|
const addresses = ref<Address[]>([])
|
||||||
const addressLoading = ref(false)
|
const addressLoading = ref(false)
|
||||||
@@ -165,74 +146,70 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
const productsTotal = computed(() => {
|
async function addNewCart(name: string) {
|
||||||
return items.value.reduce((sum, item) => sum + (item.price * item.quantity), 0)
|
try {
|
||||||
})
|
error.value = null
|
||||||
|
|
||||||
const vatAmount = computed(() => {
|
const url = `/api/v1/restricted/carts/add-new-cart`
|
||||||
return productsTotal.value * vatRate.value
|
const response = await useFetchJson<ApiResponse>(url)
|
||||||
})
|
|
||||||
|
|
||||||
const orderTotal = computed(() => {
|
const newCart: Cart = {
|
||||||
return productsTotal.value + shippingCost.value + vatAmount.value
|
id: response.items.cart_id,
|
||||||
})
|
name: response.items.name,
|
||||||
|
items: []
|
||||||
|
}
|
||||||
|
|
||||||
const itemCount = computed(() => {
|
carts.value.push(newCart)
|
||||||
return items.value.reduce((sum, item) => sum + item.quantity, 0)
|
activeCartId.value = newCart.id
|
||||||
})
|
|
||||||
|
|
||||||
function updateQuantity(itemId: number, quantity: number) {
|
return newCart
|
||||||
const item = items.value.find(i => i.id === itemId)
|
} catch (e: any) {
|
||||||
if (item) {
|
error.value = e?.message ?? 'Error creating cart'
|
||||||
if (quantity <= 0) {
|
}
|
||||||
removeItem(itemId)
|
}
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const amount = ref<number>(1);
|
||||||
|
const errorMessage = ref('');
|
||||||
|
|
||||||
|
async function addProduct(product_id: number, count: number) {
|
||||||
|
if (!activeCartId.value) {
|
||||||
|
errorMessage.value = 'No active cart selected'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await useFetchJson<ApiResponse>(
|
||||||
|
`/api/v1/restricted/carts/add-product-to-cart?cart_id=${activeCartId.value}&product_id=${product_id}&amount=${count}`
|
||||||
|
)
|
||||||
|
|
||||||
|
console.log('fsdfsdfdsfdsfs', res)
|
||||||
|
} catch (e: any) {
|
||||||
|
errorMessage.value = e?.message ?? 'Error adding product'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setActiveCart(id: number | null) {
|
||||||
|
activeCartId.value = id
|
||||||
|
|
||||||
|
if (id) {
|
||||||
|
localStorage.setItem('activeCartId', String(id))
|
||||||
} else {
|
} else {
|
||||||
item.quantity = quantity
|
localStorage.removeItem('activeCartId')
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
items.value.splice(index, 1)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearCart() {
|
function initCart() {
|
||||||
items.value = []
|
const saved = localStorage.getItem('activeCartId')
|
||||||
selectedAddressId.value = null
|
|
||||||
selectedDeliveryMethodId.value = null
|
|
||||||
shippingCost.value = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function setSelectedAddress(addressId: number | null) {
|
if (saved) {
|
||||||
selectedAddressId.value = addressId
|
activeCartId.value = Number(saved)
|
||||||
}
|
|
||||||
|
|
||||||
function setDeliveryMethod(methodId: number) {
|
|
||||||
selectedDeliveryMethodId.value = methodId
|
|
||||||
const method = deliveryMethods.value.find(m => m.id === methodId)
|
|
||||||
if (method) {
|
|
||||||
shippingCost.value = method.price
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initMockData()
|
const activeCart = computed(() => {
|
||||||
|
return carts.value.find(c => c.cart_id === activeCartId.value)
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
items,
|
items,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export interface Product {
|
|||||||
productDetails?: string
|
productDetails?: string
|
||||||
product_id: number
|
product_id: number
|
||||||
is_favorite?: boolean
|
is_favorite?: boolean
|
||||||
|
quantity: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductResponse {
|
export interface ProductResponse {
|
||||||
@@ -56,6 +57,11 @@ export const useCustomerProductStore = defineStore('customer-product', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateFavoriteState(product_id: number, value: boolean) {
|
||||||
|
const p = productsList.value.find(p => p.product_id === product_id)
|
||||||
|
if (p) p.is_favorite = value
|
||||||
|
}
|
||||||
|
|
||||||
async function toggleFavorite(product: Product) {
|
async function toggleFavorite(product: Product) {
|
||||||
const productId = product.product_id
|
const productId = product.product_id
|
||||||
const isFavorite = product.is_favorite
|
const isFavorite = product.is_favorite
|
||||||
@@ -64,11 +70,19 @@ export const useCustomerProductStore = defineStore('customer-product', () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (!isFavorite) {
|
if (!isFavorite) {
|
||||||
await useFetchJson(url, { method: 'POST' })
|
await useFetchJson(url, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({
|
||||||
|
id: productId
|
||||||
|
}),
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
await useFetchJson(url, { method: 'DELETE' })
|
await useFetchJson(url, {
|
||||||
|
method: 'DELETE',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
product.is_favorite = !isFavorite
|
|
||||||
|
product.is_favorite = !product.is_favorite
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
error.value = e instanceof Error ? e.message : 'Failed to update favorite'
|
error.value = e instanceof Error ? e.message : 'Failed to update favorite'
|
||||||
}
|
}
|
||||||
@@ -77,6 +91,7 @@ export const useCustomerProductStore = defineStore('customer-product', () => {
|
|||||||
return {
|
return {
|
||||||
fetchProductList,
|
fetchProductList,
|
||||||
toggleFavorite,
|
toggleFavorite,
|
||||||
|
updateFavoriteState,
|
||||||
productsList,
|
productsList,
|
||||||
total,
|
total,
|
||||||
loading,
|
loading,
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
<template>
|
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="container mt-24">
|
|
||||||
<div class="row">
|
|
||||||
<!-- <div class="col-12">
|
|
||||||
<h2 class="text-2xl">Category ID: {{ $route.params.category_id }}</h2>
|
|
||||||
<div v-for="(p, i) in products" :key="i">
|
|
||||||
<p>
|
|
||||||
<span class="border-b-1 bg-red-100 px-4">{{ p.name }}</span>
|
|
||||||
<span class="border-b-1 bg-red-100 px-4">{{ p.price }}</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</component>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// import { useRoute } from 'vue-router';
|
|
||||||
import Default from '@/layouts/default.vue';
|
|
||||||
import { useCategoryStore } from '@/stores/admin/category';
|
|
||||||
import { ref, watch } from 'vue';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
// const route = useRoute()
|
|
||||||
// console.log(route);
|
|
||||||
|
|
||||||
const categoryStore = useCategoryStore()
|
|
||||||
const route = useRoute()
|
|
||||||
|
|
||||||
const products = ref([])
|
|
||||||
|
|
||||||
watch(() => route.params, async (n) => {
|
|
||||||
categoryStore.setCategoryID(parseInt(n.category_id as string))
|
|
||||||
const res = await categoryStore.getCategoryProducts()
|
|
||||||
// products.value = res
|
|
||||||
|
|
||||||
}, { immediate: true })
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
home View
|
home View
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Default from '@/layouts/default.vue';
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -15,7 +15,6 @@ import { useAuthStore } from '@/stores/customer/auth'
|
|||||||
import { i18n } from '@/plugins/02_i18n'
|
import { i18n } from '@/plugins/02_i18n'
|
||||||
import type { TableColumn } from '@nuxt/ui'
|
import type { TableColumn } from '@nuxt/ui'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
|
|
||||||
ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale)
|
ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale)
|
||||||
|
|
||||||
@@ -182,7 +181,6 @@ const columns = computed<TableColumn<IssueTimeSummary>[]>(() => [
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<component :is="Default || 'div'">
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="p-6 bg-(--main-light) dark:bg-(--black) font-sans">
|
<div class="p-6 bg-(--main-light) dark:bg-(--black) font-sans">
|
||||||
<h1 class="text-2xl font-bold mb-6 text-black dark:text-white">{{ $t('repo_chart.repository_work_chart') }}
|
<h1 class="text-2xl font-bold mb-6 text-black dark:text-white">{{ $t('repo_chart.repository_work_chart') }}
|
||||||
@@ -256,5 +254,4 @@ const columns = computed<TableColumn<IssueTimeSummary>[]>(() => [
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
@@ -7,6 +7,5 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Default from '@/layouts/default.vue'
|
|
||||||
import StorageFileBrowser from '@/components/customer/StorageFileBrowser.vue'
|
import StorageFileBrowser from '@/components/customer/StorageFileBrowser.vue'
|
||||||
</script>
|
</script>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
info:
|
info:
|
||||||
name: add-product-to-cart (1)
|
name: add-product-to-cart (1)
|
||||||
type: http
|
type: http
|
||||||
seq: 1
|
seq: 2
|
||||||
|
|
||||||
http:
|
http:
|
||||||
method: GET
|
method: GET
|
||||||
url: http://localhost:3000/api/v1/restricted/carts/add-product-to-cart?cart_id=1&product_id=51&amount=1
|
url: http://localhost:3000/api/v1/restricted/carts/add-product-to-cart?cart_id=1&product_id=51&amount=1&set_amount=false
|
||||||
params:
|
params:
|
||||||
- name: cart_id
|
- name: cart_id
|
||||||
value: "1"
|
value: "1"
|
||||||
@@ -16,6 +16,9 @@ http:
|
|||||||
- name: amount
|
- name: amount
|
||||||
value: "1"
|
value: "1"
|
||||||
type: query
|
type: query
|
||||||
|
- name: set_amount
|
||||||
|
value: "false"
|
||||||
|
type: query
|
||||||
auth: inherit
|
auth: inherit
|
||||||
|
|
||||||
settings:
|
settings:
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
info:
|
info:
|
||||||
name: add-product-to-cart
|
name: add-product-to-cart
|
||||||
type: http
|
type: http
|
||||||
seq: 14
|
seq: 6
|
||||||
|
|
||||||
http:
|
http:
|
||||||
method: GET
|
method: GET
|
||||||
url: http://localhost:3000/api/v1/restricted/carts/add-product-to-cart?cart_id=1&product_id=51&product_attribute_id=1115&amount=1
|
url: http://localhost:3000/api/v1/restricted/carts/add-product-to-cart?cart_id=1&product_id=51&product_attribute_id=1115&amount=1&set_amount=true
|
||||||
params:
|
params:
|
||||||
- name: cart_id
|
- name: cart_id
|
||||||
value: "1"
|
value: "1"
|
||||||
@@ -19,6 +19,9 @@ http:
|
|||||||
- name: amount
|
- name: amount
|
||||||
value: "1"
|
value: "1"
|
||||||
type: query
|
type: query
|
||||||
|
- name: set_amount
|
||||||
|
value: "true"
|
||||||
|
type: query
|
||||||
auth: inherit
|
auth: inherit
|
||||||
|
|
||||||
settings:
|
settings:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
info:
|
info:
|
||||||
name: change-cart-name
|
name: change-cart-name
|
||||||
type: http
|
type: http
|
||||||
seq: 1
|
seq: 3
|
||||||
|
|
||||||
http:
|
http:
|
||||||
method: GET
|
method: GET
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
info:
|
info:
|
||||||
name: retrieve-cart
|
name: retrieve-cart
|
||||||
type: http
|
type: http
|
||||||
seq: 1
|
seq: 4
|
||||||
|
|
||||||
http:
|
http:
|
||||||
method: GET
|
method: GET
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
info:
|
info:
|
||||||
name: retrieve-carts-info
|
name: retrieve-carts-info
|
||||||
type: http
|
type: http
|
||||||
seq: 1
|
seq: 5
|
||||||
|
|
||||||
http:
|
http:
|
||||||
method: GET
|
method: GET
|
||||||
|
|||||||
@@ -10,17 +10,6 @@ CREATE TABLE IF NOT EXISTS b2b_routes (
|
|||||||
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
-- INSERT IGNORE INTO b2b_routes
|
|
||||||
-- (name, path, component, meta, active)
|
|
||||||
-- VALUES
|
|
||||||
-- ('root', '', '', '{"trans": "route.root"}', 0),
|
|
||||||
-- ('home', '', '/views/HomeView.vue', '{"trans": "route.home"}', 1),
|
|
||||||
-- ('login', 'login', '/views/LoginView.vue', '{"guest":true}', 1),
|
|
||||||
-- ('register', 'register', '/views/RegisterView.vue', '{"guest":true}', 1),
|
|
||||||
-- ('password-recovery', 'password-recovery', '/views/PasswordRecoveryView.vue', '{"guest":true}', 1),
|
|
||||||
-- ('reset-password', 'reset-password', '/views/ResetPasswordView.vue', '{"guest":true}', 1),
|
|
||||||
-- ('verify-email', 'verify-email', '/views/VerifyEmailView.vue', '{"guest":true}', 1);
|
|
||||||
|
|
||||||
INSERT IGNORE INTO `b2b_routes` (`id`, `name`, `path`, `component`, `meta`, `active`) VALUES
|
INSERT IGNORE INTO `b2b_routes` (`id`, `name`, `path`, `component`, `meta`, `active`) VALUES
|
||||||
(1, 'root', '', '', '{"trans": "route.root"}', 0),
|
(1, 'root', '', '', '{"trans": "route.root"}', 0),
|
||||||
(2, 'home', '', '/views/HomeView.vue', '{"trans": "route.home"}', 1),
|
(2, 'home', '', '/views/HomeView.vue', '{"trans": "route.home"}', 1),
|
||||||
@@ -29,16 +18,59 @@ INSERT IGNORE INTO `b2b_routes` (`id`, `name`, `path`, `component`, `meta`, `act
|
|||||||
(5, 'password-recovery', 'password-recovery', '/views/PasswordRecoveryView.vue', '{"guest":true}', 1),
|
(5, 'password-recovery', 'password-recovery', '/views/PasswordRecoveryView.vue', '{"guest":true}', 1),
|
||||||
(6, 'reset-password', 'reset-password', '/views/ResetPasswordForm.vue', '{"guest":true}', 1),
|
(6, 'reset-password', 'reset-password', '/views/ResetPasswordForm.vue', '{"guest":true}', 1),
|
||||||
(7, 'verify-email', 'verify-email', '/views/VerifyEmailView.vue', '{"guest":true}', 1),
|
(7, 'verify-email', 'verify-email', '/views/VerifyEmailView.vue', '{"guest":true}', 1),
|
||||||
(8, 'category', 'category/:category_id-:link_rewrite', '/views/CategoryView.vue', '{"guest":true}', 1),
|
|
||||||
(9, 'admin-products-category', 'products/:category_id-:link_rewrite', '/components/admin/PageProducts.vue', '{
|
(9, 'admin-products-category', 'products/:category_id-:link_rewrite', '/components/admin/PageProducts.vue', '{
|
||||||
"guest": true
|
"guest":true,
|
||||||
|
"name": "Products Category"
|
||||||
}', 1),
|
}', 1),
|
||||||
(10, 'customer-addresses', 'addresses', '/components/customer/PageAddresses.vue', '{"guest":true}', 1),
|
(10, 'customer-addresses', 'addresses', '/components/customer/PageAddresses.vue', '{
|
||||||
(11, 'customer-carts', 'carts', '/components/customer/PageCarts.vue', '{"guest":true}', 1),
|
"guest":true,
|
||||||
(12, 'customer-orders', 'orders', '/components/customer/PageOrders.vue', '{"guest":true}', 1),
|
"name": "Addresses"
|
||||||
(13, 'customer-statistic', 'statistic', '/components/customer/PageStatistic.vue', '{"guest":true}', 1),
|
}', 1),
|
||||||
(14, 'customer-product-details', 'products/:product_id/:link_rewrite', '/components/admin/ProductDetailView.vue', '{"guest":true}', 1),
|
(11, 'customer-cart', 'cart/:id', '/components/customer/PageCart.vue', '{
|
||||||
(15, 'admin-products', 'products', '/components/admin/PageProducts.vue', '{"guest":true}', 1);
|
"guest":true,
|
||||||
|
"name": "Cart"
|
||||||
|
}', 1),
|
||||||
|
(12, 'customer-orders', 'orders', '/components/customer/PageOrders.vue', '{
|
||||||
|
"guest":true,
|
||||||
|
"name": "Order"
|
||||||
|
}', 1),
|
||||||
|
(13, 'customer-statistic', 'statistic', '/components/customer/PageStatistic.vue', '{
|
||||||
|
"guest":true,
|
||||||
|
"name": "Statistic"
|
||||||
|
}
|
||||||
|
', 1),
|
||||||
|
(14, 'admin-product-details', 'products/:product_id', '/components/admin/ProductDetailView.vue', '{
|
||||||
|
"guest":true,
|
||||||
|
"name": "Products"
|
||||||
|
}
|
||||||
|
', 1),
|
||||||
|
(15, 'admin-products', 'products', '/components/admin/PageProducts.vue', '{
|
||||||
|
"guest":true,
|
||||||
|
"name": "Products"
|
||||||
|
}
|
||||||
|
', 1),
|
||||||
|
(16, 'admin-users-list', 'users-list', '/components/admin/UsersList.vue', '{
|
||||||
|
"guest":true,
|
||||||
|
"name": "Client List"
|
||||||
|
}
|
||||||
|
', 1),
|
||||||
|
(17, 'customer-management-profile', ':user_id/profile', '/components/customer-management/Profile.vue', '{
|
||||||
|
"guest":true,
|
||||||
|
"name": "Profile"
|
||||||
|
}
|
||||||
|
', 1),
|
||||||
|
(18, 'admin-users-search', 'users-search', '/components/admin/UsersSearch.vue', '{
|
||||||
|
"guest":true,
|
||||||
|
"name": "Search Clients"
|
||||||
|
}
|
||||||
|
', 1),
|
||||||
|
(19, 'customer-storage-file', 'file-storage', '/components/customer/StorageFileBrowser.vue', '{
|
||||||
|
"guest":true,
|
||||||
|
"name": "File Storage"
|
||||||
|
}', 1),
|
||||||
|
(20, 'customer-products', 'products', '/components/customer/PageProducts.vue', '{ "guest":true, "name": "Products" }', 1),
|
||||||
|
(21, 'customer-product-details', 'products/:product_id', '/components/customer/PageProduct.vue', '{ "guest":true, "name": "Products" }', 1),
|
||||||
|
(22, 'customer-page-carts', 'carts', '/components/customer/PageCarts.vue', '{ "guest":true, "name": "Carts" }', 1);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS b2b_top_menu (
|
CREATE TABLE IF NOT EXISTS b2b_top_menu (
|
||||||
menu_id INT AUTO_INCREMENT NOT NULL,
|
menu_id INT AUTO_INCREMENT NOT NULL,
|
||||||
@@ -71,21 +103,6 @@ INSERT IGNORE INTO `b2b_top_menu` (`menu_id`, `label`, `parent_id`, `params`, `a
|
|||||||
},
|
},
|
||||||
"icon" : "quill:list"
|
"icon" : "quill:list"
|
||||||
}', 1, '{"route":{"name":"admin-products","params":{"locale":""}}}', 1, 1),
|
}', 1, '{"route":{"name":"admin-products","params":{"locale":""}}}', 1, 1),
|
||||||
(3, '{
|
|
||||||
"name": "customer-carts",
|
|
||||||
"trans": {
|
|
||||||
"pl": {
|
|
||||||
"label": "Carts"
|
|
||||||
},
|
|
||||||
"en": {
|
|
||||||
"label": "Carts"
|
|
||||||
},
|
|
||||||
"de": {
|
|
||||||
"label": "Carts"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"icon" : "proicons:cart"
|
|
||||||
}', 1, '{"route":{"name":"customer-carts","params":{"locale":""}}}', 1, 1),
|
|
||||||
(4, '{
|
(4, '{
|
||||||
"name": "customer-addresses",
|
"name": "customer-addresses",
|
||||||
"trans": {
|
"trans": {
|
||||||
@@ -138,7 +155,138 @@ INSERT IGNORE INTO `b2b_top_menu` (`menu_id`, `label`, `parent_id`, `params`, `a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}', 1, 1),
|
}', 1, 1),
|
||||||
(9, '{"name":"carts","trans":{"pl":{"label":"Koszyki"},"en":{"label":"Carts"},"de":{"label":"Warenkörbe"}}}', 3, '{"route":{"name":"home","params":{"locale":""}}}', 1, 1);
|
(10, '{
|
||||||
|
"name": "customer-storage-file",
|
||||||
|
"trans": {
|
||||||
|
"pl": {
|
||||||
|
"label": "File Storage"
|
||||||
|
},
|
||||||
|
"en": {
|
||||||
|
"label": "File Storage"
|
||||||
|
},
|
||||||
|
"de": {
|
||||||
|
"label": "File Storage"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"icon": "carbon:volume-file-storage"
|
||||||
|
}', 1, '{
|
||||||
|
"route": {
|
||||||
|
"name": "customer-storage-file",
|
||||||
|
"params": {
|
||||||
|
"locale": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}', 1, 1),
|
||||||
|
(12, '{
|
||||||
|
"name": "admin-users-list",
|
||||||
|
"trans": {
|
||||||
|
"pl": {
|
||||||
|
"label": "Client List"
|
||||||
|
},
|
||||||
|
"en": {
|
||||||
|
"label": "Client List"
|
||||||
|
},
|
||||||
|
"de": {
|
||||||
|
"label": "Client List"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"icon": "tdesign:user-list"
|
||||||
|
}', 1, '{
|
||||||
|
"route": {
|
||||||
|
"name": "admin-users-list",
|
||||||
|
"params": {
|
||||||
|
"locale": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}', 1, 1),
|
||||||
|
(13, '{
|
||||||
|
"name": "admin-users-search",
|
||||||
|
"trans": {
|
||||||
|
"pl": {
|
||||||
|
"label": "Search Clients"
|
||||||
|
},
|
||||||
|
"en": {
|
||||||
|
"label": "Search Clients"
|
||||||
|
},
|
||||||
|
"de": {
|
||||||
|
"label": "Search Clients"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"icon": "material-symbols:search"
|
||||||
|
}', 1, '{
|
||||||
|
"route": {
|
||||||
|
"name": "admin-users-search",
|
||||||
|
"params": {
|
||||||
|
"locale": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}', 1, 1),
|
||||||
|
(14, '{
|
||||||
|
"name": "customer-management-profile",
|
||||||
|
"trans": {
|
||||||
|
"pl": {
|
||||||
|
"label": "Profile"
|
||||||
|
},
|
||||||
|
"en": {
|
||||||
|
"label": "Profile"
|
||||||
|
},
|
||||||
|
"de": {
|
||||||
|
"label": "Profile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"icon": "akar-icons:statistic-up"
|
||||||
|
}', 1, '{
|
||||||
|
"route": {
|
||||||
|
"name": "customer-management-profile",
|
||||||
|
"params": {
|
||||||
|
"locale": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}', 1, 1),
|
||||||
|
(15, '{
|
||||||
|
"name": "customer-products",
|
||||||
|
"trans": {
|
||||||
|
"pl": {
|
||||||
|
"label": "Products"
|
||||||
|
},
|
||||||
|
"en": {
|
||||||
|
"label": "Products"
|
||||||
|
},
|
||||||
|
"de": {
|
||||||
|
"label": "Products"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"icon": "akar-icons:statistic-up"
|
||||||
|
}', 1, '{
|
||||||
|
"route": {
|
||||||
|
"name": "customer-products",
|
||||||
|
"params": {
|
||||||
|
"locale": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}', 1, 1),
|
||||||
|
(16, '{
|
||||||
|
"name": "customer-page-carts",
|
||||||
|
"trans": {
|
||||||
|
"pl": {
|
||||||
|
"label": "Carts"
|
||||||
|
},
|
||||||
|
"en": {
|
||||||
|
"label": "Carts"
|
||||||
|
},
|
||||||
|
"de": {
|
||||||
|
"label": "Carts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"icon": "proicons:cart1"
|
||||||
|
}', 1, '{
|
||||||
|
"route": {
|
||||||
|
"name": "customer-page-carts",
|
||||||
|
"params": {
|
||||||
|
"locale": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}', 1, 1);
|
||||||
|
|
||||||
|
|
||||||
-- +goose Down
|
-- +goose Down
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ INSERT INTO `b2b_route_roles` (`route_id`, `role_id`) VALUES
|
|||||||
(2, '1'),
|
(2, '1'),
|
||||||
(2, '2'),
|
(2, '2'),
|
||||||
(2, '3'),
|
(2, '3'),
|
||||||
|
(2, '4'),
|
||||||
(3, '1'),
|
(3, '1'),
|
||||||
(3, '2'),
|
(3, '2'),
|
||||||
(3, '3'),
|
(3, '3'),
|
||||||
@@ -94,5 +95,24 @@ INSERT INTO `b2b_route_roles` (`route_id`, `role_id`) VALUES
|
|||||||
(7, '1'),
|
(7, '1'),
|
||||||
(7, '2'),
|
(7, '2'),
|
||||||
(7, '3'),
|
(7, '3'),
|
||||||
(7, '4');
|
(7, '4'),
|
||||||
|
(9, '2'),
|
||||||
|
(9, '3'),
|
||||||
|
(10, '1'),
|
||||||
|
(11, '1'),
|
||||||
|
(12, '1'),
|
||||||
|
(13, '1'),
|
||||||
|
(14, '2'),
|
||||||
|
(14, '3'),
|
||||||
|
(15, '2'),
|
||||||
|
(15, '3'),
|
||||||
|
(16, '2'),
|
||||||
|
(16, '3'),
|
||||||
|
(17, '1'),
|
||||||
|
(18, '2'),
|
||||||
|
(18, '3'),
|
||||||
|
(19, '1'),
|
||||||
|
(20, '1'),
|
||||||
|
(21, '1'),
|
||||||
|
(22, '1');
|
||||||
-- +goose Down
|
-- +goose Down
|
||||||
Reference in New Issue
Block a user