Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <script src="https://unpkg.com/[email protected]/dist/vuex.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@quasar/extras/material-icons/material-icons.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/quasar/dist/quasar.min.css">

<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://cdn.jsdelivr.net/npm/quasar/dist/quasar.umd.min.js"></script>

<div id="q-app">
 

 <q-layout view="hHh LpR lFf" >
    <!-- this view put header and footer fixed but tab is not fixed yet-->
    <q-page-container class="q-pa-lg q-my-lg">
      <q-page padding>
      <transition
  enter-active-class="animated fadeIn"
  appear
>
      <q-header :reveal="false">
        <q-toolbar inverted class="navBar">
          <q-btn
            flat
            round
            style="font-size: 1.2rem;"
            color="white"
            icon="menu"
            @click="left = !left"
          ></q-btn>
          
          <q-toolbar-title class="txtShamagri">shamagri</q-toolbar-title>
          
          <!-- <q-btn flat round color="grey-1" icon="search" 
          v-modal="mobileSearchBoxToggle"  @click="mobileSearchBoxToggle = !mobileSearchBoxToggle" 
          class="search-box_toggle-btn"></q-btn> -->
         
          
          <q-btn outline color="white" class="q-mr-sm" >Login</q-btn>
          <!-- notification is also available but i need number of notification on top of the icon or change in color  -->
        </q-toolbar>
        
        
      </q-header>
    </transition>
