somewhere
This commit is contained in:
@@ -0,0 +1,225 @@
|
||||
<template>
|
||||
<div>
|
||||
<CustomSubHeader>
|
||||
<CBreadcrumb class="border-0 mb-0">{{ title }}</CBreadcrumb>
|
||||
<el-tag v-if="bufferRequest._openedBy && bufferRequest._openedBy.first_name" type="primary" class="ml-1">
|
||||
<span>اولین مشاهده توسط: </span>
|
||||
<span> {{ bufferRequest._openedBy.first_name + ' ' + bufferRequest._openedBy.last_name }} </span>
|
||||
</el-tag>
|
||||
<el-tag v-if="bufferRequest._updatedBy && bufferRequest._updatedBy.first_name" type="primary" class="ml-1">
|
||||
<span>تغییر وضعیت توسط: </span>
|
||||
<span> {{ bufferRequest._updatedBy.first_name + ' ' + bufferRequest._updatedBy.last_name }} </span>
|
||||
</el-tag>
|
||||
<CButton size="sm" color="primary" class="mr-auto" @click="$router.go(-1)">برگشت به صفحه قبل</CButton>
|
||||
</CustomSubHeader>
|
||||
|
||||
<CRow>
|
||||
<CCol v-if="!bufferRequest.archived && bufferRequest.status !== 'rejected'" lg="12">
|
||||
<CCard>
|
||||
<CCardBody>
|
||||
<CRow>
|
||||
<CCol lg="6">
|
||||
<h6>تغییر وضعیت فرم</h6>
|
||||
<el-divider></el-divider>
|
||||
<CButtonGroup>
|
||||
<!-- <CButton
|
||||
:color="bufferRequest.status === 'ongoing' ? 'warning' : 'light'"
|
||||
@click="updateStatus('ongoing')"
|
||||
>
|
||||
در دست اقدام
|
||||
</CButton> -->
|
||||
|
||||
<CButton
|
||||
:color="bufferRequest.status === 'waiting' ? 'warning' : 'light'"
|
||||
@click="updateStatus('waiting')"
|
||||
>
|
||||
در انتظار قطعه
|
||||
</CButton>
|
||||
|
||||
<el-popover
|
||||
v-model="deliverPopover"
|
||||
placement="bottom"
|
||||
width="160"
|
||||
:disabled="bufferRequest.status === 'delivered'"
|
||||
@click="deliveryPopover = true"
|
||||
>
|
||||
<el-input v-model="deliveryCode" placeholder="کد ارسال مرسوله"></el-input>
|
||||
<div class="mt-1" style="text-align: center">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
class="agentsStatus-popover-insideBtn"
|
||||
@click="updateStatus('delivered')"
|
||||
>ارسال</el-button
|
||||
>
|
||||
</div>
|
||||
|
||||
<CButton slot="reference" :color="bufferRequest.status === 'delivered' ? 'success' : 'light'">
|
||||
تحویل شده
|
||||
</CButton>
|
||||
</el-popover>
|
||||
</CButtonGroup>
|
||||
<div v-if="bufferRequest.status === 'delivered'" class="mt-3">
|
||||
<p>
|
||||
<span>کد ارسال مرسوله: </span>
|
||||
<b>{{ bufferRequest.deliveryCode || '-' }} </b>
|
||||
</p>
|
||||
</div>
|
||||
</CCol>
|
||||
<CCol lg="6">
|
||||
<h6>تاریخچه وضعیت های فرم</h6>
|
||||
<el-divider></el-divider>
|
||||
<el-table :data="bufferRequest.statusHistory" style="width: 100%">
|
||||
<el-table-column prop="name" label="وضعیت">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.status === 'temp'">پیشنویس</span>
|
||||
<span v-if="scope.row.status === 'sent'">ارسال</span>
|
||||
<span v-if="scope.row.status === 'ongoing'">در دست اقدام</span>
|
||||
<span v-if="scope.row.status === 'waiting'">در انتظار قطعه</span>
|
||||
<span v-if="scope.row.status === 'delivered'">تحویل شده</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="date" label="تاریخ">
|
||||
<template slot-scope="scope">
|
||||
<span style="display: inline-block; direction: ltr">{{ $jDateTime(scope.row.date) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</CCol>
|
||||
</CRow>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
</CCol>
|
||||
|
||||
<CCol lg="12">
|
||||
<CCard>
|
||||
<CCardBody>
|
||||
<el-collapse>
|
||||
<el-collapse-item title="مشخصات نماینده">
|
||||
<CForm>
|
||||
<CInput label="نام و نام خانوادگی" horizontal disabled :value="bufferRequest.agent_id.full_name" />
|
||||
<CInput label="کد ملی" horizontal disabled :value="bufferRequest.agent_id.national_code" />
|
||||
|
||||
<CInput label="تلفن همراه" horizontal disabled :value="bufferRequest.agent_id.mobile_number" />
|
||||
<CInput label="تلفن شرکت/تعمیرگاه" horizontal disabled :value="bufferRequest.agent_id.tel_number" />
|
||||
<CInput label="فکس شرکت/تعمیرگاه" horizontal disabled :value="bufferRequest.agent_id.fax_number" />
|
||||
|
||||
<CInput label="استان" horizontal disabled :value="bufferRequest.agent_id.province_name" />
|
||||
<CInput label="شهر" horizontal disabled :value="bufferRequest.agent_id.city_name" />
|
||||
<CInput label="آدرس" horizontal disabled :value="bufferRequest.agent_id.address" />
|
||||
<CInput label="کد پستی" horizontal disabled :value="bufferRequest.agent_id.postal_code" />
|
||||
<CInput label="نام شرکت/تعمیرگاه" horizontal disabled :value="bufferRequest.agent_id.store_name" />
|
||||
</CForm>
|
||||
<el-divider></el-divider>
|
||||
<div style="text-align: center">
|
||||
<nuxt-link :to="{ name: 'admin-agents-agent', params: { agent: bufferRequest.user_id } }"
|
||||
>مشاهده اکانت نماینده</nuxt-link
|
||||
>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
</CCol>
|
||||
|
||||
<CCol lg="12">
|
||||
<CCard>
|
||||
<CCardBody>
|
||||
<CRow>
|
||||
<CCol>
|
||||
<CForm>
|
||||
<CTextarea label="توضیحات فرم" horizontal disabled rows="5" :value="bufferRequest.description" />
|
||||
</CForm>
|
||||
<h6>لیست کالاهای بافر درخواستی:</h6>
|
||||
<el-divider></el-divider>
|
||||
<el-table :data="bufferRequest.items" style="width: 100%">
|
||||
<el-table-column type="index" label="#"> </el-table-column>
|
||||
|
||||
<el-table-column prop="ItemName" label="نام کالا" width=""></el-table-column>
|
||||
|
||||
<el-table-column prop="bufferQuantity" label="تعداد" width=""></el-table-column>
|
||||
</el-table>
|
||||
</CCol>
|
||||
</CRow>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
</CCol>
|
||||
</CRow>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AdminBufferRequestDetails',
|
||||
layout: 'admin',
|
||||
async asyncData({ $axios, params, error }) {
|
||||
try {
|
||||
const bufferRequest = await $axios.get(`/api/admin/br/${params.brId}`)
|
||||
return {
|
||||
bufferRequest: bufferRequest.data
|
||||
}
|
||||
} catch (e) {
|
||||
error({ status: 404, message: 'Page not found' })
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: 'مشاهده درخواست کالای بافر',
|
||||
bufferRequest: null,
|
||||
deliverPopover: false,
|
||||
deliveryCode: '',
|
||||
validation: {}
|
||||
}
|
||||
},
|
||||
head() {
|
||||
return {
|
||||
title: this.title
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateStatus(status) {
|
||||
if (status === this.bufferRequest.status) return
|
||||
if (this.bufferRequest.status === 'delivered') return
|
||||
const title = 'هشدار'
|
||||
function getMsg() {
|
||||
const msg1 = 'با تغییر وضعیت فرم به در انتظار قطعه بلافاصله پیامک اطلاع رسانی برای نماینده ارسال خواهد شد'
|
||||
const msg2 =
|
||||
'با تغییر وضعیت فرم به تحویل شده بلافاصله پیامک اطلاع رسانی برای نماینده ارسال خواهد شد. توجه داشته باشید بعدا نمیتوانید کد ارسال مرسوله را تغییر دهید.'
|
||||
|
||||
if (status === 'ongoing') return msg1
|
||||
else return msg2
|
||||
}
|
||||
|
||||
this.$confirm(getMsg(), title, {
|
||||
confirmButtonText: 'ادامه',
|
||||
cancelButtonText: 'لغو',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.$axios
|
||||
.put(`/api/admin/brStatus/${this.bufferRequest._id}`, { status, deliveryCode: this.deliveryCode })
|
||||
.then(response => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: response.data.message
|
||||
})
|
||||
this.deliveryCode = ''
|
||||
this.$nuxt.refresh()
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: err.response.data.message
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: 'عملیات لغو شد'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<div>
|
||||
<CustomSubHeader>
|
||||
<CBreadcrumb class="border-0 mb-0">{{ title }}</CBreadcrumb>
|
||||
</CustomSubHeader>
|
||||
|
||||
<CCard>
|
||||
<CCardHeader>
|
||||
<slot name="header">
|
||||
<i class="fas fa-filter"></i>
|
||||
<b>فیلتر ها</b>
|
||||
</slot>
|
||||
</CCardHeader>
|
||||
|
||||
<CCardBody>
|
||||
<CRow>
|
||||
<CCol sm="12">
|
||||
<CButtonGroup>
|
||||
<CButton
|
||||
:color="filterType === 'all' ? 'primary' : 'light'"
|
||||
:class="filterType === 'all' && 'selected'"
|
||||
@click="filterType = 'all'"
|
||||
>
|
||||
<span>همه</span>
|
||||
<span> ({{ brList.length }}) </span>
|
||||
</CButton>
|
||||
|
||||
<CButton
|
||||
:color="filterType === 'sent' ? 'primary' : 'light'"
|
||||
:class="filterType === 'sent' && 'selected'"
|
||||
@click="filterType = 'sent'"
|
||||
>
|
||||
<span>جدید</span>
|
||||
<span> ({{ getListCountByStatus('sent') }}) </span>
|
||||
</CButton>
|
||||
|
||||
<CButton
|
||||
:color="filterType === 'ongoing' ? 'primary' : 'light'"
|
||||
:class="filterType === 'ongoing' && 'selected'"
|
||||
@click="filterType = 'ongoing'"
|
||||
>
|
||||
<span>در دست اقدام</span>
|
||||
<span> ({{ getListCountByStatus('ongoing') }}) </span>
|
||||
</CButton>
|
||||
|
||||
<CButton
|
||||
:color="filterType === 'waiting' ? 'primary' : 'light'"
|
||||
:class="filterType === 'waiting' && 'selected'"
|
||||
@click="filterType = 'waiting'"
|
||||
>
|
||||
<span>در انتظار قطعه</span>
|
||||
<span> ({{ getListCountByStatus('waiting') }} )</span>
|
||||
</CButton>
|
||||
|
||||
<CButton
|
||||
:color="filterType === 'delivered' ? 'primary' : 'light'"
|
||||
:class="filterType === 'delivered' && 'selected'"
|
||||
@click="filterType = 'delivered'"
|
||||
>
|
||||
<span>تحویل شده</span>
|
||||
<span> ({{ getListCountByStatus('delivered') }}) </span>
|
||||
</CButton>
|
||||
</CButtonGroup>
|
||||
</CCol>
|
||||
<CCol sm="12">
|
||||
<el-divider></el-divider>
|
||||
</CCol>
|
||||
<CCol sm="12">
|
||||
<h4>جستجو در لیست:</h4>
|
||||
<el-input
|
||||
v-model="filterText"
|
||||
clearable
|
||||
placeholder="کد پیگیری - کد نماینده - شماره موبایل نماینده - کد ملی نماینده - استان - شهر"
|
||||
style="display: inline-block; max-width: 500px; margin-top: 8px"
|
||||
></el-input>
|
||||
</CCol>
|
||||
</CRow>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
|
||||
<CCard>
|
||||
<CCardHeader>
|
||||
<slot name="header">
|
||||
<CIcon name="cil-grid" />
|
||||
{{ list_title }}
|
||||
</slot>
|
||||
</CCardHeader>
|
||||
|
||||
<CCardBody>
|
||||
<el-table
|
||||
:data="filteredItems"
|
||||
style="width: 100%"
|
||||
:row-class-name="({ row, rowIndex }) => row.status === 'sent' && 'unread'"
|
||||
>
|
||||
<el-table-column type="index" label="#"> </el-table-column>
|
||||
|
||||
<el-table-column label="تاریخ ثبت درخواست" width="">
|
||||
<template slot-scope="scope">
|
||||
<span> {{ $jDate(scope.row.sendDate) }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="trackingCode" label="کد پیگیری" width=""> </el-table-column>
|
||||
|
||||
<el-table-column prop="agent_id.province_name" label="استان" width=""> </el-table-column>
|
||||
|
||||
<el-table-column prop="agent_id.city_name" label="شهر" width=""> </el-table-column>
|
||||
|
||||
<el-table-column prop="agent_id.agent_code" label="کد نماینده" width=""> </el-table-column>
|
||||
|
||||
<el-table-column label="وضعیت" width="" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.status === 'sent'" type="info">جدید</el-tag>
|
||||
<el-tag v-if="scope.row.status === 'ongoing'" type="primary">در دست اقدام</el-tag>
|
||||
<el-tag v-if="scope.row.status === 'waiting'" type="warning">در انتظار قطعه</el-tag>
|
||||
<el-tag v-if="scope.row.status === 'delivered'" type="success">تحویل شده</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="بررسی" width="65" align="center">
|
||||
<template slot-scope="scope">
|
||||
<CButton
|
||||
:key="scope.row._id"
|
||||
color="success"
|
||||
variant="outline"
|
||||
:to="{ name: 'admin-buffer-requests-brId', params: { brId: scope.row._id } }"
|
||||
>
|
||||
<i class="fal fa-eye"></i>
|
||||
</CButton>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</CCardBody>
|
||||
</CCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AdminBufferRequestsList',
|
||||
layout: 'admin',
|
||||
async asyncData({ $axios, error }) {
|
||||
try {
|
||||
const brList = await $axios.get('/api/admin/brList')
|
||||
return {
|
||||
brList: brList.data
|
||||
}
|
||||
} catch (err) {
|
||||
error({ status: 404, message: 'There is a problem here' })
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: 'درخواست های کالای بافر',
|
||||
list_title: 'لیست',
|
||||
brList: null,
|
||||
filterText: ''
|
||||
}
|
||||
},
|
||||
head() {
|
||||
return {
|
||||
title: this.title
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filteredItems() {
|
||||
const filterData = this.brList.filter(item =>
|
||||
this.filterType === 'all' ? item : item.status === this.filterType
|
||||
)
|
||||
const filterText = this.filterText
|
||||
if (!this.filterText.length) return filterData
|
||||
else
|
||||
return filterData.filter(item => {
|
||||
return (
|
||||
item.trackingCode.includes(filterText) ||
|
||||
item.agent_id.agent_code.includes(filterText) ||
|
||||
item.agent_id.full_name.includes(filterText) ||
|
||||
item.agent_id.mobile_number.includes(filterText) ||
|
||||
item.agent_id.national_code.includes(filterText) ||
|
||||
item.agent_id.province_name.includes(filterText) ||
|
||||
item.agent_id.city_name.includes(filterText)
|
||||
)
|
||||
})
|
||||
},
|
||||
filterType: {
|
||||
get() {
|
||||
return this.$route.query.status
|
||||
},
|
||||
set(val) {
|
||||
this.$router.push({ name: 'admin-buffer-requests', query: { status: val } })
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getListCountByStatus(status) {
|
||||
return this.brList.filter(item => item.status === status).length
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scopped>
|
||||
.selected {
|
||||
-webkit-transform: scale(1.1);
|
||||
-moz-transform: scale(1.1);
|
||||
-ms-transform: scale(1.1);
|
||||
-o-transform: scale(1.1);
|
||||
transform: scale(1.1);
|
||||
z-index: 2;
|
||||
|
||||
span {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.unread {
|
||||
background: rgba(orange, 0.1) !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user