Fix bug and update
This commit is contained in:
@@ -2,6 +2,9 @@
|
|||||||
<aside class="mobile-menu">
|
<aside class="mobile-menu">
|
||||||
<nav class="body">
|
<nav class="body">
|
||||||
<ul>
|
<ul>
|
||||||
|
<nuxt-link :to="{ name: 'announcements' }" tag="li">
|
||||||
|
<a>اطلاعیه ها </a>
|
||||||
|
</nuxt-link>
|
||||||
<nuxt-link :to="{ name: 'index' }" exact tag="li">
|
<nuxt-link :to="{ name: 'index' }" exact tag="li">
|
||||||
<a>استعلام گارانتی</a>
|
<a>استعلام گارانتی</a>
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
</nav>
|
</nav>
|
||||||
<nav class="col-8 d-none d-lg-block">
|
<nav class="col-8 d-none d-lg-block">
|
||||||
<ul class="links">
|
<ul class="links">
|
||||||
|
<nuxt-link :to="{ name: 'announcements' }" tag="li">
|
||||||
|
<a>اطلاعیه ها </a>
|
||||||
|
</nuxt-link>
|
||||||
<li
|
<li
|
||||||
class="dropDown-container help"
|
class="dropDown-container help"
|
||||||
:class="helpDropDownActiveClass && 'active'"
|
:class="helpDropDownActiveClass && 'active'"
|
||||||
@@ -87,6 +90,7 @@
|
|||||||
import WS_User from '@/mixins/WS_User'
|
import WS_User from '@/mixins/WS_User'
|
||||||
import WS_Agent from '@/mixins/WS_Agent'
|
import WS_Agent from '@/mixins/WS_Agent'
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
mixins: [WS_User, WS_Agent],
|
mixins: [WS_User, WS_Agent],
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
+3
-1
@@ -20,10 +20,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import WS_Admin from '@/mixins/WS_Admin'
|
|
||||||
|
|
||||||
|
import WS_Admin from '@/mixins/WS_Admin'
|
||||||
export default {
|
export default {
|
||||||
name: 'AdminLayout',
|
name: 'AdminLayout',
|
||||||
|
|
||||||
mixins: [WS_Admin],
|
mixins: [WS_Admin],
|
||||||
middleware: ['auth-admin', 'permissions'],
|
middleware: ['auth-admin', 'permissions'],
|
||||||
data() {
|
data() {
|
||||||
@@ -31,6 +32,7 @@ export default {
|
|||||||
subHeaderContent: null
|
subHeaderContent: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
head() {
|
head() {
|
||||||
return {
|
return {
|
||||||
htmlAttrs: {
|
htmlAttrs: {
|
||||||
|
|||||||
@@ -10,8 +10,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DefaultLayout',
|
name: 'DefaultLayout',
|
||||||
|
|
||||||
head() {
|
head() {
|
||||||
return {
|
return {
|
||||||
htmlAttrs: {
|
htmlAttrs: {
|
||||||
|
|||||||
+7
-2
@@ -62,7 +62,12 @@ export default {
|
|||||||
],
|
],
|
||||||
|
|
||||||
// Auto import components (https://go.nuxtjs.dev/config-components)
|
// Auto import components (https://go.nuxtjs.dev/config-components)
|
||||||
components: true,
|
components: [
|
||||||
|
{
|
||||||
|
path: '~/components',
|
||||||
|
pathPrefix: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
// Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
|
// Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
|
||||||
buildModules: ['@nuxtjs/pwa'],
|
buildModules: ['@nuxtjs/pwa'],
|
||||||
@@ -102,7 +107,7 @@ export default {
|
|||||||
proxy: true
|
proxy: true
|
||||||
},
|
},
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': { target: `http://127.0.0.1:${isProduction ? NuxtPort : DevServerPort}` }
|
'/api': { target: `http://127.0.0.1:${isProduction ? NuxtPort : DevServerPort}` }
|
||||||
},
|
},
|
||||||
// Build Configuration (https://go.nuxtjs.dev/config-build)
|
// Build Configuration (https://go.nuxtjs.dev/config-build)
|
||||||
build: {
|
build: {
|
||||||
|
|||||||
Generated
+12209
-15022
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -21,7 +21,7 @@
|
|||||||
"@coreui/vue": "^3.1.2",
|
"@coreui/vue": "^3.1.2",
|
||||||
"@coreui/vue-chartjs": "^1.0.5",
|
"@coreui/vue-chartjs": "^1.0.5",
|
||||||
"@nuxtjs/auth": "^4.9.1",
|
"@nuxtjs/auth": "^4.9.1",
|
||||||
"@nuxtjs/auth-next": "5.0.0-1610375166.4d8db9d",
|
"@nuxtjs/auth-next": "5.0.0-1667386184.dfbbb54",
|
||||||
"@nuxtjs/axios": "^5.12.2",
|
"@nuxtjs/axios": "^5.12.2",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"ckeditor4-vue": "^1.2.0",
|
"ckeditor4-vue": "^1.2.0",
|
||||||
@@ -38,7 +38,9 @@
|
|||||||
"moment-jalaali": "^0.9.2",
|
"moment-jalaali": "^0.9.2",
|
||||||
"mongoose": "^5.11.8",
|
"mongoose": "^5.11.8",
|
||||||
"mongoose-paginate-v2": "^1.3.13",
|
"mongoose-paginate-v2": "^1.3.13",
|
||||||
|
"node-gyp": "^10.0.1",
|
||||||
"nodemailer": "^6.4.17",
|
"nodemailer": "^6.4.17",
|
||||||
|
"nodemon": "^3.0.1",
|
||||||
"nuxt": "^2.14.6",
|
"nuxt": "^2.14.6",
|
||||||
"read-excel-file": "^5.2.2",
|
"read-excel-file": "^5.2.2",
|
||||||
"socket.io": "^4.4.1",
|
"socket.io": "^4.4.1",
|
||||||
|
|||||||
@@ -2,13 +2,27 @@
|
|||||||
<user-dashboard-container page-class="announcements" panel-title="اعلانات">
|
<user-dashboard-container page-class="announcements" panel-title="اعلانات">
|
||||||
<div v-for="item in userAnnouncements" :key="item._id" class="item" :class="!item.seen && 'unread'">
|
<div v-for="item in userAnnouncements" :key="item._id" class="item" :class="!item.seen && 'unread'">
|
||||||
<el-collapse :key="item._id + 'co_parent'" accordion @change="seeAnnouncement">
|
<el-collapse :key="item._id + 'co_parent'" accordion @change="seeAnnouncement">
|
||||||
<el-collapse-item :key="item._id + 'co_item'" :name="item._id">
|
<el-collapse-item :key="item._id + 'co_item'" :name="item._id" >
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
<h3>{{ item.title }}</h3>
|
<h3>{{ item.title }}</h3>
|
||||||
</template>
|
</template>
|
||||||
<div>
|
<div v-if="!item.image" class="col-12">
|
||||||
<p>{{ item.caption }}</p>
|
<p>{{ item.caption }}</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div v-if="item.image" class="row">
|
||||||
|
<div class="col-md-6 col-sm-12">
|
||||||
|
<p>{{ item.caption }}</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 col-sm-12">
|
||||||
|
<div class="fr-image">
|
||||||
|
<img :src="'/uploads/images/announcement/'+item.image" alt="">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
</div>
|
</div>
|
||||||
@@ -37,3 +51,16 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.fr-image{
|
||||||
|
width: 17rem;
|
||||||
|
height: 11rem;
|
||||||
|
margin: auto;
|
||||||
|
img{
|
||||||
|
width: 100%;
|
||||||
|
height:100%;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: .5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -14,23 +14,28 @@
|
|||||||
<h6>متن اعلان:</h6>
|
<h6>متن اعلان:</h6>
|
||||||
<el-divider></el-divider>
|
<el-divider></el-divider>
|
||||||
<CForm>
|
<CForm>
|
||||||
<CInput
|
<CInput v-model="announcement.title" label="عنوان" horizontal :class="validation.title && 'err'"
|
||||||
v-model="announcement.title"
|
:disabled="!isNew" :description="validation.title && validation.title.msg" />
|
||||||
label="عنوان"
|
<CTextarea v-model="announcement.caption" label="متن" horizontal rows="5"
|
||||||
horizontal
|
:class="validation.caption && 'err'" :disabled="!isNew"
|
||||||
:class="validation.title && 'err'"
|
:description="validation.caption && validation.caption.msg" />
|
||||||
:disabled="!isNew"
|
|
||||||
:description="validation.title && validation.title.msg"
|
<div class="row">
|
||||||
/>
|
<div class="col-12">
|
||||||
<CTextarea
|
<label class="fl-r"> تصویر : </label>
|
||||||
v-model="announcement.caption"
|
<label for="file" class="btn-upload">آپلود تصویر</label>
|
||||||
label="متن"
|
<input id="file" ref="myFiles" style="display: none;" type="file" @change="setData" />
|
||||||
horizontal
|
</div>
|
||||||
rows="5"
|
<div v-if="type === 'user'" class="col-12 mt-4 mr-3">
|
||||||
:class="validation.caption && 'err'"
|
<input id="flexCheckDefault" v-model="announcement.publicx" class="form-check-input" type="checkbox" />
|
||||||
:disabled="!isNew"
|
<label class="form-check-label" for="flexCheckDefault">
|
||||||
:description="validation.caption && validation.caption.msg"
|
عمومی
|
||||||
/>
|
</label>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</CForm>
|
</CForm>
|
||||||
<el-divider></el-divider>
|
<el-divider></el-divider>
|
||||||
<h6>تاریخ منقضی شدن اعلان:</h6>
|
<h6>تاریخ منقضی شدن اعلان:</h6>
|
||||||
@@ -40,15 +45,8 @@
|
|||||||
<p v-if="type === 'agent'" class="mb-4" style="font-size: 12px; color: gray">
|
<p v-if="type === 'agent'" class="mb-4" style="font-size: 12px; color: gray">
|
||||||
*زمانی که اعلان منقضی شود از لیست حذف نخواهد شد و فقط در پنل نمایندگان قابل مشاهده نخواهد بود.
|
*زمانی که اعلان منقضی شود از لیست حذف نخواهد شد و فقط در پنل نمایندگان قابل مشاهده نخواهد بود.
|
||||||
</p>
|
</p>
|
||||||
<persian-date-picker
|
<persian-date-picker v-model="expireDate" display-format="jYYYY/jMM/jDD" :min="today" format="x"
|
||||||
v-model="expireDate"
|
:disabled="!isNew" placeholder="تاریخ را انتخاب کنید" color="#065495" />
|
||||||
display-format="jYYYY/jMM/jDD"
|
|
||||||
:min="today"
|
|
||||||
format="x"
|
|
||||||
:disabled="!isNew"
|
|
||||||
placeholder="تاریخ را انتخاب کنید"
|
|
||||||
color="#065495"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<p v-if="validation.expireDate" style="color: red">{{ validation.expireDate.msg }}</p>
|
<p v-if="validation.expireDate" style="color: red">{{ validation.expireDate.msg }}</p>
|
||||||
</CCardBody>
|
</CCardBody>
|
||||||
@@ -61,12 +59,8 @@
|
|||||||
<h6>وضعیت بازدید اعلان:</h6>
|
<h6>وضعیت بازدید اعلان:</h6>
|
||||||
<el-divider></el-divider>
|
<el-divider></el-divider>
|
||||||
<div class="progressBar">
|
<div class="progressBar">
|
||||||
<el-progress
|
<el-progress :text-inside="true" :stroke-width="26" :color="customColors"
|
||||||
:text-inside="true"
|
:percentage="seenPercentage"></el-progress>
|
||||||
:stroke-width="26"
|
|
||||||
:color="customColors"
|
|
||||||
:percentage="seenPercentage"
|
|
||||||
></el-progress>
|
|
||||||
</div>
|
</div>
|
||||||
</CCardBody>
|
</CCardBody>
|
||||||
</CCard>
|
</CCard>
|
||||||
@@ -76,9 +70,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axiosUploadProcess from '@/mixins/axiosUploadProcess'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AdminAnnouncementDetails',
|
name: 'AdminAnnouncementDetails',
|
||||||
|
mixins: [axiosUploadProcess],
|
||||||
|
|
||||||
layout: 'admin',
|
layout: 'admin',
|
||||||
|
|
||||||
async asyncData({ $axios, params, query, error }) {
|
async asyncData({ $axios, params, query, error }) {
|
||||||
try {
|
try {
|
||||||
if (params.item !== 'new') {
|
if (params.item !== 'new') {
|
||||||
@@ -93,6 +92,8 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
announcement: {
|
announcement: {
|
||||||
|
publicx: false,
|
||||||
|
image: '',
|
||||||
title: '',
|
title: '',
|
||||||
caption: '',
|
caption: '',
|
||||||
expireDate: '',
|
expireDate: '',
|
||||||
@@ -160,10 +161,22 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
setData(event) {
|
||||||
|
|
||||||
|
this.announcement.image = this.$refs.myFiles.files[0];
|
||||||
|
console.log(event)
|
||||||
|
},
|
||||||
post() {
|
post() {
|
||||||
this.validation = {}
|
this.validation = {}
|
||||||
|
const data = new FormData()
|
||||||
|
data.append('title', this.announcement.title)
|
||||||
|
data.append('caption', this.announcement.caption)
|
||||||
|
data.append('isForAgents', this.announcement.isForAgents)
|
||||||
|
data.append('publicx', this.announcement.publicx)
|
||||||
|
data.append('expireDate', this.announcement.expireDate)
|
||||||
|
data.append('image', this.$refs.myFiles.files[0])
|
||||||
this.$axios
|
this.$axios
|
||||||
.post('/api/admin/announcements', this.announcement)
|
.post('/api/admin/announcements', data, this.axiosConfig)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
@@ -223,4 +236,17 @@ export default {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-upload {
|
||||||
|
background-color: cornflowerblue;
|
||||||
|
padding: .5rem 1rem;
|
||||||
|
border-radius: .5rem;
|
||||||
|
cursor: pointer;
|
||||||
|
color: white;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.space {
|
||||||
|
margin: 5rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -120,37 +120,31 @@
|
|||||||
</CCard>
|
</CCard>
|
||||||
</CCol>
|
</CCol>
|
||||||
|
|
||||||
<CCol lg="6">
|
<CCol lg="12">
|
||||||
<CCard>
|
<CCard>
|
||||||
<CCardBody>
|
<CCardBody>
|
||||||
<h6>اطلاعات مشتری:</h6>
|
<h6>اطلاعات مشتری:</h6>
|
||||||
<el-divider></el-divider>
|
<el-divider></el-divider>
|
||||||
<CForm>
|
<CForm class="row" style="justify-content: center;">
|
||||||
<CInput label="نام مشتری" horizontal disabled :value="user.first_name + ' ' + user.last_name" />
|
<CInput v-model="user.first_name" class="col-6 col-sm-12" label="نام" horizontal :value="user.first_name" />
|
||||||
<CInput label="کد ملی" horizontal disabled :value="user.national_code" />
|
<CInput v-model="user.last_name" class="col-6 col-sm-12" label="نام خانوادگی" horizontal :value=" user.last_name" />
|
||||||
<CInput label="شماره تلفن" horizontal disabled :value="user.tel_number" />
|
<CInput v-model="user.national_code" class="col-6 col-sm-12" label="کد ملی" horizontal :value="user.national_code" />
|
||||||
<CInput label="شماره موبایل" horizontal disabled :value="user.mobile_number" />
|
<CInput v-model="user.tel_number" class="col-6 col-sm-12" label="شماره تلفن" horizontal :value="user.tel_number" />
|
||||||
<CInput label="ایمیل" horizontal disabled :value="user.email" />
|
<CInput v-model="user.mobile_number" class="col-6 col-sm-12" label="شماره موبایل" horizontal :value="user.mobile_number" />
|
||||||
<CInput label="نام فروشگاه" horizontal disabled :value="user.store_name" />
|
<CInput v-model="user.email" class="col-6 col-sm-12" label="ایمیل" horizontal :value="user.email" />
|
||||||
|
<CInput v-model="user.store_name" class="col-6 col-sm-12" label="نام فروشگاه" horizontal :value="user.store_name" />
|
||||||
|
<CInput v-model="user.province_name" class="col-6 col-sm-12" label="استان" horizontal :value="user.province_name" />
|
||||||
|
<CInput v-model="user.city_name" class="col-6 col-sm-12" label="شهر" horizontal :value="user.city_name" />
|
||||||
|
<CTextarea v-model="user.address" class="col-6 col-sm-12" label="آدرس" horizontal rows="5" :value="user.address" />
|
||||||
|
<CInput v-model="user.postal_code" class="col-6 col-sm-12" label="کد پستی" horizontal :value="user.postal_code" />
|
||||||
|
|
||||||
|
<CButton color="success" style="width: 10%; " @click="update" >بروزرسانی</CButton>
|
||||||
|
|
||||||
</CForm>
|
</CForm>
|
||||||
</CCardBody>
|
</CCardBody>
|
||||||
</CCard>
|
</CCard>
|
||||||
</CCol>
|
</CCol>
|
||||||
|
|
||||||
<CCol lg="6">
|
|
||||||
<CCard>
|
|
||||||
<CCardBody>
|
|
||||||
<h6>آدرس مشتری</h6>
|
|
||||||
<el-divider></el-divider>
|
|
||||||
<CForm>
|
|
||||||
<CInput label="استان" horizontal disabled :value="user.province_name" />
|
|
||||||
<CInput label="شهر" horizontal disabled :value="user.city_name" />
|
|
||||||
<CTextarea label="آدرس" horizontal disabled rows="5" :value="user.address" />
|
|
||||||
<CInput label="کد پستی" horizontal disabled :value="user.postal_code" />
|
|
||||||
</CForm>
|
|
||||||
</CCardBody>
|
|
||||||
</CCard>
|
|
||||||
</CCol>
|
|
||||||
</CRow>
|
</CRow>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -190,6 +184,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
update(){
|
||||||
|
this.$axios.put(`/api/admin/user/update/${this.user._id}`,this.user).then((res)=>{
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: 'اطالاعات جدید در سیستم ثبت شد'
|
||||||
|
})
|
||||||
|
this.$nuxt.refresh()
|
||||||
|
|
||||||
|
}).catch((err) =>{
|
||||||
|
|
||||||
|
if (err.response.status === 422) this.validation = err.response.data.validation
|
||||||
|
else console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
updateVerityInfo() {
|
updateVerityInfo() {
|
||||||
this.validation = {}
|
this.validation = {}
|
||||||
this.$confirm(
|
this.$confirm(
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export default {
|
|||||||
tickets: tickets.data
|
tickets: tickets.data
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error({ status: 404, message: 'There is a problem here' })
|
error({ status: 404, message: 'There is a problem here', log: err })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<template>
|
||||||
|
<div class="bg-img-in" >
|
||||||
|
<user-dashboard-container page-class="announcements" panel-title="اعلانات" class="panelx">
|
||||||
|
<div v-for="item in userAnnouncements" :key="item._id" class="item" >
|
||||||
|
<el-collapse :key="item._id + 'co_parent'" accordion >
|
||||||
|
<el-collapse-item :key="item._id + 'co_item'" :name="item._id" >
|
||||||
|
<template slot="title">
|
||||||
|
<h3>{{ item.title }}</h3>
|
||||||
|
</template>
|
||||||
|
<div v-if="!item.image" class="col-12">
|
||||||
|
<p>{{ item.caption }}</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div v-if="item.image" class="row">
|
||||||
|
<div class="col-md-6 col-sm-12">
|
||||||
|
<p>{{ item.caption }}</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 col-sm-12">
|
||||||
|
<div class="fr-image">
|
||||||
|
<img :src="'/uploads/images/announcement/'+item.image" alt="">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-collapse-item>
|
||||||
|
</el-collapse>
|
||||||
|
</div>
|
||||||
|
<h3 v-if="!userAnnouncements.length" style="text-align: center; margin-top: 50px">هیچ اعلانی موجود نیست</h3>
|
||||||
|
</user-dashboard-container>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'PublicAnnouncements',
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
userAnnouncements:''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
this.$axios.get('/api/public/announcement').then((res)=>{
|
||||||
|
|
||||||
|
this.userAnnouncements = res.data
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.bg-img-in{
|
||||||
|
background: url(@/static/assets/img/home/bg2.jpg);
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
border-top: groove;
|
||||||
|
}
|
||||||
|
.panelx{
|
||||||
|
margin-top: 20%;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
width: 80% !important;
|
||||||
|
}
|
||||||
|
.fr-image{
|
||||||
|
width: 17rem;
|
||||||
|
height: 11rem;
|
||||||
|
margin: auto;
|
||||||
|
img{
|
||||||
|
width: 100%;
|
||||||
|
height:100%;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: .5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
@@ -114,6 +114,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
checkSerial() {
|
checkSerial() {
|
||||||
// validation
|
// validation
|
||||||
if (this.checkingSerial) {
|
if (this.checkingSerial) {
|
||||||
|
|||||||
@@ -159,7 +159,8 @@ module.exports.updateUserOnArpa = (userData, arpa_businessID, db) => {
|
|||||||
Address: userData.address,
|
Address: userData.address,
|
||||||
PostalCode: userData.postal_code,
|
PostalCode: userData.postal_code,
|
||||||
BusinessCategoryId: BusinessCategoryId(db),
|
BusinessCategoryId: BusinessCategoryId(db),
|
||||||
BusinessID: arpa_businessID
|
BusinessID: arpa_businessID,
|
||||||
|
CheckExistNationalCode: true
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
const EnvirementVariables = {
|
const EnvirementVariables = {
|
||||||
// node envirements
|
// node envirements
|
||||||
isDev: process.env.NODE_ENV === 'devServer',
|
isDev: process.env.NODE_ENV === 'development',
|
||||||
isProduction: process.env.NODE_ENV === 'production',
|
isProduction: process.env.NODE_ENV === 'production',
|
||||||
|
|
||||||
// server ports
|
// server ports
|
||||||
|
|||||||
@@ -33,13 +33,12 @@ module.exports.create = [
|
|||||||
],
|
],
|
||||||
checkValidations(validationResult),
|
checkValidations(validationResult),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { title, caption, expireDate, isForAgents } = req.body
|
const { title, caption, expireDate, isForAgents, publicx } = req.body
|
||||||
const { user_id } = req
|
const { user_id } = req
|
||||||
const data = { title, caption, expireDate, isForAgents, _creator: user_id }
|
const data = { title, caption, expireDate, isForAgents, public: publicx, _creator: user_id }
|
||||||
|
|
||||||
if (req.files?.image) {
|
if (req.files?.image) {
|
||||||
const image = req.files.image
|
const image = req.files.image
|
||||||
const fileName = 'TicketAttachment_' + Date.now() + '.' + image.mimetype.split('/')[1]
|
const fileName = 'announcement' + Date.now() + '.' + image.name
|
||||||
const acceptableFormats = ['png', 'jpg', 'jpeg', 'webp']
|
const acceptableFormats = ['png', 'jpg', 'jpeg', 'webp']
|
||||||
if (!acceptableFormats.includes(image.mimetype.split('/')[1]))
|
if (!acceptableFormats.includes(image.mimetype.split('/')[1]))
|
||||||
return res.status(422).json({ validation: { image: { msg: _faSr.format.image } } })
|
return res.status(422).json({ validation: { image: { msg: _faSr.format.image } } })
|
||||||
@@ -97,6 +96,19 @@ module.exports.getNotifsForUsers = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
module.exports.getNotifsForSite = [
|
||||||
|
async (req, res) => {
|
||||||
|
try {
|
||||||
|
|
||||||
|
const announcements = await Announcement.find({ public:true })
|
||||||
|
|
||||||
|
return res.json(announcements)
|
||||||
|
} catch (e) {
|
||||||
|
return res500(res, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
module.exports.deleteAnnouncement = [
|
module.exports.deleteAnnouncement = [
|
||||||
(req, res) => {
|
(req, res) => {
|
||||||
Announcement.findByIdAndRemove(req.params.id, (err, oldData) => {
|
Announcement.findByIdAndRemove(req.params.id, (err, oldData) => {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ module.exports.getRouteManager = [
|
|||||||
else return res.json(arpaRes.data)
|
else return res.json(arpaRes.data)
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
// console.log('🚀 ~ file: arpaConnectionController.js ~ getRouteManager ~ err', err)
|
console.log('🚀 ~ file: arpaConnectionController.js ~ getRouteManager ~ err', err, "-------",url,db)
|
||||||
return res.status(500).json({ message: 'WebService Error' })
|
return res.status(500).json({ message: 'WebService Error' })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ module.exports.create = [
|
|||||||
|
|
||||||
module.exports.getAll = [
|
module.exports.getAll = [
|
||||||
(req, res) => {
|
(req, res) => {
|
||||||
ContactPageMessage.find({})
|
ContactPageMessage.find({}).sort({created_at:1})
|
||||||
.select('-message')
|
.select('-message')
|
||||||
.then(messages => {
|
.then(messages => {
|
||||||
return res.json(messages)
|
return res.json(messages)
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ module.exports.get_all_tickets_for_admin = [
|
|||||||
(req, res) => {
|
(req, res) => {
|
||||||
TicketConversation.find()
|
TicketConversation.find()
|
||||||
.sort({created_at: -1})
|
.sort({created_at: -1})
|
||||||
|
.limit(400)
|
||||||
.populate('user_id', userIdPopulation)
|
.populate('user_id', userIdPopulation)
|
||||||
.exec((err, data) => {
|
.exec((err, data) => {
|
||||||
if (err) return res500(res, err)
|
if (err) return res500(res, err)
|
||||||
|
|||||||
@@ -1047,6 +1047,198 @@ module.exports.change_panatech_info_by_admin = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
module.exports.update_user_by_admin = [
|
||||||
|
[
|
||||||
|
body('first_name')
|
||||||
|
.notEmpty()
|
||||||
|
.withMessage(_faSr.required.first_name)
|
||||||
|
.bail()
|
||||||
|
.isLength({ min: 2 })
|
||||||
|
.withMessage(_faSr.min_char.min2)
|
||||||
|
.bail()
|
||||||
|
.custom((value, { req }) => {
|
||||||
|
if (removeWhiteSpaces(value).length < 2) return Promise.reject(_faSr.min_char.min2)
|
||||||
|
if (!isPersian(value)) return Promise.reject(new Error('لطفا با حروف فارسی تایپ کنید'))
|
||||||
|
else return true
|
||||||
|
}),
|
||||||
|
|
||||||
|
body('last_name')
|
||||||
|
.notEmpty()
|
||||||
|
.withMessage(_faSr.required.first_name)
|
||||||
|
.bail()
|
||||||
|
.isLength({ min: 2 })
|
||||||
|
.withMessage(_faSr.min_char.min2)
|
||||||
|
.bail()
|
||||||
|
.custom((value, { req }) => {
|
||||||
|
if (removeWhiteSpaces(value).length < 2) return Promise.reject(_faSr.min_char.min2)
|
||||||
|
if (!isPersian(value)) return Promise.reject(new Error('لطفا با حروف فارسی تایپ کنید'))
|
||||||
|
else return true
|
||||||
|
}),
|
||||||
|
|
||||||
|
body('national_code')
|
||||||
|
.notEmpty()
|
||||||
|
.withMessage(_faSr.required.national_code)
|
||||||
|
.bail()
|
||||||
|
.custom((value, { req }) => {
|
||||||
|
if (checkNationalCode(value)) return true
|
||||||
|
else return Promise.reject(_faSr.format.national_code)
|
||||||
|
})
|
||||||
|
.custom((value, { req }) => {
|
||||||
|
const nationalCode = value.trim()
|
||||||
|
return User.findOne({ national_code: nationalCode }).then(user => {
|
||||||
|
if (user && user.national_code === nationalCode && user._id.toString() !== req.body._id)
|
||||||
|
return Promise.reject(new Error('کاربر با این کد ملی از قبل وجود دارد'))
|
||||||
|
else return true
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
|
||||||
|
body('province_id').notEmpty().withMessage(_faSr.required.province),
|
||||||
|
|
||||||
|
body('city_id').notEmpty().withMessage(_faSr.required.city),
|
||||||
|
|
||||||
|
body('address')
|
||||||
|
.notEmpty()
|
||||||
|
.withMessage(_faSr.required.address)
|
||||||
|
.bail()
|
||||||
|
.custom((value, { req }) => {
|
||||||
|
if (!isPersianWithDigits(value)) return Promise.reject(new Error('لطفا با حروف فارسی تایپ کنید'))
|
||||||
|
else return true
|
||||||
|
}),
|
||||||
|
|
||||||
|
body('postal_code')
|
||||||
|
.notEmpty()
|
||||||
|
.withMessage(_faSr.required.postal_code)
|
||||||
|
.bail()
|
||||||
|
.isNumeric()
|
||||||
|
.withMessage(_faSr.format.number),
|
||||||
|
|
||||||
|
body('tel_number')
|
||||||
|
.notEmpty()
|
||||||
|
.withMessage(_faSr.required.phone_number)
|
||||||
|
.bail()
|
||||||
|
.isNumeric()
|
||||||
|
.withMessage(_faSr.format.phone_number),
|
||||||
|
|
||||||
|
body('mobile_number')
|
||||||
|
.notEmpty()
|
||||||
|
.withMessage(_faSr.required.phone_number)
|
||||||
|
.bail()
|
||||||
|
.custom((value, { req }) => {
|
||||||
|
const mobileNStatus = checkMobileNumber(value)
|
||||||
|
if (!mobileNStatus) return Promise.reject(_faSr.format.phone_number)
|
||||||
|
else return Promise.resolve()
|
||||||
|
})
|
||||||
|
.bail()
|
||||||
|
.custom((value, { req }) => {
|
||||||
|
const mobileNumber = value.trim()
|
||||||
|
return User.findOne({ mobile_number: mobileNumber }).then(user => {
|
||||||
|
if (user && user.mobile_number === mobileNumber && user._id.toString() !== req.body._id)
|
||||||
|
return Promise.reject(new Error('کاربر با این شماره موبایل از قبل وجود دارد'))
|
||||||
|
else return true
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
|
||||||
|
body('email')
|
||||||
|
.notEmpty()
|
||||||
|
.withMessage(_faSr.required.email)
|
||||||
|
.bail()
|
||||||
|
.isEmail()
|
||||||
|
.withMessage(_faSr.format.email)
|
||||||
|
.bail()
|
||||||
|
.custom((value, { req }) => {
|
||||||
|
const email = value.trim().toLowerCase()
|
||||||
|
return User.findOne({ email }).then(user => {
|
||||||
|
if (user && user.email === email && user._id.toString() !== req.body._id)
|
||||||
|
return Promise.reject(_faSr.duplicated.email)
|
||||||
|
else return true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
],
|
||||||
|
checkValidations(validationResult),
|
||||||
|
async (req, res) => {
|
||||||
|
const {
|
||||||
|
first_name,
|
||||||
|
last_name,
|
||||||
|
national_code,
|
||||||
|
province_id,
|
||||||
|
province_name,
|
||||||
|
city_id,
|
||||||
|
city_name,
|
||||||
|
address,
|
||||||
|
postal_code,
|
||||||
|
tel_number,
|
||||||
|
mobile_number,
|
||||||
|
email,
|
||||||
|
store_name
|
||||||
|
} = req.body
|
||||||
|
|
||||||
|
const MongoData = {
|
||||||
|
last_name,
|
||||||
|
province_id,
|
||||||
|
province_name,
|
||||||
|
city_id,
|
||||||
|
city_name,
|
||||||
|
address,
|
||||||
|
postal_code,
|
||||||
|
tel_number,
|
||||||
|
store_name
|
||||||
|
}
|
||||||
|
MongoData.first_name = nameOptimizer(first_name)
|
||||||
|
MongoData.national_code = national_code.trim()
|
||||||
|
MongoData.mobile_number = normalizeMobileNumber(mobile_number)
|
||||||
|
MongoData.email = email.trim().toLowerCase()
|
||||||
|
|
||||||
|
try {
|
||||||
|
const user_id = req.params.id
|
||||||
|
const user = await User.findById(user_id)
|
||||||
|
if (!user) {
|
||||||
|
return res404(res, _faSr.not_found.user_id)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// check if need to ferify email or mobile
|
||||||
|
const newEmail = user.email !== MongoData.email
|
||||||
|
const newMobile = user.mobile_number !== MongoData.mobile_number
|
||||||
|
if (newEmail) user.email_confirmed = false
|
||||||
|
if (newMobile) user.mobile_confirmed = false
|
||||||
|
|
||||||
|
// save new info to arpa
|
||||||
|
await updateUserOnArpa(MongoData, user.verity_businessID, 'verity')
|
||||||
|
await updateUserOnArpa(MongoData, user.panatech_businessID, 'panatech')
|
||||||
|
|
||||||
|
// save new info to user
|
||||||
|
user.first_name = MongoData.first_name
|
||||||
|
user.last_name = MongoData.last_name
|
||||||
|
user.national_code = MongoData.national_code
|
||||||
|
user.province_id = MongoData.province_id
|
||||||
|
user.province_name = MongoData.province_name
|
||||||
|
user.city_id = MongoData.city_id
|
||||||
|
user.city_name = MongoData.city_name
|
||||||
|
user.address = MongoData.address
|
||||||
|
user.postal_code = MongoData.postal_code
|
||||||
|
user.tel_number = MongoData.tel_number
|
||||||
|
user.store_name = MongoData.store_name
|
||||||
|
user.mobile_number = MongoData.mobile_number
|
||||||
|
user.email = MongoData.email
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
await user.save()
|
||||||
|
|
||||||
|
// send confirmation key after user saved
|
||||||
|
if (newEmail) await sendConfirmationEmail(user_id)
|
||||||
|
if (newMobile) await sendConfirmationSMS(user_id)
|
||||||
|
|
||||||
|
return res.json({ message: _faSr.response.success_save })
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Arpa Error during update user --', e)
|
||||||
|
return res500(res, _faSr.response.problem)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
/// //////////////////////////////////////////////////////////////////// authentication
|
/// //////////////////////////////////////////////////////////////////// authentication
|
||||||
|
|
||||||
/// //////// Login
|
/// //////// Login
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ const inHostUrl = 'mongodb://asanserv_admin:admin1234@localhost:27017/asanserv_d
|
|||||||
const outHostUrl =
|
const outHostUrl =
|
||||||
'mongodb://asanserv_admin:admin1234@www.asan-service.com:27017/asanserv_database?serverSelectionTimeoutMS=5000&connectTimeoutMS=10000&authSource=asanserv_database'
|
'mongodb://asanserv_admin:admin1234@www.asan-service.com:27017/asanserv_database?serverSelectionTimeoutMS=5000&connectTimeoutMS=10000&authSource=asanserv_database'
|
||||||
const locaUrl = 'mongodb://localhost:27017/AsanService'
|
const locaUrl = 'mongodb://localhost:27017/AsanService'
|
||||||
mongoose.connect(locaUrl, {
|
mongoose.connect(outHostUrl, {
|
||||||
useNewUrlParser: true,
|
useNewUrlParser: true,
|
||||||
useUnifiedTopology: true,
|
useUnifiedTopology: true,
|
||||||
useFindAndModify: false,
|
useFindAndModify: false,
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
const mongoose = require('mongoose')
|
const mongoose = require('mongoose')
|
||||||
|
|
||||||
function image(img) {
|
|
||||||
if (img) return '/uploads/images/announcement/' + img
|
|
||||||
}
|
|
||||||
|
|
||||||
const AnnouncementSchema = mongoose.Schema({
|
const AnnouncementSchema = mongoose.Schema({
|
||||||
title: String,
|
title: String,
|
||||||
@@ -11,7 +8,8 @@ const AnnouncementSchema = mongoose.Schema({
|
|||||||
expireDate: Number,
|
expireDate: Number,
|
||||||
expired: { type: Boolean, default: false },
|
expired: { type: Boolean, default: false },
|
||||||
isForAgents: { type: Boolean, default: false },
|
isForAgents: { type: Boolean, default: false },
|
||||||
image: { type: String, get: image },
|
image: { type: String},
|
||||||
|
public:{ type: Boolean, default:false },
|
||||||
_creator: { type: mongoose.ObjectId, ref: 'User' }
|
_creator: { type: mongoose.ObjectId, ref: 'User' }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ router.get('/user/:id', hasPermission('customers'), userController.get_one_user_
|
|||||||
router.put('/user/:id', hasPermission('customers'), userController.updateUserByAdmin)
|
router.put('/user/:id', hasPermission('customers'), userController.updateUserByAdmin)
|
||||||
router.put('/user/changeVerityInfo/:id', hasPermission('customers'), userController.change_verity_info_by_admin)
|
router.put('/user/changeVerityInfo/:id', hasPermission('customers'), userController.change_verity_info_by_admin)
|
||||||
router.put('/user/changePanatechInfo/:id', hasPermission('customers'), userController.change_panatech_info_by_admin)
|
router.put('/user/changePanatechInfo/:id', hasPermission('customers'), userController.change_panatech_info_by_admin)
|
||||||
|
router.put('/user/update/:id', hasPermission('customers'), userController.update_user_by_admin)
|
||||||
|
|
||||||
|
|
||||||
/// ///////////// serials exel file
|
/// ///////////// serials exel file
|
||||||
router.post('/addExel', hasPermission('serials-exel'), serialsExelController.addExel)
|
router.post('/addExel', hasPermission('serials-exel'), serialsExelController.addExel)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const helpController = require('../controllers/helpController')
|
|||||||
const lotteryPopUpController = require('../controllers/lotteryPopUpController')
|
const lotteryPopUpController = require('../controllers/lotteryPopUpController')
|
||||||
const lotteryController = require('../controllers/lotteryController')
|
const lotteryController = require('../controllers/lotteryController')
|
||||||
const representationController = require('../controllers/representationController')
|
const representationController = require('../controllers/representationController')
|
||||||
|
const announcementController = require('../controllers/announcementController')
|
||||||
|
|
||||||
/// //////////////////////////////////////////////////////// routes
|
/// //////////////////////////////////////////////////////// routes
|
||||||
/// ///////////// warranty terms
|
/// ///////////// warranty terms
|
||||||
@@ -57,4 +58,8 @@ router.get('/lotteryPopUp', lotteryPopUpController.getPopUpInfo)
|
|||||||
router.get('/lastLottery', lotteryController.getLastLottery)
|
router.get('/lastLottery', lotteryController.getLastLottery)
|
||||||
router.post('/enrollParticipant', lotteryController.enrollParticipant)
|
router.post('/enrollParticipant', lotteryController.enrollParticipant)
|
||||||
|
|
||||||
|
/// //////////// announcement
|
||||||
|
router.get('/announcement', announcementController.getNotifsForSite)
|
||||||
|
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
Reference in New Issue
Block a user