<q-drawer
           v-model="left"
          :width="200"
          :breakpoint="500"
          show-if-above
          bordered
          content-class="bg-grey-3"
        >
          <q-scroll-area class="fit">
            <q-list v-for="(menuItem, index) in menuList" :key="index">
              <q-item :to="menuItem.route" clickable :active="menuItem.label === 'Outbox'" v-ripple exact>
                <q-item-section avatar>
                  <img v-if="menuItem.iconSrc" :src="menuItem.iconSrc" alt="Icon" width="28" height="28">
                  <q-icon :name="menuItem.icon" ></q-icon>
                </q-item-section>
                <q-item-section>
                  {{ menuItem.label }}
                </q-item-section>
              </q-item>
  
             <q-separator v-if="menuItem.separator" ></q-separator>
  
            </q-list>
          </q-scroll-area>
        </q-drawer>
      <div class="content-wrapper">
        
     <q-table
            title="Invoice"
            class="invoice-table"
            :data="multiple"
            :columns="columns"
            row-key="name"
            no-data-label="Select product from below"
            no-results-label="The filter didn't uncover any results"
            separator="vertical"
          >
            <template slot="top-left" slot-scope="props">
              <p class="q-caption">* Click on cells to edit</p>
            </template>
            <template slot="top-right" slot-scope="props">
              <p class="q-caption">{{total_invoice}}</p>
            </template>
            <q-tr slot="body" slot-scope="props" :props="props">
              <!-- <q-tr slot="body" slot-scope="props" :props="props" @click.native="$router.push({ path: '/invoice', query: { tripId: props.row._id } })" class="cursor-pointer" > -->
              <q-td key="desc" :props="props">
                {{ props.row.value.product }}
                <q-popup-edit v-model="props.row.product" title="Update product" buttons>
                  <q-input type="text" v-model="props.row.value.product" />
                </q-popup-edit>
              </q-td>

              <q-td key="rate" :props="props">
                {{ props.row.value.rate }}
                <q-popup-edit v-model="rate" title="Update Price" buttons>
                  <q-input type="number" v-model="props.row.value.rate" />
                </q-popup-edit>
                <!-- <q-chip small square color="amber">{{ props.row.unpaid }}</q-chip> -->
              </q-td>
              <q-td key="quantity" :props="props">
                {{ props.row.value.quantity }}
                <q-popup-edit v-model.number="props.row.value.quantity" title="Update Quantity" buttons>
                  <q-input type="number" v-model.number="props.row.value.quantity" />
                </q-popup-edit>
              </q-td>
              <q-td key="total" :props="props">{{ props.row.value.quantity * props.row.value.rate }}</q-td>
              <!-- <q-td key="expiry_left" :props="props">{{ props.row.value.expiry_left }}</q-td> -->
            </q-tr>
          </q-table>
          <q-form class="q-gutter-md">
            <q-select
              ref="select"
              v-model="multiple"
              multiple
              input-debounce="0"
              use-chips
              filled
              color="tertiary"
              :options="stringOptions"
              label="Choose goods/services"
              use-input
              @filter="filterFn"
              @input="onValueChange"
              @new-value="createValue"
            />
            <q-btn to="/add_goods" label="Save" color="secondary" type="submit" />
          </q-form>
       
     
      </q-page>

    </q-page-container>
    
  </q-layout>

  
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                const store = new Vuex.Store({
    state: {
      
        left: false,
			  toggleTheme: false,
			  headerReveal: false,
			 checkedNames: ['Jack', 'Mike']
    },
    mutations: {
				setLeft (state, val) {
    state.left = val
		},
		setToggleTheme  (state, val)  {
				state.toggleTheme = val
		},
		setHeader (state, val)  {
				state.header = val
		},



    },
    actions: {
       
    }
})
const stringOptions = [
  {
    label: "Google",
    value: {
      product: "Google",
      rate: 30,
      quantity: 5,
      expiry_left: 150
    }
  },
  {
    label: "Facebook",
    value: {
      product: "Facebook",
      rate: 30,
      quantity: 5,
      expiry_left: 150
    }
  },
  {
    label: "Twitter",
    value: {
      product: "Twitter",
      rate: 30,
      quantity: 5,
      expiry_left: 150
    }
  },
  {
    label: "Apple Inc.",
    value: {
      product: "Apple Inc.",
      rate: 30,
      quantity: 5,
      expiry_left: 150
    }
  },
  {
    label: "Linux Inc.",
    value: {
      product: "Linux Inc.",
      rate: 30,
      quantity: 5,
      expiry_left: 150
    }
  },
  {
    label: "Dell Inc.",
    value: {
      product: "Dell Inc.",
      rate: 30,
      quantity: 5,
      expiry_left: 150
    }
  },
  {
    label: "Oracle",
    value: {
      product: "Oracle",
      rate: 30,
      quantity: 5,
      expiry_left: 150
    }
  }
];
new Vue({
store,
  el: '#q-app',
	
  data: function () {
    return {
       rate:0,
      quantity:0,
      total_invoice: 0,
      sum: 0,
      lazy: [],
      multiple: [], //model that takes selected values
      filterOptions: [], //value to add on select
      columns: [
        {
          name: "desc", //dont rename name
          required: false,
          label: "Goods/Services",
          align: "left",
          field: "product",
          sortable: false
        },

        { name: "rate", label: "Rate(Rs)", field: "rate", sortable: false }, //dont rename name
        {
          name: "quantity",
          label: "Quantity",
          field: "quantity",
          sortable: false
        }, //dont rename name
        {
          name: "total",
          label: "Total",
          field: "total",
          sortable: false
        } //dont rename name
        /*   {
          name: "expiry_left",
          label: "Expiry Left",
          field: "expiry_left",
          sortable: false
        }  */
      ],
      filter: "",
       ecategory: "",
      add:true,
      show: false,
        changeTheme: false,
      searchBox: "",
      mobileSearchBoxToggle: false,
      drawer:true,
      menuList : [
  {
    icon: 'face',
    label: 'Profile',
    route: '/profile',
    separator: true
  },
  {
    icon: 'home',
    label: 'Home',
    route: '/',
    separator: false
  },
  {
    iconSrc: '',
    label: 'Goods',
    route: '/my_products',
    separator: false
  },
  {
    iconSrc: '',
    label: 'Services',
    route: '/my_services',
    separator: false
  },
  {
    iconSrc: '',
    label: 'Measurement',
    route: '/measurement',
    separator: true
  },
  {
    iconSrc: '',
    label: 'Bought',
    route: '/payment_bought',
    separator: false
  },
  {
    iconSrc: '',
    label: 'Sold',
    route: '/payment_sold',
    separator: true
  },
  {
    icon: 'settings',
    label: 'Settings',
    route: '/settings',
    separator: false
  },
  {
    icon: 'logout',
    label: 'Logout',
    route: '/logout',
    separator: false
  }
],
      pagination: {
        sortBy: 'name',
        descending: false,
        page: 2,
        rowsPerPage: 3,
         rowsNumber: 4 
      },
    lazy: [
        /* {
          product: "hululu",
          rate: 30,
          quantity: 5,
          expiry_left: 150
        } */
      ],
      multiple:[],
      
     
      filter: "" 
    }
  },
  methods: {
    onValueChange() {
      this.$refs["select"].__resetInputValue();
    },
    createValue(val, done) {
      console.log(val);
      if (val.length > 0) {
        if (!this.filterOptions.includes(val)) {
          this.filterOptions.push(val);
        }
        done(val, "toggle");
      }
    },

    filterFn(val, update) {
      update(() => {
        if (val === "") {
          this.filterOptions = stringOptions;
        } else {
          const needle = val.toLowerCase();

          this.filterOptions = stringOptions.filter(
            v => v.label.toLowerCase().indexOf(needle) > -1
          );
        }
      });
    }
  	
	},
  watch: {
   
    multiple() {
      // this.multiple.forEach(myFunction);

      this.sum = this.multiple.map(arrayItem => {
        var x = 0;
        return (x += arrayItem.value.rate*arrayItem.value.quantity);
      });
      this.total_invoice = this.sum.reduce((total, value, index, array) => {
        return total += value;
      });
    }
  },

	    computed: {
       
        checkedNames: {
            get() {
                return this.$store.state.checkedNames
            },
            set(str) {
                this.$store.dispatch('updateChecked', str)
            }
        },
				   header: {
      get() {
        return this.$store.state.layoutDemo.header;
      },
      set(val) {
        this.$store.commit("layoutDemo/setHeader", val);
      }
    },
    left: {
      get() {
        return this.$store.state.left;
      },
      set(val) {
        this.$store.commit("setLeft", val);
      }
    },
    themeToggle: {
      get() {
        return this.$store.state.toggleTheme;
      },
      set(val) {
        this.$store.commit("setToggleTheme", val);
      }
    },
    }
})
              
            
!
999px

Console