develop #8
|
@ -1,9 +1,4 @@
|
||||||
const db = require("../../db/db");
|
const db = require("../../db/db");
|
||||||
<<<<<<<< HEAD:api/controller/product/product.controller.js
|
|
||||||
|
|
||||||
const productsJson = require("./products.json")
|
|
||||||
========
|
|
||||||
>>>>>>>> master:api/controller/Product/product.controller.js
|
|
||||||
|
|
||||||
class ProductController {
|
class ProductController {
|
||||||
async findAll(req, res) {
|
async findAll(req, res) {
|
||||||
|
@ -78,7 +73,6 @@ class ProductController {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Number(params.isNew)) {
|
if (Number(params.isNew)) {
|
||||||
console.log(params.isNew);
|
|
||||||
productsFilter = productsFilter.filter(item => item.isNew == Number(params.isNew))
|
productsFilter = productsFilter.filter(item => item.isNew == Number(params.isNew))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,146 +0,0 @@
|
||||||
const db = require("../../db/db");
|
|
||||||
const paypal = require('paypal-rest-sdk');
|
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
class PaymentController {
|
|
||||||
async Create(req, res) {
|
|
||||||
|
|
||||||
//parâmetros para retornar os produtos que serão comprados
|
|
||||||
const products = req.body.products
|
|
||||||
//parameters to return price
|
|
||||||
const price = req.body.price
|
|
||||||
let productsIds = ''
|
|
||||||
for (let i = 0; i < products.length; i++) {
|
|
||||||
productsIds += `${products[i]}${i === products.length - 1 ? '' : '-'}`
|
|
||||||
}
|
|
||||||
|
|
||||||
//json for checkout
|
|
||||||
var payReq = JSON.stringify({
|
|
||||||
'intent': 'sale',
|
|
||||||
'redirect_urls': {
|
|
||||||
'return_url': `${process.env.BASE_URL}/checkout/success?productsIds=${productsIds}`,
|
|
||||||
'cancel_url': `${process.env.BASE_URL}/checkout/error`
|
|
||||||
},
|
|
||||||
'payer': {
|
|
||||||
'payment_method': 'paypal'
|
|
||||||
},
|
|
||||||
'transactions': [{
|
|
||||||
'amount': {
|
|
||||||
'total': price,
|
|
||||||
'currency': 'EUR'
|
|
||||||
},
|
|
||||||
'description': 'This is the payment transaction description.'
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
|
|
||||||
//Starting checkout process and returning sandbox url
|
|
||||||
try {
|
|
||||||
let urlRedirect
|
|
||||||
urlRedirect = await new Promise(async (resolve, reject) => {
|
|
||||||
paypal.payment.create(payReq, function (error, payment) {
|
|
||||||
if (error) {
|
|
||||||
reject(error)
|
|
||||||
} else {
|
|
||||||
//capture HATEOAS links
|
|
||||||
var links = {};
|
|
||||||
payment.links.forEach(function (linkObj) {
|
|
||||||
links[linkObj.rel] = {
|
|
||||||
'href': linkObj.href,
|
|
||||||
'method': linkObj.method
|
|
||||||
};
|
|
||||||
})
|
|
||||||
//if redirect url present, redirect user
|
|
||||||
if (links.hasOwnProperty('approval_url')) {
|
|
||||||
resolve(links['approval_url'].href)
|
|
||||||
} else {
|
|
||||||
console.error('no redirect URI present');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).then(res => res)
|
|
||||||
if (urlRedirect) {
|
|
||||||
return res.status(200).send({
|
|
||||||
data: urlRedirect
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
return res.status(422).send({
|
|
||||||
data: {
|
|
||||||
message: "Error when starting payment"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async Success(req, res) {
|
|
||||||
//Parameters for validating payment and purchased products
|
|
||||||
const paramns = JSON.parse(req.body.data)
|
|
||||||
const custumer = paramns.custumer
|
|
||||||
const productsIds = paramns.productsIds
|
|
||||||
const productsArray = productsIds.split('-')
|
|
||||||
const products = productsArray.map(Number)
|
|
||||||
const _products = await db.getProducts();
|
|
||||||
const productsFilter = _products[0].filter((item) => {
|
|
||||||
if (products.includes(item.id)) {
|
|
||||||
return item
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const paymentId = paramns.paymentId;
|
|
||||||
const payerId = { 'payer_id': paramns.PayerID };
|
|
||||||
|
|
||||||
const jsonOrderData = JSON.stringify({
|
|
||||||
"paymentId": paymentId,
|
|
||||||
"custumer": custumer,
|
|
||||||
"products": productsFilter
|
|
||||||
})
|
|
||||||
|
|
||||||
fs.writeFileSync('order.json', jsonOrderData, 'utf-8')
|
|
||||||
const contentOrder = fs.readFileSync('order.json', 'utf-8');
|
|
||||||
//API validation and data
|
|
||||||
paypal.payment.execute(paymentId, payerId, async function (error, payment) {
|
|
||||||
if (error) {
|
|
||||||
console.log(error);
|
|
||||||
return res.status(422).send({
|
|
||||||
data: {
|
|
||||||
message: "payment not successful"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
if (payment.state == 'approved') {
|
|
||||||
await db.orderData_put(contentOrder);
|
|
||||||
return res.status(200).send({
|
|
||||||
data: {
|
|
||||||
id: payment.id,
|
|
||||||
email: payment.payer.payer_info.email,
|
|
||||||
message: "payment completed successfully",
|
|
||||||
products: productsFilter
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
return res.status(422).send({
|
|
||||||
data: {
|
|
||||||
message: "payment not successful"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
/* return res.status(200).send({
|
|
||||||
data: {
|
|
||||||
menssage: "sucesso"
|
|
||||||
}
|
|
||||||
}) */
|
|
||||||
}
|
|
||||||
|
|
||||||
Cancel(req, res) {
|
|
||||||
return res.status(200).send({
|
|
||||||
data: {
|
|
||||||
menssage: "cancelado"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new PaymentController();
|
|
|
@ -78,7 +78,6 @@ class ProductController {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Number(params.isNew)) {
|
if (Number(params.isNew)) {
|
||||||
console.log(params.isNew);
|
|
||||||
productsFilter = productsFilter.filter(item => item.isNew == Number(params.isNew))
|
productsFilter = productsFilter.filter(item => item.isNew == Number(params.isNew))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,23 +0,0 @@
|
||||||
const db = require("../../db/db");
|
|
||||||
|
|
||||||
class ProvincesController {
|
|
||||||
async findAll(req, res) {
|
|
||||||
const params = req.query;
|
|
||||||
const tmpProvinces = await db.getProvinces();
|
|
||||||
|
|
||||||
let provinces = [];
|
|
||||||
|
|
||||||
tmpProvinces.forEach(element => {
|
|
||||||
provinces = [...provinces,{
|
|
||||||
code: element.id,
|
|
||||||
name: element.name
|
|
||||||
}];
|
|
||||||
})
|
|
||||||
|
|
||||||
return res.status(200).send({
|
|
||||||
data: provinces
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new ProvincesController();
|
|
14
api/db/db.js
14
api/db/db.js
|
@ -26,10 +26,6 @@ async function getProducts(dateExpired, postalCode) {
|
||||||
//Procedure for create transactions, do not carry out any manipulation at the bank
|
//Procedure for create transactions, do not carry out any manipulation at the bank
|
||||||
async function orderData_put(jsonOrderData) {
|
async function orderData_put(jsonOrderData) {
|
||||||
const conn = await connect();
|
const conn = await connect();
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log(jsonOrderData);
|
|
||||||
=======
|
|
||||||
>>>>>>> master
|
|
||||||
const [rows] = await conn.query(`CALL orderData_put(?)`, [jsonOrderData], (err, results) => {
|
const [rows] = await conn.query(`CALL orderData_put(?)`, [jsonOrderData], (err, results) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
@ -39,9 +35,6 @@ async function orderData_put(jsonOrderData) {
|
||||||
});
|
});
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
=======
|
|
||||||
async function order_confirm(orderFk) {
|
async function order_confirm(orderFk) {
|
||||||
const conn = await connect();
|
const conn = await connect();
|
||||||
const [rows] = await conn.query(`CALL order_confirm(${orderFk})`);
|
const [rows] = await conn.query(`CALL order_confirm(${orderFk})`);
|
||||||
|
@ -49,7 +42,6 @@ async function order_confirm(orderFk) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
//Procedure for get transactions, do not carry out any manipulation at the bank
|
//Procedure for get transactions, do not carry out any manipulation at the bank
|
||||||
async function orderData_get() {
|
async function orderData_get() {
|
||||||
const conn = await connect();
|
const conn = await connect();
|
||||||
|
@ -68,9 +60,6 @@ async function getProvinces() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
module.exports = { getProducts, orderData_get, orderData_put, getProvinces }
|
|
||||||
=======
|
|
||||||
async function deliveryDate_get(postalCode) {
|
async function deliveryDate_get(postalCode) {
|
||||||
const conn = await connect();
|
const conn = await connect();
|
||||||
const [rows] = await conn.query(`CALL deliveryDate_get("${postalCode}")`);
|
const [rows] = await conn.query(`CALL deliveryDate_get("${postalCode}")`);
|
||||||
|
@ -84,5 +73,4 @@ async function contact_Request(name, phone, email, message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports = { getProducts, orderData_get, orderData_put, getProvinces, deliveryDate_get, contact_Request, order_confirm }
|
module.exports = { getProducts, orderData_get, orderData_put, getProvinces, deliveryDate_get, contact_Request, order_confirm }
|
||||||
>>>>>>> master
|
|
|
@ -2,17 +2,11 @@ const cors = require('cors');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const paypal = require('paypal-rest-sdk');
|
const paypal = require('paypal-rest-sdk');
|
||||||
<<<<<<< HEAD
|
|
||||||
const productController = require('./controller/product/product.controller');
|
|
||||||
const paymengtController = require('./controller/payment/payment.controller');
|
|
||||||
const provincesController = require('./controller/provinces/provinces.controller');
|
|
||||||
=======
|
|
||||||
const productController = require('./controller/Product/product.controller');
|
const productController = require('./controller/Product/product.controller');
|
||||||
const paymengtController = require('./controller/Payment/payment.controller');
|
const paymengtController = require('./controller/Payment/payment.controller');
|
||||||
const provincesController = require('./controller/Provinces/provinces.controller');
|
const provincesController = require('./controller/Provinces/provinces.controller');
|
||||||
const deliveryController = require('./controller/Delivery/delivery.controller');
|
const deliveryController = require('./controller/Delivery/delivery.controller');
|
||||||
const contactController = require('./controller/Contact/contact.controller');
|
const contactController = require('./controller/Contact/contact.controller');
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
paypal.configure({
|
paypal.configure({
|
||||||
'mode': 'sandbox',
|
'mode': 'sandbox',
|
||||||
|
@ -50,13 +44,10 @@ app.post('/api/payment/', paymengtController.Create)
|
||||||
app.post('/api/payment/success', paymengtController.Success)
|
app.post('/api/payment/success', paymengtController.Success)
|
||||||
app.get('/api/payment/cancel', paymengtController.Cancel)
|
app.get('/api/payment/cancel', paymengtController.Cancel)
|
||||||
app.get('/api/provinces', provincesController.findAll)
|
app.get('/api/provinces', provincesController.findAll)
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
app.get('/api/delivery/dates', deliveryController.findByPostalCode)
|
app.get('/api/delivery/dates', deliveryController.findByPostalCode)
|
||||||
app.post('/api/contact/save', contactController.Create)
|
app.post('/api/contact/save', contactController.Create)
|
||||||
|
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log(`Server listening at http://localhost:${port}`);
|
console.log(`Server listening at http://localhost:${port}`);
|
||||||
|
|
|
@ -138,15 +138,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@faker-js/faker": {
|
"node_modules/@faker-js/faker": {
|
||||||
<<<<<<< HEAD
|
|
||||||
"version": "8.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.4.0.tgz",
|
|
||||||
"integrity": "sha512-htW87352wzUCdX1jyUQocUcmAaFqcR/w082EC8iP/gtkF0K+aKcBp0hR5Arb7dzR8tQ1TrhE9DNa5EbJELm84w==",
|
|
||||||
=======
|
|
||||||
"version": "8.4.1",
|
"version": "8.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.4.1.tgz",
|
||||||
"integrity": "sha512-XQ3cU+Q8Uqmrbf2e0cIC/QN43sTBSC8KF12u29Mb47tWrt2hAgBXSgpZMj4Ao8Uk0iJcU99QsOCaIL8934obCg==",
|
"integrity": "sha512-XQ3cU+Q8Uqmrbf2e0cIC/QN43sTBSC8KF12u29Mb47tWrt2hAgBXSgpZMj4Ao8Uk0iJcU99QsOCaIL8934obCg==",
|
||||||
>>>>>>> master
|
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,10 +25,7 @@
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
"mysql2": "^3.7.0",
|
"mysql2": "^3.7.0",
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
"node-redsys-api": "^0.0.5",
|
"node-redsys-api": "^0.0.5",
|
||||||
>>>>>>> master
|
|
||||||
"paypal-rest-sdk": "^1.8.1",
|
"paypal-rest-sdk": "^1.8.1",
|
||||||
"pinia": "^2.0.11",
|
"pinia": "^2.0.11",
|
||||||
"quasar": "^2.6.0",
|
"quasar": "^2.6.0",
|
||||||
|
|
|
@ -27,32 +27,9 @@ export default defineComponent({
|
||||||
return date >= fullCurrentDate;
|
return date >= fullCurrentDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
onBeforeMount(() => {
|
|
||||||
setValues({ date: invertDate(proxyDate.value) });
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(proxyDate, (newProxy) => {
|
|
||||||
setValues({ date: invertDate(newProxy) });
|
|
||||||
});
|
|
||||||
|
|
||||||
const locale = {
|
|
||||||
days: "Domingo_Lunes_Martes_Miércoles_Jueves_Viernes_Sábado".split("_"),
|
|
||||||
daysShort: "Dom_Lun_Mar_Mié_Jue_Vie_Sáb".split("_"),
|
|
||||||
months:
|
|
||||||
"Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre".split(
|
|
||||||
"_"
|
|
||||||
),
|
|
||||||
monthsShort: "Ene_Feb_Mar_Abr_May_Jun_Jul_Ago_Sep_Oct_Nov_Dic".split("_"),
|
|
||||||
firstDayOfWeek: 1,
|
|
||||||
format24h: false,
|
|
||||||
pluralDay: "dias",
|
|
||||||
};
|
|
||||||
=======
|
|
||||||
function updateModel(value) {
|
function updateModel(value) {
|
||||||
emit("update:modelValue", value);
|
emit("update:modelValue", value);
|
||||||
}
|
}
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
setValues({ date: invertDate(proxyDate.value) });
|
setValues({ date: invertDate(proxyDate.value) });
|
||||||
|
@ -79,16 +56,10 @@ export default defineComponent({
|
||||||
availability,
|
availability,
|
||||||
postalCodeValid,
|
postalCodeValid,
|
||||||
proxyDate,
|
proxyDate,
|
||||||
<<<<<<< HEAD
|
|
||||||
locale,
|
|
||||||
updateProxy,
|
|
||||||
optionsValidDates,
|
|
||||||
=======
|
|
||||||
LOCALE,
|
LOCALE,
|
||||||
updateProxy,
|
updateProxy,
|
||||||
optionsValidDates,
|
optionsValidDates,
|
||||||
updateModel,
|
updateModel,
|
||||||
>>>>>>> master
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -107,15 +78,9 @@ export default defineComponent({
|
||||||
>
|
>
|
||||||
<q-date
|
<q-date
|
||||||
v-model="proxyDate"
|
v-model="proxyDate"
|
||||||
<<<<<<< HEAD
|
|
||||||
:options="optionsValidDates"
|
|
||||||
:locale="locale"
|
|
||||||
today-btn
|
|
||||||
=======
|
|
||||||
:options="postalCodeValid.dataOptions"
|
:options="postalCodeValid.dataOptions"
|
||||||
:locale="LOCALE"
|
:locale="LOCALE"
|
||||||
:readonly="!postalCodeValid.isValid"
|
:readonly="!postalCodeValid.isValid"
|
||||||
>>>>>>> master
|
|
||||||
mask="YYYY-MM-DD"
|
mask="YYYY-MM-DD"
|
||||||
>
|
>
|
||||||
<div class="row items-center justify-end q-gutter-sm">
|
<div class="row items-center justify-end q-gutter-sm">
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
<script>
|
<script>
|
||||||
<<<<<<< HEAD
|
|
||||||
import { defineComponent } from "vue";
|
|
||||||
|
|
||||||
=======
|
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { defineComponent, ref } from "vue";
|
import { defineComponent, ref } from "vue";
|
||||||
|
|
||||||
|
@ -10,16 +6,10 @@ import { apiBack } from "src/boot/axios";
|
||||||
import { quasarNotify } from "src/functions/quasarNotify";
|
import { quasarNotify } from "src/functions/quasarNotify";
|
||||||
import { useFormStore } from "src/stores/forms";
|
import { useFormStore } from "src/stores/forms";
|
||||||
import * as M from "src/utils/zod/messages";
|
import * as M from "src/utils/zod/messages";
|
||||||
>>>>>>> master
|
|
||||||
import IconPostalCode from "../icons/IconPostalCode.vue";
|
import IconPostalCode from "../icons/IconPostalCode.vue";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "postal-code",
|
name: "postal-code",
|
||||||
<<<<<<< HEAD
|
|
||||||
components: { IconPostalCode },
|
|
||||||
setup() {
|
|
||||||
return {};
|
|
||||||
=======
|
|
||||||
components: { IconPostalCode /* IconInfo, */ /* IconSearch */ },
|
components: { IconPostalCode /* IconInfo, */ /* IconSearch */ },
|
||||||
props: ["modelValue", "bindValue", "setFieldError"],
|
props: ["modelValue", "bindValue", "setFieldError"],
|
||||||
setup({ setFieldError, modelValue }, { emit }) {
|
setup({ setFieldError, modelValue }, { emit }) {
|
||||||
|
@ -80,7 +70,6 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
return { updateModel, onBlur, isPostalCodeLoading };
|
return { updateModel, onBlur, isPostalCodeLoading };
|
||||||
>>>>>>> master
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -95,9 +84,6 @@ export default defineComponent({
|
||||||
<!-- <IconInfo /> -->
|
<!-- <IconInfo /> -->
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
<slot></slot>
|
|
||||||
=======
|
|
||||||
<q-input
|
<q-input
|
||||||
:model-value="modelValue"
|
:model-value="modelValue"
|
||||||
@update:model-value="updateModel"
|
@update:model-value="updateModel"
|
||||||
|
@ -110,7 +96,6 @@ export default defineComponent({
|
||||||
dense
|
dense
|
||||||
@blur="onBlur"
|
@blur="onBlur"
|
||||||
/>
|
/>
|
||||||
>>>>>>> master
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -74,44 +74,10 @@ export default defineComponent({
|
||||||
<h1 class="carousel-header-title">
|
<h1 class="carousel-header-title">
|
||||||
Regala un verano lleno de flores y plantas
|
Regala un verano lleno de flores y plantas
|
||||||
</h1>
|
</h1>
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
<!-- <p class="carousel-header-paragraph"></p> -->
|
|
||||||
=======
|
|
||||||
>>>>>>> master
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<form @submit="onSubmit" class="carousel-content-body">
|
<form @submit="onSubmit" class="carousel-content-body">
|
||||||
<div class="carousel-content-item">
|
<div class="carousel-content-item">
|
||||||
<<<<<<< HEAD
|
|
||||||
<Calendar :setValues="setValues">
|
|
||||||
<q-input
|
|
||||||
borderless
|
|
||||||
class="custom-date-input"
|
|
||||||
v-model="calendar"
|
|
||||||
v-bind="calendarAttrs"
|
|
||||||
:error="false"
|
|
||||||
placeholder="Elige una fecha"
|
|
||||||
mask="##/##/####"
|
|
||||||
dense
|
|
||||||
/>
|
|
||||||
</Calendar>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="carousel-content-item">
|
|
||||||
<PostalCode>
|
|
||||||
<q-input
|
|
||||||
borderless
|
|
||||||
class="custom-main-paragraph"
|
|
||||||
v-model="postalCode"
|
|
||||||
v-bind="postalCodeAttrs"
|
|
||||||
:error="false"
|
|
||||||
placeholder="código postal"
|
|
||||||
mask="#####"
|
|
||||||
dense
|
|
||||||
/>
|
|
||||||
</PostalCode>
|
|
||||||
=======
|
|
||||||
<PostalCode
|
<PostalCode
|
||||||
v-model="postalCode"
|
v-model="postalCode"
|
||||||
v-bind:bindValue="postalCodeAttrs"
|
v-bind:bindValue="postalCodeAttrs"
|
||||||
|
@ -125,7 +91,6 @@ export default defineComponent({
|
||||||
v-bind:bindValue="calendarAttrs"
|
v-bind:bindValue="calendarAttrs"
|
||||||
:setValues="setValues"
|
:setValues="setValues"
|
||||||
/>
|
/>
|
||||||
>>>>>>> master
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-btn type="submit" class="btn carousel-content-item">
|
<q-btn type="submit" class="btn carousel-content-item">
|
||||||
|
|
|
@ -128,33 +128,6 @@ export default defineComponent({
|
||||||
v-if="modalItem === 'isOpenAvailability'"
|
v-if="modalItem === 'isOpenAvailability'"
|
||||||
class="modal-body-availability"
|
class="modal-body-availability"
|
||||||
>
|
>
|
||||||
<<<<<<< HEAD
|
|
||||||
<Calendar :setValues="setValues">
|
|
||||||
<q-input
|
|
||||||
borderless
|
|
||||||
class="custom-date-input"
|
|
||||||
v-model="calendar"
|
|
||||||
v-bind="calendarAttrs"
|
|
||||||
:error="false"
|
|
||||||
placeholder="Elige una fecha"
|
|
||||||
mask="##/##/####"
|
|
||||||
dense
|
|
||||||
/>
|
|
||||||
</Calendar>
|
|
||||||
|
|
||||||
<PostalCode>
|
|
||||||
<q-input
|
|
||||||
borderless
|
|
||||||
class="custom-main-paragraph"
|
|
||||||
v-model="postalCode"
|
|
||||||
v-bind="postalCodeAttrs"
|
|
||||||
:error="false"
|
|
||||||
placeholder="código postal"
|
|
||||||
mask="#####"
|
|
||||||
dense
|
|
||||||
/>
|
|
||||||
</PostalCode>
|
|
||||||
=======
|
|
||||||
<PostalCode
|
<PostalCode
|
||||||
v-model="postalCode"
|
v-model="postalCode"
|
||||||
v-bind:bindValue="postalCodeAttrs"
|
v-bind:bindValue="postalCodeAttrs"
|
||||||
|
@ -166,7 +139,6 @@ export default defineComponent({
|
||||||
v-bind:bindValue="calendarAttrs"
|
v-bind:bindValue="calendarAttrs"
|
||||||
:setValues="setValues"
|
:setValues="setValues"
|
||||||
/>
|
/>
|
||||||
>>>>>>> master
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -27,30 +27,7 @@ export default defineComponent({
|
||||||
terms,
|
terms,
|
||||||
termsAttrs,
|
termsAttrs,
|
||||||
},
|
},
|
||||||
<<<<<<< HEAD
|
|
||||||
});
|
|
||||||
const [firstName, firstNameAttrs] = defineField("name");
|
|
||||||
const [secondName, secondNameAttrs] = defineField("surname");
|
|
||||||
const [email, emailAttrs] = defineField("email");
|
|
||||||
const [phone, phoneAttrs] = defineField("phone");
|
|
||||||
const [query, queryAttrs] = defineField("query");
|
|
||||||
const [message, messageAttrs] = defineField("message");
|
|
||||||
const [terms, termsAttrs] = defineField("terms");
|
|
||||||
|
|
||||||
const onSubmit = handleSubmit((values) => {
|
|
||||||
handleQuestionData(values);
|
|
||||||
handleReset();
|
|
||||||
if (!terms.value) {
|
|
||||||
$q.notify({
|
|
||||||
color: "negative",
|
|
||||||
message: "Primero tienes que aceptar la licencia y las condiciones",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
=======
|
|
||||||
} = useQuestionForm();
|
} = useQuestionForm();
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isQuestionSubmitLoading,
|
isQuestionSubmitLoading,
|
||||||
|
|
|
@ -343,8 +343,6 @@ body {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
.tooltip {
|
.tooltip {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -386,7 +384,6 @@ body {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
//! QUASAR
|
//! QUASAR
|
||||||
.q-virtual-scroll__content .q-item .q-item__label {
|
.q-virtual-scroll__content .q-item .q-item__label {
|
||||||
font-family: $font-questrial;
|
font-family: $font-questrial;
|
||||||
|
|
|
@ -5,10 +5,7 @@ import { useForm } from "vee-validate";
|
||||||
import { computed, reactive, ref, watch } from "vue";
|
import { computed, reactive, ref, watch } from "vue";
|
||||||
|
|
||||||
import { apiBack } from "src/boot/axios";
|
import { apiBack } from "src/boot/axios";
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
import { quasarNotify } from "src/functions/quasarNotify";
|
import { quasarNotify } from "src/functions/quasarNotify";
|
||||||
>>>>>>> master
|
|
||||||
import { useFormStore } from "src/stores/forms";
|
import { useFormStore } from "src/stores/forms";
|
||||||
import { checkoutSchema } from "src/utils/zod/schemas";
|
import { checkoutSchema } from "src/utils/zod/schemas";
|
||||||
import { useLocalStorage } from "./useLocalStorage";
|
import { useLocalStorage } from "./useLocalStorage";
|
||||||
|
@ -71,11 +68,7 @@ export function useCheckoutForm() {
|
||||||
const { meta, errors, handleSubmit, defineField, resetForm } = useForm({
|
const { meta, errors, handleSubmit, defineField, resetForm } = useForm({
|
||||||
validationSchema: toTypedSchema(checkoutSchema),
|
validationSchema: toTypedSchema(checkoutSchema),
|
||||||
initialValues: {
|
initialValues: {
|
||||||
<<<<<<< HEAD
|
|
||||||
paymentMethod: "paypal",
|
|
||||||
=======
|
|
||||||
paymentMethod: "",
|
paymentMethod: "",
|
||||||
>>>>>>> master
|
|
||||||
terms: false,
|
terms: false,
|
||||||
postalCode: availabilityForm.value.postalCode || availability.postalCode,
|
postalCode: availabilityForm.value.postalCode || availability.postalCode,
|
||||||
phone: "",
|
phone: "",
|
||||||
|
@ -102,67 +95,6 @@ export function useCheckoutForm() {
|
||||||
const [paymentMethod, paymentMethodAttrs] = defineField("paymentMethod");
|
const [paymentMethod, paymentMethodAttrs] = defineField("paymentMethod");
|
||||||
const [terms, termsAttrs] = defineField("terms");
|
const [terms, termsAttrs] = defineField("terms");
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
|
|
||||||
//TODO hacer el await de las provincias
|
|
||||||
//const provinceOptions = getProvinces();
|
|
||||||
|
|
||||||
const provinceOptions = ref([
|
|
||||||
{ code: "01", name: "Araba/Álava" },
|
|
||||||
{ code: "02", name: "Albacete" },
|
|
||||||
{ code: "03", name: "Alicante/Alacant" },
|
|
||||||
{ code: "04", name: "Almería" },
|
|
||||||
{ code: "05", name: "Ávila" },
|
|
||||||
{ code: "06", name: "Badajoz" },
|
|
||||||
{ code: "07", name: "Balears, Illes" },
|
|
||||||
{ code: "08", name: "Barcelona" },
|
|
||||||
{ code: "09", name: "Burgos" },
|
|
||||||
{ code: "10", name: "Cáceres" },
|
|
||||||
{ code: "11", name: "Cádiz" },
|
|
||||||
{ code: "12", name: "Castellón/Castelló" },
|
|
||||||
{ code: "13", name: "Ciudad Real" },
|
|
||||||
{ code: "14", name: "Córdoba" },
|
|
||||||
{ code: "15", name: "Coruña, A" },
|
|
||||||
{ code: "16", name: "Cuenca" },
|
|
||||||
{ code: "17", name: "Girona" },
|
|
||||||
{ code: "18", name: "Granada" },
|
|
||||||
{ code: "19", name: "Guadalajara" },
|
|
||||||
{ code: "20", name: "Gipuzkoa" },
|
|
||||||
{ code: "21", name: "Huelva" },
|
|
||||||
{ code: "22", name: "Huesca" },
|
|
||||||
{ code: "23", name: "Jaén" },
|
|
||||||
{ code: "24", name: "León" },
|
|
||||||
{ code: "25", name: "Lleida" },
|
|
||||||
{ code: "26", name: "Rioja, La" },
|
|
||||||
{ code: "27", name: "Lugo" },
|
|
||||||
{ code: "28", name: "Madrid" },
|
|
||||||
{ code: "29", name: "Málaga" },
|
|
||||||
{ code: "30", name: "Murcia" },
|
|
||||||
{ code: "31", name: "Navarra" },
|
|
||||||
{ code: "32", name: "Ourense" },
|
|
||||||
{ code: "33", name: "Asturias" },
|
|
||||||
{ code: "34", name: "Palencia" },
|
|
||||||
{ code: "35", name: "Palmas, Las" },
|
|
||||||
{ code: "36", name: "Pontevedra" },
|
|
||||||
{ code: "37", name: "Salamanca" },
|
|
||||||
{ code: "38", name: "Santa Cruz de Tenerife" },
|
|
||||||
{ code: "39", name: "Cantabria" },
|
|
||||||
{ code: "40", name: "Segovia" },
|
|
||||||
{ code: "41", name: "Sevilla" },
|
|
||||||
{ code: "42", name: "Soria" },
|
|
||||||
{ code: "43", name: "Tarragona" },
|
|
||||||
{ code: "44", name: "Teruel" },
|
|
||||||
{ code: "45", name: "Toledo" },
|
|
||||||
{ code: "46", name: "Valencia/València" },
|
|
||||||
{ code: "47", name: "Valladolid" },
|
|
||||||
{ code: "48", name: "Bizkaia" },
|
|
||||||
{ code: "49", name: "Zamora" },
|
|
||||||
{ code: "50", name: "Zaragoza" },
|
|
||||||
{ code: "51", name: "Ceuta" },
|
|
||||||
{ code: "52", name: "Melilla" },
|
|
||||||
]);
|
|
||||||
=======
|
|
||||||
//! Tooltip hook
|
//! Tooltip hook
|
||||||
const { floatingStyles } = useFloating(postalCodeRef, postalCodeTooltip, {
|
const { floatingStyles } = useFloating(postalCodeRef, postalCodeTooltip, {
|
||||||
placement: "top-start",
|
placement: "top-start",
|
||||||
|
@ -194,7 +126,6 @@ export function useCheckoutForm() {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
const stepActive = reactive({ data: 1 });
|
const stepActive = reactive({ data: 1 });
|
||||||
const stepList = reactive({
|
const stepList = reactive({
|
||||||
data: [
|
data: [
|
||||||
|
@ -237,10 +168,6 @@ export function useCheckoutForm() {
|
||||||
|
|
||||||
const checkoutBlock = ref(true);
|
const checkoutBlock = ref(true);
|
||||||
const cart = getItem("cart");
|
const cart = getItem("cart");
|
||||||
<<<<<<< HEAD
|
|
||||||
const availability = getItem("availability");
|
|
||||||
=======
|
|
||||||
>>>>>>> master
|
|
||||||
const totalPrice = computed(() => {
|
const totalPrice = computed(() => {
|
||||||
return cart?.reduce((acc, { price }) => {
|
return cart?.reduce((acc, { price }) => {
|
||||||
if (price) {
|
if (price) {
|
||||||
|
@ -250,28 +177,6 @@ export function useCheckoutForm() {
|
||||||
}, 0);
|
}, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
const isLoadingSubmit = ref(false);
|
|
||||||
const isErrorSubmit = ref(false);
|
|
||||||
|
|
||||||
const onSuccess = async (values) => {
|
|
||||||
isLoadingSubmit.value = true;
|
|
||||||
stepsFormated.value[1].active = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const productsId = cart.map((item) => item.id);
|
|
||||||
|
|
||||||
const cartItensData = cart.map((item) => {
|
|
||||||
const { id, message, ...rest } = item;
|
|
||||||
|
|
||||||
if (message) {
|
|
||||||
return { id, message };
|
|
||||||
}
|
|
||||||
|
|
||||||
return { id, message: "" };
|
|
||||||
});
|
|
||||||
|
|
||||||
=======
|
|
||||||
const redsysData = ref({
|
const redsysData = ref({
|
||||||
Ds_MerchantParameters: "",
|
Ds_MerchantParameters: "",
|
||||||
Ds_Signature: "",
|
Ds_Signature: "",
|
||||||
|
@ -290,7 +195,6 @@ export function useCheckoutForm() {
|
||||||
* @returns {Promise<void>} - A promise that resolves when the payment method is fetched.
|
* @returns {Promise<void>} - A promise that resolves when the payment method is fetched.
|
||||||
*/
|
*/
|
||||||
const handleFetchPaymentMethod = async ({ type, values }) => {
|
const handleFetchPaymentMethod = async ({ type, values }) => {
|
||||||
console.log({ type, values });
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const productsId = cart.map((item) => item.id);
|
const productsId = cart.map((item) => item.id);
|
||||||
|
@ -298,16 +202,11 @@ export function useCheckoutForm() {
|
||||||
id,
|
id,
|
||||||
message: message || "",
|
message: message || "",
|
||||||
}));
|
}));
|
||||||
>>>>>>> master
|
|
||||||
const deliveryData = {
|
const deliveryData = {
|
||||||
customerData: {
|
customerData: {
|
||||||
custumerName: `${values.name} ${values.surname}`,
|
custumerName: `${values.name} ${values.surname}`,
|
||||||
email: values.senderEmail,
|
email: values.senderEmail,
|
||||||
<<<<<<< HEAD
|
|
||||||
custumerPhone: values.phone,
|
|
||||||
=======
|
|
||||||
custumerPhone: phoneData.value.number,
|
custumerPhone: phoneData.value.number,
|
||||||
>>>>>>> master
|
|
||||||
},
|
},
|
||||||
itemData: cartItensData,
|
itemData: cartItensData,
|
||||||
deliveryData: {
|
deliveryData: {
|
||||||
|
@ -315,33 +214,6 @@ export function useCheckoutForm() {
|
||||||
deliveryName: values.senderName,
|
deliveryName: values.senderName,
|
||||||
address: values.address,
|
address: values.address,
|
||||||
postalCode: availability.postalCode,
|
postalCode: availability.postalCode,
|
||||||
<<<<<<< HEAD
|
|
||||||
deliveryPhone: values.senderPhone,
|
|
||||||
deliveryMessage: values.senderNotes,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
addItem("costumer", deliveryData);
|
|
||||||
|
|
||||||
const productData = {
|
|
||||||
products: productsId,
|
|
||||||
price: totalPrice.value.toFixed(2).toString(),
|
|
||||||
};
|
|
||||||
|
|
||||||
const {
|
|
||||||
data: { data },
|
|
||||||
} = await apiBack.post("payment", productData);
|
|
||||||
|
|
||||||
isLoadingSubmit.value = false;
|
|
||||||
location.href = data;
|
|
||||||
removeItem("cart");
|
|
||||||
removeItem("availability");
|
|
||||||
} catch (error) {
|
|
||||||
console.error(`FATAL ERROR ::: ${error}`);
|
|
||||||
|
|
||||||
isErrorSubmit.value = true;
|
|
||||||
isLoadingSubmit.value = false;
|
|
||||||
} finally {
|
|
||||||
=======
|
|
||||||
deliveryPhone: phoneSenderData.value.number,
|
deliveryPhone: phoneSenderData.value.number,
|
||||||
deliveryMessage: values.senderNotes,
|
deliveryMessage: values.senderNotes,
|
||||||
},
|
},
|
||||||
|
@ -375,7 +247,6 @@ export function useCheckoutForm() {
|
||||||
const {
|
const {
|
||||||
data: { data },
|
data: { data },
|
||||||
} = await apiBack.post("payment", productData);
|
} = await apiBack.post("payment", productData);
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
location.href = data.link;
|
location.href = data.link;
|
||||||
},
|
},
|
||||||
|
@ -411,14 +282,11 @@ export function useCheckoutForm() {
|
||||||
isErrorSubmit.value = true;
|
isErrorSubmit.value = true;
|
||||||
} finally {
|
} finally {
|
||||||
isLoadingSubmit.value = false;
|
isLoadingSubmit.value = false;
|
||||||
>>>>>>> master
|
|
||||||
handleCheckoutData(values);
|
handleCheckoutData(values);
|
||||||
resetForm();
|
resetForm();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
const onSuccess = async (values, actions) => {
|
const onSuccess = async (values, actions) => {
|
||||||
const INVALID_NUMBER =
|
const INVALID_NUMBER =
|
||||||
"Número no válido introducido, por favor, compruébelo e inténtelo de nuevo";
|
"Número no válido introducido, por favor, compruébelo e inténtelo de nuevo";
|
||||||
|
@ -444,7 +312,6 @@ export function useCheckoutForm() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
const onSubmit = handleSubmit(onSuccess);
|
const onSubmit = handleSubmit(onSuccess);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -456,9 +323,6 @@ export function useCheckoutForm() {
|
||||||
cart,
|
cart,
|
||||||
totalPrice,
|
totalPrice,
|
||||||
isError,
|
isError,
|
||||||
<<<<<<< HEAD
|
|
||||||
onError,
|
|
||||||
=======
|
|
||||||
redsysData,
|
redsysData,
|
||||||
|
|
||||||
phoneInputRef,
|
phoneInputRef,
|
||||||
|
@ -478,7 +342,6 @@ export function useCheckoutForm() {
|
||||||
showTooltip,
|
showTooltip,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
>>>>>>> master
|
|
||||||
formState: {
|
formState: {
|
||||||
meta,
|
meta,
|
||||||
errors,
|
errors,
|
||||||
|
@ -516,4 +379,4 @@ export function useCheckoutForm() {
|
||||||
termsAttrs,
|
termsAttrs,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,24 +25,14 @@ import { useLocalStorage } from "./useLocalStorage";
|
||||||
*/
|
*/
|
||||||
export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
<<<<<<< HEAD
|
|
||||||
const { push, go } = useRouter();
|
|
||||||
const { addItem, getItem, removeItem } = useLocalStorage();
|
|
||||||
=======
|
|
||||||
const { push } = useRouter();
|
const { push } = useRouter();
|
||||||
const { addItem, getItem, removeItem } = useLocalStorage();
|
const { addItem, getItem, removeItem } = useLocalStorage();
|
||||||
|
|
||||||
const modalStore = useModalStore();
|
const modalStore = useModalStore();
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
const rangePriceStore = useRangePriceStore();
|
const rangePriceStore = useRangePriceStore();
|
||||||
const { rangeValue } = storeToRefs(rangePriceStore);
|
const { rangeValue } = storeToRefs(rangePriceStore);
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
const modalStore = useModalStore();
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> master
|
|
||||||
const formStore = useFormStore();
|
const formStore = useFormStore();
|
||||||
const { sortProductFilters, availability: availabilityForm } =
|
const { sortProductFilters, availability: availabilityForm } =
|
||||||
storeToRefs(formStore);
|
storeToRefs(formStore);
|
||||||
|
@ -54,33 +44,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
const min = 0;
|
const min = 0;
|
||||||
const max = 200;
|
const max = 200;
|
||||||
const category = ref(route.path.split("/")[2]);
|
const category = ref(route.path.split("/")[2]);
|
||||||
<<<<<<< HEAD
|
|
||||||
const availability = ref(getItem("availability"));
|
|
||||||
const isAvailabilityEmpty = computed(() => {
|
|
||||||
return Object.keys(availability.value).length === 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
const { handleSubmit, handleReset, defineField, errors, setValues } = useForm(
|
|
||||||
{
|
|
||||||
validateOnMount: false,
|
|
||||||
validationSchema: toTypedSchema(
|
|
||||||
type !== "filter" ? availabilitySchema : rangePriceSchema
|
|
||||||
),
|
|
||||||
initialValues: {
|
|
||||||
range: {
|
|
||||||
min,
|
|
||||||
max,
|
|
||||||
},
|
|
||||||
postalCode: "",
|
|
||||||
date: "",
|
|
||||||
},
|
|
||||||
initialTouched: {
|
|
||||||
date: false,
|
|
||||||
postalCode: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
=======
|
|
||||||
const categoryObj = {
|
const categoryObj = {
|
||||||
plantas: "Floranet Plantas",
|
plantas: "Floranet Plantas",
|
||||||
ramos: "Floranet Ramos",
|
ramos: "Floranet Ramos",
|
||||||
|
@ -139,7 +102,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
postalCode: true,
|
postalCode: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
validateOnBlur: false,
|
validateOnBlur: false,
|
||||||
|
@ -167,13 +129,10 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
watch([() => route.path, () => sortProductFilters.value], ([newPath]) => {
|
watch([() => route.path, () => sortProductFilters.value], ([newPath]) => {
|
||||||
const categoryPath = newPath.split("/")[2];
|
const categoryPath = newPath.split("/")[2];
|
||||||
category.value = categoryPath;
|
category.value = categoryPath;
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
availabilityForm.value.dateExpired = "";
|
availabilityForm.value.dateExpired = "";
|
||||||
availability.value.postalCode = "";
|
availability.value.postalCode = "";
|
||||||
sortProductFilters.value.isOpenOrderFilter = false;
|
sortProductFilters.value.isOpenOrderFilter = false;
|
||||||
sortProductFilters.value.order = undefined;
|
sortProductFilters.value.order = undefined;
|
||||||
>>>>>>> master
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const removeCart = () => {
|
const removeCart = () => {
|
||||||
|
@ -183,11 +142,7 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
|
|
||||||
const onSuccess = async (values) => {
|
const onSuccess = async (values) => {
|
||||||
const handleAvailability = async () => {
|
const handleAvailability = async () => {
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
console.log(type);
|
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
addItem("availability", {
|
addItem("availability", {
|
||||||
postalCode: values.postalCode,
|
postalCode: values.postalCode,
|
||||||
dateExpired: invertDate(values.date),
|
dateExpired: invertDate(values.date),
|
||||||
|
@ -197,17 +152,13 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
availabilityForm.value.postalCode = values.postalCode;
|
availabilityForm.value.postalCode = values.postalCode;
|
||||||
|
|
||||||
await getProducts({
|
await getProducts({
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
type: categoryObj[category.value],
|
type: categoryObj[category.value],
|
||||||
>>>>>>> master
|
|
||||||
postalCode: values.postalCode,
|
postalCode: values.postalCode,
|
||||||
dateExpired: invertDate(values.date),
|
dateExpired: invertDate(values.date),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHome = async () => {
|
const handleHome = async () => {
|
||||||
console.log(type);
|
|
||||||
|
|
||||||
addItem("availability", {
|
addItem("availability", {
|
||||||
postalCode: values.postalCode,
|
postalCode: values.postalCode,
|
||||||
|
@ -231,7 +182,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleProduct = async () => {
|
const handleProduct = async () => {
|
||||||
console.log(type);
|
|
||||||
|
|
||||||
addItem("availability", {
|
addItem("availability", {
|
||||||
postalCode: values.postalCode,
|
postalCode: values.postalCode,
|
||||||
|
@ -257,13 +207,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
|
|
||||||
const id = +route.path.split("/")[2];
|
const id = +route.path.split("/")[2];
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log(item.postalCode === values.postalCode);
|
|
||||||
console.log(item.id === id);
|
|
||||||
console.log(dateSelected <= dateExpired);
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> master
|
|
||||||
return (
|
return (
|
||||||
item.postalCode === values.postalCode &&
|
item.postalCode === values.postalCode &&
|
||||||
item.id === id &&
|
item.id === id &&
|
||||||
|
@ -286,7 +229,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFilter = async () => {
|
const handleFilter = async () => {
|
||||||
console.log(type);
|
|
||||||
|
|
||||||
rangeValue.value.max = values.range.max;
|
rangeValue.value.max = values.range.max;
|
||||||
rangeValue.value.min = values.range.min;
|
rangeValue.value.min = values.range.min;
|
||||||
|
@ -295,16 +237,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
type: categoryObj[category.value],
|
type: categoryObj[category.value],
|
||||||
minPrice: values.range.min,
|
minPrice: values.range.min,
|
||||||
maxPrice: values.range.max,
|
maxPrice: values.range.max,
|
||||||
<<<<<<< HEAD
|
|
||||||
};
|
|
||||||
console.log(params);
|
|
||||||
|
|
||||||
if (category.value === "all") {
|
|
||||||
params.postalCode = availability.value.postalCode;
|
|
||||||
params.dateExpired = availability.value.dateExpired;
|
|
||||||
|
|
||||||
const { type, ...rest } = params;
|
|
||||||
=======
|
|
||||||
postalCode: availabilityForm.value.postalCode,
|
postalCode: availabilityForm.value.postalCode,
|
||||||
dateExpired: availabilityForm.value.dateExpired,
|
dateExpired: availabilityForm.value.dateExpired,
|
||||||
};
|
};
|
||||||
|
@ -316,8 +248,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
availability.value.dateExpired || availabilityForm.value.dateExpired;
|
availability.value.dateExpired || availabilityForm.value.dateExpired;
|
||||||
|
|
||||||
const { type, ...rest } = params;
|
const { type, ...rest } = params;
|
||||||
console.log(rest);
|
|
||||||
>>>>>>> master
|
|
||||||
await getProducts({ ...rest });
|
await getProducts({ ...rest });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -367,15 +297,11 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||||
setValues,
|
setValues,
|
||||||
handleReset,
|
handleReset,
|
||||||
modalStore,
|
modalStore,
|
||||||
<<<<<<< HEAD
|
|
||||||
isAvailabilityEmpty,
|
|
||||||
=======
|
|
||||||
setFieldError,
|
setFieldError,
|
||||||
isAvailabilityEmpty,
|
isAvailabilityEmpty,
|
||||||
isPostalCalendarEmpty,
|
isPostalCalendarEmpty,
|
||||||
availabilityFormKeys,
|
availabilityFormKeys,
|
||||||
category,
|
category,
|
||||||
>>>>>>> master
|
|
||||||
fields: {
|
fields: {
|
||||||
calendar,
|
calendar,
|
||||||
calendarAttrs,
|
calendarAttrs,
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { computed, defineComponent, onBeforeMount, ref, watch } from "vue";
|
import { computed, defineComponent, onBeforeMount, ref, watch } from "vue";
|
||||||
<<<<<<< HEAD
|
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
=======
|
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
import SortSelect from "src/components/@inputs/SortSelect.vue";
|
import SortSelect from "src/components/@inputs/SortSelect.vue";
|
||||||
import IconArrowCircleFilledRight from "src/components/icons/IconArrowCircleFilledRight.vue";
|
import IconArrowCircleFilledRight from "src/components/icons/IconArrowCircleFilledRight.vue";
|
||||||
|
@ -44,10 +40,6 @@ export default defineComponent({
|
||||||
const { getItem } = useLocalStorage();
|
const { getItem } = useLocalStorage();
|
||||||
const { isAvailabilityEmpty } = usePostalCalendar({});
|
const { isAvailabilityEmpty } = usePostalCalendar({});
|
||||||
|
|
||||||
const { getItem } = useLocalStorage();
|
|
||||||
|
|
||||||
const { isAvailabilityEmpty } = usePostalCalendar({});
|
|
||||||
|
|
||||||
const mobileStore = useMobileStore();
|
const mobileStore = useMobileStore();
|
||||||
const { screenWidth } = storeToRefs(mobileStore);
|
const { screenWidth } = storeToRefs(mobileStore);
|
||||||
|
|
||||||
|
@ -167,11 +159,8 @@ export default defineComponent({
|
||||||
await getProducts(availabilityStoraged.value);
|
await getProducts(availabilityStoraged.value);
|
||||||
datePostalCode.value = availabilityStoraged.value;
|
datePostalCode.value = availabilityStoraged.value;
|
||||||
if (isAvailabilityEmpty.value) {
|
if (isAvailabilityEmpty.value) {
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
await push("/");
|
await push("/");
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
quasarNotify({
|
quasarNotify({
|
||||||
message: "Debes seleccionar una fecha y código postal",
|
message: "Debes seleccionar una fecha y código postal",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
<script>
|
<script>
|
||||||
import Container from "src/components/ui/Container.vue";
|
import Container from "src/components/ui/Container.vue";
|
||||||
import { useLocalStorage } from "src/hooks/useLocalStorage";
|
import { useLocalStorage } from "src/hooks/useLocalStorage";
|
||||||
|
@ -16,7 +14,6 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
<template>
|
<template>
|
||||||
<q-page class="checkout-error-page error-message">
|
<q-page class="checkout-error-page error-message">
|
||||||
<container>
|
<container>
|
||||||
|
@ -25,19 +22,6 @@ export default defineComponent({
|
||||||
</q-page>
|
</q-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
<script>
|
|
||||||
import Container from "src/components/ui/Container.vue";
|
|
||||||
import { defineComponent } from "vue";
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
name: "CheckoutErrorPage",
|
|
||||||
components: { Container },
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> master
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.checkout-error-page {
|
.checkout-error-page {
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,6 @@ export default defineComponent({
|
||||||
totalPrice,
|
totalPrice,
|
||||||
isError,
|
isError,
|
||||||
onError,
|
onError,
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
redsysData,
|
redsysData,
|
||||||
tooltip: {
|
tooltip: {
|
||||||
postalCode: {
|
postalCode: {
|
||||||
|
@ -35,7 +33,6 @@ export default defineComponent({
|
||||||
showTooltip,
|
showTooltip,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
>>>>>>> master
|
|
||||||
formState: { errors, meta, onSubmit, isLoadingSubmit },
|
formState: { errors, meta, onSubmit, isLoadingSubmit },
|
||||||
fields: {
|
fields: {
|
||||||
name,
|
name,
|
||||||
|
@ -474,82 +471,6 @@ export default defineComponent({
|
||||||
{{ name }}
|
{{ name }}
|
||||||
<span>{{ price }}€</span>
|
<span>{{ price }}€</span>
|
||||||
</p>
|
</p>
|
||||||
<<<<<<< HEAD
|
|
||||||
</q-radio> -->
|
|
||||||
|
|
||||||
<q-radio
|
|
||||||
v-model="paymentMethod"
|
|
||||||
v-bind="paymentMethodAttrs"
|
|
||||||
val="paypal"
|
|
||||||
color="primary"
|
|
||||||
>
|
|
||||||
<p>
|
|
||||||
Paypal
|
|
||||||
<!-- <a
|
|
||||||
href="https://www.paypal.com/br/digital-wallet/how-paypal-works"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>¿Qué es Paypal?</a
|
|
||||||
> -->
|
|
||||||
</p>
|
|
||||||
</q-radio>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="checkout-terms">
|
|
||||||
<q-checkbox v-model="terms" v-bind="termsAttrs" class="terms">
|
|
||||||
<p :style="!!errors.terms && 'color: red;'">
|
|
||||||
He leído y estoy de acuerdo con los términosy condiciones de
|
|
||||||
la tienda Floranet
|
|
||||||
</p>
|
|
||||||
</q-checkbox>
|
|
||||||
|
|
||||||
<q-btn
|
|
||||||
flat
|
|
||||||
class="btn"
|
|
||||||
type="submit"
|
|
||||||
form="checkout-form"
|
|
||||||
:loading="isLoadingSubmit"
|
|
||||||
>
|
|
||||||
PROCEDER AL PAGO
|
|
||||||
</q-btn>
|
|
||||||
</div>
|
|
||||||
</aside>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-else>
|
|
||||||
<div class="checkout-success" id="success-block">
|
|
||||||
<h6 class="checkout-success-title green-text">
|
|
||||||
Has efectuado la siguiente compra
|
|
||||||
</h6>
|
|
||||||
|
|
||||||
<div class="checkout-success-body">
|
|
||||||
<div class="checkout-success-content">
|
|
||||||
<ul class="checkout-success-list">
|
|
||||||
<li
|
|
||||||
v-for="({ name, price, image }, index) in cart"
|
|
||||||
:key="index"
|
|
||||||
class="checkout-success-item"
|
|
||||||
>
|
|
||||||
<div class="checkout-item-content">
|
|
||||||
<div class="checkout-product-details">
|
|
||||||
<img
|
|
||||||
:src="isError ? '../assets/empty-img.jpg' : image"
|
|
||||||
:alt="name"
|
|
||||||
class="checkout-product-img"
|
|
||||||
@error="onError"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<p class="checkout-product-title">
|
|
||||||
{{ name }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="checkout-product-price">{{ price }}€</p>
|
|
||||||
</div>
|
|
||||||
=======
|
|
||||||
>>>>>>> master
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,10 @@
|
||||||
<script>
|
<script>
|
||||||
<<<<<<< HEAD
|
|
||||||
import { apiBack } from "src/boot/axios";
|
|
||||||
import { useCheckoutForm } from "src/hooks/useCheckoutForm";
|
|
||||||
import { useLocalStorage } from "src/hooks/useLocalStorage";
|
|
||||||
import { defineComponent, onBeforeMount, reactive, ref } from "vue";
|
|
||||||
=======
|
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { apiBack } from "src/boot/axios";
|
import { apiBack } from "src/boot/axios";
|
||||||
import { useCheckoutForm } from "src/hooks/useCheckoutForm";
|
import { useCheckoutForm } from "src/hooks/useCheckoutForm";
|
||||||
import { useLocalStorage } from "src/hooks/useLocalStorage";
|
import { useLocalStorage } from "src/hooks/useLocalStorage";
|
||||||
import { useCartStore } from "src/stores/cart";
|
import { useCartStore } from "src/stores/cart";
|
||||||
import { defineComponent, onBeforeMount, ref } from "vue";
|
import { defineComponent, onBeforeMount, ref } from "vue";
|
||||||
>>>>>>> master
|
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -20,17 +13,6 @@ export default defineComponent({
|
||||||
const { query } = useRoute();
|
const { query } = useRoute();
|
||||||
const { push } = useRouter();
|
const { push } = useRouter();
|
||||||
const { getItem, removeItem } = useLocalStorage();
|
const { getItem, removeItem } = useLocalStorage();
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log(query);
|
|
||||||
const costumerData = getItem("costumer");
|
|
||||||
|
|
||||||
const productsPurchased = reactive({ data: [] });
|
|
||||||
const totalPrice = ref();
|
|
||||||
|
|
||||||
async function getSuccessData() {
|
|
||||||
try {
|
|
||||||
productsPurchased.data = await new Promise(async (resolve, reject) => {
|
|
||||||
=======
|
|
||||||
const cartStore = useCartStore();
|
const cartStore = useCartStore();
|
||||||
const { cart: cartStoreArr } = storeToRefs(cartStore);
|
const { cart: cartStoreArr } = storeToRefs(cartStore);
|
||||||
const cart = getItem("cart");
|
const cart = getItem("cart");
|
||||||
|
@ -45,17 +27,11 @@ export default defineComponent({
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await new Promise(async (resolve, reject) => {
|
await new Promise(async (resolve, reject) => {
|
||||||
>>>>>>> master
|
|
||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
data: { data },
|
data: { data },
|
||||||
} = await apiBack.post("payment/success", {
|
} = await apiBack.post("payment/success", {
|
||||||
<<<<<<< HEAD
|
|
||||||
// params: query,
|
|
||||||
data: JSON.stringify({ customer: costumerData, ...query }),
|
|
||||||
=======
|
|
||||||
...query,
|
...query,
|
||||||
>>>>>>> master
|
|
||||||
});
|
});
|
||||||
resolve(data.products);
|
resolve(data.products);
|
||||||
removeItem("costumer");
|
removeItem("costumer");
|
||||||
|
@ -63,14 +39,6 @@ export default defineComponent({
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
}).then((res) => res);
|
}).then((res) => res);
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
totalPrice.value = await productsPurchased.data.reduce(
|
|
||||||
(acc, { price }) => acc + Number(price),
|
|
||||||
0
|
|
||||||
);
|
|
||||||
=======
|
|
||||||
>>>>>>> master
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`FATAL ERROR ::: ${error}`);
|
console.error(`FATAL ERROR ::: ${error}`);
|
||||||
push("/checkout/error");
|
push("/checkout/error");
|
||||||
|
@ -78,30 +46,18 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
<<<<<<< HEAD
|
|
||||||
const queryObj = {
|
|
||||||
paymentId: query.paymentId,
|
|
||||||
=======
|
|
||||||
/* const queryObj = {
|
/* const queryObj = {
|
||||||
orderId: query.orderId,
|
orderId: query.orderId,
|
||||||
>>>>>>> master
|
|
||||||
productsIds: query.productsIds,
|
productsIds: query.productsIds,
|
||||||
PayerID: query.PayerID,
|
PayerID: query.PayerID,
|
||||||
};
|
};
|
||||||
for (const [_, value] of Object.entries(queryObj)) {
|
for (const [_, value] of Object.entries(queryObj)) {
|
||||||
if (!value) return push("/");
|
if (!value) return push("/");
|
||||||
<<<<<<< HEAD
|
|
||||||
}
|
|
||||||
|
|
||||||
await getSuccessData();
|
|
||||||
console.log(productsPurchased.data);
|
|
||||||
=======
|
|
||||||
} */
|
} */
|
||||||
|
|
||||||
if (cart.length === 0) return push("/");
|
if (cart.length === 0) return push("/");
|
||||||
|
|
||||||
await getSuccessData();
|
await getSuccessData();
|
||||||
>>>>>>> master
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const { isError, onError } = useCheckoutForm();
|
const { isError, onError } = useCheckoutForm();
|
||||||
|
@ -126,9 +82,6 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
return { isError, onError, steppers, productsPurchased, totalPrice };
|
|
||||||
=======
|
|
||||||
cartStoreArr.value = [];
|
cartStoreArr.value = [];
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
removeItem("cart");
|
removeItem("cart");
|
||||||
|
@ -136,7 +89,6 @@ export default defineComponent({
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
return { isError, onError, steppers, totalPrice, cart };
|
return { isError, onError, steppers, totalPrice, cart };
|
||||||
>>>>>>> master
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -185,11 +137,7 @@ export default defineComponent({
|
||||||
<div class="checkout-success-content">
|
<div class="checkout-success-content">
|
||||||
<ul class="checkout-success-list">
|
<ul class="checkout-success-list">
|
||||||
<li
|
<li
|
||||||
<<<<<<< HEAD
|
|
||||||
v-for="({ name, price, image }, index) in productsPurchased.data"
|
|
||||||
=======
|
|
||||||
v-for="({ name, price, image }, index) in cart"
|
v-for="({ name, price, image }, index) in cart"
|
||||||
>>>>>>> master
|
|
||||||
:key="index"
|
:key="index"
|
||||||
class="checkout-success-item"
|
class="checkout-success-item"
|
||||||
>
|
>
|
||||||
|
@ -215,11 +163,7 @@ export default defineComponent({
|
||||||
|
|
||||||
<footer class="checkout-success-footer">
|
<footer class="checkout-success-footer">
|
||||||
<p class="checkout-success-paragraph">Total</p>
|
<p class="checkout-success-paragraph">Total</p>
|
||||||
<<<<<<< HEAD
|
|
||||||
<p class="checkout-success-paragraph">{{ totalPrice }}€</p>
|
|
||||||
=======
|
|
||||||
<p class="checkout-success-paragraph">{{ totalPrice.toFixed(2) }}€</p>
|
<p class="checkout-success-paragraph">{{ totalPrice.toFixed(2) }}€</p>
|
||||||
>>>>>>> master
|
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { defineComponent, onBeforeMount } from "vue";
|
import { defineComponent, onBeforeMount, ref } from "vue";
|
||||||
|
|
||||||
import VerticalCarouselImgs from "src/components/quasar-components/carousel/VerticalCarouselImgs.vue";
|
import VerticalCarouselImgs from "src/components/quasar-components/carousel/VerticalCarouselImgs.vue";
|
||||||
import Swiper from "src/components/swiper/Swiper.vue";
|
import Swiper from "src/components/swiper/Swiper.vue";
|
||||||
|
@ -30,13 +30,23 @@ export default defineComponent({
|
||||||
await getProducts();
|
await getProducts();
|
||||||
});
|
});
|
||||||
|
|
||||||
const slidesContent = [
|
const slidesContent = ref([]);
|
||||||
"assets/1.jpg",
|
|
||||||
"assets/2.jpg",
|
onBeforeMount(async () => {
|
||||||
"assets/3.jpg",
|
const images = await new Promise((resolve) => {
|
||||||
"assets/4.jpg",
|
setTimeout(() => {
|
||||||
"assets/5.jpg",
|
resolve([
|
||||||
];
|
"assets/1.jpg",
|
||||||
|
"assets/2.jpg",
|
||||||
|
"assets/3.jpg",
|
||||||
|
"assets/4.jpg",
|
||||||
|
"assets/5.jpg",
|
||||||
|
]);
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
|
||||||
|
slidesContent.value = images;
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isCarouselVisible,
|
isCarouselVisible,
|
||||||
|
|
|
@ -49,11 +49,7 @@ export default defineComponent({
|
||||||
const { availability: availabilityForm } = storeToRefs(formStore);
|
const { availability: availabilityForm } = storeToRefs(formStore);
|
||||||
|
|
||||||
const availability = ref(getItem("availability"));
|
const availability = ref(getItem("availability"));
|
||||||
<<<<<<< HEAD
|
|
||||||
const filteredAvailabilityForm = computed(() => {
|
|
||||||
=======
|
|
||||||
const availabilityFormKeys = computed(() => {
|
const availabilityFormKeys = computed(() => {
|
||||||
>>>>>>> master
|
|
||||||
return Object.fromEntries(
|
return Object.fromEntries(
|
||||||
Object.entries(availabilityForm.value).filter(
|
Object.entries(availabilityForm.value).filter(
|
||||||
([key, value]) => value !== ""
|
([key, value]) => value !== ""
|
||||||
|
@ -63,13 +59,8 @@ export default defineComponent({
|
||||||
|
|
||||||
const isAvailabilityEmpty = computed(() => {
|
const isAvailabilityEmpty = computed(() => {
|
||||||
return (
|
return (
|
||||||
<<<<<<< HEAD
|
|
||||||
Object.keys(filteredAvailabilityForm.value || availability.value)
|
|
||||||
.length === 0
|
|
||||||
=======
|
|
||||||
Object.keys(availabilityFormKeys.value || availability.value).length ===
|
Object.keys(availabilityFormKeys.value || availability.value).length ===
|
||||||
0
|
0
|
||||||
>>>>>>> master
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -271,11 +262,7 @@ export default defineComponent({
|
||||||
:loading="addCartLoadingBtn"
|
:loading="addCartLoadingBtn"
|
||||||
color="primary"
|
color="primary"
|
||||||
class="btn sm-btn"
|
class="btn sm-btn"
|
||||||
<<<<<<< HEAD
|
|
||||||
label="AÑADIR AL CARRITO"
|
|
||||||
=======
|
|
||||||
label="COMPRAR"
|
label="COMPRAR"
|
||||||
>>>>>>> master
|
|
||||||
@click="addModal"
|
@click="addModal"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -37,23 +37,7 @@ export const useCartStore = defineStore("cart", () => {
|
||||||
//! Variables
|
//! Variables
|
||||||
const cart = ref(getItem("cart"));
|
const cart = ref(getItem("cart"));
|
||||||
const availability = ref(getItem("availability"));
|
const availability = ref(getItem("availability"));
|
||||||
<<<<<<< HEAD
|
|
||||||
const filteredAvailabilityForm = computed(() => {
|
|
||||||
return Object.fromEntries(
|
|
||||||
Object.entries(availabilityForm.value).filter(
|
|
||||||
([key, value]) => value !== ""
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
const isAvailabilityEmpty = computed(() => {
|
|
||||||
return (
|
|
||||||
Object.keys(filteredAvailabilityForm.value || availability.value)
|
|
||||||
.length === 0
|
|
||||||
);
|
|
||||||
});
|
|
||||||
=======
|
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
const addCartLoadingBtn = ref(false);
|
const addCartLoadingBtn = ref(false);
|
||||||
const routeId = ref(null);
|
const routeId = ref(null);
|
||||||
const products = ref({
|
const products = ref({
|
||||||
|
@ -225,10 +209,7 @@ export const useCartStore = defineStore("cart", () => {
|
||||||
type: "erro",
|
type: "erro",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
if (!products.value.data.some((item) => item.id === product.id)) {
|
if (!products.value.data.some((item) => item.id === product.id)) {
|
||||||
push("/");
|
push("/");
|
||||||
return quasarNotify({
|
return quasarNotify({
|
||||||
|
@ -249,11 +230,8 @@ export const useCartStore = defineStore("cart", () => {
|
||||||
arr.push({ ...product, message: message.value });
|
arr.push({ ...product, message: message.value });
|
||||||
cart.value = arr;
|
cart.value = arr;
|
||||||
addItem("cart", arr);
|
addItem("cart", arr);
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
|
|
||||||
await push("/checkout");
|
await push("/checkout");
|
||||||
>>>>>>> master
|
|
||||||
quasarNotify({
|
quasarNotify({
|
||||||
message: "Producto añadido al carrito.",
|
message: "Producto añadido al carrito.",
|
||||||
type: "success",
|
type: "success",
|
||||||
|
|
|
@ -18,17 +18,10 @@ const checkoutObjVal = {
|
||||||
.min(2, M.onlyMinimumTwoCharacters)
|
.min(2, M.onlyMinimumTwoCharacters)
|
||||||
.regex(R.justLetters, M.onlyTextMessage),
|
.regex(R.justLetters, M.onlyTextMessage),
|
||||||
province: z.string({ required_error: M.requiredMessage }),
|
province: z.string({ required_error: M.requiredMessage }),
|
||||||
<<<<<<< HEAD
|
|
||||||
phone: z
|
|
||||||
.string({ required_error: M.requiredMessage })
|
|
||||||
.refine(handlePhoneVal, M.phoneMessage),
|
|
||||||
senderName: z.string().regex(justLetters, M.nameMessage),
|
|
||||||
=======
|
|
||||||
phone: z.string({ required_error: M.requiredMessage }).refine((val) => {
|
phone: z.string({ required_error: M.requiredMessage }).refine((val) => {
|
||||||
return val.length > 0;
|
return val.length > 0;
|
||||||
}, M.requiredMessage),
|
}, M.requiredMessage),
|
||||||
senderName: z.string().regex(R.justLetters),
|
senderName: z.string().regex(R.justLetters),
|
||||||
>>>>>>> master
|
|
||||||
senderCifNif: z
|
senderCifNif: z
|
||||||
.string()
|
.string()
|
||||||
.regex(R.justLettersAndNumbers, M.onlyTextAndNumbersMessage),
|
.regex(R.justLettersAndNumbers, M.onlyTextAndNumbersMessage),
|
||||||
|
@ -37,17 +30,9 @@ const checkoutObjVal = {
|
||||||
return val.length >= 0;
|
return val.length >= 0;
|
||||||
}, M.phoneMessage),
|
}, M.phoneMessage),
|
||||||
senderNotes: z.string(),
|
senderNotes: z.string(),
|
||||||
<<<<<<< HEAD
|
|
||||||
paymentMethod: z
|
|
||||||
.enum(["credit", "paypal"], {
|
|
||||||
required_error: "Seleccione uno de los métodos de pago!",
|
|
||||||
})
|
|
||||||
.default("paypal"),
|
|
||||||
=======
|
|
||||||
paymentMethod: z.enum(["redsys", "paypal"], {
|
paymentMethod: z.enum(["redsys", "paypal"], {
|
||||||
required_error: "Seleccione uno de los métodos de pago!",
|
required_error: "Seleccione uno de los métodos de pago!",
|
||||||
}),
|
}),
|
||||||
>>>>>>> master
|
|
||||||
terms: z.boolean().refine((val) => {
|
terms: z.boolean().refine((val) => {
|
||||||
return val === true;
|
return val === true;
|
||||||
}, "Acepte las condiciones antes de continuar con la compra"),
|
}, "Acepte las condiciones antes de continuar con la compra"),
|
||||||
|
|
Loading…
Reference in New Issue