first commit
This commit is contained in:
288
_mockApis/apps/blog/index.ts
Executable file
288
_mockApis/apps/blog/index.ts
Executable file
@@ -0,0 +1,288 @@
|
||||
import { Chance } from 'chance';
|
||||
import { random } from 'lodash';
|
||||
import { sub } from 'date-fns';
|
||||
import mock from '../../mockAdapter';
|
||||
import s1 from '@/assets/images/blog/blog-img1.jpg';
|
||||
import s2 from '@/assets/images/blog/blog-img2.jpg';
|
||||
import s3 from '@/assets/images/blog/blog-img3.jpg';
|
||||
import s4 from '@/assets/images/blog/blog-img4.jpg';
|
||||
import s5 from '@/assets/images/blog/blog-img5.jpg';
|
||||
import s6 from '@/assets/images/blog/blog-img6.jpg';
|
||||
import s7 from '@/assets/images/blog/blog-img11.jpg';
|
||||
import s8 from '@/assets/images/blog/blog-img8.jpg';
|
||||
import s9 from '@/assets/images/blog/blog-img9.jpg';
|
||||
import s10 from '@/assets/images/blog/blog-img10.jpg';
|
||||
|
||||
import user1 from '@/assets/images/profile/user-6.jpg';
|
||||
import user2 from '@/assets/images/profile/user-2.jpg';
|
||||
import user3 from '@/assets/images/profile/user-3.jpg';
|
||||
import user4 from '@/assets/images/profile/user-4.jpg';
|
||||
import user5 from '@/assets/images/profile/user-5.jpg';
|
||||
import user6 from '@/assets/images/profile/user-8.jpg';
|
||||
import { uniqueId } from 'lodash';
|
||||
|
||||
import type { blogType, blogpostType } from '@/types/apps/BlogTypes';
|
||||
|
||||
const chance = new Chance();
|
||||
|
||||
const BlogComment: blogType[] = [
|
||||
{
|
||||
id: uniqueId('#comm_'),
|
||||
profile: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user2,
|
||||
name: chance.name()
|
||||
},
|
||||
time: chance.date(),
|
||||
comment: chance.paragraph({ sentences: 2 }),
|
||||
replies: []
|
||||
},
|
||||
{
|
||||
id: uniqueId('#comm_'),
|
||||
profile: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user3,
|
||||
name: chance.name()
|
||||
},
|
||||
time: chance.date(),
|
||||
comment: chance.paragraph({ sentences: 2 }),
|
||||
replies: [
|
||||
{
|
||||
id: uniqueId('#comm_'),
|
||||
profile: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user3,
|
||||
name: chance.name()
|
||||
},
|
||||
time: chance.date(),
|
||||
comment: chance.paragraph({ sentences: 2 })
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: uniqueId('#comm_'),
|
||||
profile: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user5,
|
||||
name: chance.name()
|
||||
},
|
||||
time: chance.date(),
|
||||
comment: chance.paragraph({ sentences: 2 }),
|
||||
replies: []
|
||||
}
|
||||
];
|
||||
|
||||
const BlogPost: blogpostType[] = [
|
||||
{
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
title: 'Garmins Instinct Crossover is a rugged hybrid smartwatch',
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
coverImg: s1,
|
||||
createdAt: sub(new Date(), { days: 8, hours: 6, minutes: 20 }),
|
||||
view: random(9999),
|
||||
share: random(9999),
|
||||
category: 'Gadget',
|
||||
featured: false,
|
||||
author: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user1,
|
||||
name: chance.name()
|
||||
},
|
||||
comments: BlogComment
|
||||
},
|
||||
{
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
title: 'After Twitter Staff Cuts, Survivors Face ‘Radio Silence',
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
coverImg: s2,
|
||||
createdAt: sub(new Date(), { days: 7, hours: 3, minutes: 20 }),
|
||||
view: random(9999),
|
||||
share: random(9999),
|
||||
category: 'Lifestyle',
|
||||
featured: false,
|
||||
author: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user2,
|
||||
name: chance.name()
|
||||
},
|
||||
comments: BlogComment
|
||||
},
|
||||
{
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
title: 'Apple is apparently working on a new ‘streamlined’ accessibility',
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
coverImg: s3,
|
||||
createdAt: sub(new Date(), { days: 5, hours: 2, minutes: 20 }),
|
||||
view: random(9999),
|
||||
share: random(9999),
|
||||
category: 'Design',
|
||||
featured: false,
|
||||
author: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user3,
|
||||
name: chance.name()
|
||||
},
|
||||
comments: BlogComment
|
||||
},
|
||||
{
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
title: 'Why Figma is selling to Adobe for $20 billion',
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
coverImg: s4,
|
||||
createdAt: sub(new Date(), { days: 7, hours: 6, minutes: 20 }),
|
||||
view: random(9999),
|
||||
share: random(9999),
|
||||
category: 'Design',
|
||||
featured: false,
|
||||
author: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user4,
|
||||
name: chance.name()
|
||||
},
|
||||
comments: BlogComment
|
||||
},
|
||||
{
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
title: 'Streaming video way before it was cool, go dark tomorrow',
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
coverImg: s5,
|
||||
createdAt: sub(new Date(), { days: 4, hours: 6, minutes: 20 }),
|
||||
view: random(9999),
|
||||
share: random(9999),
|
||||
category: 'Lifestyle',
|
||||
featured: false,
|
||||
author: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user5,
|
||||
name: chance.name()
|
||||
},
|
||||
comments: BlogComment
|
||||
},
|
||||
{
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
title: 'As yen tumbles, gadget-loving Japan goes for secondhand',
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
coverImg: s6,
|
||||
createdAt: sub(new Date(), { days: 2, hours: 6, minutes: 20 }),
|
||||
view: random(9999),
|
||||
share: random(9999),
|
||||
category: 'Gadget',
|
||||
featured: false,
|
||||
author: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user6,
|
||||
name: chance.name()
|
||||
},
|
||||
comments: BlogComment
|
||||
},
|
||||
{
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
title: 'Intel loses bid to revive antitrust case against patent foe Fortress',
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
coverImg: s7,
|
||||
createdAt: sub(new Date(), { days: 3, hours: 6, minutes: 20 }),
|
||||
view: random(9999),
|
||||
share: random(9999),
|
||||
category: 'Social',
|
||||
featured: false,
|
||||
author: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user2,
|
||||
name: chance.name()
|
||||
},
|
||||
comments: BlogComment
|
||||
},
|
||||
{
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
title: 'COVID outbreak deepens as more lockdowns loom in China',
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
coverImg: s8,
|
||||
createdAt: sub(new Date(), { days: 4, hours: 6, minutes: 20 }),
|
||||
view: random(9999),
|
||||
share: random(9999),
|
||||
category: 'Health',
|
||||
featured: false,
|
||||
author: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user3,
|
||||
name: chance.name()
|
||||
},
|
||||
comments: BlogComment
|
||||
},
|
||||
{
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
title: 'Early Black Friday Amazon deals: cheap TVs, headphones',
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
coverImg: s9,
|
||||
createdAt: sub(new Date(), { days: 5, hours: 3, minutes: 20 }),
|
||||
view: random(9999),
|
||||
share: random(9999),
|
||||
category: 'Gadget',
|
||||
featured: true,
|
||||
author: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user4,
|
||||
name: chance.name()
|
||||
},
|
||||
comments: BlogComment
|
||||
},
|
||||
{
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
title: 'Presented by Max Rushden with Barry Glendenning, Philippe',
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
coverImg: s10,
|
||||
createdAt: sub(new Date(), { days: 0, hours: 1, minutes: 20 }),
|
||||
view: random(9999),
|
||||
share: random(9999),
|
||||
category: 'Health',
|
||||
featured: true,
|
||||
author: {
|
||||
id: chance.integer({ min: 1, max: 2000 }),
|
||||
avatar: user5,
|
||||
name: chance.name()
|
||||
},
|
||||
comments: BlogComment
|
||||
}
|
||||
];
|
||||
|
||||
mock.onGet('/api/data/blog/BlogPosts').reply(() => {
|
||||
return [200, BlogPost];
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
mock.onPost('/api/data/blog/post').reply((config: string | any) => {
|
||||
try {
|
||||
const { title } = JSON.parse(config.data);
|
||||
|
||||
const paramCase = (t: string) =>
|
||||
t
|
||||
.toLowerCase()
|
||||
.replace(/ /g, '-')
|
||||
.replace(/[^\w-]+/g, '');
|
||||
|
||||
const post = BlogPost.find((_post: blogpostType | string | any) => paramCase(_post.title) === title);
|
||||
|
||||
if (!post) {
|
||||
return [404, { message: 'Post not found' }];
|
||||
}
|
||||
|
||||
return [200, { post }];
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return [500, { message: 'Internal server error' }];
|
||||
}
|
||||
});
|
||||
|
||||
mock.onPost('/api/data/blog/post/add').reply((config: string | any) => {
|
||||
try {
|
||||
const { postId, comment } = JSON.parse(config.data);
|
||||
const postIndex = BlogPost.findIndex((x) => x.id === postId);
|
||||
const post = BlogPost[postIndex];
|
||||
const cComments = post.comments || [];
|
||||
post.comments = [comment, ...cComments];
|
||||
return [200, { posts: [...BlogPost] }];
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [500, { message: 'Internal server error' }];
|
||||
}
|
||||
});
|
||||
531
_mockApis/apps/chat/index.ts
Executable file
531
_mockApis/apps/chat/index.ts
Executable file
@@ -0,0 +1,531 @@
|
||||
import mock from '../../mockAdapter';
|
||||
import { Chance } from 'chance';
|
||||
import type { ChatType } from '@/types/apps/ChatType';
|
||||
import { sub } from 'date-fns';
|
||||
import { uniqueId } from 'lodash';
|
||||
|
||||
import user1 from '@/assets/images/profile/user-2.jpg';
|
||||
import user2 from '@/assets/images/profile/user-3.jpg';
|
||||
import user3 from '@/assets/images/profile/user-4.jpg';
|
||||
import user4 from '@/assets/images/profile/user-5.jpg';
|
||||
import user5 from '@/assets/images/profile/user-6.jpg';
|
||||
import user6 from '@/assets/images/profile/user-7.jpg';
|
||||
import user7 from '@/assets/images/profile/user-8.jpg';
|
||||
|
||||
import background1 from '@/assets/images/products/product-1.jpg';
|
||||
import background2 from '@/assets/images/products/product-2.jpg';
|
||||
import background3 from '@/assets/images/products/product-3.jpg';
|
||||
import background4 from '@/assets/images/products/product-4.jpg';
|
||||
|
||||
|
||||
import adobe from '@/assets/images/chat/icon-adobe.svg';
|
||||
import chrome from '@/assets/images/chat/icon-chrome.svg';
|
||||
import figma from '@/assets/images/chat/icon-figma.svg';
|
||||
import java from '@/assets/images/chat/icon-javascript.svg';
|
||||
import zip from '@/assets/images/chat/icon-zip-folder.svg';
|
||||
|
||||
const chance = new Chance();
|
||||
|
||||
// const ChatData: ChatTypes[] = [
|
||||
const ChatData: ChatType[] = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'James Johnson',
|
||||
status: 'online',
|
||||
thumb: user2,
|
||||
recent: false,
|
||||
chatHistory: [
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 1 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [
|
||||
{ icon: adobe, file: 'service-task.pdf', fileSize: '2MB' },
|
||||
{ icon: chrome, file: 'homepage-design.fig', fileSize: '3MB' },
|
||||
{ icon: figma, file: 'about-us.htmlf', fileSize: '1KB' },
|
||||
{ icon: java, file: 'work-project.zip', fileSize: '20MB' },
|
||||
{ icon: zip, file: 'custom.js', fileSize: '2MB' }
|
||||
],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 30 }),
|
||||
msg: chance.sentence({ words: 10 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 6 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: uniqueId(),
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 5 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 5 }),
|
||||
msg: background1,
|
||||
senderId: uniqueId(),
|
||||
type: 'img',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Maria Hernandez',
|
||||
status: 'away',
|
||||
thumb: user3,
|
||||
recent: true,
|
||||
chatHistory: [
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 1 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: uniqueId(),
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 30 }),
|
||||
msg: chance.sentence({ words: 10 }),
|
||||
senderId: uniqueId(),
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 6 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 2,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 5 }),
|
||||
msg: background1,
|
||||
senderId: 2,
|
||||
type: 'img',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 1 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: uniqueId(),
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'David Smith',
|
||||
status: 'busy',
|
||||
thumb: user4,
|
||||
recent: false,
|
||||
chatHistory: [
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 10 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [
|
||||
{ icon: adobe, file: 'service-task.pdf', fileSize: '2MB' },
|
||||
{ icon: zip, file: 'custom.js', fileSize: '2MB' }
|
||||
],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 30 }),
|
||||
msg: chance.sentence({ words: 10 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 6 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 3,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 6 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 3,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: 'Loren Rodriguez',
|
||||
status: 'offline',
|
||||
thumb: user5,
|
||||
recent: true,
|
||||
chatHistory: [
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 1 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 10 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 4,
|
||||
type: 'text',
|
||||
attachment: [
|
||||
{ icon: java, file: 'work-project.zip', fileSize: '20MB' },
|
||||
{ icon: zip, file: 'custom.js', fileSize: '2MB' }
|
||||
],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 11 }),
|
||||
msg: background2,
|
||||
senderId: uniqueId(),
|
||||
type: 'img',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 6 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 4,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 1 }),
|
||||
msg: chance.sentence({ words: 7 }),
|
||||
senderId: 3,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: 'Robert Smith',
|
||||
status: 'online',
|
||||
thumb: user6,
|
||||
recent: true,
|
||||
chatHistory: [
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 1 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [
|
||||
{ icon: adobe, file: 'service-task.pdf', fileSize: '2MB' },
|
||||
{ icon: chrome, file: 'homepage-design.fig', fileSize: '3MB' },
|
||||
{ icon: figma, file: 'about-us.htmlf', fileSize: '1KB' },
|
||||
{ icon: java, file: 'work-project.zip', fileSize: '20MB' },
|
||||
{ icon: zip, file: 'custom.js', fileSize: '2MB' }
|
||||
],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 30 }),
|
||||
msg: chance.sentence({ words: 10 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 6 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: uniqueId(),
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 5 }),
|
||||
msg: background3,
|
||||
senderId: 5,
|
||||
type: 'img',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 5 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 5,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: 'Joseph Sara',
|
||||
status: 'busy',
|
||||
thumb: user7,
|
||||
recent: false,
|
||||
chatHistory: [
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 10 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [
|
||||
{ icon: chrome, file: 'homepage-design.fig', fileSize: '3MB' },
|
||||
{ icon: java, file: 'work-project.zip', fileSize: '20MB' },
|
||||
{ icon: zip, file: 'custom.js', fileSize: '2MB' }
|
||||
],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 5 }),
|
||||
msg: background4,
|
||||
senderId: uniqueId(),
|
||||
type: 'img',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 5 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 2 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 6,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: 'Thomas Smith',
|
||||
status: 'away',
|
||||
thumb: user2,
|
||||
recent: true,
|
||||
chatHistory: [
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 10 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [
|
||||
{ icon: adobe, file: 'service-task.pdf', fileSize: '2MB' },
|
||||
{ icon: chrome, file: 'homepage-design.fig', fileSize: '3MB' }
|
||||
],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 1 }),
|
||||
msg: chance.sentence({ words: 10 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 15 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 7,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 10 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 7,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: 'Davina Elizabeth',
|
||||
status: 'offline',
|
||||
thumb: user3,
|
||||
recent: false,
|
||||
chatHistory: [
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 10 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [
|
||||
{ icon: adobe, file: 'service-task.pdf', fileSize: '2MB' },
|
||||
{ icon: java, file: 'work-project.zip', fileSize: '20MB' },
|
||||
{ icon: zip, file: 'custom.js', fileSize: '2MB' }
|
||||
],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 6 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 3,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 6 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 1 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 8,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: 'Charles Martha',
|
||||
status: 'online',
|
||||
thumb: user4,
|
||||
recent: false,
|
||||
chatHistory: [
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 10 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [
|
||||
{ icon: java, file: 'work-project.zip', fileSize: '20MB' },
|
||||
{ icon: zip, file: 'custom.js', fileSize: '2MB' }
|
||||
],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 8 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 3,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 8 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 3,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 5 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 9,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 2 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 9,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: 'Samuel Ban',
|
||||
status: 'online',
|
||||
thumb: user5,
|
||||
recent: false,
|
||||
chatHistory: [
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 10 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 1,
|
||||
type: 'text',
|
||||
attachment: [
|
||||
{ icon: adobe, file: 'service-task.pdf', fileSize: '2MB' },
|
||||
{ icon: zip, file: 'custom.js', fileSize: '2MB' }
|
||||
],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 11 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 3,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 6 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 3,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { hours: 6 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 3,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
},
|
||||
{
|
||||
createdAt: sub(new Date(), { minutes: 6 }),
|
||||
msg: chance.sentence({ words: 5 }),
|
||||
senderId: 10,
|
||||
type: 'text',
|
||||
attachment: [],
|
||||
id: uniqueId()
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
mock.onGet('/api/data/chat/ChatData').reply(() => {
|
||||
return [200, ChatData];
|
||||
});
|
||||
|
||||
export default ChatData;
|
||||
131
_mockApis/apps/contact/index.ts
Executable file
131
_mockApis/apps/contact/index.ts
Executable file
@@ -0,0 +1,131 @@
|
||||
import mock from '../../mockAdapter';
|
||||
|
||||
import user1 from '@/assets/images/profile/user-11.jpg';
|
||||
import user2 from '@/assets/images/profile/user-2.jpg';
|
||||
import user3 from '@/assets/images/profile/user-3.jpg';
|
||||
import user4 from '@/assets/images/profile/user-4.jpg';
|
||||
import user5 from '@/assets/images/profile/user-5.jpg';
|
||||
import user6 from '@/assets/images/profile/user-6.jpg';
|
||||
import user7 from '@/assets/images/profile/user-7.jpg';
|
||||
import user8 from '@/assets/images/profile/user-8.jpg';
|
||||
import user9 from '@/assets/images/profile/user-9.jpg';
|
||||
import user10 from '@/assets/images/profile/user-10.jpg';
|
||||
|
||||
|
||||
// types
|
||||
export type KeyedObject = {
|
||||
[key: string]: string | number | KeyedObject | any;
|
||||
};
|
||||
|
||||
const contacts: KeyedObject[] = [
|
||||
{
|
||||
id: '#123',
|
||||
avatar: user2,
|
||||
userinfo: 'Hanna Gover',
|
||||
usermail: 'hannagover@gmail.com',
|
||||
phone: '+123 456 789',
|
||||
jdate: '12-10-2014',
|
||||
role: 'Designer',
|
||||
rolestatus: 'primary'
|
||||
},
|
||||
{
|
||||
id: '#452',
|
||||
avatar: user1,
|
||||
userinfo: 'Daniel Kristeen',
|
||||
usermail: 'danielr@gmail.com',
|
||||
phone: '+234 456 789',
|
||||
jdate: '10-09-2014',
|
||||
role: 'Developer',
|
||||
rolestatus: 'secondary'
|
||||
},
|
||||
{
|
||||
id: '#565',
|
||||
avatar: user3,
|
||||
userinfo: 'Julian Josephs',
|
||||
usermail: 'julijosep@gmail.com',
|
||||
phone: '+345 456 789',
|
||||
jdate: '01-10-2013',
|
||||
role: 'Accountant',
|
||||
rolestatus: 'error'
|
||||
},
|
||||
{
|
||||
id: '#785',
|
||||
avatar: user4,
|
||||
userinfo: 'Jany Petrovic',
|
||||
usermail: 'janyver@gmail.com',
|
||||
phone: '+456 456 789',
|
||||
jdate: '02-10-2017',
|
||||
role: 'Designer',
|
||||
rolestatus: 'success'
|
||||
},
|
||||
{
|
||||
id: '#564',
|
||||
avatar: user5,
|
||||
userinfo: 'Leanne Graham',
|
||||
usermail: 'leanegr@gmail.com',
|
||||
phone: '+567 456 789',
|
||||
jdate: '10-9-2015',
|
||||
role: 'HR',
|
||||
rolestatus: 'info'
|
||||
},
|
||||
{
|
||||
id: '#980',
|
||||
avatar: user6,
|
||||
userinfo: 'Dennis Schulist',
|
||||
usermail: 'dennis12@gmail.com',
|
||||
phone: '+678 456 789',
|
||||
jdate: '10-5-2013',
|
||||
role: 'Designer',
|
||||
rolestatus: 'warning'
|
||||
},
|
||||
{
|
||||
id: '#521',
|
||||
avatar: user7,
|
||||
userinfo: 'Kurtis Weissnat',
|
||||
usermail: 'kurtisr@gmail.com',
|
||||
phone: '+123 456 789',
|
||||
jdate: '05-10-2012',
|
||||
role: 'Manager',
|
||||
rolestatus: 'primary'
|
||||
},
|
||||
{
|
||||
id: '#450',
|
||||
avatar: user8,
|
||||
userinfo: 'Nicholas Runolfsdottir V',
|
||||
usermail: 'nickover@gmail.com',
|
||||
phone: '+234 456 789',
|
||||
jdate: '11-10-2014',
|
||||
role: 'Chairman',
|
||||
rolestatus: 'secondary'
|
||||
},
|
||||
{
|
||||
id: '#212',
|
||||
avatar: user9,
|
||||
userinfo: 'Glenna Reichert',
|
||||
usermail: 'glenarei@gmail.com',
|
||||
phone: '+345 456 789',
|
||||
jdate: '12-5-2017',
|
||||
role: 'Designer',
|
||||
rolestatus: 'error'
|
||||
},
|
||||
{
|
||||
id: '#152',
|
||||
avatar: user10,
|
||||
userinfo: 'Clementina DuBuque',
|
||||
usermail: 'clementina@gmail.com',
|
||||
phone: '+456 456 789',
|
||||
jdate: '18-5-2009',
|
||||
role: 'Developer',
|
||||
rolestatus: 'success'
|
||||
}
|
||||
];
|
||||
|
||||
// ==============================|| MOCK SERVICES ||============================== //
|
||||
|
||||
// mock.onGet('/api/products/list').reply(200, { products });
|
||||
mock.onGet('/api/contacts').reply(() => {
|
||||
return [200, contacts];
|
||||
});
|
||||
|
||||
|
||||
export default contacts;
|
||||
72
_mockApis/apps/ecommerce/Editproduc.ts
Executable file
72
_mockApis/apps/ecommerce/Editproduc.ts
Executable file
@@ -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}
|
||||
112
_mockApis/apps/ecommerce/billing-address.ts
Executable file
112
_mockApis/apps/ecommerce/billing-address.ts
Executable file
@@ -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' }];
|
||||
}
|
||||
});
|
||||
2
_mockApis/apps/ecommerce/index.ts
Executable file
2
_mockApis/apps/ecommerce/index.ts
Executable file
@@ -0,0 +1,2 @@
|
||||
import './products';
|
||||
import './billing-address';
|
||||
273
_mockApis/apps/ecommerce/products.ts
Executable file
273
_mockApis/apps/ecommerce/products.ts
Executable file
@@ -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;
|
||||
596
_mockApis/apps/email/index.ts
Executable file
596
_mockApis/apps/email/index.ts
Executable file
@@ -0,0 +1,596 @@
|
||||
import mock from "../../mockAdapter";
|
||||
import { Chance } from "chance";
|
||||
import type { EmailType } from "@/types/apps/EmailTypes";
|
||||
import { sub } from "date-fns";
|
||||
|
||||
import user1 from '@/assets/images/profile/user-2.jpg';
|
||||
import user2 from '@/assets/images/profile/user-3.jpg';
|
||||
import user3 from '@/assets/images/profile/user-4.jpg';
|
||||
import user4 from '@/assets/images/profile/user-5.jpg';
|
||||
import user5 from '@/assets/images/profile/user-6.jpg';
|
||||
import user6 from '@/assets/images/profile/user-7.jpg';
|
||||
import user7 from '@/assets/images/profile/user-8.jpg';
|
||||
import user8 from '@/assets/images/profile/user-14.jpg';
|
||||
import user9 from '@/assets/images/profile/user-9.jpg';
|
||||
import user10 from '@/assets/images/profile/user-10.jpg';
|
||||
import user11 from '@/assets/images/profile/user-11.jpg';
|
||||
import user12 from '@/assets/images/profile/user-12.jpg';
|
||||
import user13 from '@/assets/images/profile/user-13.jpg';
|
||||
|
||||
import adobe from '@/assets/images/chat/icon-adobe.svg';
|
||||
import chrome from '@/assets/images/chat/icon-chrome.svg';
|
||||
import figma from '@/assets/images/chat/icon-figma.svg';
|
||||
import java from '@/assets/images/chat/icon-javascript.svg';
|
||||
import zip from '@/assets/images/chat/icon-zip-folder.svg';
|
||||
|
||||
const chance = new Chance();
|
||||
|
||||
const EmailData: EmailType[] = [
|
||||
{
|
||||
id: 1,
|
||||
from: "James Smith",
|
||||
thumbnail: user10,
|
||||
subject: "Kindly check this latest updated",
|
||||
time: sub(new Date(), { hours: 1 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt:
|
||||
"Contrary to popular belief, Lorem Ipsum is not simply random text. ",
|
||||
emailContent: `<p>Hello Andrew, </p>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque bibendum hendrerit lobortis. Nullam ut lacus eros. Sed at luctus urna, eu fermentum diam. In et tristique mauris.</p>
|
||||
<p>Ut id ornare metus, sed auctor enim. Pellentesque nisi magna, laoreet a augue eget,
|
||||
tempor volutpat diam.</p>
|
||||
<p>Regards,<br/> <b>James Smith</b></p>
|
||||
`,
|
||||
unread: true,
|
||||
attachment: false,
|
||||
starred: true,
|
||||
important: false,
|
||||
inbox: true,
|
||||
sent: false,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: false,
|
||||
promotional:true,
|
||||
social:false,
|
||||
health:true,
|
||||
label: "Promotional",
|
||||
attchments: [
|
||||
{
|
||||
id: "#1Attach",
|
||||
image: adobe,
|
||||
title: "adobe.pdf",
|
||||
fileSize: "2MB",
|
||||
},
|
||||
{
|
||||
id: "#2Attach",
|
||||
image: chrome,
|
||||
title: "abouts.html",
|
||||
fileSize: "2MB",
|
||||
},
|
||||
{
|
||||
id: "#3Attach",
|
||||
image: zip,
|
||||
title: "cheese.zip",
|
||||
fileSize: "2MB",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
from: "Michael Smith",
|
||||
thumbnail: user1,
|
||||
subject: "Fact that a reader will be distracted.",
|
||||
time: sub(new Date(), { days: 0, hours: 3, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt:
|
||||
"It has roots in a piece of classical Latin literature from 45 BC",
|
||||
emailContent: `<p>Hello Andrew, </p>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque bibendum hendrerit lobortis. Nullam ut lacus eros. Sed at luctus urna, eu fermentum diam. In et tristique mauris.</p>
|
||||
<p>Ut id ornare metus, sed auctor enim. Pellentesque nisi magna, laoreet a augue eget,
|
||||
tempor volutpat diam.</p>
|
||||
<p>Regards,<br/> <b>Michael Smith</b></p>
|
||||
`,
|
||||
unread: true,
|
||||
attachment: false,
|
||||
starred: true,
|
||||
important: false,
|
||||
inbox: false,
|
||||
sent: false,
|
||||
draft: true,
|
||||
spam: false,
|
||||
promotional:true,
|
||||
social:false,
|
||||
health:true,
|
||||
trash: false,
|
||||
label: "Social",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
from: "Robert Smith",
|
||||
thumbnail: user2,
|
||||
subject:
|
||||
"The point of using Lorem Ipsum is that it has a more-or-less normal",
|
||||
time: sub(new Date(), { days: 0, hours: 11, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt: "Richard McClintock, a Latin professor at Hampden-Sydney",
|
||||
emailContent:
|
||||
"<p>Dummy text is also used to demonstrate the appearance of different typefaces and layouts, and in general the content of dummy text is nonsensical. ",
|
||||
unread: false,
|
||||
attachment: false,
|
||||
starred: false,
|
||||
important: true,
|
||||
inbox: false,
|
||||
sent: true,
|
||||
draft: false,
|
||||
promotional:true,
|
||||
social:true,
|
||||
health:true,
|
||||
spam: false,
|
||||
trash: false,
|
||||
label: "Promotional",
|
||||
attchments: [
|
||||
{
|
||||
id: "#4Attach",
|
||||
image: figma,
|
||||
title: "service.fig",
|
||||
fileSize: "2MB",
|
||||
},
|
||||
{
|
||||
id: "#5Attach",
|
||||
image: java,
|
||||
title: "abouts.js",
|
||||
fileSize: "2MB",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
from: "Maria Garcia",
|
||||
thumbnail:user5,
|
||||
subject: "Contrary to popular belief, Lorem Ipsum is.",
|
||||
time: sub(new Date(), { days: 1, hours: 2, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt: "Lorem Ipsum passage, and going through",
|
||||
emailContent:
|
||||
"<p>Furthermore, it is advantageous when the dummy text is relatively realistic so that the layout impression of the final publication is not compromised.</p>",
|
||||
unread: false,
|
||||
attachment: true,
|
||||
starred: true,
|
||||
important: false,
|
||||
inbox: false,
|
||||
promotional:false,
|
||||
social:false,
|
||||
health:false,
|
||||
sent: false,
|
||||
draft: true,
|
||||
spam: false,
|
||||
trash: false,
|
||||
label: "Social",
|
||||
attchments: [
|
||||
{
|
||||
id: "#4Attach",
|
||||
image: figma,
|
||||
title: "service.fig",
|
||||
fileSize: "2MB",
|
||||
},
|
||||
{
|
||||
id: "#5Attach",
|
||||
image: java,
|
||||
title: "abouts.js",
|
||||
fileSize: "2MB",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
from: "David Smith",
|
||||
thumbnail: user6,
|
||||
subject: "Literature from 45 BC, making",
|
||||
time: sub(new Date(), { days: 1, hours: 8, minutes: 45 }),
|
||||
To: "abc123@company.com",
|
||||
emailExcerpt: "The standard chunk of Lorem Ipsum used since the 1500s",
|
||||
emailContent:
|
||||
"<p>One disadvantage of Lorum Ipsum is that in Latin certain letters appear more frequently than others which creates a distinct visual impression.</p>",
|
||||
unread: false,
|
||||
attachment: false,
|
||||
starred: false,
|
||||
important: true,
|
||||
inbox: true,
|
||||
sent: false,
|
||||
draft: false,
|
||||
promotional:true,
|
||||
social:true,
|
||||
health:true,
|
||||
spam: false,
|
||||
trash: false,
|
||||
label: "Social",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
from: "Maria Rodriguez",
|
||||
thumbnail: user7,
|
||||
subject: "Latin professor at Hampden-Sydney College.",
|
||||
time: sub(new Date(), { days: 1, hours: 10, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt: "Cicero are also reproduced in their exact original form",
|
||||
emailContent:
|
||||
"<p>Thus, Lorem Ipsum has only limited suitability as a visual filler for German texts. If the fill text is intended to illustrate the characteristics of different typefaces.</p>",
|
||||
unread: false,
|
||||
attachment: true,
|
||||
starred: false,
|
||||
important: true,
|
||||
inbox: true,
|
||||
promotional:false,
|
||||
social:true,
|
||||
health:true,
|
||||
sent: false,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: false,
|
||||
label: "Health",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
from: "Mary Smith",
|
||||
thumbnail: user8,
|
||||
subject: "the cites of the word in classical.",
|
||||
time: sub(new Date(), { days: 1, hours: 11, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt:
|
||||
"There are many variations of passages of Lorem Ipsum available",
|
||||
emailContent:
|
||||
"<p>There is now an abundance of readable dummy texts. These are usually used when a text is required purely to fill a space.These alternatives to the classic Lorem Ipsum texts are often amusing and tell short, funny or nonsensical stories.</p>",
|
||||
unread: true,
|
||||
attachment: true,
|
||||
starred: false,
|
||||
important: false,
|
||||
promotional:true,
|
||||
social:false,
|
||||
health:false,
|
||||
inbox: true,
|
||||
sent: false,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: false,
|
||||
label: "Social",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
from: "Maria Hernandez",
|
||||
thumbnail: user9,
|
||||
subject: " This book is a treatise on the theory of ethics.",
|
||||
time: sub(new Date(), { days: 2, hours: 1, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt:
|
||||
"the majority have suffered alteration in some form, by injected ",
|
||||
emailContent:
|
||||
"<p>According to most sources, Lorum Ipsum can be traced back to a text composed by Cicero in 45 BC. Allegedly, a Latin scholar established the origin of the text.</p>",
|
||||
unread: false,
|
||||
attachment: true,
|
||||
starred: false,
|
||||
important: true,
|
||||
inbox: false,
|
||||
promotional:true,
|
||||
social:true,
|
||||
health:true,
|
||||
sent: false,
|
||||
draft: false,
|
||||
spam: true,
|
||||
trash: false,
|
||||
label: "Social",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
from: "Maria Martinez",
|
||||
thumbnail: user10,
|
||||
subject: "Lorem Ipsum used since the 1500s is reproduced.",
|
||||
time: sub(new Date(), { days: 2, hours: 3, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt: "If you are going to use a passage of Lorem Ipsum",
|
||||
emailContent:
|
||||
"<p>It seems that only fragments of the original text remain in the Lorem Ipsum texts used today. One may speculate that over the course of time certain letters.</p>",
|
||||
unread: false,
|
||||
attachment: true,
|
||||
starred: false,
|
||||
important: false,
|
||||
inbox: false,
|
||||
promotional:false,
|
||||
social:true,
|
||||
health:false,
|
||||
sent: false,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: true,
|
||||
label: "Promotional",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
from: "James Johnson",
|
||||
thumbnail:user1,
|
||||
subject: "accompanied by English versions from the 1914 translation.",
|
||||
time: sub(new Date(), { days: 2, hours: 8, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt: "you need to be sure there isn't anything",
|
||||
emailContent:
|
||||
"<p>This might also explain why one can now find slightly different versions. Due to the age of the Lorem Ipsum text there are no copyright issues to contend with.</p>",
|
||||
unread: false,
|
||||
attachment: true,
|
||||
starred: true,
|
||||
important: false,
|
||||
inbox: false,
|
||||
promotional:true,
|
||||
social:false,
|
||||
health:true,
|
||||
sent: true,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: false,
|
||||
label: "Health",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
from: "James Smith",
|
||||
thumbnail:user3,
|
||||
subject: "All the Lorem Ipsum generators on the Internet.",
|
||||
time: sub(new Date(), { days: 2, hours: 9, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt:
|
||||
"All the Lorem Ipsum generators on the Internet tend to repeat predefined",
|
||||
emailContent:
|
||||
"<p>The spread of computers and layout programmes thus made dummy text better known. While in earlier times several lines of the Lorem Ipsum text were repeated in the creation of dummy texts.</p>",
|
||||
unread: false,
|
||||
attachment: false,
|
||||
starred: true,
|
||||
important: false,
|
||||
inbox: true,
|
||||
promotional:true,
|
||||
social:false,
|
||||
health:false,
|
||||
sent: false,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: false,
|
||||
label: "Promotional",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
from: "Michael Smith",
|
||||
thumbnail: user7,
|
||||
subject: "Latin words, combined with a handful.",
|
||||
time: sub(new Date(), { days: 2, hours: 11, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt: "combined with a handful of model sentence structures",
|
||||
emailContent:
|
||||
"<p>basis for many dummy text or Lorem Ipsum generators. Based on 'De finibus', these generators automatically create longer sections of the Lorem Ipsum text or various other filler texts.</p>",
|
||||
unread: false,
|
||||
attachment: false,
|
||||
starred: false,
|
||||
important: false,
|
||||
promotional:true,
|
||||
social:true,
|
||||
health:true,
|
||||
inbox: true,
|
||||
sent: false,
|
||||
draft: true,
|
||||
spam: false,
|
||||
trash: true,
|
||||
label: "Social",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 13,
|
||||
from: "Robert Smith",
|
||||
thumbnail: user1,
|
||||
subject: "If you are going to use a passage.",
|
||||
time: sub(new Date(), { days: 3, hours: 2, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt:
|
||||
"Lorem Ipsum is therefore always free from repetition, injected humour",
|
||||
emailContent:
|
||||
"<p>The phrasal sequence of the Lorem Ipsum text is now so widespread and commonplace that many DTP programmes can generate dummy text using the starting sequence.</p>",
|
||||
unread: false,
|
||||
attachment: true,
|
||||
starred: true,
|
||||
important: true,
|
||||
promotional:false,
|
||||
social:false,
|
||||
health:false,
|
||||
inbox: false,
|
||||
sent: true,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: false,
|
||||
label: "Health",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 14,
|
||||
from: "Maria Garcia",
|
||||
thumbnail: user2,
|
||||
subject: "piece of classical Latin literature.",
|
||||
time: sub(new Date(), { days: 3, hours: 11, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt: "Lorem Ipsum passage, and going through the cites",
|
||||
emailContent:
|
||||
"<p>now recognized by electronic pre-press systems and, when found, an alarm can be raised. This avoids a publication going to print with overlooked dummy text.</p>",
|
||||
unread: false,
|
||||
attachment: false,
|
||||
starred: true,
|
||||
important: false,
|
||||
inbox: false,
|
||||
promotional:true,
|
||||
social:true,
|
||||
health:true,
|
||||
sent: false,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: true,
|
||||
label: "Social",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 15,
|
||||
from: "David Smith",
|
||||
thumbnail: user3,
|
||||
subject: "first true generator on the Internet.",
|
||||
time: sub(new Date(), { days: 3, hours: 4, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt:
|
||||
"Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
|
||||
emailContent:
|
||||
"<p>Certain internet providers exploit the fact that fill text cannot be recognized by automatic search engines - meaningful information cannot be distinguished from meaningless.</p>",
|
||||
unread: false,
|
||||
attachment: true,
|
||||
starred: false,
|
||||
important: false,
|
||||
inbox: false,
|
||||
promotional:true,
|
||||
social:false,
|
||||
health:true,
|
||||
sent: false,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: true,
|
||||
label: "Promotional",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 16,
|
||||
from: "Maria Rodriguez",
|
||||
thumbnail: user4,
|
||||
subject: "combined with a handful of model sentence structure.",
|
||||
time: sub(new Date(), { days: 4, hours: 1, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt:
|
||||
"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s",
|
||||
emailContent:
|
||||
"<p>Target-generated dummy text mixed with a certain combination of search terms can lead to an increased frequency of visits by search machine users. As a consequence, advertising revenues, which rely on website 'hits', are increased.</p>",
|
||||
unread: true,
|
||||
attachment: false,
|
||||
starred: false,
|
||||
important: true,
|
||||
inbox: true,
|
||||
promotional:true,
|
||||
social:true,
|
||||
health:false,
|
||||
sent: false,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: true,
|
||||
label: "Social",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 17,
|
||||
from: "Mary Smith",
|
||||
thumbnail: user6,
|
||||
subject: "randomised words which don't look even.",
|
||||
time: sub(new Date(), { days: 4, hours: 1, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt: "when an unknown printer took a galley of type",
|
||||
emailContent:
|
||||
"<p>Vitae purus faucibus ornare suspendisse sed nisi lacus sed viverra. Amet nisl suscipit adipiscing bibendum est ultricies integer.</p>",
|
||||
unread: true,
|
||||
attachment: false,
|
||||
starred: false,
|
||||
important: false,
|
||||
inbox: false,
|
||||
promotional:true,
|
||||
social:false,
|
||||
health:true,
|
||||
sent: false,
|
||||
draft: false,
|
||||
spam: true,
|
||||
trash: false,
|
||||
label: "Health",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 18,
|
||||
from: "Maria Hernandez",
|
||||
thumbnail: user8,
|
||||
subject: "Lorem Ipsum generators on the Internet tend.",
|
||||
time: sub(new Date(), { days: 4, hours: 1, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt: "scrambled it to make a type specimen book",
|
||||
emailContent:
|
||||
"<p>Volutpat diam ut venenatis tellus in metus vulputate eu. Id aliquet lectus proin nibh nisl condimentum id venenatis. Risus quis varius quam quisque id diam vel. Pulvinar pellentesque habitant morbi tristique senectus et netus et.</p>",
|
||||
unread: false,
|
||||
attachment: false,
|
||||
starred: false,
|
||||
important: true,
|
||||
inbox: false,
|
||||
promotional:true,
|
||||
social:false,
|
||||
health:true,
|
||||
sent: true,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: false,
|
||||
label: "Promotional",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 19,
|
||||
from: "Maria Martinez",
|
||||
thumbnail: user9,
|
||||
subject: "combined with a handful of model.",
|
||||
time: sub(new Date(), { days: 4, hours: 1, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt: "It has survived not only five centuries",
|
||||
emailContent:
|
||||
"<p>Scelerisque purus semper eget duis at. Tempus imperdiet nulla malesuada pellentesque elit. Vitae semper quis lectus nulla at volutpat. Ac tortor vitae purus faucibus ornare suspendisse.</p>",
|
||||
unread: true,
|
||||
attachment: false,
|
||||
starred: false,
|
||||
important: false,
|
||||
inbox: false,
|
||||
promotional:true,
|
||||
social:false,
|
||||
health:true,
|
||||
sent: false,
|
||||
draft: true,
|
||||
spam: false,
|
||||
trash: false,
|
||||
label: "Health",
|
||||
attchments: [],
|
||||
},
|
||||
{
|
||||
id: 20,
|
||||
from: "James Johnson",
|
||||
thumbnail: user11,
|
||||
subject: "The Extremes of Good and Evil.",
|
||||
time: sub(new Date(), { days: 4, hours: 1, minutes: 45 }),
|
||||
To: "abc@company.com",
|
||||
emailExcerpt: "the 1960s with the release of Letraset sheets containings",
|
||||
emailContent:
|
||||
"<p>Ultrices in iaculis nunc sed augue lacus viverra. Tellus cras adipiscing enim eu turpis egestas. Libero enim sed faucibus turpis in eu mi bibendum neque. Consectetur adipiscing elit ut aliquam. Mattis nunc sed blandit libero volutpat sed cras. </p>",
|
||||
unread: false,
|
||||
attachment: true,
|
||||
starred: true,
|
||||
important: true,
|
||||
inbox: true,
|
||||
promotional:false,
|
||||
social:false,
|
||||
health:false,
|
||||
sent: false,
|
||||
draft: false,
|
||||
spam: false,
|
||||
trash: false,
|
||||
label: "Social",
|
||||
attchments: [],
|
||||
},
|
||||
];
|
||||
|
||||
mock.onGet('/api/data/email/EmailData').reply(() => {
|
||||
return [200, EmailData];
|
||||
});
|
||||
export default EmailData;
|
||||
253
_mockApis/apps/invoice/index.ts
Executable file
253
_mockApis/apps/invoice/index.ts
Executable file
@@ -0,0 +1,253 @@
|
||||
import type { InvoiceType } from "@/types/apps/InvoiceTypes";
|
||||
import mock from "../../mockAdapter";
|
||||
import { Chance } from "chance";
|
||||
const chance = new Chance();
|
||||
|
||||
const InvoiceData: InvoiceType[] = [
|
||||
{
|
||||
id: 101,
|
||||
billFrom: "PineappleInc.",
|
||||
billFromEmail: "first@xabz.com",
|
||||
billFromAddress: "Ganesh glory,Godrej garden city,Ahmedabad.",
|
||||
billFromPhone: 979796786,
|
||||
billFromFax: 13,
|
||||
billTo: "Redq Inc.",
|
||||
billToEmail: "toFirst@agth.com",
|
||||
billToAddress: "Godrej garden city,Ahmedabad.",
|
||||
billToPhone: 757575233,
|
||||
billToFax: 76,
|
||||
orders: [
|
||||
{
|
||||
itemName: "Courge",
|
||||
unitPrice: 10,
|
||||
units: 15,
|
||||
unitTotalPrice: 90,
|
||||
},
|
||||
],
|
||||
orderDate: new Date(),
|
||||
totalCost: 90,
|
||||
vat: 9,
|
||||
grandTotal: 99,
|
||||
status: "Shipped",
|
||||
completed: false,
|
||||
isSelected: false,
|
||||
},
|
||||
{
|
||||
id: 102,
|
||||
billFrom: "Pineapple.",
|
||||
billFromEmail: "first@xabz.com",
|
||||
billFromAddress: "Ganesh glory,Godrej garden city,Ahmedabad.",
|
||||
billFromPhone: 979796786,
|
||||
billFromFax: 13,
|
||||
billTo: "ME Inc.",
|
||||
billToEmail: "toFirst@agth.com",
|
||||
billToAddress: "Godrej garden city,Ahmedabad.",
|
||||
billToPhone: 757575233,
|
||||
billToFax: 76,
|
||||
orders: [
|
||||
{
|
||||
itemName: "Courge",
|
||||
unitPrice: 10,
|
||||
units: 9,
|
||||
unitTotalPrice: 90,
|
||||
},
|
||||
],
|
||||
orderDate: new Date(),
|
||||
totalCost: 90,
|
||||
vat: 9,
|
||||
grandTotal: 99,
|
||||
status: "Delivered",
|
||||
completed: false,
|
||||
isSelected: false,
|
||||
},
|
||||
{
|
||||
id: 103,
|
||||
billFrom: "Incorporation.",
|
||||
billFromEmail: "first@xabz.com",
|
||||
billFromAddress: "Ahmedabad.",
|
||||
billFromPhone: 979796786,
|
||||
billFromFax: 13,
|
||||
billTo: "Redirwed.",
|
||||
billToEmail: "toFirst@agth.com",
|
||||
billToAddress: "Godrej garden city,Ahmedabad.",
|
||||
billToPhone: 757575233,
|
||||
billToFax: 76,
|
||||
orders: [
|
||||
{
|
||||
itemName: "Courge",
|
||||
unitPrice: 10,
|
||||
units: 9,
|
||||
unitTotalPrice: 90,
|
||||
},
|
||||
],
|
||||
orderDate: new Date(),
|
||||
totalCost: 90,
|
||||
vat: 9,
|
||||
grandTotal: 99,
|
||||
status: "Pending",
|
||||
completed: false,
|
||||
isSelected: false,
|
||||
},
|
||||
{
|
||||
id: 104,
|
||||
billFrom: "PineappleTimes.",
|
||||
billFromEmail: "first@xabz.com",
|
||||
billFromAddress: "Ganesh glory,Godrej garden city,Ahmedabad.",
|
||||
billFromPhone: 979796786,
|
||||
billFromFax: 13,
|
||||
billTo: "RFc.",
|
||||
billToEmail: "toFirst@agth.com",
|
||||
billToAddress: "Godrej garden city,Ahmedabad.",
|
||||
billToPhone: 757575233,
|
||||
billToFax: 76,
|
||||
orders: [
|
||||
{
|
||||
itemName: "Courge",
|
||||
unitPrice: 10,
|
||||
units: 9,
|
||||
unitTotalPrice: 90,
|
||||
},
|
||||
],
|
||||
orderDate: new Date(),
|
||||
totalCost: 90,
|
||||
vat: 9,
|
||||
grandTotal: 99,
|
||||
status: "Shipped",
|
||||
completed: false,
|
||||
isSelected: false,
|
||||
},
|
||||
{
|
||||
id: 105,
|
||||
billFrom: "FortuneCreation",
|
||||
billFromEmail: "first@xabz.com",
|
||||
billFromAddress: "Ganesh glory,Godrej garden city,Ahmedabad.",
|
||||
billFromPhone: 979796786,
|
||||
billFromFax: 13,
|
||||
billTo: "Soft solution.",
|
||||
billToEmail: "toFirst@agth.com",
|
||||
billToAddress: "Godrej garden city,Ahmedabad.",
|
||||
billToPhone: 757575233,
|
||||
billToFax: 76,
|
||||
orders: [
|
||||
{
|
||||
itemName: "Courge",
|
||||
unitPrice: 10,
|
||||
units: 9,
|
||||
unitTotalPrice: 90,
|
||||
},
|
||||
],
|
||||
orderDate: new Date("2020-10-15"),
|
||||
totalCost: 90,
|
||||
vat: 9,
|
||||
grandTotal: 99,
|
||||
status: "Delivered",
|
||||
completed: false,
|
||||
isSelected: false,
|
||||
},
|
||||
{
|
||||
id: 106,
|
||||
billFrom: "PineappleTimes.",
|
||||
billFromEmail: "first@xabz.com",
|
||||
billFromAddress: "Ganesh glory,Godrej garden city,Ahmedabad.",
|
||||
billFromPhone: 979796786,
|
||||
billFromFax: 13,
|
||||
billTo: "RFc.",
|
||||
billToEmail: "toFirst@agth.com",
|
||||
billToAddress: "Godrej garden city,Ahmedabad.",
|
||||
billToPhone: 757575233,
|
||||
billToFax: 76,
|
||||
orders: [
|
||||
{
|
||||
itemName: "Courge",
|
||||
unitPrice: 10,
|
||||
units: 9,
|
||||
unitTotalPrice: 90,
|
||||
},
|
||||
],
|
||||
orderDate: new Date(),
|
||||
totalCost: 90,
|
||||
vat: 9,
|
||||
grandTotal: 99,
|
||||
status: "Shipped",
|
||||
completed: false,
|
||||
isSelected: false,
|
||||
},
|
||||
{
|
||||
id: 107,
|
||||
billFrom: "FortuneCreation",
|
||||
billFromEmail: "first@xabz.com",
|
||||
billFromAddress: "Ganesh glory,Godrej garden city,Ahmedabad.",
|
||||
billFromPhone: 979796786,
|
||||
billFromFax: 13,
|
||||
billTo: "Soft solution.",
|
||||
billToEmail: "toFirst@agth.com",
|
||||
billToAddress: "Godrej garden city,Ahmedabad.",
|
||||
billToPhone: 757575233,
|
||||
billToFax: 76,
|
||||
orders: [
|
||||
{
|
||||
itemName: "Courge",
|
||||
unitPrice: 10,
|
||||
units: 9,
|
||||
unitTotalPrice: 90,
|
||||
},
|
||||
],
|
||||
orderDate: new Date("2020-10-15"),
|
||||
totalCost: 90,
|
||||
vat: 9,
|
||||
grandTotal: 99,
|
||||
status: "Delivered",
|
||||
completed: false,
|
||||
isSelected: false,
|
||||
},
|
||||
];
|
||||
|
||||
mock.onGet("/api/data/invoices/invoiceData").reply(() => {
|
||||
return [200, InvoiceData];
|
||||
});
|
||||
|
||||
// Handle POST requests to add a new invoice
|
||||
mock.onPost("/api/data/invoices/invoiceData").reply((config) => {
|
||||
try {
|
||||
// Parse the new invoice from the request body
|
||||
const newInvoice = JSON.parse(config.data) as InvoiceType;
|
||||
|
||||
// Assign a new ID to the new invoice
|
||||
const newId =
|
||||
InvoiceData.length > 0
|
||||
? Math.max(...InvoiceData.map((i) => i.id)) + 1
|
||||
: 1;
|
||||
newInvoice.id = newId;
|
||||
|
||||
// Add the new invoice to the invoice array
|
||||
InvoiceData.push(newInvoice);
|
||||
|
||||
// Return the new invoice in the response
|
||||
return [201, newInvoice];
|
||||
} catch (error) {
|
||||
return [500, { message: "Failed to add new invoice" }];
|
||||
}
|
||||
});
|
||||
|
||||
// Handle PUT requests to update an existing invoice
|
||||
mock.onPut(/\/api\/data\/invoices\/invoiceData\/\d+/).reply((config) => {
|
||||
const id = config.url?.split('/').pop(); // Get the last segment of the URL
|
||||
console.log('Extracted ID:', id);
|
||||
if (!id) {
|
||||
return [400, { message: "Invalid ID" }];
|
||||
}
|
||||
|
||||
const updatedInvoice = JSON.parse(config.data) as InvoiceType;
|
||||
const index = InvoiceData.findIndex(invoice => invoice.id === parseInt(id, 10));
|
||||
console.log('Index of invoice to update:', index);
|
||||
|
||||
if (index !== -1) {
|
||||
InvoiceData[index] = { ...InvoiceData[index], ...updatedInvoice };
|
||||
|
||||
return [200, InvoiceData[index]];
|
||||
}
|
||||
|
||||
return [404, { message: "Invoice not found" }];
|
||||
});
|
||||
|
||||
export default InvoiceData;
|
||||
141
_mockApis/apps/kanban/index.ts
Executable file
141
_mockApis/apps/kanban/index.ts
Executable file
@@ -0,0 +1,141 @@
|
||||
import mock from '../../mockAdapter';
|
||||
import image1 from '@/assets/images/backgrounds/kanban-img-1.jpg';
|
||||
import image2 from '@/assets/images/backgrounds/kanban-img-2.jpg';
|
||||
import image3 from '@/assets/images/backgrounds/kanban-img-3.jpg';
|
||||
import image4 from '@/assets/images/backgrounds/kanban-img-4.jpg';
|
||||
import { uniqueId } from 'lodash';
|
||||
import { sub } from 'date-fns';
|
||||
|
||||
interface TaskType {
|
||||
id?: number | any;
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
cardbg?: string;
|
||||
datef?: Date | any;
|
||||
taskimg?: string;
|
||||
date?: Date | any;
|
||||
category?: string;
|
||||
tasks?: TaskType[];
|
||||
categorybg?: string;
|
||||
}
|
||||
|
||||
const TaskData: TaskType[] = [
|
||||
{
|
||||
id: uniqueId('#m_'),
|
||||
title: 'Todo',
|
||||
cardbg: 'light',
|
||||
tasks: [
|
||||
{
|
||||
id: uniqueId('#task_'),
|
||||
title: 'This is first task',
|
||||
taskimg: image1,
|
||||
date:sub(new Date(), { months: 1 }),
|
||||
category: 'Design',
|
||||
categorybg: 'success'
|
||||
},
|
||||
{
|
||||
id: uniqueId('#task_'),
|
||||
title: 'Lets do some task on pd',
|
||||
subtitle: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, o eiusmod tempor incid.',
|
||||
date:sub(new Date(), { days: 2 }),
|
||||
category: 'Development',
|
||||
categorybg: 'warning'
|
||||
},
|
||||
{
|
||||
id: uniqueId('#task_'),
|
||||
title: 'Do some projects on React Native with Flutter',
|
||||
date:sub(new Date(), { days: 4 }),
|
||||
category: 'Mobile',
|
||||
categorybg: 'primary'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: uniqueId('#m_'),
|
||||
title: 'In Progress',
|
||||
cardbg: 'lightsecondary',
|
||||
tasks: [
|
||||
{
|
||||
id: uniqueId('#task_'),
|
||||
title: 'Work on Dashboard Designing',
|
||||
date:sub(new Date(), { seconds: 1 }),
|
||||
category: 'Mobile',
|
||||
categorybg: 'primary'
|
||||
},
|
||||
{
|
||||
id: uniqueId('#task_'),
|
||||
title: 'Battle with fire',
|
||||
taskimg: image2,
|
||||
date:sub(new Date(), { seconds: 1 }),
|
||||
category: 'Design',
|
||||
categorybg: 'success'
|
||||
},
|
||||
{
|
||||
id: uniqueId('#task_'),
|
||||
title: 'Do some projects on Reactjs with tailwind ',
|
||||
date:sub(new Date(), { seconds: 1 }),
|
||||
category: 'Mobile',
|
||||
categorybg: 'primary'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: uniqueId('#m_'),
|
||||
title: 'Pending',
|
||||
cardbg: 'lightinfo',
|
||||
tasks: [
|
||||
{
|
||||
id: uniqueId('#task_'),
|
||||
title: 'Create a Nextjs Dashboard',
|
||||
date:sub(new Date(), { seconds: 1 }),
|
||||
category: 'Design',
|
||||
categorybg: 'success'
|
||||
},
|
||||
{
|
||||
id: uniqueId('#task_'),
|
||||
title: 'Solve Vuejs Project errors',
|
||||
subtitle: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, o eiusmod tempor incid.',
|
||||
date:sub(new Date(), { seconds: 1 }),
|
||||
category: 'Development',
|
||||
categorybg: 'primary'
|
||||
},
|
||||
{
|
||||
id: uniqueId('#task_'),
|
||||
taskimg: image4,
|
||||
title: 'Redesign Overview',
|
||||
date:sub(new Date(), { seconds: 1 }),
|
||||
category: 'Design',
|
||||
categorybg: 'error'
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
id: uniqueId('#m_'),
|
||||
title: 'Done',
|
||||
cardbg: 'lightsuccess',
|
||||
tasks: [
|
||||
{
|
||||
id: uniqueId('#task_'),
|
||||
title: 'Develop React app',
|
||||
taskimg: image3,
|
||||
date:sub(new Date(), { months: 1 }),
|
||||
category: 'Mobile',
|
||||
categorybg: 'warning'
|
||||
},
|
||||
{
|
||||
id: uniqueId('#task_'),
|
||||
title: 'Do some task on Nuxtjs',
|
||||
subtitle: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit',
|
||||
date:sub(new Date(), { seconds: 1 }),
|
||||
category: 'Design',
|
||||
categorybg: 'error'
|
||||
},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
mock.onGet('/api/data/task/TaskData').reply(() => {
|
||||
return [200, TaskData];
|
||||
});
|
||||
export default TaskData;
|
||||
68
_mockApis/apps/notes/index.ts
Executable file
68
_mockApis/apps/notes/index.ts
Executable file
@@ -0,0 +1,68 @@
|
||||
import mock from '../../mockAdapter';
|
||||
|
||||
interface NotesType {
|
||||
id?: number | any;
|
||||
color?: string;
|
||||
title?: string;
|
||||
datef?: string | Date;
|
||||
}
|
||||
|
||||
const NotesData: NotesType[] = [
|
||||
{
|
||||
id: 1,
|
||||
color: 'primary',
|
||||
title: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
datef: '2023-06-03T23:28:56.782Z'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
color: 'error',
|
||||
title: 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,',
|
||||
datef: '2023-06-02T23:28:56.782Z'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
color: 'warning',
|
||||
title: 'consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?',
|
||||
datef: '2023-06-01T23:28:56.782Z'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
color: 'success',
|
||||
title: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
||||
datef: '2023-06-03T23:28:56.782Z'
|
||||
}
|
||||
];
|
||||
|
||||
interface colorVariationType {
|
||||
id?: number;
|
||||
color?: string;
|
||||
}
|
||||
|
||||
export const colorVariation: colorVariationType[] = [
|
||||
{
|
||||
id: 1,
|
||||
color: 'warning'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
color: 'secondary'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
color: 'error'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
color: 'success'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
color: 'primary'
|
||||
}
|
||||
];
|
||||
|
||||
mock.onGet('/api/data/notes/NotesData').reply(() => {
|
||||
return [200, NotesData];
|
||||
});
|
||||
export default NotesData;
|
||||
118
_mockApis/apps/tickets/index.ts
Executable file
118
_mockApis/apps/tickets/index.ts
Executable file
@@ -0,0 +1,118 @@
|
||||
import mock from '../../mockAdapter';
|
||||
import { Chance } from 'chance';
|
||||
const chance = new Chance();
|
||||
interface TicketType {
|
||||
Id?: number | any;
|
||||
ticketTitle?: string;
|
||||
ticketDescription?: string;
|
||||
Status?: string;
|
||||
Label?: string;
|
||||
thumb?: string;
|
||||
AgentName?: string;
|
||||
Date?: string | Date;
|
||||
}
|
||||
|
||||
import user1 from '@/assets/images/profile/user-2.jpg';
|
||||
import user2 from '@/assets/images/profile/user-3.jpg';
|
||||
import user3 from '@/assets/images/profile/user-4.jpg';
|
||||
import user4 from '@/assets/images/profile/user-5.jpg';
|
||||
import user5 from '@/assets/images/profile/user-6.jpg';
|
||||
import user6 from '@/assets/images/profile/user-7.jpg';
|
||||
import user7 from '@/assets/images/profile/user-8.jpg';
|
||||
import user10 from '@/assets/images/profile/user-10.jpg';
|
||||
|
||||
const TicketData: TicketType[] = [
|
||||
{
|
||||
Id: 1,
|
||||
ticketTitle: 'Sed ut perspiciatis unde omnis iste',
|
||||
ticketDescription:
|
||||
'ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos',
|
||||
Status: 'Closed',
|
||||
Label: 'error',
|
||||
thumb: user10,
|
||||
AgentName: 'Liam',
|
||||
Date: chance.date()
|
||||
},
|
||||
{
|
||||
Id: 2,
|
||||
ticketTitle: 'Consequuntur magni dolores eos qui ratione',
|
||||
ticketDescription:
|
||||
'ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos',
|
||||
Status: 'Pending',
|
||||
Label: 'warning',
|
||||
thumb: user1,
|
||||
AgentName: 'Steve',
|
||||
Date: chance.date()
|
||||
},
|
||||
{
|
||||
Id: 3,
|
||||
ticketTitle: 'Exercitationem ullam corporis',
|
||||
ticketDescription:
|
||||
'ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos',
|
||||
Status: 'Open',
|
||||
Label: 'success',
|
||||
thumb: user2,
|
||||
AgentName: 'Jack',
|
||||
Date: chance.date()
|
||||
},
|
||||
{
|
||||
Id: 4,
|
||||
ticketTitle: 'Sed ut perspiciatis unde omnis iste',
|
||||
ticketDescription:
|
||||
'ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos',
|
||||
Status: 'Closed',
|
||||
Label: 'error',
|
||||
thumb: user3,
|
||||
AgentName: 'Steve',
|
||||
Date: chance.date()
|
||||
},
|
||||
{
|
||||
Id: 5,
|
||||
ticketTitle: 'Exercitationem ullam corporis',
|
||||
ticketDescription:
|
||||
'ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos',
|
||||
Status: 'Closed',
|
||||
Label: 'error',
|
||||
thumb: user4,
|
||||
AgentName: 'Liam',
|
||||
Date: chance.date()
|
||||
},
|
||||
{
|
||||
Id: 6,
|
||||
ticketTitle: 'Consequuntur magni dolores eos qui ratione',
|
||||
ticketDescription:
|
||||
'ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos',
|
||||
Status: 'Pending',
|
||||
Label: 'warning',
|
||||
thumb: user5,
|
||||
AgentName: 'Jack',
|
||||
Date: chance.date()
|
||||
},
|
||||
{
|
||||
Id: 7,
|
||||
ticketTitle: 'Sed ut perspiciatis unde omnis iste',
|
||||
ticketDescription:
|
||||
'ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos',
|
||||
Status: 'Open',
|
||||
Label: 'success',
|
||||
thumb: user6,
|
||||
AgentName: 'Steve',
|
||||
Date: chance.date()
|
||||
},
|
||||
{
|
||||
Id: 8,
|
||||
ticketTitle: 'Consequuntur magni dolores eos qui ratione',
|
||||
ticketDescription:
|
||||
'ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos',
|
||||
Status: 'Closed',
|
||||
Label: 'error',
|
||||
thumb: user7,
|
||||
AgentName: 'John',
|
||||
Date: chance.date()
|
||||
}
|
||||
];
|
||||
|
||||
mock.onGet('/api/data/tickets/TicketData').reply(() => {
|
||||
return [200, TicketData];
|
||||
});
|
||||
export default TicketData;
|
||||
171
_mockApis/apps/userprofile/followers.ts
Executable file
171
_mockApis/apps/userprofile/followers.ts
Executable file
@@ -0,0 +1,171 @@
|
||||
// project imports
|
||||
import mock from '../../mockAdapter';
|
||||
import user1 from '@/assets/images/profile/user-1.jpg';
|
||||
import user8 from '@/assets/images/profile/user-2.jpg';
|
||||
import user3 from '@/assets/images/profile/user-3.jpg';
|
||||
import user4 from '@/assets/images/profile/user-4.jpg';
|
||||
import user5 from '@/assets/images/profile/user-5.jpg';
|
||||
import user6 from '@/assets/images/profile/user-6.jpg';
|
||||
import user7 from '@/assets/images/profile/user-7.jpg';
|
||||
import user11 from '@/assets/images/profile/user-3.jpg';
|
||||
import user12 from '@/assets/images/profile/user-4.jpg';
|
||||
import user9 from '@/assets/images/profile/user-5.jpg';
|
||||
import user10 from '@/assets/images/profile/user-2.jpg';
|
||||
|
||||
// types
|
||||
export type KeyedObject = {
|
||||
[key: string]: string | number | KeyedObject | any;
|
||||
};
|
||||
|
||||
// followers list
|
||||
|
||||
const followers: KeyedObject[] = [
|
||||
{
|
||||
id: '#1Followers_Barney',
|
||||
avatar: user6,
|
||||
name: 'Barney',
|
||||
location: 'Handburgh',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#2Followers_Thea',
|
||||
avatar: user3,
|
||||
name: 'Thea',
|
||||
location: 'New jana',
|
||||
follow: 2
|
||||
},
|
||||
{
|
||||
id: '#3Followers_Guiseppe',
|
||||
avatar: user7,
|
||||
name: 'Guiseppe',
|
||||
location: 'Jenkinsstad',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#4Followers_Henderson',
|
||||
avatar: user8,
|
||||
name: 'Henderson',
|
||||
location: 'South Antonina',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#5Followers_Maddison',
|
||||
avatar: user6,
|
||||
name: 'Maddison',
|
||||
location: 'New Dorthy',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#6Followers_Wilber',
|
||||
avatar: user1,
|
||||
name: 'Wilber',
|
||||
location: 'Twilahsven',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#7Followers_Hayden',
|
||||
avatar: user4,
|
||||
name: 'Hayden',
|
||||
location: 'Darrelshaire',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#8Followers_Lloyd',
|
||||
avatar: user10,
|
||||
name: 'Lloyd',
|
||||
location: 'New Credrick',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#9Followers_Kris',
|
||||
avatar: user8,
|
||||
name: 'Kris',
|
||||
location: 'New Dianna',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#10Followers_Kyler',
|
||||
avatar: user11,
|
||||
name: 'Kyler',
|
||||
location: 'Murraymouth',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#11Followers_Pamela',
|
||||
avatar: user3,
|
||||
name: 'Pamela',
|
||||
location: 'Murraymouth',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#12Followers_Betty',
|
||||
avatar: user6,
|
||||
name: 'John Doe',
|
||||
location: 'North Zole',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#13Followers_Anthony',
|
||||
avatar: user5,
|
||||
name: 'Anthony',
|
||||
location: 'Lake Judy',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#14Followers_Reggie',
|
||||
avatar: user12,
|
||||
name: 'Reggie',
|
||||
location: 'Kailynland',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#15Followers_Francesca',
|
||||
avatar: user1,
|
||||
name: 'Francesca',
|
||||
location: 'Pagacview',
|
||||
follow: 2
|
||||
},
|
||||
{
|
||||
id: '#16Followers_Carmel',
|
||||
avatar: user9,
|
||||
name: 'Carmel',
|
||||
location: 'Port Lerashire',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#17Followers_Darwin',
|
||||
avatar: user4,
|
||||
name: 'Darwin',
|
||||
location: 'North Jacquesside',
|
||||
follow: 2
|
||||
},
|
||||
{
|
||||
id: '#18Followers_Kaylin',
|
||||
avatar: user3,
|
||||
name: 'Kaylin',
|
||||
location: 'Bergstrombury',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#19Followers_Kamryn',
|
||||
avatar: user7,
|
||||
name: 'Kamryn',
|
||||
location: 'South Norma',
|
||||
follow: 1
|
||||
},
|
||||
{
|
||||
id: '#20Followers_Madelyn',
|
||||
avatar: user8,
|
||||
name: 'Madelyn',
|
||||
location: 'Port Opheliamouth',
|
||||
follow: 1
|
||||
}
|
||||
];
|
||||
|
||||
// ==============================|| MOCK SERVICES ||============================== //
|
||||
|
||||
mock.onGet('/api/followers/list').reply(200, { followers });
|
||||
|
||||
// mock.onGet('/api/followers/list').reply(() => {
|
||||
// return [200, followers];
|
||||
// });
|
||||
192
_mockApis/apps/userprofile/friends.ts
Executable file
192
_mockApis/apps/userprofile/friends.ts
Executable file
@@ -0,0 +1,192 @@
|
||||
// project imports
|
||||
import mock from '../../mockAdapter';
|
||||
import { Chance } from 'chance';
|
||||
|
||||
|
||||
import user1 from '@/assets/images/profile/user-10.jpg';
|
||||
import user2 from '@/assets/images/profile/user-2.jpg';
|
||||
import user8 from '@/assets/images/profile/user-6.jpg';
|
||||
import user3 from '@/assets/images/profile/user-3.jpg';
|
||||
import user4 from '@/assets/images/profile/user-4.jpg';
|
||||
import user5 from '@/assets/images/profile/user-5.jpg';
|
||||
import user6 from '@/assets/images/profile/user-6.jpg';
|
||||
import user7 from '@/assets/images/profile/user-7.jpg';
|
||||
import user11 from '@/assets/images/profile/user-3.jpg';
|
||||
import user12 from '@/assets/images/profile/user-4.jpg';
|
||||
import user9 from '@/assets/images/profile/user-5.jpg';
|
||||
import user10 from '@/assets/images/profile/user-2.jpg';
|
||||
|
||||
const chance = new Chance();
|
||||
|
||||
// types
|
||||
export type KeyedObject = {
|
||||
[key: string]: string | number | KeyedObject | any;
|
||||
};
|
||||
|
||||
// friends list
|
||||
const friends: KeyedObject[] = [
|
||||
{
|
||||
id: '#1Friends_Barney',
|
||||
avatar: user1,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 10
|
||||
},
|
||||
{
|
||||
id: '#2Friends_Thea',
|
||||
avatar: user2,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 89
|
||||
},
|
||||
{
|
||||
id: '#3Friends_Guiseppe',
|
||||
avatar: user3,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 65
|
||||
},
|
||||
{
|
||||
id: '#4Friends_Henderson',
|
||||
avatar: user4,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 1
|
||||
},
|
||||
{
|
||||
id: '#5Friends_Maddison',
|
||||
avatar: user5,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 14
|
||||
},
|
||||
{
|
||||
id: '#6Friends_Wilber',
|
||||
avatar: user6,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 36
|
||||
},
|
||||
{
|
||||
id: '#7Friends_Hayden',
|
||||
avatar: user7,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 106
|
||||
},
|
||||
{
|
||||
id: '#8Friends_Lloyd',
|
||||
avatar: user8,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 10
|
||||
},
|
||||
{
|
||||
id: '#9Friends_Kris',
|
||||
avatar: user9,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 0
|
||||
},
|
||||
{
|
||||
id: '#10Friends_Kyler',
|
||||
avatar: user10,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 48
|
||||
},
|
||||
{
|
||||
id: '#11Friends_Pamela',
|
||||
avatar: user11,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 72
|
||||
},
|
||||
{
|
||||
id: '#12Friends_Betty',
|
||||
avatar: user12,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 99
|
||||
},
|
||||
{
|
||||
id: '#13Friends_Anthony',
|
||||
avatar: user1,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 78
|
||||
},
|
||||
{
|
||||
id: '#14Friends_Reggie',
|
||||
avatar: user3,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 1
|
||||
},
|
||||
{
|
||||
id: '#15Friends_Francesca',
|
||||
avatar: user4,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 68
|
||||
},
|
||||
{
|
||||
id: '#16Friends_Carmel',
|
||||
avatar: user5,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 15
|
||||
},
|
||||
{
|
||||
id: '#17Friends_Darwin',
|
||||
avatar: user6,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 10
|
||||
},
|
||||
{
|
||||
id: '#18Friends_Kaylin',
|
||||
avatar: user7,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 36
|
||||
},
|
||||
{
|
||||
id: '#19Friends_Kamryn',
|
||||
avatar: user8,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 55
|
||||
},
|
||||
{
|
||||
id: '#20Friends_Madelyn',
|
||||
avatar: user9,
|
||||
name: chance.name(),
|
||||
location: chance.country({ full: true }),
|
||||
role: chance.profession(),
|
||||
mutual: 78
|
||||
}
|
||||
];
|
||||
|
||||
// ==============================|| MOCK SERVICES ||============================== //
|
||||
|
||||
mock.onGet('/api/friends/list').reply(200, { friends });
|
||||
101
_mockApis/apps/userprofile/gallery.ts
Executable file
101
_mockApis/apps/userprofile/gallery.ts
Executable file
@@ -0,0 +1,101 @@
|
||||
// project imports
|
||||
import mock from '../../mockAdapter';
|
||||
// assets
|
||||
import image1 from '@/assets/images/products/s1.jpg';
|
||||
import image2 from '@/assets/images/products/s2.jpg';
|
||||
import image3 from '@/assets/images/products/s3.jpg';
|
||||
import image4 from '@/assets/images/products/s4.jpg';
|
||||
import image5 from '@/assets/images/products/s5.jpg';
|
||||
import image6 from '@/assets/images/products/s6.jpg';
|
||||
import image7 from '@/assets/images/products/s7.jpg';
|
||||
import image8 from '@/assets/images/products/s8.jpg';
|
||||
import image9 from '@/assets/images/products/s9.jpg';
|
||||
import image10 from '@/assets/images/products/s10.jpg';
|
||||
import image11 from '@/assets/images/products/s11.jpg';
|
||||
import image12 from '@/assets/images/products/s12.jpg';
|
||||
|
||||
// types
|
||||
export type KeyedObject = {
|
||||
[key: string]: string | number | KeyedObject | any;
|
||||
};
|
||||
|
||||
// gallery components
|
||||
|
||||
const gallery: KeyedObject[] = [
|
||||
{
|
||||
id: '#1Gallery',
|
||||
image: image1,
|
||||
title: '1080p_table_denar.pdf',
|
||||
dateTime: 'Tue Aug 24 2021'
|
||||
},
|
||||
{
|
||||
id: '#2Gallery',
|
||||
image: image2,
|
||||
title: 'handmade.mp2',
|
||||
dateTime: 'Fri Apr 30 2021'
|
||||
},
|
||||
{
|
||||
id: '#3Gallery',
|
||||
image: image3,
|
||||
title: 'granite_cheese.wav',
|
||||
dateTime: 'Fri Jun 25 2021'
|
||||
},
|
||||
{
|
||||
id: '#4Gallery',
|
||||
image: image4,
|
||||
title: 'invoice.mpg',
|
||||
dateTime: 'Sat Oct 23 2021'
|
||||
},
|
||||
{
|
||||
id: '#5Gallery',
|
||||
image: image5,
|
||||
title: 'benchmark_forge.m1v',
|
||||
dateTime: 'Fri Jan 21 2022'
|
||||
},
|
||||
{
|
||||
id: '#6Gallery',
|
||||
image: image6,
|
||||
title: 'violet_withdrawal.png',
|
||||
dateTime: 'Wed Sep 22 2021'
|
||||
},
|
||||
{
|
||||
id: '#7Gallery',
|
||||
image: image7,
|
||||
title: 'web_readiness.mpeg',
|
||||
dateTime: 'Mon Jul 12 2021'
|
||||
},
|
||||
{
|
||||
id: '#8Gallery',
|
||||
image: image8,
|
||||
title: 'zimbabwe.htm',
|
||||
dateTime: 'Sat Mar 20 2021'
|
||||
},
|
||||
{
|
||||
id: '#9Gallery',
|
||||
image: image9,
|
||||
title: 'circuit.m3a',
|
||||
dateTime: 'Tue Jan 18 2022'
|
||||
},
|
||||
{
|
||||
id: '#10Gallery',
|
||||
image: image10,
|
||||
title: 'data_red.png',
|
||||
dateTime: 'Sun Apr 04 2021'
|
||||
},
|
||||
{
|
||||
id: '#11Gallery',
|
||||
image: image11,
|
||||
title: 'handcrafted.html',
|
||||
dateTime: 'Tue May 25 2021'
|
||||
},
|
||||
{
|
||||
id: '#12Gallery',
|
||||
image: image12,
|
||||
title: 'hacking_games.pdf',
|
||||
dateTime: 'Tue Oct 19 2021'
|
||||
}
|
||||
];
|
||||
|
||||
// ==============================|| MOCK SERVICES ||============================== //
|
||||
|
||||
mock.onGet('/api/gallery/list').reply(200, { gallery });
|
||||
77
_mockApis/apps/userprofile/photos.ts
Executable file
77
_mockApis/apps/userprofile/photos.ts
Executable file
@@ -0,0 +1,77 @@
|
||||
// project imports
|
||||
import mock from '../../mockAdapter';
|
||||
// assets
|
||||
import image1 from '@/assets/images/products/s1.jpg';
|
||||
import image2 from '@/assets/images/products/s2.jpg';
|
||||
import image3 from '@/assets/images/products/s3.jpg';
|
||||
import image4 from '@/assets/images/products/s4.jpg';
|
||||
import image5 from '@/assets/images/products/s5.jpg';
|
||||
import image6 from '@/assets/images/products/s6.jpg';
|
||||
import image7 from '@/assets/images/products/s7.jpg';
|
||||
import image8 from '@/assets/images/products/s8.jpg';
|
||||
import image9 from '@/assets/images/products/s9.jpg';
|
||||
import image10 from '@/assets/images/products/s10.jpg';
|
||||
import image11 from '@/assets/images/products/s11.jpg';
|
||||
import image12 from '@/assets/images/products/s12.jpg';
|
||||
|
||||
// types
|
||||
export type KeyedObject = {
|
||||
[key: string]: string | number | KeyedObject | any;
|
||||
};
|
||||
|
||||
// Photos components
|
||||
|
||||
const photos: KeyedObject[] = [
|
||||
{
|
||||
id: '#1Photos',
|
||||
avatar: image1,
|
||||
},
|
||||
{
|
||||
id: '#2Photos',
|
||||
avatar: image2,
|
||||
},
|
||||
{
|
||||
id: '#3Photos',
|
||||
avatar: image3,
|
||||
},
|
||||
{
|
||||
id: '#4Photos',
|
||||
avatar: image4,
|
||||
},
|
||||
{
|
||||
id: '#5Photos',
|
||||
avatar: image5,
|
||||
},
|
||||
{
|
||||
id: '#6Photos',
|
||||
avatar: image6,
|
||||
},
|
||||
{
|
||||
id: '#7Photos',
|
||||
avatar: image7,
|
||||
},
|
||||
{
|
||||
id: '#8Photos',
|
||||
avatar: image8,
|
||||
},
|
||||
{
|
||||
id: '#9Photos',
|
||||
avatar: image9,
|
||||
},
|
||||
{
|
||||
id: '#10Photos',
|
||||
avatar: image10,
|
||||
},
|
||||
{
|
||||
id: '#11Photos',
|
||||
avatar: image11,
|
||||
},
|
||||
{
|
||||
id: '#12Photos',
|
||||
avatar: image12,
|
||||
},
|
||||
];
|
||||
|
||||
// ==============================|| MOCK SERVICES ||============================== //
|
||||
|
||||
mock.onGet('/api/photos').reply(200, { photos });
|
||||
305
_mockApis/apps/userprofile/posts.ts
Executable file
305
_mockApis/apps/userprofile/posts.ts
Executable file
@@ -0,0 +1,305 @@
|
||||
// project imports
|
||||
import mock from '../../mockAdapter';
|
||||
import { Chance } from 'chance';
|
||||
|
||||
// types
|
||||
import type { Post } from '@/types/apps/PostType';
|
||||
|
||||
// assets
|
||||
import image1 from '@/assets/images/products/s1.jpg';
|
||||
import image2 from '@/assets/images/products/s2.jpg';
|
||||
import image4 from '@/assets/images/products/s4.jpg';
|
||||
import user1 from '@/assets/images/profile/user-1.jpg';
|
||||
import user2 from '@/assets/images/profile/user-2.jpg';
|
||||
import user3 from '@/assets/images/profile/user-3.jpg';
|
||||
import user4 from '@/assets/images/profile/user-4.jpg';
|
||||
import user5 from '@/assets/images/profile/user-5.jpg';
|
||||
|
||||
const chance = new Chance();
|
||||
|
||||
// social profile
|
||||
let posts: Post[] = [
|
||||
{
|
||||
id: '#1POST_MATHEW',
|
||||
profile: {
|
||||
id: '#52MATHEW',
|
||||
avatar: user1,
|
||||
name: 'David McMichael',
|
||||
time: '15 min ago'
|
||||
},
|
||||
data: {
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
images: [
|
||||
{
|
||||
img: image1,
|
||||
featured: true
|
||||
}
|
||||
],
|
||||
likes: {
|
||||
like: true,
|
||||
value: 102
|
||||
},
|
||||
comments: [
|
||||
{
|
||||
id: '#3COMMENTMATHEWE',
|
||||
profile: {
|
||||
id: '#52MATHEW',
|
||||
avatar: user3,
|
||||
name: 'Deran Mac',
|
||||
time: '8 mins ago '
|
||||
},
|
||||
data: {
|
||||
comment: chance.paragraph({ sentences: 1 }),
|
||||
likes: {
|
||||
like: true,
|
||||
value: 55
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '#2COMMENT_MATHEW',
|
||||
profile: {
|
||||
id: '#52MATHEW',
|
||||
avatar: user4,
|
||||
name: 'Jonathan Bg',
|
||||
time: '5 mins ago '
|
||||
},
|
||||
data: {
|
||||
comment:
|
||||
chance.paragraph({ sentences: 1 }),
|
||||
likes: {
|
||||
like: false,
|
||||
value: 68
|
||||
},
|
||||
replies: [
|
||||
{
|
||||
id: '#1REPLY_MATHEW',
|
||||
profile: {
|
||||
id: '#52MATHEW',
|
||||
avatar: user5,
|
||||
name: 'Carry minati',
|
||||
time: 'just now '
|
||||
},
|
||||
data: {
|
||||
comment: chance.paragraph({ sentences: 1 }),
|
||||
likes: {
|
||||
like: true,
|
||||
value: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '#4POST_CARRY',
|
||||
profile: {
|
||||
id: '#52CARRY',
|
||||
avatar: user1,
|
||||
name: 'Carry Minati',
|
||||
time: 'now'
|
||||
},
|
||||
data: {
|
||||
content: chance.paragraph({ sentences: 2 }),
|
||||
images: [],
|
||||
likes: {
|
||||
like: false,
|
||||
value: 67
|
||||
},
|
||||
comments: []
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '#2POST_GENELIA',
|
||||
profile: {
|
||||
id: '#52GENELIA',
|
||||
avatar: user2,
|
||||
name: 'Genelia Desouza',
|
||||
time: '15 min ago '
|
||||
},
|
||||
data: {
|
||||
content: chance.paragraph({ sentences: 1 }),
|
||||
images: [
|
||||
{
|
||||
img: image2,
|
||||
title: 'Image Title'
|
||||
},
|
||||
{
|
||||
img: image4,
|
||||
title: 'Painter'
|
||||
}
|
||||
],
|
||||
likes: {
|
||||
like: false,
|
||||
value: 320
|
||||
},
|
||||
comments: [
|
||||
{
|
||||
id: '#2COMMENT_GENELIA',
|
||||
profile: {
|
||||
id: '#52GENELIA',
|
||||
avatar: user3,
|
||||
name: 'Ritesh Deshmukh',
|
||||
time: '15 min ago '
|
||||
},
|
||||
data: {
|
||||
comment:
|
||||
chance.paragraph({ sentences: 1 }),
|
||||
likes: {
|
||||
like: true,
|
||||
value: 65
|
||||
},
|
||||
replies: []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '#3POST_Mathew',
|
||||
profile: {
|
||||
id: '#52Mathew',
|
||||
avatar: user1,
|
||||
name: 'David McMichael',
|
||||
time: '15 min ago '
|
||||
},
|
||||
data: {
|
||||
content: chance.paragraph({ sentences: 1 }),
|
||||
images: [],
|
||||
video: 'd1-FRj20WBE',
|
||||
likes: {
|
||||
like: true,
|
||||
value: 130
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
// ==============================|| MOCK SERVICES ||============================== //
|
||||
|
||||
//mock.onGet('/api/posts/list').reply(200, { posts });
|
||||
mock.onGet('/api/posts/list').reply(() => {
|
||||
return [200, posts];
|
||||
});
|
||||
|
||||
mock.onPost('/api/posts/editComment').reply((config) => {
|
||||
try {
|
||||
const { key, id } = JSON.parse(config.data);
|
||||
|
||||
posts = posts.filter((post, index) => {
|
||||
if (post.id === key) {
|
||||
const cComments = post.data.comments || [];
|
||||
post.data.comments = [id, ...cComments];
|
||||
return post;
|
||||
}
|
||||
return post;
|
||||
});
|
||||
|
||||
return [200, { posts }];
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [500, { message: 'Internal server error' }];
|
||||
}
|
||||
});
|
||||
|
||||
mock.onPost('/api/comments/add').reply((config) => {
|
||||
try {
|
||||
const { postId, comment } = JSON.parse(config.data);
|
||||
|
||||
const postIndex = posts.findIndex((x) => x.id === postId);
|
||||
const post = posts[postIndex];
|
||||
const cComments = post.data.comments || [];
|
||||
post.data.comments = [comment, ...cComments];
|
||||
|
||||
return [200, { posts: [...posts] }];
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [500, { message: 'Internal server error' }];
|
||||
}
|
||||
});
|
||||
|
||||
mock.onPost('/api/replies/add').reply((config) => {
|
||||
try {
|
||||
const { postId, commentId, reply } = JSON.parse(config.data);
|
||||
const postIndex = posts.findIndex((x: any) => x.id === postId);
|
||||
const post = posts[postIndex];
|
||||
const cComments = post.data.comments || [];
|
||||
const commentIndex = cComments.findIndex((x: any) => x.id === commentId);
|
||||
const comment = cComments[commentIndex];
|
||||
/** comment.data.replies has to be defined */
|
||||
if (comment && comment.data && comment.data.replies) comment.data.replies = [...comment.data.replies, reply];
|
||||
return [200, { posts: [...posts] }];
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [500, { message: 'Internal server error' }];
|
||||
}
|
||||
});
|
||||
|
||||
mock.onPost('/api/posts/list/like').reply((config) => {
|
||||
try {
|
||||
const { postId } = JSON.parse(config.data);
|
||||
const postIndex = posts.findIndex((x: any) => x.id === postId);
|
||||
|
||||
const post = { ...posts[postIndex] };
|
||||
post.data = { ...post.data };
|
||||
|
||||
post.data.likes = { ...post.data.likes };
|
||||
post.data.likes.like = !post.data.likes.like;
|
||||
post.data.likes.value = post.data.likes.like ? post.data.likes.value + 1 : post.data.likes.value - 1;
|
||||
posts[postIndex] = post;
|
||||
return [200, { posts: [...posts] }];
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [500, { message: 'Internal server error' }];
|
||||
}
|
||||
});
|
||||
|
||||
mock.onPost('/api/comments/list/like').reply((config) => {
|
||||
try {
|
||||
const { postId, commentId } = JSON.parse(config.data);
|
||||
const postIndex = posts.findIndex((x: any) => x.id === postId);
|
||||
const post = posts[postIndex];
|
||||
const cComments = post.data.comments || [];
|
||||
const commentIndex = cComments.findIndex((x: any) => x.id === commentId);
|
||||
const comment = { ...cComments[commentIndex] };
|
||||
/** comment.data.likes has to be defined */
|
||||
if (comment && comment.data && comment.data.likes) comment.data.likes.like = !comment.data.likes.like;
|
||||
if (comment && comment.data && comment.data.likes)
|
||||
comment.data.likes.value = comment.data.likes.like ? comment.data.likes.value + 1 : comment.data.likes.value - 1;
|
||||
if (post && post.data && post.data.comments) post.data.comments[commentIndex] = comment;
|
||||
return [200, { posts: [...posts] }];
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [500, { message: 'Internal server error' }];
|
||||
}
|
||||
});
|
||||
|
||||
mock.onPost('/api/replies/list/like').reply((config) => {
|
||||
try {
|
||||
const { postId, commentId, replayId } = JSON.parse(config.data);
|
||||
const postIndex = posts.findIndex((x: any) => x.id === postId);
|
||||
const post = posts[postIndex];
|
||||
const cComments = post.data.comments || [];
|
||||
const commentIndex = cComments.findIndex((x: any) => x.id === commentId);
|
||||
const comment = { ...cComments[commentIndex] };
|
||||
const replayIndex = comment?.data?.replies?.findIndex((x: any) => x.id === replayId);
|
||||
if (replayIndex !== undefined) {
|
||||
if (comment && comment.data && comment.data.replies) {
|
||||
const reply = { ...comment.data.replies[replayIndex] };
|
||||
if (reply && reply.data && reply.data.likes) {
|
||||
reply.data.likes.like = !reply.data.likes.like;
|
||||
reply.data.likes.value = reply.data.likes.like ? reply.data.likes.value + 1 : reply.data.likes.value - 1;
|
||||
}
|
||||
comment.data.replies[replayIndex] = reply;
|
||||
if (post && post.data && post.data.comments) post.data.comments[commentIndex] = comment;
|
||||
}
|
||||
}
|
||||
return [200, { posts: [...posts] }];
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [500, { message: 'Internal server error' }];
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user