소스 검색

Merge branch 'master' of http://git.hghweb.ir/ali.s/palizvani-front-vite into production

hgh 1 년 전
부모
커밋
21921809ab

+ 2 - 2
src/api/models/Content.js

@@ -26,8 +26,8 @@ export default class ContentAPI extends APIRepository {
   index(data) {
     const normalizedSendData = this.getNormalizedSendData({
       category: null, // Number
-      per_page: 10, // Number
-      page: 1 // Number
+      page: 1, // Number
+      per_page: 10 // Number
     }, data)
     return this.sendRequest({
       apiMethod: 'get',

+ 31 - 31
src/components/EventItem.vue

@@ -53,15 +53,17 @@
            @click="goToPage">
     </q-card-section>
     <div class="infos">
-      <div class="title ellipsis-2-lines">
+      <div class="title">
         <router-link :to="{name: 'Public.ShowEventInfo', params: {id: event.id}}">
           {{event.title}}
         </router-link>
       </div>
-      <div class="date">
-        <q-icon name="calendar_month"
-                size="20px" />
-        {{ miladiToShamsi() }}
+      <div class="attribute">
+        <div class="attribute-item">
+          <q-icon name="calendar_month"
+                  size="20px" />
+          {{ miladiToShamsi() }}
+        </div>
       </div>
     </div>
     <q-card-actions class="action-section">
@@ -188,7 +190,10 @@ export default defineComponent({
     }
   }
   .thumbnail {
-    padding: 0;
+    padding-top: 17px;
+    padding-left: 22px;
+    padding-right: 22px;
+    padding-bottom: 26px;
     .RegisteredSign {
       display: none;
     }
@@ -197,32 +202,27 @@ export default defineComponent({
       height: auto;
     }
   }
-  .infos {
-    position: absolute;
-    left: 0;
-    bottom: 60px;
-    width: 100%;
-    z-index: 2;
-    .title {
-      padding: 0 15px;
-      text-align: left;
-      margin-bottom: 49px;
-      a {
-        color: white;
-        font-size: 16px;
-        font-weight: bold;
+  .title {
+    text-align: left;
+    padding-top: 0;
+    padding-left: 46px;
+    padding-right: 46px;
+    padding-bottom: 33px;
+  }
+  .attribute {
+    padding-top: 0;
+    padding-left: 46px;
+    padding-right: 46px;
+    padding-bottom: 44px;
+    .attribute-item {
+      margin-bottom: 21px;
+      display: flex;
+      flex-flow: row;
+      .attribute-logo {
+        margin-right: 15px;
       }
-    }
-    .date {
-      padding: 0 15px;
-      text-align: left;
-      margin-bottom: 24px;
-      color: white;
-      font-size: 16px;
-      font-weight: normal;
-      .q-icon {
-        color: #EAC38A;
-        margin-right: 12.5px;
+      &:last-child {
+        margin-bottom: 0;
       }
     }
   }

+ 1 - 0
src/components/Widgets/Content/AdminContentCreate/AdminContentCreate.vue

@@ -53,6 +53,7 @@ export default {
       inputs: [
         { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-md-6 col-12' },
         { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'عکس', placeholder: ' ', col: 'col-md-6 col-12' },
+        { type: 'date', name: 'created_on_date', responseKey: 'created_on_date', outsideLabel: 'روز انتشار(تولید)', placeholder: ' ', col: 'col-md-6 col-12' },
         { type: 'checkbox', name: 'is_hidden', responseKey: 'is_hidden', label: 'پنهان باشد؟', placeholder: ' ', value: true, col: 'col-12' },
         { type: ContentCategorySelectorComp, name: 'category', responseKey: 'category', sendNull: true, col: 'col-12' },
         { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات', col: 'col-12' },

+ 1 - 0
src/components/Widgets/Content/AdminContentShow/AdminContentShow.vue

@@ -87,6 +87,7 @@ export default {
       inputs: [
         { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-md-6 col-12' },
         { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'عکس', placeholder: ' ', col: 'col-md-6 col-12' },
+        { type: 'date', name: 'created_on_date', responseKey: 'created_on_date', outsideLabel: 'روز انتشار(تولید)', placeholder: ' ', col: 'col-md-6 col-12' },
         { type: 'checkbox', name: 'is_hidden', responseKey: 'is_hidden', label: 'پنهان باشد؟', placeholder: ' ', col: 'col-12' },
         { type: ContentCategorySelectorComp, name: 'category', responseKey: 'category_info', sendNull: true, col: 'col-md-12 col-12' },
         { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات', col: 'col-md-12 col-12' },

+ 17 - 1
src/components/Widgets/Content/ContentCarousel/ContentCarousel.vue

@@ -8,7 +8,7 @@
       </div>
       <div>
         <q-btn flat
-               :to="{name: 'Public.ContentCategoryParentParent.List'}">
+               :to="getSeeAllContentsRout()">
           مشاهده همه
           <svg xmlns="http://www.w3.org/2000/svg"
                width="18.387"
@@ -138,6 +138,22 @@ export default {
 
       this.contents.loading = true
       return APIGateway.content.index(params)
+    },
+    getSeeAllContentsRout () {
+      let route = { name: 'Public.ContentCategoryParentParent.List' }
+
+      if (this.localOptions.categoryCategoryCategoryId) {
+        route = { name: 'Public.ContentCategoryParentParent.Show', params: { category_id: this.localOptions.categoryCategoryCategoryId } }
+      }
+
+      if (this.localOptions.categoryCategoryId) {
+        route = { name: 'Public.ContentCategoryParentParent.Show', params: { category_id: this.localOptions.categoryCategoryId } }
+      }
+
+      if (this.localOptions.categoryId) {
+        route = { name: 'Public.ContentCategoryParentParent.Show', params: { category_id: this.localOptions.categoryId } }
+      }
+      return route
     }
   }
 }

+ 45 - 83
src/components/Widgets/Content/ContentCarousel/componetns/ContentItem.vue

@@ -1,40 +1,20 @@
 <template>
-  <q-card flat
-          class="content-item">
-    <div class="thumbnail">
-      <img class="thumbnail-img"
-           :src="content.thumbnail"
-           @click="goToPage">
+  <q-card class="ContentItem"
+          flat>
+    <div class="thumbnail"
+         @click="goToContentPageShow">
+      <q-img :src="content.thumbnail" />
     </div>
-    <div class="infos">
-      <div class="title ellipsis-2-lines">
-        <router-link :to="{name: 'Public.Content.Show', params: {id: content.id}}">
-          {{ content.title }}
-        </router-link>
-      </div>
-      <div class="date">
-        <q-icon name="calendar_month"
-                size="20px" />
-        {{ miladiToShamsi() }}
-      </div>
+    <div class="title ellipsis-2-lines"
+         @click="goToContentPageShow">
+      {{ content.title }}
     </div>
-    <q-card-actions class="action-section">
-      <q-btn color="primary"
-             class="btn-show-content"
-             :to="{name: 'Public.Content.Show', params: {id: content.id}}">
-        مشاهده جزییات
-        <svg xmlns="http://www.w3.org/2000/svg"
-             width="18.387"
-             height="11.502"
-             viewBox="0 0 18.387 11.502">
-          <path id="Combined_Shape"
-                data-name="Combined Shape"
-                d="M-9.338,11.408a.748.748,0,0,0,.388-.656V6.5h8.2A.751.751,0,0,0,0,5.75.75.75,0,0,0-.75,5h-8.2V.75A.751.751,0,0,0-9.338.093.769.769,0,0,0-9.7,0a.735.735,0,0,0-.4.115l-7.938,5a.747.747,0,0,0-.35.635.742.742,0,0,0,.35.634l7.938,5a.751.751,0,0,0,.4.116A.746.746,0,0,0-9.338,11.408ZM-10.45,9.392l-5.78-3.641,5.78-3.642Z"
-                transform="translate(18.387)"
-                fill="#fff" />
-        </svg>
-      </q-btn>
-    </q-card-actions>
+    <content-item-categories :content="content" />
+    <q-btn color="primary"
+           class="show-content-btn"
+           :to="{name: 'Public.Content.Show', params: {id: content.id}}">
+      مشاهده
+    </q-btn>
   </q-card>
 </template>
 
@@ -42,9 +22,11 @@
 import { defineComponent } from 'vue'
 import Assist from 'src/assets/js/Assist.js'
 import { Content } from 'src/models/Content.js'
+import ContentItemCategories from '../../../ContentCategory/ContentCategoryList/ContentItemCategories.vue'
 
 export default defineComponent({
   name: 'ContentItem',
+  components: { ContentItemCategories },
   props: {
     content: {
       type: Content,
@@ -56,6 +38,9 @@ export default defineComponent({
     }
   },
   methods: {
+    goToContentPageShow () {
+      this.$router.push({ name: 'Public.Content.Show', params: { id: this.content.id } })
+    },
     goToPage () {
       this.$router.push({ name: 'Public.Content.Show', params: { id: this.content.id } })
     },
@@ -67,62 +52,39 @@ export default defineComponent({
 </script>
 
 <style lang="scss" scoped>
-.content-item {
-  width: 100%;
-  background-color: #F6F6F6;
-  border-radius: 8px;
+.ContentItem {
+  background-color: #f6f6f6;
+  display: flex;
+  flex-flow: column;
   position: relative;
-  z-index: 1;
-
+  cursor: pointer;
+  padding: 16px;
+  margin: 8px;
+  border-radius: 16px;
   .thumbnail {
-    padding: 0;
-    cursor: pointer;
-    .thumbnail-img {
+    margin-bottom: 16px;
+    .q-img {
       width: 100%;
-      height: auto;
+      border-radius: 8px;
     }
   }
-  .infos {
+  .title {
+    text-align: center;
+    margin-bottom: 16px;
+    font-size: 16px;
+  }
+  .description {
     position: absolute;
-    left: 0;
-    padding-top: 12px;
-    bottom: 60px;
-    width: 100%;
-    z-index: 2;
-    -webkit-box-shadow: inset 0px -200px 55px -90px rgba(0,0,0,0.32);
-    -moz-box-shadow: inset 0px -200px 55px -90px rgba(0,0,0,0.32);
-    box-shadow: inset 0px -200px 55px -90px rgba(0,0,0,0.32);
-    .title {
-      padding: 0 15px;
-      text-align: left;
-      margin-bottom: 49px;
-      a {
-        color: white;
-        font-size: 16px;
-        font-weight: bold;
-      }
-    }
-    .date {
-      padding: 0 15px;
-      text-align: left;
-      margin-bottom: 24px;
-      color: white;
-      font-size: 16px;
-      font-weight: normal;
-      .q-icon {
-        color: #EAC38A;
-        margin-right: 12.5px;
-      }
-    }
+    left: 21px;
+    color: #FFFFFF;
+    font-size: 16px;
+    display: none;
   }
-  .action-section {
-    padding: 0;
-    .btn-show-content {
-      width: 100%;
-      height: 60px;
-      border-top-right-radius: 0;
-      border-top-left-radius: 0;
-    }
+  .show-content-btn {
+    width: 100%;
+    border-top-right-radius: 0;
+    border-top-left-radius: 0;
+    height: 60px;
   }
 }
 </style>

+ 47 - 17
src/components/Widgets/ContentCategory/ContentCategoryList/ContentCategoryList.vue

@@ -9,17 +9,30 @@
     <filters :show-category-route-name="showCategoryRouteName"
              :content-categories="contentCategories"
              @filter="onChangeFilter" />
-    <div class="contents row">
+    <div v-if="mounted"
+         class="row">
       <q-linear-progress v-if="contents.loading"
                          class="q-my-md"
                          indeterminate />
-      <template v-else>
-        <div v-for="(content, contentIndex) in contents.list"
-             :key="contentIndex"
-             class="col-md-4 col-12">
-          <content-item :content="content" />
+      <q-infinite-scroll ref="infiniteScroll"
+                         :key="scrollKey"
+                         :offset="2000"
+                         class="col-12"
+                         @load="loadMoreContents">
+        <div class="row">
+          <template v-for="(content, contentIndex) in contents.list"
+                    :key="contentIndex">
+            <div class="col-md-4 col-12">
+              <content-item :content="content" />
+            </div>
+          </template>
         </div>
-      </template>
+
+        <template v-slot:loading>
+          <q-spinner-dots v-if="contents.loading"
+                          size="40px" />
+        </template>
+      </q-infinite-scroll>
     </div>
   </div>
 </template>
@@ -57,6 +70,11 @@ export default {
       mounted: false,
       subFilterExpanded: false,
       contents: new ContentList(),
+      totalPage: null,
+      nextPage: 1,
+      scrollKey: 0,
+      perPage: 12,
+      filters: {},
       contentCategories: new ContentCategoryList(),
       contentCategory: new ContentCategory(),
       contentCategoryParent: new ContentCategory(),
@@ -124,7 +142,7 @@ export default {
       this.loadContentCategory()
     }
     this.getContentCategories()
-    this.getContents({ selected_category: this.contentCategoryId })
+    this.filters = { selected_category: this.contentCategoryId }
     this.mounted = true
   },
   methods: {
@@ -189,15 +207,24 @@ export default {
 
       return filter
     },
-    getContents (filters) {
+    async loadMoreContents(index, done) {
+      if (this.contents.loading) return
       this.contents.loading = true
-      APIGateway.content.index({ ...filters, per_page: 9999 })
-        .then(({ list }) => {
-          this.contents = new ContentList(list)
-        })
-        .finally(() => {
-          this.contents.loading = false
-        })
+      try {
+        const { list, paginate } = await APIGateway.content.index({ ...this.filters, page: this.nextPage, per_page: this.perPage })
+        this.nextPage = paginate.current + 1
+        if (this.nextPage > paginate.num_pages) {
+          done(true) // پایان لیست
+        } else {
+          done()
+        }
+        const newList = new ContentList(list)
+        this.contents.list = [...this.contents.list, ...newList.list]
+      } catch (error) {
+        done(true) // در صورت خطا بارگذاری را متوقف کن
+      } finally {
+        this.contents.loading = false
+      }
     },
     getContentCategories () {
       const filter = this.getFilterOfCategorySearch()
@@ -211,7 +238,10 @@ export default {
         })
     },
     onChangeFilter (newFilter) {
-      this.getContents({ ...newFilter, selected_category: this.contentCategoryId })
+      this.filters = { ...newFilter, selected_category: this.contentCategoryId }
+      this.nextPage = 1
+      this.contents.list = []
+      this.scrollKey++ // مقدار کلید را تغییر بده تا کامپوننت دوباره رندر شود
     }
   }
 }

+ 3 - 3
src/components/Widgets/ContentCategory/ContentCategoryShow/ContentCategoryShow.vue

@@ -149,12 +149,12 @@ export default {
   },
   mounted () {
     this.updateBreadcrumbs()
+    FormBuilderAssist.setAttributeByName(this.productInputs, 'content_category', 'value', this.contentCategoryId)
+    FormBuilderAssist.setAttributeByName(this.contentInputs, 'category', 'value', this.contentCategoryId)
     this.mounted = true
   },
   methods: {
     prefetchServerDataPromise () {
-      FormBuilderAssist.setAttributeByName(this.productInputs, 'content_category', 'value', this.contentCategoryId)
-      FormBuilderAssist.setAttributeByName(this.contentInputs, 'category', 'value', this.contentCategoryId)
       if (this.contentCategoryId) {
         this.contentCategory.loading = true
         return this.getContentCategoryInfo(this.contentCategoryId)
@@ -274,7 +274,7 @@ export default {
       this.$store.commit('AppLayout/updateBreadcrumbs', breadcrumbs)
     },
     onProductPageChanged (response) {
-      console.log(response.data)
+      // console.log(response.data)
       this.showRelatedProduct = response?.data?.results?.length !== 0
     }
   }

+ 1 - 2
src/components/Widgets/Event/LastEvents/LastEvents.vue

@@ -3,8 +3,7 @@
     <div class="eventCarousel-title">
       <div>
         <q-banner class="banner">
-          آخرین
-          رویدادها
+          آخرین رویدادها
         </q-banner>
       </div>
       <div>

+ 2 - 2
src/components/Widgets/Ticket/AdminTicketList/AdminTicketList.vue

@@ -144,14 +144,14 @@ export default {
             required: true,
             label: 'فرستنده',
             align: 'left',
-            field: row => row.creator_info.firstname + ' ' + row.creator_info.lastname
+            field: row => row.owner_info.firstname + ' ' + row.owner_info.lastname
           },
           {
             name: 'national_code',
             required: true,
             label: 'کد ملی فرستنده',
             align: 'left',
-            field: row => row.creator_info.national_code
+            field: row => row.owner_info.national_code
           },
           {
             name: 'status',