|
|
@@ -4,7 +4,6 @@
|
|
|
|
|
|
<div class="q-px-md q-pb-md">
|
|
|
|
|
|
- <!-- Search -->
|
|
|
<div class="q-mb-md">
|
|
|
<q-input
|
|
|
v-model="search"
|
|
|
@@ -20,7 +19,6 @@
|
|
|
</q-input>
|
|
|
</div>
|
|
|
|
|
|
- <!-- Category chips -->
|
|
|
<div class="chips-row q-mb-md">
|
|
|
<div
|
|
|
:class="['cat-chip', activeTab === 'all' ? 'cat-chip--selected' : 'cat-chip--default']"
|
|
|
@@ -47,17 +45,14 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- Loading -->
|
|
|
<div v-if="loading" class="flex flex-center q-py-xl">
|
|
|
<q-spinner color="primary" size="48px" />
|
|
|
</div>
|
|
|
|
|
|
- <!-- Empty -->
|
|
|
<div v-else-if="pagedItems.length === 0" class="text-center text-grey q-py-xl">
|
|
|
{{ $t('http.errors.no_records_found') }}
|
|
|
</div>
|
|
|
|
|
|
- <!-- Grid -->
|
|
|
<div v-else class="items-list">
|
|
|
<div
|
|
|
v-for="item in pagedItems"
|
|
|
@@ -67,10 +62,8 @@
|
|
|
<q-card-section class="q-pa-sm">
|
|
|
<div class="row no-wrap store-card-inner">
|
|
|
|
|
|
- <!-- LEFT -->
|
|
|
<div class="col column justify-between q-pr-sm">
|
|
|
<div>
|
|
|
- <!-- Category badge -->
|
|
|
<div class="q-mb-xs">
|
|
|
<span v-if="item.category?.name" class="badge-category">
|
|
|
{{ item.category.name }}
|
|
|
@@ -85,7 +78,6 @@
|
|
|
{{ item.description }}
|
|
|
</div>
|
|
|
|
|
|
- <!-- Variations -->
|
|
|
<template v-if="item.variations?.length">
|
|
|
<div class="text-caption text-grey-6 q-mb-xs">
|
|
|
{{ variationTypeLabel(item) }}
|
|
|
@@ -108,7 +100,6 @@
|
|
|
</template>
|
|
|
</div>
|
|
|
|
|
|
- <!-- Price -->
|
|
|
<div class="column items-start q-mt-sm">
|
|
|
<span v-if="item.price" class="text-caption text-grey-5 text-strike">
|
|
|
R$ {{ formatPrice(item.price) }}
|
|
|
@@ -119,7 +110,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- RIGHT -->
|
|
|
<div class="store-card-right column items-stretch no-wrap">
|
|
|
<div class="store-card-image col">
|
|
|
<img
|
|
|
@@ -137,7 +127,6 @@
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
- <!-- Button -->
|
|
|
<q-btn
|
|
|
unelevated
|
|
|
size="sm"
|
|
|
@@ -149,6 +138,15 @@
|
|
|
padding="5px 8px"
|
|
|
@click="toggleInterest(item)"
|
|
|
/>
|
|
|
+ <q-btn
|
|
|
+ unelevated
|
|
|
+ size="sm"
|
|
|
+ class="q-mt-xs btn-whatsapp"
|
|
|
+ icon="mdi-whatsapp"
|
|
|
+ style="width: 100%"
|
|
|
+ padding="5px 8px"
|
|
|
+ @click="openWhatsAppDialog(item)"
|
|
|
+ />
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
@@ -157,7 +155,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- Pagination -->
|
|
|
<div v-if="totalPages > 1" class="flex flex-center q-mt-lg">
|
|
|
<q-pagination
|
|
|
v-model="currentPage"
|
|
|
@@ -179,6 +176,7 @@ import { normalizeString } from "src/helpers/utils";
|
|
|
import { getStoreItemsAssociado, toggleInterestAssociado as apiToggleInterest } from "src/api/storeItem";
|
|
|
import { getCategories } from "src/api/category";
|
|
|
import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
|
|
|
+import WhatsAppLojaDialog from "./components/WhatsAppLojaDialog.vue";
|
|
|
|
|
|
const $q = useQuasar();
|
|
|
const { t } = useI18n();
|
|
|
@@ -251,17 +249,22 @@ const toggleInterest = async (item) => {
|
|
|
const result = await apiToggleInterest(item.id);
|
|
|
item.user_interested = result.interested;
|
|
|
item.interests_count = (item.interests_count ?? 0) + (result.interested ? 1 : -1);
|
|
|
- $q.notify({
|
|
|
- type: "positive",
|
|
|
- message: result.interested
|
|
|
- ? t("loja.btn_interested")
|
|
|
- : t("http.success"),
|
|
|
- });
|
|
|
} catch {
|
|
|
- $q.notify({ type: "negative", message: t("http.errors.failed") });
|
|
|
+ // silent
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const openWhatsAppDialog = (item) => {
|
|
|
+ const variation = activeVariation(item);
|
|
|
+ $q.dialog({
|
|
|
+ component: WhatsAppLojaDialog,
|
|
|
+ componentProps: {
|
|
|
+ item,
|
|
|
+ variationLabel: variation?.variation_label ?? null,
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
try {
|
|
|
const [itemsData, catsData] = await Promise.all([
|
|
|
@@ -423,6 +426,14 @@ onMounted(async () => {
|
|
|
|
|
|
.btn-interested :deep(.q-icon) { color: white !important; }
|
|
|
|
|
|
+.btn-whatsapp {
|
|
|
+ background: #25d366 !important;
|
|
|
+ color: white !important;
|
|
|
+ border-radius: 8px !important;
|
|
|
+}
|
|
|
+
|
|
|
+.btn-whatsapp :deep(.q-icon) { color: white !important; }
|
|
|
+
|
|
|
// --- text colors ---
|
|
|
.text-violet-dark { color: #4d1658; }
|
|
|
.text-violet-medium { color: #7b2d97; }
|