Arreglar problemillas con los merges
This commit is contained in:
parent
bfb66a7c0d
commit
5e7d4371db
|
@ -1,9 +1,4 @@
|
|||
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 {
|
||||
async findAll(req, res) {
|
||||
|
@ -78,7 +73,6 @@ class ProductController {
|
|||
}
|
||||
|
||||
if (Number(params.isNew)) {
|
||||
console.log(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)) {
|
||||
console.log(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();
|
12
api/db/db.js
12
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
|
||||
async function orderData_put(jsonOrderData) {
|
||||
const conn = await connect();
|
||||
<<<<<<< HEAD
|
||||
console.log(jsonOrderData);
|
||||
=======
|
||||
>>>>>>> master
|
||||
const [rows] = await conn.query(`CALL orderData_put(?)`, [jsonOrderData], (err, results) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
|
@ -39,9 +35,6 @@ async function orderData_put(jsonOrderData) {
|
|||
});
|
||||
return rows;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
async function order_confirm(orderFk) {
|
||||
const conn = await connect();
|
||||
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
|
||||
async function orderData_get() {
|
||||
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) {
|
||||
const conn = await connect();
|
||||
const [rows] = await conn.query(`CALL deliveryDate_get("${postalCode}")`);
|
||||
|
@ -85,4 +74,3 @@ async function contact_Request(name, phone, email, message) {
|
|||
|
||||
|
||||
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 path = require('path');
|
||||
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 paymengtController = require('./controller/Payment/payment.controller');
|
||||
const provincesController = require('./controller/Provinces/provinces.controller');
|
||||
const deliveryController = require('./controller/Delivery/delivery.controller');
|
||||
const contactController = require('./controller/Contact/contact.controller');
|
||||
>>>>>>> master
|
||||
|
||||
paypal.configure({
|
||||
'mode': 'sandbox',
|
||||
|
@ -50,13 +44,10 @@ app.post('/api/payment/', paymengtController.Create)
|
|||
app.post('/api/payment/success', paymengtController.Success)
|
||||
app.get('/api/payment/cancel', paymengtController.Cancel)
|
||||
app.get('/api/provinces', provincesController.findAll)
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
app.get('/api/delivery/dates', deliveryController.findByPostalCode)
|
||||
app.post('/api/contact/save', contactController.Create)
|
||||
|
||||
|
||||
>>>>>>> master
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Server listening at http://localhost:${port}`);
|
||||
|
|
|
@ -138,15 +138,9 @@
|
|||
}
|
||||
},
|
||||
"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",
|
||||
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.4.1.tgz",
|
||||
"integrity": "sha512-XQ3cU+Q8Uqmrbf2e0cIC/QN43sTBSC8KF12u29Mb47tWrt2hAgBXSgpZMj4Ao8Uk0iJcU99QsOCaIL8934obCg==",
|
||||
>>>>>>> master
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
|
|
|
@ -25,10 +25,7 @@
|
|||
"express": "^4.18.2",
|
||||
"fs": "^0.0.1-security",
|
||||
"mysql2": "^3.7.0",
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"node-redsys-api": "^0.0.5",
|
||||
>>>>>>> master
|
||||
"paypal-rest-sdk": "^1.8.1",
|
||||
"pinia": "^2.0.11",
|
||||
"quasar": "^2.6.0",
|
||||
|
|
|
@ -27,32 +27,9 @@ export default defineComponent({
|
|||
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) {
|
||||
emit("update:modelValue", value);
|
||||
}
|
||||
>>>>>>> master
|
||||
|
||||
onBeforeMount(() => {
|
||||
setValues({ date: invertDate(proxyDate.value) });
|
||||
|
@ -79,16 +56,10 @@ export default defineComponent({
|
|||
availability,
|
||||
postalCodeValid,
|
||||
proxyDate,
|
||||
<<<<<<< HEAD
|
||||
locale,
|
||||
updateProxy,
|
||||
optionsValidDates,
|
||||
=======
|
||||
LOCALE,
|
||||
updateProxy,
|
||||
optionsValidDates,
|
||||
updateModel,
|
||||
>>>>>>> master
|
||||
};
|
||||
},
|
||||
});
|
||||
|
@ -107,15 +78,9 @@ export default defineComponent({
|
|||
>
|
||||
<q-date
|
||||
v-model="proxyDate"
|
||||
<<<<<<< HEAD
|
||||
:options="optionsValidDates"
|
||||
:locale="locale"
|
||||
today-btn
|
||||
=======
|
||||
:options="postalCodeValid.dataOptions"
|
||||
:locale="LOCALE"
|
||||
:readonly="!postalCodeValid.isValid"
|
||||
>>>>>>> master
|
||||
mask="YYYY-MM-DD"
|
||||
>
|
||||
<div class="row items-center justify-end q-gutter-sm">
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<script>
|
||||
<<<<<<< HEAD
|
||||
import { defineComponent } from "vue";
|
||||
|
||||
=======
|
||||
import { storeToRefs } from "pinia";
|
||||
import { defineComponent, ref } from "vue";
|
||||
|
||||
|
@ -10,16 +6,10 @@ import { apiBack } from "src/boot/axios";
|
|||
import { quasarNotify } from "src/functions/quasarNotify";
|
||||
import { useFormStore } from "src/stores/forms";
|
||||
import * as M from "src/utils/zod/messages";
|
||||
>>>>>>> master
|
||||
import IconPostalCode from "../icons/IconPostalCode.vue";
|
||||
|
||||
export default defineComponent({
|
||||
name: "postal-code",
|
||||
<<<<<<< HEAD
|
||||
components: { IconPostalCode },
|
||||
setup() {
|
||||
return {};
|
||||
=======
|
||||
components: { IconPostalCode /* IconInfo, */ /* IconSearch */ },
|
||||
props: ["modelValue", "bindValue", "setFieldError"],
|
||||
setup({ setFieldError, modelValue }, { emit }) {
|
||||
|
@ -80,7 +70,6 @@ export default defineComponent({
|
|||
}
|
||||
|
||||
return { updateModel, onBlur, isPostalCodeLoading };
|
||||
>>>>>>> master
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
@ -95,9 +84,6 @@ export default defineComponent({
|
|||
<!-- <IconInfo /> -->
|
||||
</p>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<slot></slot>
|
||||
=======
|
||||
<q-input
|
||||
:model-value="modelValue"
|
||||
@update:model-value="updateModel"
|
||||
|
@ -110,7 +96,6 @@ export default defineComponent({
|
|||
dense
|
||||
@blur="onBlur"
|
||||
/>
|
||||
>>>>>>> master
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -74,44 +74,10 @@ export default defineComponent({
|
|||
<h1 class="carousel-header-title">
|
||||
Regala un verano lleno de flores y plantas
|
||||
</h1>
|
||||
<<<<<<< HEAD
|
||||
|
||||
<!-- <p class="carousel-header-paragraph"></p> -->
|
||||
=======
|
||||
>>>>>>> master
|
||||
</header>
|
||||
|
||||
<form @submit="onSubmit" class="carousel-content-body">
|
||||
<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
|
||||
v-model="postalCode"
|
||||
v-bind:bindValue="postalCodeAttrs"
|
||||
|
@ -125,7 +91,6 @@ export default defineComponent({
|
|||
v-bind:bindValue="calendarAttrs"
|
||||
:setValues="setValues"
|
||||
/>
|
||||
>>>>>>> master
|
||||
</div>
|
||||
|
||||
<q-btn type="submit" class="btn carousel-content-item">
|
||||
|
|
|
@ -128,33 +128,6 @@ export default defineComponent({
|
|||
v-if="modalItem === 'isOpenAvailability'"
|
||||
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
|
||||
v-model="postalCode"
|
||||
v-bind:bindValue="postalCodeAttrs"
|
||||
|
@ -166,7 +139,6 @@ export default defineComponent({
|
|||
v-bind:bindValue="calendarAttrs"
|
||||
:setValues="setValues"
|
||||
/>
|
||||
>>>>>>> master
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -27,30 +27,7 @@ export default defineComponent({
|
|||
terms,
|
||||
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();
|
||||
>>>>>>> master
|
||||
|
||||
return {
|
||||
isQuestionSubmitLoading,
|
||||
|
|
|
@ -343,8 +343,6 @@ body {
|
|||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
.tooltip {
|
||||
user-select: none;
|
||||
display: flex;
|
||||
|
@ -386,7 +384,6 @@ body {
|
|||
}
|
||||
}
|
||||
|
||||
>>>>>>> master
|
||||
//! QUASAR
|
||||
.q-virtual-scroll__content .q-item .q-item__label {
|
||||
font-family: $font-questrial;
|
||||
|
|
|
@ -5,10 +5,7 @@ import { useForm } from "vee-validate";
|
|||
import { computed, reactive, ref, watch } from "vue";
|
||||
|
||||
import { apiBack } from "src/boot/axios";
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import { quasarNotify } from "src/functions/quasarNotify";
|
||||
>>>>>>> master
|
||||
import { useFormStore } from "src/stores/forms";
|
||||
import { checkoutSchema } from "src/utils/zod/schemas";
|
||||
import { useLocalStorage } from "./useLocalStorage";
|
||||
|
@ -71,11 +68,7 @@ export function useCheckoutForm() {
|
|||
const { meta, errors, handleSubmit, defineField, resetForm } = useForm({
|
||||
validationSchema: toTypedSchema(checkoutSchema),
|
||||
initialValues: {
|
||||
<<<<<<< HEAD
|
||||
paymentMethod: "paypal",
|
||||
=======
|
||||
paymentMethod: "",
|
||||
>>>>>>> master
|
||||
terms: false,
|
||||
postalCode: availabilityForm.value.postalCode || availability.postalCode,
|
||||
phone: "",
|
||||
|
@ -102,67 +95,6 @@ export function useCheckoutForm() {
|
|||
const [paymentMethod, paymentMethodAttrs] = defineField("paymentMethod");
|
||||
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
|
||||
const { floatingStyles } = useFloating(postalCodeRef, postalCodeTooltip, {
|
||||
placement: "top-start",
|
||||
|
@ -194,7 +126,6 @@ export function useCheckoutForm() {
|
|||
}
|
||||
);
|
||||
|
||||
>>>>>>> master
|
||||
const stepActive = reactive({ data: 1 });
|
||||
const stepList = reactive({
|
||||
data: [
|
||||
|
@ -237,10 +168,6 @@ export function useCheckoutForm() {
|
|||
|
||||
const checkoutBlock = ref(true);
|
||||
const cart = getItem("cart");
|
||||
<<<<<<< HEAD
|
||||
const availability = getItem("availability");
|
||||
=======
|
||||
>>>>>>> master
|
||||
const totalPrice = computed(() => {
|
||||
return cart?.reduce((acc, { price }) => {
|
||||
if (price) {
|
||||
|
@ -250,28 +177,6 @@ export function useCheckoutForm() {
|
|||
}, 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({
|
||||
Ds_MerchantParameters: "",
|
||||
Ds_Signature: "",
|
||||
|
@ -290,7 +195,6 @@ export function useCheckoutForm() {
|
|||
* @returns {Promise<void>} - A promise that resolves when the payment method is fetched.
|
||||
*/
|
||||
const handleFetchPaymentMethod = async ({ type, values }) => {
|
||||
console.log({ type, values });
|
||||
|
||||
try {
|
||||
const productsId = cart.map((item) => item.id);
|
||||
|
@ -298,16 +202,11 @@ export function useCheckoutForm() {
|
|||
id,
|
||||
message: message || "",
|
||||
}));
|
||||
>>>>>>> master
|
||||
const deliveryData = {
|
||||
customerData: {
|
||||
custumerName: `${values.name} ${values.surname}`,
|
||||
email: values.senderEmail,
|
||||
<<<<<<< HEAD
|
||||
custumerPhone: values.phone,
|
||||
=======
|
||||
custumerPhone: phoneData.value.number,
|
||||
>>>>>>> master
|
||||
},
|
||||
itemData: cartItensData,
|
||||
deliveryData: {
|
||||
|
@ -315,33 +214,6 @@ export function useCheckoutForm() {
|
|||
deliveryName: values.senderName,
|
||||
address: values.address,
|
||||
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,
|
||||
deliveryMessage: values.senderNotes,
|
||||
},
|
||||
|
@ -375,7 +247,6 @@ export function useCheckoutForm() {
|
|||
const {
|
||||
data: { data },
|
||||
} = await apiBack.post("payment", productData);
|
||||
console.log(data);
|
||||
|
||||
location.href = data.link;
|
||||
},
|
||||
|
@ -411,14 +282,11 @@ export function useCheckoutForm() {
|
|||
isErrorSubmit.value = true;
|
||||
} finally {
|
||||
isLoadingSubmit.value = false;
|
||||
>>>>>>> master
|
||||
handleCheckoutData(values);
|
||||
resetForm();
|
||||
}
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
const onSuccess = async (values, actions) => {
|
||||
const INVALID_NUMBER =
|
||||
"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);
|
||||
|
||||
return {
|
||||
|
@ -456,9 +323,6 @@ export function useCheckoutForm() {
|
|||
cart,
|
||||
totalPrice,
|
||||
isError,
|
||||
<<<<<<< HEAD
|
||||
onError,
|
||||
=======
|
||||
redsysData,
|
||||
|
||||
phoneInputRef,
|
||||
|
@ -478,7 +342,6 @@ export function useCheckoutForm() {
|
|||
showTooltip,
|
||||
},
|
||||
},
|
||||
>>>>>>> master
|
||||
formState: {
|
||||
meta,
|
||||
errors,
|
||||
|
|
|
@ -25,24 +25,14 @@ import { useLocalStorage } from "./useLocalStorage";
|
|||
*/
|
||||
export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
||||
const route = useRoute();
|
||||
<<<<<<< HEAD
|
||||
const { push, go } = useRouter();
|
||||
const { addItem, getItem, removeItem } = useLocalStorage();
|
||||
=======
|
||||
const { push } = useRouter();
|
||||
const { addItem, getItem, removeItem } = useLocalStorage();
|
||||
|
||||
const modalStore = useModalStore();
|
||||
>>>>>>> master
|
||||
|
||||
const rangePriceStore = useRangePriceStore();
|
||||
const { rangeValue } = storeToRefs(rangePriceStore);
|
||||
|
||||
<<<<<<< HEAD
|
||||
const modalStore = useModalStore();
|
||||
|
||||
=======
|
||||
>>>>>>> master
|
||||
const formStore = useFormStore();
|
||||
const { sortProductFilters, availability: availabilityForm } =
|
||||
storeToRefs(formStore);
|
||||
|
@ -54,33 +44,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
|||
const min = 0;
|
||||
const max = 200;
|
||||
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 = {
|
||||
plantas: "Floranet Plantas",
|
||||
ramos: "Floranet Ramos",
|
||||
|
@ -139,7 +102,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
|||
postalCode: true,
|
||||
},
|
||||
});
|
||||
>>>>>>> master
|
||||
|
||||
const options = {
|
||||
validateOnBlur: false,
|
||||
|
@ -167,13 +129,10 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
|||
watch([() => route.path, () => sortProductFilters.value], ([newPath]) => {
|
||||
const categoryPath = newPath.split("/")[2];
|
||||
category.value = categoryPath;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
availabilityForm.value.dateExpired = "";
|
||||
availability.value.postalCode = "";
|
||||
sortProductFilters.value.isOpenOrderFilter = false;
|
||||
sortProductFilters.value.order = undefined;
|
||||
>>>>>>> master
|
||||
});
|
||||
|
||||
const removeCart = () => {
|
||||
|
@ -183,11 +142,7 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
|||
|
||||
const onSuccess = async (values) => {
|
||||
const handleAvailability = async () => {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
console.log(type);
|
||||
|
||||
>>>>>>> master
|
||||
addItem("availability", {
|
||||
postalCode: values.postalCode,
|
||||
dateExpired: invertDate(values.date),
|
||||
|
@ -197,17 +152,13 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
|||
availabilityForm.value.postalCode = values.postalCode;
|
||||
|
||||
await getProducts({
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
type: categoryObj[category.value],
|
||||
>>>>>>> master
|
||||
postalCode: values.postalCode,
|
||||
dateExpired: invertDate(values.date),
|
||||
});
|
||||
};
|
||||
|
||||
const handleHome = async () => {
|
||||
console.log(type);
|
||||
|
||||
addItem("availability", {
|
||||
postalCode: values.postalCode,
|
||||
|
@ -231,7 +182,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
|||
};
|
||||
|
||||
const handleProduct = async () => {
|
||||
console.log(type);
|
||||
|
||||
addItem("availability", {
|
||||
postalCode: values.postalCode,
|
||||
|
@ -257,13 +207,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
|||
|
||||
const id = +route.path.split("/")[2];
|
||||
|
||||
<<<<<<< HEAD
|
||||
console.log(item.postalCode === values.postalCode);
|
||||
console.log(item.id === id);
|
||||
console.log(dateSelected <= dateExpired);
|
||||
|
||||
=======
|
||||
>>>>>>> master
|
||||
return (
|
||||
item.postalCode === values.postalCode &&
|
||||
item.id === id &&
|
||||
|
@ -286,7 +229,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
|||
};
|
||||
|
||||
const handleFilter = async () => {
|
||||
console.log(type);
|
||||
|
||||
rangeValue.value.max = values.range.max;
|
||||
rangeValue.value.min = values.range.min;
|
||||
|
@ -295,16 +237,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
|||
type: categoryObj[category.value],
|
||||
minPrice: values.range.min,
|
||||
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,
|
||||
dateExpired: availabilityForm.value.dateExpired,
|
||||
};
|
||||
|
@ -316,8 +248,6 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
|||
availability.value.dateExpired || availabilityForm.value.dateExpired;
|
||||
|
||||
const { type, ...rest } = params;
|
||||
console.log(rest);
|
||||
>>>>>>> master
|
||||
await getProducts({ ...rest });
|
||||
return;
|
||||
}
|
||||
|
@ -367,15 +297,11 @@ export function usePostalCalendar({ modalItem = "", type = "home" }) {
|
|||
setValues,
|
||||
handleReset,
|
||||
modalStore,
|
||||
<<<<<<< HEAD
|
||||
isAvailabilityEmpty,
|
||||
=======
|
||||
setFieldError,
|
||||
isAvailabilityEmpty,
|
||||
isPostalCalendarEmpty,
|
||||
availabilityFormKeys,
|
||||
category,
|
||||
>>>>>>> master
|
||||
fields: {
|
||||
calendar,
|
||||
calendarAttrs,
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
<script>
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed, defineComponent, onBeforeMount, ref, watch } from "vue";
|
||||
<<<<<<< HEAD
|
||||
import { useRoute } from "vue-router";
|
||||
=======
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
>>>>>>> master
|
||||
|
||||
import SortSelect from "src/components/@inputs/SortSelect.vue";
|
||||
import IconArrowCircleFilledRight from "src/components/icons/IconArrowCircleFilledRight.vue";
|
||||
|
@ -44,10 +40,6 @@ export default defineComponent({
|
|||
const { getItem } = useLocalStorage();
|
||||
const { isAvailabilityEmpty } = usePostalCalendar({});
|
||||
|
||||
const { getItem } = useLocalStorage();
|
||||
|
||||
const { isAvailabilityEmpty } = usePostalCalendar({});
|
||||
|
||||
const mobileStore = useMobileStore();
|
||||
const { screenWidth } = storeToRefs(mobileStore);
|
||||
|
||||
|
@ -167,11 +159,8 @@ export default defineComponent({
|
|||
await getProducts(availabilityStoraged.value);
|
||||
datePostalCode.value = availabilityStoraged.value;
|
||||
if (isAvailabilityEmpty.value) {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
await push("/");
|
||||
|
||||
>>>>>>> master
|
||||
quasarNotify({
|
||||
message: "Debes seleccionar una fecha y código postal",
|
||||
type: "warning",
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
=======
|
||||
<script>
|
||||
import Container from "src/components/ui/Container.vue";
|
||||
import { useLocalStorage } from "src/hooks/useLocalStorage";
|
||||
|
@ -16,7 +14,6 @@ export default defineComponent({
|
|||
});
|
||||
</script>
|
||||
|
||||
>>>>>>> master
|
||||
<template>
|
||||
<q-page class="checkout-error-page error-message">
|
||||
<container>
|
||||
|
@ -25,19 +22,6 @@ export default defineComponent({
|
|||
</q-page>
|
||||
</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>
|
||||
.checkout-error-page {
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ export default defineComponent({
|
|||
totalPrice,
|
||||
isError,
|
||||
onError,
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
redsysData,
|
||||
tooltip: {
|
||||
postalCode: {
|
||||
|
@ -35,7 +33,6 @@ export default defineComponent({
|
|||
showTooltip,
|
||||
},
|
||||
},
|
||||
>>>>>>> master
|
||||
formState: { errors, meta, onSubmit, isLoadingSubmit },
|
||||
fields: {
|
||||
name,
|
||||
|
@ -474,82 +471,6 @@ export default defineComponent({
|
|||
{{ name }}
|
||||
<span>{{ price }}€</span>
|
||||
</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>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -1,17 +1,10 @@
|
|||
<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 { apiBack } from "src/boot/axios";
|
||||
import { useCheckoutForm } from "src/hooks/useCheckoutForm";
|
||||
import { useLocalStorage } from "src/hooks/useLocalStorage";
|
||||
import { useCartStore } from "src/stores/cart";
|
||||
import { defineComponent, onBeforeMount, ref } from "vue";
|
||||
>>>>>>> master
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
export default defineComponent({
|
||||
|
@ -20,17 +13,6 @@ export default defineComponent({
|
|||
const { query } = useRoute();
|
||||
const { push } = useRouter();
|
||||
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 { cart: cartStoreArr } = storeToRefs(cartStore);
|
||||
const cart = getItem("cart");
|
||||
|
@ -45,17 +27,11 @@ export default defineComponent({
|
|||
|
||||
try {
|
||||
await new Promise(async (resolve, reject) => {
|
||||
>>>>>>> master
|
||||
try {
|
||||
const {
|
||||
data: { data },
|
||||
} = await apiBack.post("payment/success", {
|
||||
<<<<<<< HEAD
|
||||
// params: query,
|
||||
data: JSON.stringify({ customer: costumerData, ...query }),
|
||||
=======
|
||||
...query,
|
||||
>>>>>>> master
|
||||
});
|
||||
resolve(data.products);
|
||||
removeItem("costumer");
|
||||
|
@ -63,14 +39,6 @@ export default defineComponent({
|
|||
reject(error);
|
||||
}
|
||||
}).then((res) => res);
|
||||
<<<<<<< HEAD
|
||||
|
||||
totalPrice.value = await productsPurchased.data.reduce(
|
||||
(acc, { price }) => acc + Number(price),
|
||||
0
|
||||
);
|
||||
=======
|
||||
>>>>>>> master
|
||||
} catch (error) {
|
||||
console.error(`FATAL ERROR ::: ${error}`);
|
||||
push("/checkout/error");
|
||||
|
@ -78,30 +46,18 @@ export default defineComponent({
|
|||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
<<<<<<< HEAD
|
||||
const queryObj = {
|
||||
paymentId: query.paymentId,
|
||||
=======
|
||||
/* const queryObj = {
|
||||
orderId: query.orderId,
|
||||
>>>>>>> master
|
||||
productsIds: query.productsIds,
|
||||
PayerID: query.PayerID,
|
||||
};
|
||||
for (const [_, value] of Object.entries(queryObj)) {
|
||||
if (!value) return push("/");
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
|
||||
await getSuccessData();
|
||||
console.log(productsPurchased.data);
|
||||
=======
|
||||
} */
|
||||
|
||||
if (cart.length === 0) return push("/");
|
||||
|
||||
await getSuccessData();
|
||||
>>>>>>> master
|
||||
});
|
||||
|
||||
const { isError, onError } = useCheckoutForm();
|
||||
|
@ -126,9 +82,6 @@ export default defineComponent({
|
|||
},
|
||||
];
|
||||
|
||||
<<<<<<< HEAD
|
||||
return { isError, onError, steppers, productsPurchased, totalPrice };
|
||||
=======
|
||||
cartStoreArr.value = [];
|
||||
setTimeout(() => {
|
||||
removeItem("cart");
|
||||
|
@ -136,7 +89,6 @@ export default defineComponent({
|
|||
}, 5000);
|
||||
|
||||
return { isError, onError, steppers, totalPrice, cart };
|
||||
>>>>>>> master
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
@ -185,11 +137,7 @@ export default defineComponent({
|
|||
<div class="checkout-success-content">
|
||||
<ul class="checkout-success-list">
|
||||
<li
|
||||
<<<<<<< HEAD
|
||||
v-for="({ name, price, image }, index) in productsPurchased.data"
|
||||
=======
|
||||
v-for="({ name, price, image }, index) in cart"
|
||||
>>>>>>> master
|
||||
:key="index"
|
||||
class="checkout-success-item"
|
||||
>
|
||||
|
@ -215,11 +163,7 @@ export default defineComponent({
|
|||
|
||||
<footer class="checkout-success-footer">
|
||||
<p class="checkout-success-paragraph">Total</p>
|
||||
<<<<<<< HEAD
|
||||
<p class="checkout-success-paragraph">{{ totalPrice }}€</p>
|
||||
=======
|
||||
<p class="checkout-success-paragraph">{{ totalPrice.toFixed(2) }}€</p>
|
||||
>>>>>>> master
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
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 Swiper from "src/components/swiper/Swiper.vue";
|
||||
|
@ -30,13 +30,23 @@ export default defineComponent({
|
|||
await getProducts();
|
||||
});
|
||||
|
||||
const slidesContent = [
|
||||
"assets/1.jpg",
|
||||
"assets/2.jpg",
|
||||
"assets/3.jpg",
|
||||
"assets/4.jpg",
|
||||
"assets/5.jpg",
|
||||
];
|
||||
const slidesContent = ref([]);
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const images = await new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve([
|
||||
"assets/1.jpg",
|
||||
"assets/2.jpg",
|
||||
"assets/3.jpg",
|
||||
"assets/4.jpg",
|
||||
"assets/5.jpg",
|
||||
]);
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
slidesContent.value = images;
|
||||
});
|
||||
|
||||
return {
|
||||
isCarouselVisible,
|
||||
|
|
|
@ -49,11 +49,7 @@ export default defineComponent({
|
|||
const { availability: availabilityForm } = storeToRefs(formStore);
|
||||
|
||||
const availability = ref(getItem("availability"));
|
||||
<<<<<<< HEAD
|
||||
const filteredAvailabilityForm = computed(() => {
|
||||
=======
|
||||
const availabilityFormKeys = computed(() => {
|
||||
>>>>>>> master
|
||||
return Object.fromEntries(
|
||||
Object.entries(availabilityForm.value).filter(
|
||||
([key, value]) => value !== ""
|
||||
|
@ -63,13 +59,8 @@ export default defineComponent({
|
|||
|
||||
const isAvailabilityEmpty = computed(() => {
|
||||
return (
|
||||
<<<<<<< HEAD
|
||||
Object.keys(filteredAvailabilityForm.value || availability.value)
|
||||
.length === 0
|
||||
=======
|
||||
Object.keys(availabilityFormKeys.value || availability.value).length ===
|
||||
0
|
||||
>>>>>>> master
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -271,11 +262,7 @@ export default defineComponent({
|
|||
:loading="addCartLoadingBtn"
|
||||
color="primary"
|
||||
class="btn sm-btn"
|
||||
<<<<<<< HEAD
|
||||
label="AÑADIR AL CARRITO"
|
||||
=======
|
||||
label="COMPRAR"
|
||||
>>>>>>> master
|
||||
@click="addModal"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -37,23 +37,7 @@ export const useCartStore = defineStore("cart", () => {
|
|||
//! Variables
|
||||
const cart = ref(getItem("cart"));
|
||||
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 routeId = ref(null);
|
||||
const products = ref({
|
||||
|
@ -225,10 +209,7 @@ export const useCartStore = defineStore("cart", () => {
|
|||
type: "erro",
|
||||
});
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> master
|
||||
if (!products.value.data.some((item) => item.id === product.id)) {
|
||||
push("/");
|
||||
return quasarNotify({
|
||||
|
@ -249,11 +230,8 @@ export const useCartStore = defineStore("cart", () => {
|
|||
arr.push({ ...product, message: message.value });
|
||||
cart.value = arr;
|
||||
addItem("cart", arr);
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
await push("/checkout");
|
||||
>>>>>>> master
|
||||
quasarNotify({
|
||||
message: "Producto añadido al carrito.",
|
||||
type: "success",
|
||||
|
|
|
@ -18,17 +18,10 @@ const checkoutObjVal = {
|
|||
.min(2, M.onlyMinimumTwoCharacters)
|
||||
.regex(R.justLetters, M.onlyTextMessage),
|
||||
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) => {
|
||||
return val.length > 0;
|
||||
}, M.requiredMessage),
|
||||
senderName: z.string().regex(R.justLetters),
|
||||
>>>>>>> master
|
||||
senderCifNif: z
|
||||
.string()
|
||||
.regex(R.justLettersAndNumbers, M.onlyTextAndNumbersMessage),
|
||||
|
@ -37,17 +30,9 @@ const checkoutObjVal = {
|
|||
return val.length >= 0;
|
||||
}, M.phoneMessage),
|
||||
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"], {
|
||||
required_error: "Seleccione uno de los métodos de pago!",
|
||||
}),
|
||||
>>>>>>> master
|
||||
terms: z.boolean().refine((val) => {
|
||||
return val === true;
|
||||
}, "Acepte las condiciones antes de continuar con la compra"),
|
||||
|
|
Loading…
Reference in New Issue