Compare commits

..

8 Commits

15 changed files with 230 additions and 603 deletions

View File

@ -45,15 +45,21 @@ class EstimatesRequest extends FormRequest
'nullable' 'nullable'
], ],
'discount' => [ 'discount' => [
'numeric',
'required', 'required',
], ],
'discount_val' => [ 'discount_val' => [
'integer',
'required', 'required',
], ],
'sub_total' => [ 'sub_total' => [
'integer',
'required', 'required',
], ],
'total' => [ 'total' => [
'integer',
'numeric',
'max:99999999',
'required', 'required',
], ],
'tax' => [ 'tax' => [
@ -77,9 +83,11 @@ class EstimatesRequest extends FormRequest
'required', 'required',
], ],
'items.*.quantity' => [ 'items.*.quantity' => [
'integer',
'required', 'required',
], ],
'items.*.price' => [ 'items.*.price' => [
'integer',
'required', 'required',
], ],
]; ];

View File

@ -45,15 +45,21 @@ class InvoicesRequest extends FormRequest
'nullable' 'nullable'
], ],
'discount' => [ 'discount' => [
'numeric',
'required', 'required',
], ],
'discount_val' => [ 'discount_val' => [
'integer',
'required', 'required',
], ],
'sub_total' => [ 'sub_total' => [
'integer',
'required', 'required',
], ],
'total' => [ 'total' => [
'integer',
'numeric',
'max:99999999',
'required', 'required',
], ],
'tax' => [ 'tax' => [
@ -77,9 +83,11 @@ class InvoicesRequest extends FormRequest
'required', 'required',
], ],
'items.*.quantity' => [ 'items.*.quantity' => [
'integer',
'required', 'required',
], ],
'items.*.price' => [ 'items.*.price' => [
'integer',
'required', 'required',
], ],
]; ];

View File

