somewhere

This commit is contained in:
Swift
2023-08-17 13:05:51 +03:30
parent 30c7eb0e7b
commit 53843207cc
429 changed files with 117489 additions and 1 deletions
@@ -0,0 +1,167 @@
<template>
<el-dialog :title="title" :visible.sync="showModal">
<div v-loading="fetchingBuffers" class="addPtoPrModal">
<el-form label-position="top" :model="formData">
<el-form-item label="نام کالا" :class="validation.ItemName && 'err'">
<el-select v-model="selectedItem" filterable style="width: 100%">
<el-option-group label="لوازم جانبی کامپیوتر و موبایل">
<el-option
v-for="item in verityProducts"
:key="item.ItemID + '_V'"
:value="item.ItemID + '__v'"
:label="item.ItemName"
></el-option>
</el-option-group>
<el-option-group label="لوازم صوتی و تصویری خودرو">
<el-option
v-for="item in panatechProducts"
:key="item.ItemID + '_P'"
:value="item.ItemID + '__p'"
:label="item.ItemName"
></el-option>
</el-option-group>
</el-select>
<p v-if="validation.ItemName" class="errMsg">{{ validation.ItemName.msg }}</p>
</el-form-item>
<el-form-item label="تعداد درخواستی" :class="validation.bufferQuantity && 'err'">
<el-input
v-model="formData.bufferQuantity"
placeholder="تعداد را وارد کنید"
@input="normalizeQuantityInput"
></el-input>
<p v-if="validation.bufferQuantity" class="errMsg">{{ validation.bufferQuantity.msg }}</p>
</el-form-item>
</el-form>
<div class="btnRow">
<el-button class="btn btn-primary custom-el-button" :loading="postingForm" @click="add">افزودن</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'AddBuffersToBufferRequest',
props: {
show: {
type: Boolean,
default: false
},
brId: {
requred: true,
type: String,
default: null
}
},
data() {
return {
fetchingBuffers: false,
postingForm: false,
selectedItem: '',
formData: {
ItemName: '',
ItemID: '',
ItemCode: '',
bufferQuantity: ''
},
validation: {}
}
},
computed: {
showModal: {
get() {
return this.show
},
set(value) {
this.$emit('closeModal')
}
},
title() {
return 'افزودن کالای بافر به فرم'
},
bufferQuantity() {
return this.formData.bufferQuantity
},
verityProducts() {
return this.$store.state.front.verityProducts
},
panatechProducts() {
return this.$store.state.front.panatechProducts
}
},
watch: {
selectedItem() {
const selectedItem = this.selectedItem
let ItemID, db_name
if (selectedItem.includes('__v')) {
ItemID = selectedItem.replace('__v', '')
db_name = 'verity'
} else if (selectedItem.includes('__p')) {
ItemID = selectedItem.replace('__p', '')
db_name = 'panatech'
} else {
return this.$message({
type: 'error',
message: 'Invalid Value'
})
}
// find product
let products
if (db_name === 'verity') products = this.verityProducts
if (db_name === 'panatech') products = this.panatechProducts
const item = products.find(item => item.ItemID === ItemID)
this.formData.ItemName = item?.ItemName
this.formData.ItemID = item?.ItemID
this.formData.ItemCode = item?.ItemCode
}
},
methods: {
normalizeQuantityInput() {
this.formData.bufferQuantity = this.formData.bufferQuantity.toString().replace(/[^0-9]/g, '')
if (
this.formData.bufferQuantity === '' ||
this.formData.bufferQuantity === null ||
this.formData.bufferQuantity < 1
) {
this.formData.bufferQuantity = 1
}
},
add() {
this.validation = {}
this.postingForm = true
const data = this.formData
this.$axios
.put(`/api/agent/addBrItems/${this.brId}`, data)
.then(res => {
this.postingForm = false
this.showModal = false
this.$message({
type: 'success',
message: 'کالای بافر درخواستی به فرم افزوده شد'
})
this.$nuxt.refresh()
})
.catch(err => {
this.postingForm = false
if (err.response.status === 422) {
this.$message({
type: 'warning',
message: 'پارامترها رو بررسی و دوباره تلاش کنید'
})
this.validation = err.response.data.validation
} else {
this.$message({
type: 'error',
message: err.response?.data?.message
})
}
})
}
}
}
</script>
@@ -0,0 +1,207 @@
<template>
<el-dialog :title="title" :visible.sync="showModal">
<div v-loading="fetchingPieces" class="addPtoPrModal">
<el-form label-position="top" :model="formData">
<h3 class="mb-3">مشخصات کالا:</h3>
<el-form-item label="تاریخ پذیرش" :class="validation.ItemReceptionTransDate && 'err'">
<div class="datePickerWrapper">
<persian-date-picker
v-model="formData.ItemReceptionTransDate"
display-format="jYYYY/jMM/jDD"
format="YYYY-MM-DD HH:mm:ss"
placeholder="تاریخ را انتخاب کنید"
color="#065495"
/>
</div>
<p v-if="validation.ItemReceptionTransDate" class="errMsg">{{ validation.ItemReceptionTransDate.msg }}</p>
</el-form-item>
<el-form-item label="نام کالا" :class="validation.ItemName && 'err'">
<el-select v-model="selectedItem" filterable style="width: 100%">
<el-option-group label="لوازم جانبی کامپیوتر و موبایل">
<el-option
v-for="item in verityProducts"
:key="item.ItemID + '_V'"
:value="item.ItemID + '__v'"
:label="item.ItemName"
></el-option>
</el-option-group>
<el-option-group label="لوازم صوتی و تصویری خودرو">
<el-option
v-for="item in panatechProducts"
:key="item.ItemID + '_P'"
:value="item.ItemID + '__p'"
:label="item.ItemName"
></el-option>
</el-option-group>
</el-select>
<p v-if="validation.ItemName" class="errMsg">{{ validation.ItemName.msg }}</p>
</el-form-item>
<el-form-item label="سریال">
<el-input v-model="formData.SerialNo1" placeholder="اختیاری"></el-input>
</el-form-item>
<h3 class="mb-3">مشخصات قطعه درخواستی:</h3>
<el-form-item label="نام قطعه" :class="validation.pieceName && 'err'">
<el-select v-model="selectedPiece" filterable style="width: 100%">
<el-option
v-for="item in pieces"
:key="item._id"
:value="item._id"
:label="item.name + ` ( کد: ${item.code} ) `"
></el-option>
</el-select>
<p v-if="validation.pieceName" class="errMsg">{{ validation.pieceName.msg }}</p>
</el-form-item>
</el-form>
<div class="btnRow">
<el-button class="btn btn-primary custom-el-button" :loading="postingForm" @click="add">افزودن</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'AddOldPiecesToOldPieceRequest',
props: {
show: {
type: Boolean,
default: false
},
oprId: {
requred: true,
type: String,
default: null
}
},
data() {
return {
fetchingPieces: false,
postingForm: false,
pieces: [],
selectedItem: '',
selectedPiece: '',
formData: {
ItemReceptionTransDate: '',
ItemName: '',
SerialNo1: '',
ItemID: '',
ItemCode: '',
// piece info
pieceName: '',
pieceCode: '',
pieceId: ''
},
validation: {}
}
},
computed: {
showModal: {
get() {
return this.show
},
set(value) {
this.$emit('closeModal')
}
},
title() {
return 'افزودن قطعه داغی به فرم'
},
verityProducts() {
return this.$store.state.front.verityProducts
},
panatechProducts() {
return this.$store.state.front.panatechProducts
}
},
watch: {
showModal(newVal, oldVal) {
if (newVal) {
this.fetchingPieces = true
this.$axios
.get('/api/agent/pieces')
.then(res => {
this.fetchingPieces = false
this.pieces = res.data
})
.catch(err => {
console.log(err)
})
}
},
selectedItem() {
const selectedItem = this.selectedItem
let ItemID, db_name
if (selectedItem.includes('__v')) {
ItemID = selectedItem.replace('__v', '')
db_name = 'verity'
} else if (selectedItem.includes('__p')) {
ItemID = selectedItem.replace('__p', '')
db_name = 'panatech'
} else {
return this.$message({
type: 'error',
message: 'Invalid Value'
})
}
// find product
let products
if (db_name === 'verity') products = this.verityProducts
if (db_name === 'panatech') products = this.panatechProducts
const item = products.find(item => item.ItemID === ItemID)
this.formData.ItemName = item?.ItemName
this.formData.ItemID = item?.ItemID
this.formData.ItemCode = item?.ItemCode
},
selectedPiece() {
const item = this.pieces.find(item => item._id === this.selectedPiece)
this.formData.pieceId = item?._id
this.formData.pieceName = item?.name
this.formData.pieceCode = item?.code
}
},
methods: {
add() {
this.validation = {}
this.postingForm = true
const data = this.formData
this.$axios
.put(`/api/agent/addOprItems/${this.oprId}`, data)
.then(res => {
this.postingForm = false
this.showModal = false
this.$message({
type: 'success',
message: 'قطعه داغی درخواستی به فرم افزوده شد'
})
this.$nuxt.refresh()
})
.catch(err => {
this.postingForm = false
if (err.response.status === 422) {
this.$message({
type: 'warning',
message: 'پارامترها رو بررسی و دوباره تلاش کنید'
})
this.validation = err.response.data.validation
} else {
this.$message({
type: 'error',
message: err.response?.data?.message
})
}
})
}
}
}
</script>
@@ -0,0 +1,239 @@
<template>
<el-dialog :title="title" :visible.sync="showModal">
<div v-loading="fetchingPieces" class="addPtoPrModal">
<el-form label-position="top" :model="formData">
<h3 class="mb-3">مشخصات کالا:</h3>
<el-form-item label="تاریخ پذیرش" :class="validation.ItemReceptionTransDate && 'err'">
<div class="datePickerWrapper">
<persian-date-picker
v-model="formData.ItemReceptionTransDate"
display-format="jYYYY/jMM/jDD"
format="YYYY-MM-DD HH:mm:ss"
placeholder="تاریخ را انتخاب کنید"
color="#065495"
/>
</div>
<p v-if="validation.ItemReceptionTransDate" class="errMsg">{{ validation.ItemReceptionTransDate.msg }}</p>
</el-form-item>
<el-form-item label="نام کالا" :class="validation.ItemName && 'err'">
<el-select v-model="selectedItem" filterable style="width: 100%">
<el-option-group label="لوازم جانبی کامپیوتر و موبایل">
<el-option
v-for="item in verityProducts"
:key="item.ItemID + '_V'"
:value="item.ItemID + '__v'"
:label="item.ItemName"
></el-option>
</el-option-group>
<el-option-group label="لوازم صوتی و تصویری خودرو">
<el-option
v-for="item in panatechProducts"
:key="item.ItemID + '_P'"
:value="item.ItemID + '__p'"
:label="item.ItemName"
></el-option>
</el-option-group>
</el-select>
<p v-if="validation.ItemName" class="errMsg">{{ validation.ItemName.msg }}</p>
</el-form-item>
<el-form-item label="سریال">
<el-input v-model="formData.SerialNo1" placeholder="اختیاری"></el-input>
</el-form-item>
<el-form-item label="وضعیت گارانتی" :class="validation.gStatus && 'err'">
<el-select v-model="formData.gStatus" style="width: 100%">
<el-option :value="true" label="دارد"></el-option>
<el-option :value="false" label="ندارد"></el-option>
</el-select>
<p v-if="validation.gStatus" class="errMsg">{{ validation.gStatus.msg }}</p>
</el-form-item>
<h3 class="mb-3">مشخصات قطعه درخواستی:</h3>
<el-form-item label="نام قطعه" :class="validation.pieceName && 'err'">
<el-select v-model="selectedPiece" filterable style="width: 100%">
<el-option
v-for="item in pieces"
:key="item._id"
:value="item._id"
:label="item.name + ` ( کد: ${item.code} ) `"
></el-option>
</el-select>
<p v-if="validation.pieceName" class="errMsg">{{ validation.pieceName.msg }}</p>
</el-form-item>
<el-form-item label="تعداد درخواستی" :class="validation.pieceQuantity && 'err'">
<el-input
v-model="formData.pieceQuantity"
placeholder="تعداد را وارد کنید"
@input="normalizeQuantityInput"
></el-input>
<p v-if="validation.pieceQuantity" class="errMsg">{{ validation.pieceQuantity.msg }}</p>
</el-form-item>
</el-form>
<div class="btnRow">
<el-button class="btn btn-primary custom-el-button" :loading="postingForm" @click="add">افزودن</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'AddPiecesToPieceRequest',
props: {
show: {
type: Boolean,
default: false
},
prId: {
requred: true,
type: String,
default: null
}
},
data() {
return {
fetchingPieces: false,
postingForm: false,
pieces: [],
selectedItem: '',
selectedPiece: '',
formData: {
ItemReceptionTransDate: '',
ItemName: '',
SerialNo1: '',
ItemID: '',
ItemCode: '',
gStatus: '',
// piece info
pieceName: '',
pieceCode: '',
pieceQuantity: '',
pieceId: ''
},
validation: {}
}
},
computed: {
showModal: {
get() {
return this.show
},
set(value) {
this.$emit('closeModal')
}
},
title() {
return 'افزودن قطعه به فرم'
},
pieceQuantity() {
return this.formData.pieceQuantity
},
verityProducts() {
return this.$store.state.front.verityProducts
},
panatechProducts() {
return this.$store.state.front.panatechProducts
}
},
watch: {
showModal(newVal, oldVal) {
if (newVal) {
this.fetchingPieces = true
this.$axios
.get('/api/agent/pieces')
.then(res => {
this.fetchingPieces = false
this.pieces = res.data
})
.catch(err => {
console.log(err)
})
}
},
selectedItem() {
const selectedItem = this.selectedItem
let ItemID, db_name
if (selectedItem.includes('__v')) {
ItemID = selectedItem.replace('__v', '')
db_name = 'verity'
} else if (selectedItem.includes('__p')) {
ItemID = selectedItem.replace('__p', '')
db_name = 'panatech'
} else {
return this.$message({
type: 'error',
message: 'Invalid Value'
})
}
// find product
let products
if (db_name === 'verity') products = this.verityProducts
if (db_name === 'panatech') products = this.panatechProducts
const item = products.find(item => item.ItemID === ItemID)
this.formData.ItemName = item?.ItemName
this.formData.ItemID = item?.ItemID
this.formData.ItemCode = item?.ItemCode
},
selectedPiece() {
const item = this.pieces.find(item => item._id === this.selectedPiece)
this.formData.pieceId = item?._id
this.formData.pieceName = item?.name
this.formData.pieceCode = item?.code
}
},
methods: {
normalizeQuantityInput() {
this.formData.pieceQuantity = this.formData.pieceQuantity.toString().replace(/[^0-9]/g, '')
if (
this.formData.pieceQuantity === '' ||
this.formData.pieceQuantity === null ||
this.formData.pieceQuantity < 1
) {
this.formData.pieceQuantity = 1
}
},
add() {
this.validation = {}
this.postingForm = true
const data = this.formData
this.$axios
.put(`/api/agent/addPrItems/${this.prId}`, data)
.then(res => {
this.postingForm = false
this.showModal = false
this.$message({
type: 'success',
message: 'قطعه درخواستی به فرم افزوده شد'
})
this.$nuxt.refresh()
})
.catch(err => {
this.postingForm = false
if (err.response.status === 422) {
this.$message({
type: 'warning',
message: 'پارامترها رو بررسی و دوباره تلاش کنید'
})
this.validation = err.response.data.validation
} else {
this.$message({
type: 'error',
message: err.response?.data?.message
})
}
})
}
}
}
</script>
@@ -0,0 +1,223 @@
<template>
<el-dialog :title="title" :visible.sync="showModal">
<div class="addPtoPrModal reportModal">
<el-form label-position="top" :model="formData">
<el-form-item label="نام و نام خانوادگی مشتری" :class="validation.customerName && 'err'">
<el-input v-model="formData.customerName" placeholder="نام را وارد کنید"></el-input>
<p v-if="validation.customerName" class="errMsg">{{ validation.customerName.msg }}</p>
</el-form-item>
<el-form-item label="شماره تماس مشتری" :class="validation.customerTel && 'err'">
<el-input v-model="formData.customerTel" placeholder="شماره را وارد کنید"></el-input>
<p v-if="validation.customerTel" class="errMsg">{{ validation.customerTel.msg }}</p>
</el-form-item>
<el-form-item label="مدل کالا" :class="validation.ItemName && 'err'">
<el-select v-model="selectedItem" filterable style="width: 100%">
<el-option-group label="لوازم جانبی کامپیوتر و موبایل">
<el-option
v-for="item in verityProducts"
:key="item.ItemID + '_V'"
:value="item.ItemID + '__v'"
:label="item.ItemName"
></el-option>
</el-option-group>
<el-option-group label="لوازم صوتی و تصویری خودرو">
<el-option
v-for="item in panatechProducts"
:key="item.ItemID + '_P'"
:value="item.ItemID + '__p'"
:label="item.ItemName"
></el-option>
</el-option-group>
</el-select>
<p v-if="validation.ItemName" class="errMsg">{{ validation.ItemName.msg }}</p>
</el-form-item>
<el-form-item label="سریال">
<el-input v-model="formData.SerialNo1" placeholder="اختیاری"></el-input>
</el-form-item>
<el-form-item label="ایراد کالا" :class="validation.productIssue && 'err'">
<el-input
v-model="formData.productIssue"
type="textarea"
:rows="5"
placeholder="شرح ایرادات کالا را بنویسید"
></el-input>
<p v-if="validation.productIssue" class="errMsg">{{ validation.productIssue.msg }}</p>
</el-form-item>
<el-form-item label="قطعات مصرفی" :class="validation.usedPieces && 'err'">
<el-input
v-model="formData.usedPieces"
type="textarea"
:rows="5"
placeholder="شرح قطقات مصرفی را بنویسید"
></el-input>
<p v-if="validation.usedPieces" class="errMsg">{{ validation.usedPieces.msg }}</p>
</el-form-item>
<el-form-item label="تاریخ دریافت از مشتی" :class="validation.recieveDate && 'err'">
<div class="datePickerWrapper">
<persian-date-picker
v-model="formData.recieveDate"
display-format="jYYYY/jMM/jDD"
format="YYYY-MM-DD HH:mm:ss"
placeholder="تاریخ را انتخاب کنید"
color="#065495"
/>
</div>
<p v-if="validation.recieveDate" class="errMsg">{{ validation.recieveDate.msg }}</p>
</el-form-item>
<el-form-item label="تاریخ تحویل به مشتری" :class="validation.deliverDate && 'err'">
<div class="datePickerWrapper">
<persian-date-picker
v-model="formData.deliverDate"
display-format="jYYYY/jMM/jDD"
format="YYYY-MM-DD HH:mm:ss"
:min="formData.recieveDate"
placeholder="تاریخ را انتخاب کنید"
color="#065495"
/>
</div>
<p v-if="validation.deliverDate" class="errMsg">{{ validation.deliverDate.msg }}</p>
</el-form-item>
</el-form>
<div class="btnRow">
<el-button class="btn btn-primary custom-el-button" :loading="postingForm" @click="add">افزودن</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'AddReportToGuaranteeReportForm',
props: {
show: {
type: Boolean,
default: false
},
grId: {
requred: true,
type: String,
default: null
}
},
data() {
return {
postingForm: false,
selectedItem: '',
formData: {
customerName: '',
customerTel: '',
// product info
ItemName: '',
SerialNo1: '',
ItemID: '',
ItemCode: '',
// product issue
productIssue: '',
usedPieces: '',
// dates
recieveDate: '',
deliverDate: ''
},
validation: {}
}
},
computed: {
showModal: {
get() {
return this.show
},
set(value) {
this.$emit('closeModal')
}
},
title() {
return 'افزودن گزارش به فرم'
},
verityProducts() {
return this.$store.state.front.verityProducts
},
panatechProducts() {
return this.$store.state.front.panatechProducts
},
recieveDate() {
return this.formData.recieveDate
}
},
watch: {
recieveDate(newVal, oldVal) {
this.formData.deliverDate = ''
},
selectedItem() {
const selectedItem = this.selectedItem
let ItemID, db_name
if (selectedItem.includes('__v')) {
ItemID = selectedItem.replace('__v', '')
db_name = 'verity'
} else if (selectedItem.includes('__p')) {
ItemID = selectedItem.replace('__p', '')
db_name = 'panatech'
} else {
return this.$message({
type: 'error',
message: 'Invalid Value'
})
}
// find product
let products
if (db_name === 'verity') products = this.verityProducts
if (db_name === 'panatech') products = this.panatechProducts
const item = products.find(item => item.ItemID === ItemID)
this.formData.ItemName = item?.ItemName
this.formData.ItemID = item?.ItemID
this.formData.ItemCode = item?.ItemCode
}
},
methods: {
add() {
this.validation = {}
this.postingForm = true
const data = this.formData
this.$axios
.put(`/api/agent/addGrItems/${this.grId}`, data)
.then(res => {
this.postingForm = false
this.showModal = false
this.$message({
type: 'success',
message: 'گزارش به فرم افزوده شد'
})
this.$nuxt.refresh()
})
.catch(err => {
this.postingForm = false
if (err.response.status === 422) {
this.$message({
type: 'warning',
message: 'پارامترها رو بررسی و دوباره تلاش کنید'
})
this.validation = err.response.data.validation
} else {
this.$message({
type: 'error',
message: err.response?.data?.message
})
}
})
}
}
}
</script>
+300
View File
@@ -0,0 +1,300 @@
<template>
<el-dialog :title="title" :visible.sync="showModal">
<div>
<form v-loading="fetchingSerials" class="form form_3 stuffModal" @submit.prevent="addStuff">
<div class="formRow">
<el-select
v-if="!currentItem.name"
ref="productSelector"
v-model="currentItem.item"
filterable
:placeholder="productsPlaceholder"
>
<el-option v-for="item in products" :key="item.ItemID" :label="item.ItemName" :value="item.ItemID">
</el-option>
</el-select>
<p v-else>
<b>نام کالا: </b>
<span>{{ currentItem.name }}</span>
<span style="margin: 0 5px"> - </span>
<i style="color: blue; font-weight: bold; cursor: pointer" @click="changeProduct">تغییر کالا</i>
</p>
</div>
<div
v-if="currentItem.item && !serials.length && !fetchingSerials"
class="formRow"
:class="validation.quantity ? 'err' : null"
>
<p style="user-select: none">
<b style="margin-left: 10px">تعداد: </b>
<i
style="color: #bf6060; cursor: pointer"
class="fas fa-minus-circle"
@click="changeQuantity('decrease')"
></i>
<!-- <span style="font-weight: bold;margin: 0 5px">{{ currentItem.quantity }}</span> -->
<input
ref="quantityInput"
v-model="currentItem.quantity"
type="text"
style="
width: 50px;
display: inline-block;
border-radius: 50px;
padding: 5px;
direction: ltr;
text-align: center;
"
@input="normalizeQuantityInput"
/>
<i
style="color: #658865; cursor: pointer"
class="fas fa-plus-circle"
@click="changeQuantity('increase')"
></i>
</p>
</div>
<div v-if="serials.length" class="formRow" :class="serialInput.length && !isValid ? 'err' : null">
<el-input
v-if="!currentItem.SerialNo1"
ref="serialInput"
v-model="serialInput"
:disabled="isValid"
placeholder="شماره سریال را به صورت کامل وارد کنید"
@input="checkSerial"
>
<template v-if="serialInput.length">
<i v-if="isValid" slot="prefix" style="color: green" class="el-input__icon fas fa-check-circle"></i>
<i v-else slot="prefix" style="color: red" class="el-input__icon fas fa-exclamation-circle"></i>
</template>
</el-input>
<p v-else>
<b>شماره سریال: </b>
<span>{{ currentItem.SerialNo1 }}</span>
<span style="margin: 0 5px"> - </span>
<i v-if="isValid" style="color: blue; font-weight: bold; cursor: pointer" @click="changeSerial">
تغییر شماره سریال
</i>
</p>
</div>
<div v-if="addBtnVisible" class="formRow">
<button id="addBtn" ref="addBtn" type="submit" class="btn btn-primary">افزودن</button>
</div>
</form>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'AddStuffModal',
props: {
show: {
type: Boolean,
default: false
},
db_name: {
type: String,
required: true
}
},
data() {
return {
serials: [],
fetchingSerials: false,
currentItem: {
name: null,
item: null,
quantity: 1,
SerialNo1: '',
GStartDate: '',
GEndDate: ''
},
isValid: false,
serialInput: '',
validation: {}
}
},
computed: {
showModal: {
get() {
return this.show
},
set(value) {
this.$emit('closeModal')
}
},
title() {
if (this.db_name === 'panatech') return 'افزودن کالاهای صوتی تصویری به فرم'
if (this.db_name === 'verity') return 'افزودن کالاهای لوازم جانبی به فرم'
else return ''
},
products() {
if (this.db_name === 'verity') return this.$store.state.front.verityProducts
else if (this.db_name === 'panatech') return this.$store.state.front.panatechProducts
else return []
},
productsPlaceholder() {
return this.products ? 'نام کالا را جستجو کنید' : 'درحال بارگیری اطلاعات...'
},
selectedItem() {
return this.currentItem.item
},
selectedSerial() {
return this.currentItem.SerialNo1
},
addBtnVisible() {
if (this.serials.length) {
return this.currentItem.item && this.currentItem.SerialNo1
} else {
return this.currentItem.item && !this.fetchingSerials
}
}
},
watch: {
addBtnVisible(newVal, oldVal) {
if (newVal) {
if (this.serials.length) setTimeout(() => this.$refs.addBtn?.focus(), 300)
else setTimeout(() => this.$refs.quantityInput?.focus(), 300)
}
},
async selectedSerial(newVal, oldVal) {
if (newVal) {
const serialObject = await this.serials.filter(item => item.SerialNo1 === newVal)[0]
this.currentItem.GStartDate = serialObject.GStartDate
this.currentItem.GEndDate = serialObject.GEndDate
} else {
this.currentItem.GStartDate = ''
this.currentItem.GEndDate = ''
}
},
async selectedItem(newVal, oldVal) {
if (newVal) {
try {
this.fetchingSerials = true
this.currentItem.SerialNo1 = ''
this.serials = []
this.currentItem.name = null
const item = await this.products.filter(item => item.ItemID === newVal)[0]
this.currentItem.name = item.ItemName
const serialsData = {
url: `/api/GetSerials?ItemCode=${item.ItemCode}&QtyStatus=1`,
db: this.db_name
}
const serials = await this.$axios.post('/api/cross/getRouteManager', serialsData, {
progress: false
})
this.serials = serials.data.data
this.fetchingSerials = false
setTimeout(() => this.$refs.serialInput?.focus(), 300)
} catch (e) {
this.currentItem = {
item: '',
quantity: 1,
SerialNo1: '',
GStartDate: '',
GEndDate: ''
}
console.log(e)
return this.$message({
type: 'error',
message: 'مشکلی در دریافت اطلاعات پیش آمده، لطفا نام کالا را دوباره انتخاب کنید.'
})
}
} else {
this.serials = []
}
},
serials(newVal, oldVal) {
this.currentItem.quantity = 1
},
showModal(newVal, oldVal) {
if (newVal) {
this.$nextTick(() => {
this.$refs?.productSelector?.focus()
})
}
}
},
methods: {
changeProduct() {
this.currentItem.item = this.currentItem.name = null
this.isValid = false
this.serialInput = ''
},
changeSerial() {
this.currentItem.SerialNo1 = ''
this.isValid = false
this.serialInput = ''
setTimeout(() => this.$refs.serialInput?.focus(), 300)
},
checkSerial(serial) {
const SerialNo1 = this.serials.find(item => item.SerialNo1.toLowerCase() === serial.toLowerCase())
if (SerialNo1) {
this.isValid = true
this.currentItem.SerialNo1 = SerialNo1.SerialNo1
} else this.isValid = false
},
changeQuantity(mode) {
if (mode === 'increase') this.currentItem.quantity++
else if (mode === 'decrease' && this.currentItem.quantity > 1) this.currentItem.quantity--
},
addStuff() {
if (this.serials.length && !this.currentItem.SerialNo1) {
return this.$message({
type: 'warning',
message: 'شماره سریال معتبر وارد کنید'
})
}
this.fetchingSerials = true
const currentItem = this.currentItem
const selectedItem = this.products.filter(item => item.ItemID === currentItem.item)[0]
const item = {
ItemID: selectedItem.ItemID,
ItemCode: selectedItem.ItemCode,
MjQty: Number(currentItem.quantity),
SerialNo1: currentItem.SerialNo1,
GStartDate: currentItem.GStartDate,
GEndDate: currentItem.GEndDate
}
this.$axios
.put(`/api/user/transactionDraftItemAdd/${this.$route.params.draftID}`, item, { progress: false })
.then(res => {
this.fetchingSerials = false
this.$message({
type: 'success',
message: res.data.message
})
this.showModal = false
this.$nuxt.refresh()
})
.catch(err => {
this.fetchingSerials = false
if (err.response.status === 406) {
return this.$message({
type: 'warning',
message: err.response.data.message
})
} else {
return this.$message({
type: 'error',
message: 'مشکلی در ثبت اطلاعات پیش آمده، لطفا دوباره امتحان کنید'
})
}
})
},
normalizeQuantityInput() {
this.currentItem.quantity = this.currentItem.quantity.toString().replace(/[^0-9]/g, '')
if (this.currentItem.quantity === '' || this.currentItem.quantity === null || this.currentItem.quantity < 1) {
this.currentItem.quantity = 1
}
}
}
}
</script>
@@ -0,0 +1,233 @@
<template>
<el-dialog :title="title" :visible.sync="showModal">
<div v-loading="fetchingDrafts">
<template v-if="!addingStuff">
<h3 class="mb-3">پیشنویس مورد نظر جهت افزودن اقلام انتخاب شده را انتخاب کنید:</h3>
<div class="tableBox">
<table class="drafts-modal">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="description">توضیحات</th>
<th class="brand">نوع</th>
<th class="quantity">تعداد کالاها</th>
<th class="details">افزودن</th>
</tr>
</thead>
<tbody>
<template v-if="filteredDrafts.length">
<tr v-for="(item, index) in filteredDrafts" :key="item._id" :title="item.description">
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="description">
<span v-if="item.description" class="singleLineTxt">{{ item.description }}</span>
<span v-else style="color: gray">بدون توضیحات</span>
</td>
<td class="brand">
<!-- <img src="/assets/img/verity-small.png" alt="verity" v-if="item.db_name === 'verity'" />
<img src="/assets/img/panatech-small.png" alt="panatech" v-if="item.db_name === 'panatech'" /> -->
<i
v-if="item.db_name === 'verity'"
class="fas fa-phone-laptop"
title="لوازم جانبی کامپیوتر و موبایل"
></i>
<i
v-if="item.db_name === 'panatech'"
class="fas fa-photo-video"
title="لوازم صوتی و تصویری خودرو"
></i>
</td>
<td class="quantity">
<span>{{ totalItemsCount(item) }}</span>
</td>
<td class="details">
<button class="btn btn-primary" @click="addStuffToDraft(item._id)">
<i class="fas fa-link"></i>
</button>
</td>
</tr>
</template>
<tr v-else>
<td class="noItem">
<span>هیچ اطلاعاتی وجود ندارد</span>
</td>
</tr>
</tbody>
</table>
</div>
</template>
<template v-else>
<el-progress
class="mb-3"
:text-inside="true"
:stroke-width="20"
:percentage="addProgress"
:status="addProgressStatus"
></el-progress>
<div class="tableBox">
<table class="drafts-modal">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="name">نام</th>
<th class="quantity">تعداد کالاها</th>
<th class="brand">شماره سریال</th>
<th class="addStatus">وضعیت</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in addedStuff" :key="index + '_addedStuff_modal_itemStatus'">
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="name">
<span class="singleLineTxt" :title="getItemName(item.ItemID)">{{ getItemName(item.ItemID) }}</span>
</td>
<td class="quantity">
<span>{{ item.MjQty }}</span>
</td>
<td class="brand">
<span> {{ item.SerialNo1 || '-' }} </span>
</td>
<td class="addStatus">
<i
v-if="item.status"
class="el-icon-success"
style="color: rgb(19, 206, 102)"
:title="item.statusTxt"
></i>
<i v-else class="el-icon-info" style="color: orange" :title="item.statusTxt"></i>
</td>
</tr>
</tbody>
</table>
</div>
</template>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'AddUserItemsToAgentDraft',
props: {
show: {
type: Boolean,
default: false
},
db_name: {
type: String,
required: true
},
items: {
type: Array,
required: true
}
},
data() {
return {
fetchingDrafts: false,
addingStuff: false,
addProgress: 0,
addProgressStatus: 'success',
transactionDrafts: [],
addedStuff: [],
validation: {}
}
},
computed: {
showModal: {
get() {
return this.show
},
set(value) {
this.$emit('closeModal')
}
},
title() {
if (this.db_name === 'panatech') return 'افزودن کالاهای صوتی تصویری به فرم'
if (this.db_name === 'verity') return 'افزودن کالاهای لوازم جانبی به فرم'
else return ''
},
filteredDrafts() {
return this.transactionDrafts.filter(item => item.db_name === this.db_name)
},
products() {
if (this.db_name === 'verity') return this.$store.state.front.verityProducts
else if (this.db_name === 'panatech') return this.$store.state.front.panatechProducts
else return []
}
},
watch: {
showModal(newVal, oldVal) {
if (newVal) {
this.fetchingDrafts = true
this.$axios
.get('/api/user/transactionDrafts')
.then(res => {
this.transactionDrafts = res.data
this.fetchingDrafts = false
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در دریافت اطلاعات پیش آمده'
})
this.showModal = false
})
}
}
},
methods: {
totalItemsCount(draft) {
const items = draft.items
let count = 0
items.forEach(item => (count += item.MjQty))
return count
},
getItemName(ItemID) {
return this.products.find(item => item.ItemID === ItemID)?.ItemName
},
async addStuffToDraft(draftId) {
this.addingStuff = true
try {
let index = 1
for await (const item of this.items) {
this.addProgress = Number(((index * 100) / this.items.length).toFixed(0))
await new Promise((resolve, reject) => {
index++
this.$axios
.put(`/api/user/transactionDraftItemAdd/${draftId}`, item, { progress: false })
.then(res => {
this.addedStuff.push({ ...item, status: true, statusTxt: res.data.message })
resolve()
})
.catch(err => {
this.addedStuff.push({ ...item, status: false, statusTxt: err.response.data.message })
this.addProgressStatus = 'warning'
resolve()
})
})
}
} catch (e) {
this.$message({
type: 'error',
message: 'مشکلی در ثبت اطلاعات پیش آمده'
})
}
}
}
}
</script>
+99
View File
@@ -0,0 +1,99 @@
<template>
<el-dialog :title="title" :visible.sync="showModal">
<div>
<form class="form form_3 stuffModal" @submit.prevent="change">
<div class="formRow" :class="[validation.email && 'err', validation.mobile && 'err']">
<el-input v-model="input" :placeholder="inputPlaceholder"> </el-input>
<p v-if="validation.email">{{ validation.email.msg }}</p>
<p v-if="validation.mobile">{{ validation.mobile.msg }}</p>
</div>
<div class="formRow">
<el-button
class="btn btn-primary custom-el-button"
type="primary"
native-type="submit"
:loading="posting"
:disabled="input.length < 1"
>
تغییر
</el-button>
</div>
</form>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'ChangeEmailOrMobileModal',
props: {
show: {
type: Boolean,
default: false
},
type: {
required: true,
type: String
}
},
data() {
return {
input: '',
posting: false,
validation: {}
}
},
computed: {
showModal: {
get() {
return this.show
},
set(value) {
this.$emit('closeModal')
}
},
title() {
if (this.type === 'mobile') return 'تغییر شماره موبایل'
if (this.type === 'email') return 'تغییر ایمیل'
else return ''
},
inputPlaceholder() {
if (this.type === 'mobile') return 'شماره موبایل خود را وارد کنید'
if (this.type === 'email') return 'ایمیل خود را وارد کنید'
else return ''
}
},
methods: {
async change() {
try {
this.posting = true
this.validation = {}
let res
if (this.type === 'email') {
res = await this.$axios.put('/api/user/changeEmail', { email: this.input })
}
if (this.type === 'mobile') {
res = await this.$axios.put('/api/user/changeMobile', { mobile: this.input })
}
this.posting = false
this.$message({
type: 'success',
message: res.data.message
})
this.$auth.fetchUser()
this.showModal = false
} catch (err) {
this.posting = false
if (err.response.status === 422) this.validation = err.response.data.validation
else {
this.$message({
type: 'error',
message: 'مشکلی در بروزرسانی اطلاعات پیش آمده'
})
}
}
}
}
}
</script>
+230
View File
@@ -0,0 +1,230 @@
<template>
<el-dialog title="انتخاب نمایندگی و ارسال فرم" :visible.sync="showModal">
<div v-loading="fetchingAgents" class="terms">
<h2>تعهدنامه:</h2>
<p class="mb-5">
کاربر محترم درخواست کننده خدمت با تایید این متن هرگونه ادعایی خارج از پروتکل های اعلامی این شرکت را از خود سلب
مینماید و تشخیص و سنجش کارشناسان واحد خدمات پس از فروش آسان سرویس ملاک عمل خواهد بود .دریافت کننده خدمات با
تایید این متن تصدیق مینماید موارد خارج از شمول گارانتی اعلامی توسط آسان سرویس را میپذیرد .در صورتیکه کالایی فاقد
شرایط گارانتی باشد نخست جهت تعمیر به درخواست کننده خدمت در این سامانه اطلاع رسانی میگردد و در صورت عدم اعلام نظر
توسط کاربر جهت ثبت درخواست تعمیر ،کالای مذکور به نشانی کاربر عودت خواهد گردید.
</p>
<h4>موارد خارج از شمول گارانتی :</h4>
<ol>
<li>
<p>دستکاری توسط افراد غیر مجاز</p>
</li>
<li>
<p>مغایرت محصول با پک و یا نداشتن پک</p>
</li>
<li>
<p>شکستگی، ضربه خوردگی، آبخوردگی</p>
</li>
<li>
<p>مخدوش بودن سریال کالا با کارت گارانتی و پکیج محصول</p>
</li>
<li>
<p>کسورات لوازم جانبی و قطعات محصول در پک</p>
</li>
</ol>
<div class="form form_2">
<div class="formRow">
<label for="accept">
<input id="accept" v-model="termsOfUse" type="checkbox" />
<span>قوانین را میپذیرم</span>
</label>
</div>
<div class="formRow agents">
<el-select
v-model="agent"
:disabled="!termsOfUse || user.isAgent"
filterable
placeholder="نماینگی نزدیک خودرا انتخاب کنید"
>
<el-option label="شرکت آسان سرویس (تهران)" value="main"></el-option>
<el-option
v-for="item in filteredAgents"
:key="item._id"
:label="agentName(item)"
:title="agentName(item)"
:value="item._id"
>
</el-option>
</el-select>
<el-button
class="btn btn-primary custom-el-button"
:disabled="!termsOfUse"
:loading="postingForm"
@click="sendForm"
>
ارسال
</el-button>
</div>
</div>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'SelectAgentModal',
props: {
show: {
type: Boolean,
default: false
},
draft: {
required: true,
type: Object
}
},
data() {
return {
termsOfUse: false,
fetchingAgents: true,
postingForm: false,
agents: [],
agent: ''
}
},
computed: {
showModal: {
get() {
return this.show
},
set(value) {
this.$emit('closeModal')
}
},
user() {
return this.$auth.user
},
userAddress() {
const user = this.user
return user.province_name + '، ' + user.city_name + '، ' + user.address + '،کد پستی: ' + user.postal_code
},
filteredAgents() {
return this.agents.filter(item => {
if (this.draft.db_name === 'verity')
return item.representation_type === 'verity' || item.representation_type === 'both'
else if (this.draft.db_name === 'panatech')
return item.representation_type === 'panatech' || item.representation_type === 'both'
else return false
})
}
},
watch: {
show(newVal, oldVal) {
if (newVal) {
this.$axios
.get('/api/public/agents')
.then(res => {
this.agents = res.data
this.fetchingAgents = false
})
.catch(() => {
this.$message({
type: 'error',
message: 'در دریافت لیست نمایندگان مشکلی پیش آمده'
})
this.showModal = false
})
}
}
},
mounted() {
if (this.user.isAgent) this.agent = 'main'
},
methods: {
agentName(item) {
return (
'نمایندگی ' +
item.city_name +
' کد ' +
item.agent_code +
' ' +
'(' +
item.province_name +
', ' +
item.city_name +
', ' +
item.address +
')'
)
},
sendForm() {
// validations
if (this.postingForm) return
if (!this.termsOfUse)
return this.$message({
type: 'warning',
message: 'با قوانین و مقررات موافقت نکرده اید.'
})
if (!this.agent)
return this.$message({
type: 'warning',
message: 'نماینده مورد نظر را انتخاب کنید'
})
// set postingForm true
this.postingForm = true
const businessID = () => {
if (this.draft.db_name === 'panatech') return this.user.panatech_businessID
else if (this.draft.db_name === 'verity') return this.user.verity_businessID
else return ''
}
const agent = () => {
if (this.user.isAgent) return 'main'
else return this.agent
}
const data = {
BusinessID: businessID(),
Description: this.draft.description,
cAddress1: this.userAddress,
TransCCustom1: this.user.first_name + ' ' + this.user.last_name,
cTel1: this.user.mobile_number,
items: this.draft.items,
termsOfUse: this.termsOfUse,
draftId: this.draft._id,
db_name: this.draft.db_name,
agent: agent()
}
this.$axios
.post('/api/user/transaction', data)
.then(res => {
this.$message({
type: 'success',
message: 'فرم شما با موفقیت ارسال شد'
})
this.postingForm = false
this.$router.push({
name: 'account-guarantee-receipt',
query: { ttn: res.data.transNumber, host: res.data.host, db_name: this.draft.db_name }
})
})
.catch(e => {
this.postingForm = false
if (e.response.status === 422) {
this.$message({
type: 'error',
message: 'اطلاعات را بررسی و دوباره تلاش کنید'
})
} else if (e.response.status === 406) {
this.$message({
type: 'error',
message: e.response.data.message
})
} else {
this.$arpaError()
console.log(e)
}
})
}
}
}
</script>
+237
View File
@@ -0,0 +1,237 @@
<template>
<div class="user-aside">
<ul>
<template v-if="userContactConfirmed && user.isAgent">
<div class="seprator">
<div class="txt">
<span>امکانات نمایندگی</span>
</div>
<div class="line"></div>
</div>
<nuxt-link
:to="{ name: 'account-agents-inbox', query: { type: 'ttl' } }"
tag="li"
:class="$route.name.includes('account-agents-inbox') && 'active'"
>
<a>
<b v-if="agentInbox" class="badge">{{ agentInbox }}</b>
<i v-else class="fal fa-inbox"></i>
<span>صندوق ورودی</span>
</a>
</nuxt-link>
<nuxt-link
:to="{ name: 'account-agents-pieces', query: { type: 'temp' } }"
tag="li"
:class="$route.name.includes('account-agents-pieces') && 'active'"
>
<a>
<i class="fas fa-wrench"></i>
<span>درخواست قطعه</span>
</a>
</nuxt-link>
<nuxt-link
:to="{ name: 'account-agents-ops', query: { type: 'temp' } }"
tag="li"
:class="$route.name.includes('account-agents-ops') && 'active'"
>
<a>
<i class="fas fa-backpack"></i>
<span>درخواست قطعه داغی</span>
</a>
</nuxt-link>
<nuxt-link
:to="{ name: 'account-agents-buffer', query: { type: 'temp' } }"
tag="li"
:class="$route.name.includes('account-agents-buffer') && 'active'"
>
<a>
<i class="fab fa-buffer"></i>
<span>درخواست کالای بافر</span>
</a>
</nuxt-link>
<nuxt-link
:to="{ name: 'account-agents-guaranteeReports', query: { type: 'temp' } }"
tag="li"
:class="$route.name.includes('account-agents-guaranteeReports') && 'active'"
>
<a>
<i class="fas fa-file-chart-line"></i>
<span>ارسال گزارش عملکرد</span>
</a>
</nuxt-link>
<nuxt-link :to="{ name: 'account-agents-reports' }" tag="li">
<a>
<i class="fas fa-file-chart-pie"></i>
<span>گزارشات</span>
</a>
</nuxt-link>
<nuxt-link :to="{ name: 'account-agents-announcements' }" tag="li">
<a class="relativePos">
<b v-if="newAgentAnnosCount" class="badge">{{ newAgentAnnosCount }}</b>
<i v-else class="fas fa-bullhorn"></i>
<span>اطلاعیه ها</span>
</a>
</nuxt-link>
<nuxt-link :to="{ name: 'account-agents-edit-info' }" tag="li">
<a>
<i class="fas fa-edit"></i>
<span>ویرایش اطلاعات نمایندگی</span>
</a>
</nuxt-link>
<nuxt-link :to="{ name: 'account-agents-file-upload' }" tag="li">
<a>
<i class="fas fa-edit"></i>
<span>ویرایش مدارک نمایندگی</span>
</a>
</nuxt-link>
<div class="seprator">
<div class="txt">
<span>امکانات کاربری</span>
</div>
<div class="line"></div>
</div>
</template>
<nuxt-link :to="{ name: 'account' }" tag="li" exact class="username">
<a>
<i class="fas fa-user"></i>
<span class="singleLineTxt" :title="fullName">{{ fullName }}</span>
</a>
</nuxt-link>
<template v-if="userContactConfirmed">
<nuxt-link :to="{ name: 'account-post' }" tag="li">
<a>
<i class="fas fa-shipping-fast"></i>
<span>ارسال کالا</span>
</a>
</nuxt-link>
<nuxt-link :to="{ name: 'account-drafts' }" tag="li">
<a>
<b v-if="draftsCount" class="badge">{{ draftsCount }}</b>
<i v-else class="fas fa-mail-bulk"></i>
<span>پیش نویس ها</span>
</a>
</nuxt-link>
<nuxt-link
:to="{ name: 'account-guarantee', query: { type: 'ttl' } }"
tag="li"
:class="$route.name.includes('account-guarantee') && 'active'"
>
<a>
<i class="fal fa-list"></i>
<span>لیست گارانتی</span>
</a>
</nuxt-link>
<nuxt-link :to="{ name: 'account-history' }" tag="li">
<a>
<i class="fal fa-book"></i>
<span>مانده معین مشتری</span>
</a>
</nuxt-link>
<nuxt-link :to="{ name: 'account-addTicket' }" tag="li" exact>
<a>
<i class="fal fa-plus"></i>
<span>افزودن تیکت</span>
</a>
</nuxt-link>
<nuxt-link :to="{ name: 'account-tickets' }" tag="li">
<a class="relativePos">
<b v-if="unreadTickets" class="badge">{{ unreadTickets }}</b>
<i v-else class="fal fa-envelope"></i>
<span>تیکت ها</span>
</a>
</nuxt-link>
<nuxt-link :to="{ name: 'account-announcements' }" tag="li">
<a class="relativePos">
<b v-if="newUserAnnosCount" class="badge">{{ newUserAnnosCount }}</b>
<i v-else class="fas fa-bell"></i>
<span>اعلانات</span>
</a>
</nuxt-link>
<nuxt-link :to="{ name: 'account-survey' }" tag="li">
<a>
<i class="fas fa-chart-bar"></i>
<span>نظر سنجی</span>
</a>
</nuxt-link>
<nuxt-link :to="{ name: 'account-profile' }" tag="li">
<a>
<i class="fal fa-user-edit"></i>
<span>ویرایش پروفایل</span>
</a>
</nuxt-link>
</template>
<nuxt-link v-if="!user.email_confirmed || !user.mobile_confirmed" :to="{ name: 'account-verify' }" tag="li">
<a>
<i class="fas fa-badge-check"></i>
<span>تایید اطلاعات</span>
</a>
</nuxt-link>
<li>
<a @click="logOut">
<i class="fal fa-sign-out-alt"></i>
<span>خروج</span>
</a>
</li>
</ul>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
computed: {
...mapState({
unreadTickets: state => state.front.unreadTickets,
draftsCount: state => state.front.draftsCount,
agentInbox: state => state.front.agentInbox,
newUserAnnosCount: state => state.front.newUserAnnosCount,
newAgentAnnosCount: state => state.front.newAgentAnnosCount
}),
user() {
return this.$auth.user
},
fullName() {
return this.user.first_name + ' ' + this.user.last_name
},
userContactConfirmed() {
return this.user.email_confirmed
}
},
methods: {
logOut() {
this.$confirm('میخواهید از حساب کاربری خارج شوید؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(async () => {
try {
await this.$auth.logout()
location.reload()
} catch (e) {
console.log(e.response.data)
}
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
@@ -0,0 +1,34 @@
<template>
<div class="user-dashboard page" :class="pageClass">
<slot name="body" />
<div class="container">
<div class="row">
<div class="col-12">
<div class="panel">
<div class="panel-title">
<p class="singleLineTxt" :title="panelTitle">{{ panelTitle }}</p>
</div>
<slot />
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
pageClass: {
required: false,
type: String,
default: null
},
panelTitle: {
required: false,
type: String,
default: null
}
}
}
</script>