Browse Source

modalcard added samples, industriels in navtools; flag collection items open modalcard

bach 1 month ago
parent
commit
515e400ea5

+ 2 - 2
config/sync/image.style.linkedmaterial_card.yml

@@ -3,13 +3,13 @@ langcode: en
 status: true
 dependencies: {  }
 name: linkedmaterial_card
-label: 'linkedmaterial-card (200x110)'
+label: 'linkedmaterial-card (190x110)'
 effects:
   34e936a0-1fee-4327-9553-b4f48bde14e6:
     uuid: 34e936a0-1fee-4327-9553-b4f48bde14e6
     id: image_scale_and_crop
     weight: 1
     data:
-      width: 200
+      width: 190
       height: 110
       anchor: center-center

+ 43 - 10
web/themes/custom/materiotheme/assets/dist/main.css

@@ -1844,9 +1844,17 @@ article.card {
     height: 100px;
     margin: auto; }
     article.card.minicard > header {
-      padding: 0.3em 0.3em 0.1em; }
+      padding: 0.3em 0.3em 0.1em;
+      cursor: pointer; }
       article.card.minicard > header h1 {
-        margin: 0; }
+        margin: 0;
+        font-size: 1em; }
+      article.card.minicard > header h4 {
+        margin: 0;
+        line-height: 1.1;
+        margin-bottom: -0.4em; }
+      article.card.minicard > header span.ref {
+        line-height: 0.5; }
     article.card.minicard > nav.tools {
       top: auto;
       bottom: 0;
@@ -1855,7 +1863,7 @@ article.card {
       article.card.minicard > nav.tools .mdi.unflag {
         cursor: pointer; }
   article.card.linkedmaterialcard {
-    width: 200px;
+    width: 190px;
     height: 110px; }
     article.card.linkedmaterialcard > header {
       padding: 0.3em 0.3em 0.1em;
@@ -1927,9 +1935,9 @@ article.card {
         right: 100%;
         width: 180px;
         box-sizing: border-box;
-        padding: 0.3em;
+        padding: 0;
         background-color: #fff;
-        box-shadow: -2px 3px 4px rgba(0, 0, 0, 0.2);
+        box-shadow: -2px 3px 8px rgba(0, 0, 0, 0.5);
         opacity: 0;
         max-height: 0;
         max-width: 0;
@@ -1938,6 +1946,7 @@ article.card {
       article.card nav.tools > *:hover .tool-content {
         transition: all 0.3s ease-in-out;
         opacity: 1;
+        padding: 0.3em;
         max-height: 195px;
         max-width: 200px; }
     article.card nav.tools .tool.flags .tool-content ul {
@@ -1989,27 +1998,51 @@ article.card {
       flex-basis: 50%; }
     article.card.modal-card section.col-right > *:not(nav.tools) {
       position: relative;
-      padding: 0.5em 0.5em 0;
+      padding: 0.3em 20px 0 0.5em;
       box-sizing: border-box;
       width: 100%; }
     article.card.modal-card section.col-right > header {
       bottom: auto; }
+    article.card.modal-card section.col-right span.label {
+      font-size: 0.693em;
+      font-weight: 500; }
     article.card.modal-card section.col-right section.body p {
-      font-size: 0.882em;
+      font-size: 0.693em;
       font-weight: 300;
       line-height: 1.35;
-      margin: 0 0 0.5em; }
-    article.card.modal-card section.col-right section.linked-materials {
+      margin: 0 0 0.3em; }
+    article.card.modal-card section.col-right section.linked-materials > ul {
       display: flex;
       flex-flow: row wrap;
       justify-content: space-between; }
-      article.card.modal-card section.col-right section.linked-materials > article.linkedmaterialcard {
+      article.card.modal-card section.col-right section.linked-materials > ul > li {
         flex-basis: 0 0 50%;
         margin-bottom: 0.5em; }
     article.card.modal-card section.col-right nav.tools {
       opacity: 1; }
       article.card.modal-card section.col-right nav.tools section.close span.btn.mdi-close {
         cursor: pointer; }
+      article.card.modal-card section.col-right nav.tools div.tool-content {
+        min-width: 385px; }
+    article.card.modal-card section.col-right section.tool.samples div.tool-content ul {
+      font-size: 0.882em;
+      font-weight: 300; }
+      article.card.modal-card section.col-right section.tool.samples div.tool-content ul li {
+        padding-right: 0.5em; }
+        article.card.modal-card section.col-right section.tool.samples div.tool-content ul li span.showroom {
+          font-weight: 500; }
+    article.card.modal-card section.col-right section.tool.industriels div.tool-content {
+      display: flex;
+      flex-flow: row; }
+      article.card.modal-card section.col-right section.tool.industriels div.tool-content > section {
+        flex: 0 0 50%; }
+        article.card.modal-card section.col-right section.tool.industriels div.tool-content > section h2 {
+          margin: 0;
+          font-size: 1em;
+          line-height: 0.6; }
+        article.card.modal-card section.col-right section.tool.industriels div.tool-content > section p {
+          margin: 0;
+          font-size: 0.882em; }
 
 #main-content > article.thematique div.cols {
   display: flex;

File diff suppressed because it is too large
+ 7 - 5
web/themes/custom/materiotheme/assets/dist/main.js


+ 1 - 1
web/themes/custom/materiotheme/assets/styles/base/_variables.scss

@@ -13,7 +13,7 @@ $card_height: 295px;
 $minicard_width: 170px;
 $minicard_height: 100px;
 
-$linkedmaterialcard_width: 200px;
+$linkedmaterialcard_width: 190px;
 $linkedmaterialcard_height: 110px;
 
 $modalcard_width: 850px;

+ 71 - 27
web/themes/custom/materiotheme/assets/styles/main.scss

@@ -952,8 +952,18 @@ article.card{
     margin:auto;
     >header{
       padding: 0.3em 0.3em 0.1em;
+      cursor: pointer;
       h1{
         margin:0;
+        font-size: 1em;
+      }
+      h4{
+        margin:0;
+        line-height: 1.1;
+        margin-bottom: -0.4em;
+      }
+      span.ref{
+        line-height: 0.5;
       }
     }
     >nav.tools{
@@ -1035,13 +1045,13 @@ article.card{
   &.card-thematique header{
     background-color: $color-base-transparent;
   }
+  $navtool_width: 15px;
   nav.tools{
     position: absolute;
     top: 0;
     right: 0;
     z-index: 21;
-    $toolbar_width: 15px;
-    width: $toolbar_width;
+    width: $navtool_width;
     background-color: #fff;
     box-sizing: content-box;
     padding: 0.3em 0.1em;
@@ -1057,11 +1067,11 @@ article.card{
         top: 0px;
         right: 100%;
         // width: 5em;
-        width: $column_width - $toolbar_width - 10px;
+        width: $column_width - $navtool_width - 10px;
         box-sizing: border-box;
-        padding: 0.3em;
+        padding: 0;
         background-color: #fff;
-        box-shadow: -2px 3px 4px rgba(0, 0, 0, 0.2);
+        box-shadow: -2px 3px 8px rgba(0, 0, 0, 0.5);
         opacity: 0;
         max-height: 0; max-width:0;
         overflow: hidden;
@@ -1071,6 +1081,7 @@ article.card{
         .tool-content{
           transition: all 0.3s ease-in-out;
           opacity: 1;
+          padding: 0.3em;
           max-height: 195px;
           max-width:200px;
         }
@@ -1148,44 +1159,41 @@ article.card{
     section.col-right{
       >*:not(nav.tools){
         position: relative;
-        padding: 0.5em 0.5em 0;
+        padding: 0.3em $navtool_width + 5px 0 0.5em;
         box-sizing: border-box;
         width: 100%;
       }
       >header{
         bottom: auto;
       }
-      // section.samples{
-      //   ul{
-      //     display: flex;
-      //     flex-flow: row wrap;
-      //     font-size: 0.882em;
-      //     font-weight: 300;
-      //     // line-height: 1.35;
-      //     li{
-      //       padding-right: 0.5em;
-      //       span.showroom{ font-weight: 500; }
-      //     }
-      //   }
-      // }
+      span.label{
+        font-size: 0.693em;
+        font-weight: 500;
+      }
+
       section.body{
         p{
-          font-size: 0.882em;
+          font-size: 0.693em;
           font-weight: 300;
           line-height: 1.35;
-          margin:0 0 0.5em;
+          margin:0 0 0.3em;
         }
 
       }
       section.linked-materials{
-        display: flex;
-        flex-flow: row wrap;
-        justify-content: space-between;
-        >article.linkedmaterialcard{
-          flex-basis: 0 0 50%;
-          margin-bottom: 0.5em;
+        >ul{
+          display: flex;
+          flex-flow: row wrap;
+          justify-content: space-between;
+          >li{
+            flex-basis: 0 0 50%;
+            margin-bottom: 0.5em;
+            article.linkedmaterialcard{
+            }
+          }
         }
       }
+
       nav.tools{
         opacity: 1;
         section.close{
@@ -1193,6 +1201,42 @@ article.card{
             cursor:pointer;
           }
         }
+        div.tool-content{
+          min-width: $column_width *2 - $navtool_width - 10px;
+        }
+      }
+      section.tool.samples{
+        div.tool-content{
+          ul{
+            // display: flex;
+            // flex-flow: row wrap;
+            font-size: 0.882em;
+            font-weight: 300;
+            // line-height: 1.35;
+            li{
+              padding-right: 0.5em;
+              span.showroom{ font-weight: 500; }
+            }
+          }
+        }
+      }
+      section.tool.industriels{
+        div.tool-content{
+          display: flex;
+          flex-flow: row;
+          >section{
+            flex: 0 0 50%;
+            h2{
+              margin:0;
+              font-size: 1em;
+              line-height: 0.6;
+            }
+            p{
+              margin: 0;
+              font-size: 0.882em;
+            }
+          }
+        }
       }
     }
   }

+ 40 - 0
web/themes/custom/materiotheme/vuejs/api/gql/materiaumodal.fragment.gql

@@ -16,12 +16,52 @@ fragment MateriauFields on Materiau {
     name
     email
     description
+    website{
+      title
+      url
+    }
+    infos
+    address {
+      langcode
+      country_code
+      administrative_area
+      locality
+      dependent_locality
+      postal_code
+      sorting_code
+      address_line1
+      address_line2
+      organization
+      given_name
+      additional_name
+      family_name
+    }
   }
   manufacturer{
     id
     name
     email
     description
+    website{
+      title
+      url
+    }
+    infos
+    address {
+      langcode
+      country_code
+      administrative_area
+      locality
+      dependent_locality
+      postal_code
+      sorting_code
+      address_line1
+      address_line2
+      organization
+      given_name
+      additional_name
+      family_name
+    }
   }
   body
 	samples{

+ 31 - 3
web/themes/custom/materiotheme/vuejs/components/Content/MiniCard.vue

@@ -1,8 +1,10 @@
 <template>
   <article class="card minicard">
-    <header>
+    <header
+      @click.prevent="openModalCard"
+    >
       <h1>{{ item.title }}</h1>
-      <span class="ref">{{ item.reference }}</span>
+      <span v-if="item.reference" class="ref">{{ item.reference }}</span>
     </header>
     <nav class="tools">
       <section class="tool flags">
@@ -26,7 +28,11 @@
           :data-src="img.style_minicard.url"
           :title="img.title"
         />
-        <img class="blank" :src="blanksrc">
+        <img
+          class="blank"
+          :src="blanksrc"
+          @click.prevent="openModalCard"
+        >
       </figure>
     </section>
   </article>
@@ -35,11 +41,15 @@
 <script>
 import { mapState, mapActions } from 'vuex'
 import cardMixins from 'vuejs/components/cardMixins'
+import ModalCard from 'vuejs/components/Content/ModalCard'
 
 export default {
   name: "MiniCard",
   props: ['item', 'collid'],
   mixins: [cardMixins],
+  components: {
+    ModalCard
+  },
   data() {
     return {
       blanksrc:`${drupalSettings.path.themePath}/assets/img/blank.gif`,
@@ -47,6 +57,9 @@ export default {
     }
   },
   computed: {
+    ...mapState({
+      isloggedin: state => state.User.isloggedin
+    })
   },
   methods: {
     ...mapActions({
@@ -69,6 +82,21 @@ export default {
           this.loadingItem = false;
         })
       }
+    },
+    openModalCard (e) {
+      console.log('openModalCard', this.isLoggedin);
+      if(this.isloggedin){
+        this.$modal.show(
+          ModalCard,
+          { item: this.item },
+          {
+            name: `modal-${this.item.id}`,
+            draggable: true,
+            width: '850px',
+            height: '610px'
+          }
+        )
+      }
     }
   }
 }

+ 49 - 11
web/themes/custom/materiotheme/vuejs/components/Content/ModalCard.vue

@@ -19,6 +19,7 @@
         <section class="tool flags">
           <span class="btn mdi mdi-folder-outline"/>
           <div class="tool-content">
+            <span class="label">{{ $t("materio.My folders") }}</span>
             <ul>
               <li  v-if="flagcolls" v-for="coll in flagcolls" :key="coll.id">
                 <span
@@ -35,21 +36,58 @@
             </ul>
           </div>
         </section>
+        <section class="tool samples">
+          <span class="btn mdi mdi-beaker-outline"/>
+          <div class="tool-content">
+            <span class="label">{{ $t("materio.Samples") }}</span>
+            <ul>
+              <li
+                v-for="sample in material.samples"
+                :key="sample.showroom.id"
+              >
+                <span class="showroom">{{ sample.showroom.name }}</span>: {{ sample.location }}
+              </li>
+            </ul>
+          </div>
+        </section>
+        <section class="tool industriels"  v-if="material.manufacturer || material.distributor">
+          <span class="btn mdi mdi-factory"/>
+          <div class="tool-content">
+            <section v-if="material.distributor">
+              <span class="label">{{ $t("materio.Distributor") }}</span>
+              <ul>
+                <li v-for="distrib in material.distributor" v-bind:key="distrib.id">
+                  <h2>{{ distrib.name }}</h2>
+                  <p v-if="distrib.website">
+                    <a target="_blank" :href="distrib.website.url">distrib.website.url</a>
+                  </p>
+                  <p v-if="distrib.email"><a :href="'mailto:'+distrib.email">{{ distrib.email }}</a></p>
+                </li>
+              </ul>
+            </section>
+            <section v-if="material.manufacturer">
+              <span class="label">{{ $t("materio.Manufacturer") }}</span>
+              <ul>
+                <li v-for="manu in material.manufacturer" v-bind:key="manu.id">
+                  <h2>{{ manu.name }}</h2>
+                  <p v-if="manu.website">
+                    <a target="_blank" :href="manu.website.url">manu.website.url</a>
+                  </p>
+                  <p v-if="manu.email"><a :href="'mailto:'+manu.email">{{ manu.email }}</a></p>
+                </li>
+              </ul>
+            </section>
+          </div>
+        </section>
       </nav>
-      <!-- <section class="samples">
-        <h3>{{ $t("materio.Samples") }}</h3>
+      <section class="body" v-html="material.body"/>
+      <section class="linked-materials">
+        <span class="label">{{ $t("materio.Linked materials") }}</span>
         <ul>
-          <li
-            v-for="sample in material.samples"
-            :key="sample.showroom.id"
-          >
-            <span class="showroom">{{ sample.showroom.name }}</span>: {{ sample.location }}
+          <li v-for="m in material.linked_materials" v-bind:key="m.id">
+            <LinkedMaterialCard :item="m"/>
           </li>
         </ul>
-      </section> -->
-      <section class="body" v-html="material.body"/>
-      <section class="linked-materials">
-        <LinkedMaterialCard v-for="m in material.linked_materials" v-bind:key="m.id" :item="m"/>
       </section>
     </section>
     <section class="col col-left images" v-switcher>