first commit antrean operasi
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import type { Productreview } from "@/types/apps/Editproducts";
|
||||
|
||||
import img1 from '@/assets/images/profile/user-11.jpg';
|
||||
import img2 from '@/assets/images/profile/user-8.jpg';
|
||||
import img3 from '@/assets/images/profile/user-3.jpg';
|
||||
import img4 from '@/assets/images/profile/user-4.jpg';
|
||||
import img5 from '@/assets/images/profile/user-5.jpg';
|
||||
import img6 from '@/assets/images/profile/user-6.jpg';
|
||||
import img7 from '@/assets/images/profile/user-7.jpg';
|
||||
import img8 from '@/assets/images/profile/user-10.jpg';
|
||||
|
||||
|
||||
const ProductreviewData: Productreview[] = [
|
||||
{
|
||||
review:5,
|
||||
image:img1,
|
||||
name: 'Sunil Joshi',
|
||||
comment:'I like this design',
|
||||
date:'1 day ago'
|
||||
},
|
||||
{
|
||||
review:4,
|
||||
image:img2,
|
||||
name: 'Mark Richard',
|
||||
comment:'Awesome quality with great materials used, but could be more comfortable',
|
||||
date:'11:20 PM'
|
||||
},
|
||||
{
|
||||
review:4.5,
|
||||
image:img3,
|
||||
name: 'Hanry Lord',
|
||||
comment:'This is the best product I have ever used.',
|
||||
date:'Today'
|
||||
},
|
||||
{
|
||||
review:3.5,
|
||||
image:img4,
|
||||
name: 'Britny Cox',
|
||||
comment:'Beautifully crafted. Worth every penny.',
|
||||
date:'Today'
|
||||
},
|
||||
{
|
||||
review:4,
|
||||
image:img5,
|
||||
name: 'Olvin wild',
|
||||
comment:'Awesome value for money. Shipping could be faster tho.',
|
||||
date:'12:00 PM'
|
||||
},
|
||||
{
|
||||
review:5,
|
||||
image:img6,
|
||||
name: 'Dan wilsed',
|
||||
comment:'Excellent quality, I got it for my sons birthday and he loved it',
|
||||
date:'1 May 2024'
|
||||
},
|
||||
{
|
||||
review:5,
|
||||
image:img7,
|
||||
name: 'Jon Miller',
|
||||
comment:'Firesale is on! Buy now! Totally worth it!',
|
||||
date:'25 April 2024'
|
||||
},
|
||||
{
|
||||
review:3.5,
|
||||
image:img8,
|
||||
name: 'Anaa Crown',
|
||||
comment:'Excellent quality, I got it for my sons birthday and he loved it',
|
||||
date:'1 May 2024'
|
||||
}
|
||||
];
|
||||
|
||||
export {ProductreviewData}
|
||||
@@ -0,0 +1,112 @@
|
||||
import mock from '../../mockAdapter';
|
||||
|
||||
// third-party
|
||||
import { add, sub } from 'date-fns';
|
||||
import { Chance } from 'chance';
|
||||
//Types
|
||||
import type { Address } from '@/types/apps/EcommerceType';
|
||||
|
||||
const chance = new Chance();
|
||||
|
||||
// billing address list
|
||||
let address: Address[] = [
|
||||
{
|
||||
id: 1,
|
||||
name: chance.name(),
|
||||
destination: 'Home',
|
||||
building: chance.address({ short_suffix: true }),
|
||||
city: chance.city(),
|
||||
state: chance.state({ full: true }),
|
||||
phone: chance.phone(),
|
||||
isDefault: true
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: chance.name(),
|
||||
destination: 'Office',
|
||||
building: chance.address({ short_suffix: true }),
|
||||
city: chance.city(),
|
||||
state: chance.state({ full: true }),
|
||||
phone: chance.phone(),
|
||||
isDefault: false
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: chance.name(),
|
||||
destination: 'Office',
|
||||
building: chance.address({ short_suffix: true }),
|
||||
city: chance.city(),
|
||||
state: chance.state({ full: true }),
|
||||
phone: chance.phone(),
|
||||
isDefault: false
|
||||
}
|
||||
];
|
||||
|
||||
// ==============================|| MOCK SERVICES ||============================== //
|
||||
|
||||
mock.onGet('/api/address/list').reply(() => {
|
||||
return [200, address];
|
||||
});
|
||||
|
||||
mock.onPost('/api/address/new').reply((request) => {
|
||||
try {
|
||||
const data = JSON.parse(request.data);
|
||||
const { name, destination, building, street, city, state, country, post, phone, isDefault } = data;
|
||||
const newAddress = {
|
||||
id: new Date(),
|
||||
name,
|
||||
destination,
|
||||
building,
|
||||
street,
|
||||
city,
|
||||
state,
|
||||
country,
|
||||
post,
|
||||
phone,
|
||||
isDefault
|
||||
};
|
||||
|
||||
if (isDefault) {
|
||||
address = address.map((item) => {
|
||||
if (item.isDefault === true) {
|
||||
return { ...item, isDefault: false };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
address = [...address, newAddress];
|
||||
|
||||
return [200, { address }];
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [500, { message: 'Internal server error' }];
|
||||
}
|
||||
});
|
||||
|
||||
mock.onPost('/api/address/edit').reply((request) => {
|
||||
try {
|
||||
const data = JSON.parse(request.data);
|
||||
|
||||
if (data.isDefault) {
|
||||
address = address.map((item) => {
|
||||
if (item.isDefault === true) {
|
||||
return { ...item, isDefault: false };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
address = address.map((item) => {
|
||||
if (item.id === data.id) {
|
||||
return data;
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
||||
return [200, { address }];
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [500, { message: 'Internal server error' }];
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
import './products';
|
||||
import './billing-address';
|
||||
@@ -0,0 +1,273 @@
|
||||
import mock from '../../mockAdapter';
|
||||
|
||||
// third-party
|
||||
import { add, sub } from 'date-fns';
|
||||
import { Chance } from 'chance';
|
||||
import product1 from '@/assets/images/products/s11.jpg';
|
||||
import product2 from '@/assets/images/products/s5.jpg';
|
||||
import product3 from '@/assets/images/products/s6.jpg';
|
||||
import product4 from '@/assets/images/products/s4.jpg';
|
||||
import product5 from '@/assets/images/products/s10.jpg';
|
||||
import product6 from '@/assets/images/products/s9.jpg';
|
||||
import product7 from '@/assets/images/products/s7.jpg';
|
||||
import product8 from '@/assets/images/products/s8.jpg';
|
||||
import product9 from '@/assets/images/products/s3.jpg';
|
||||
import product10 from '@/assets/images/products/s1.jpg';
|
||||
import product11 from '@/assets/images/products/s12.jpg';
|
||||
import product12 from '@/assets/images/products/s2.jpg';
|
||||
//Types
|
||||
import type { Products } from '@/types/apps/EcommerceType';
|
||||
|
||||
const chance = new Chance();
|
||||
// products list
|
||||
const products: Products[] = [
|
||||
{
|
||||
id: 1,
|
||||
image: product1,
|
||||
name: 'Super Games',
|
||||
description: chance.paragraph({ sentences: 1 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 25,
|
||||
salePrice: 180,
|
||||
offerPrice: 200,
|
||||
gender: 'kids',
|
||||
categories: ['fashion', 'toys','electronics'],
|
||||
colors: ['error', 'warning', 'primary', 'secondary'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: sub(new Date(), { days: 8, hours: 6, minutes: 20 }),
|
||||
isStock: true,
|
||||
qty: 1,
|
||||
rank:87,
|
||||
price:'200'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image: product2,
|
||||
name: 'Derma-E',
|
||||
description: chance.paragraph({ sentences: 2 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 10,
|
||||
salePrice: 81,
|
||||
offerPrice: 89,
|
||||
gender: 'kids',
|
||||
categories: ['fashion', 'female'],
|
||||
colors: ['lightprimary', 'success', 'lighterror', 'warning'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: sub(new Date(), { days: 10, hours: 8, minutes: 69 }),
|
||||
isStock: false,
|
||||
qty: 1,
|
||||
rank:87,
|
||||
price:'100'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image: product3,
|
||||
name: 'SockSoho',
|
||||
description: chance.paragraph({ sentences: 2 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 40,
|
||||
salePrice: 49,
|
||||
offerPrice: 59,
|
||||
gender: 'male',
|
||||
categories: ['fashion','kids'],
|
||||
colors: ['lightprimary', 'primary'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: sub(new Date(), { days: 4, hours: 9, minutes: 50 }),
|
||||
isStock: true,
|
||||
qty: 1,
|
||||
rank:50,
|
||||
price:'100'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
image: product4,
|
||||
name: 'Glossy Solution',
|
||||
description: chance.paragraph({ sentences: 2 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 17,
|
||||
salePrice: 29,
|
||||
offerPrice: 36,
|
||||
gender: 'kids',
|
||||
categories: ['fashion','female'],
|
||||
colors: ['error', 'warning', 'warning'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: sub(new Date(), { days: 7, hours: 6, minutes: 45 }),
|
||||
isStock: false,
|
||||
qty: 1,
|
||||
rank:90,
|
||||
price:'50'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
image: product5,
|
||||
name: 'Supercolor 645CL',
|
||||
description: chance.paragraph({ sentences: 2 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 20,
|
||||
salePrice: 12,
|
||||
offerPrice: 15,
|
||||
gender: 'male',
|
||||
categories: ['toys'],
|
||||
colors: ['warning', 'lightprimary'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: sub(new Date(), { days: 2, hours: 9, minutes: 45 }),
|
||||
isStock: true,
|
||||
qty: 1,
|
||||
rank:88,
|
||||
price:'50'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
image: product6,
|
||||
name: 'Orange Glass',
|
||||
description: chance.paragraph({ sentences: 2 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 13,
|
||||
salePrice: 86,
|
||||
offerPrice: 99,
|
||||
gender: 'female',
|
||||
categories: ['fashion', 'kitchen'],
|
||||
colors: ['primary', 'warning'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: add(new Date(), { days: 6, hours: 10, minutes: 0 }),
|
||||
isStock: true,
|
||||
qty: 1,
|
||||
rank:95,
|
||||
price:'100'
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
image: product7,
|
||||
name: 'Polraid One Step',
|
||||
description: chance.paragraph({ sentences: 2 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 15,
|
||||
salePrice: 16,
|
||||
offerPrice: 14.59,
|
||||
gender: 'female',
|
||||
categories: ['fashion'],
|
||||
colors: ['error', 'secondary', 'primary', 'warning'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: add(new Date(), { days: 14, hours: 1, minutes: 55 }),
|
||||
isStock: false,
|
||||
qty: 1,
|
||||
rank:60,
|
||||
price:'50'
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
image: product8,
|
||||
name: 'Colorful Camera',
|
||||
description: chance.paragraph({ sentences: 2 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 20,
|
||||
salePrice: 130,
|
||||
offerPrice: 105,
|
||||
gender: 'female',
|
||||
categories: ['toys'],
|
||||
colors: ['lightsuccess', 'primary', 'success'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: sub(new Date(), { days: 0, hours: 11, minutes: 10 }),
|
||||
isStock: true,
|
||||
qty: 1,
|
||||
rank:80,
|
||||
price:'151'
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
image: product9,
|
||||
name: 'Smart Watch',
|
||||
description: chance.paragraph({ sentences: 2 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 20,
|
||||
salePrice: 130,
|
||||
offerPrice: 160,
|
||||
gender: 'female',
|
||||
categories: ['toys','electronics'],
|
||||
colors: ['lightsuccess', 'primary', 'success'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: sub(new Date(), { days: 0, hours: 11, minutes: 10 }),
|
||||
isStock: true,
|
||||
qty: 1,
|
||||
rank:80,
|
||||
price:'252'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
image: product10,
|
||||
name: 'Curology Face wash',
|
||||
description: chance.paragraph({ sentences: 2 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 20,
|
||||
salePrice: 275,
|
||||
offerPrice: 350,
|
||||
gender: 'female',
|
||||
categories: ['toys'],
|
||||
colors: ['lightsuccess', 'primary', 'success'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: sub(new Date(), { days: 0, hours: 11, minutes: 10 }),
|
||||
isStock: true,
|
||||
qty: 1,
|
||||
rank:80,
|
||||
price:'275'
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
image: product11,
|
||||
name: 'Smart Game',
|
||||
description: chance.paragraph({ sentences: 2 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 20,
|
||||
salePrice: 10,
|
||||
offerPrice: 15,
|
||||
gender: 'female',
|
||||
categories: ['toys','electronics'],
|
||||
colors: ['lightsuccess', 'primary', 'success'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: sub(new Date(), { days: 0, hours: 11, minutes: 10 }),
|
||||
isStock: true,
|
||||
qty: 1,
|
||||
rank:80,
|
||||
price:'275'
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
image: product12,
|
||||
name: 'Body Lotion',
|
||||
description: chance.paragraph({ sentences: 2 }),
|
||||
rating: chance.floating({ min: 0.1, max: 5.0 }),
|
||||
discount: 20,
|
||||
salePrice: 89,
|
||||
offerPrice: 99,
|
||||
gender: 'female',
|
||||
categories: ['toys'],
|
||||
colors: ['lightsuccess', 'primary', 'success'],
|
||||
popularity: chance.natural(),
|
||||
date: chance.natural(),
|
||||
created: sub(new Date(), { days: 0, hours: 11, minutes: 10 }),
|
||||
isStock: true,
|
||||
qty: 1,
|
||||
rank:80,
|
||||
price:'275'
|
||||
}
|
||||
];
|
||||
|
||||
// ==============================|| MOCK SERVICES ||============================== //
|
||||
|
||||
// mock.onGet('/api/products/list').reply(200, { products });
|
||||
mock.onGet('/api/products/list').reply(() => {
|
||||
return [200, products];
|
||||
});
|
||||
|
||||
export default products;
|
||||
Reference in New Issue
Block a user