Compare commits

..

No commits in common. "5e44109ee5bd32ea54e954d93355cbf937ba951c" and "42075849979a3175a0e75102e2a7ac418b8e5428" have entirely different histories.

5 changed files with 107 additions and 149 deletions

View File

@ -95,9 +95,8 @@ class ProductController {
}
async findById(req, res) {
const { dateExpired, postalCode } = req.query
const id = Number(req.params.id)
const _products = await db.getProducts(dateExpired, postalCode);
const _products = await db.getProducts();
const filterProduct = _products[0].filter(item => item.id === id)
return res.status(200).send({

View File

@ -88,7 +88,7 @@ export default defineComponent({
:model-value="modelValue"
@update:model-value="updateModel"
v-bind="bindValue"
class="custom-main-paragraph field-postal-code"
class="custom-main-paragraph"
:error="false"
placeholder="código postal"
mask="#####"

View File

@ -1,5 +1,4 @@
<script>
import { storeToRefs } from "pinia";
import { defineComponent } from "vue";
import Calendar from "src/components/@inputs/Calendar.vue";
@ -7,8 +6,6 @@ import PostalCode from "src/components/@inputs/PostalCode.vue";
import IconSearch from "src/components/icons/IconSearch.vue";
import { usePostalCalendar } from "src/hooks/usePostalCalendar";
import { useVerticalCarouselImgs } from "src/hooks/useVerticalCarouselImgs";
import { useFormStore } from "src/stores/forms";
import { onMounted } from "vue";
export default defineComponent({
name: "vertical-carousel-imgs",
@ -29,30 +26,6 @@ export default defineComponent({
} = usePostalCalendar({ type: "home" });
const { navPos, screenWidth, slide, target } = useVerticalCarouselImgs();
const formStore = useFormStore();
const {postalCodeValid } = storeToRefs(formStore);
function handleFormKeyPress() {
const postalCodeField = document.querySelector("#carousel-form .postal-code-control input")
const modalDate = document.querySelector("#carousel-form .calendar .custom-date-btn")
let isEventKeyActive = false
postalCodeField.addEventListener('input', (e) =>{
isEventKeyActive = true
})
postalCodeField.addEventListener('keypress', e => {
if (e.target.value.length === 5 && isEventKeyActive) {
if (e.key === 'Enter') {
e.preventDefault();
modalDate.click()
isEventKeyActive = false
}
}
})
}
onMounted(() => {
handleFormKeyPress()
})
return {
slide,
navPos,
@ -75,24 +48,19 @@ export default defineComponent({
<div ref="target" class="vertical-carousel-container" style="min-height: 100dvh">
<q-carousel navigation-position="right" style="min-height: 100dvh" v-model="slide" navigation autoplay infinite
animated v-if="!!banners.length" class="custom-carousel">
<q-carousel-slide v-for="(item, i) in banners" :key="i" :name="item.title" :img-src="item.image">
<q-carousel-slide v-for="(item, i) in banners[0]" :key="i" :name="item.longName" :img-src="item.url">
<div class="vertical-carousel-content">
<header class="carousel-content-header">
<h1 class="carousel-header-title">
{{ item.title }}
</h1>
</header>
</div>
</q-carousel-slide>
</q-carousel>
<div class="carousel-form">
<form @submit="onSubmit" class="carousel-content-body" id="carousel-form">
<div class="carousel-content-item postal-code-control">
<form @submit="onSubmit" class="carousel-content-body">
<div class="carousel-content-item">
<PostalCode v-model="postalCode" v-bind:bindValue="postalCodeAttrs" :setFieldError="setFieldError" />
</div>
<div class="carousel-content-item date-expired-control">
<div class="carousel-content-item">
<Calendar v-model="calendar" v-bind:bindValue="calendarAttrs" :setValues="setValues" />
</div>
@ -101,6 +69,9 @@ export default defineComponent({
</q-btn>
</form>
</div>
</q-carousel-slide>
</q-carousel>
</div>
</template>
@ -112,15 +83,39 @@ export default defineComponent({
& .custom-carousel {
user-select: none;
}
.carousel-form{
max-width: 850px;
margin: 0 auto;
& .vertical-carousel-content {
position: absolute;
bottom: 15vh;
min-height: fit-content;
left: 0;
right: 0;
bottom: 110px;
width: min(100%, 845px);
margin: 0 auto;
& .carousel-content-header {
display: flex;
flex-direction: column;
gap: 17px;
color: $white;
text-align: center;
margin-bottom: 27px;
& .carousel-header-title {
font-size: $font-35;
font-weight: 500;
line-height: 30px;
color: currentColor;
}
.carousel-content-body {
& .carousel-header-paragraph {
color: currentColor;
font-family: $font-lora;
line-height: 22px;
}
}
& .carousel-content-body {
display: flex;
flex-wrap: wrap;
border-radius: 10px 0 0 10px;
@ -178,36 +173,6 @@ export default defineComponent({
}
}
}
& .vertical-carousel-content {
min-height: fit-content;
width: min(100%, 845px);
margin: 0 auto;
& .carousel-content-header {
display: flex;
flex-direction: column;
gap: 17px;
color: $white;
text-align: center;
position: absolute;
bottom: 30vh;
left: 0;
width: 100%;
margin-bottom: 27px;
& .carousel-header-title {
font-size: $font-35;
font-weight: 500;
line-height: 30px;
color: currentColor;
}
& .carousel-header-paragraph {
color: currentColor;
font-family: $font-lora;
line-height: 22px;
}
}
& .carousel-content-footer {
display: grid;
@ -216,12 +181,12 @@ export default defineComponent({
@media only screen and (max-width: $med-xmd) {
padding-inline: 20px;
top: 50%;
transform: translateY(-50%);
& .carousel-content-header {
gap: 15px;
margin-bottom: 20px;
bottom: initial;
top: calc(10dvh + 120px);
margin-bottom: 49px;
& .carousel-header-title {
font-size: $font-28;
@ -234,24 +199,6 @@ export default defineComponent({
}
}
& .carousel-content-footer {
display: none;
}
}
@media only screen and (max-width: $med-md) {}
@media only screen and (max-height: 360px) {
/* background-color: tomato; */
}
}
@media only screen and (max-width: $med-xmd) {
.carousel-form{
bottom: 0;
top: 120px;
display: flex;
align-items: center;
}
& .carousel-content-body {
margin-bottom: initial;
flex-direction: column;
@ -270,6 +217,17 @@ export default defineComponent({
}
}
}
& .carousel-content-footer {
display: none;
}
}
@media only screen and (max-width: $med-md) {}
@media only screen and (max-height: 360px) {
/* background-color: tomato; */
}
}
}
</style>

View File

@ -77,7 +77,7 @@ export default defineComponent({
const { products, addCartLoadingBtn } = storeToRefs(cartStore);
onBeforeMount(async () => {
await getProduct(route.params.id, availability.value);
await getProduct(route.params.id);
});
watch(

View File

@ -147,10 +147,11 @@ export const useCartStore = defineStore("cart", () => {
routeId.value = id;
try {
const params = transformOptionsToParams(options);
const promises = [
apiBack.get(`products/${+id - 1}`, { params }),
apiBack.get(`products/${+id}`, { params }),
apiBack.get(`products/${+id + 1}`, { params }),
apiBack.get(`products/${+id - 1}`),
apiBack.get(`products/${+id}`),
apiBack.get(`products/${+id + 1}`),
];
const results = await Promise.allSettled(promises);
const [prev, current, next] = results.map((res) => {