@ -43,15 +43,21 @@ class RecurringInvoiceRequest extends FormRequest
'nullable' 'nullable'
], ],
'discount' => [ 'discount' => [
'numeric',
'required', 'required',
], ],
'discount_val' => [ 'discount_val' => [
'integer',
'required', 'required',
], ],
'sub_total' => [ 'sub_total' => [
'integer',
'required', 'required',
], ],
'total' => [ 'total' => [
'integer',
'numeric',
'max:99999999',
'required', 'required',
], ],
'tax' => [ 'tax' => [

502
package-lock.json generated
View File

@ -65,13 +65,6 @@
"to-fast-properties": "^2.0.0" "to-fast-properties": "^2.0.0"
} }
}, },
"@esbuild/linux-loong64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz",
"integrity": "sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==",
"dev": true,
"optional": true
},
"@eslint/eslintrc": { "@eslint/eslintrc": {
"version": "0.4.3", "version": "0.4.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz",
@ -221,23 +214,6 @@
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.9.3.tgz", "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.9.3.tgz",
"integrity": "sha512-xDu17cEfh7Kid/d95kB6tZsLOmSWKCZKtprnhVepjsSaCij+lM3mItSJDuuHDMbCWTh8Ejmebwb+KONcCJ0eXQ==" "integrity": "sha512-xDu17cEfh7Kid/d95kB6tZsLOmSWKCZKtprnhVepjsSaCij+lM3mItSJDuuHDMbCWTh8Ejmebwb+KONcCJ0eXQ=="
}, },
"@rvxlab/tailwind-plugin-ios-full-height": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@rvxlab/tailwind-plugin-ios-full-height/-/tailwind-plugin-ios-full-height-1.1.0.tgz",
"integrity": "sha512-jPIxXn0raN/YTk8nXesqM+JbS2WWd5XaUk/MbaAgVDDPyYtsPfeN3B26xIhSa2oE2+JB66tegPUMSOmixzroXg==",
"dev": true
},
"@stripe/stripe-js": {
"version": "1.48.0",
"resolved": "https://registry.npmjs.org/@stripe/stripe-js/-/stripe-js-1.48.0.tgz",
"integrity": "sha512-Kw2BRXk6z/wnTU9m2IJOhxJNrx9xzmpFSbk6D/Z0x6LJntMafiHeHFag2PvSF30O2quMb1UUdWsnZqGVDruZww=="
},
"@tailwindcss/aspect-ratio": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/@tailwindcss/aspect-ratio/-/aspect-ratio-0.4.2.tgz",
"integrity": "sha512-8QPrypskfBa7QIMuKHg2TA7BqES6vhBrDLOv8Unb6FcFyd3TjKbc6lcmb9UPQHxfl24sXoJ41ux/H7qQQvfaSQ==",
"dev": true
},
"@tailwindcss/forms": { "@tailwindcss/forms": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.4.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.4.0.tgz",
@ -247,35 +223,6 @@
"mini-svg-data-uri": "^1.2.3" "mini-svg-data-uri": "^1.2.3"
} }
}, },
"@tailwindcss/line-clamp": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/line-clamp/-/line-clamp-0.3.1.tgz",
"integrity": "sha512-pNr0T8LAc3TUx/gxCfQZRe9NB2dPEo/cedPHzUGIPxqDMhgjwNm6jYxww4W5l0zAsAddxr+XfZcqttGiFDgrGg=="
},
"@tailwindcss/typography": {
"version": "0.5.9",
"resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.9.tgz",
"integrity": "sha512-t8Sg3DyynFysV9f4JDOVISGsjazNb48AeIYQwcL+Bsq5uf4RYL75C1giZ43KISjeDGBaTN3Kxh7Xj/vRSMJUUg==",
"dev": true,
"requires": {
"lodash.castarray": "^4.4.0",
"lodash.isplainobject": "^4.0.6",
"lodash.merge": "^4.6.2",
"postcss-selector-parser": "6.0.10"
},
"dependencies": {
"postcss-selector-parser": {
"version": "6.0.10",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz",
"integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==",
"dev": true,
"requires": {
"cssesc": "^3.0.0",
"util-deprecate": "^1.0.2"
}
}
}
},
"@tiptap/core": { "@tiptap/core": {
"version": "2.0.0-beta.99", "version": "2.0.0-beta.99",
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.0.0-beta.99.tgz", "resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.0.0-beta.99.tgz",
@ -439,11 +386,6 @@
"resolved": "https://registry.npmjs.org/@tiptap/extension-text/-/extension-text-2.0.0-beta.13.tgz", "resolved": "https://registry.npmjs.org/@tiptap/extension-text/-/extension-text-2.0.0-beta.13.tgz",
"integrity": "sha512-0EtAwuRldCAoFaL/iXgkRepEeOd55rPg5N4FQUN1xTwZT7PDofukP0DG/2jff/Uj17x4uTaJAa9qlFWuNnDvjw==" "integrity": "sha512-0EtAwuRldCAoFaL/iXgkRepEeOd55rPg5N4FQUN1xTwZT7PDofukP0DG/2jff/Uj17x4uTaJAa9qlFWuNnDvjw=="
}, },
"@tiptap/extension-text-align": {
"version": "2.0.0-beta.220",
"resolved": "https://registry.npmjs.org/@tiptap/extension-text-align/-/extension-text-align-2.0.0-beta.220.tgz",
"integrity": "sha512-xUYhozdJA0UVLxlrxYLHLhwDYD5oDDiy0omAzFKAyRRtHAkNSPot7Vp7UJW2M0R6XHIQDMFEopxKQNJMBTRk3w=="
},
"@tiptap/starter-kit": { "@tiptap/starter-kit": {
"version": "2.0.0-beta.97", "version": "2.0.0-beta.97",
"resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.0.0-beta.97.tgz", "resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.0.0-beta.97.tgz",
@ -595,12 +537,6 @@
"@types/prosemirror-transform": "*" "@types/prosemirror-transform": "*"
} }
}, },
"@vitejs/plugin-vue": {
"version": "1.10.2",
"resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-1.10.2.tgz",
"integrity": "sha512-/QJ0Z9qfhAFtKRY+r57ziY4BSbGUTGsPRMpB/Ron3QPwBZM4OZAZHdTa4a8PafCwU5DTatXG8TMDoP8z+oDqJw==",
"dev": true
},
"@vue/compiler-core": { "@vue/compiler-core": {
"version": "3.2.4", "version": "3.2.4",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.4.tgz", "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.4.tgz",
@ -622,70 +558,6 @@
"@vue/shared": "3.2.4" "@vue/shared": "3.2.4"
} }
}, },
"@vue/compiler-sfc": {
"version": "3.2.47",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.2.47.tgz",
"integrity": "sha512-rog05W+2IFfxjMcFw10tM9+f7i/+FFpZJJ5XHX72NP9eC2uRD+42M3pYcQqDXVYoj74kHMSEdQ/WmCjt8JFksQ==",
"dev": true,
"requires": {
"@babel/parser": "^7.16.4",
"@vue/compiler-core": "3.2.47",
"@vue/compiler-dom": "3.2.47",
"@vue/compiler-ssr": "3.2.47",
"@vue/reactivity-transform": "3.2.47",
"@vue/shared": "3.2.47",
"estree-walker": "^2.0.2",
"magic-string": "^0.25.7",
"postcss": "^8.1.10",
"source-map": "^0.6.1"
},
"dependencies": {
"@babel/parser": {
"version": "7.21.2",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.2.tgz",
"integrity": "sha512-URpaIJQwEkEC2T9Kn+Ai6Xe/02iNaVCuT/PtoRz3GPVJVDpPd7mLo+VddTbhCRU9TXqW5mSrQfXZyi8kDKOVpQ==",
"dev": true
},
"@vue/compiler-core": {
"version": "3.2.47",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.47.tgz",
"integrity": "sha512-p4D7FDnQb7+YJmO2iPEv0SQNeNzcbHdGByJDsT4lynf63AFkOTFN07HsiRSvjGo0QrxR/o3d0hUyNCUnBU2Tig==",
"dev": true,
"requires": {
"@babel/parser": "^7.16.4",
"@vue/shared": "3.2.47",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
}
},
"@vue/compiler-dom": {
"version": "3.2.47",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.47.tgz",
"integrity": "sha512-dBBnEHEPoftUiS03a4ggEig74J2YBZ2UIeyfpcRM2tavgMWo4bsEfgCGsu+uJIL/vax9S+JztH8NmQerUo7shQ==",
"dev": true,
"requires": {
"@vue/compiler-core": "3.2.47",
"@vue/shared": "3.2.47"
}
},
"@vue/compiler-ssr": {
"version": "3.2.47",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.2.47.tgz",
"integrity": "sha512-wVXC+gszhulcMD8wpxMsqSOpvDZ6xKXSVWkf50Guf/S+28hTAXPDYRTbLQ3EDkOP5Xz/+SY37YiwDquKbJOgZw==",
"dev": true,
"requires": {
"@vue/compiler-dom": "3.2.47",
"@vue/shared": "3.2.47"
}
},
"@vue/shared": {
"version": "3.2.47",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.47.tgz",
"integrity": "sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==",
"dev": true
}
}
},
"@vue/compiler-ssr": { "@vue/compiler-ssr": {
"version": "3.2.19", "version": "3.2.19",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.2.19.tgz", "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.2.19.tgz",
@ -735,45 +607,6 @@
"@vue/shared": "3.2.4" "@vue/shared": "3.2.4"
} }
}, },
"@vue/reactivity-transform": {
"version": "3.2.47",
"resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.2.47.tgz",
"integrity": "sha512-m8lGXw8rdnPVVIdIFhf0LeQ/ixyHkH5plYuS83yop5n7ggVJU+z5v0zecwEnX7fa7HNLBhh2qngJJkxpwEEmYA==",
"dev": true,
"requires": {
"@babel/parser": "^7.16.4",
"@vue/compiler-core": "3.2.47",
"@vue/shared": "3.2.47",
"estree-walker": "^2.0.2",
"magic-string": "^0.25.7"
},
"dependencies": {
"@babel/parser": {
"version": "7.21.2",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.2.tgz",
"integrity": "sha512-URpaIJQwEkEC2T9Kn+Ai6Xe/02iNaVCuT/PtoRz3GPVJVDpPd7mLo+VddTbhCRU9TXqW5mSrQfXZyi8kDKOVpQ==",
"dev": true
},
"@vue/compiler-core": {
"version": "3.2.47",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.47.tgz",
"integrity": "sha512-p4D7FDnQb7+YJmO2iPEv0SQNeNzcbHdGByJDsT4lynf63AFkOTFN07HsiRSvjGo0QrxR/o3d0hUyNCUnBU2Tig==",
"dev": true,
"requires": {
"@babel/parser": "^7.16.4",
"@vue/shared": "3.2.47",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
}
},
"@vue/shared": {
"version": "3.2.47",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.47.tgz",
"integrity": "sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==",
"dev": true
}
}
},
"@vue/ref-transform": { "@vue/ref-transform": {
"version": "3.2.19", "version": "3.2.19",
"resolved": "https://registry.npmjs.org/@vue/ref-transform/-/ref-transform-3.2.19.tgz", "resolved": "https://registry.npmjs.org/@vue/ref-transform/-/ref-transform-3.2.19.tgz",
@ -844,44 +677,6 @@
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.4.tgz", "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.4.tgz",
"integrity": "sha512-j2j1MRmjalVKr3YBTxl/BClSIc8UQ8NnPpLYclxerK65JIowI4O7n8O8lElveEtEoHxy1d7BelPUDI0Q4bumqg==" "integrity": "sha512-j2j1MRmjalVKr3YBTxl/BClSIc8UQ8NnPpLYclxerK65JIowI4O7n8O8lElveEtEoHxy1d7BelPUDI0Q4bumqg=="
}, },
"@vuelidate/components": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/@vuelidate/components/-/components-1.2.3.tgz",
"integrity": "sha512-QE+oSzJVYZUfYcIAsM+QCrB3xRJoesFzUTNtfuYbhWfdMmTHxA9YtKuKWlTsR1nK8+SmHMJROIG8PnL77ZLSuQ==",
"requires": {
"@vuelidate/core": "^2.0.0"
}
},
"@vuelidate/core": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@vuelidate/core/-/core-2.0.0.tgz",
"integrity": "sha512-xIFgdQlScO0aaSZ0wTGPJh8YcTMNAj5veI8yPgiAyxOT+GV7vNQFiU1vpYWCL4cklkkhYvRRSC2OEX7YOZNmPQ==",
"requires": {
"vue-demi": "^0.13.11"
},
"dependencies": {
"vue-demi": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.13.11.tgz",
"integrity": "sha512-IR8HoEEGM65YY3ZJYAjMlKygDQn25D5ajNFNoKh9RSDMQtlzCxtfQjdQgv9jjK+m3377SsJXY8ysq8kLCZL25A=="
}
}
},
"@vuelidate/validators": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@vuelidate/validators/-/validators-2.0.0.tgz",
"integrity": "sha512-fQQcmDWfz7pyH5/JPi0Ng2GEgNK1pUHn/Z/j5rG/Q+HwhgIXvJblTPcZwKOj1ABL7V4UVuGKECvZCDHNGOwdrg==",
"requires": {
"vue-demi": "^0.13.11"
},
"dependencies": {
"vue-demi": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.13.11.tgz",
"integrity": "sha512-IR8HoEEGM65YY3ZJYAjMlKygDQn25D5ajNFNoKh9RSDMQtlzCxtfQjdQgv9jjK+m3377SsJXY8ysq8kLCZL25A=="
}
}
},
"@vueuse/core": { "@vueuse/core": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-6.0.0.tgz", "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-6.0.0.tgz",
@ -1445,175 +1240,6 @@
} }
} }
}, },
"esbuild": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.54.tgz",
"integrity": "sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA==",
"dev": true,
"requires": {
"@esbuild/linux-loong64": "0.14.54",
"esbuild-android-64": "0.14.54",
"esbuild-android-arm64": "0.14.54",
"esbuild-darwin-64": "0.14.54",
"esbuild-darwin-arm64": "0.14.54",
"esbuild-freebsd-64": "0.14.54",
"esbuild-freebsd-arm64": "0.14.54",
"esbuild-linux-32": "0.14.54",
"esbuild-linux-64": "0.14.54",
"esbuild-linux-arm": "0.14.54",
"esbuild-linux-arm64": "0.14.54",
"esbuild-linux-mips64le": "0.14.54",
"esbuild-linux-ppc64le": "0.14.54",
"esbuild-linux-riscv64": "0.14.54",
"esbuild-linux-s390x": "0.14.54",
"esbuild-netbsd-64": "0.14.54",
"esbuild-openbsd-64": "0.14.54",
"esbuild-sunos-64": "0.14.54",
"esbuild-windows-32": "0.14.54",
"esbuild-windows-64": "0.14.54",
"esbuild-windows-arm64": "0.14.54"
}
},
"esbuild-android-64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz",
"integrity": "sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ==",
"dev": true,
"optional": true
},
"esbuild-android-arm64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz",
"integrity": "sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg==",
"dev": true,
"optional": true
},
"esbuild-darwin-64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz",
"integrity": "sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug==",
"dev": true,
"optional": true
},
"esbuild-darwin-arm64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz",
"integrity": "sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw==",
"dev": true,
"optional": true
},
"esbuild-freebsd-64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz",
"integrity": "sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg==",
"dev": true,
"optional": true
},
"esbuild-freebsd-arm64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz",
"integrity": "sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q==",
"dev": true,
"optional": true
},
"esbuild-linux-32": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz",
"integrity": "sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw==",
"dev": true,
"optional": true
},
"esbuild-linux-64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz",
"integrity": "sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg==",
"dev": true,
"optional": true
},
"esbuild-linux-arm": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz",
"integrity": "sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw==",
"dev": true,
"optional": true
},
"esbuild-linux-arm64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz",
"integrity": "sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig==",
"dev": true,
"optional": true
},
"esbuild-linux-mips64le": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz",
"integrity": "sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw==",
"dev": true,
"optional": true
},
"esbuild-linux-ppc64le": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz",
"integrity": "sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ==",
"dev": true,
"optional": true
},
"esbuild-linux-riscv64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz",
"integrity": "sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg==",
"dev": true,
"optional": true
},
"esbuild-linux-s390x": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz",
"integrity": "sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA==",
"dev": true,
"optional": true
},
"esbuild-netbsd-64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz",
"integrity": "sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w==",
"dev": true,
"optional": true
},
"esbuild-openbsd-64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz",
"integrity": "sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw==",
"dev": true,
"optional": true
},
"esbuild-sunos-64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz",
"integrity": "sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw==",
"dev": true,
"optional": true
},
"esbuild-windows-32": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz",
"integrity": "sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w==",
"dev": true,
"optional": true
},
"esbuild-windows-64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz",
"integrity": "sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ==",
"dev": true,
"optional": true
},
"esbuild-windows-arm64": {
"version": "0.14.54",
"resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz",
"integrity": "sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg==",
"dev": true,
"optional": true
},
"escalade": { "escalade": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
@ -2321,24 +1947,12 @@
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
}, },
"lodash.castarray": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz",
"integrity": "sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==",
"dev": true
},
"lodash.clonedeep": { "lodash.clonedeep": {
"version": "4.5.0", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=",
"dev": true "dev": true
}, },
"lodash.isplainobject": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
"dev": true
},
"lodash.merge": { "lodash.merge": {
"version": "4.6.2", "version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@ -2413,9 +2027,9 @@
} }
}, },
"minimist": { "minimist": {
"version": "1.2.8", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true "dev": true
}, },
"modern-normalize": { "modern-normalize": {
@ -2591,22 +2205,6 @@
"integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",
"dev": true "dev": true
}, },
"pinia": {
"version": "2.0.32",
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.0.32.tgz",
"integrity": "sha512-8Tw4OrpCSJ028UUyp0gYPP/wyjigLoEceuO/x1G+FlHVf73337e5vLm4uDmrRIoBG1hvaed/eSHnrCFjOc4nkA==",
"requires": {
"@vue/devtools-api": "^6.5.0",
"vue-demi": "*"
},
"dependencies": {
"@vue/devtools-api": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz",
"integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q=="
}
}
},
"postcss": { "postcss": {
"version": "8.4.5", "version": "8.4.5",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz",
@ -2910,15 +2508,6 @@
"glob": "^7.1.3" "glob": "^7.1.3"
} }
}, },
"rollup": {
"version": "2.77.3",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.77.3.tgz",
"integrity": "sha512-/qxNTG7FbmefJWoeeYJFbHehJ2HNWnjkAFRKzWN/45eNBBF/r8lo992CwcJXEzyVxs5FmfId+vTSTQDb+bxA+g==",
"dev": true,
"requires": {
"fsevents": "~2.3.2"
}
},
"rope-sequence": { "rope-sequence": {
"version": "1.3.2", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.2.tgz", "resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.2.tgz",
@ -3079,12 +2668,6 @@
"has-flag": "^3.0.0" "has-flag": "^3.0.0"
} }
}, },
"supports-preserve-symlinks-flag": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"dev": true
},
"table": { "table": {
"version": "6.7.2", "version": "6.7.2",
"resolved": "https://registry.npmjs.org/table/-/table-6.7.2.tgz", "resolved": "https://registry.npmjs.org/table/-/table-6.7.2.tgz",
@ -3351,86 +2934,12 @@
"resolved": "https://registry.npmjs.org/v-money3/-/v-money3-3.16.1.tgz", "resolved": "https://registry.npmjs.org/v-money3/-/v-money3-3.16.1.tgz",
"integrity": "sha512-U0GjmdybvEwfxCpZiTUbKugSglJbX6wxlyMeg0YJdLTAKlnjMRDph3hpNJlTlg5Gs8MQRpDVdaLysBjV749HLg==" "integrity": "sha512-U0GjmdybvEwfxCpZiTUbKugSglJbX6wxlyMeg0YJdLTAKlnjMRDph3hpNJlTlg5Gs8MQRpDVdaLysBjV749HLg=="
}, },
"v-tooltip": {
"version": "4.0.0-beta.17",
"resolved": "https://registry.npmjs.org/v-tooltip/-/v-tooltip-4.0.0-beta.17.tgz",
"integrity": "sha512-d7v/6KEXQOtcj3NT3Z1LpbDv8SBh8JgbsD+3s/zGIGCxiXC2SoVW6wGV4X0MlCo97PiosibcSe+VKbFiy4AKnQ==",
"requires": {
"@popperjs/core": "^2.11.0",
"vue-resize": "^2.0.0-alpha.1"
},
"dependencies": {
"@popperjs/core": {
"version": "2.11.6",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz",
"integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw=="
}
}
},
"v8-compile-cache": { "v8-compile-cache": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
"integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
"dev": true "dev": true
}, },
"vite": {
"version": "2.9.15",
"resolved": "https://registry.npmjs.org/vite/-/vite-2.9.15.tgz",
"integrity": "sha512-fzMt2jK4vQ3yK56te3Kqpkaeq9DkcZfBbzHwYpobasvgYmP2SoAr6Aic05CsB4CzCZbsDv4sujX3pkEGhLabVQ==",
"dev": true,
"requires": {
"esbuild": "^0.14.27",
"fsevents": "~2.3.2",
"postcss": "^8.4.13",
"resolve": "^1.22.0",
"rollup": ">=2.59.0 <2.78.0"
},
"dependencies": {
"is-core-module": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz",
"integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==",
"dev": true,
"requires": {
"has": "^1.0.3"
}
},
"nanoid": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
"dev": true
},
"postcss": {
"version": "8.4.21",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz",
"integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==",
"dev": true,
"requires": {
"nanoid": "^3.3.4",
"picocolors": "^1.0.0",
"source-map-js": "^1.0.2"
}
},
"resolve": {
"version": "1.22.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
"dev": true,
"requires": {
"is-core-module": "^2.9.0",
"path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0"
}
},
"source-map-js": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
"dev": true
}
}
},
"vue": { "vue": {
"version": "3.2.4", "version": "3.2.4",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.2.4.tgz", "resolved": "https://registry.npmjs.org/vue/-/vue-3.2.4.tgz",
@ -3493,11 +3002,6 @@
"@vue/devtools-api": "^6.0.0-beta.7" "@vue/devtools-api": "^6.0.0-beta.7"
} }
}, },
"vue-resize": {
"version": "2.0.0-alpha.1",
"resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-2.0.0-alpha.1.tgz",
"integrity": "sha512-7+iqOueLU7uc9NrMfrzbG8hwMqchfVfSzpVlCMeJQe4pyibqyoifDNbKTZvwxZKDvGkB+PdFeKvnGZMoEb8esg=="
},
"vue-router": { "vue-router": {
"version": "4.0.11", "version": "4.0.11",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.0.11.tgz", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.0.11.tgz",

View File

@ -271,23 +271,19 @@ const price = computed({
} else { } else {
updateItemAttribute('price', newValue) updateItemAttribute('price', newValue)
} }
setDiscount()
}, },
}) })
const subtotal = computed(() => props.itemData.price * props.itemData.quantity) const subtotal = computed(() => Math.round(props.itemData.price * props.itemData.quantity))
const discount = computed({ const discount = computed({
get: () => { get: () => {
return props.itemData.discount return props.itemData.discount
}, },
set: (newValue) => { set: (newValue) => {
if (props.itemData.discount_type === 'percentage') {
updateItemAttribute('discount_val', (subtotal.value * newValue) / 100)
} else {
updateItemAttribute('discount_val', Math.round(newValue * 100))
}
updateItemAttribute('discount', newValue) updateItemAttribute('discount', newValue)
setDiscount()
}, },
}) })
@ -313,7 +309,7 @@ const showRemoveButton = computed(() => {
const totalSimpleTax = computed(() => { const totalSimpleTax = computed(() => {
return Math.round( return Math.round(
sumBy(props.itemData.taxes, function (tax) { sumBy(props.itemData.taxes, function (tax) {
if (!tax.compound_tax) { if (tax.amount) {
return tax.amount return tax.amount
} }
return 0 return 0
@ -321,18 +317,7 @@ const totalSimpleTax = computed(() => {
) )
}) })
const totalCompoundTax = computed(() => { const totalTax = computed(() => totalSimpleTax.value)
return Math.round(
sumBy(props.itemData.taxes, function (tax) {
if (tax.compound_tax) {
return tax.amount
}
return 0
})
)
})
const totalTax = computed(() => totalSimpleTax.value + totalCompoundTax.value)
const rules = { const rules = {
name: { name: {
@ -416,6 +401,16 @@ function updateTax(data) {
syncItemToStore() syncItemToStore()
} }
function setDiscount() {
const newValue = props.store[props.storeProp].items[props.index].discount
if (props.itemData.discount_type === 'percentage'){
updateItemAttribute('discount_val', Math.round((subtotal.value * newValue) / 100))
}else{
updateItemAttribute('discount_val', Math.round(newValue * 100))
}
}
function searchVal(val) { function searchVal(val) {
updateItemAttribute('name', val) updateItemAttribute('name', val)
} }
@ -485,10 +480,12 @@ function syncItemToStore() {
total: total.value, total: total.value,
sub_total: subtotal.value, sub_total: subtotal.value,
totalSimpleTax: totalSimpleTax.value, totalSimpleTax: totalSimpleTax.value,
totalCompoundTax: totalCompoundTax.value,
totalTax: totalTax.value, totalTax: totalTax.value,
tax: totalTax.value, tax: totalTax.value,
taxes: [...itemTaxes], taxes: [...itemTaxes],
tax_type_ids: itemTaxes.flatMap(_t =>
_t.tax_type_id ? _t.tax_type_id : [],
),
} }
props.store.updateItem(data) props.store.updateItem(data)

View File

@ -146,14 +146,14 @@ const filteredTypes = computed(() => {
}) })
const taxAmount = computed(() => { const taxAmount = computed(() => {
if (localTax.compound_tax && props.discountedTotal) {
return ((props.discountedTotal + props.totalTax) * localTax.percent) / 100
}
if (props.discountedTotal && localTax.percent) { if (props.discountedTotal && localTax.percent) {
const taxPerItemEnabled = props.store[props.storeProp].tax_per_item === 'YES'
const discountPerItemEnabled = props.store[props.storeProp].discount_per_item === 'YES'
if (taxPerItemEnabled && !discountPerItemEnabled){
return getTaxAmount()
}
return (props.discountedTotal * localTax.percent) / 100 return (props.discountedTotal * localTax.percent) / 100
} }
return 0 return 0
}) })
@ -171,6 +171,13 @@ watch(
} }
) )
watch(
() => taxAmount.value,
() => {
updateRowTax()
},
)
// Set SelectedTax // Set SelectedTax
if (props.taxData.tax_type_id > 0) { if (props.taxData.tax_type_id > 0) {
selectedTax.value = taxTypeStore.taxTypes.find( selectedTax.value = taxTypeStore.taxTypes.find(
@ -183,7 +190,6 @@ updateRowTax()
function onSelectTax(val) { function onSelectTax(val) {
localTax.percent = val.percent localTax.percent = val.percent
localTax.tax_type_id = val.id localTax.tax_type_id = val.id
localTax.compound_tax = val.compound_tax
localTax.name = val.name localTax.name = val.name
updateRowTax() updateRowTax()
@ -220,6 +226,27 @@ function openTaxModal() {
function removeTax(index) { function removeTax(index) {
props.store.$patch((state) => { props.store.$patch((state) => {
state[props.storeProp].items[props.itemIndex].taxes.splice(index, 1) state[props.storeProp].items[props.itemIndex].taxes.splice(index, 1)
state[props.storeProp].items[props.itemIndex].tax = 0
state[props.storeProp].items[props.itemIndex].totalTax = 0
}) })
} }
function getTaxAmount() {
let total = 0
let discount = 0
const itemTotal = props.discountedTotal
const modelDiscount = props.store[props.storeProp].discount ? props.store[props.storeProp].discount : 0
const type = props.store[props.storeProp].discount_type
if (modelDiscount > 0) {
props.store[props.storeProp].items.forEach((_i) => {
total += _i.total
})
const proportion = (itemTotal / total).toFixed(2)
discount = type === 'fixed' ? modelDiscount * 100 : (total * modelDiscount) / 100
const itemDiscount = Math.round(discount * proportion)
const discounted = itemTotal - itemDiscount
return Math.round((discounted * localTax.percent) / 100)
}
return Math.round((props.discountedTotal * localTax.percent) / 100)
}
</script> </script>

View File

@ -191,7 +191,7 @@
</template> </template>
<script setup> <script setup>
import { computed, inject, ref } from 'vue' import { computed, inject, ref, watch } from 'vue'
import Guid from 'guid' import Guid from 'guid'
import Tax from './CreateTotalTaxes.vue' import Tax from './CreateTotalTaxes.vue'
import TaxStub from '@/scripts/admin/stub/abilities' import TaxStub from '@/scripts/admin/stub/abilities'
@ -227,19 +227,20 @@ const utils = inject('$utils')
const companyStore = useCompanyStore() const companyStore = useCompanyStore()
watch(
() => props.store[props.storeProp].items,
(val) => {
setDiscount()
}, { deep: true },
)
const totalDiscount = computed({ const totalDiscount = computed({
get: () => { get: () => {
return props.store[props.storeProp].discount return props.store[props.storeProp].discount
}, },
set: (newValue) => { set: (newValue) => {
if (props.store[props.storeProp].discount_type === 'percentage') {
props.store[props.storeProp].discount_val = Math.round(
(props.store.getSubTotal * newValue) / 100
)
} else {
props.store[props.storeProp].discount_val = Math.round(newValue * 100)
}
props.store[props.storeProp].discount = newValue props.store[props.storeProp].discount = newValue
setDiscount()
}, },
}) })
@ -265,7 +266,7 @@ const itemWiseTaxes = computed(() => {
} else if (tax.tax_type_id) { } else if (tax.tax_type_id) {
taxes.push({ taxes.push({
tax_type_id: tax.tax_type_id, tax_type_id: tax.tax_type_id,
amount: tax.amount, amount: Math.round(tax.amount),
percent: tax.percent, percent: tax.percent,
name: tax.name, name: tax.name,
}) })
@ -284,6 +285,19 @@ const defaultCurrency = computed(() => {
} }
}) })
function setDiscount() {
const newValue = props.store[props.storeProp].discount
if (props.store[props.storeProp].discount_type === 'percentage') {
props.store[props.storeProp].discount_val
= Math.round((props.store.getSubTotal * newValue) / 100)
return
}
props.store[props.storeProp].discount_val = Math.round(newValue * 100)
}
function selectFixed() { function selectFixed() {
if (props.store[props.storeProp].discount_type === 'fixed') { if (props.store[props.storeProp].discount_type === 'fixed') {
return return
@ -298,21 +312,18 @@ function selectPercentage() {
if (props.store[props.storeProp].discount_type === 'percentage'){ if (props.store[props.storeProp].discount_type === 'percentage'){
return return
} }
props.store[props.storeProp].discount_val =
(props.store.getSubTotal * props.store[props.storeProp].discount) / 100 const val = Math.round(props.store[props.storeProp].discount * 100) / 100
props.store[props.storeProp].discount_val
= Math.round((props.store.getSubTotal * val) / 100)
props.store[props.storeProp].discount_type = 'percentage' props.store[props.storeProp].discount_type = 'percentage'
} }
function onSelectTax(selectedTax) { function onSelectTax(selectedTax) {
let amount = 0 let amount = 0
if (props.store.getSubtotalWithDiscount && selectedTax.percent) {
if (selectedTax.compound_tax && props.store.getSubtotalWithDiscount) {
amount = Math.round(
((props.store.getSubtotalWithDiscount + props.store.getTotalSimpleTax) *
selectedTax.percent) /
100
)
} else if (props.store.getSubtotalWithDiscount && selectedTax.percent) {
amount = Math.round( amount = Math.round(
(props.store.getSubtotalWithDiscount * selectedTax.percent) / 100 (props.store.getSubtotalWithDiscount * selectedTax.percent) / 100
) )
@ -323,7 +334,6 @@ function onSelectTax(selectedTax) {
id: Guid.raw(), id: Guid.raw(),
name: selectedTax.name, name: selectedTax.name,
percent: selectedTax.percent, percent: selectedTax.percent,
compound_tax: selectedTax.compound_tax,
tax_type_id: selectedTax.id, tax_type_id: selectedTax.id,
amount, amount,
} }

View File

@ -77,17 +77,6 @@
@input="v$.currentTaxType.description.$touch()" @input="v$.currentTaxType.description.$touch()"
/> />
</BaseInputGroup> </BaseInputGroup>
<BaseInputGroup
:label="$t('tax_types.compound_tax')"
variant="horizontal"
class="flex flex-row-reverse"
>
<BaseSwitch
v-model="taxTypeStore.currentTaxType.compound_tax"
class="flex items-center"
/>
</BaseInputGroup>
</BaseInputGrid> </BaseInputGrid>
</div> </div>
<div <div
@ -209,14 +198,7 @@ async function submitTaxTypeData() {
function SelectTax(taxData) { function SelectTax(taxData) {
let amount = 0 let amount = 0
if (taxData.compound_tax && estimateStore.getSubtotalWithDiscount) { if (estimateStore.getSubtotalWithDiscount && taxData.percent) {
amount = Math.round(
((estimateStore.getSubtotalWithDiscount +
estimateStore.getTotalSimpleTax) *
taxData.percent) /
100
)
} else if (estimateStore.getSubtotalWithDiscount && taxData.percent) {
amount = Math.round( amount = Math.round(
(estimateStore.getSubtotalWithDiscount * taxData.percent) / 100 (estimateStore.getSubtotalWithDiscount * taxData.percent) / 100
) )
@ -226,7 +208,6 @@ function SelectTax(taxData) {
id: Guid.raw(), id: Guid.raw(),
name: taxData.name, name: taxData.name,
percent: taxData.percent, percent: taxData.percent,
compound_tax: taxData.compound_tax,
tax_type_id: taxData.id, tax_type_id: taxData.id,
amount, amount,
} }
@ -242,7 +223,6 @@ function selectItemTax(taxData) {
id: Guid.raw(), id: Guid.raw(),
name: taxData.name, name: taxData.name,
percent: taxData.percent, percent: taxData.percent,
compound_tax: taxData.compound_tax,
tax_type_id: taxData.id, tax_type_id: taxData.id,
} }
modalStore.refreshData(data) modalStore.refreshData(data)

View File

@ -143,7 +143,8 @@ export const useEstimateStore = (useWindow = false) => {
axios axios
.get(`/api/v1/estimates/${id}`) .get(`/api/v1/estimates/${id}`)
.then((response) => { .then((response) => {
Object.assign(this.newEstimate, response.data.data) this.setEstimateData(response.data.data)
this.setCustomerAddresses(this.newEstimate.customer)
resolve(response) resolve(response)
}) })
.catch((err) => { .catch((err) => {
@ -154,6 +155,41 @@ export const useEstimateStore = (useWindow = false) => {
}) })
}, },
setEstimateData(estimate) {
Object.assign(this.newEstimate, estimate)
if (this.newEstimate.tax_per_item === 'YES') {
this.newEstimate.items.forEach((_i) => {
if (_i.taxes && !_i.taxes.length){
_i.taxes.push({ ...taxStub, id: Guid.raw() })
}
})
}
if (this.newEstimate.discount_per_item === 'YES') {
this.newEstimate.items.forEach((_i, index) => {
if (_i.discount_type === 'fixed'){
this.newEstimate.items[index].discount = _i.discount / 100
}
})
}
else {
if (this.newEstimate.discount_type === 'fixed'){
this.newEstimate.discount = this.newEstimate.discount / 100
}
}
},
setCustomerAddresses(customer) {
const customer_business = customer.customer_business
if (customer_business?.billing_address){
this.newEstimate.customer.billing_address = customer_business.billing_address
}
if (customer_business?.shipping_address){
this.newEstimate.customer.shipping_address = customer_business.shipping_address
}
},
addSalesTaxUs() { addSalesTaxUs() {
const taxTypeStore = useTaxTypeStore() const taxTypeStore = useTaxTypeStore()
let salesTax = { ...taxStub } let salesTax = { ...taxStub }

View File

@ -133,8 +133,8 @@ export const useInvoiceStore = (useWindow = false) => {
axios axios
.get(`/api/v1/invoices/${id}`) .get(`/api/v1/invoices/${id}`)
.then((response) => { .then((response) => {
Object.assign(this.newInvoice, response.data.data) this.setInvoiceData(response.data.data)
this.newInvoice.customer = response.data.data.customer this.setCustomerAddresses(this.newInvoice.customer)
resolve(response) resolve(response)
}) })
.catch((err) => { .catch((err) => {
@ -144,6 +144,38 @@ export const useInvoiceStore = (useWindow = false) => {
}) })
}, },
setInvoiceData(invoice) {
Object.assign(this.newInvoice, invoice)
if (this.newInvoice.tax_per_item === 'YES') {
this.newInvoice.items.forEach((_i) => {
if (_i.taxes && !_i.taxes.length)
_i.taxes.push({ ...taxStub, id: Guid.raw() })
})
}
if (this.newInvoice.discount_per_item === 'YES') {
this.newInvoice.items.forEach((_i, index) => {
if (_i.discount_type === 'fixed')
this.newInvoice.items[index].discount = _i.discount / 100
})
}
else {
if (this.newInvoice.discount_type === 'fixed')
this.newInvoice.discount = this.newInvoice.discount / 100
}
},
setCustomerAddresses(customer) {
const customer_business = customer.customer_business
if (customer_business?.billing_address)
this.newInvoice.customer.billing_address = customer_business.billing_address
if (customer_business?.shipping_address)
this.newInvoice.customer.shipping_address = customer_business.shipping_address
},
addSalesTaxUs() { addSalesTaxUs() {
const taxTypeStore = useTaxTypeStore() const taxTypeStore = useTaxTypeStore()
let salesTax = { ...taxStub } let salesTax = { ...taxStub }

View File

@ -138,6 +138,7 @@
<script setup> <script setup>
import { computed, ref, watch, onMounted } from 'vue' import { computed, ref, watch, onMounted } from 'vue'
import { cloneDeep } from 'lodash'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { import {
@ -257,11 +258,30 @@ async function submitForm() {
isSaving.value = true isSaving.value = true
let data = { let data = cloneDeep({
...estimateStore.newEstimate, ...estimateStore.newEstimate,
sub_total: estimateStore.getSubTotal, sub_total: estimateStore.getSubTotal,
total: estimateStore.getTotal, total: estimateStore.getTotal,
tax: estimateStore.getTotalTax, tax: estimateStore.getTotalTax,
})
if (data.discount_per_item === 'YES') {
data.items.forEach((item, index) => {
if (item.discount_type === 'fixed'){
data.items[index].discount = Math.round(item.discount * 100)
}
})
}
else {
if (data.discount_type === 'fixed'){
data.discount = Math.round(data.discount * 100)
}
}
if (
!estimateStore.newEstimate.tax_per_item === 'YES'
&& data.taxes.length
){
data.tax_type_ids = data.taxes.map(_t => _t.tax_type_id)
} }
const action = isEdit.value const action = isEdit.value

View File

@ -147,6 +147,7 @@ import {
decimal, decimal,
} from '@vuelidate/validators' } from '@vuelidate/validators'
import useVuelidate from '@vuelidate/core' import useVuelidate from '@vuelidate/core'
import { cloneDeep } from 'lodash'
import { useInvoiceStore } from '@/scripts/admin/stores/invoice' import { useInvoiceStore } from '@/scripts/admin/stores/invoice'
import { useModuleStore } from '@/scripts/admin/stores/module' import { useModuleStore } from '@/scripts/admin/stores/module'
@ -258,11 +259,29 @@ async function submitForm() {
isSaving.value = true isSaving.value = true
let data = { let data = cloneDeep({
...invoiceStore.newInvoice, ...invoiceStore.newInvoice,
sub_total: invoiceStore.getSubTotal, sub_total: invoiceStore.getSubTotal,
total: invoiceStore.getTotal, total: invoiceStore.getTotal,
tax: invoiceStore.getTotalTax, tax: invoiceStore.getTotalTax,
})
if (data.discount_per_item === 'YES') {
data.items.forEach((item, index) => {
if (item.discount_type === 'fixed'){
data.items[index].discount = item.discount * 100
}
})
}
else {
if (data.discount_type === 'fixed'){
data.discount = data.discount * 100
}
}
if (
!invoiceStore.newInvoice.tax_per_item === 'YES'
&& data.taxes.length
){
data.tax_type_ids = data.taxes.map(_t => _t.tax_type_id)
} }
try { try {

View File

@ -20,21 +20,6 @@
:data="fetchData" :data="fetchData"
:columns="taxTypeColumns" :columns="taxTypeColumns"
> >
<template #cell-compound_tax="{ row }">
<BaseBadge
:bg-color="
utils.getBadgeStatusColor(row.data.compound_tax ? 'YES' : 'NO')
.bgColor
"
:color="
utils.getBadgeStatusColor(row.data.compound_tax ? 'YES' : 'NO')
.color
"
>
{{ row.data.compound_tax ? 'Yes' : 'No'.replace('_', ' ') }}
</BaseBadge>
</template>
<template #cell-percent="{ row }"> {{ row.data.percent }} % </template> <template #cell-percent="{ row }"> {{ row.data.percent }} % </template>
<template v-if="hasAtleastOneAbility()" #cell-actions="{ row }"> <template v-if="hasAtleastOneAbility()" #cell-actions="{ row }">
@ -91,11 +76,6 @@ const taxTypeColumns = computed(() => {
thClass: 'extra', thClass: 'extra',
tdClass: 'font-medium text-gray-900', tdClass: 'font-medium text-gray-900',
}, },
{
key: 'compound_tax',
label: t('settings.tax_types.compound_tax'),
tdClass: 'font-medium text-gray-900',
},
{ {
key: 'percent', key: 'percent',
label: t('settings.tax_types.percent'), label: t('settings.tax_types.percent'),

View File

@ -309,6 +309,8 @@ function changeSorting(column) {
} }
if (!usesLocalData.value) { if (!usesLocalData.value) {
if (pagination.value)
pagination.value.currentPage = 1
mapDataToRows() mapDataToRows()
} }
} }
@ -326,7 +328,10 @@ async function pageChange(page) {
await mapDataToRows() await mapDataToRows()
} }
async function refresh() { async function refresh(isPreservePage = false) {
if (pagination.value && !isPreservePage)
pagination.value.currentPage = 1
await mapDataToRows() await mapDataToRows()
} }

View File

@ -367,11 +367,6 @@
resolved "https://registry.yarnpkg.com/@tiptap/extension-strike/-/extension-strike-2.0.0-beta.17.tgz#2280ea4e8c50189c2729814d2ae484e58c712a36" resolved "https://registry.yarnpkg.com/@tiptap/extension-strike/-/extension-strike-2.0.0-beta.17.tgz#2280ea4e8c50189c2729814d2ae484e58c712a36"
integrity sha512-+WRd0RuCK4+jFKNVN+4rHTa5VMqqGDO2uc+TknkqhFqWp/z96OAGlpHJOwPrnW1fLbpjEBBQIr1vVYSw6KgcZg== integrity sha512-+WRd0RuCK4+jFKNVN+4rHTa5VMqqGDO2uc+TknkqhFqWp/z96OAGlpHJOwPrnW1fLbpjEBBQIr1vVYSw6KgcZg==
"@tiptap/extension-text-align@^2.0.0-beta.29":
version "2.0.0-beta.220"
resolved "https://registry.yarnpkg.com/@tiptap/extension-text-align/-/extension-text-align-2.0.0-beta.220.tgz#d88acc2306ae549756616ba60d9eccf4ad13e267"
integrity sha512-xUYhozdJA0UVLxlrxYLHLhwDYD5oDDiy0omAzFKAyRRtHAkNSPot7Vp7UJW2M0R6XHIQDMFEopxKQNJMBTRk3w==
"@tiptap/extension-text@^2.0.0-beta.13": "@tiptap/extension-text@^2.0.0-beta.13":
version "2.0.0-beta.13" version "2.0.0-beta.13"
resolved "https://registry.yarnpkg.com/@tiptap/extension-text/-/extension-text-2.0.0-beta.13.tgz#da0af8d9a3f149d20076e15d88c6af21fb6d940f" resolved "https://registry.yarnpkg.com/@tiptap/extension-text/-/extension-text-2.0.0-beta.13.tgz#da0af8d9a3f149d20076e15d88c6af21fb6d940f"
@ -2013,9 +2008,9 @@ minimatch@^3.0.4:
brace-expansion "^1.1.7" brace-expansion "^1.1.7"
minimist@^1.1.1: minimist@^1.1.1:
version "1.2.8" version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
modern-normalize@^1.1.0: modern-normalize@^1.1.0:
version "1.1.0" version "1.1.0"