From 92fb85b8afaacc4a8b5dbb41eea2d0e35eeb6862 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Wed, 4 Oct 2023 20:31:21 +0530 Subject: first commit --- src/App.vue | 11 +++ src/assets/main.scss | 5 ++ src/classes/address.ts | 15 ++++ src/classes/customer.ts | 21 +++++ src/classes/item.ts | 21 +++++ src/components/brands_table.vue | 114 ++++++++++++++++++++++++ src/components/customers_table.vue | 139 ++++++++++++++++++++++++++++++ src/components/items_table.vue | 150 ++++++++++++++++++++++++++++++++ src/components/navbar.vue | 64 ++++++++++++++ src/components/new_brand.vue | 45 ++++++++++ src/components/new_customer.vue | 172 +++++++++++++++++++++++++++++++++++++ src/components/new_item.vue | 163 +++++++++++++++++++++++++++++++++++ src/main.ts | 19 ++++ src/router/index.ts | 74 ++++++++++++++++ src/views/AllBrands.vue | 9 ++ src/views/AllCustomers.vue | 7 ++ src/views/AllItems.vue | 7 ++ src/views/HomeView.vue | 5 ++ src/views/LogIn.vue | 139 ++++++++++++++++++++++++++++++ src/views/NewCustomer.vue | 7 ++ src/views/NewItem.vue | 7 ++ src/views/Register.vue | 106 +++++++++++++++++++++++ 22 files changed, 1300 insertions(+) create mode 100644 src/App.vue create mode 100644 src/assets/main.scss create mode 100644 src/classes/address.ts create mode 100644 src/classes/customer.ts create mode 100644 src/classes/item.ts create mode 100644 src/components/brands_table.vue create mode 100644 src/components/customers_table.vue create mode 100644 src/components/items_table.vue create mode 100644 src/components/navbar.vue create mode 100644 src/components/new_brand.vue create mode 100644 src/components/new_customer.vue create mode 100644 src/components/new_item.vue create mode 100644 src/main.ts create mode 100644 src/router/index.ts create mode 100644 src/views/AllBrands.vue create mode 100644 src/views/AllCustomers.vue create mode 100644 src/views/AllItems.vue create mode 100644 src/views/HomeView.vue create mode 100644 src/views/LogIn.vue create mode 100644 src/views/NewCustomer.vue create mode 100644 src/views/NewItem.vue create mode 100644 src/views/Register.vue (limited to 'src') diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..ab2e3f5 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,11 @@ + + + diff --git a/src/assets/main.scss b/src/assets/main.scss new file mode 100644 index 0000000..3f8988c --- /dev/null +++ b/src/assets/main.scss @@ -0,0 +1,5 @@ +//$body-color: #000; +//$body-bg: #e3e3e3; + +@import 'bootstrap/scss/bootstrap'; +@import 'bootstrap-icons/font/bootstrap-icons.css'; diff --git a/src/classes/address.ts b/src/classes/address.ts new file mode 100644 index 0000000..1f42a0b --- /dev/null +++ b/src/classes/address.ts @@ -0,0 +1,15 @@ +export default class Address { + addresstext: string + city: string + state: string + postalcode: string + country: string + + constructor() { + this.addresstext = '' + this.city = '' + this.state = '' + this.postalcode = '' + this.country = '' + } +} diff --git a/src/classes/customer.ts b/src/classes/customer.ts new file mode 100644 index 0000000..e5d0fff --- /dev/null +++ b/src/classes/customer.ts @@ -0,0 +1,21 @@ +import Address from './address' + +export default class Customer { + name: string + gstin: string + contactname: string + phone: string + email: string + website: string + billingaddress: Address + + constructor() { + this.name = '' + this.gstin = '' + this.contactname = '' + this.phone = '' + this.email = '' + this.website = '' + this.billingaddress = new Address() + } +} diff --git a/src/classes/item.ts b/src/classes/item.ts new file mode 100644 index 0000000..271eb3d --- /dev/null +++ b/src/classes/item.ts @@ -0,0 +1,21 @@ +export default class Item { + unitofmeasure: string + hasdecimalquantity: boolean + name: string + description: string + hsn: string + unitprice: string + gstpercentage: string + brandid: number + + constructor() { + this.name = '' + this.description = '' + this.hsn = '' + this.unitprice = '' + this.gstpercentage = '' + this.unitofmeasure = '' + this.hasdecimalquantity = false + this.brandid = 0 + } +} diff --git a/src/components/brands_table.vue b/src/components/brands_table.vue new file mode 100644 index 0000000..a0f95ad --- /dev/null +++ b/src/components/brands_table.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/src/components/customers_table.vue b/src/components/customers_table.vue new file mode 100644 index 0000000..fcd1fda --- /dev/null +++ b/src/components/customers_table.vue @@ -0,0 +1,139 @@ + + + + + diff --git a/src/components/items_table.vue b/src/components/items_table.vue new file mode 100644 index 0000000..5d689e5 --- /dev/null +++ b/src/components/items_table.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/src/components/navbar.vue b/src/components/navbar.vue new file mode 100644 index 0000000..e6205c8 --- /dev/null +++ b/src/components/navbar.vue @@ -0,0 +1,64 @@ + + + diff --git a/src/components/new_brand.vue b/src/components/new_brand.vue new file mode 100644 index 0000000..e0deb83 --- /dev/null +++ b/src/components/new_brand.vue @@ -0,0 +1,45 @@ + + + diff --git a/src/components/new_customer.vue b/src/components/new_customer.vue new file mode 100644 index 0000000..f6f8d9b --- /dev/null +++ b/src/components/new_customer.vue @@ -0,0 +1,172 @@ + + + diff --git a/src/components/new_item.vue b/src/components/new_item.vue new file mode 100644 index 0000000..0df7249 --- /dev/null +++ b/src/components/new_item.vue @@ -0,0 +1,163 @@ + + + diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..f6d3ea7 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,19 @@ +import './assets/main.scss' + +import { createApp } from 'vue' +import App from './App.vue' +import router from './router' +import axios from 'axios' +import * as bootstrap from 'bootstrap' + +import 'vue-toast-notification/dist/theme-sugar.css' + +axios.defaults.baseURL = '/api' +axios.defaults.headers.common['Authorization'] = `Bearer ${localStorage.getItem('authToken')}` +axios.defaults.headers.post['Content-Type'] = 'application/json' + +const app = createApp(App) + +app.use(router) + +app.mount('#app') diff --git a/src/router/index.ts b/src/router/index.ts new file mode 100644 index 0000000..af8e2c5 --- /dev/null +++ b/src/router/index.ts @@ -0,0 +1,74 @@ +import { createRouter, createWebHistory } from 'vue-router' + +import Register from '../views/Register.vue' +import LogIn from '../views/LogIn.vue' +import HomeView from '../views/HomeView.vue' +import AllBrands from '../views/AllBrands.vue' +import AllCustomers from '../views/AllCustomers.vue' +import NewCustomer from '../views/NewCustomer.vue' +import AllItems from '../views/AllItems.vue' +import NewItem from '../views/NewItem.vue' + +const router = createRouter({ + history: createWebHistory(import.meta.env.BASE_URL), + routes: [ + { + path: '/register', + name: 'register', + component: Register, + meta: { isAuth: false } + }, + { + path: '/login', + name: 'log in', + component: LogIn, + meta: { isAuth: false } + }, + { + path: '/', + name: 'home', + component: HomeView, + meta: { isAuth: true } + }, + { + path: '/brand', + name: 'brand', + component: AllBrands, + meta: { isAuth: true } + }, + { + path: '/customer', + name: 'customer', + component: AllCustomers, + meta: { isAuth: true } + }, + { + path: '/customer/new', + name: 'new customer', + component: NewCustomer, + meta: { isAuth: true } + }, + { + path: '/item', + name: 'item', + component: AllItems, + meta: { isAuth: true } + }, + { + path: '/item/new', + name: 'new item', + component: NewItem, + meta: { isAuth: true } + } + ] +}) + +router.beforeEach((to, _, next) => { + if (to.meta.isAuth && !localStorage.getItem("authToken")) { + next("/login?redirected=true") + } else { + next() + } +}) + +export default router diff --git a/src/views/AllBrands.vue b/src/views/AllBrands.vue new file mode 100644 index 0000000..d07e316 --- /dev/null +++ b/src/views/AllBrands.vue @@ -0,0 +1,9 @@ + + + diff --git a/src/views/AllCustomers.vue b/src/views/AllCustomers.vue new file mode 100644 index 0000000..ba9096b --- /dev/null +++ b/src/views/AllCustomers.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/views/AllItems.vue b/src/views/AllItems.vue new file mode 100644 index 0000000..9cf3708 --- /dev/null +++ b/src/views/AllItems.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue new file mode 100644 index 0000000..6b087a7 --- /dev/null +++ b/src/views/HomeView.vue @@ -0,0 +1,5 @@ + + + diff --git a/src/views/LogIn.vue b/src/views/LogIn.vue new file mode 100644 index 0000000..fb9bdcd --- /dev/null +++ b/src/views/LogIn.vue @@ -0,0 +1,139 @@ + + + + + diff --git a/src/views/NewCustomer.vue b/src/views/NewCustomer.vue new file mode 100644 index 0000000..d19995e --- /dev/null +++ b/src/views/NewCustomer.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/views/NewItem.vue b/src/views/NewItem.vue new file mode 100644 index 0000000..89690c6 --- /dev/null +++ b/src/views/NewItem.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/views/Register.vue b/src/views/Register.vue new file mode 100644 index 0000000..b96a0d1 --- /dev/null +++ b/src/views/Register.vue @@ -0,0 +1,106 @@ + + + + + -- cgit v1.2.3