diff --git a/package.json b/package.json
index e7e0e30..657c0dc 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
"vue-datepicker": "^1.3.0",
"vue-meta": "^2.4.0",
"vue-router": "^4.0.3",
+ "vue-splash": "^1.2.1",
"vue-virtual-scroller": "^2.0.0-beta.7",
"vue3-html2pdf": "^1.1.2",
"vue3-print-nb": "^0.1.4",
diff --git a/src/App.vue b/src/App.vue
index 1aae27c..410be8e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,12 +1,40 @@
-
+
+
+
diff --git a/src/CommonMethods.vue b/src/CommonMethods.vue
index 46b9cb7..27bad5e 100644
--- a/src/CommonMethods.vue
+++ b/src/CommonMethods.vue
@@ -1,6 +1,12 @@
diff --git a/src/components/LoadingScreen.vue b/src/components/LoadingScreen.vue
new file mode 100644
index 0000000..bd9e67f
--- /dev/null
+++ b/src/components/LoadingScreen.vue
@@ -0,0 +1,40 @@
+
+
+ Loading ...
+
+
+
+
+
+
diff --git a/src/types/ContractType.vue b/src/types/ContractType.vue
new file mode 100644
index 0000000..ddded43
--- /dev/null
+++ b/src/types/ContractType.vue
@@ -0,0 +1,25 @@
+
diff --git a/src/views/contracts/ContractEdit.vue b/src/views/contracts/ContractEdit.vue
index 1826693..6ccf555 100644
--- a/src/views/contracts/ContractEdit.vue
+++ b/src/views/contracts/ContractEdit.vue
@@ -1,10 +1,25 @@
-
+
+ {{ contract }}
-
+
+
@@ -62,9 +77,12 @@
- Save
+ Add
import axios from 'axios'
import DatePicker from '@vuepic/vue-datepicker'
+import methods from '@/CommonMethods.vue'
export default {
props: {
- setcontract: {
- no: Number,
- customer: {
- acc_no: String,
- name: String,
- at_risk: Boolean,
- },
- products: [{
- code: String,
- name: String,
- price: Number,
- }],
- start_date: String,
- finish_date: String,
- agree_date: String,
- tonnage_per_month: Number,
- comments: String,
- office_comments: String,
- active: Boolean
- }
+ setcontract: {}
},
components: {
DatePicker
@@ -109,8 +109,14 @@ export default {
if (val && val.length > 1) {
this.searchProducts(val)
}
+ },
+ customer_search(val) {
+ if (val && val.length > 2) {
+ this.searchCustomers(val)
+ }
}
},
+ mixins: [methods],
data() {
return {
contract: this.setcontract,
@@ -119,6 +125,18 @@ export default {
product_search: null,
products_loading: false,
products: [],
+ customer_search: null,
+ customers_loading: false,
+ customers: [],
+ }
+ },
+ computed: {
+ title() {
+ if ( this.contract.isNew ) {
+ return "New Contract"
+ } else {
+ return "Edit Contract"
+ }
}
},
methods: {
@@ -128,8 +146,9 @@ export default {
async saveContract(){
this.saving = true
let url = this.$api_url + "/customers/contracts/" + this.contract.no + "/save"
- console.log("Saving Contract : ", this.contract.no)
- console.log(this.contract)
+ if (this.contract.isNew) {
+ url = this.$api_url + "/customers/contracts/add"
+ }
axios.post(url, {
contract: this.contract
}).then(resp => {
@@ -141,13 +160,22 @@ export default {
this.saving = false
})
},
+ async searchCustomers(name) {
+ let url = this.$api_url + "/customers/search/" + name
+ axios.get(url)
+ .then(resp => {
+ this.customers = resp.data
+ })
+ .catch(err => {
+ console.log(err)
+ })
+ },
searchProducts(code) {
let url = this.$api_url + "/products/search/" + code
- console.log(url)
axios.get(url)
.then(resp => {
console.log(resp)
- this.products = resp.data
+ this.products = resp.data
})
.catch(err => {
console.log(err)
diff --git a/src/views/contracts/ContractList.vue b/src/views/contracts/ContractList.vue
index ca9e389..1c7758d 100644
--- a/src/views/contracts/ContractList.vue
+++ b/src/views/contracts/ContractList.vue
@@ -17,104 +17,110 @@
density="compact"
append-inner-icon="mdi-magnify">
-
-
-
-
-
-
-
-
- Contract : {{ item.no }}
- {{ item.customer.acc_no }} - {{ item.customer.name }}
-
-
-
-
-
- {{ p.code }} @ {{ p.price }}
-
-
-
-
- mdi-play: {{ formatDate(item.start_date,"DD/MM/YYYY") }}
- mdi-flag-checkered: {{ formatDate(item.finish_date,"DD/MM/YYYY") }}
- mdi-clock: {{ item.duration }} months
-
-
- {{ item.tonnage_per_month }} per month
- = {{ formatNumber(item.tonnage_per_month * item.duration,2) }} total
- = {{ formatNumber(item.tonnage_per_month * item.remaining_duration,2) }} remaining
-
-
-
-
-
- More
-
-
- Comments
- {{ item.comments}}
- Office
- {{ item.office_comments}}
- Agreed
- {{ formatDate(item.agree_date,"DD/MM/YYYY") }}
- Products
-
-
-
- {{ p.code }} - {{ p.name }} @ {{ p.price }}
-
-
-
-
-
- Multi
-
-
+
+ Add
+
+
+
+
+
+
+
+
+
+ Contract : {{ item.no }}
+ {{ item.customer.acc_no }} - {{ item.customer.name }}
+
+
+
+
+
+ {{ p.code }} @ {{ p.price }}
+
+
+
+
+ mdi-play: {{ formatDate(item.start_date,"DD/MM/YYYY") }}
+ mdi-flag-checkered: {{ formatDate(item.finish_date,"DD/MM/YYYY") }}
+ mdi-clock: {{ item.duration }} months
+
+
+ {{ item.tonnage_per_month }} per month
+ = {{ formatNumber(item.tonnage_per_month * item.duration,2) }} total
+ = {{ formatNumber(item.tonnage_per_month * item.remaining_duration,2) }} remaining
+
+
+
+
+
+ More
+
+
+ Comments
+ {{ item.comments}}
+ Office
+ {{ item.office_comments}}
+ Agreed
+ {{ formatDate(item.agree_date,"DD/MM/YYYY") }}
+ Products
+
+
+
+ {{ p.code }} - {{ p.name }} @ {{ p.price }}
+
+
+
+
- Total
+ Multi
-
- Edit
+ Total
-
-
-
-
-
-
-
- Edit
-
-
-
-
-
-
-
-
+
+ Edit
+
+
+
+
+
+
+
+
+ Edit
+
+
+
+
+
+
+
+
@@ -128,6 +134,7 @@
import ContractEdit from './ContractEdit.vue';
import ContractMulti from './ContractMulti.vue';
import methods from '@/CommonMethods.vue'
+import ContractType from '@/types/ContractType.vue';
import axios from 'axios'
export default {
props: {
@@ -185,8 +192,11 @@ export default {
mixins: [methods],
methods: {
async showEditContract(contract) {
- this.selected_contract = contract
- //this.selected_contract = contract
+ if ( contract != undefined ) {
+ this.selected_contract = contract
+ } else {
+ this.selected_contract = new ContractType()
+ }
this.tab = "edit"
this.edit = true
},
diff --git a/yarn.lock b/yarn.lock
index 365826c..5d20c9a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -294,6 +294,11 @@
resolved "https://registry.npmmirror.com/@babel/parser/-/parser-7.20.7.tgz#66fe23b3c8569220817d5feb8b9dcdc95bb4f71b"
integrity sha512-T3Z9oHybU+0vZlY9CiDSJQTD5ZapcW18ZctFMi0MOAl/4BjFF4ul7NVSARLdbGO5vDqy9eQiGTV0LtKfvCYvcg==
+"@babel/parser@^7.18.4":
+ version "7.20.13"
+ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.13.tgz#ddf1eb5a813588d2fb1692b70c6fce75b945c088"
+ integrity sha512-gFDLKMfpiXCsjt4za2JA9oTMn70CeseCehb11kRZgvd7+F67Hih3OHOK24cRrWECJ/ljfPGac6ygXAs/C8kIvw==
+
"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6":
version "7.18.6"
resolved "https://registry.npmmirror.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2"
@@ -1561,6 +1566,15 @@
"@vue/compiler-core" "3.2.45"
"@vue/shared" "3.2.45"
+"@vue/compiler-sfc@2.7.14":
+ version "2.7.14"
+ resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-2.7.14.tgz#3446fd2fbb670d709277fc3ffa88efc5e10284fd"
+ integrity sha512-aNmNHyLPsw+sVvlQFQ2/8sjNuLtK54TC6cuKnVzAY93ks4ZBrvwQSnkkIh7bsbNhum5hJBS00wSDipQ937f5DA==
+ dependencies:
+ "@babel/parser" "^7.18.4"
+ postcss "^8.4.14"
+ source-map "^0.6.1"
+
"@vue/compiler-sfc@3.2.45", "@vue/compiler-sfc@^3.0.11":
version "3.2.45"
resolved "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.2.45.tgz#7f7989cc04ec9e7c55acd406827a2c4e96872c70"
@@ -2768,6 +2782,11 @@ csstype@^2.6.8:
resolved "https://registry.npmmirror.com/csstype/-/csstype-2.6.21.tgz#2efb85b7cc55c80017c66a5ad7cbd931fda3a90e"
integrity sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==
+csstype@^3.1.0:
+ version "3.1.1"
+ resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.1.tgz#841b532c45c758ee546a11d5bd7b7b473c8c30b9"
+ integrity sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==
+
dashdash@^1.12.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
@@ -5295,6 +5314,15 @@ postcss@^8.1.10, postcss@^8.2.6, postcss@^8.3.5, postcss@^8.4.19:
picocolors "^1.0.0"
source-map-js "^1.0.2"
+postcss@^8.4.14:
+ version "8.4.21"
+ resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.21.tgz#c639b719a57efc3187b13a1d765675485f4134f4"
+ integrity sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==
+ dependencies:
+ nanoid "^3.3.4"
+ picocolors "^1.0.0"
+ source-map-js "^1.0.2"
+
prelude-ls@^1.2.1:
version "1.2.1"
resolved "https://registry.npmmirror.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
@@ -6490,6 +6518,13 @@ vue-router@^4.0.3:
dependencies:
"@vue/devtools-api" "^6.4.5"
+vue-splash@^1.2.1:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/vue-splash/-/vue-splash-1.2.1.tgz#d9f4857c39195639545c93a83551c2b323f4be99"
+ integrity sha512-e943XhOtvAZK/Vr1DNAHaD4/A6mQBvubClUN2HozIw+qKktT8PZwOo87LL09xm1oPUee7dS8/XNEDAMGMObacg==
+ dependencies:
+ vue "^2.6.11"
+
vue-style-loader@^4.1.0, vue-style-loader@^4.1.3:
version "4.1.3"
resolved "https://registry.npmmirror.com/vue-style-loader/-/vue-style-loader-4.1.3.tgz#6d55863a51fa757ab24e89d9371465072aa7bc35"
@@ -6527,6 +6562,14 @@ vue3-print-nb@^0.1.4:
dependencies:
vue "^3.0.5"
+vue@^2.6.11:
+ version "2.7.14"
+ resolved "https://registry.yarnpkg.com/vue/-/vue-2.7.14.tgz#3743dcd248fd3a34d421ae456b864a0246bafb17"
+ integrity sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==
+ dependencies:
+ "@vue/compiler-sfc" "2.7.14"
+ csstype "^3.1.0"
+
vue@^3.0.5, vue@^3.2.13:
version "3.2.45"
resolved "https://registry.npmmirror.com/vue/-/vue-3.2.45.tgz#94a116784447eb7dbd892167784619fef379b3c8"