Init project

This commit is contained in:
alirezakarari
2021-01-09 20:53:13 +03:30
commit 8d06c89a89
1005 changed files with 105625 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
import axios from '@/axios'
const state = {
loading: false,
access_id:undefined
};
const actions = {
async save({commit}, payload) {
try {
commit('LOADING', true);
await axios.post('admin/permission',{data: payload});
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async getOneId({commit}, payload) {
try {
commit('LOADING', true);
const {data} = await axios.get(`admin/permission/${payload}`)
commit('ACCESS_ID', data);
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
}
}
const mutations = {
LOADING(state, payload) {
state.loading = payload;
},
ACCESS_ID(state, payload) {
state.access_id = payload;
}
};
export default {
namespaced: true,
state,
mutations,
actions
}
+91
View File
@@ -0,0 +1,91 @@
import axios from '@/axios'
import { notification } from 'ant-design-vue';
const actions = {
// /////////////////////////////////////////////
// COMPONENTS
// /////////////////////////////////////////////
// async SubmitUser({commit}, payload) {
//
// try {
//
// commit('LOADING', true);
//
// await axios({
// method: 'post',
// url: 'admin/user',
// data: {data:payload}
// })
//
// commit('INIT', payload);
//
// setTimeout(()=>{
// notification.success({
// message:"پیغام موفقیت آمیز",
// description:"دسته شما با موفقیت ثبت شد."
// })
// },500)
//
// } catch (e) {
// console.log('error has')
// commit('ERROR', e);
// } finally {
// commit('LOADING', false);
// }
//
// },
// Vertical NavMenu
updateVerticalNavMenuWidth ({ commit }, width) {
commit('UPDATE_VERTICAL_NAV_MENU_WIDTH', width)
},
// VxAutoSuggest
updateStarredPage ({ commit }, payload) {
commit('UPDATE_STARRED_PAGE', payload)
},
// The Navbar
arrangeStarredPagesLimited ({ commit }, list) {
commit('ARRANGE_STARRED_PAGES_LIMITED', list)
},
arrangeStarredPagesMore ({ commit }, list) {
commit('ARRANGE_STARRED_PAGES_MORE', list)
},
// /////////////////////////////////////////////
// UI
// /////////////////////////////////////////////
toggleContentOverlay ({ commit }) {
commit('TOGGLE_CONTENT_OVERLAY')
},
updateTheme ({ commit }, val) {
commit('UPDATE_THEME', val)
},
// /////////////////////////////////////////////
// User/Account
// /////////////////////////////////////////////
updateUserInfo ({ commit }, payload) {
commit('UPDATE_USER_INFO', payload)
},
updateUserRole ({ dispatch }, payload) {
// Change client side
payload.aclChangeRole(payload.userRole)
// Make API call to server for changing role
// Change userInfo in localStorage and store
dispatch('updateUserInfo', {userRole: payload.userRole})
}
}
export default actions
+72
View File
@@ -0,0 +1,72 @@
import axios from '@/axios'
const state = {
loading: false,
AdOneId:undefined,
edit:[]
};
const actions = {
async save({commit}, payload) {
try {
commit('LOADING', true);
await axios.post('admin/ipc',{data: payload});
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async get({commit},id) {
try {
commit('LOADING', true);
let res = await axios.get('admin/ipc/'+id);
commit('AdPACKAGE_ID', res.data);
} catch (e) {
commit('ERROR', e);
throw e;
} finally {
commit('LOADING', false);
}
},
async put({commit}, payload) {
try{
commit('LOADING', true);
await axios.put('admin/ipc/'+payload.id, {id:payload.id,data:payload.data})
commit('UPDATE_ADPACKAGE', payload);
}catch (e) {
commit('ERROR', e);
} finally {
commit('LOADING', false);
}
}
}
const mutations = {
LOADING(state, payload) {
state.loading = payload;
},
AdPACKAGE_ID(state,payload){
state.AdOneId = payload
},
UPDATE_ADPACKAGE(state, payload) {
state.edit = state.edit.map(item => {
if (item.id === payload.id) {
return Object.assign({},item, payload.data)
}
return item
})
}
};
export default {
namespaced: true,
state,
mutations,
actions
}
+63
View File
@@ -0,0 +1,63 @@
import axios from '@/axios'
const state = {
collectionSingle: undefined,
error: undefined,
loading: false,
users: []
};
const actions = {
async save({commit}, payload) {
try {
commit('LOADING', true);
await axios.put(`admin/adv/${payload.id}`,{data:payload.data,op:'update'})
commit('INIT', payload);
this.$ntSet();
} catch (e) {
console.log('error has')
commit('ERROR', e);
} finally {
commit('LOADING', false);
}
},
async advId({commit}, id) {
try {
commit('LOADING', true);
let res = await axios.get('admin/adv/' + id);
console.log(res.data, 'res-attr')
commit('ADV_ID', res.data);
} catch (e) {
commit('ERROR', e);
throw e;
} finally {
commit('LOADING', false);
}
},
};
const mutations = {
UPDATE_ADV(state, payload) {
state.advEdit = state.advEdit.map(adv => {
if (adv.id === payload.id) {
return Object.assign({}, adv, payload.data)
}
return adv
})
console.log(state.adv, 'users data kole')
},
LOADING(state, payload) {
state.loading = payload;
},
ADV_ID(state, payload) {
state.collectionSingle = payload;
},
};
export default {
namespaced: true,
state,
mutations,
actions
}
+122
View File
@@ -0,0 +1,122 @@
import axios from '@/axios'
const state = {
loadingSpecifiedDate: false,
loadingCompareAdv: false,
loadingUseAdvPackage: false,
loadingOwnerMarketer: false,
loadingGrowthAdv: false,
loadingLastDaysAdv: false,
loadingAdvOwnerMarketer: false,
};
const actions = {
async save({commit}, payload) {
try {
commit('LOADING_SPECIFIED_DATE', true);
const {data} = await axios.post('admin/adv/query/create',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_SPECIFIED_DATE', false);
}
},
async line({commit}, payload) {
try {
commit('LOADING_COMPARE_DATE', true);
const {data} = await axios.post('admin/adv/query/compare',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_COMPARE_DATE', false);
}
},
async donut({commit}, payload) {
try {
commit('LOADING_USE_ADV_PACKAGE', true);
const {data} = await axios.post('admin/adv/chart/ipc',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_USE_ADV_PACKAGE', false);
}
},
async countAdv({commit}, payload) {
try {
commit('LOADING_MARKETER_OWNER', true);
const {data} = await axios.post('admin/adv/query/city',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_MARKETER_OWNER', false);
}
},
async growthAdv({commit}, payload) {
try {
commit('LOADING_GROWTH_ADV', true);
const {data} = await axios.post('admin/adv/chart/growth',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_GROWTH_ADV', false);
}
},
async lastDaysAdv({commit}, payload) {
try {
commit('LOADING_LAST_DAY_ADV', true);
const {data} = await axios.post('admin/adv/chart/count',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_LAST_DAY_ADV', false);
}
},
async countOwnerMarketer({commit}, payload) {
try {
commit('LOADING_OWNER_MARKETER', true);
const {data} = await axios.post('admin/adv/query/creator',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_OWNER_MARKETER', false);
}
},
}
const mutations = {
LOADING_SPECIFIED_DATE(state, payload) {
state.loadingSpecifiedDate = payload;
},
LOADING_COMPARE_DATE(state, payload) {
state.loadingCompareAdv = payload;
},
LOADING_USE_ADV_PACKAGE(state, payload) {
state.loadingUseAdvPackage = payload;
},
LOADING_MARKETER_OWNER(state, payload) {
state.loadingOwnerMarketer = payload;
},
LOADING_GROWTH_ADV(state, payload) {
state.loadingGrowthAdv = payload;
},
LOADING_LAST_DAY_ADV(state, payload) {
state.loadingLastDaysAdv = payload;
},
LOADING_OWNER_MARKETER(state, payload) {
state.loadingAdvOwnerMarketer = payload;
},
}
export default {
namespaced: true,
state,
mutations,
actions
}
+22
View File
@@ -0,0 +1,22 @@
/*=========================================================================================
File Name: moduleAuth.js
Description: Auth Module
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import state from './moduleAuthState.js'
import mutations from './moduleAuthMutations.js'
import actions from './moduleAuthActions.js'
import getters from './moduleAuthGetters.js'
export default {
namespaced: true,
state: state,
mutations: mutations,
actions: actions,
getters: getters
}
+448
View File
@@ -0,0 +1,448 @@
/*=========================================================================================
File Name: moduleAuthActions.js
Description: Auth Module Actions
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import jwt from "../../http/requests/auth/jwt/index.js"
import firebase from 'firebase/app'
import 'firebase/auth'
import router from '@/router'
import axios from "../../http/axios";
import {ax} from "@/axios";
export default {
getUserInfo({commit}) {
/* ax().get('customer/user/get')
.then((res)=>{
console.log("in get user info ",res.data);
commit("SET_USER_INFO",res.data);
}).catch((error)=>{
console.log(error);
});*/
},
loginAttempt({dispatch}, payload) {
// New payload for login action
const newPayload = {
userDetails: payload.userDetails,
notify: payload.notify,
closeAnimation: payload.closeAnimation
}
// If remember_me is enabled change firebase Persistence
if (!payload.checkbox_remember_me) {
// Change firebase Persistence
firebase.auth().setPersistence(firebase.auth.Auth.Persistence.SESSION)
// If success try to login
.then(function () {
dispatch('login', newPayload)
})
// If error notify
.catch(function (err) {
// Close animation if passed as payload
if (payload.closeAnimation) payload.closeAnimation()
payload.notify({
time: 2500,
title: 'Error',
text: err.message,
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'danger'
})
})
} else {
// Try to login
dispatch('login', newPayload)
}
},
async register({commit, state, dispatch}, payload) {
await axios.post('/customer/auth/register', payload).then(response => {
if (response.data) {
state.registerStepTwo=true;
// Navigate User to homepage
//localStorage.setItem("accessToken", response.data.api_token)
// Set accessToken
// Update user details
// commit('UPDATE_USER_INFO', response.data, {root: true})
// Set bearer token in axios
//commit("SET_BEARER", response.data.api_token)
//router.push(router.currentRoute.query.to || '/')
}
})
.catch(error => {
throw error
})
},
async registerValidate({commit}, payload) {
/* try {*/
await axios.post('/customer/auth/registerValidate', payload)
.then(response => {
if (response.data) {
// Navigate User to homepage
localStorage.setItem("accessToken", response.data.api_token)
// Set accessToken
// Update user details
commit('UPDATE_USER_INFO', response.data, {root: true})
commit("SET_USER_INFO",response.data);
// Set bearer token in axios
commit("SET_BEARER", response.data.api_token)
router.push(router.currentRoute.query.to || '/')
}
}).catch(error=>{
payload.notify({
title: 'خطا در بررسی اطلاعات',
text: 'لطفا کد صحیح را وارد کنید.',
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'danger'
});
/*console.log("sdfsdfsdfsdff");
this.$vs.notify({
title: 'خطا در بررسی اطلاعات',
text: 'لطفا کد صحیح را وارد کنید.',
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'danger'
})*/
});
//localStorage.setItem("accessToken", response.data.api_token)
//commit('SET_REGISTER_STEP')
/*} catch (e) {
}*/
},
login({commit, state, dispatch}, payload) {
// If user is already logged in notify and exit
if (state.isUserLoggedIn()) {
// Close animation if passed as payload
if (payload.closeAnimation) payload.closeAnimation()
payload.notify({
title: 'Login Attempt',
text: 'You are already logged in!',
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'warning'
})
return false
}
// Try to sigin
firebase.auth().signInWithEmailAndPassword(payload.userDetails.email, payload.userDetails.password)
.then((result) => {
// Set FLAG username update required for updating username
let isUsernameUpdateRequired = false
// if username is provided and updateUsername FLAG is true
// set local username update FLAG to true
// try to update username
if (payload.updateUsername && payload.userDetails.username) {
isUsernameUpdateRequired = true
dispatch('updateUsername', {
user: result.user,
username: payload.userDetails.username,
notify: payload.notify,
isReloadRequired: true
})
}
// Close animation if passed as payload
if (payload.closeAnimation) payload.closeAnimation()
// if username update is not required
// just reload the page to get fresh data
// set new user data in localstorage
if (!isUsernameUpdateRequired) {
router.push(router.currentRoute.query.to || '/')
commit('UPDATE_USER_INFO', result.user.providerData[0], {root: true})
}
}, (err) => {
// Close animation if passed as payload
if (payload.closeAnimation) payload.closeAnimation()
payload.notify({
time: 2500,
title: 'Error',
text: err.message,
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'danger'
})
})
},
// Google Login
loginWithGoogle({commit, state}, payload) {
if (state.isUserLoggedIn()) {
payload.notify({
title: 'Login Attempt',
text: 'You are already logged in!',
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'warning'
})
return false
}
const provider = new firebase.auth.GoogleAuthProvider()
firebase.auth().signInWithPopup(provider)
.then((result) => {
router.push(router.currentRoute.query.to || '/')
commit('UPDATE_USER_INFO', result.user.providerData[0], {root: true})
}).catch((err) => {
payload.notify({
time: 2500,
title: 'Error',
text: err.message,
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'danger'
})
})
},
// Facebook Login
loginWithFacebook({commit, state}, payload) {
if (state.isUserLoggedIn()) {
payload.notify({
title: 'Login Attempt',
text: 'You are already logged in!',
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'warning'
})
return false
}
const provider = new firebase.auth.FacebookAuthProvider()
firebase.auth().signInWithPopup(provider)
.then((result) => {
router.push(router.currentRoute.query.to || '/')
commit('UPDATE_USER_INFO', result.user.providerData[0], {root: true})
}).catch((err) => {
payload.notify({
time: 2500,
title: 'Error',
text: err.message,
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'danger'
})
})
},
// Twitter Login
loginWithTwitter({commit, state}, payload) {
if (state.isUserLoggedIn()) {
payload.notify({
title: 'Login Attempt',
text: 'You are already logged in!',
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'warning'
})
return false
}
const provider = new firebase.auth.TwitterAuthProvider()
firebase.auth().signInWithPopup(provider)
.then((result) => {
router.push(router.currentRoute.query.to || '/')
commit('UPDATE_USER_INFO', result.user.providerData[0], {root: true})
}).catch((err) => {
payload.notify({
time: 2500,
title: 'Error',
text: err.message,
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'danger'
})
})
},
// Github Login
loginWithGithub({commit, state}, payload) {
if (state.isUserLoggedIn()) {
payload.notify({
title: 'Login Attempt',
text: 'You are already logged in!',
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'warning'
})
return false
}
const provider = new firebase.auth.GithubAuthProvider()
firebase.auth().signInWithPopup(provider)
.then((result) => {
router.push(router.currentRoute.query.to || '/')
commit('UPDATE_USER_INFO', result.user.providerData[0], {root: true})
}).catch((err) => {
payload.notify({
time: 2500,
title: 'Error',
text: err.message,
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'danger'
})
})
},
registerUser({dispatch}, payload) {
// create user using firebase
firebase.auth().createUserWithEmailAndPassword(payload.userDetails.email, payload.userDetails.password)
.then(() => {
payload.notify({
title: 'Account Created',
text: 'You are successfully registered!',
iconPack: 'feather',
icon: 'icon-check',
color: 'success'
})
const newPayload = {
userDetails: payload.userDetails,
notify: payload.notify,
updateUsername: true
}
dispatch('login', newPayload)
}, (error) => {
payload.notify({
title: 'Error',
text: error.message,
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'danger'
})
})
},
updateUsername({commit}, payload) {
payload.user.updateProfile({
displayName: payload.username
}).then(() => {
// If username update is success
// update in localstorage
let newUserData = Object.assign({}, payload.user.providerData[0])
newUserData.displayName = payload.username
commit('UPDATE_USER_INFO', newUserData, {root: true})
// If reload is required to get fresh data after update
// Reload current page
if (payload.isReloadRequired) {
router.push(router.currentRoute.query.to || '/')
}
}).catch((err) => {
payload.notify({
time: 8800,
title: 'Error',
text: err.message,
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'danger'
})
})
},
// JWT
loginJWT({commit}, payload) {
return new Promise((resolve, reject) => {
// login(email, pwd) {
// return axios.post("/api/auth/login", {email: email, password: pwd})
// },
// registerUser(name, email, pwd) {
// return axios.post("/api/auth/register", {displayName: name, email: email, password: pwd})
// },
// refreshToken() {
// return axios.post("/api/auth/refresh-token", {accessToken: localStorage.getItem("accessToKen")})
// }
axios.post('auth/login', {
username: payload.userDetails.email,
password: payload.userDetails.password
})
.then(response => {
if (response.data) {
// Navigate User to homepage
localStorage.setItem("accessToken", response.data.api_token)
// Set accessToken
// Update user details
commit('SET_USER_INFO',response.data)
commit('UPDATE_USER_INFO', response.data, {root: true})
//
// Set bearer token in axios
commit("SET_BEARER", response.data.api_token)
router.push(router.currentRoute.query.to || '/')
//store.dispatch("user/getUserInfo");
resolve(response)
} else {
reject({message: "Wrong Email or Password"})
}
})
.catch(error => {
reject(error)
})
})
},
registerUserJWT({commit}, payload) {
const {displayName, email, password, confirmPassword} = payload.userDetails
return new Promise((resolve, reject) => {
// Check confirm password
if (password !== confirmPassword) {
reject({message: "Password doesn't match. Please try again."})
}
jwt.registerUser(displayName, email, password)
.then(response => {
// Redirect User
router.push(router.currentRoute.query.to || '/')
// Update data in localStorage
localStorage.setItem("accessToken", response.data.accessToken)
commit('UPDATE_USER_INFO', response.data.userData, {root: true})
resolve(response)
})
.catch(error => {
reject(error)
})
})
},
fetchAccessToken() {
return new Promise((resolve) => {
jwt.refreshToken().then(response => {
resolve(response)
})
})
}
}
+11
View File
@@ -0,0 +1,11 @@
/*=========================================================================================
File Name: moduleAuthGetters.js
Description: Auth Module Getters
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {}
+20
View File
@@ -0,0 +1,20 @@
/*=========================================================================================
File Name: moduleAuthMutations.js
Description: Auth Module Mutations
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import axios from "../../http/axios/index.js"
export default {
SET_BEARER(state, accessToken) {
axios.defaults.headers.common['Authorization'] = 'Bearer ' + accessToken
},
SET_USER_INFO(state, payload) {
state.userInfo=payload;
console.log( state.userInfo);
}
}
+26
View File
@@ -0,0 +1,26 @@
/*=========================================================================================
File Name: moduleAuthState.js
Description: Auth Module State
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import auth from "@/auth/authService";
import firebase from 'firebase/app'
import 'firebase/auth'
export default {
userInfo: {},
isUserLoggedIn: () => {
let isAuthenticated = false
// get firebase current user
const firebaseCurrentUser = firebase.auth().currentUser
if (auth.isAuthenticated() || firebaseCurrentUser) isAuthenticated = true
else isAuthenticated = false
return (localStorage.getItem('userInfo') && isAuthenticated)
},
registerStepTwo: false
}
+32
View File
@@ -0,0 +1,32 @@
import axios from '@/axios'
const state = {
loading: false
};
const actions = {
async line({commit}, payload) {
try {
commit('LOADING', true);
const {data} = await axios.post('admin/badadv/chart/date',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
}
}
const mutations = {
LOADING(state, payload) {
state.loading = payload;
}
}
export default {
namespaced: true,
state,
mutations,
actions
}
+89
View File
@@ -0,0 +1,89 @@
import axios from '@/axios'
const state = {
error: undefined,
loading: false,
blogOneId:undefined,
edit:[]
};
const actions = {
async save({commit}, payload) {
try {
commit('LOADING', true);
await axios.post('admin/post',payload);
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async get({commit},id) {
try {
commit('LOADING', true);
let res = await axios.get('admin/post/'+id);
console.log(res.data,'res data')
commit('BLOG_ID', res.data);
} catch (e) {
commit('ERROR', e);
throw e;
} finally {
commit('LOADING', false);
}
},
async put({commit}, payload) {
try{
commit('LOADING', true);
await axios.put('admin/post/'+payload.id, {id:payload.id,data:payload.data,op:'update'})
commit('UPDATE_BLOG', payload);
}catch (e) {
commit('ERROR', e);
} finally {
commit('LOADING', false);
}
},
async submitCountWriting({commit}, payload) {
try{
commit('LOADING', true);
const writing = await axios.post('admin/post/chart/date',payload)
return writing
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING', false);
}
}
}
const mutations = {
LOADING(state, payload) {
state.loading = payload;
},
BLOG_ID(state,payload){
state.blogOneId = payload
},
UPDATE_BLOG(state, payload) {
state.edit = state.edit.map(blog => {
if (blog.id === payload.id) {
return Object.assign({},blog, payload.data)
}
return blog
})
}
};
export default {
namespaced: true,
state,
mutations,
actions
}
+22
View File
@@ -0,0 +1,22 @@
/*=========================================================================================
File Name: moduleCalendar.js
Description: Calendar Module
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import state from './moduleCalendarState.js'
import mutations from './moduleCalendarMutations.js'
import actions from './moduleCalendarActions.js'
import getters from './moduleCalendarGetters.js'
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
@@ -0,0 +1,85 @@
/*=========================================================================================
File Name: moduleCalendarActions.js
Description: Calendar Module Actions
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import axios from '@/axios.js'
export default {
addEvent ({ commit }, event) {
return new Promise((resolve, reject) => {
axios.post('/api/apps/calendar/events/', {event})
.then((response) => {
commit('ADD_EVENT', Object.assign(event, {id: response.data.id}))
resolve(response)
})
.catch((error) => { reject(error) })
})
},
fetchEvents ({ commit }) {
return new Promise((resolve, reject) => {
axios.get('/api/apps/calendar/events')
.then((response) => {
commit('SET_EVENTS', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
fetchEventLabels ({ commit }) {
return new Promise((resolve, reject) => {
axios.get('/api/apps/calendar/labels')
.then((response) => {
commit('SET_LABELS', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
editEvent ({ commit }, event) {
return new Promise((resolve, reject) => {
axios.post(`/api/apps/calendar/event/${event.id}`, {event})
.then((response) => {
// Convert Date String to Date Object
const event = response.data
event.startDate = new Date(event.startDate)
event.endDate = new Date(event.endDate)
commit('UPDATE_EVENT', event)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
removeEvent ({ commit }, eventId) {
return new Promise((resolve, reject) => {
axios.delete(`/api/apps/calendar/event/${eventId}`)
.then((response) => {
commit('REMOVE_EVENT', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
eventDragged ({ commit }, payload) {
return new Promise((resolve, reject) => {
axios.post(`/api/apps/calendar/event/dragged/${payload.event.id}`, {payload})
.then((response) => {
// Convert Date String to Date Object
const event = response.data
event.startDate = new Date(event.startDate)
event.endDate = new Date(event.endDate)
commit('UPDATE_EVENT', event)
resolve(response)
})
.catch((error) => { reject(error) })
})
}
}
@@ -0,0 +1,13 @@
/*=========================================================================================
File Name: moduleCalendarGetters.js
Description: Calendar Module Getters
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
getEvent: state => (eventId) => state.events.find((event) => event.id === eventId)
}
@@ -0,0 +1,29 @@
/*=========================================================================================
File Name: moduleCalendarMutations.js
Description: Calendar Module Mutations
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
ADD_EVENT (state, event) {
state.events.push(event)
},
SET_EVENTS (state, events) {
state.events = events
},
SET_LABELS (state, labels) {
state.eventLabels = labels
},
UPDATE_EVENT (state, event) {
const eventIndex = state.events.findIndex((e) => e.id === event.id)
Object.assign(state.events[eventIndex], event)
},
REMOVE_EVENT (state, eventId) {
const eventIndex = state.events.findIndex((e) => e.id === eventId)
state.events.splice(eventIndex, 1)
}
}
+17
View File
@@ -0,0 +1,17 @@
/*=========================================================================================
File Name: moduleCalendarState.js
Description: Calendar Module State
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
// Calendar Labels
eventLabels: [],
// Simple Calendar State
events: []
}
+86
View File
@@ -0,0 +1,86 @@
import _ from 'lodash';
import axios from "@/axios";
const state = {
model: {},
rows: [],
count: 0,
page: 1,
loading: false,
searchQuery: undefined,
};
const mutations = {
ADD_ITEM(state, data) {
state.rows.push(data);
},
LOADING(state, data) {
state.loading = data;
},
SEARCH_QUERY_SET(state, data) {
state.searchQuery = data;
},
FETCH(state, {rows , count, page}){
state.rows = rows;
state.count = count || 0;
state.page = page || 1;
},
INJECT_LIST(state, {count, rows, page}) {
state.count = count;
state.page = page;
state.rows = rows;
}
};
const actions = {
async remove({commit, dispatch}, {id}) {
commit('LOADING', true);
try {
const {data} = await axios.delete('category/' + id);
dispatch('category/fetch');
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async save({commit, state}, payload) {
commit('LOADING', true);
try {
if (payload.id) {
const {data} = await axios.put(`category/${payload.id}`, payload);
return data;
} else {
const {data} = await axios.post(`category/`, payload);
return data;
}
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async fetch({commit, state}, data) {
commit('LOADING', true);
try {
const {data} = await axios.get('category/', {params:{page:state.page, text_search:state.searchQuery}});
commit('FETCH' , data);
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
}
};
const getters = {};
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
+22
View File
@@ -0,0 +1,22 @@
/*=========================================================================================
File Name: moduleChat.js
Description: Chat Module
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import state from './moduleChatState.js'
import mutations from './moduleChatMutations.js'
import actions from './moduleChatActions.js'
import getters from './moduleChatGetters.js'
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
+105
View File
@@ -0,0 +1,105 @@
/*=========================================================================================
File Name: moduleChatActions.js
Description: Chat Module Actions
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import axios from '@/axios.js'
export default {
setChatSearchQuery ({ commit }, query) {
commit('SET_CHAT_SEARCH_QUERY', query)
},
updateAboutChat ({ commit, rootState }, value) {
commit('UPDATE_ABOUT_CHAT', {
rootState,
value
})
},
updateStatusChat ({ commit, rootState }, value) {
commit('UPDATE_STATUS_CHAT', {
rootState,
value
})
},
// API CALLS
sendChatMessage ({ getters, commit, dispatch }, payload) {
return new Promise((resolve, reject) => {
axios.post('/api/apps/chat/msg', {payload})
.then((response) => {
payload.chatData = getters.chatDataOfUser(payload.id)
if (!payload.chatData) { dispatch('fetchChatContacts') }
commit('SEND_CHAT_MESSAGE', payload)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
// Get contacts from server. Also change in store
fetchContacts ({ commit }) {
return new Promise((resolve, reject) => {
axios.get('/api/apps/chat/contacts', {params: {q: ''}})
.then((response) => {
commit('UPDATE_CONTACTS', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
// Get chat-contacts from server. Also change in store
fetchChatContacts ({ commit }) {
return new Promise((resolve, reject) => {
axios.get('/api/apps/chat/chat-contacts', {params: {q: ''}})
.then((response) => {
commit('UPDATE_CHAT_CONTACTS', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
// Get chats from server. Also change in store
fetchChats ({ commit }) {
return new Promise((resolve, reject) => {
axios.get('/api/apps/chat/chats')
.then((response) => {
commit('UPDATE_CHATS', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
markSeenAllMessages ({ getters, commit }, id) {
return new Promise((resolve, reject) => {
axios.post('/api/apps/chat/mark-all-seen', {id})
.then((response) => {
commit('MARK_SEEN_ALL_MESSAGES', {
id,
chatData: getters.chatDataOfUser(id)
})
resolve(response)
})
.catch((error) => { reject(error) })
})
},
toggleIsPinned ({ commit }, payload) {
return new Promise((resolve, reject) => {
axios.post('/api/apps/chat/set-pinned/', {contactId: payload.id,
value: payload.value})
.then((response) => {
commit('TOGGLE_IS_PINNED', payload)
resolve(response)
})
.catch((error) => { reject(error) })
})
}
}
+52
View File
@@ -0,0 +1,52 @@
/*=========================================================================================
File Name: moduleChatGetters.js
Description: Chat Module Getters
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
// import contacts from '@/views/apps/chat/contacts'
export default {
chatDataOfUser: state => id => {
return state.chats[Object.keys(state.chats).find(key => Number(key) === id)]
},
chatContacts: (state, getters) => {
const chatContacts = state.chatContacts.filter((contact) => contact.displayName.toLowerCase().includes(state.chatSearchQuery.toLowerCase()))
chatContacts.sort((x, y) => {
const timeX = getters.chatLastMessaged(x.uid).time
const timeY = getters.chatLastMessaged(y.uid).time
return new Date(timeY) - new Date(timeX)
})
return chatContacts.sort((x, y) => {
const chatDataX = getters.chatDataOfUser(x.uid)
const chatDataY = getters.chatDataOfUser(y.uid)
if (chatDataX && chatDataY) return chatDataY.isPinned - chatDataX.isPinned
else return 0
})
},
contacts: (state) => state.contacts.filter((contact) => contact.displayName.toLowerCase().includes(state.chatSearchQuery.toLowerCase())),
contact: (state) => contactId => state.contacts.find((contact) => contact.uid === contactId),
chats: (state) => state.chats,
chatUser: (state, getters, rootState) => id => state.contacts.find((contact) => contact.uid === id) || rootState.AppActiveUser,
chatLastMessaged: (state, getters) => id => {
if (getters.chatDataOfUser(id)) return getters.chatDataOfUser(id).msg.slice(-1)[0]
else return false
},
chatUnseenMessages: (state, getters) => id => {
let unseenMsg = 0
const chatData = getters.chatDataOfUser(id)
if (chatData) {
chatData.msg.map((msg) => {
if (!msg.isSeen && !msg.isSent) unseenMsg++
})
}
return unseenMsg
}
}
+54
View File
@@ -0,0 +1,54 @@
/*=========================================================================================
File Name: moduleChatMutations.js
Description: Chat Module Mutations
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import Vue from 'vue'
export default {
UPDATE_ABOUT_CHAT (state, obj) {
obj.rootState.AppActiveUser.about = obj.value
},
UPDATE_STATUS_CHAT (state, obj) {
obj.rootState.AppActiveUser.status = obj.value
},
// API AFTER
SEND_CHAT_MESSAGE (state, payload) {
if (payload.chatData) {
// If there's already chat. Push msg to existing chat
state.chats[Object.keys(state.chats).find(key => Number(key) === payload.id)].msg.push(payload.msg)
} else {
// Create New chat and add msg
const chatId = payload.id
Vue.set(state.chats, [chatId], { isPinned: payload.isPinned,
msg: [payload.msg] })
}
},
UPDATE_CONTACTS (state, contacts) {
state.contacts = contacts
},
UPDATE_CHAT_CONTACTS (state, chatContacts) {
state.chatContacts = chatContacts
},
UPDATE_CHATS (state, chats) {
state.chats = chats
},
SET_CHAT_SEARCH_QUERY (state, query) {
state.chatSearchQuery = query
},
MARK_SEEN_ALL_MESSAGES (state, payload) {
payload.chatData.msg.forEach((msg) => {
msg.isSeen = true
})
},
TOGGLE_IS_PINNED (state, payload) {
state.chats[Object.keys(state.chats).find(key => Number(key) === payload.id)].isPinned = payload.value
}
}
+24
View File
@@ -0,0 +1,24 @@
/*=========================================================================================
File Name: moduleChatState.js
Description: Chat Module State
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
// Chat Search Query
chatSearchQuery: '',
// Stores All Contacts
contacts: [],
// Stores Chat Contacts
chatContacts: [],
// Stores Chat data(log)
chats: {}
}
+92
View File
@@ -0,0 +1,92 @@
import axios from '@/axios';
import {notification} from "ant-design-vue";
const state = {
collectionSingle: undefined,
error: undefined,
loading: false,
users: [],
successData: undefined,
collection: [],
groups: []
};
const actions = {
async submitCollection({commit}, payload) {
try {
commit('LOADING', true);
if (payload.id) {
await axios({
method: 'put',
url: 'admin/collection/' + payload.id,
data: {id: payload.id, data: payload.data}
});
} else {
await axios({
method: 'post',
url: 'admin/collection',
data: {data: payload}
});
}
} catch (e) {
console.log(e);
throw e;
} finally {
commit('LOADING', false);
}
},
async collectionId({commit}, id) {
try {
commit('LOADING', true);
let res = await axios.get('admin/collection/' + id);
commit('COLLECTION_ID', res.data);
} catch (e) {
commit('ERROR', e);
throw e;
} finally {
commit('LOADING', false);
}
},
};
const mutations = {
LOADING(state, payload) {
state.loading = payload;
},
SET_ROW_ATTR(state, payload) {
if (!payload.id) {
state.collectionSingle.groups.push(payload);
} else {
const ind = state.collectionSingle.groups.indexOf(state.collectionSingle.groups.find((item) => item.id == payload.id));
if (ind > -1) {
state.collectionSingle.groups[ind] = Object.assign({}, payload)
}
}
},
DELETE_ROW(state, payload) {
state.collectionSingle.groups.splice(payload,1)
},
COLLECTION_ID(state, payload) {
state.collectionSingle = payload;
},
SUCCESS_DATA(state, payload) {
state.successData = payload;
},
UPDATE_COLLECTION(state, payload) {
state.collection = state.collection.map(collection => {
if (collection.id === payload.id) {
return Object.assign({}, collection, payload.data);
}
return collection;
});
}
};
export default {
namespaced: true,
state,
mutations,
actions
};
+188
View File
@@ -0,0 +1,188 @@
import axios from "@/axios";
import {notification} from "ant-design-vue";
const state = {
getDataCustomer: [],
loading: false,
customerById:[],
successData:undefined,
loadingUnActiveAccount:false
};
const actions = {
async CustomerId({commit},id) {
try {
commit('LOADING', true);
let res = await axios.get('admin/customer/'+id);
console.log(res.data,'res-collection')
commit('CUSTOMER_ID', res.data);
} catch (e) {
commit('ERROR', e);
throw e;
} finally {
commit('LOADING', false);
}
},
async editCustomer({commit}, payload) {
try{
commit('LOADING', true);
await axios({
method: 'put',
url: 'admin/customer/'+payload.id,
data: {id:payload.id,data:payload.data,op:'update'}
}).then((res)=>{
console.log(res,res.data,'--->res data')
commit('SUCCESS_DATA',res.data)
commit('EDIT_CUSTOMER', payload);
notification.success({
message: "پیغام موفقیت آمیز",
description: "اطلاعات شما با موفقیت ویرایش شد.",
duration: 1,
})
})
}
catch (e) {
commit('ERROR', e);
}
finally {
commit('LOADING', false);
}
},
async Authentication({commit}, payload) {
try{
commit('LOADING', true);
await axios.put('admin/customer/'+payload.id,{data:payload,op:'sts'})
}
catch (e) {
commit('ERROR', e);
}
finally {
commit('LOADING', false);
}
},
async reject({commit}, payload) {
try{
await axios.put('admin/customer/'+payload.id,{data:payload,op:'sts'})
}
catch (e) {
commit('ERROR', e);
}
finally {
}
},
async saveActiveAccount({commit}, payload) {
try{
commit('LOADING', true);
await axios.put('admin/customer/'+payload.id,{data:payload,op:'active'})
}
catch (e) {
commit('ERROR', e);
}
finally {
commit('LOADING', false);
}
},
async SendCity({commit}, payload) {
try{
commit('LOADING', true);
const city = await axios.post('admin/customer/query/city',payload)
return city
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING', false);
}
},
async SendCustomerSingUp({commit}, payload) {
try{
commit('LOADING', true);
const signUp = await axios.post('admin/customer/query/date',payload)
return signUp
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING', false);
}
},
async SendCustomerGrowth({commit}, payload) {
try{
commit('LOADING', true);
const growth = await axios.post('admin/customer/chart/growth',payload)
return growth
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING', false);
}
},
async deleteCustomer({commit},id) {
try {
commit('LOADING_DELETE', true);
const {data} = await axios.delete('admin/customer/'+id );
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_DELETE', false);
}
},
async unActiveAccountCustomer({commit},payload) {
try {
commit('LOADING_UN_ACTIVE_ACCOUNT_CUSTOMER', true);
await axios.put('admin/customer/'+payload.id , {data:payload,op:"active"});
} catch (e) {
throw e;
} finally {
commit('LOADING_UN_ACTIVE_ACCOUNT_CUSTOMER', false);
}
},
async sendMessage({commit},payload) {
try {
await axios.post('admin/customer/message',payload);
} catch (e) {
throw e;
} finally {
}
},
};
const mutations = {
CUSTOMER_ID(state, payload) {
state.getDataCustomer = payload;
},
SUCCESS_DATA(state, payload) {
state.successData = payload;
},
LOADING(state, payload) {
state.loading = payload;
},
LOADING_UN_ACTIVE_ACCOUNT_CUSTOMER(state, payload) {
state.loadingUnActiveAccount = payload;
},
EDIT_CUSTOMER(state, payload) {
state.customerById = state.customerById.map(customer => {
if (customer.id === payload.id) {
return Object.assign({},customer, payload.data)
}
return customer
})
},
};
export default {
namespaced: true,
state,
mutations,
actions,
}
+101
View File
@@ -0,0 +1,101 @@
import axios from "@/axios";
const state = {
model: {},
rows: [],
count: 0,
page: 1,
loading: false,
searchQuery: undefined,
};
const mutations = {
ADD_ITEM(state, data) {
state.rows.push(data);
},
LOADING(state, data) {
state.loading = data;
},
SET_PAGE(state, data) {
state.page = data;
},
FETCH_EDIT(state, data) {
state.model = data;
},
SEARCH_QUERY_SET(state, data) {
state.searchQuery = data;
},
FETCH(state, {rows, count, page}) {
state.rows = rows;
state.count = count || 0;
state.page = (page || 0)+1;
},
INJECT_LIST(state, {count, rows, page}) {
state.count = count;
state.page = page;
state.rows = rows;
}
};
const actions = {
async remove({commit, dispatch}, {id}) {
commit('LOADING', true);
try {
const {data} = await axios.delete('user/profile/' + id);
dispatch('fetch');
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async save({commit, state}, payload) {
commit('LOADING', true);
try {
if (payload.id) {
const {data} = await axios.put(`user/profile/${payload.id}`, payload);
return data;
} else {
const {data} = await axios.post(`user/profile/`, payload);
return data;
}
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async fetch({commit, state}, data) {
commit('LOADING', true);
try {
const {data} = await axios.get('user/profile', {params: {page: state.page, text_search: state.searchQuery}});
commit('FETCH', data);
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async getEditData({commit, state}, {id}) {
commit('LOADING', true);
try {
const {data} = await axios.get(`user/profile/${id}`);
commit('FETCH_EDIT', data);
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
}
};
const getters = {};
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
+24
View File
@@ -0,0 +1,24 @@
/*=========================================================================================
File Name: moduleDataList.js
Description: Calendar Module
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import state from './moduleDataListState.js'
import mutations from './moduleDataListMutations.js'
import actions from './moduleDataListActions.js'
import getters from './moduleDataListGetters.js'
export default {
isRegistered: false,
namespaced: true,
state,
mutations,
actions,
getters
}
@@ -0,0 +1,79 @@
/*=========================================================================================
File Name: moduleCalendarActions.js
Description: Calendar Module Actions
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import axios from '@/axios.js'
export default {
addItem ({ commit }, item) {
return new Promise((resolve, reject) => {
axios.post('/api/data-list/products/', {item})
.then((response) => {
commit('ADD_ITEM', Object.assign(item, {id: response.data.id}))
resolve(response)
})
.catch((error) => { reject(error) })
})
},
fetchDataListItems ({ commit }) {
return new Promise((resolve, reject) => {
axios.get('/api/data-list/products')
.then((response) => {
commit('SET_PRODUCTS', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
// fetchEventLabels({ commit }) {
// return new Promise((resolve, reject) => {
// axios.get("/api/apps/calendar/labels")
// .then((response) => {
// commit('SET_LABELS', response.data)
// resolve(response)
// })
// .catch((error) => { reject(error) })
// })
// },
updateItem ({ commit }, item) {
return new Promise((resolve, reject) => {
axios.post(`/api/data-list/products/${item.id}`, {item})
.then((response) => {
commit('UPDATE_PRODUCT', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
removeItem ({ commit }, itemId) {
return new Promise((resolve, reject) => {
axios.delete(`/api/data-list/products/${itemId}`)
.then((response) => {
commit('REMOVE_ITEM', itemId)
resolve(response)
})
.catch((error) => { reject(error) })
})
}
// eventDragged({ commit }, payload) {
// return new Promise((resolve, reject) => {
// axios.post(`/api/apps/calendar/event/dragged/${payload.event.id}`, {payload: payload})
// .then((response) => {
// // Convert Date String to Date Object
// let event = response.data
// event.startDate = new Date(event.startDate)
// event.endDate = new Date(event.endDate)
// commit('UPDATE_EVENT', event)
// resolve(response)
// })
// .catch((error) => { reject(error) })
// })
// },
}
@@ -0,0 +1,13 @@
/*=========================================================================================
File Name: moduleCalendarGetters.js
Description: Calendar Module Getters
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
// getItem: state => (productId) => state.products.find((product) => product.id == productId),
}
@@ -0,0 +1,29 @@
/*=========================================================================================
File Name: moduleCalendarMutations.js
Description: Calendar Module Mutations
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
ADD_ITEM (state, item) {
state.products.unshift(item)
},
SET_PRODUCTS (state, products) {
state.products = products
},
// SET_LABELS(state, labels) {
// state.eventLabels = labels
// },
UPDATE_PRODUCT (state, product) {
const productIndex = state.products.findIndex((p) => p.id === product.id)
Object.assign(state.products[productIndex], product)
},
REMOVE_ITEM (state, itemId) {
const ItemIndex = state.products.findIndex((p) => p.id === itemId)
state.products.splice(ItemIndex, 1)
}
}
@@ -0,0 +1,12 @@
/*=========================================================================================
File Name: moduleCalendarState.js
Description: Calendar Module State
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
products: []
}
+22
View File
@@ -0,0 +1,22 @@
/*=========================================================================================
File Name: moduleecommerce.js
Description: ecommerce Module
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import state from './moduleECommerceState.js'
import mutations from './moduleECommerceMutations.js'
import actions from './moduleECommerceActions.js'
import getters from './moduleECommerceGetters.js'
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
@@ -0,0 +1,31 @@
/*=========================================================================================
File Name: moduleEcommerceActions.js
Description: Ecommerce Module Actions
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
toggleItemInWishList ({ commit }, item) {
commit('TOGGLE_ITEM_IN_WISH_LIST', item)
},
toggleItemInCart ({ getters, commit, dispatch }, item) {
getters.isInCart(item.objectID) ? commit('REMOVE_ITEM_FROM_CART', item) : dispatch('additemInCart', item)
},
additemInCart ({ commit }, item) {
// Below properties should be added as per requirement from back-end
// This is added just for demo purpose
item['quantity'] = 1
item['discount_in_percentage'] = Math.floor(Math.random() * 20) + 4
item['offers_count'] = Math.floor(Math.random() * 4) + 1
item['delivery_date'] = new Date(new Date().getTime() + (Math.random() * 10 * 24 * 60 * 60 * 1000)).toDateString().slice(0, -4)
commit('ADD_ITEM_IN_CART', item)
},
updateItemQuantity ({ commit }, payload) {
commit('UPDATE_ITEM_QUANTITY', payload)
}
}
@@ -0,0 +1,22 @@
/*=========================================================================================
File Name: moduleEcommerceGetters.js
Description: Ecommerce Module Getters
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
isInCart: state => itemId => {
return state.cartItems.some((item) => item.objectID === itemId)
},
isInWishList: state => itemId => {
return state.wishList.some((item) => item.objectID === itemId)
},
getCartItem: state => itemId => {
const result = state.cartItems.filter((item) => item.objectID === itemId)
return result.length ? result.pop() : []
}
}
@@ -0,0 +1,30 @@
/*=========================================================================================
File Name: moduleEcommerceMutations.js
Description: Ecommerce Module Mutations
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
TOGGLE_ITEM_IN_WISH_LIST (state, item) {
const index = state.wishList.findIndex(i => i.objectID === item.objectID)
if (index < 0) {
state.wishList.push(item)
} else {
state.wishList.splice(index, 1)
}
},
REMOVE_ITEM_FROM_CART (state, item) {
const index = state.cartItems.findIndex(i => i.objectID === item.objectID)
if (index > -1) { state.cartItems.splice(index, 1) }
},
ADD_ITEM_IN_CART (state, item) {
state.cartItems.push(Object.assign({}, item))
},
UPDATE_ITEM_QUANTITY (state, payload) {
state.cartItems[payload.index].quantity = payload.quantity
}
}
@@ -0,0 +1,34 @@
/*=========================================================================================
File Name: moduleEcommerceState.js
Description: Ecommerce Module State
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
/* eslint-disable */
export default {
cartItems: [
{ "name": "Nikon - D810 DSLR Camera with AF-S NIKKOR 24-120mm f/4G ED VR Zoom Lens - Black", "description": "Shoot arresting photos and 1080p high-definition videos with this Nikon D810 DSLR camera, which features a 36.3-megapixel CMOS sensor and a powerful EXPEED 4 processor for clear, detailed images. The AF-S NIKKOR 24-120mm lens offers shooting versatility. Memory card sold separately.", "brand": "Nikon", "categories": ["Cameras & Camcorders", "Digital Cameras", "Digital SLR Cameras", "DSLR Body & Lens"], "hierarchicalCategories": { "lvl0": "Cameras & Camcorders", "lvl1": "Cameras & Camcorders > Digital Cameras", "lvl2": "Cameras & Camcorders > Digital Cameras > Digital SLR Cameras", "lvl3": "Cameras & Camcorders > Digital Cameras > Digital SLR Cameras > DSLR Body & Lens" }, "type": "Dslr cameras", "price": 4099.99, "price_range": "> 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/3953409_sb.jpg", "url": "https://api.bestbuy.com/click/-/3953409/pdp", "free_shipping": true, "rating": 4, "popularity": 12311, "objectID": "3953409", "_highlightResult": { "name": { "value": "Nikon - D810 DSLR Camera with AF-S NIKKOR 24-120mm f/4G ED VR Zoom Lens - Black", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "Shoot arresting photos and 1080p high-definition videos with this Nikon D810 DSLR camera, which features a 36.3-megapixel CMOS sensor and a powerful EXPEED 4 processor for clear, detailed images. The AF-S NIKKOR 24-120mm lens offers shooting versatility. Memory card sold separately.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Nikon", "matchLevel": "none", "matchedWords": [] }, "categories": [{ "value": "Cameras &amp; Camcorders", "matchLevel": "none", "matchedWords": [] }, { "value": "Digital Cameras", "matchLevel": "none", "matchedWords": [] }, { "value": "Digital SLR Cameras", "matchLevel": "none", "matchedWords": [] }, { "value": "DSLR Body &amp; Lens", "matchLevel": "none", "matchedWords": [] }] }, "quantity": 1, "discount_in_percentage": 13, "offers_count": 4, "delivery_date": "Wed Apr 10" },
{ "name": "Sony - 75\" Class (74.5\" diag) - LED - 2160p - Smart - 3D - 4K Ultra HD TV with High Dynamic Range - Black", "description": "This Sony 4K HDR TV boasts 4K technology for vibrant hues. Its X940D series features a bold 75-inch screen and slim design. Wires remain hidden, and the unit is easily wall mounted. This television has a 4K Processor X1 and 4K X-Reality PRO for crisp video. This Sony 4K HDR TV is easy to control via voice commands.", "brand": "Sony", "categories": ["TV & Home Theater", "TVs", "4K Ultra HD TVs"], "hierarchicalCategories": { "lvl0": "TV & Home Theater", "lvl1": "TV & Home Theater > TVs", "lvl2": "TV & Home Theater > TVs > 4K Ultra HD TVs" }, "type": "Mht 61\"-100\" tv's", "price": 4499.99, "price_range": "> 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/4803900_sb.jpg", "url": "https://api.bestbuy.com/click/-/4803900/pdp", "free_shipping": false, "rating": 4, "popularity": 20687, "objectID": "4803900", "_highlightResult": { "name": { "value": "Sony - 75&quot; Class (74.5&quot; diag) - LED - 2160p - Smart - 3D - 4K Ultra HD TV with High Dynamic Range - Black", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "This Sony 4K HDR TV boasts 4K technology for vibrant hues. Its X940D series features a bold 75-inch screen and slim design. Wires remain hidden, and the unit is easily wall mounted. This television has a 4K Processor X1 and 4K X-Reality PRO for crisp video. This Sony 4K HDR TV is easy to control via voice commands.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Sony", "matchLevel": "none", "matchedWords": [] }, "categories": [{ "value": "TV &amp; Home Theater", "matchLevel": "none", "matchedWords": [] }, { "value": "TVs", "matchLevel": "none", "matchedWords": [] }, { "value": "4K Ultra HD TVs", "matchLevel": "none", "matchedWords": [] }] }, "quantity": 1, "discount_in_percentage": 5, "offers_count": 2, "delivery_date": "Wed Apr 13" },
{ "name": "Beats by Dr. Dre - Geek Squad Certified Refurbished Beats Studio Wireless On-Ear Headphones - Red", "description": "Rock out to your favorite songs with these Beats by Dr. Dre Beats Studio Wireless GS-MH8K2AM/A headphones that feature a Beats Acoustic Engine and DSP software for enhanced clarity. ANC (Adaptive Noise Cancellation) allows you to focus on your tunes.", "brand": "Beats by Dr. Dre", "categories": ["Audio", "Headphones", "All Headphones"], "hierarchicalCategories": { "lvl0": "Audio", "lvl1": "Audio > Headphones", "lvl2": "Audio > Headphones > All Headphones" }, "type": "Refurbished beats", "price": 379.99, "price_range": "200 - 500", "image": "https://cdn-demo.algolia.com/bestbuy-0118/4784058_sb.jpg", "url": "https://api.bestbuy.com/click/-/4784058/pdp", "free_shipping": false, "rating": 4, "popularity": 15883, "objectID": "4784058", "_highlightResult": { "name": { "value": "<mark>Beats</mark> <mark>by</mark> <mark>Dr.</mark> Dre - Geek Squad Certified Refurbished <mark>Beats</mark> Studio Wireless On-Ear Headphones - Red", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["beats", "by", "dr"] }, "description": { "value": "Rock out to your favorite songs with these <mark>Beats</mark> <mark>by</mark> <mark>Dr.</mark> Dre <mark>Beats</mark> Studio Wireless GS-MH8K2AM/A headphones that feature a <mark>Beats</mark> Acoustic Engine and DSP software for enhanced clarity. ANC (Adaptive Noise Cancellation) allows you to focus on your tunes.", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["beats", "by", "dr"] }, "brand": { "value": "<mark>Beats</mark> <mark>by</mark> <mark>Dr.</mark> Dre", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["beats", "by", "dr"] }, "categories": [{ "value": "Audio", "matchLevel": "none", "matchedWords": [] }, { "value": "Headphones", "matchLevel": "none", "matchedWords": [] }, { "value": "All Headphones", "matchLevel": "none", "matchedWords": [] }] }, "quantity": 1, "discount_in_percentage": 12, "offers_count": 3, "delivery_date": "Wed Apr 9" },
{ "name": "Sony - PlayStation 4 Pro Console", "description": "PS4 Pro Dynamic 4K Gaming & 4K Entertainment* PS4 Pro gets you closer to your game. Heighten your experiences. Enrich your adventures. Let the super-charged PS4 Pro lead the way.** GREATNESS AWAITS", "brand": "Sony", "categories": ["Video Games", "PlayStation 4", "PS4 Consoles"], "hierarchicalCategories": { "lvl0": "Video Games", "lvl1": "Video Games > PlayStation 4", "lvl2": "Video Games > PlayStation 4 > PS4 Consoles" }, "type": "Playstation 4 hw", "price": 399.99, "price_range": "200 - 500", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5388900_sb.jpg", "url": "https://api.bestbuy.com/click/-/5388900/pdp", "free_shipping": true, "rating": 4, "popularity": 21402, "objectID": "5388900", "_highlightResult": { "name": { "value": "<mark>Sony</mark> - <mark>Pla</mark>yStation 4 Pro Console", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["sony", "pla"] }, "description": { "value": "PS4 Pro Dynamic 4K Gaming &amp; 4K Entertainment* PS4 Pro gets you closer to your game. Heighten your experiences. Enrich your adventures. Let the super-charged PS4 Pro lead the way.** GREATNESS AWAITS", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "<mark>Sony</mark>", "matchLevel": "partial", "fullyHighlighted": true, "matchedWords": ["sony"] }, "categories": [{ "value": "Video Games", "matchLevel": "none", "matchedWords": [] }, { "value": "<mark>Pla</mark>yStation 4", "matchLevel": "partial", "fullyHighlighted": false, "matchedWords": ["pla"] }, { "value": "PS4 Consoles", "matchLevel": "none", "matchedWords": [] }] }, "quantity": 1, "discount_in_percentage": 3, "offers_count": 1, "delivery_date": "Wed Apr 12" },
{ "name": "Apple - Macbook® (Latest Model) - 12\" Display - Intel Core M5 - 8GB Memory - 512GB Flash Storage - Space Gray", "description": "MacBook delivers a full-size experience in the lightest and most compact Mac notebook ever. With a full-size keyboard, force-sensing trackpad, 12-inch Retina display,1 sixth-generation Intel Core M processor, multifunctional USB-C port, and now up to 10 hours of battery life,2 MacBook features big thinking in an impossibly compact form.", "brand": "Apple", "categories": ["Computers & Tablets", "Laptops", "All Laptops", "MacBooks"], "hierarchicalCategories": { "lvl0": "Computers & Tablets", "lvl1": "Computers & Tablets > Laptops", "lvl2": "Computers & Tablets > Laptops > All Laptops", "lvl3": "Computers & Tablets > Laptops > All Laptops > MacBooks" }, "type": "Apple", "price": 1599.99, "price_range": "500 - 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5229600_sb.jpg", "url": "https://api.bestbuy.com/click/-/5229600/pdp", "free_shipping": true, "rating": 4, "popularity": 19609, "objectID": "5229600", "_highlightResult": { "name": { "value": "<mark>Apple</mark> - Macbook® (Latest Model) - 12&quot; Display - Intel Core M5 - 8GB Memory - 512GB Flash Storage - Space Gray", "matchLevel": "partial", "fullyHighlighted": false, "matchedWords": ["apple"] }, "description": { "value": "MacBook delivers a full-size experience in the lightest and most compact Mac notebook ever. With a full-size keyboard, force-sensing trackpad, 12-inch Retina display,1 sixth-generation Intel Core M processor, multifunctional USB-C port, and now up to 10 hours of battery life,2 MacBook features big thinking in an impossibly compact form.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "<mark>Apple</mark>", "matchLevel": "partial", "fullyHighlighted": true, "matchedWords": ["apple"] }, "categories": [{ "value": "Computers &amp; Tablets", "matchLevel": "none", "matchedWords": [] }, { "value": "<mark>Laptops</mark>", "matchLevel": "partial", "fullyHighlighted": true, "matchedWords": ["laptop"] }, { "value": "All <mark>Laptops</mark>", "matchLevel": "partial", "fullyHighlighted": false, "matchedWords": ["laptop"] }, { "value": "MacBooks", "matchLevel": "none", "matchedWords": [] }] }, "quantity": 1, "discount_in_percentage": 7, "offers_count": 1, "delivery_date": "Wed Apr 14" },
{ "name": "Apple - Apple Watch Series 1 42mm Space Gray Aluminum Case Black Sport Band - Space Gray Aluminum", "description": "Durable, lightweight aluminum cases in silver, space gray, gold, and rose gold. Sport Band in a variety of colors. All the features of the original Apple Watch, plus a new dual-core processor for faster performance. All models run watchOS 3. Requires an iPhone 5 or later.", "brand": "Apple", "categories": ["Wearable Technology", "Apple Watch", "Apple Watch Series 1"], "hierarchicalCategories": { "lvl0": "Wearable Technology", "lvl1": "Wearable Technology > Apple Watch", "lvl2": "Wearable Technology > Apple Watch > Apple Watch Series 1" }, "type": "Standard apple watch", "price": 299, "price_range": "200 - 500", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5546604_sb.jpg", "url": "https://api.bestbuy.com/click/-/5546604/pdp", "free_shipping": true, "rating": 4, "popularity": 21419, "objectID": "5546604", "_highlightResult": { "name": { "value": "<mark>Apple</mark> - <mark>Apple</mark> Watch Series 1 42mm Space Gray Aluminum Case Black Sport Band - Space Gray Aluminum", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }, "description": { "value": "Durable, lightweight aluminum cases in silver, space gray, gold, and rose gold. Sport Band in a variety of colors. All the features of the original <mark>Apple</mark> Watch, plus a new dual-core processor for faster performance. All models run watchOS 3. Requires an iPhone 5 or later.", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }, "brand": { "value": "<mark>Apple</mark>", "matchLevel": "full", "fullyHighlighted": true, "matchedWords": ["apple"] }, "categories": [{ "value": "Wearable Technology", "matchLevel": "none", "matchedWords": [] }, { "value": "<mark>Apple</mark> Watch", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }, { "value": "<mark>Apple</mark> Watch Series 1", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] }], "type": { "value": "Standard <mark>apple</mark> watch", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": ["apple"] } }, "quantity": 1, "discount_in_percentage": 17, "offers_count": 4, "delivery_date": "Wed Apr 15" },
],
wishList: [
{ "name": "Bowers & Wilkins - CM10 S2 Triple 6-1/2\" 3-Way Floorstanding Speaker (Each) - Gloss Black", "description": "Featuring triple 6-1/2\" bass cones, a 6\" midrange cone and a 1\" tweeter, this Bowers & Wilkins CM10 S2 floorstanding speaker fills a large room with stunning, true-to-life audio. The tweeter-on-top design ensures studio-grade sound is emitted.", "brand": "Bowers & Wilkins", "categories": ["Audio", "Home Audio", "Speakers", "Floor Speakers"], "hierarchicalCategories": { "lvl0": "Audio", "lvl1": "Audio > Home Audio", "lvl2": "Audio > Home Audio > Speakers", "lvl3": "Audio > Home Audio > Speakers > Floor Speakers" }, "type": "Mht floor speakers", "price": 1999.98, "price_range": "500 - 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/8434275_sb.jpg", "url": "https://api.bestbuy.com/click/-/8434275/pdp", "free_shipping": false, "rating": 5, "popularity": 17253, "objectID": "8434275", "_highlightResult": { "name": { "value": "Bowers &amp; Wilkins - CM10 S2 Triple 6-1/2&quot; 3-Way Floorstanding Speaker (Each) - Gloss Black", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "Featuring triple 6-1/2&quot; bass cones, a 6&quot; midrange cone and a 1&quot; tweeter, this Bowers &amp; Wilkins CM10 S2 floorstanding speaker fills a large room with stunning, true-to-life audio. The tweeter-on-top design ensures studio-grade sound is emitted.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Bowers &amp; Wilkins", "matchLevel": "none", "matchedWords": [] }, "categories": [{ "value": "Audio", "matchLevel": "none", "matchedWords": [] }, { "value": "Home Audio", "matchLevel": "none", "matchedWords": [] }, { "value": "Speakers", "matchLevel": "none", "matchedWords": [] }, { "value": "Floor Speakers", "matchLevel": "none", "matchedWords": [] }] } },
{ "name": "Samsung - Chef Collection 34.3 Cu. Ft. 4-Door Flex French Door Refrigerator with Thru-the-Door Ice and Water - Stainless Steel", "description": "Samsung 34.3 Cu. Ft. Frost-Free 4-Door Flex French Door Refrigerator with Thru-the Door Ice and Water: Take the utmost care of your ingredients, and keep them all organized, with this ultralarge-capacity Chef Collection refrigerator. It features 2 compressors, 3 evaporators and 4 temperature zones, keeping foods at their optimum temperature for freshness and flavor.", "brand": "Samsung", "categories": ["Appliances", "Refrigerators", "All Refrigerators"], "hierarchicalCategories": { "lvl0": "Appliances", "lvl1": "Appliances > Refrigerators", "lvl2": "Appliances > Refrigerators > All Refrigerators" }, "type": "French door refrig", "price": 4999.99, "price_range": "> 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/4039001_sb.jpg", "url": "https://api.bestbuy.com/click/-/4039001/pdp", "free_shipping": false, "rating": 4, "popularity": 17400, "objectID": "4039001", "_highlightResult": { "name": { "value": "Samsung - Chef Collection 34.3 Cu. Ft. 4-Door Flex French Door Refrigerator with Thru-the-Door Ice and Water - Stainless Steel", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "Samsung 34.3 Cu. Ft. Frost-Free 4-Door Flex French Door Refrigerator with Thru-the Door Ice and Water: Take the utmost care of your ingredients, and keep them all organized, with this ultralarge-capacity Chef Collection refrigerator. It features 2 compressors, 3 evaporators and 4 temperature zones, keeping foods at their optimum temperature for freshness and flavor.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Samsung", "matchLevel": "none", "matchedWords": [] }, "categories": [{ "value": "Appliances", "matchLevel": "none", "matchedWords": [] }, { "value": "Refrigerators", "matchLevel": "none", "matchedWords": [] }, { "value": "All Refrigerators", "matchLevel": "none", "matchedWords": [] }] } },
{ "name": "Canon - EOS 5D Mark IV DSLR Camera with 24-70mm f/4L IS USM Lens", "description": "Shoot professional photos and videos with this Canon EOS 5D Mk V 24-70mm lens kit. A huge 30.4-megapixel full-frame sensor delivers outstanding image clarity, and 4K video is possible from this DSLR for powerful films. Ultra-precise autofocus and huge ISO ranges give you the images you want from this Canon EOS 5D Mk V 24-70mm lens kit.", "brand": "Canon", "categories": ["Cameras & Camcorders", "Digital Cameras", "Digital SLR Cameras", "DSLR Body & Lens"], "hierarchicalCategories": { "lvl0": "Cameras & Camcorders", "lvl1": "Cameras & Camcorders > Digital Cameras", "lvl2": "Cameras & Camcorders > Digital Cameras > Digital SLR Cameras", "lvl3": "Cameras & Camcorders > Digital Cameras > Digital SLR Cameras > DSLR Body & Lens" }, "type": "Dslr cameras", "price": 4399.99, "price_range": "> 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5578528_rb.jpg", "url": "https://api.bestbuy.com/click/-/5578528/pdp", "free_shipping": true, "rating": 4, "popularity": 16298, "objectID": "5578528", "_highlightResult": { "name": { "value": "Canon - EOS 5D Mark IV DSLR Camera with 24-70mm f/4L IS USM Lens", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "Shoot professional photos and videos with this Canon EOS 5D Mk V 24-70mm lens kit. A huge 30.4-megapixel full-frame sensor delivers outstanding image clarity, and 4K video is possible from this DSLR for powerful films. Ultra-precise autofocus and huge ISO ranges give you the images you want from this Canon EOS 5D Mk V 24-70mm lens kit.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Canon", "matchLevel": "none", "matchedWords": [] }, "categories": [{ "value": "Cameras &amp; Camcorders", "matchLevel": "none", "matchedWords": [] }, { "value": "Digital Cameras", "matchLevel": "none", "matchedWords": [] }, { "value": "Digital SLR Cameras", "matchLevel": "none", "matchedWords": [] }, { "value": "DSLR Body &amp; Lens", "matchLevel": "none", "matchedWords": [] }] } },
{ "name": "Apple - 27\" iMac with Retina 5K display - Intel Core i7 - 32GB Memory - 2TB Fusion Drive - Silver", "description": "With 14.7 million pixels, the 27-inch iMac with Retina 5K display is the most powerful iMac ever. It features quad-core Intel&#174; processors, the latest AMD graphics, 2TB Fusion Drive, and great built-in apps. All in the same ultrathin design that's just 5mm at the edge.", "brand": "Apple", "categories": ["Computers & Tablets", "All Desktops"], "hierarchicalCategories": { "lvl0": "Computers & Tablets", "lvl1": "Computers & Tablets > All Desktops" }, "type": "Apple cpu's", "price": 3199.99, "price_range": "> 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5622404_sb.jpg", "url": "https://api.bestbuy.com/click/-/5622404/pdp", "free_shipping": true, "rating": 4, "popularity": 16050, "objectID": "5622404", "_highlightResult": { "name": { "value": "Apple - 27&quot; iMac with Retina 5K display - Intel Core i7 - 32GB Memory - 2TB Fusion Drive - Silver", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "With 14.7 million pixels, the 27-inch iMac with Retina 5K display is the most powerful iMac ever. It features quad-core Intel® processors, the latest AMD graphics, 2TB Fusion Drive, and great built-in apps. All in the same ultrathin design that&#39;s just 5mm at the edge.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Apple", "matchLevel": "none", "matchedWords": [] }, "categories": [{ "value": "Computers &amp; Tablets", "matchLevel": "none", "matchedWords": [] }, { "value": "All Desktops", "matchLevel": "none", "matchedWords": [] }] } },
{ "name": "Amazon - Fire TV Stick with Alexa Voice Remote - Black", "description": "Enjoy smart access to videos, games and apps with this Amazon Fire TV stick. Its Alexa voice remote lets you deliver hands-free commands when you want to watch television or engage with other applications. With a quad-core processor, 1GB internal memory and 8GB of storage, this portable Amazon Fire TV stick works fast for buffer-free streaming.", "brand": "Amazon", "categories": ["TV & Home Theater", "Streaming Media Players"], "hierarchicalCategories": { "lvl0": "TV & Home Theater", "lvl1": "TV & Home Theater > Streaming Media Players" }, "type": "Streaming media plyr", "price": 39.99, "price_range": "1 - 50", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5477500_sb.jpg", "url": "https://api.bestbuy.com/click/-/5477500/pdp", "free_shipping": false, "rating": 4, "popularity": 21469, "objectID": "5477500", "_highlightResult": { "name": { "value": "Amazon - Fire TV Stick with Alexa Voice Remote - Black", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "Enjoy smart access to videos, games and apps with this Amazon Fire TV stick. Its Alexa voice remote lets you deliver hands-free commands when you want to watch television or engage with other applications. With a quad-core processor, 1GB internal memory and 8GB of storage, this portable Amazon Fire TV stick works fast for buffer-free streaming.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Amazon", "matchLevel": "none", "matchedWords": [] }, "categories": [{ "value": "TV &amp; Home Theater", "matchLevel": "none", "matchedWords": [] }, { "value": "Streaming Media Players", "matchLevel": "none", "matchedWords": [] }], "type": { "value": "Streaming media plyr", "matchLevel": "none", "matchedWords": [] } } },
{ "name": "Alienware - 17.3\" Laptop - Intel Core i7 - 16GB Memory - NVIDIA GeForce GTX 1070 - 1TB Hard Drive + 128GB Solid State Drive - Silver", "description": "Alienware Laptop: Bring video games to life with this 17.3-inch Dell Alienware laptop. It has a powerful quad-core Intel Core i7 processor and 16GB of DDR4 RAM to run modern games quickly, and its 1TB hard drive stores plenty of game and other files. This Dell Alienware laptop has a 2.1 speaker configuration with a subwoofer for a dynamic gaming experience.", "brand": "Alienware", "categories": [ "Computers & Tablets", "Laptops" ], "hierarchicalCategories": { "lvl0": "Computers & Tablets", "lvl1": "Computers & Tablets > Laptops" }, "type": "Gaming laptops", "price": 1999.99, "price_range": "500 - 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5713010_sb.jpg", "url": "https://api.bestbuy.com/click/-/5713010/pdp", "free_shipping": false, "rating": 0, "popularity": 14033, "objectID": "5713010", "_highlightResult": { "name": { "value": "<mark>Alien</mark>ware - 17.3&quot; Laptop - Intel Core i7 - 16GB Memory - NVIDIA GeForce GTX 1070 - 1TB Hard Drive + 128GB Solid State Drive - Silver", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": [ "alien" ] }, "description": { "value": "<mark>Alien</mark>ware Laptop: Bring video games to life with this 17.3-inch Dell <mark>Alien</mark>ware laptop. It has a powerful quad-core Intel Core i7 processor and 16GB of DDR4 RAM to run modern games quickly, and its 1TB hard drive stores plenty of game and other files. This Dell <mark>Alien</mark>ware laptop has a 2.1 speaker configuration with a subwoofer for a dynamic gaming experience.", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": [ "alien" ] }, "brand": { "value": "<mark>Alien</mark>ware", "matchLevel": "full", "fullyHighlighted": false, "matchedWords": [ "alien" ] }, "categories": [ { "value": "Computers &amp; Tablets", "matchLevel": "none", "matchedWords": [] }, { "value": "Laptops", "matchLevel": "none", "matchedWords": [] } ] } },
{ "name": "Garmin - fenix 3 Sapphire GPS Watch - Silver", "description": "This Garmin fenix 3 Sapphire GPS watch comes with a titanium bezel and band, providing style and strength. This watch is waterproof up to 100m, and it comes with state-of-the-art fitness training features such as advanced running dynamics with vertical oscillation and vertical ratio. Track your activity and stay fit with the Garmin fenix 3 Sapphire GPS watch.", "brand": "Garmin", "categories": [ "Health, Fitness & Beauty", "Fitness & GPS Watches" ], "hierarchicalCategories": { "lvl0": "Health, Fitness & Beauty", "lvl1": "Health, Fitness & Beauty > Fitness & GPS Watches" }, "type": "", "price": 649.99, "price_range": "500 - 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/4922801_sb.jpg", "url": "https://api.bestbuy.com/click/-/4922801/pdp", "free_shipping": true, "rating": 4, "popularity": 12115, "objectID": "4922801", "_highlightResult": { "name": { "value": "Garmin - fenix 3 Sapphire GPS Watch - Silver", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "This Garmin fenix 3 Sapphire GPS watch comes with a titanium bezel and band, providing style and strength. This watch is waterproof up to 100m, and it comes with state-of-the-art fitness training features such as advanced running dynamics with vertical oscillation and vertical ratio. Track your activity and stay fit with the Garmin fenix 3 Sapphire GPS watch.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Garmin", "matchLevel": "none", "matchedWords": [] }, "categories": [ { "value": "Health, Fitness &amp; Beauty", "matchLevel": "none", "matchedWords": [] }, { "value": "Fitness &amp; GPS Watches", "matchLevel": "none", "matchedWords": [] } ] } },
{ "name": "Garmin - fēnix 5 GPS Heart Rate Monitor Watch - Slate gray", "description": "Map your adventure with this Garmin Fenix 5 GPS watch. Built-in navigation lets you know where you are when hiking or camping, and integrated Wi-Fi connects to the Garmin Connect to track your fitness level and daily steps. This Garmin Fenix 5 GPS watch is water-resistant up to 100m for use in wet conditions.", "brand": "Garmin", "categories": [ "Health, Fitness & Beauty", "Fitness & GPS Watches" ], "hierarchicalCategories": { "lvl0": "Health, Fitness & Beauty", "lvl1": "Health, Fitness & Beauty > Fitness & GPS Watches" }, "type": "Monitoring devices", "price": 599.99, "price_range": "500 - 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5714479_sb.jpg", "url": "https://api.bestbuy.com/click/-/5714479/pdp", "free_shipping": false, "rating": 0, "popularity": 12534, "objectID": "5714479", "_highlightResult": { "name": { "value": "Garmin - fēnix 5 GPS Heart Rate Monitor Watch - Slate gray", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "Map your adventure with this Garmin Fenix 5 GPS watch. Built-in navigation lets you know where you are when hiking or camping, and integrated Wi-Fi connects to the Garmin Connect to track your fitness level and daily steps. This Garmin Fenix 5 GPS watch is water-resistant up to 100m for use in wet conditions.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Garmin", "matchLevel": "none", "matchedWords": [] }, "categories": [ { "value": "Health, Fitness &amp; Beauty", "matchLevel": "none", "matchedWords": [] }, { "value": "Fitness &amp; GPS Watches", "matchLevel": "none", "matchedWords": [] } ] } },
{ "name": "Beats by Dr. Dre - Powerbeats2 Wireless Earbud Headphones - Black/Red", "description": "Beats by Dr. Dre Powerbeats2: These workout headphones are crafted to keep up with your active routine. The no-slip design of the call answer button ensures phone calls won't be missed, and music can be easily cycled through.", "brand": "Beats by Dr. Dre", "categories": [ "Audio", "Headphones", "Wireless Headphones" ], "hierarchicalCategories": { "lvl0": "Audio", "lvl1": "Audio > Headphones", "lvl2": "Audio > Headphones > Wireless Headphones" }, "type": "Wireless in ears", "price": 199.99, "price_range": "100 - 200", "image": "https://cdn-demo.algolia.com/bestbuy/5565002_sb.jpg", "url": "http://www.bestbuy.com/site/beats-by-dr-dre-powerbeats2-wireless-earbud-headphones-black-red/5565002.p?id=1219139426902&skuId=5565002&cmp=RMX&ky=1uWSHMdQqBeVJB9cXgEke60s5EjfS6M1W", "free_shipping": false, "popularity": 9059, "rating": 4, "objectID": "5565002" },
{ "name": "Asus - ROG Desktop - Intel Core i7 - 16GB Memory - Double NVIDIA GeForce GTX1080 - 1TB Hard Drive + 2x512GB Solid State Drive - Gray", "description": "Place the sleek form of this ASUS desktop computer tower on your desk, and take your gaming to the next level. With Intel Core i7 processing inside, this speedy desktop keeps up with even multilayered action games. Nvidia graphics on this ASUS desktop computer help eliminate ghosting and stutter so you see every move your enemy makes.", "brand": "Asus", "categories": [ "Video Games", "PC Gaming", "Virtual Reality for PC" ], "hierarchicalCategories": { "lvl0": "Video Games", "lvl1": "Video Games > PC Gaming", "lvl2": "Video Games > PC Gaming > Virtual Reality for PC" }, "type": "", "price": 4999.99, "price_range": "> 2000", "image": "https://cdn-demo.algolia.com/bestbuy-0118/5582501_sb.jpg", "url": "https://api.bestbuy.com/click/-/5582501/pdp", "free_shipping": false, "rating": 1, "popularity": 9684, "objectID": "5582501", "_highlightResult": { "name": { "value": "Asus - ROG Desktop - Intel Core i7 - 16GB Memory - Double NVIDIA GeForce GTX1080 - 1TB Hard Drive + 2x512GB Solid State Drive - Gray", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "Place the sleek form of this ASUS desktop computer tower on your desk, and take your gaming to the next level. With Intel Core i7 processing inside, this speedy desktop keeps up with even multilayered action games. Nvidia graphics on this ASUS desktop computer help eliminate ghosting and stutter so you see every move your enemy makes.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Asus", "matchLevel": "none", "matchedWords": [] }, "categories": [ { "value": "Video Games", "matchLevel": "none", "matchedWords": [] }, { "value": "PC Gaming", "matchLevel": "none", "matchedWords": [] }, { "value": "Virtual Reality for PC", "matchLevel": "none", "matchedWords": [] } ] } },
{ "name": "Sony - ZX Series On-Ear Headphones - Black", "description": "These Sony ZX Series MDRZX110/BLK headphones feature neodymium magnets and 30mm drivers for powerful, reinforced sound. Enjoy your favorite songs with lush bass response thanks to the Acoustic Bass Booster technology.", "brand": "Sony", "categories": [ "Audio", "Headphones", "On-Ear Headphones" ], "hierarchicalCategories": { "lvl0": "Audio", "lvl1": "Audio > Headphones", "lvl2": "Audio > Headphones > On-Ear Headphones" }, "type": "On ear headphones", "price": 19.99, "price_range": "1 - 50", "image": "https://cdn-demo.algolia.com/bestbuy-0118/8618232_sb.jpg", "url": "https://api.bestbuy.com/click/-/8618232/pdp", "free_shipping": true, "rating": 4, "popularity": 21400, "objectID": "8618232", "_highlightResult": { "name": { "value": "Sony - ZX Series On-Ear Headphones - Black", "matchLevel": "none", "matchedWords": [] }, "description": { "value": "These Sony ZX Series MDRZX110/BLK headphones feature neodymium magnets and 30mm drivers for powerful, reinforced sound. Enjoy your favorite songs with lush bass response thanks to the Acoustic Bass Booster technology.", "matchLevel": "none", "matchedWords": [] }, "brand": { "value": "Sony", "matchLevel": "none", "matchedWords": [] }, "categories": [ { "value": "Audio", "matchLevel": "none", "matchedWords": [] }, { "value": "Headphones", "matchLevel": "none", "matchedWords": [] }, { "value": "On-Ear Headphones", "matchLevel": "none", "matchedWords": [] } ], "type": { "value": "On ear headphones", "matchLevel": "none", "matchedWords": [] } } }
]
}
/* eslint-enable */
+22
View File
@@ -0,0 +1,22 @@
/*=========================================================================================
File Name: moduleEmail.js
Description: Email Module
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import state from './moduleEmailState.js'
import mutations from './moduleEmailMutations.js'
import actions from './moduleEmailActions.js'
import getters from './moduleEmailGetters.js'
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
+121
View File
@@ -0,0 +1,121 @@
/*=========================================================================================
File Name: moduleEmailActions.js
Description: Email Module Actions
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import axios from '@/axios.js'
export default {
setEmailSearchQuery ({ commit }, query) {
commit('SET_EMAIL_SEARCH_QUERY', query)
},
// Fetch emails
fetchEmails ({ commit }, payload) {
return new Promise((resolve, reject) => {
axios.get('/api/apps/email/mails', { params: {filter: payload.filter} })
.then((response) => {
commit('SET_MAILS', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
// Fetch Tags
fetchTags ({ commit }) {
return new Promise((resolve, reject) => {
axios.get('/api/apps/email/tags')
.then((response) => {
commit('SET_TAGS', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
// Fetch Email Meta
fetchMeta ({ commit }) {
return new Promise((resolve, reject) => {
axios.get('/api/apps/email/meta')
.then((response) => {
commit('SET_META', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
// Move mails to another folder
moveMailsTo ({ commit }, payload) {
return new Promise((resolve, reject) => {
axios.post('/api/apps/email/move-mails', { emailIds: payload.emailIds,
mailFolder: payload.to })
.then((response) => {
commit('MOVE_MAILS_TO', payload)
commit('UPDATE_UNREAD_META_ON_MOVE', payload)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
// Update Mails label
updateLabels ({ commit }, payload) {
return new Promise((resolve, reject) => {
axios.post('/api/apps/email/update-labels', { emailIds: payload.mails,
label: payload.label })
.then((response) => {
commit('UPDATE_LABELS', payload)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
setLabels ({ commit }, payload) {
return new Promise((resolve, reject) => {
axios.post('/api/apps/email/set-labels', { mailId: payload.mailId,
labels: payload.labels })
.then((response) => {
commit('SET_LABELS', payload)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
// Set mails flag unread to true
setUnread ({ commit }, payload) {
return new Promise((resolve, reject) => {
axios.post('/api/apps/email/mark-unread', { emailIds: payload.emailIds,
unreadFlag: payload.unreadFlag })
.then((response) => {
commit('SET_UNREAD', payload)
// Remove this if you are getting meta like us
// Use your own method to update email meta if you are fetching email meta
commit('UPDATE_UNREAD_META', payload)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
// Toggle isStarred flag in mail
toggleIsMailStarred ({ commit }, payload) {
return new Promise((resolve, reject) => {
axios.post('/api/apps/email/set-starred', { mailId: payload.mailId,
value: payload.value })
.then((response) => {
commit('TOGGLE_IS_MAIL_STARRED', payload)
resolve(response)
})
.catch((error) => { reject(error) })
})
}
}
+16
View File
@@ -0,0 +1,16 @@
/*=========================================================================================
File Name: moduleEmailGetters.js
Description: Email Module Getters
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
filteredMails: state => state.mails.filter((mail) => {
return (state.mail_filter === 'starred' ? mail.isStarred : state.mail_filter === mail.mailFolder || mail.labels.includes(state.mail_filter)) && (mail.sender_name.toLowerCase().includes(state.mailSearchQuery.toLowerCase()) || mail.sender.toLowerCase().includes(state.mailSearchQuery.toLowerCase()) || mail.subject.toLowerCase().includes(state.mailSearchQuery.toLowerCase()) || mail.message.toLowerCase().includes(state.mailSearchQuery.toLowerCase()))
}),
getMail: state => (emailId) => state.mails.find((email) => email.id === emailId)
}
+112
View File
@@ -0,0 +1,112 @@
/*=========================================================================================
File Name: moduleEmailMutations.js
Description: Email Module Mutations
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
SET_EMAIL_SEARCH_QUERY (state, query) {
state.mailSearchQuery = query
},
SET_MAILS (state, mails) {
state.mails = mails
},
SET_TAGS (state, tags) {
state.mailTags = tags
},
SET_META (state, meta) {
state.meta = meta
},
UPDATE_MAIL_FILTER (state, filterName) {
state.mail_filter = filterName
},
UPDATE_LABELS (state, payload) {
payload.mails.forEach((mailId) => {
const mailIndex = state.mails.findIndex((mail) => mail.id === mailId)
const index = state.mails[mailIndex].labels.indexOf(payload.label)
if (index === -1) state.mails[mailIndex].labels.push(payload.label)
else state.mails[mailIndex].labels.splice(index, 1)
})
},
SET_LABELS (state, payload) {
state.mails.find((mail) => mail.id === payload.mailId).labels = payload.labels
},
SET_UNREAD (state, payload) {
payload.emailIds.forEach((mailId) => {
const mailIndex = state.mails.findIndex((mail) => mail.id === mailId)
if (mailIndex !== -1) state.mails[mailIndex].unread = payload.unreadFlag
})
},
MOVE_MAILS_TO (state, payload) {
payload.emailIds.forEach((mailId) => {
const mailIndex = state.mails.findIndex((mail) => mail.id === mailId)
// Update draft meta
// If moving from draft mailFolder decrease draft meta by removing mailId
if (state.mails[mailIndex].mailFolder === 'draft') {
state.meta.draftMails.splice(state.meta.draftMails.findIndex(i => i === mailId), 1)
}
// Else increase by pushing mailId
if (payload.to === 'draft') {
state.meta.draftMails.push(mailId)
}
state.mails[mailIndex].mailFolder = payload.to
})
},
TOGGLE_IS_MAIL_STARRED (state, payload) {
state.mails.find((mail) => mail.id === payload.mailId).isStarred = payload.value
},
// If your process of fetching is different than ours. Please update action and mutation
// Maybe this mutation is redundant for you. Feel free to remove it.
UPDATE_UNREAD_META (state, payload) {
// Loop over email meta
for (const folder in state.meta.unreadMails.folder) {
// If folder is same as current filter
if (folder === state.mail_filter) {
if (payload.unreadFlag) {
// If unread flag is true - increase count
payload.emailIds.forEach((mailId) => {
if (state.meta.unreadMails.folder[folder].indexOf(mailId) === -1) state.meta.unreadMails.folder[folder].push(mailId)
})
} else {
// else reduce unread mails count
payload.emailIds.forEach((mailId) => {
const mailIdIndex = state.meta.unreadMails.folder[folder].indexOf(mailId)
if (mailIdIndex !== -1) state.meta.unreadMails.folder[folder].splice(mailIdIndex, 1)
})
}
}
}
},
UPDATE_UNREAD_META_ON_MOVE (state, payload) {
// Updating Draft meta is handled by "MOVE_MAILS_TO" mutation
payload.emailIds.forEach((mailId) => {
const mail = state.mails.find((mail) => mail.id === mailId)
if (mail.unread) {
const cf_unread_mails = state.meta.unreadMails.folder[state.mail_filter]
if (cf_unread_mails) {
cf_unread_mails.splice(cf_unread_mails.indexOf(mailId), 1)
}
if (state.meta.unreadMails.folder[payload.to]) state.meta.unreadMails.folder[payload.to].push(mailId)
}
})
}
}
+17
View File
@@ -0,0 +1,17 @@
/*=========================================================================================
File Name: moduleEmailState.js
Description: Email Module State
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
mails: [],
mail_filter: null,
mailTags: [],
meta: {},
mailSearchQuery: ''
}
View File
+33
View File
@@ -0,0 +1,33 @@
/*=========================================================================================
File Name: getters.js
Description: Vuex Store - getters
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
// added so later we can keep breakpoint in sync automatically using this config file
// import tailwindConfig from "../../tailwind.config.js"
const getters = {
// COMPONENT
// vx-autosuggest
// starredPages: state => state.navbarSearchAndPinList.data.filter((page) => page.highlightAction),
windowBreakPoint: state => {
// This should be same as tailwind. So, it stays in sync with tailwind utility classes
if (state.windowWidth >= 1200) return 'xl'
else if (state.windowWidth >= 992) return 'lg'
else if (state.windowWidth >= 768) return 'md'
else if (state.windowWidth >= 576) return 'sm'
else return 'xs'
},
scrollbarTag: state => {
return state.is_touch_device ? 'div' : 'VuePerfectScrollbar'
}
}
export default getters
+80
View File
@@ -0,0 +1,80 @@
import _ from 'lodash';
import axios from "../../axios";
const state = {
keys: [
{
id: 'ut',
title: 'نوع کاربری',
icon: 'icon-user',
iconPack: 'feather'
},
{
id: 'status',
title: 'وضعیت سفارش',
icon: 'icon-user',
iconPack: 'feather'
},
],
loading: false,
rows: [
{id: 1, key: 'ut', val: 'نوع اول'}
]
};
const mutations = {
ADD_ITEM(state, data) {
console.log("data ==> ", data);
state.rows.push(data);
},
INJECT(state , {rows , keys}){
state.rows = rows || [];
state.keys = keys || [];
},
LOADING(state, data) {
state.loading = data;
},
EDIT_ROW(state, data) {
if (data.delete) {
console.log("data.row ==> ", data.row);
console.log("data ==> ", data);
state.rows = _.without(state.rows, _.find(state.rows, (item) => item.val == data.row.val));
} else {
state.rows[data.index] = data.row;
}
}
};
const actions = {
async init({commit}){
commit('LOADING', true);
try {
let res = await axios.get('http://api.doringold.com/admin/config/statics');
console.log("res ==> " , res);
commit('INJECT' , res.data);
} catch (e) {
} finally {
commit('LOADING', false);
}
},
async save({commit ,state}, data) {
commit('LOADING', true);
try {
let res = await axios.post('http://api.doringold.com/config/statics' , state.rows);
} catch (e) {
} finally {
commit('LOADING', false);
}
}
};
const getters = {};
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
View File
+141
View File
@@ -0,0 +1,141 @@
/*=========================================================================================
File Name: mutations.js
Description: Vuex Store - mutations
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
const mutations = {
// /////////////////////////////////////////////
// COMPONENTS
// /////////////////////////////////////////////
// Vertical NavMenu
TOGGLE_IS_VERTICAL_NAV_MENU_ACTIVE (state, value) {
state.isVerticalNavMenuActive = value
},
TOGGLE_REDUCE_BUTTON (state, val) {
state.reduceButton = val
},
UPDATE_MAIN_LAYOUT_TYPE (state, val) {
state.mainLayoutType = val
},
UPDATE_VERTICAL_NAV_MENU_ITEMS_MIN (state, val) {
state.verticalNavMenuItemsMin = val
},
UPDATE_VERTICAL_NAV_MENU_WIDTH (state, width) {
state.verticalNavMenuWidth = width
},
INIT(state, data) {
state.collection = data;
},
LOADING(state, payload) {
state.loading = payload;
},
ERROR(state, payload) {
state.error = payload;
},
UPDATE_COLLECTION(state, payload) {
state.collectionEdit = state.collectionEdit.map(collection => {
if (collection.id === payload.id) {
return Object.assign({},collection, payload.data)
}
return collection
})
console.log(state.collection,'users data kole')
},
// VxAutoSuggest
UPDATE_STARRED_PAGE (state, payload) {
// find item index in search list state
const index = state.navbarSearchAndPinList['pages'].data.findIndex((item) => item.url === payload.url)
// update the main list
state.navbarSearchAndPinList['pages'].data[index].is_bookmarked = payload.val
// if val is true add it to starred else remove
if (payload.val) {
state.starredPages.push(state.navbarSearchAndPinList['pages'].data[index])
} else {
// find item index from starred pages
const index = state.starredPages.findIndex((item) => item.url === payload.url)
// remove item using index
state.starredPages.splice(index, 1)
}
},
// Navbar-Vertical
ARRANGE_STARRED_PAGES_LIMITED (state, list) {
const starredPagesMore = state.starredPages.slice(10)
state.starredPages = list.concat(starredPagesMore)
},
ARRANGE_STARRED_PAGES_MORE (state, list) {
let downToUp = false
const lastItemInStarredLimited = state.starredPages[10]
const starredPagesLimited = state.starredPages.slice(0, 10)
state.starredPages = starredPagesLimited.concat(list)
state.starredPages.slice(0, 10).map((i) => {
if (list.indexOf(i) > -1) downToUp = true
})
if (!downToUp) {
state.starredPages.splice(10, 0, lastItemInStarredLimited)
}
},
// ////////////////////////////////////////////
// UI
// ////////////////////////////////////////////
TOGGLE_CONTENT_OVERLAY (state, val) { state.bodyOverlay = val },
UPDATE_PRIMARY_COLOR (state, val) { state.themePrimaryColor = val },
UPDATE_THEME (state, val) { state.theme = val },
UPDATE_WINDOW_WIDTH (state, width) { state.windowWidth = width },
UPDATE_WINDOW_SCROLL_Y (state, val) { state.scrollY = val },
// /////////////////////////////////////////////
// User/Account
// /////////////////////////////////////////////
// Updates user info in state and localstorage
UPDATE_USER_INFO (state, payload) {
// Get Data localStorage
const userInfo = JSON.parse(localStorage.getItem('userInfo')) || state.AppActiveUser
for (const property of Object.keys(payload)) {
if (payload[property] !== null) {
// If some of user property is null - user default property defined in state.AppActiveUser
state.AppActiveUser[property] = payload[property]
// Update key in localStorage
userInfo[property] = payload[property]
}
}
// Store data in localStorage
localStorage.setItem('userInfo', JSON.stringify(userInfo))
}
}
export default mutations
+87
View File
@@ -0,0 +1,87 @@
import axios from "@/axios";
const state = {
model: {},
rows: [],
count: 0,
page: 0,
loading: false,
searchQuery: undefined,
};
const mutations = {
ADD_ITEM(state, data) {
state.rows.push(data);
},
LOADING(state, data) {
state.loading = data;
},
SET_PAGE(state, data) {
state.page = data;
},
SEARCH_QUERY_SET(state, data) {
state.searchQuery = data;
},
FETCH(state, {rows, count, page}) {
state.rows = rows;
state.count = count || 0;
state.page = page || 0;
},
INJECT_LIST(state, {count, rows, page}) {
state.count = count;
state.page = page;
state.rows = rows;
}
};
const actions = {
async remove({commit, dispatch}, {id}) {
commit('LOADING', true);
try {
const {data} = await axios.delete('order/' + id);
dispatch('order/fetch');
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async save({commit, state}, payload) {
commit('LOADING', true);
try {
if (payload.id) {
const {data} = await axios.put(`order/${payload.id}`, payload);
return data;
} else {
const {data} = await axios.post(`order/`, payload);
return data;
}
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async fetch({commit, state}, data) {
commit('LOADING', true);
try {
const {data} = await axios.get('order/', {params: {page: state.page, text_search: state.searchQuery}});
commit('FETCH', data);
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
}
};
const getters = {};
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
+121
View File
@@ -0,0 +1,121 @@
import axios from "@/axios";
const state = {
loadingDatePoint: false,
loadingDateRequest: false,
loadingCustomerSingle: false,
loadingPointCash: false,
loadingUserPoint: false,
loadingUserPointPayment: false,
};
const actions = {
async SendDatePoint({commit}, payload) {
try{
commit('LOADING_DATE_POINT', true);
const point = await axios.post('admin/score/chart/date',payload)
return point
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING_DATE_POINT', false);
}
},
async SendDateRequest({commit}, payload) {
try{
commit('LOADING_DATE_REQUEST', true);
const request = await axios.post('admin/score/chart/exchange',payload)
return request
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING_DATE_REQUEST', false);
}
},
async CustomerSingle({commit}, payload){
try{
commit('LOADING_CUSTOMER_SINGLE', true);
const customer = await axios.get(`admin/score/chart/customer/${payload.customer_id}`,payload)
return customer
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING_CUSTOMER_SINGLE', false);
}
},
async PointCash({commit}, payload){
try{
commit('LOADING_POINT_CASH', true);
const cash = await axios.post('admin/badadv/query/date',payload)
return cash
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING_POINT_CASH', false);
}
},
async SumUserPoint({commit}, payload){
try{
commit('LOADING_USER_POINT', true);
const {data} = await axios.post('admin/score/query/sum',payload)
return data
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING_USER_POINT', false);
}
},
async SumUserPointPayment({commit}, payload){
try{
commit('LOADING_USER_POINT_PAYMENT', true);
const {data} = await axios.post('admin/score/query/payment',payload)
return data
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING_USER_POINT_PAYMENT', false);
}
}
};
const mutations = {
LOADING_DATE_POINT(state, payload) {
state.loadingDatePoint = payload;
},
LOADING_DATE_REQUEST(state, payload) {
state.loadingDateRequest = payload;
},
LOADING_CUSTOMER_SINGLE(state, payload) {
state.loadingCustomerSingle = payload;
},
LOADING_POINT_CASH(state, payload) {
state.loadingPointCash = payload;
},
LOADING_USER_POINT(state, payload) {
state.loadingUserPoint = payload;
},
LOADING_USER_POINT_PAYMENT(state, payload) {
state.loadingUserPointPayment = payload;
}
};
export default {
namespaced: true,
state,
mutations,
actions,
}
+85
View File
@@ -0,0 +1,85 @@
import axios from '@/axios'
const state = {
collectionSingle: undefined,
error: undefined,
loading: false,
users: [],
dataSuccess:undefined,
price:[]
};
const actions = {
async save({commit}, payload) {
try {
commit('LOADING', true);
if (payload.id) {
await axios({
method: 'put',
url: 'admin/price/'+payload.id,
data: {...payload}
})
} else {
await axios({
method: 'post',
url: 'admin/price',
data: payload
})
}
} catch (e) {
console.log('error has')
commit('ERROR', e);
throw e
} finally {
commit('LOADING', false);
}
},
async priceId({commit}, id) {
try {
commit('LOADING', true);
let res = await axios.get('admin/price/' + id);
console.log(res.data, 'res-attr');
commit('PRICE_ID', res.data);
} catch (e) {
commit('ERROR', e);
throw e;
} finally {
commit('LOADING', false);
}
},
};
const mutations = {
UPDATE_PRICE(state, payload) {
state.priceEdit = state.priceEdit.map(price => {
if (price.id === payload.id) {
return Object.assign({}, price, payload.data)
}
return price
})
console.log(state.adv, 'users data kole')
},
INIT(state, data) {
state.price = data;
},
LOADING(state, payload) {
state.loading = payload;
},
PRICE_ID(state, payload) {
state.collectionSingle = payload;
},
DATA_SUCCESS(state,payload){
state.dataSuccess = payload
}
};
export default {
namespaced: true,
state,
mutations,
actions
}
+111
View File
@@ -0,0 +1,111 @@
import _ from 'lodash';
import axios from "@/axios";
const state = {
loading: false,
searchQuery: undefined,
page: 1,
count:0,
rows: []
};
const mutations = {
ADD_ITEM(state, data) {
state.rows.push(data);
},
INJECT(state , {rows , keys}){
state.rows = rows || [];
state.keys = keys || [];
},
LOADING(state, data) {
state.loading = data;
},
PAGE_SET(state, data){
state.page = data;
},
SEARCH_QUERY_SET(state, data){
state.searchQuery = data;
},
FETCH(state, {rows , count, page}){
state.rows = rows;
state.count = count || 0;
state.page = page || 1;
},
EDIT_ROW(state, data) {
if (data.delete) {
state.rows = _.without(state.rows, _.find(state.rows, (item) => item.val == data.row.val));
} else {
state.rows[data.index] = data.row;
}
}
};
const actions = {
async init({commit}){
commit('LOADING', true);
try {
let res = await axios.get('config/statics');
console.log("res ==> " , res);
commit('INJECT' , res.data);
} catch (e) {
} finally {
commit('LOADING', false);
}
},
async removeProduct({commit , dispatch } , {id}){
commit('LOADING', true);
try {
let res = await axios.delete('product/'+id);
dispatch('product/fetch');
} catch (e) {
} finally {
commit('LOADING', false);
}
},
async save({commit ,state}, data) {
commit('LOADING', true);
try {
if(data.id){
const res = await axios.put(`product/${data.id}` , data);
return res;
}else{
const res = await axios.post('product/' , data);
return res;
}
} catch (e) {
} finally {
commit('LOADING', false);
}
},
async fetch({commit ,state}, data) {
commit('LOADING', true);
try {
let {data} = await axios.get('product' , {params:{page:state.page, text_search:state.searchQuery}});
commit('FETCH' , data);
} catch (e) {
} finally {
commit('LOADING', false);
}
},
async activeDeactive({commit ,state}, payload) {
try {
let {data} = await axios.put(`product/variant/${payload.id}` , payload);
} catch (e) {
console.log("e ==> " , e);
} finally {
}
}
};
const getters = {};
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
+100
View File
@@ -0,0 +1,100 @@
/*=========================================================================================
File Name: state.js
Description: Vuex Store - state
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import navbarSearchAndPinList from '@/layouts/components/navbar/navbarSearchAndPinList'
import themeConfig, { colors } from '@/../themeConfig.js'
// /////////////////////////////////////////////
// Helper
// /////////////////////////////////////////////
// *From Auth - Data will be received from auth provider
const userDefaults = {
uid : 0, // From Auth
displayName : 'محسن الیادرانی', // From Auth
about : 'Dessert chocolate cake lemon drops jujubes. Biscuit cupcake ice cream bear claw brownie brownie marshmallow.',
photoURL : require('@/assets/images/portrait/small/avatar-s-11.jpg'), // From Auth
status : 'online',
userRole : 'admin'
}
const userInfoLocalStorage = JSON.parse(localStorage.getItem('userInfo')) || {}
// Set default values for active-user
// More data can be added by auth provider or other plugins/packages
const getUserInfo = () => {
const userInfo = {}
// Update property in user
Object.keys(userDefaults).forEach((key) => {
// If property is defined in localStorage => Use that
userInfo[key] = userInfoLocalStorage[key] ? userInfoLocalStorage[key] : userDefaults[key]
})
// Include properties from localStorage
Object.keys(userInfoLocalStorage).forEach((key) => {
if (userInfo[key] === undefined && userInfoLocalStorage[key] !== null) userInfo[key] = userInfoLocalStorage[key]
})
return userInfo
}
// Check if device is touch device
// This is used to remove perfect scrollbar from touch devices
// Using Dynamic components
const is_touch_device = () => {
const prefixes = ' -webkit- -moz- -o- -ms- '.split(' ')
const mq = function (query) {
return window.matchMedia(query).matches
}
if ('ontouchstart' in window || window.DocumentTouch) {
return true
}
// include the 'heartz' as a way to have a non matching MQ to help terminate the join
// https://git.io/vznFH
const query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join('')
return mq(query)
}
// /////////////////////////////////////////////
// State
// /////////////////////////////////////////////
const state = {
AppActiveUser : getUserInfo(),
bodyOverlay : false,
isVerticalNavMenuActive : true,
is_touch_device : is_touch_device(),
mainLayoutType : themeConfig.mainLayoutType || 'vertical',
navbarSearchAndPinList,
reduceButton : themeConfig.sidebarCollapsed,
verticalNavMenuWidth : 'default',
verticalNavMenuItemsMin : false,
scrollY : 0,
starredPages : navbarSearchAndPinList['pages'].data.filter((page) => page.is_bookmarked),
theme : themeConfig.theme || 'light',
themePrimaryColor : colors.primary,
// Can be used to get current window with
// Note: Above breakpoint state is for internal use of sidebar & navbar component
windowWidth: null,
collection: {},
collectionEdit:[],
userEdit:[],
loading: false,
error: undefined,
}
export default state
+76
View File
@@ -0,0 +1,76 @@
/*=========================================================================================
File Name: store.js
Description: Vuex store
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import getters from './getters'
import mutations from './mutations'
import actions from './actions'
Vue.use(Vuex)
// import moduleTodo from './todo/moduleTodo.js'
// import moduleCalendar from './calendar/moduleCalendar.js'
// import moduleChat from './chat/moduleChat.js'
// import moduleEmail from './email/moduleEmail.js'
import moduleAuth from './auth/moduleAuth.js'
import moduleECommerce from './eCommerce/moduleECommerce.js'
import moduleConst from './manage/const.js'
import moduleCategory from './category/index'
import moduleVariant from './variant/index'
import variantAdd from './variant/variant'
import moduleProduct from './product/index'
import moduleOrder from './order/index'
import moduleCustomer from './customer/customer'
import collection from './collection/collection'
import user from './user/user'
import blog from './blog/blog'
import adpackage from './adpackage/adpackage'
import shop from './store/shop'
import access from './access/access'
import adv from './advertisng/advertising'
import advModel from './adv/adv'
import badadv from './badadv/badadv'
import points from './point/points'
import transaction from './transaction/transaction'
import price from './price/price'
export default new Vuex.Store({
getters,
mutations,
state,
actions,
modules: {
auth: moduleAuth,
const: moduleConst,
category: moduleCategory,
variant: moduleVariant,
product: moduleProduct,
order: moduleOrder,
customer: moduleCustomer ,
eCommerce: moduleECommerce,
collection:collection,
user:user,
blog:blog,
adpackage:adpackage,
shop:shop,
access:access,
adv:adv,
badadv:badadv,
points:points,
transaction:transaction,
price:price,
variantAdd:variantAdd,
advModel:advModel
},
strict: process.env.NODE_ENV !== 'production'
})
+113
View File
@@ -0,0 +1,113 @@
import axios from "@/axios";
const state = {
loading: false,
storeOneId:undefined,
edit:[]
};
const actions = {
async ok({commit}, payload) {
try{
commit('LOADING', true);
await axios.put('admin/store/'+payload.id,{data:payload,op:'sts'})
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING', false);
}
},
async save({commit}, payload) {
try{
commit('LOADING', true);
await axios.post('admin/store',{data:payload})
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING', false);
}
},
async get({commit},id) {
try {
commit('LOADING', true);
let res = await axios.get('admin/store/'+id);
console.log(res.data,'res data')
commit('STORE_ID', res.data);
} catch (e) {
console.log(e)
throw e;
} finally {
commit('LOADING', false);
}
},
async put({commit}, payload) {
try{
commit('LOADING', true);
await axios.put('admin/store/'+payload.id, {id:payload.id,data:payload.data,op:'update'})
commit('UPDATE_STORE', payload);
}catch (e) {
commit('ERROR', e);
} finally {
commit('LOADING', false);
}
},
async submitDateLine({commit}, payload) {
try{
commit('LOADING', true);
const save = await axios.post('admin/store/chart/date',payload)
return save
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING', false);
}
},
async submitGrowthStore({commit}, payload) {
try{
commit('LOADING', true);
const growth = await axios.post('admin/store/chart/create',payload)
return growth
}
catch (e) {
this.$ntSetError()
}
finally {
commit('LOADING', false);
}
},
};
const mutations = {
LOADING(state, payload) {
state.loading = payload;
},
STORE_ID(state,payload){
state.storeOneId = payload
},
UPDATE_STORE(state, payload) {
state.edit = state.edit.map(edit => {
if (edit.id === payload.id) {
return Object.assign({},edit, payload.data)
}
return edit
})
}
};
export default {
namespaced: true,
state,
mutations,
actions,
}
+22
View File
@@ -0,0 +1,22 @@
/*=========================================================================================
File Name: moduleTodo.js
Description: Todo Module
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import state from './moduleTodoState.js'
import mutations from './moduleTodoMutations.js'
import actions from './moduleTodoActions.js'
import getters from './moduleTodoGetters.js'
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
+59
View File
@@ -0,0 +1,59 @@
/*=========================================================================================
File Name: moduleTodoActions.js
Description: Todo Module Actions
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import axios from '@/axios.js'
export default {
setTodoSearchQuery ({ commit }, query) {
commit('SET_TODO_SEARCH_QUERY', query)
},
fetchTasks ({ commit }, payload) {
return new Promise((resolve, reject) => {
axios.get('/api/apps/todo/tasks', { params: {filter: payload.filter} })
.then((response) => {
commit('SET_TASKS', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
fetchTags ({ commit }) {
return new Promise((resolve, reject) => {
axios.get('/api/apps/todo/tags')
.then((response) => {
commit('SET_TAGS', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
addTask ({ commit }, task) {
return new Promise((resolve, reject) => {
axios.post('/api/apps/todo/tasks/', {task})
.then((response) => {
commit('ADD_TASK', Object.assign(task, {id: response.data.id}))
resolve(response)
})
.catch((error) => { reject(error) })
})
},
updateTask ({ commit }, task) {
return new Promise((resolve, reject) => {
axios.post(`/api/apps/todo/task/${task.id}`, {task})
.then((response) => {
commit('UPDATE_TASK', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
}
}
+29
View File
@@ -0,0 +1,29 @@
/*=========================================================================================
File Name: moduleTodoGetters.js
Description: Todo Module Getters
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
queriedTasks: state => state.tasks.filter((task) => {
let isItemOfCurrentFilter = false
if (
(state.todoFilter === 'all' && !task.isTrashed)
|| (state.todoFilter === 'important' && !task.isTrashed && task.isImportant)
|| (state.todoFilter === 'starred' && !task.isTrashed && task.isStarred)
|| (state.todoFilter === 'completed' && !task.isTrashed && task.isCompleted)
|| (state.todoFilter === 'trashed' && task.isTrashed)
|| (task.tags.includes(state.todoFilter))
) { isItemOfCurrentFilter = true }
return isItemOfCurrentFilter && (task.title.toLowerCase().includes(state.todoSearchQuery.toLowerCase()) || task.desc.toLowerCase().includes(state.todoSearchQuery.toLowerCase()))
}),
getTask: state => taskId => state.tasks.find((task) => task.id === taskId)
// getTodosBySection: state => (sectionId) => state.todoArray.filter((task) => task.sectionId == sectionId),
}
+33
View File
@@ -0,0 +1,33 @@
/*=========================================================================================
File Name: moduleTodoMutations.js
Description: Todo Module Mutations
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
SET_TODO_SEARCH_QUERY (state, query) {
state.todoSearchQuery = query
},
UPDATE_TODO_FILTER (state, filter) {
state.todoFilter = filter
},
// API
SET_TASKS (state, tasks) {
state.tasks = tasks
},
SET_TAGS (state, tags) {
state.taskTags = tags
},
ADD_TASK (state, task) {
state.tasks.unshift(task)
},
UPDATE_TASK (state, task) {
const taskIndex = state.tasks.findIndex((t) => t.id === task.id)
Object.assign(state.tasks[taskIndex], task)
}
}
+16
View File
@@ -0,0 +1,16 @@
/*=========================================================================================
File Name: moduleTodoState.js
Description: Todo Module State
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
tasks: [],
taskTags: [],
todoSearchQuery: '',
todoFilter: null
}
+167
View File
@@ -0,0 +1,167 @@
import axios from '@/axios'
const state = {
loadingDepositPercentages:false,
loadingDepositAmount:false,
loadingDepositAmountIp:false,
loadingDepositAmountCity:false,
loadingDepositAmountIpCity:false,
loadingDepositAmountAdv:false,
loadingDepositAmountCa:false,
loadingDepositAmountIpCollection:false,
loadingDepositAmountSort:false,
loadingDepositAmountReturned:false,
};
const actions = {
async DepositPercentages({commit}, payload) {
try {
commit('LOADING_Deposit_Percentages', true);
const {data} = await axios.post('admin/transaction/query/charity',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_Deposit_Percentages', false);
}
},
async DepositAmount({commit}, payload) {
try {
commit('LOADING_Deposit_Amount', true);
const {data} = await axios.post('admin/transaction/query/charity/date',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_Deposit_Amount', false);
}
},
async DepositAmountIp({commit}, payload) {
try {
commit('LOADING_Deposit_Amount_IP', true);
const {data} = await axios.post('admin/transaction/query/charity/all',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_Deposit_Amount_IP', false);
}
},
async DepositAmountCity({commit}, payload) {
try {
commit('LOADING_Deposit_Amount_CITY', true);
const {data} = await axios.post('admin/transaction/chart/city',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_Deposit_Amount_CITY', false);
}
},
async DepositAmountIpCity({commit}, payload) {
try {
commit('LOADING_Deposit_Amount_IP_CITY', true);
const {data} = await axios.post('admin/transaction/chart/ip/city',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_Deposit_Amount_IP_CITY', false);
}
},
async DepositAmountAdv({commit}, payload) {
try {
commit('LOADING_Deposit_Amount_ADV', true);
const {data} = await axios.post('admin/transaction/chart/adv',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_Deposit_Amount_ADV', false);
}
},
async DepositAmountCa({commit}, payload) {
try {
commit('LOADING_Deposit_Amount_CA', true);
const {data} = await axios.post('admin/transaction/chart/ip/ca',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_Deposit_Amount_CA', false);
}
},
async DepositAmountIpCollection({commit}, payload) {
try {
commit('LOADING_Deposit_Amount_IP_COLLECTION', true);
const {data} = await axios.post('admin/transaction/chart/ip/collection',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_Deposit_Amount_IP_COLLECTION', false);
}
},
async DepositAmountSort({commit}, payload) {
try {
commit('LOADING_Deposit_Amount_SORT', true);
const {data} = await axios.post('admin/transaction/ip/payment',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_Deposit_Amount_SORT', false);
}
},
async DepositAmountReturned({commit}, payload) {
try {
commit('LOADING_Deposit_Amount_RETUNED', true);
const {data} = await axios.post('admin/transaction/ip/refund',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_Deposit_Amount_RETUNED', false);
}
},
};
const mutations = {
LOADING_Deposit_Percentages(state,payload){
state.loadingDepositPercentages = payload;
},
LOADING_Deposit_Amount(state,payload){
state.loadingDepositAmount = payload;
},
LOADING_Deposit_Amount_IP(state,payload){
state.loadingDepositAmountIp = payload;
},
LOADING_Deposit_Amount_CITY(state,payload){
state.loadingDepositAmountCity = payload;
},
LOADING_Deposit_Amount_IP_CITY(state,payload){
state.loadingDepositAmountIpCity = payload;
},
LOADING_Deposit_Amount_ADV(state,payload){
state.loadingDepositAmountAdv = payload;
},
LOADING_Deposit_Amount_CA(state,payload){
state.loadingDepositAmountCa = payload;
},
LOADING_Deposit_Amount_IP_COLLECTION(state,payload){
state.loadingDepositAmountIpCollection = payload;
},
LOADING_Deposit_Amount_SORT(state,payload){
state.loadingDepositAmountSort = payload;
},
LOADING_Deposit_Amount_RETUNED(state,payload){
state.loadingDepositAmountReturned = payload;
},
};
export default {
namespaced: true,
state,
mutations,
actions
}
@@ -0,0 +1,24 @@
/*=========================================================================================
File Name: moduleUserManagement.js
Description: Calendar Module
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import state from './moduleUserManagementState.js'
import mutations from './moduleUserManagementMutations.js'
import actions from './moduleUserManagementActions.js'
import getters from './moduleUserManagementGetters.js'
export default {
isRegistered: false,
namespaced: true,
state,
mutations,
actions,
getters
}
@@ -0,0 +1,52 @@
/*=========================================================================================
File Name: moduleCalendarActions.js
Description: Calendar Module Actions
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
import axios from '@/axios.js'
export default {
// addItem({ commit }, item) {
// return new Promise((resolve, reject) => {
// axios.post("/api/data-list/products/", {item: item})
// .then((response) => {
// commit('ADD_ITEM', Object.assign(item, {id: response.data.id}))
// resolve(response)
// })
// .catch((error) => { reject(error) })
// })
// },
fetchUsers ({ commit }) {
return new Promise((resolve, reject) => {
axios.get('/api/user-management/users')
.then((response) => {
commit('SET_USERS', response.data)
resolve(response)
})
.catch((error) => { reject(error) })
})
},
fetchUser (context, userId) {
return new Promise((resolve, reject) => {
axios.get(`/api/user-management/users/${userId}`)
.then((response) => {
resolve(response)
})
.catch((error) => { reject(error) })
})
},
removeRecord ({ commit }, userId) {
return new Promise((resolve, reject) => {
axios.delete(`/api/user-management/users/${userId}`)
.then((response) => {
commit('REMOVE_RECORD', userId)
resolve(response)
})
.catch((error) => { reject(error) })
})
}
}
@@ -0,0 +1,11 @@
/*=========================================================================================
File Name: moduleCalendarGetters.js
Description: Calendar Module Getters
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {}
@@ -0,0 +1,19 @@
/*=========================================================================================
File Name: moduleCalendarMutations.js
Description: Calendar Module Mutations
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
SET_USERS (state, users) {
state.users = users
},
REMOVE_RECORD (state, itemId) {
const userIndex = state.users.findIndex((u) => u.id === itemId)
state.users.splice(userIndex, 1)
}
}
@@ -0,0 +1,12 @@
/*=========================================================================================
File Name: moduleCalendarState.js
Description: Calendar Module State
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
export default {
users: []
}
+284
View File
@@ -0,0 +1,284 @@
import axios from '@/axios'
const state = {
users: [],
error: undefined,
loading:false,
loadingWithUser:false,
loadingWithUserPeak:false,
loadingAvgSupervisionUser:false,
loadingChartPeak:false,
loadingDeterminationAvg:false,
loadingSingleUser:false,
loadingVisionDateUser:false,
loadingChartSingleUser:false,
loadingChartAvgCustomer:false,
loadingChartCountSuperVision:false,
loadingSortUser:false,
userEdit:[],
userList:[],
getDataSuccess:undefined,
collection:{},
deleteItem:false
};
const actions = {
async SubmitUser({commit}, payload) {
try {
commit('LOADING', true);
if(payload.id){
await axios({
method: 'put',
url: 'admin/user/'+payload.id,
data: {id:payload.id,data:payload.data,op:'update'}
})
}else{
await axios({
method: 'post',
url: 'admin/user',
data: {data:payload}
})
}
} catch (e) {
commit('ERROR', e);
throw e
} finally {
commit('LOADING', false);
}
},
async UserId({commit},id) {
try {
commit('LOADING', true);
let res = await axios.get('admin/user/user/'+id);
console.log(res.data,'res-collection')
commit('USERS_ID', res.data);
} catch (e) {
commit('ERROR', e);
throw e;
} finally {
commit('LOADING', false);
}
},
async editUsers({commit}, payload) {
try{
commit('LOADING', true);
await axios({
method: 'put',
url: 'admin/user/'+payload.id,
data: {id:payload.id,data:payload.data,op:'update'}
}).then((res)=>{
commit('SUCCESS_DATA',res.data);
commit('UPDATE_USERS', payload);
})
}catch (e) {
commit('ERROR', e);
throw e
} finally {
commit('LOADING', false);
}
},
async avgWithUser({commit}, payload) {
try {
commit('LOADING_WITH_USER', true);
const {data} = await axios.post('admin/user/query/avg',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_WITH_USER', false);
}
},
async peakWithUser({commit}, payload) {
try {
commit('LOADING_WITH_USER_PEAK', true);
const {data} = await axios.post('admin/user/query/peak',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_WITH_USER_PEAK', false);
}
},
async avgSupervisionUser({commit}, payload) {
try {
commit('LOADING_AVG_SUPER_VISION_USER', true);
const {data} = await axios.post('admin/user/query/users',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_AVG_SUPER_VISION_USER', false);
}
},
async DeterminationPeak({commit}, payload) {
try {
commit('LOADING_CHART_PEAK', true);
const {data} = await axios.post('admin/user/chart/peak',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_CHART_PEAK', false);
}
},
async DeterminationAvg({commit}, payload) {
try {
commit('LOADING_Determination_AVG', true);
const {data} = await axios.post('admin/user/chart/avg',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_Determination_AVG', false);
}
},
async singleUser({commit}, payload) {
try {
commit('LOADING_SINGLE_USER', true);
const {data} = await axios.post('admin/user/chart/adv',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_SINGLE_USER', false);
}
},
async superVisionDateUser({commit}, payload) {
try {
commit('LOADING_VISION_DATE_USER', true);
const {data} = await axios.post('admin/user/chart/count',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_VISION_DATE_USER', false);
}
},
async chartSingleUser({commit}, payload) {
try {
commit('LOADING_CHART_SINGLE_USER', true);
const {data} = await axios.post('admin/user/chart/user',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_CHART_SINGLE_USER', false);
}
},
async chartCountSuperVision({commit}, payload) {
try {
commit('LOADING_CHART_SUPER_VISION', true);
const {data} = await axios.post('admin/user/chart/date',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_CHART_SUPER_VISION', false);
}
},
async avgCustomers({commit}, payload) {
try {
commit('LOADING_CHART_AVG_CUSTOMER', true);
const {data} = await axios.post('admin/user/chart/customer',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_CHART_AVG_CUSTOMER', false);
}
},
async SortUser({commit}, payload) {
try {
commit('LOADING_SORT_USER', true);
const {data} = await axios.post('admin/user/query/collection',payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_SORT_USER', false);
}
},
async deleteUser({commit},payload) {
try {
commit('LOADING_DELETE', true);
console.log(payload,'id');
const {data} = await axios.delete('admin/user/'+ payload);
return data;
} catch (e) {
throw e;
} finally {
commit('LOADING_DELETE', false);
}
}
};
const mutations = {
INIT(state, data) {
state.collection = data;
},
LOADING(state,payload){
state.loading = payload;
},
LOADING_WITH_USER(state,payload){
state.loadingWithUser = payload;
},
LOADING_WITH_USER_PEAK(state,payload){
state.loadingWithUserPeak = payload;
},
LOADING_AVG_SUPER_VISION_USER(state,payload){
state.loadingAvgSupervisionUser = payload;
},
LOADING_CHART_PEAK(state,payload){
state.loadingChartPeak = payload;
},
LOADING_Determination_AVG(state,payload){
state.loadingDeterminationAvg = payload;
},
LOADING_SINGLE_USER(state,payload){
state.loadingSingleUser = payload;
},
LOADING_VISION_DATE_USER(state,payload){
state.loadingVisionDateUser = payload;
},
LOADING_CHART_SINGLE_USER(state,payload){
state.loadingChartSingleUser = payload;
},
LOADING_CHART_AVG_CUSTOMER(state,payload){
state.loadingChartAvgCustomer = payload;
},
LOADING_CHART_SUPER_VISION(state,payload){
state.loadingChartCountSuperVision = payload;
},
LOADING_SORT_USER(state,payload){
state.loadingSortUser = payload;
},
USERS_ID(state,payload){
state.users = payload;
},
SUCCESS_DATA(state, payload) {
state.getDataSuccess = payload;
},
LOADING_DELETE(state, payload) {
state.deleteItem = payload;
},
UPDATE_USERS(state, payload) {
state.userEdit = state.userEdit.map(user => {
if (user.id === payload.id) {
return Object.assign({},user, payload.data)
}
return user
})
}
};
export default {
namespaced: true,
state,
mutations,
actions
}
+110
View File
@@ -0,0 +1,110 @@
import _ from 'lodash';
import axios from "@/axios";
const state = {
loading: false,
getId:undefined,
rows: [
{id: 1, key: 'ut', val: 'نوع اول'}
]
};
const mutations = {
ADD_ITEM(state, data) {
state.rows.push(data);
},
INJECT(state, {rows, keys}) {
state.rows = rows || [];
state.keys = keys || [];
},
LOADING(state, data) {
state.loading = data;
},
GET_ONE_BY_ID(state, data) {
state.getId = data;
},
EDIT_ROW(state, data) {
if (data.delete) {
state.rows = _.without(state.rows, _.find(state.rows, (item) => item.val == data.row.val));
} else {
state.rows[data.index] = data.row;
}
},
};
const actions = {
async init({commit}) {
commit('LOADING', true);
try {
let res = await axios.get('config/statics');
commit('INJECT', res.data);
} catch (e) {
} finally {
commit('LOADING', false);
}
},
async save({commit, state}, data) {
commit('LOADING', true);
try {
if (data.id) {
const res = await axios.put(`product/variant/${data.id}`, data);
} else {
const res = await axios.post('product/variant', data);
}
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async submitGroup({commit}, payload) {
commit('LOADING', true);
try {
await axios.post('admin/group', {data:payload});
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async editGroup({commit}, payload) {
commit('LOADING', true);
try {
await axios.put('admin/group/'+payload.id,{id:payload.id,data:payload.data});
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async deleteItem({commit}, id) {
try {
commit('LOADING', true);
await axios.delete('admin/group/'+id)
} catch (e) {
throw e;
} finally {
commit('LOADING', false);
}
},
async getOneById({commit},id) {
try {
commit('LOADING', true);
const {data} = await axios.get('admin/group/' + id );
commit('GET_ONE_BY_ID',data);
} catch (e) {
} finally {
commit('LOADING', false);
}
}
};
const getters = {};
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
+91
View File
@@ -0,0 +1,91 @@
import axios from '@/axios'
const state = {
collectionSingle: undefined,
error: undefined,
loading: false,
users: []
};
const actions = {
async save({commit}, payload) {
try {
commit('LOADING', true);
if (payload.id) {
await axios({
method: 'put',
url: `admin/attribute/${payload.id}`,
data: payload
})
} else {
const {data} = await axios({
method: 'post',
url: 'admin/attribute',
data: {data:payload}
})
return data
}
} catch (e) {
console.log('error has')
commit('ERROR', e);
throw e
} finally {
commit('LOADING', false);
}
},
async variantId({commit}, id) {
try {
commit('LOADING', true);
let res = await axios.get('admin/attribute/' + id);
console.log(res.data, 'res-attr')
commit('VARIANT_ID', res.data);
} catch (e) {
commit('ERROR', e);
throw e;
} finally {
commit('LOADING', false);
}
},
};
const mutations = {
UPDATE_VARIANT(state, payload) {
state.variantEdit = state.variantEdit.map(variant => {
if (variant.id === payload.id) {
return Object.assign({}, variant, payload.data)
}
return variant
})
console.log(state.variant, 'users data kole')
},
LOADING(state, payload) {
state.loading = payload;
},
VARIANT_ID(state, payload) {
state.collectionSingle = payload;
},
DELETE_ROW(state, payload) {
state.collectionSingle.values.splice(payload,1)
},
SET_ROW_SOUND(state,payload){
if (!payload.id) {
state.collectionSingle.values.push(payload.title);
} else {
const ind = state.collectionSingle.values.indexOf(state.collectionSingle.values.find((item) => item.id == payload.id));
if (ind > -1) {
state.collectionSingle.values[ind] = Object.assign({}, payload)
}
}
},
};
export default {
namespaced: true,
state,
mutations,
actions
}