Init project

This commit is contained in:
alirezakarari
2021-01-09 20:53:13 +03:30
commit 8d06c89a89
1005 changed files with 105625 additions and 0 deletions
+131
View File
@@ -0,0 +1,131 @@
<template>
<div>
<a-button class="editable-add-btn" @click="openAddAttrModal">
افزودن ردیف
</a-button>
<a-table bordered :data-source="attributes" :columns="columns" style="margin-top: 1em">
<template slot="op" slot-scope="text, record">
<a-tooltip placement="bottomLeft">
<template slot="title">
<span>ویرایش</span>
</template>
<feather-icon icon="EditIcon" @click="edit(record.id,record)" svgClasses="w-6 h-6 text-success" style="cursor: pointer"/>
</a-tooltip>
<a-tooltip>
<a-popconfirm placement="top" ok-text="بله" cancel-text="خیر" @confirm="() => onDelete(record.id)">
<template slot="title">
<p>آیا مطمئن به حذف رکورد مورد نظر هستید ؟</p>
</template>
<feather-icon icon="TrashIcon" svgClasses="h-6 w-6 text-danger" class="cursor-pointer mx-1"/>
</a-popconfirm>
<span slot="title">حذف</span>
</a-tooltip>
</template>
</a-table>
<AdvAttributeModal ref="modalAttr" :visible.sync="visibleAdvAttrModal" :model="tempAttrModel" :id="id" @submit="handleAdd"/>
</div>
</template>
<script>
import AdvAttributeModal from "./AdvAttributeModal";
class Attr {
id = 0;
title;
type;
value;
editable = false;
}
export default {
name: "AdvAttributeComponent",
components: {AdvAttributeModal},
props: ['attributes','id','attr'],
data(){
return{
visibleAdvAttrModal:false,
tempAttrModel:undefined,
columns: [
{
title: 'نام',
dataIndex: 'title',
customRender: (text, row, index)=>{
console.log(text, row, index,'indexx')
}
},
{
title: 'نوع',
dataIndex: 'attribute.type_str',
},
{
title: 'مقدار',
dataIndex: 'value',
},
{
title: 'عملیات',
dataIndex: 'op',
scopedSlots: {customRender: 'op'},
}
],
count: 0,
editingKey:''
}
},
methods:{
onDelete(id) {
const dataSource = [...this.attributes];
this.attributes = dataSource.filter(item => item.id !== id);
},
openAddAttrModal() {
this.tempAttrModel = new Attr();
this.visibleAdvAttrModal = true;
this.$refs.modalAttr.getCollection()
},
handleAdd(newKey,newVal) {
const {count} = this
this.count = count + 1
console.log(this.tempAttrModel,'newData')
let newObj = Object.assign({},this.tempAttrModel)
console.log(newObj,'newObj')
this.attr[newKey] = newVal
this.attributes = [...this.attributes, newObj ];
console.log(this.attributes,'this.attributes')
console.log(this.attr,'attr')
// newObj.id = count
this.$emit('handleAdd',this.attr);
this.visibleAdvAttrModal = false;
},
handleChange(value, id, column) {
console.log(column,'colllll')
const newData = [...this.attributes];
const target = newData.filter(item => id === item.id)[0];
if (target) {
target[column] = value;
this.attributes = newData;
}
},
edit(record,recording){
console.log(recording,'record')
this.tempAttrModel = record;
const newData = [...this.attributes];
const target = newData.filter(item => record === item.id)[0];
this.editingKey = record;
if (target) {
target.editable = true;
this.attributes = newData;
}
},
},
mounted() {
}
}
</script>
<!--var arr = [{key:"11", value:"1100"},{key:"22", value:"2200"}];-->
<!--var object = arr.reduce(-->
<!--(obj, item) => Object.assign(obj, { [item.key]: item.value }), {});-->
<!--this.attributes = this.data.attributes.reduce((obj,item)=> Object.assign(obj, { [item.attribute_id]: item.value }),{});-->
<!--console.log(object)-->
+86
View File
@@ -0,0 +1,86 @@
<template>
<div>
<AModal v-model="visible" title="افزودن صفت" ok-text="تایید" cancel-text="رد">
<AForm :form="form" @submit="submit">
<AFormItem label="عنوان">
<a-select v-model="model.title">
<a-select-option v-for="item in collection" :value="item.attribute_id" v-if="item.attribute">
{{ item.attribute.title }} , {{ item.attribute.type_str }}
</a-select-option>
</a-select>
</AFormItem>
<AFormItem label="مقدار">
<a-input
v-model="model.value"
autocomplete="off"
/>
</AFormItem>
<AFormItem>
<a-button html-type="submit" type="primary">
ثبت صفت
</a-button>
</AFormItem>
<AFormItem v-if="model.editable">
<a-input v-model="model.editable" v-show="false"/>
</AFormItem>
</AForm>
</AModal>
</div>
</template>
<script>
import axios from '@/axios'
export default {
name: "AdvAttributeModal",
props: {
visible: {
type: Boolean
},
model: {
default: {}
},
id:{
type:Number
}
},
data(){
return{
attrType:[
{id:1, title:'input'},
{id:2, title:'dropdown'},
{id:3, title:'radio_button'},
{id:4, title:'checkbox'},
{id:5, title:'input_number'},
{id:6, title:'category'},
{id:7, title:'cheep'},
{id:8, title:'email'},
{id:9, title:'mobile'},
{id:10, title:'phone'},
{id:11, title:'price'},
{id:12, title:'date'},
{id:13, title:'slider'},
{id:14, title:'other'}
],
form: this.$form.createForm(this, {name: 'coordinated'}),
collection:null
}
},
methods: {
submit(e) {
e.preventDefault()
this.$emit('submit',this.model.title,this.model.value);
},
async getCollection(){
const {data} = await axios.get(`site/collection/${this.id}`)
this.collection = data.attributes
}
}
}
</script>
<style scoped>
</style>
+437
View File
@@ -0,0 +1,437 @@
<template>
<a-form :form="form" @submit="handleSubmit">
<a-spin type="loading" :spinning="loading">
<vx-card title="ویرایش آگهی">
<div class="grid grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-2 md:gap-2 xl:grid-cols-2 lg:gap-4 xl:gap-4">
<a-form-item label="عنوان آگهی">
<a-input
v-decorator="['title', { rules: [{ required: true, message: 'واردکردن دسته الزامی است.' }] }]"
autocomplete="off"
/>
</a-form-item>
<a-form-item label="توضیحات آگهی">
<a-textarea
v-decorator="['body', { rules: [{ required: false, message: '' }] }]" autocomplete="off"/>
</a-form-item>
<a-form-item label="همراه آگهی دهنده">
<a-input
v-decorator="['phone', { rules: [{ required: false, message: 'واردکردن دسته الزامی است.' }] }]"
autocomplete="off"
:disabled="true"
/>
</a-form-item>
<a-form-item label="همراه بازاریاب">
<a-input
v-decorator="['marketer.mobile', { rules: [{ required: false, message: 'واردکردن دسته الزامی است.' }] }]"
autocomplete="off"
:disabled="true"
/>
</a-form-item>
<a-form-item label="دسته">
<a-tree-select
v-decorator="['collection_id', { rules: [{ required: false, message: 'واردکردن دسته الزامی است.' }] }]"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="collection"
placeholder=""
tree-default-expand-all
:replaceFields="replaceFields"
@change="accessIdAdv"
/>
</a-form-item>
<a-form-item label="فروشگاه ثبت کننده">
<a-input
style="width: 100%"
v-decorator="['store.title']" :disabled="true"/>
</a-form-item>
<a-form-item label="تعداد بازدید">
<a-input
v-decorator="['view_count', { rules: [{ required: false, message: 'واردکردن دسته الزامی است.' }] }]"
autocomplete="off"
:disabled="true"
/>
</a-form-item>
<a-form-item label="شهر">
<a-select
show-search
v-decorator="['city_id',{ rules: [{ required: true, message: 'واردکردن دسته الزامی است.' }] }]"
option-filter-prop="children"
:filter-option="filterOption"
>
<a-select-option v-for="(item, key, index) in cities" :value="key" :key="index">
{{item.join(' , ')}}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="شماره نمایش داده شده در آگهی">
<a-input
v-decorator="['phone', { rules: [{ required: false, message: 'واردکردن دسته الزامی است.' }] }]"
autocomplete="off"
:disabled="true"
/>
</a-form-item>
<a-form-item label="تاریخ انقضا">
<a-input
v-decorator="['expired_at', { rules: [{ required: false, message: 'واردکردن دسته الزامی است.' }] }]"
autocomplete="off"
:disabled="true"
/>
<!-- <label></label>-->
<!-- <date-picker-->
<!-- :auto-submit="true"-->
<!-- color="#ff9800"-->
<!-- v-model="expired_at"-->
<!-- style="margin-top: 0.5em"-->
<!-- :initial-value="null"-->
<!-- />-->
</a-form-item>
<a-form-item>
<a-checkbox :disabled="true" v-decorator="['is_swap',{initialValue:false,valuePropName: 'checked'}]">
تمایل به معاوضه
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox :disabled="true" v-decorator="['for_store',{initialValue:false,valuePropName: 'checked'}]">
ثبت شده برای فروشگاه
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox :disabled="true" v-decorator="['for_other',{initialValue:false,valuePropName: 'checked'}]">
ثبت آگهی برای شخص دیگر
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox :disabled="true" v-decorator="['active_chat',{valuePropName: 'checked'}]">
فعال کردن چت
</a-checkbox>
</a-form-item>
<a-form-item label="برچسب ها">
<TagCreator></TagCreator>
</a-form-item>
<!-- <a-checkbox @change="activeImage">تایید تصاویر</a-checkbox>-->
<a-form-item label="تصاویر آگهی">
<Xupload url="admin/file" v-model="images" @change="changeUploadImage"/>
</a-form-item>
</div>
<AdvAttributeComponent :attributes="attributes" :attr="getAttr" :id="data.collection_id" @handleAdd="saveAttrTable"/>
<a-button html-type="submit" type="primary" ghost style="margin-left: 3rem;margin-top: 1rem">
ذخیره تغییرات
</a-button>
</vx-card>
</a-spin>
</a-form>
</template>
<script>
import axios from '@/axios'
import AdvAttributeModal from "./AdvAttributeModal";
import AdvAttributeComponent from "./AdvAttributeComponent";
import AdvImagesComponent from "./AdvImagesComponent";
import TagCreator from '../../components/tag-creator/TagCreator'
import * as moment from 'jalali-moment';
import Xupload from '../../components/x-upload/XUpload'
export default {
name: "adv-add",
components: {
AdvImagesComponent,
AdvAttributeComponent,
AdvAttributeModal,
TagCreator,
Xupload
},
data() {
return {
activeConfirm:false,
activeTitleBtn:false,
activeImageBtn:false,
attributes: [],
collection: [],
rejectReason: [],
provinces: [],
provinceCities: [],
images: [],
cities: [],
stores: [],
tags: [],
visibleConfirmForm: false,
cancelAdv: false,
value: this.text,
editable: false,
tempAttrModel: undefined,
count: 2,
visibleAdvAttrModal: false,
attr: {
title: '',
type: '',
value: '',
for_swap: ''
},
adv_for_other: true,
adv_has_store: true,
previewVisible: false,
previewImage: '',
form: this.$form.createForm(this, {name: 'coordinated'}),
expired_at:'',
replaceFields:{ children:'children', title:'title', key:'key', value: 'id' },
receiveAttr:null,
getAttr:null,
collection_adv:null
}
},
methods: {
saveAttrTable(value){
console.log(value,'valuehjjjjj')
this.receiveAttr = value
},
accessIdAdv(id){
this.collection_adv = id
},
handleSubmit(e) {
e.preventDefault();
this.form.validateFields((err, values) => {
if (!err) {
try{
const rec_attr = this.receiveAttr
values.attributes = rec_attr
console.log(rec_attr,'dfffffffffff')
values.images = this.images
this.$store.dispatch('advModel/save', {
id: this.$route.params.id,
data:values
});
this.$ntSet('عملیات با موفقیت انجام شد.')
this.$router.push('/adv/list')
}catch ({message}) {
this.$ntSetError(message)
}finally {
}
// this.form.resetFields()
}
});
this.visibleConfirmForm = false;
},
activeTitle(e){
this.activeTitleBtn = e.target.checked;
if(this.activeTitleBtn === true && this.activeImageBtn === true){
this.activeConfirm = true
}
else {
this.activeConfirm = false
}
console.log('activeConfirm',this.activeConfirm);
},
changeUploadImage(file){
file.subject = 1
file.alt = null
file.description = null
file.collection_id = this.collection_adv
console.log(file,'fileeee')
},
activeImage(e){
this.activeImageBtn = e.target.checked;
if(this.activeTitleBtn === true && this.activeImageBtn === true){
this.activeConfirm = true
}
else {
this.activeConfirm = false
}
console.log('activeConfirm',this.activeConfirm);
},
cancellForm() {
this.cancelAdv = true;
},
async getCollection() {
const {data} = await axios.get('admin/adv/collection')
console.log(data,'collection')
this.collection = data
},
async getRejectReason() {
await axios.get('admin/adv/reject')
.then((res) => {
console.log(res.data, 'rejectReason')
return this.rejectReason = res.data
})
},
async getStores() {
const {data} = await axios.get('admin/adv/store')
this.stores = data
},
async getCity() {
const {data} = await axios.get('site/city');
console.log(data,'city')
this.cities = data;
// this.provinces = new Set(Object.values(data).map((item) => item[0]));
},
// async getCity() {
// const {data} = await axios.get('site/city');
// this.provinceCities = data;
// this.provinces = new Set(Object.values(data).map((item) => item[0]));
// },
//
// changeProvinces(value) {
// let cities = [];
// for (var i in this.provinceCities) {
// if (this.provinceCities[i][0] == value) {
// cities.push({id: i, title: this.provinceCities[i][1]});
// }
// }
// this.form.setFieldsValue({city: undefined});
// this.cities = cities;
// },
successUpload() {
console.log('ok')
this.$vs.notify({color: 'success', title: 'Upload Success', text: 'Lorem ipsum dolor sit amet, consectetur'})
},
addDomain() {
this.dynamicValidateForm.domains.push({
value: '',
key: Date.now(),
});
},
removeDomain(item) {
let index = this.dynamicValidateForm.domains.indexOf(item);
if (index !== -1) {
this.dynamicValidateForm.domains.splice(index, 1);
}
},
filterOption(input, option) {
return (
option.componentOptions.children[0].text.indexOf(input) >= 0
)
},
},
computed: {
loading() {
return this.$store.state.advModel.loading;
},
editAdvById() {
return this.$route.params && this.$route.params.id !== undefined
},
data() {
console.log('this.$store.state.adv.collectionSingle', this.$store.state.advModel.collectionSingle);
return this.$store.state.advModel.collectionSingle
},
},
mounted() {
this.getCollection();
this.getStores();
this.getRejectReason();
this.getCity();
if (this.editAdvById) {
this.$store.dispatch('advModel/advId', this.$route.params.id).then(() => {
// this.data.tags = `${this.data.tags}`
this.data.collection_id = `${this.data.collection_id}`
this.data.city_id = `${this.data.city_id}`
this.images = this.data.images;
this.attributes = this.data.attributes
this.getAttr = this.attributes.reduce((obj,item)=> Object.assign(obj,{[item.attribute_id]: item.value}),{});
console.log(this.getAttr,'getAttr')
this.form.setFieldsValue(this.data);
this.tags = this.data.tags
if (this.data.marketer_id !== null) {
this.adv_for_other = true
}
if (this.data.store_id !== null) {
this.adv_has_store = true
}
});
}
}
}
</script>
<style>
@media (min-width: 940px) {
.checkbox {
display: grid;
grid-template-columns: repeat(4, 1fr);
}
[dir] .ant-form-item {
margin-bottom: 0
}
}
.content-area__content {
padding-bottom: 30px;
}
[dir=rtl] .ant-notification {
z-index: 100000000 !important;
}
.v-nav-menu .vs-sidebar {
z-index: 1 !important;
}
[dir=rtl] .ant-checkbox-wrapper + .ant-checkbox-wrapper {
margin-right: 0 !important;
}
.ant-checkbox-wrapper {
padding: 10px 0;
}
.ant-input-number {
width: 100%
}
.grow-space {
padding: 0 10px
}
[dir=rtl] .ant-checkbox-wrapper + .ant-checkbox-wrapper[data-v-6c853ba7] {
white-space: nowrap;
}
.birth-day{
margin-top: .3em;
}
.birth-day label{
color: rgba(0, 0, 0, 0.85);
}
[dir=rtl] .ant-checkbox-inner::after{
right: 55%;
top: 35%;
border-left: 0 !important;
-webkit-transform: rotate(-45deg) scale(0) translate(50%, -50%);
transform: rotate(-45deg) scale(0) translate(50%, -50%);
}
[dir=rtl] .ant-tree-checkbox-checked .ant-tree-checkbox-inner::after{
border-left: 0 !important;
border-right: 2px solid #fff;
}
[dir=rtl] .ant-tree-checkbox-checked .ant-tree-checkbox-inner::after {
border-left: 0 !important;
border-right: 2px solid #fff;
-webkit-transform: rotate(25deg) scale(1) translate(50%, -50%);
transform: rotate(25deg) scale(1) translate(50%, -50%);
}
[dir=rtl] .ant-checkbox-checked .ant-checkbox-inner::after {
border-right: 2px solid #fff;
-webkit-transform: rotate(25deg) scale(1) translate(50%, -50%);
transform: rotate(25deg) scale(1) translate(50%, -50%);
}
</style>
+62
View File
@@ -0,0 +1,62 @@
<!-- =========================================================================================
File Name: UserList.vue
Description: User List page
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
========================================================================================== -->
<template>
<div id="page-user-list">
<vx-card title="لیست درخواست های آگهی های منقضی شده" class="vx-card">
<XTable
:model="model">
</XTable>
</vx-card>
</div>
</template>
<script>
import {AgGridVue} from 'ag-grid-vue'
import '@/assets/scss/vuexy/extraComponents/agGridStyleOverride.scss'
import vSelect from 'vue-select'
import FeatherIcon from '@/components/FeatherIcon.vue'
import * as TableCol from './AdvExpiredListModel';
import CustomerView from "@/views/apps/customer/CustomerView";
import axios from "@/axios";
import XTable from "../../components/x-table/XTable";
export default {
components: {
XTable,
CustomerView,
vSelect,
FeatherIcon,
},
data() {
return {
variantLoading: false,
productLoading: false,
variantPopup: false,
model: null,
components: {
}
}
},
created() {
this.model = TableCol.default;
}
}
</script>
<style>
.ant-popover {
z-index: 25000000;
}
</style>
+14
View File
@@ -0,0 +1,14 @@
import XTbl, {Xtc} from '../../components/x-table/index';
const tbl = new XTbl('/admin/request', 'لیست درخواست های آگهی های منقضی شده');
tbl.add(new Xtc('id', 'کد درخواست').filterNumber());
tbl.add(new Xtc('customer.mobile', 'موبایل درخواست دهنده').filterText());
tbl.add(new Xtc('adv_id', 'کد آگهی').filterNumber());
tbl.add(new Xtc('adv.collection.title', 'دسته آگهی').filterText());
tbl.add(new Xtc('adv.city', 'شهر آگهی').filterText());
tbl.add(new Xtc('caj', 'تاریخ ثبت درخواست').filterDate());
tbl.add(new Xtc('adv.owner.mobile', 'مالک اگهی').filterText());
tbl.add(new Xtc('adv.marketer.mobile', 'بازاریاب آگهی').filterText());
export default tbl;
+104
View File
@@ -0,0 +1,104 @@
<template>
<div>
<div v-for="img in model">
<img :src="img.src">
</div>
<a-upload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
list-type="picture-card"
@preview="handlePreview"
@change="handleChange"
>
<div v-if="fileList.length < 8">
<a-icon type="plus"/>
<div class="ant-upload-text">
Upload
</div>
</div>
</a-upload>
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
<img alt="example" style="width: 100%" :src="previewImage"/>
</a-modal>
</div>
</template>
<script>
// function getBase64(file) {
// return new Promise((resolve, reject) => {
// const reader = new FileReader();
// reader.readAsDataURL(file);
// reader.onload = () => resolve(reader.result);
// reader.onerror = error => reject(error);
// });
// }
export default {
name: "AdvImagesComponent",
props: {
model: {
default: []
}
},
data() {
return {
previewVisible: false,
previewImage: '',
fileList: [
{
uid: '-1',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
uid: '-2',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
uid: '-3',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
uid: '-4',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
uid: '-5',
name: 'image.png',
status: 'error',
},
],
}
},
methods: {
handleCancel() {
this.previewVisible = false;
},
async handlePreview(file) {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
},
handleChange({fileList}) {
this.fileList = fileList;
},
},
mounted() {
console.log('images',this.model);
}
}
</script>
<style scoped>
</style>
+495
View File
@@ -0,0 +1,495 @@
<template>
<div id="page-user-list">
<vx-card title="لیست آگهی های ثبت شده" class="vx-card">
<XTable :model="model" ref="adv">
<span slot="ad_adv" slot-scope="text,record">
<span v-for="item in text.record.adv_ipc">
{{ item.ipc.title }}
</span>
</span>
<span slot="attr" slot-scope="text,record">
<span v-for="item in text.record.attributes">
<ATag>{{ item.title }}</ATag>
</span>
</span>
<span slot="swap" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.is_swap"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="active_adv" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.active"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="lock" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.lock"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="opt" slot-scope="text,record" class="flex space-x-2">
<a-tooltip placement="bottomLeft">
<template slot="title">
<span>نظارت</span>
</template>
<a-popconfirm
title="آیا می خواهید آگهی تایید کنید؟"
ok-text="تایید"
cancel-text="رد"
@confirm="okAdv(text.record.id)"
@cancel="cancelAdv(text.record.id)"
>
<feather-icon icon="EyeIcon" svgClasses="w-5 h-5 text-warning" style="cursor: pointer"/>
</a-popconfirm>
</a-tooltip>
<a-tooltip placement="bottomLeft">
<template slot="title">
<span>فعالسازی آگهی</span>
</template>
<a-popconfirm
title="آگهی مورد نظر فعال شود؟"
ok-text="بله"
cancel-text="خیر"
@confirm="okActiveAdv(text.record.id)"
@cancel="cancelActiveAdv(text.record.id)"
>
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-primary" style="cursor: pointer"/>
</a-popconfirm>
</a-tooltip>
<a-tooltip placement="bottomLeft">
<template slot="title">
<span>قفل آگهی</span>
</template>
<a-popconfirm
title="قفل آگهی مورد نظر باز شود؟"
ok-text="بله"
cancel-text="خیر"
@confirm="okLockAdv(text.record.id)"
>
<feather-icon icon="LockIcon" svgClasses="w-5 h-5 text-success" style="cursor: pointer"/>
</a-popconfirm>
</a-tooltip>
<a-tooltip placement="bottomLeft">
<template slot="title">
<span>حذف</span>
</template>
<a-popconfirm
title="آیا می خواهید حذف کنید؟"
ok-text="بله"
cancel-text="خیر"
@confirm="okDelete(text.record.id)"
>
<feather-icon icon="TrashIcon" svgClasses="w-5 h-5 text-danger" style="cursor: pointer"/>
</a-popconfirm>
</a-tooltip>
<a-tooltip placement="bottomLeft">
<template slot="title">
<span>مشاهده آگهی</span>
</template>
<feather-icon icon="MonitorIcon" @click="viewAdv(text.record.id)" svgClasses="w-5 h-5" style="cursor: pointer"/>
</a-tooltip>
</span>
</XTable>
<a-modal v-model="visibleReasonReject" ok-text="ارسال" title="دلیل رد" :ok-button-props="{ props: { disabled: true } }" :cancel-button-props="{ props: { disabled: true } }">
<a-form :form="formSuperVisionCancel" @submit="submitRejectAdv">
<a-form-item label="دلیل رد">
<a-radio-group v-decorator="['reject_reason',{ initialValue:null,rules: [{ required: false, message:'' }] }]">
<a-radio v-for="item in radioGroupReason" :value="item">
{{ item }}
</a-radio>
</a-radio-group>
<a-input
v-decorator="['reject_reason', { rules: [{ required: true, message: 'لطفامقدار وارد کنید.' }] }]"
autocomplete="off"
/>
</a-form-item>
<a-form-item>
<a-button html-type="submit">
ثبت
</a-button>
</a-form-item>
</a-form>
</a-modal>
<a-modal :visible="visibleGetOneById" :width="1000" ok-text="ارسال" @cancel="cancelModalOneId">
<div v-if="isGetData">
<ASkeleton/>
</div>
<div v-else>
<div v-if="getAdvOneId">
<a-descriptions title="اطلاعات آگهی">
<a-descriptions-item label="عنوان آگهی">
{{ getAdvOneId.title }}
</a-descriptions-item>
<a-descriptions-item label="فعالسازی چت">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="getAdvOneId.active_chat"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</a-descriptions-item>
<a-descriptions-item label="فعالسازی پیامک">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="getAdvOneId.active_sms"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</a-descriptions-item>
<a-descriptions-item label="فعالسازی تلفن">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="getAdvOneId.active_phone"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</a-descriptions-item>
<a-descriptions-item label="توضیحات آگهی">
{{ getAdvOneId.body }}
</a-descriptions-item>
<a-descriptions-item label="شماره موبایل ثبت کننده آگهی">
{{ getAdvOneId.mobile }}
</a-descriptions-item>
<a-descriptions-item label="نام دسته آگهی">
{{ getAdvOneId.collection.title }}
</a-descriptions-item>
<a-descriptions-item label="تاریخ ثبت آگهی">
{{ getAdvOneId.caj }}
</a-descriptions-item>
</a-descriptions>
<div class="flex">
<div class="flex-initial" v-for="item in getAdvOneId.images" v-if="getAdvOneId.images">
<img :src="item.src" alt="" width="200" height="200" class="object-cover"/>
</div>
<div class="flex-none" v-for="item in getAdvOneId.video" v-if="getAdvOneId.video">
<video width="200" height="200" controls>
<source :src="item.src" type="video/mp4">
</video>
</div>
</div>
<!-- <div v-if="getAdvOneId.attributes.attribute.sounds">-->
<!-- <div class="flex-initial" v-for="item in getAdvOneId.attributes.attribute.sounds">-->
<!-- <audio :src="item.src" controls></audio>-->
<!-- </div>-->
<!-- </div>-->
<a-table :locale="{emptyText:'رکوردی وجود ندارد.'}" class="mt-5" :columns="columns" :data-source="getAdvOneId.attributes" bordered>
<span slot="value" slot-scope="text,record">
<span v-if="typeof text === 'string' ">
<span v-if="text.includes('.jpg') || text.includes('.png') || text.includes('.jpeg')">
<img :src="text" width="100" height="100" class="object-cover"/>
</span>
<span v-else-if="text.includes('.mp3') || text.includes('.ogg')">
<audio controls>
<source :src="text" type="audio/ogg">
<source :src="text" type="audio/mpeg">
</audio>
</span>
<span v-else-if="text.includes('.pdf')">
<a :href="text" download>
دانلودpdf
</a>
</span>
<span v-else>
{{ text }}
</span>
</span>
<span v-else>
<template v-for="item in text">
<span v-if="item.includes('.jpg') || item.includes('.png') || item.includes('.jpeg') || item.includes('.webp')">
<img :src="item" width="100" height="100" class="object-cover"/>
</span>
<span v-else>
<a-tag>
{{ item }}
</a-tag>
</span>
</template>
</span>
</span>
</a-table>
</div>
</div>
</a-modal>
</vx-card>
</div>
</template>
<script>
import '@/assets/scss/vuexy/extraComponents/agGridStyleOverride.scss'
import vSelect from 'vue-select'
import FeatherIcon from '@/components/FeatherIcon.vue'
import * as TableCol from './AdvListModel';
import CustomerView from "@/views/apps/customer/CustomerView";
import axios from "@/axios";
import XTable from "../../components/x-table/XTable";
import SendMsg from "../../components/SendMsg";
const columns = [
{
title: 'نام صفت',
dataIndex: 'title',
},
{
title: 'مقادیر صفت ',
dataIndex: 'value',
scopedSlots: { customRender: 'value' },
},
{
title: 'گروه صفت',
dataIndex: 'attribute.group.title',
}
];
export default {
components: {
SendMsg,
XTable,
CustomerView,
vSelect,
FeatherIcon,
},
data() {
return {
model: null,
interval:undefined,
modelChangeCollection:null,
tempRowId: undefined,
radioGroupReason: undefined,
collection:[],
replaceFields:{ children:'children', title:'title', key:'id', value: 'id' },
visibleReasonReject:false,
formSuperVisionCancel: this.$form.createForm(this, {name: 'coordinated'}),
getAdvOneId:null,
isGetData:true,
visibleGetOneById:false,
columns
}
},
methods:{
async okDelete(id){
try{
await axios.delete(`admin/adv/${id}`)
this.$refs.adv.fetch()
this.$ntSet('حذف با موفقیت انجام شد.')
} catch (e) {
this.$ntSetError()
}finally {
}
},
edit(id){
this.$router.push(`/adv/edit/${id}`)
},
send(id) {
this.visibleSendMsg = true;
this.tempRowId = id
},
changeCategory(id){
this.tempRowId = id
this.visibleChangeCategory = true;
this.getCollection();
},
viewAdv(id){
this.visibleGetOneById = true
this.isGetData = true
this.getOneIdAdv(id)
},
async getOneIdAdv(id){
try{
const {data} = await axios.get(`admin/adv/${id}`)
this.getAdvOneId = data
}catch (e) {
this.visibleGetOneById = false
this.$ntSetError('خطا در دریافت اطلاعات')
}finally {
this.isGetData = false
}
},
cancelModal(){
this.visibleChangeCategory = false;
},
cancelModalOneId(){
this.visibleGetOneById = false;
},
monitoring(id){
this.tempRowId = id
this.visibleSuperVision = true
},
confirmationAdv(){
this.visibleSuperVisionOk = true
},
rejectAdv(){
this.visibleReasonReject = true
this.getRadioButtonReason()
},
getCollection(){
axios.get('admin/adv/collection')
.then((res)=>{
return this.collection = res.data
})
},
async getRadioButtonReason(){
try{
const {data} = await axios.get('admin/adv/reason/reject')
this.radioGroupReason = data
}catch (e) {
}finally {
}
},
submitReasonDelete(e){
e.preventDefault()
const id = this.tempRowId
this.form.validateFields(async(err, values) => {
if (!err) {
try{
await axios.put(`admin/adv/delete/${id}`,{reason_delete:values.reason_delete})
this.$refs.adv.fetch()
this.form.resetFields()
this.visibleReasonDelete = false
this.$ntSet()
}catch (e) {
this.visibleReasonDelete = false
this.$ntSetError()
}finally {
}
}
});
},
submitChangeCategory(e){
e.preventDefault()
const id = this.tempRowId
this.formChangeCategory.validateFields(async (err, values) => {
if(!err){
try{
await axios.put(`admin/adv/${id}`, {data:values,op:"collection"})
this.$refs.adv.fetch()
this.$ntSet('تغییردسته باموفقیت ثبت شد.')
this.formChangeCategory.resetFields()
this.visibleChangeCategory = false
}catch (e) {
this.visibleChangeCategory = false
this.$ntSetError()
}finally {
}
}
})
},
async okAdv(id){
try{
await axios.put(`admin/adv/${id}`,{data:{sts:3},op:"sts"})
this.$refs.adv.fetch()
this.$ntSet('تاییدآگهی باموفقیت انجام شد.')
}catch (e) {
this.$ntSetError()
}finally {
}
},
async okActiveAdv(id){
try{
await axios.put(`admin/adv/${id}`,{data:{active:true},op:"active"})
this.$refs.adv.fetch()
this.$ntSet('آگهی تایید شد.')
}catch (e) {
this.$ntSetError()
}finally {
}
},
async cancelActiveAdv(id){
try{
await axios.put(`admin/adv/${id}`,{data:{active:false},op:"active"})
this.$refs.adv.fetch()
this.$ntSet('آگهی رد شد.')
}catch (e) {
this.$ntSetError()
}finally {
}
},
async okLockAdv(id){
try{
await axios.put(`admin/adv/${id}`,{op:"lock"})
this.$refs.adv.fetch()
this.$ntSet('آگهی مورد نظر باز شد.')
}catch (e) {
this.$ntSetError()
}finally {
}
},
cancelAdv(id){
this.tempRowId = id
this.visibleReasonReject = true
},
submitRejectAdv(e){
e.preventDefault()
const id = this.tempRowId
this.formSuperVisionCancel.validateFields(async (err, values) => {
if(!err){
try{
await axios.put(`admin/adv/${id}`,{data:{reject_reason:values.reject_reason,sts:4},op:"sts"})
this.$refs.adv.fetch()
this.$ntSet('ردآگهی باموفقیت انجام شد.')
this.formSuperVisionCancel.resetFields()
this.visibleReasonReject = false
}catch (e) {
this.visibleReasonReject = false
this.$ntSetError()
}finally {
}
}
})
},
disabledTitleParent(value){
const item = this.collection.map(item=>item.title)
console.log(value,'map')
}
},
created(){
this.model = TableCol.default
// this.interval = setInterval(()=>{
// this.$refs.adv.fetch()
// },10000)
}
}
</script>
<style>
.ant-popover {
z-index: 25000000;
}
[dir=rtl] .ant-modal-footer{
display: none;
}
</style>
+21
View File
@@ -0,0 +1,21 @@
import XTbl, {Xtc} from '../../components/x-table/index';
const tbl = new XTbl('admin/adv/table', 'لیست آگهی های ثبت شده');
tbl.add(new Xtc('title', 'عنوان آگهی').filterText());
tbl.add(new Xtc('id', 'کد آگهی').filterText());
tbl.add(new Xtc('collection.title', 'دسته آگهی').filterText());
tbl.add(new Xtc('city', 'شهر').filterText());
tbl.add(new Xtc('caj', 'تاریخ ثبت').filterDate());
tbl.add(new Xtc('exaj', 'تاریخ انقضا').hidden().filterDate());
tbl.add(new Xtc('marketer_phone', 'بازاریاب آگهی').hidden().filterText());
tbl.add(new Xtc('owner.mobile', 'مالک').filterText().hidden());
tbl.add(new Xtc('acceptor.name', 'ناظر').hidden().filterText());
tbl.add(new Xtc('sts_str', 'وضعیت').filterSwitch());
tbl.add(new Xtc('active', 'فعالسازی آگهی').filterSwitch().renderSlot('active_adv'));
tbl.add(new Xtc('lock', 'قفل').filterSwitch().renderSlot('lock'));
tbl.add(new Xtc('vaj', 'تاریخ نظارت').hidden().filterDate());
tbl.add(new Xtc('price', 'قیمت آگهی').hidden().filterNumber());
tbl.add(new Xtc('id', 'عملیات').noSort().renderSlot('opt'));
export default tbl;
+17
View File
@@ -0,0 +1,17 @@
import XTbl, {Xtc} from '../../components/x-table/index';
const tbl = new XTbl('/list/table', 'لیست آگهی های حذف شده');
tbl.add(new Xtc('title', 'بازه زمانی').filterSwitch());
tbl.add(new Xtc('title', 'کد آگهی').filterSwitch());
tbl.add(new Xtc('title', 'ثبت کننده آگهی').filterSwitch());
tbl.add(new Xtc('title', 'مالک آگهی').filterSwitch());
tbl.add(new Xtc('title', 'گزارش دهنده آگهی').filterSwitch());
tbl.add(new Xtc('title', 'علت گزارش').filterSwitch());
tbl.add(new Xtc('title', 'توضیحات').filterSwitch());
tbl.add(new Xtc('title', 'دسته').filterSwitch());
tbl.add(new Xtc('title', 'شهر').filterSwitch());
tbl.add(new Xtc('title', 'ناظر').filterSwitch());
tbl.add(new Xtc('title', 'عملیات').noSort());
export default tbl;
+55
View File
@@ -0,0 +1,55 @@
<!-- =========================================================================================
File Name: UserList.vue
Description: User List page
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
========================================================================================== -->
<template>
<div id="page-user-list">
<vx-card title="لیست آگهی های حذف شده" class="vx-card">
<XTable :model="model"></XTable>
</vx-card>
</div>
</template>
<script>
import {AgGridVue} from 'ag-grid-vue'
import '@/assets/scss/vuexy/extraComponents/agGridStyleOverride.scss'
import vSelect from 'vue-select'
import FeatherIcon from '@/components/FeatherIcon.vue'
import * as TableCol from './AdvMaliciousListModel';
import CustomerView from "@/views/apps/customer/CustomerView";
import axios from "@/axios";
import XTable from "../../components/x-table/XTable";
export default {
components: {
XTable,
CustomerView,
vSelect,
FeatherIcon,
},
data() {
return {
}
},
created() {
this.model = TableCol.default;
}
}
</script>
<style>
.ant-popover {
z-index: 25000000;
}
</style>