#8113 create arrayDataStore map #979
270
CHANGELOG.md
270
CHANGELOG.md
|
@ -1,3 +1,273 @@
|
||||||
|
# Version 24.50 - 2024-12-10
|
||||||
|
|
||||||
|
### Added 🆕
|
||||||
|
|
||||||
|
- feat: add reportFileName option by:Javier Segarra
|
||||||
|
- feat: all clients just with global series by:jgallego
|
||||||
|
- feat: improve Merge branch 'test' into dev by:Javier Segarra
|
||||||
|
- feat: manual invoice in two lines by:jgallego
|
||||||
|
- feat: manualInvoice with address by:jgallego
|
||||||
|
- feat: randomize functions and example by:Javier Segarra
|
||||||
|
- feat: refs #6999 added search when user tabs on a filter with value by:Jon
|
||||||
|
- feat: refs #6999 added tab to search in VnTable filter by:Jon
|
||||||
|
- feat: refs #7346 #7346 improve form by:Javier Segarra
|
||||||
|
- feat: refs #7346 address ordered by:jgallego
|
||||||
|
- feat: refs #7346 radioButton by:jgallego
|
||||||
|
- feat: refs #7346 style radioButton by:jgallego
|
||||||
|
- feat: refs #7346 traducciones en cammelCase (7346-manualInvoice) by:jgallego
|
||||||
|
- feat: refs #8038 added new functionality in VnSelect and refactor styles by:Jon
|
||||||
|
- feat: refs #8061 #8061 updates by:Javier Segarra
|
||||||
|
- feat: refs #8087 reactive data by:jorgep
|
||||||
|
- feat: refs #8087 refs#8087 Redadas en travel by:Carlos Andrés
|
||||||
|
- feat: refs #8138 add component ticket problems by:pablone
|
||||||
|
- feat: refs #8163 add max length and more tests by:wbuezas
|
||||||
|
- feat: refs #8163 add prop by:wbuezas
|
||||||
|
- feat: refs #8163 add VnInput insert functionality and e2e test by:wbuezas
|
||||||
|
- feat: refs #8163 limit with maxLength by:Javier Segarra
|
||||||
|
- feat: refs #8163 maxLength SupplierFD account by:Javier Segarra
|
||||||
|
- feat: refs #8163 maxLengthVnInput by:Javier Segarra
|
||||||
|
- feat: refs #8163 use VnAccountNumber in VnAccountNumber by:Javier Segarra
|
||||||
|
- feat: refs #8166 show notification by:jorgep
|
||||||
|
|
||||||
|
### Changed 📦
|
||||||
|
|
||||||
|
- feat: refs #8038 added new functionality in VnSelect and refactor styles by:Jon
|
||||||
|
- perf: add dataCy by:Javier Segarra
|
||||||
|
- perf: refs #7346 #7346 Imrpove interface dialog by:Javier Segarra
|
||||||
|
- perf: refs #7346 #7346 use v-show instead v-if by:Javier Segarra
|
||||||
|
- perf: refs #8036 currentFilter by:alexm
|
||||||
|
- perf: refs #8061 filter autonomy by:Javier Segarra
|
||||||
|
- perf: refs #8061 solve conflicts and random posCode it by:Javier Segarra
|
||||||
|
- perf: refs #8061 use opts from VnSelect by:Javier Segarra
|
||||||
|
- perf: refs #8163 #8061 createNewPostCodeForm by:Javier Segarra
|
||||||
|
- perf: remove console by:Javier Segarra
|
||||||
|
- perf: remove timeout by:Javier Segarra
|
||||||
|
- perf: test command fillInForm by:Javier Segarra
|
||||||
|
- refactor: refs #8162 remove comment by:wbuezas
|
||||||
|
- refactor: remove unnecesary things by:wbuezas
|
||||||
|
|
||||||
|
### Fixed 🛠️
|
||||||
|
|
||||||
|
- fix: #8016 fetching data by:Javier Segarra
|
||||||
|
- fix: icons by:jgallego
|
||||||
|
- fix: refs #7229 download file by:jorgep
|
||||||
|
- fix: refs #7229 remove catch by:jorgep
|
||||||
|
- fix: refs #7229 set url by:jorgep
|
||||||
|
- fix: refs #7229 test by:jorgep
|
||||||
|
- fix: refs #7229 url by:jorgep
|
||||||
|
- fix: refs #7229 url + test by:jorgep
|
||||||
|
- fix: refs #7304 7304 clean warning by:carlossa
|
||||||
|
- fix: refs #7304 fix list by:carlossa
|
||||||
|
- fix: refs #7304 fix warning by:carlossa
|
||||||
|
- fix: refs #7346 traslations by:jgallego
|
||||||
|
- fix: refs #7529 add save by:carlossa
|
||||||
|
- fix: refs #7529 fix e2e by:carlossa
|
||||||
|
- fix: refs #7529 fix front by:carlossa
|
||||||
|
- fix: refs #7529 fix scss by:carlossa
|
||||||
|
- fix: refs #7529 fix te2e by:carlossa
|
||||||
|
- fix: refs #7529 fix workerPit e2e by:carlossa
|
||||||
|
- fix: refs #7529 front by:carlossa
|
||||||
|
- fix: refs #8036 apply exprBuilder after save filters by:alexm
|
||||||
|
- fix: refs #8036 only add where when required by:alexm
|
||||||
|
- fix: refs #8038 solve conflicts by:Jon
|
||||||
|
- fix: refs #8061 improve code dependencies (origin/8061_improve_newCP) by:Javier Segarra
|
||||||
|
- fix: refs #8138 move component from ui folder by:pablone
|
||||||
|
- fix: refs #8138 sme minor issues by:pablone
|
||||||
|
- fix: refs #8163 #8061 createNewPostCodeForm by:Javier Segarra
|
||||||
|
- fix: refs #8163 minor problem when keypress by:Javier Segarra
|
||||||
|
- fix: refs #8166 show zone error by:jorgep
|
||||||
|
- fix: removed selectedClient by:jgallego
|
||||||
|
- refs #7529 fix workerPit by:carlossa
|
||||||
|
- revert: refs #8061 test #8061 updates by:Javier Segarra
|
||||||
|
- test: fix own test by:Javier Segarra
|
||||||
|
- test: refs #8162 #8162 fix TicketList spec by:Javier Segarra
|
||||||
|
|
||||||
|
# Version 24.48 - 2024-11-25
|
||||||
|
|
||||||
|
### Added 🆕
|
||||||
|
|
||||||
|
- chore: correct checkNotification (fix_customer_issues) by:alexm
|
||||||
|
- chore: perf (warmFix_order_equalSalix) by:alexm
|
||||||
|
- chore: refs #6818 add spaces by:jorgep
|
||||||
|
- chore: refs #6818 drop useless code & comment by:jorgep
|
||||||
|
- chore: refs #7273 sticky add btn & refactor by:jorgep
|
||||||
|
- chore: refs #7524 fix test by:jorgep
|
||||||
|
- chore: refs #8039 not required by:alexm
|
||||||
|
- chore: refs #8078 fiz tests by:jorgep
|
||||||
|
- chore: refs #8078 rollback ref by:jorgep
|
||||||
|
- chore: remove console.log (warmFix_invoiceOut_Global) by:alexm
|
||||||
|
- chore: typo (fix_itemType-redirection) by:alexm
|
||||||
|
- feat: #6943 use openURL quasar by:Javier Segarra
|
||||||
|
- feat: #7782 add cypress report by:Javier Segarra
|
||||||
|
- feat: #7782 cypress.config watchForFileChanges by:Javier Segarra
|
||||||
|
- feat: #7782 npm run resetDatabase by:Javier Segarra
|
||||||
|
- feat: #7782 waitUntil domContentLoad by:Javier Segarra
|
||||||
|
- feat: added composable to confirm orders by:Jon
|
||||||
|
- feat: add /reports in gitignore (warmFix_reports_in_gitignore) by:alexm
|
||||||
|
- feat: apply changes for customerModule by:Javier Segarra
|
||||||
|
- feat: disabled buttons by:Javier Segarra
|
||||||
|
- feat: move buttons to DescriptorMenu by:Javier Segarra
|
||||||
|
- feat: refs #6818 add icon by:jorgep
|
||||||
|
- feat: refs #6818 fetch url & default channel by:jorgep
|
||||||
|
- feat: refs #6818 saysimple integration by:jorgep
|
||||||
|
- feat: refs #6839 module searching (6839-addSearchMenu) by:jorgep
|
||||||
|
- feat: refs #6839 normalize search by:jorgep
|
||||||
|
- feat: refs #6919 sync entry data by:jorgep
|
||||||
|
- feat: refs #7006 itemType basic data new inputs by:guillermo
|
||||||
|
- feat: refs #7006 itemTypeLog added by:guillermo
|
||||||
|
- feat: refs #7193 modified parking to use the scope and corrected small errors by:Jon
|
||||||
|
- feat: refs #7206 added inactive label and corrected minor errors by:Jon
|
||||||
|
- feat: refs #7308 #7308 remove warnings related to useSession by:Javier Segarra
|
||||||
|
- feat: refs #7349 usa back con permisos by:jgallego
|
||||||
|
- feat: refs #7524 add front test by:jorgep
|
||||||
|
- feat: refs #7874 improve vn-notes ui by:jorgep
|
||||||
|
- feat: refs #7970 notify changes by:Jon
|
||||||
|
- feat(): refs #8039 canceledError not notify by:alexm
|
||||||
|
- feat: refs #8039 notify error unify by:alexm
|
||||||
|
- feat: refs #8039 show duplicate request in local by:alexm
|
||||||
|
- feat: refs #8078 add shortcut multi selection by:jorgep
|
||||||
|
- feat: refs #8078 add tests by:jorgep
|
||||||
|
- feat: refs#8087 Redadas en travel by:Carlos Andrés
|
||||||
|
- feat: refs #8087 Traspasar redadas a travels by:Carlos Andrés
|
||||||
|
- feat: remove comments by:Javier Segarra
|
||||||
|
- feat(Supplier): add companySize by:alexm
|
||||||
|
- feat: use composable to unify logic by:Javier Segarra
|
||||||
|
- feat(VnInput): empty to null by:alexm
|
||||||
|
- feat(VnSelect): order data equal salix by:alexm
|
||||||
|
- feat(VnSelect): refs #7136 add scroll (7136-vnSelect_paginate_simplify_2) by:alexm
|
||||||
|
|
||||||
|
### Changed 📦
|
||||||
|
|
||||||
|
- chore: perf (warmFix_order_equalSalix) by:alexm
|
||||||
|
- chore: refs #7273 sticky add btn & refactor by:jorgep
|
||||||
|
- fix: better performance (warmFix_accountAcls) by:alexm
|
||||||
|
- perf: minor bugs detected by:Javier Segarra
|
||||||
|
- perf: refs #6943 #6943 merge command by:Javier Segarra
|
||||||
|
- perf: refs #7283 #7283 declare composable inst4ead code duplicated by:Javier Segarra
|
||||||
|
- perf: refs #7283 #7283 handle composable i18n by:Javier Segarra
|
||||||
|
- perf: refs #7283 #7283 handle i18n by:Javier Segarra
|
||||||
|
- perf: refs #7283 #7283 i18n params by:Javier Segarra
|
||||||
|
- perf: refs #7308 #7308 remove comments by:Javier Segarra
|
||||||
|
- perf: remove appendParams by:Javier Segarra
|
||||||
|
- perf: use const in VnLocation by:Javier Segarra
|
||||||
|
- perf: use required instead :required="true" by:Javier Segarra
|
||||||
|
- refactor: apply QPopupProxy by:wbuezas
|
||||||
|
- refactor: changed confirmOrder directory by:Jon
|
||||||
|
- refactor: change keyup.enter for update:model-value by:wbuezas
|
||||||
|
- refactor(InvoiceInBasicData): use VnDms by:alexm
|
||||||
|
- refactor: modified composable by:Jon
|
||||||
|
- refactor: refs #6818 change channel source by:jorgep
|
||||||
|
- refactor: refs #6818 channel logic by:jorgep
|
||||||
|
- refactor: refs #6919 export filter by:jorgep
|
||||||
|
- refactor: refs #7132 1st wave of changes in global translations files by:Jon
|
||||||
|
- refactor: refs #7132 account's module translations by:Jon
|
||||||
|
- refactor: refs #7132 customer's module translations by:Jon
|
||||||
|
- refactor: refs #7132 deleted pageTitles repeated by:Jon
|
||||||
|
- refactor: refs #7132 delete duplicate translations' keys by:Jon
|
||||||
|
- refactor: refs #7132 deleted useless code by:Jon
|
||||||
|
- refactor: refs #7132 global translations files changed by:Jon
|
||||||
|
- refactor: refs #7266 Changed method name by:guillermo
|
||||||
|
- refactor: refs #7950 Created cmr model by:guillermo
|
||||||
|
- refactor: refs #7970 added emit by:Jon
|
||||||
|
- refactor: refs #7970 refactored VnConfirm to emit events by:Jon
|
||||||
|
- refactor: refs #8185 modified LeftMenu to avoid duplicates by:Jon
|
||||||
|
- refactor: remove unused variable by:wbuezas
|
||||||
|
- refactor: revert catalog changes by:Jon
|
||||||
|
- refactor: small change by:wbuezas
|
||||||
|
- test: refactor e2e by:alexm
|
||||||
|
- test: refs #8039 add hasNotify and, refactor: agencyWorkCenter test by:alexm
|
||||||
|
|
||||||
|
### Fixed 🛠️
|
||||||
|
|
||||||
|
- chore: refs #7524 fix test by:jorgep
|
||||||
|
- fix: better performance (warmFix_accountAcls) by:alexm
|
||||||
|
- fix: catalog view category and type filter by:wbuezas
|
||||||
|
- fix: category and tags filters by:Jon
|
||||||
|
- fix: changed route.query by:Jon
|
||||||
|
- fix: change type vnput by:Javier Segarra
|
||||||
|
- fix(ClaimList): stateCode orderBy priority by:alexm
|
||||||
|
- fix: entryFilters by:carlossa
|
||||||
|
- fix: filter panel by:Jon
|
||||||
|
- fix(InvoiceOutGlobal): parallelism by:alexm
|
||||||
|
- fix: itemBotanical by:Javier Segarra
|
||||||
|
- fix: itemType redirection and fix filters by:alexm
|
||||||
|
- fix: logout spec (warmFix_logout.spec) by:alexm
|
||||||
|
- fix: merge errors by:alexm
|
||||||
|
- fix: order catalog by:wbuezas
|
||||||
|
- fix: order catalog fixes by:wbuezas
|
||||||
|
- fix: refs #6818 use right icon by:jorgep
|
||||||
|
- fix: refs #6896 fixed module problems by:Jon
|
||||||
|
- fix: refs #7193 fixed e2e test by:Jon
|
||||||
|
- fix: refs #7206 deleted duplicate code by:Jon
|
||||||
|
- fix: refs #7273 use same filter by:jorgep
|
||||||
|
- fix: refs #7283 #7283 bugs by:Javier Segarra
|
||||||
|
- fix: refs #7283 #7283 ItemDiary subToolbar by:Javier Segarra
|
||||||
|
- fix: refs #7283 #7283 ItemSummary bugs by:Javier Segarra
|
||||||
|
- fix: refs #7283 Account image resolution by:guillermo
|
||||||
|
- fix: refs #7283 css by:jorgep
|
||||||
|
- fix: refs #7283 filter by:carlossa
|
||||||
|
- fix: refs #7283 fix image by:carlossa
|
||||||
|
- fix: refs #7283 fix pr by:carlossa
|
||||||
|
- fix: refs #7283 fix preview by:carlossa
|
||||||
|
- fix: refs #7283 fix required by:carlossa
|
||||||
|
- fix: refs #7283 item filters by:carlossa
|
||||||
|
- fix: refs #7283 itemtype fix by:carlossa
|
||||||
|
- fix: refs #7283 order translation by:carlossa
|
||||||
|
- fix: refs #7283 preview by:carlossa
|
||||||
|
- fix: refs #7283 tooltips !Item by:Javier Segarra
|
||||||
|
- fix: refs #7306 clean warning by:carlossa
|
||||||
|
- fix: refs #7310 clean warning by:carlossa
|
||||||
|
- fix: refs #7323 locale #7396 by:jorgep
|
||||||
|
- fix: refs #7323 show advanced fields by:jorgep
|
||||||
|
- fix: refs #7349 dependencia no usada by:jgallego
|
||||||
|
- fix: refs #7524 e2e & worker module by:jorgep
|
||||||
|
- fix: refs #7874 add title by:jorgep
|
||||||
|
- fix: refs #7874 show name by:jorgep
|
||||||
|
- fix: refs #7943 use correct data-key by:jorgep
|
||||||
|
- fix: refs #7943 use summary by:jorgep
|
||||||
|
- fix: refs #8039 bad tests by:alexm
|
||||||
|
- fix: refs #8039 o not handle unnecessary errors by:alexm
|
||||||
|
- fix: refs #8078 e2e #7970 by:jorgep
|
||||||
|
- fix: refs #8078 handleSelection by:jorgep
|
||||||
|
- fix: refs #8078 improve cy command (8078-enableMultiSelection) by:jorgep
|
||||||
|
- fix: refs #8078 improve handleSelection by:jorgep
|
||||||
|
- fix: reset category by:wbuezas
|
||||||
|
- fix: tag chips by:Jon
|
||||||
|
- fix: vnSearchbar spec (warmFix_vnSearchBar.spec) by:alexm
|
||||||
|
- fix(VnSelect): setOptions when applyFilter by:alexm
|
||||||
|
- fix: worker test e2e by:Jon
|
||||||
|
- Merge branch 'dev' into fix_customer_issues by:Javier Segarra
|
||||||
|
- refactor: revert catalog changes by:Jon
|
||||||
|
- refs #7283 fix conflicts by:carlossa
|
||||||
|
- refs #7283 fix descriptorproxy by:carlossa
|
||||||
|
- refs #7283 fixedPrice by:carlossa
|
||||||
|
- refs #7283 fixedPrices by:carlossa
|
||||||
|
- refs #7283 fix itemFixed by:carlossa
|
||||||
|
- refs #7283 fix itemFixedPrice by:carlossa
|
||||||
|
- refs #7283 fix itemMigration by:carlossa
|
||||||
|
- refs #7283 fix itemMigration list filters by:carlossa
|
||||||
|
- refs #7283 fix items by:carlossa
|
||||||
|
- refs #7283 fix items error get images by:carlossa
|
||||||
|
- refs #7283 fix items images by:carlossa
|
||||||
|
- refs #7283 fix request by:carlossa
|
||||||
|
- refs #7283 fix searchbar by:carlossa
|
||||||
|
- refs #7283 fix viewSummary by:carlossa
|
||||||
|
- refs #7283 fix yml list basicData by:carlossa
|
||||||
|
- refs #7283 itemRequest fix by:carlossa
|
||||||
|
- refs #7283 itemRequest fix deny by:carlossa
|
||||||
|
- refs #7283 itemRequest fix reload by:carlossa
|
||||||
|
- refs #72983 fix filters by:carlossa
|
||||||
|
- revert: commit by:Javier Segarra
|
||||||
|
- revert e57a253c6f649382da187d1129449d265fb26d3b by:Javier Segarra
|
||||||
|
- test: #8162 fix clientList spec by:Javier Segarra
|
||||||
|
- test: #8162 fix vnLocation spec by:Javier Segarra
|
||||||
|
- test: fix arrayData by:Javier Segarra
|
||||||
|
- test: fix e2e by:alexm
|
||||||
|
- test: fix e2e by:Javier Segarra
|
||||||
|
- test: refs #8039 fix WorkerNotification e2e by:alexm
|
||||||
|
- test: refs #8039 fix ZoneWarehouse e2e by:alexm
|
||||||
|
- warmfix: ItemLastEntries to date (origin/warmfix_itemLastEntriesFilter) by:Javier Segarra
|
||||||
|
|
||||||
# Version 24.40 - 2024-10-02
|
# Version 24.40 - 2024-10-02
|
||||||
|
|
||||||
### Added 🆕
|
### Added 🆕
|
||||||
|
|
|
@ -4,7 +4,8 @@ def PROTECTED_BRANCH
|
||||||
|
|
||||||
def BRANCH_ENV = [
|
def BRANCH_ENV = [
|
||||||
test: 'test',
|
test: 'test',
|
||||||
master: 'production'
|
master: 'production',
|
||||||
|
beta: 'production'
|
||||||
]
|
]
|
||||||
|
|
||||||
node {
|
node {
|
||||||
|
@ -15,7 +16,8 @@ node {
|
||||||
PROTECTED_BRANCH = [
|
PROTECTED_BRANCH = [
|
||||||
'dev',
|
'dev',
|
||||||
'test',
|
'test',
|
||||||
'master'
|
'master',
|
||||||
|
'beta'
|
||||||
].contains(env.BRANCH_NAME)
|
].contains(env.BRANCH_NAME)
|
||||||
|
|
||||||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "24.50.0",
|
"version": "24.52.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
import routes from 'src/router/modules';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
let isNotified = false;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
created: function () {
|
||||||
|
const router = useRouter();
|
||||||
|
const keyBindingMap = routes
|
||||||
|
.filter((route) => route.meta.keyBinding)
|
||||||
|
.reduce((map, route) => {
|
||||||
|
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
||||||
|
return map;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
const handleKeyDown = (event) => {
|
||||||
|
const { ctrlKey, altKey, code } = event;
|
||||||
|
|
||||||
|
if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) {
|
||||||
|
event.preventDefault();
|
||||||
|
router.push(keyBindingMap[code]);
|
||||||
|
isNotified = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleKeyUp = (event) => {
|
||||||
|
const { ctrlKey, altKey } = event;
|
||||||
|
if (!ctrlKey || !altKey) {
|
||||||
|
isNotified = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('keydown', handleKeyDown);
|
||||||
|
window.addEventListener('keyup', handleKeyUp);
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,13 +1,37 @@
|
||||||
import { getCurrentInstance } from 'vue';
|
function focusFirstInput(input) {
|
||||||
|
input.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
const vm = getCurrentInstance();
|
|
||||||
if (vm.type.name === 'QForm') {
|
|
||||||
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
|
|
||||||
// TODO: AUTOFOCUS IS NOT FOCUSING
|
|
||||||
const that = this;
|
const that = this;
|
||||||
this.$el.addEventListener('keyup', function (evt) {
|
|
||||||
|
const form = document.querySelector('.q-form#formModel');
|
||||||
|
if (!form) return;
|
||||||
|
try {
|
||||||
|
const inputsFormCard = form.querySelectorAll(
|
||||||
|
`input:not([disabled]):not([type="checkbox"])`
|
||||||
|
);
|
||||||
|
if (inputsFormCard.length) {
|
||||||
|
focusFirstInput(inputsFormCard[0]);
|
||||||
|
}
|
||||||
|
const textareas = document.querySelectorAll(
|
||||||
|
'textarea:not([disabled]), [contenteditable]:not([disabled])'
|
||||||
|
);
|
||||||
|
if (textareas.length) {
|
||||||
|
focusFirstInput(textareas[textareas.length - 1]);
|
||||||
|
}
|
||||||
|
const inputs = document.querySelectorAll(
|
||||||
|
'form#formModel input:not([disabled]):not([type="checkbox"])'
|
||||||
|
);
|
||||||
|
const input = inputs[0];
|
||||||
|
if (!input) return;
|
||||||
|
|
||||||
|
focusFirstInput(input);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
form.addEventListener('keyup', function (evt) {
|
||||||
if (evt.key === 'Enter') {
|
if (evt.key === 'Enter') {
|
||||||
const input = evt.target;
|
const input = evt.target;
|
||||||
if (input.type == 'textarea' && evt.shiftKey) {
|
if (input.type == 'textarea' && evt.shiftKey) {
|
||||||
|
@ -24,7 +48,5 @@ export default {
|
||||||
that.onSubmit();
|
that.onSubmit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
|
import axios from 'axios';
|
||||||
import { boot } from 'quasar/wrappers';
|
import { boot } from 'quasar/wrappers';
|
||||||
import qFormMixin from './qformMixin';
|
import qFormMixin from './qformMixin';
|
||||||
import keyShortcut from './keyShortcut';
|
import keyShortcut from './keyShortcut';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import { QForm } from 'quasar';
|
||||||
import { CanceledError } from 'axios';
|
import { QLayout } from 'quasar';
|
||||||
|
import mainShortcutMixin from './mainShortcutMixin';
|
||||||
const { notify } = useNotify();
|
import { useCau } from 'src/composables/useCau';
|
||||||
|
|
||||||
export default boot(({ app }) => {
|
export default boot(({ app }) => {
|
||||||
app.mixin(qFormMixin);
|
QForm.mixins = [qFormMixin];
|
||||||
|
QLayout.mixins = [mainShortcutMixin];
|
||||||
|
|
||||||
app.directive('shortcut', keyShortcut);
|
app.directive('shortcut', keyShortcut);
|
||||||
app.config.errorHandler = (error) => {
|
app.config.errorHandler = async (error) => {
|
||||||
let message;
|
let message;
|
||||||
const response = error.response;
|
const response = error.response;
|
||||||
const responseData = response?.data;
|
const responseData = response?.data;
|
||||||
|
@ -40,12 +43,12 @@ export default boot(({ app }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error(error);
|
console.error(error);
|
||||||
if (error instanceof CanceledError) {
|
if (error instanceof axios.CanceledError) {
|
||||||
const env = process.env.NODE_ENV;
|
const env = process.env.NODE_ENV;
|
||||||
if (env && env !== 'development') return;
|
if (env && env !== 'development') return;
|
||||||
message = 'Duplicate request';
|
message = 'Duplicate request';
|
||||||
}
|
}
|
||||||
|
|
||||||
notify(message ?? 'globals.error', 'negative', 'error');
|
await useCau(response, message);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,6 +40,7 @@ const onDataSaved = (...args) => {
|
||||||
url-create="towns"
|
url-create="towns"
|
||||||
model="city"
|
model="city"
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
|
data-cy="newCityForm"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
|
@ -47,11 +48,15 @@ const onDataSaved = (...args) => {
|
||||||
:label="t('Name')"
|
:label="t('Name')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
:rules="validate('city.name')"
|
:rules="validate('city.name')"
|
||||||
|
required
|
||||||
|
data-cy="cityName"
|
||||||
/>
|
/>
|
||||||
<VnSelectProvince
|
<VnSelectProvince
|
||||||
:province-selected="$props.provinceSelected"
|
:province-selected="$props.provinceSelected"
|
||||||
:country-fk="$props.countryFk"
|
:country-fk="$props.countryFk"
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
|
required
|
||||||
|
data-cy="provinceCity"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -21,15 +21,13 @@ const postcodeFormData = reactive({
|
||||||
provinceFk: null,
|
provinceFk: null,
|
||||||
townFk: null,
|
townFk: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const townsFetchDataRef = ref(false);
|
const townsFetchDataRef = ref(false);
|
||||||
const countriesFetchDataRef = ref(false);
|
const townFilter = ref({});
|
||||||
const provincesFetchDataRef = ref(false);
|
|
||||||
const countriesOptions = ref([]);
|
const countriesRef = ref(false);
|
||||||
const provincesOptions = ref([]);
|
const provincesOptions = ref([]);
|
||||||
const townsOptions = ref([]);
|
const townsOptions = ref([]);
|
||||||
const town = ref({});
|
const town = ref({});
|
||||||
const townFilter = ref({});
|
|
||||||
const countryFilter = ref({});
|
const countryFilter = ref({});
|
||||||
|
|
||||||
function onDataSaved(formData) {
|
function onDataSaved(formData) {
|
||||||
|
@ -42,32 +40,71 @@ function onDataSaved(formData) {
|
||||||
({ id }) => id === formData.provinceFk
|
({ id }) => id === formData.provinceFk
|
||||||
);
|
);
|
||||||
newPostcode.province = provinceObject?.name;
|
newPostcode.province = provinceObject?.name;
|
||||||
const countryObject = countriesOptions.value.find(
|
const countryObject = countriesRef.value.opts.find(
|
||||||
({ id }) => id === formData.countryFk
|
({ id }) => id === formData.countryFk
|
||||||
);
|
);
|
||||||
newPostcode.country = countryObject?.name;
|
newPostcode.country = countryObject?.name;
|
||||||
emit('onDataSaved', newPostcode);
|
emit('onDataSaved', newPostcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setCountry(countryFk, data) {
|
||||||
|
data.townFk = null;
|
||||||
|
data.provinceFk = null;
|
||||||
|
data.countryFk = countryFk;
|
||||||
|
await fetchTowns();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Province
|
||||||
|
|
||||||
|
async function handleProvinces(data) {
|
||||||
|
provincesOptions.value = data;
|
||||||
|
if (postcodeFormData.countryFk) {
|
||||||
|
await fetchTowns();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function setProvince(id, data) {
|
||||||
|
if (data.provinceFk === id) return;
|
||||||
|
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
||||||
|
if (newProvince) data.countryFk = newProvince.countryFk;
|
||||||
|
postcodeFormData.provinceFk = id;
|
||||||
|
await fetchTowns();
|
||||||
|
}
|
||||||
|
async function onProvinceCreated(data) {
|
||||||
|
postcodeFormData.provinceFk = data.id;
|
||||||
|
}
|
||||||
|
function provinceByCountry(countryFk = postcodeFormData.countryFk) {
|
||||||
|
return provincesOptions.value
|
||||||
|
.filter((province) => province.countryFk === countryFk)
|
||||||
|
.map(({ id }) => id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Town
|
||||||
|
async function handleTowns(data) {
|
||||||
|
townsOptions.value = data;
|
||||||
|
}
|
||||||
|
function setTown(newTown, data) {
|
||||||
|
town.value = newTown;
|
||||||
|
data.provinceFk = newTown?.provinceFk ?? newTown;
|
||||||
|
data.countryFk = newTown?.province?.countryFk ?? newTown;
|
||||||
|
}
|
||||||
async function onCityCreated(newTown, formData) {
|
async function onCityCreated(newTown, formData) {
|
||||||
await provincesFetchDataRef.value.fetch();
|
|
||||||
newTown.province = provincesOptions.value.find(
|
newTown.province = provincesOptions.value.find(
|
||||||
(province) => province.id === newTown.provinceFk
|
(province) => province.id === newTown.provinceFk
|
||||||
);
|
);
|
||||||
formData.townFk = newTown;
|
formData.townFk = newTown;
|
||||||
setTown(newTown, formData);
|
setTown(newTown, formData);
|
||||||
}
|
}
|
||||||
|
async function fetchTowns(countryFk = postcodeFormData.countryFk) {
|
||||||
function setTown(newTown, data) {
|
if (!countryFk) return;
|
||||||
town.value = newTown;
|
const provinces = postcodeFormData.provinceFk
|
||||||
data.provinceFk = newTown?.provinceFk ?? newTown;
|
? [postcodeFormData.provinceFk]
|
||||||
data.countryFk = newTown?.province?.countryFk ?? newTown;
|
: provinceByCountry();
|
||||||
}
|
townFilter.value.where = {
|
||||||
|
provinceFk: {
|
||||||
async function setCountry(countryFk, data) {
|
inq: provinces,
|
||||||
data.townFk = null;
|
},
|
||||||
data.provinceFk = null;
|
};
|
||||||
data.countryFk = countryFk;
|
await townsFetchDataRef.value?.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function filterTowns(name) {
|
async function filterTowns(name) {
|
||||||
|
@ -80,65 +117,9 @@ async function filterTowns(name) {
|
||||||
await townsFetchDataRef.value?.fetch();
|
await townsFetchDataRef.value?.fetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function filterCountries(name) {
|
|
||||||
if (name !== '') {
|
|
||||||
countryFilter.value.where = {
|
|
||||||
name: {
|
|
||||||
like: `%${name}%`,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
await countriesFetchDataRef.value?.fetch();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetchTowns(countryFk) {
|
|
||||||
if (!countryFk) return;
|
|
||||||
townFilter.value.where = {
|
|
||||||
provinceFk: {
|
|
||||||
inq: provincesOptions.value.map(({ id }) => id),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
await townsFetchDataRef.value?.fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleProvinces(data) {
|
|
||||||
provincesOptions.value = data;
|
|
||||||
if (postcodeFormData.countryFk) {
|
|
||||||
await fetchTowns(postcodeFormData.countryFk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async function handleTowns(data) {
|
|
||||||
townsOptions.value = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleCountries(data) {
|
|
||||||
countriesOptions.value = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function setProvince(id, data) {
|
|
||||||
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
|
||||||
if (!newProvince) return;
|
|
||||||
|
|
||||||
data.countryFk = newProvince.countryFk;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function onProvinceCreated(data) {
|
|
||||||
await provincesFetchDataRef.value.fetch({
|
|
||||||
where: { countryFk: postcodeFormData.countryFk },
|
|
||||||
});
|
|
||||||
postcodeFormData.provinceFk = data.id;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
ref="provincesFetchDataRef"
|
|
||||||
@on-fetch="handleProvinces"
|
|
||||||
:sort-by="['name ASC']"
|
|
||||||
:limit="30"
|
|
||||||
auto-load
|
|
||||||
url="Provinces/location"
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="townsFetchDataRef"
|
ref="townsFetchDataRef"
|
||||||
:sort-by="['name ASC']"
|
:sort-by="['name ASC']"
|
||||||
|
@ -148,15 +129,6 @@ async function onProvinceCreated(data) {
|
||||||
auto-load
|
auto-load
|
||||||
url="Towns/location"
|
url="Towns/location"
|
||||||
/>
|
/>
|
||||||
<FetchData
|
|
||||||
ref="countriesFetchDataRef"
|
|
||||||
:limit="30"
|
|
||||||
:filter="countryFilter"
|
|
||||||
:sort-by="['name ASC']"
|
|
||||||
@on-fetch="handleCountries"
|
|
||||||
auto-load
|
|
||||||
url="Countries"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
url-create="postcodes"
|
url-create="postcodes"
|
||||||
|
@ -174,6 +146,8 @@ async function onProvinceCreated(data) {
|
||||||
v-model="data.code"
|
v-model="data.code"
|
||||||
:rules="validate('postcode.code')"
|
:rules="validate('postcode.code')"
|
||||||
clearable
|
clearable
|
||||||
|
required
|
||||||
|
data-cy="locationPostcode"
|
||||||
/>
|
/>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('City')"
|
:label="t('City')"
|
||||||
|
@ -187,7 +161,8 @@ async function onProvinceCreated(data) {
|
||||||
:rules="validate('postcode.city')"
|
:rules="validate('postcode.city')"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
:clearable="true"
|
required
|
||||||
|
data-cy="locationTown"
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -217,21 +192,31 @@ async function onProvinceCreated(data) {
|
||||||
:country-fk="data.countryFk"
|
:country-fk="data.countryFk"
|
||||||
:province-selected="data.provinceFk"
|
:province-selected="data.provinceFk"
|
||||||
@update:model-value="(value) => setProvince(value, data)"
|
@update:model-value="(value) => setProvince(value, data)"
|
||||||
|
@update:options="
|
||||||
|
(data) => {
|
||||||
|
provincesOptions = data;
|
||||||
|
}
|
||||||
|
"
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
@on-province-fetched="handleProvinces"
|
|
||||||
@on-province-created="onProvinceCreated"
|
@on-province-created="onProvinceCreated"
|
||||||
|
required
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
ref="countriesRef"
|
||||||
|
:limit="30"
|
||||||
|
:filter="countryFilter"
|
||||||
|
:sort-by="['name ASC']"
|
||||||
|
auto-load
|
||||||
|
url="Countries"
|
||||||
|
required
|
||||||
:label="t('Country')"
|
:label="t('Country')"
|
||||||
@update:options="handleCountries"
|
|
||||||
:options="countriesOptions"
|
|
||||||
hide-selected
|
hide-selected
|
||||||
@filter="filterCountries"
|
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="data.countryFk"
|
v-model="data.countryFk"
|
||||||
:rules="validate('postcode.countryFk')"
|
:rules="validate('postcode.countryFk')"
|
||||||
@update:model-value="(value) => setCountry(value, data)"
|
@update:model-value="(value) => setCountry(value, data)"
|
||||||
|
data-cy="locationCountry"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import { computed, reactive, ref } from 'vue';
|
import { computed, reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
@ -21,15 +20,11 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
provinces: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const autonomiesOptions = ref([]);
|
const autonomiesRef = ref([]);
|
||||||
|
|
||||||
const onDataSaved = (dataSaved, requestResponse) => {
|
const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
requestResponse.autonomy = autonomiesOptions.value.find(
|
requestResponse.autonomy = autonomiesRef.value.opts.find(
|
||||||
(autonomy) => autonomy.id == requestResponse.autonomyFk
|
(autonomy) => autonomy.id == requestResponse.autonomyFk
|
||||||
);
|
);
|
||||||
emit('onDataSaved', dataSaved, requestResponse);
|
emit('onDataSaved', dataSaved, requestResponse);
|
||||||
|
@ -43,16 +38,6 @@ const where = computed(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
@on-fetch="(data) => (autonomiesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
:filter="{
|
|
||||||
where,
|
|
||||||
}"
|
|
||||||
url="Autonomies/location"
|
|
||||||
:sort-by="['name ASC']"
|
|
||||||
:limit="30"
|
|
||||||
/>
|
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
:title="t('New province')"
|
:title="t('New province')"
|
||||||
:subtitle="t('Please, ensure you put the correct data!')"
|
:subtitle="t('Please, ensure you put the correct data!')"
|
||||||
|
@ -67,10 +52,19 @@ const where = computed(() => {
|
||||||
:label="t('Name')"
|
:label="t('Name')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
:rules="validate('province.name')"
|
:rules="validate('province.name')"
|
||||||
|
required
|
||||||
|
data-cy="provinceName"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
data-cy="autonomyProvince"
|
||||||
|
required
|
||||||
|
ref="autonomiesRef"
|
||||||
|
auto-load
|
||||||
|
:where="where"
|
||||||
|
url="Autonomies/location"
|
||||||
|
:sort-by="['name ASC']"
|
||||||
|
:limit="30"
|
||||||
:label="t('Autonomy')"
|
:label="t('Autonomy')"
|
||||||
:options="autonomiesOptions"
|
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
|
|
@ -10,6 +10,7 @@ import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
import SkeletonTable from 'components/ui/SkeletonTable.vue';
|
import SkeletonTable from 'components/ui/SkeletonTable.vue';
|
||||||
import { tMobile } from 'src/composables/tMobile';
|
import { tMobile } from 'src/composables/tMobile';
|
||||||
|
import getDifferences from 'src/filters/getDifferences';
|
||||||
|
|
||||||
const { push } = useRouter();
|
const { push } = useRouter();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
@ -94,6 +95,7 @@ defineExpose({
|
||||||
saveChanges,
|
saveChanges,
|
||||||
getChanges,
|
getChanges,
|
||||||
formData,
|
formData,
|
||||||
|
originalData,
|
||||||
vnPaginateRef,
|
vnPaginateRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -174,14 +176,13 @@ async function saveChanges(data) {
|
||||||
const changes = data || getChanges();
|
const changes = data || getChanges();
|
||||||
try {
|
try {
|
||||||
await axios.post($props.saveUrl || $props.url + '/crud', changes);
|
await axios.post($props.saveUrl || $props.url + '/crud', changes);
|
||||||
} catch (e) {
|
} finally {
|
||||||
return (isLoading.value = false);
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
originalData.value = JSON.parse(JSON.stringify(formData.value));
|
originalData.value = JSON.parse(JSON.stringify(formData.value));
|
||||||
if (changes.creates?.length) await vnPaginateRef.value.fetch();
|
if (changes.creates?.length) await vnPaginateRef.value.fetch();
|
||||||
|
|
||||||
hasChanges.value = false;
|
hasChanges.value = false;
|
||||||
isLoading.value = false;
|
|
||||||
emit('saveChanges', data);
|
emit('saveChanges', data);
|
||||||
quasar.notify({
|
quasar.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
|
@ -248,7 +249,7 @@ function getChanges() {
|
||||||
for (const [i, row] of formData.value.entries()) {
|
for (const [i, row] of formData.value.entries()) {
|
||||||
if (!row[pk]) {
|
if (!row[pk]) {
|
||||||
creates.push(row);
|
creates.push(row);
|
||||||
} else if (originalData.value) {
|
} else if (originalData.value[i]) {
|
||||||
const data = getDifferences(originalData.value[i], row);
|
const data = getDifferences(originalData.value[i], row);
|
||||||
if (!isEmpty(data)) {
|
if (!isEmpty(data)) {
|
||||||
updates.push({
|
updates.push({
|
||||||
|
@ -267,28 +268,6 @@ function getChanges() {
|
||||||
return changes;
|
return changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDifferences(obj1, obj2) {
|
|
||||||
let diff = {};
|
|
||||||
delete obj1.$index;
|
|
||||||
delete obj2.$index;
|
|
||||||
|
|
||||||
for (let key in obj1) {
|
|
||||||
if (obj2[key] && JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])) {
|
|
||||||
diff[key] = obj2[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let key in obj2) {
|
|
||||||
if (
|
|
||||||
obj1[key] === undefined ||
|
|
||||||
JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])
|
|
||||||
) {
|
|
||||||
diff[key] = obj2[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isEmpty(obj) {
|
function isEmpty(obj) {
|
||||||
if (obj == null) return true;
|
if (obj == null) return true;
|
||||||
if (obj === undefined) return true;
|
if (obj === undefined) return true;
|
||||||
|
|
|
@ -85,12 +85,14 @@ const closeForm = () => {
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="label"
|
option-label="label"
|
||||||
v-model="selectedField"
|
v-model="selectedField"
|
||||||
|
data-cy="field-to-edit"
|
||||||
/>
|
/>
|
||||||
<component
|
<component
|
||||||
:is="inputs[selectedField?.component || 'input']"
|
:is="inputs[selectedField?.component || 'input']"
|
||||||
v-bind="selectedField?.attrs || {}"
|
v-bind="selectedField?.attrs || {}"
|
||||||
v-model="newValue"
|
v-model="newValue"
|
||||||
:label="t('Value')"
|
:label="t('Value')"
|
||||||
|
data-cy="value-to-edit"
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
|
@ -110,6 +110,7 @@ const originalData = ref({});
|
||||||
const formData = computed(() => state.get(modelValue));
|
const formData = computed(() => state.get(modelValue));
|
||||||
const defaultButtons = computed(() => ({
|
const defaultButtons = computed(() => ({
|
||||||
save: {
|
save: {
|
||||||
|
dataCy: 'saveDefaultBtn',
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
icon: 'save',
|
icon: 'save',
|
||||||
label: 'globals.save',
|
label: 'globals.save',
|
||||||
|
@ -117,6 +118,7 @@ const defaultButtons = computed(() => ({
|
||||||
type: 'submit',
|
type: 'submit',
|
||||||
},
|
},
|
||||||
reset: {
|
reset: {
|
||||||
|
dataCy: 'resetDefaultBtn',
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
icon: 'restart_alt',
|
icon: 'restart_alt',
|
||||||
label: 'globals.reset',
|
label: 'globals.reset',
|
||||||
|
@ -207,7 +209,9 @@ async function save() {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
try {
|
try {
|
||||||
formData.value = trimData(formData.value);
|
formData.value = trimData(formData.value);
|
||||||
const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
|
const body = $props.mapper
|
||||||
|
? $props.mapper(formData.value, originalData.value)
|
||||||
|
: formData.value;
|
||||||
const method = $props.urlCreate ? 'post' : 'patch';
|
const method = $props.urlCreate ? 'post' : 'patch';
|
||||||
const url =
|
const url =
|
||||||
$props.urlCreate || $props.urlUpdate || $props.url || arrayData.store.url;
|
$props.urlCreate || $props.urlUpdate || $props.url || arrayData.store.url;
|
||||||
|
@ -322,6 +326,7 @@ defineExpose({
|
||||||
:title="t(defaultButtons.reset.label)"
|
:title="t(defaultButtons.reset.label)"
|
||||||
/>
|
/>
|
||||||
<QBtnDropdown
|
<QBtnDropdown
|
||||||
|
data-cy="saveAndContinueDefaultBtn"
|
||||||
v-if="$props.goTo"
|
v-if="$props.goTo"
|
||||||
@click="saveAndGo"
|
@click="saveAndGo"
|
||||||
:label="tMobile('globals.saveAndContinue')"
|
:label="tMobile('globals.saveAndContinue')"
|
||||||
|
|
|
@ -62,6 +62,7 @@ defineExpose({
|
||||||
@click="emit('onDataCanceled')"
|
@click="emit('onDataCanceled')"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
data-cy="FormModelPopup_cancel"
|
data-cy="FormModelPopup_cancel"
|
||||||
|
z-max
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('globals.save')"
|
:label="t('globals.save')"
|
||||||
|
@ -72,6 +73,7 @@ defineExpose({
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
data-cy="FormModelPopup_save"
|
data-cy="FormModelPopup_save"
|
||||||
|
z-max
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -9,6 +9,8 @@ import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { getParamWhere } from 'src/filters';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -26,28 +28,21 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const itemCategories = ref([]);
|
const route = useRoute();
|
||||||
const selectedCategoryFk = ref(null);
|
|
||||||
const selectedTypeFk = ref(null);
|
|
||||||
const itemTypesOptions = ref([]);
|
const itemTypesOptions = ref([]);
|
||||||
const suppliersOptions = ref([]);
|
const suppliersOptions = ref([]);
|
||||||
const tagOptions = ref([]);
|
const tagOptions = ref([]);
|
||||||
const tagValues = ref([]);
|
const tagValues = ref([]);
|
||||||
|
const categoryList = ref(null);
|
||||||
|
const selectedCategoryFk = ref(getParamWhere(route.query.table, 'categoryFk', false));
|
||||||
|
const selectedTypeFk = ref(getParamWhere(route.query.table, 'typeFk', false));
|
||||||
|
|
||||||
const categoryList = computed(() => {
|
const selectedCategory = computed(() => {
|
||||||
return (itemCategories.value || [])
|
return (categoryList.value || []).find(
|
||||||
.filter((category) => category.display)
|
|
||||||
.map((category) => ({
|
|
||||||
...category,
|
|
||||||
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
const selectedCategory = computed(() =>
|
|
||||||
(itemCategories.value || []).find(
|
|
||||||
(category) => category?.id === selectedCategoryFk.value
|
(category) => category?.id === selectedCategoryFk.value
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
|
||||||
const selectedType = computed(() => {
|
const selectedType = computed(() => {
|
||||||
return (itemTypesOptions.value || []).find(
|
return (itemTypesOptions.value || []).find(
|
||||||
|
@ -87,7 +82,7 @@ const applyTags = (params, search) => {
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchItemTypes = async (id) => {
|
const fetchItemTypes = async (id = selectedCategoryFk.value) => {
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['id', 'name', 'categoryFk'],
|
fields: ['id', 'name', 'categoryFk'],
|
||||||
where: { categoryFk: id },
|
where: { categoryFk: id },
|
||||||
|
@ -126,15 +121,19 @@ const removeTag = (index, params, search) => {
|
||||||
(tagValues.value || []).splice(index, 1);
|
(tagValues.value || []).splice(index, 1);
|
||||||
applyTags(params, search);
|
applyTags(params, search);
|
||||||
};
|
};
|
||||||
|
const setCategoryList = (data) => {
|
||||||
|
categoryList.value = (data || [])
|
||||||
|
.filter((category) => category.display)
|
||||||
|
.map((category) => ({
|
||||||
|
...category,
|
||||||
|
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
||||||
|
}));
|
||||||
|
fetchItemTypes();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData url="ItemCategories" limit="30" auto-load @on-fetch="setCategoryList" />
|
||||||
url="ItemCategories"
|
|
||||||
limit="30"
|
|
||||||
auto-load
|
|
||||||
@on-fetch="(data) => (itemCategories = data)"
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Suppliers"
|
url="Suppliers"
|
||||||
limit="30"
|
limit="30"
|
||||||
|
|
|
@ -177,6 +177,7 @@ function normalize(text) {
|
||||||
class="full-width"
|
class="full-width"
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
|
autofocus
|
||||||
/>
|
/>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
|
|
|
@ -7,7 +7,7 @@ import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onProvinceCreated', 'onProvinceFetched']);
|
const emit = defineEmits(['onProvinceCreated', 'onProvinceFetched', 'update:options']);
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
countryFk: {
|
countryFk: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -41,6 +41,7 @@ async function onProvinceCreated(_, data) {
|
||||||
}
|
}
|
||||||
async function handleProvinces(data) {
|
async function handleProvinces(data) {
|
||||||
provincesOptions.value = data;
|
provincesOptions.value = data;
|
||||||
|
emit('update:options', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -64,11 +65,11 @@ watch(
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
|
data-cy="locationProvince"
|
||||||
:label="t('Province')"
|
:label="t('Province')"
|
||||||
:options="provincesOptions"
|
:options="provincesOptions"
|
||||||
:tooltip="t('Create province')"
|
:tooltip="t('Create province')"
|
||||||
hide-selected
|
hide-selected
|
||||||
:clearable="true"
|
|
||||||
v-model="provinceFk"
|
v-model="provinceFk"
|
||||||
:rules="validate && validate('postcode.provinceFk')"
|
:rules="validate && validate('postcode.provinceFk')"
|
||||||
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||||
|
|
|
@ -610,6 +610,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
$props.rowClick && $props.rowClick(row);
|
$props.rowClick && $props.rowClick(row);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
style="height: 100%"
|
||||||
>
|
>
|
||||||
<QCardSection
|
<QCardSection
|
||||||
vertical
|
vertical
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||||
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useAttrs } from 'vue';
|
import { useAttrs } from 'vue';
|
||||||
import { useRequired } from 'src/composables/useRequired';
|
import { useRequired } from 'src/composables/useRequired';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -43,7 +43,7 @@ const formatLocation = (obj, properties) => {
|
||||||
return filteredParts.join(', ');
|
return filteredParts.join(', ');
|
||||||
};
|
};
|
||||||
|
|
||||||
const modelValue = ref(
|
const modelValue = computed(() =>
|
||||||
props.location ? formatLocation(props.location, locationProperties) : null
|
props.location ? formatLocation(props.location, locationProperties) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -75,7 +75,6 @@ const handleModelValue = (data) => {
|
||||||
:input-debounce="300"
|
:input-debounce="300"
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
clearable
|
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
:tooltip="t('Create new location')"
|
:tooltip="t('Create new location')"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
|
|
|
@ -238,6 +238,7 @@ async function openPointRecord(id, modelLog) {
|
||||||
pointRecord.value = parseProps(propNames, locale, data);
|
pointRecord.value = parseProps(propNames, locale, data);
|
||||||
}
|
}
|
||||||
async function setLogTree(data) {
|
async function setLogTree(data) {
|
||||||
|
if (!data) return;
|
||||||
logTree.value = getLogTree(data);
|
logTree.value = getLogTree(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,14 @@ import dataByOrder from 'src/utils/dataByOrder';
|
||||||
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
|
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
|
||||||
const $attrs = useAttrs();
|
const $attrs = useAttrs();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { isRequired, requiredFieldRule } = useRequired($attrs);
|
|
||||||
|
const isRequired = computed(() => {
|
||||||
|
return useRequired($attrs).isRequired;
|
||||||
|
});
|
||||||
|
const requiredFieldRule = computed(() => {
|
||||||
|
return useRequired($attrs).requiredFieldRule;
|
||||||
|
});
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: [String, Number, Object],
|
type: [String, Number, Object],
|
||||||
|
@ -261,7 +268,7 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
defineExpose({ opts: myOptions });
|
defineExpose({ opts: myOptions });
|
||||||
|
|
||||||
function handleKeyDown(event) {
|
function handleKeyDown(event) {
|
||||||
if (event.key === 'Tab') {
|
if (event.key === 'Tab' && !event.shiftKey) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
const inputValue = vnSelectRef.value?.inputValue;
|
const inputValue = vnSelectRef.value?.inputValue;
|
||||||
|
@ -279,6 +286,17 @@ function handleKeyDown(event) {
|
||||||
}
|
}
|
||||||
vnSelectRef.value?.hidePopup();
|
vnSelectRef.value?.hidePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const focusableElements = document.querySelectorAll(
|
||||||
|
'a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
|
||||||
|
);
|
||||||
|
const currentIndex = Array.prototype.indexOf.call(
|
||||||
|
focusableElements,
|
||||||
|
event.target
|
||||||
|
);
|
||||||
|
if (currentIndex >= 0 && currentIndex < focusableElements.length - 1) {
|
||||||
|
focusableElements[currentIndex + 1].focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -308,9 +326,9 @@ function handleKeyDown(event) {
|
||||||
@virtual-scroll="onScroll"
|
@virtual-scroll="onScroll"
|
||||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||||
>
|
>
|
||||||
<template v-if="isClearable" #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-show="value"
|
v-show="isClearable && value"
|
||||||
name="close"
|
name="close"
|
||||||
@click.stop="
|
@click.stop="
|
||||||
() => {
|
() => {
|
||||||
|
@ -323,7 +341,22 @@ function handleKeyDown(event) {
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
||||||
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
<div v-if="slotName == 'append'">
|
||||||
|
<QIcon
|
||||||
|
v-show="isClearable && value"
|
||||||
|
name="close"
|
||||||
|
@click.stop="
|
||||||
|
() => {
|
||||||
|
value = null;
|
||||||
|
emit('remove');
|
||||||
|
}
|
||||||
|
"
|
||||||
|
class="cursor-pointer"
|
||||||
|
size="xs"
|
||||||
|
/>
|
||||||
|
<slot name="append" v-if="$slots.append" v-bind="slotData ?? {}" />
|
||||||
|
</div>
|
||||||
|
<slot v-else :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
||||||
</template>
|
</template>
|
||||||
</QSelect>
|
</QSelect>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -43,6 +43,7 @@ const isAllowedToCreate = computed(() => {
|
||||||
>
|
>
|
||||||
<template v-if="isAllowedToCreate" #append>
|
<template v-if="isAllowedToCreate" #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_icon'"
|
||||||
@click.stop.prevent="$refs.dialog.show()"
|
@click.stop.prevent="$refs.dialog.show()"
|
||||||
:name="actionIcon"
|
:name="actionIcon"
|
||||||
:size="actionIcon === 'add' ? 'xs' : 'sm'"
|
:size="actionIcon === 'add' ? 'xs' : 'sm'"
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
<script setup>
|
||||||
|
import { computed, useAttrs } from 'vue';
|
||||||
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
const $props = defineProps({
|
||||||
|
hasAvatar: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
hasInfo: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
modelValue: {
|
||||||
|
type: [String, Number, Object],
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const $attrs = useAttrs();
|
||||||
|
|
||||||
|
const value = computed({
|
||||||
|
get() {
|
||||||
|
return $props.modelValue;
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
emit('update:modelValue', val);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const url = computed(() => {
|
||||||
|
let url = 'Workers/search';
|
||||||
|
const { departmentCodes } = $attrs.params ?? {};
|
||||||
|
if (!departmentCodes) return url;
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
departmentCodes: JSON.stringify(departmentCodes),
|
||||||
|
});
|
||||||
|
|
||||||
|
return url.concat(`?${params.toString()}`);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VnSelect
|
||||||
|
:label="$t('globals.worker')"
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-model="value"
|
||||||
|
:url="url"
|
||||||
|
option-value="id"
|
||||||
|
option-label="nickname"
|
||||||
|
:fields="['id', 'name', 'nickname', 'code']"
|
||||||
|
sort-by="nickname ASC"
|
||||||
|
>
|
||||||
|
<template #prepend v-if="$props.hasAvatar">
|
||||||
|
<VnAvatar :worker-id="value" color="primary" :title="title" />
|
||||||
|
</template>
|
||||||
|
<template #append v-if="$props.hasInfo">
|
||||||
|
<QIcon name="info" class="cursor-pointer">
|
||||||
|
<QTooltip>{{ $t($props.hasInfo) }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</template>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ scope.opt.name }}
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel v-if="!scope.opt.id">
|
||||||
|
{{ scope.opt.nickname }}
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel caption v-else>
|
||||||
|
{{ scope.opt.nickname }}, {{ scope.opt.code }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Responsible for approving invoices: Responsable de aprobar las facturas
|
||||||
|
</i18n>
|
|
@ -67,7 +67,7 @@ const dialog = ref(null);
|
||||||
<QTooltip>{{ t('globals.add') }}</QTooltip>
|
<QTooltip>{{ t('globals.add') }}</QTooltip>
|
||||||
<QPopupProxy ref="dialog">
|
<QPopupProxy ref="dialog">
|
||||||
<OrderCatalogItemDialog
|
<OrderCatalogItemDialog
|
||||||
:prices="item.prices"
|
:item="item"
|
||||||
@added="() => dialog.hide()"
|
@added="() => dialog.hide()"
|
||||||
/>
|
/>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { useColor } from 'src/composables/useColor';
|
||||||
import { getCssVar } from 'quasar';
|
import { getCssVar } from 'quasar';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
workerId: { type: Number, required: true },
|
workerId: { type: [Number, undefined], default: null },
|
||||||
description: { type: String, default: null },
|
description: { type: String, default: null },
|
||||||
title: { type: String, default: null },
|
title: { type: String, default: null },
|
||||||
color: { type: String, default: null },
|
color: { type: String, default: null },
|
||||||
|
@ -38,7 +38,13 @@ watch(src, () => (showLetter.value = false));
|
||||||
<template v-if="showLetter">
|
<template v-if="showLetter">
|
||||||
{{ title.charAt(0) }}
|
{{ title.charAt(0) }}
|
||||||
</template>
|
</template>
|
||||||
<QImg v-else :src="src" spinner-color="white" @error="showLetter = true" />
|
<QImg
|
||||||
|
v-else-if="workerId"
|
||||||
|
:src="src"
|
||||||
|
spinner-color="white"
|
||||||
|
@error="showLetter = true"
|
||||||
|
/>
|
||||||
|
<QIcon v-else name="mood" size="xs" />
|
||||||
</QAvatar>
|
</QAvatar>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<slot name="description" v-if="description">
|
<slot name="description" v-if="description">
|
||||||
|
|
|
@ -61,6 +61,7 @@ const emit = defineEmits([
|
||||||
'update:modelValue',
|
'update:modelValue',
|
||||||
'refresh',
|
'refresh',
|
||||||
'clear',
|
'clear',
|
||||||
|
'search',
|
||||||
'init',
|
'init',
|
||||||
'remove',
|
'remove',
|
||||||
'setUserParams',
|
'setUserParams',
|
||||||
|
@ -78,7 +79,7 @@ const userParams = ref({});
|
||||||
defineExpose({ search, sanitizer, params: userParams });
|
defineExpose({ search, sanitizer, params: userParams });
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
userParams.value = $props.modelValue ?? {};
|
if (!userParams.value) userParams.value = $props.modelValue ?? {};
|
||||||
emit('init', { params: userParams.value });
|
emit('init', { params: userParams.value });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -104,7 +105,8 @@ watch(
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => arrayData.store.userParams,
|
() => arrayData.store.userParams,
|
||||||
(val, oldValue) => (val || oldValue) && setUserParams(val)
|
(val, oldValue) => (val || oldValue) && setUserParams(val),
|
||||||
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -273,6 +275,7 @@ function sanitizer(params) {
|
||||||
:key="chip.label"
|
:key="chip.label"
|
||||||
:removable="!unremovableParams?.includes(chip.label)"
|
:removable="!unremovableParams?.includes(chip.label)"
|
||||||
@remove="remove(chip.label)"
|
@remove="remove(chip.label)"
|
||||||
|
data-cy="vnFilterPanelChip"
|
||||||
>
|
>
|
||||||
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
|
|
|
@ -1,22 +1,28 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, useAttrs, onBeforeMount, capitalize } from 'vue';
|
import { ref, reactive, useAttrs, onBeforeMount, capitalize } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { parsePhone } from 'src/filters';
|
||||||
|
import useOpenURL from 'src/composables/useOpenURL';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
phoneNumber: { type: [String, Number], default: null },
|
phoneNumber: { type: [String, Number], default: null },
|
||||||
channel: { type: Number, default: null },
|
channel: { type: Number, default: null },
|
||||||
|
country: { type: String, default: null },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const phone = ref(props.phoneNumber);
|
||||||
const config = reactive({
|
const config = reactive({
|
||||||
sip: { icon: 'phone', href: `sip:${props.phoneNumber}` },
|
sip: { icon: 'phone', href: `sip:${props.phoneNumber}` },
|
||||||
'say-simple': {
|
'say-simple': {
|
||||||
icon: 'vn:saysimple',
|
icon: 'vn:saysimple',
|
||||||
href: null,
|
url: null,
|
||||||
channel: props.channel,
|
channel: props.channel,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const type = Object.keys(config).find((key) => key in useAttrs()) || 'sip';
|
const type = Object.keys(config).find((key) => key in useAttrs()) || 'sip';
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
|
if (!phone.value) return;
|
||||||
let { channel } = config[type];
|
let { channel } = config[type];
|
||||||
|
|
||||||
if (type === 'say-simple') {
|
if (type === 'say-simple') {
|
||||||
|
@ -24,23 +30,28 @@ onBeforeMount(async () => {
|
||||||
.data;
|
.data;
|
||||||
if (!channel) channel = defaultChannel;
|
if (!channel) channel = defaultChannel;
|
||||||
|
|
||||||
|
phone.value = await parsePhone(props.phoneNumber, props.country.toLowerCase());
|
||||||
config[
|
config[
|
||||||
type
|
type
|
||||||
].href = `${url}?customerIdentity=%2B${props.phoneNumber}&channelId=${channel}`;
|
].url = `${url}?customerIdentity=%2B${phone.value}&channelId=${channel}`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function handleClick() {
|
||||||
|
if (config[type].url) useOpenURL(config[type].url);
|
||||||
|
else if (config[type].href) window.location.href = config[type].href;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="phoneNumber"
|
v-if="phone"
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
:icon="config[type].icon"
|
:icon="config[type].icon"
|
||||||
size="sm"
|
size="sm"
|
||||||
color="primary"
|
color="primary"
|
||||||
padding="none"
|
padding="none"
|
||||||
:href="config[type].href"
|
@click.stop="handleClick"
|
||||||
@click.stop
|
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ capitalize(type).replace('-', '') }}
|
{{ capitalize(type).replace('-', '') }}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import { toDateHourMin } from 'src/filters';
|
import { toDateHourMin } from 'src/filters';
|
||||||
import { useState } from 'src/composables/useState';
|
|
||||||
|
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
import VnUserLink from 'components/ui/VnUserLink.vue';
|
import VnUserLink from 'components/ui/VnUserLink.vue';
|
||||||
|
@ -26,9 +25,7 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const state = useState();
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const currentUser = ref(state.getUser());
|
|
||||||
const newNote = reactive({ text: null, observationTypeFk: null });
|
const newNote = reactive({ text: null, observationTypeFk: null });
|
||||||
const observationTypes = ref([]);
|
const observationTypes = ref([]);
|
||||||
const vnPaginateRef = ref();
|
const vnPaginateRef = ref();
|
||||||
|
@ -101,6 +98,7 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
@click="insert"
|
@click="insert"
|
||||||
class="q-mb-xs"
|
class="q-mb-xs"
|
||||||
dense
|
dense
|
||||||
|
data-cy="saveNote"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
|
|
|
@ -136,7 +136,7 @@ const addFilter = async (filter, params) => {
|
||||||
async function fetch(params) {
|
async function fetch(params) {
|
||||||
useArrayData(props.dataKey, params);
|
useArrayData(props.dataKey, params);
|
||||||
arrayData.reset(['filter.skip', 'skip', 'page']);
|
arrayData.reset(['filter.skip', 'skip', 'page']);
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false, updateRouter: mounted.value });
|
||||||
return emitStoreData();
|
return emitStoreData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import { useVnConfirm } from 'src/composables/useVnConfirm';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { i18n } from 'src/boot/i18n';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
||||||
|
export async function useCau(res, message) {
|
||||||
|
const { notify } = useNotify();
|
||||||
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
const { config, headers, request, status, statusText, data } = res || {};
|
||||||
|
const { params, url, method, signal, headers: confHeaders } = config || {};
|
||||||
|
const { message: resMessage, code, name } = data?.error || {};
|
||||||
|
|
||||||
|
const additionalData = {
|
||||||
|
path: location.hash,
|
||||||
|
message: resMessage,
|
||||||
|
code,
|
||||||
|
request: request?.responseURL,
|
||||||
|
status,
|
||||||
|
name,
|
||||||
|
statusText: statusText,
|
||||||
|
config: {
|
||||||
|
url,
|
||||||
|
method,
|
||||||
|
params,
|
||||||
|
headers: confHeaders,
|
||||||
|
aborted: signal?.aborted,
|
||||||
|
version: headers?.['salix-version'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const opts = {
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
icon: 'support_agent',
|
||||||
|
color: 'primary',
|
||||||
|
dense: true,
|
||||||
|
flat: false,
|
||||||
|
round: true,
|
||||||
|
handler: async () => {
|
||||||
|
const locale = i18n.global.t;
|
||||||
|
const reason = ref(
|
||||||
|
code == 'ACCESS_DENIED' ? locale('cau.askPrivileges') : ''
|
||||||
|
);
|
||||||
|
openConfirmationModal(
|
||||||
|
locale('cau.title'),
|
||||||
|
locale('cau.subtitle'),
|
||||||
|
async () => {
|
||||||
|
await axios.post('OsTickets/send-to-support', {
|
||||||
|
reason: reason.value,
|
||||||
|
additionalData,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
{
|
||||||
|
component: VnInput,
|
||||||
|
props: {
|
||||||
|
modelValue: reason,
|
||||||
|
'onUpdate:modelValue': (val) => (reason.value = val),
|
||||||
|
label: locale('cau.inputLabel'),
|
||||||
|
class: 'full-width',
|
||||||
|
required: true,
|
||||||
|
autofocus: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
notify(message ?? 'globals.error', 'negative', 'error', opts);
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ import { Notify } from 'quasar';
|
||||||
import { i18n } from 'src/boot/i18n';
|
import { i18n } from 'src/boot/i18n';
|
||||||
|
|
||||||
export default function useNotify() {
|
export default function useNotify() {
|
||||||
const notify = (message, type, icon) => {
|
const notify = (message, type, icon, opts = {}) => {
|
||||||
const defaultIcons = {
|
const defaultIcons = {
|
||||||
warning: 'warning',
|
warning: 'warning',
|
||||||
negative: 'error',
|
negative: 'error',
|
||||||
|
@ -13,6 +13,7 @@ export default function useNotify() {
|
||||||
message: i18n.global.t(message),
|
message: i18n.global.t(message),
|
||||||
type: type,
|
type: type,
|
||||||
icon: icon ? icon : defaultIcons[type],
|
icon: icon ? icon : defaultIcons[type],
|
||||||
|
...opts,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,14 @@ import { useValidator } from 'src/composables/useValidator';
|
||||||
|
|
||||||
export function useRequired($attrs) {
|
export function useRequired($attrs) {
|
||||||
const { validations } = useValidator();
|
const { validations } = useValidator();
|
||||||
|
const hasRequired = Object.keys($attrs).includes('required');
|
||||||
const isRequired = Object.keys($attrs).includes('required');
|
let isRequired = false;
|
||||||
|
if (hasRequired) {
|
||||||
|
const required = $attrs['required'];
|
||||||
|
if (typeof required === 'boolean') {
|
||||||
|
isRequired = required;
|
||||||
|
}
|
||||||
|
}
|
||||||
const requiredFieldRule = (val) => validations().required(isRequired, val);
|
const requiredFieldRule = (val) => validations().required(isRequired, val);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -20,7 +20,7 @@ export function useRole() {
|
||||||
|
|
||||||
function hasAny(roles) {
|
function hasAny(roles) {
|
||||||
const roleStore = state.getRoles();
|
const roleStore = state.getRoles();
|
||||||
|
if (typeof roles === 'string') roles = [roles];
|
||||||
for (const role of roles) {
|
for (const role of roles) {
|
||||||
if (roleStore.value.indexOf(role) !== -1) return true;
|
if (roleStore.value.indexOf(role) !== -1) return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,27 @@
|
||||||
|
import { h } from 'vue';
|
||||||
|
import { Dialog } from 'quasar';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
|
|
||||||
export function useVnConfirm() {
|
export function useVnConfirm() {
|
||||||
const quasar = useQuasar();
|
const openConfirmationModal = (
|
||||||
|
title,
|
||||||
const openConfirmationModal = (title, message, promise, successFn) => {
|
message,
|
||||||
quasar
|
promise,
|
||||||
.dialog({
|
successFn,
|
||||||
component: VnConfirm,
|
customHTML = {}
|
||||||
componentProps: {
|
) => {
|
||||||
|
const { component, props } = customHTML;
|
||||||
|
Dialog.create({
|
||||||
|
component: h(
|
||||||
|
VnConfirm,
|
||||||
|
{
|
||||||
title: title,
|
title: title,
|
||||||
message: message,
|
message: message,
|
||||||
promise: promise,
|
promise: promise,
|
||||||
},
|
},
|
||||||
})
|
{ customHTML: () => h(component, props) }
|
||||||
.onOk(async () => {
|
),
|
||||||
|
}).onOk(async () => {
|
||||||
if (successFn) successFn();
|
if (successFn) successFn();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
export default function getDifferences(obj1, obj2) {
|
||||||
|
let diff = {};
|
||||||
|
delete obj1.$index;
|
||||||
|
delete obj2.$index;
|
||||||
|
|
||||||
|
for (let key in obj1) {
|
||||||
|
if (obj2[key] && JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])) {
|
||||||
|
diff[key] = obj2[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let key in obj2) {
|
||||||
|
if (
|
||||||
|
obj1[key] === undefined ||
|
||||||
|
JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])
|
||||||
|
) {
|
||||||
|
diff[key] = obj2[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return diff;
|
||||||
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
// parsing JSON safely
|
|
||||||
function parseJSON(str, fallback) {
|
function parseJSON(str, fallback) {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(str ?? '{}');
|
return JSON.parse(str ?? '{}');
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
export default function getUpdatedValues(keys, formData) {
|
||||||
|
return keys.reduce((acc, key) => {
|
||||||
|
acc[key] = formData[key];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
}
|
|
@ -11,11 +11,17 @@ import dashIfEmpty from './dashIfEmpty';
|
||||||
import dateRange from './dateRange';
|
import dateRange from './dateRange';
|
||||||
import toHour from './toHour';
|
import toHour from './toHour';
|
||||||
import dashOrCurrency from './dashOrCurrency';
|
import dashOrCurrency from './dashOrCurrency';
|
||||||
|
import getDifferences from './getDifferences';
|
||||||
|
import getUpdatedValues from './getUpdatedValues';
|
||||||
import getParamWhere from './getParamWhere';
|
import getParamWhere from './getParamWhere';
|
||||||
|
import parsePhone from './parsePhone';
|
||||||
import isDialogOpened from './isDialogOpened';
|
import isDialogOpened from './isDialogOpened';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
getUpdatedValues,
|
||||||
|
getDifferences,
|
||||||
isDialogOpened,
|
isDialogOpened,
|
||||||
|
parsePhone,
|
||||||
toLowerCase,
|
toLowerCase,
|
||||||
toLowerCamel,
|
toLowerCamel,
|
||||||
toDate,
|
toDate,
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
export default async function parsePhone(phone, country) {
|
||||||
|
if (!phone) return;
|
||||||
|
if (phone.startsWith('+')) return `${phone.slice(1)}`;
|
||||||
|
if (phone.startsWith('00')) return `${phone.slice(2)}`;
|
||||||
|
|
||||||
|
let prefix;
|
||||||
|
try {
|
||||||
|
prefix = (await axios.get(`Prefixes/${country.toLowerCase()}`)).data?.prefix;
|
||||||
|
} catch (e) {
|
||||||
|
prefix = (await axios.get('PbxConfigs/findOne')).data?.defaultPrefix;
|
||||||
|
}
|
||||||
|
prefix = prefix.replace(/^0+/, '');
|
||||||
|
|
||||||
|
if (phone.startsWith(prefix)) return phone;
|
||||||
|
return `${prefix}${phone}`;
|
||||||
|
}
|
|
@ -60,7 +60,7 @@ globals:
|
||||||
reference: Reference
|
reference: Reference
|
||||||
agency: Agency
|
agency: Agency
|
||||||
warehouseOut: Warehouse Out
|
warehouseOut: Warehouse Out
|
||||||
wareHouseIn: Warehouse In
|
warehouseIn: Warehouse In
|
||||||
landed: Landed
|
landed: Landed
|
||||||
shipped: Shipped
|
shipped: Shipped
|
||||||
totalEntries: Total entries
|
totalEntries: Total entries
|
||||||
|
@ -331,6 +331,7 @@ globals:
|
||||||
fi: FI
|
fi: FI
|
||||||
myTeam: My team
|
myTeam: My team
|
||||||
departmentFk: Department
|
departmentFk: Department
|
||||||
|
countryFk: Country
|
||||||
changePass: Change password
|
changePass: Change password
|
||||||
deleteConfirmTitle: Delete selected elements
|
deleteConfirmTitle: Delete selected elements
|
||||||
changeState: Change state
|
changeState: Change state
|
||||||
|
@ -368,6 +369,11 @@ resetPassword:
|
||||||
repeatPassword: Repeat password
|
repeatPassword: Repeat password
|
||||||
passwordNotMatch: Passwords don't match
|
passwordNotMatch: Passwords don't match
|
||||||
passwordChanged: Password changed
|
passwordChanged: Password changed
|
||||||
|
cau:
|
||||||
|
title: Send cau
|
||||||
|
subtitle: By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.
|
||||||
|
inputLabel: Explain why this error should not appear
|
||||||
|
askPrivileges: Ask for privileges
|
||||||
entry:
|
entry:
|
||||||
list:
|
list:
|
||||||
newEntry: New entry
|
newEntry: New entry
|
||||||
|
@ -397,8 +403,8 @@ entry:
|
||||||
buys: Buys
|
buys: Buys
|
||||||
stickers: Stickers
|
stickers: Stickers
|
||||||
package: Package
|
package: Package
|
||||||
packing: Packing
|
packing: Pack.
|
||||||
grouping: Grouping
|
grouping: Group.
|
||||||
buyingValue: Buying value
|
buyingValue: Buying value
|
||||||
import: Import
|
import: Import
|
||||||
pvp: PVP
|
pvp: PVP
|
||||||
|
@ -768,7 +774,7 @@ travel:
|
||||||
thermographs: Thermographs
|
thermographs: Thermographs
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
daysInForward: Days in forward
|
daysInForward: Automatic movement (Raid)
|
||||||
isRaid: Raid
|
isRaid: Raid
|
||||||
thermographs:
|
thermographs:
|
||||||
temperature: Temperature
|
temperature: Temperature
|
||||||
|
|
|
@ -335,6 +335,7 @@ globals:
|
||||||
SSN: NSS
|
SSN: NSS
|
||||||
fi: NIF
|
fi: NIF
|
||||||
myTeam: Mi equipo
|
myTeam: Mi equipo
|
||||||
|
countryFk: País
|
||||||
changePass: Cambiar contraseña
|
changePass: Cambiar contraseña
|
||||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||||
changeState: Cambiar estado
|
changeState: Cambiar estado
|
||||||
|
@ -370,6 +371,11 @@ resetPassword:
|
||||||
repeatPassword: Repetir contraseña
|
repeatPassword: Repetir contraseña
|
||||||
passwordNotMatch: Las contraseñas no coinciden
|
passwordNotMatch: Las contraseñas no coinciden
|
||||||
passwordChanged: Contraseña cambiada
|
passwordChanged: Contraseña cambiada
|
||||||
|
cau:
|
||||||
|
title: Enviar cau
|
||||||
|
subtitle: Al enviar este cau ya se envían todos los datos relacionados con el error, la sección, el usuario, etc
|
||||||
|
inputLabel: Explique el motivo por el que no deberia aparecer este fallo
|
||||||
|
askPrivileges: Solicitar permisos
|
||||||
entry:
|
entry:
|
||||||
list:
|
list:
|
||||||
newEntry: Nueva entrada
|
newEntry: Nueva entrada
|
||||||
|
@ -400,8 +406,8 @@ entry:
|
||||||
buys: Compras
|
buys: Compras
|
||||||
stickers: Etiquetas
|
stickers: Etiquetas
|
||||||
package: Embalaje
|
package: Embalaje
|
||||||
packing: Packing
|
packing: Pack.
|
||||||
grouping: Grouping
|
grouping: Group.
|
||||||
buyingValue: Coste
|
buyingValue: Coste
|
||||||
import: Importe
|
import: Importe
|
||||||
pvp: PVP
|
pvp: PVP
|
||||||
|
@ -762,7 +768,7 @@ travel:
|
||||||
thermographs: Termógrafos
|
thermographs: Termógrafos
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
daysInForward: Días redada
|
daysInForward: Desplazamiento automatico (redada)
|
||||||
isRaid: Redada
|
isRaid: Redada
|
||||||
thermographs:
|
thermographs:
|
||||||
temperature: Temperatura
|
temperature: Temperatura
|
||||||
|
|
|
@ -1,50 +1,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
import Navbar from 'src/components/NavBar.vue';
|
import Navbar from 'src/components/NavBar.vue';
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
import routes from 'src/router/modules';
|
|
||||||
import { onMounted } from 'vue';
|
|
||||||
|
|
||||||
const quasar = useQuasar();
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
let isNotified = false;
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const keyBindingMap = routes
|
|
||||||
.filter((route) => route.meta.keyBinding)
|
|
||||||
.reduce((map, route) => {
|
|
||||||
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
|
||||||
return map;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
const handleKeyDown = (event) => {
|
|
||||||
const { ctrlKey, altKey, code } = event;
|
|
||||||
|
|
||||||
if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) {
|
|
||||||
event.preventDefault();
|
|
||||||
router.push(keyBindingMap[code]);
|
|
||||||
isNotified = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleKeyUp = (event) => {
|
|
||||||
const { ctrlKey, altKey } = event;
|
|
||||||
|
|
||||||
if (!ctrlKey || !altKey) {
|
|
||||||
isNotified = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener('keydown', handleKeyDown);
|
|
||||||
window.addEventListener('keyup', handleKeyUp);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QLayout view="hHh LpR fFf" v-shortcut>
|
<QLayout view="hHh LpR fFf" v-shortcut>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<RouterView></RouterView>
|
<RouterView></RouterView>
|
||||||
<QFooter v-if="quasar.platform.is.mobile"></QFooter>
|
<QFooter v-if="$q.platform.is.mobile"></QFooter>
|
||||||
</QLayout>
|
</QLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -31,7 +31,6 @@ const rolesOptions = ref([]);
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
:search-button="true"
|
:search-button="true"
|
||||||
:hidden-tags="['search']"
|
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
search-url="table"
|
search-url="table"
|
||||||
>
|
>
|
||||||
|
|
|
@ -7,6 +7,7 @@ import AccountSummary from './Card/AccountSummary.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import AccountFilter from './AccountFilter.vue';
|
import AccountFilter from './AccountFilter.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
@ -22,10 +23,27 @@ const columns = computed(() => [
|
||||||
field: 'id',
|
field: 'id',
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'name',
|
||||||
|
label: t('Name'),
|
||||||
|
component: 'input',
|
||||||
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'roleFk',
|
name: 'roleFk',
|
||||||
label: t('role'),
|
label: t('Role'),
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'VnRoles',
|
||||||
|
optionValue: 'id',
|
||||||
|
optionLabel: 'name',
|
||||||
|
},
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: 'select',
|
component: 'select',
|
||||||
name: 'roleFk',
|
name: 'roleFk',
|
||||||
|
@ -35,7 +53,11 @@ const columns = computed(() => [
|
||||||
optionLabel: 'name',
|
optionLabel: 'name',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
format: ({ role }, dashIfEmpty) => dashIfEmpty(role?.name),
|
format: ({ role }, dashIfEmpty) => dashIfEmpty(role?.name),
|
||||||
|
create: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -51,20 +73,32 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'name',
|
name: 'email',
|
||||||
label: t('Name'),
|
label: t('Email'),
|
||||||
component: 'input',
|
component: 'input',
|
||||||
columnField: {
|
columnField: {
|
||||||
component: null,
|
component: null,
|
||||||
},
|
},
|
||||||
cardVisible: true,
|
|
||||||
create: true,
|
create: true,
|
||||||
|
visible: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'email',
|
name: 'password',
|
||||||
label: t('email'),
|
label: t('Password'),
|
||||||
component: 'input',
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
|
attrs: {},
|
||||||
|
required: true,
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'active',
|
||||||
|
label: t('Active'),
|
||||||
|
component: 'checkbox',
|
||||||
create: true,
|
create: true,
|
||||||
visible: false,
|
visible: false,
|
||||||
},
|
},
|
||||||
|
@ -101,7 +135,6 @@ const exprBuilder = (param, value) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="AccountList"
|
data-key="AccountList"
|
||||||
|
@ -119,6 +152,12 @@ const exprBuilder = (param, value) => {
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="AccountList"
|
data-key="AccountList"
|
||||||
url="VnUsers/preview"
|
url="VnUsers/preview"
|
||||||
|
:create="{
|
||||||
|
urlCreate: 'VnUsers',
|
||||||
|
title: t('Create user'),
|
||||||
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
|
formInitialData: {},
|
||||||
|
}"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
order="id DESC"
|
order="id DESC"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
@ -127,7 +166,19 @@ const exprBuilder = (param, value) => {
|
||||||
:use-model="true"
|
:use-model="true"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
auto-load
|
auto-load
|
||||||
|
>
|
||||||
|
<template #more-create-dialog="{ data }">
|
||||||
|
<QCardSection>
|
||||||
|
<VnInput
|
||||||
|
:label="t('Password')"
|
||||||
|
v-model="data.password"
|
||||||
|
type="password"
|
||||||
|
:required="true"
|
||||||
|
autocomplete="new-password"
|
||||||
/>
|
/>
|
||||||
|
</QCardSection>
|
||||||
|
</template>
|
||||||
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
@ -135,4 +186,7 @@ const exprBuilder = (param, value) => {
|
||||||
Id: Id
|
Id: Id
|
||||||
Nickname: Nickname
|
Nickname: Nickname
|
||||||
Name: Nombre
|
Name: Nombre
|
||||||
|
Password: Contraseña
|
||||||
|
Active: Activo
|
||||||
|
Role: Rol
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -37,11 +37,7 @@ onBeforeMount(() => {
|
||||||
@on-fetch="(data) => (rolesOptions = data)"
|
@on-fetch="(data) => (rolesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<VnFilterPanel
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||||
:data-key="props.dataKey"
|
|
||||||
:search-button="true"
|
|
||||||
:hidden-tags="['search']"
|
|
||||||
>
|
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`acls.aclFilter.${tag.label}`) }}: </strong>
|
<strong>{{ t(`acls.aclFilter.${tag.label}`) }}: </strong>
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { useAcl } from 'src/composables/useAcl';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||||
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
hasAccount: {
|
hasAccount: {
|
||||||
|
@ -21,7 +21,7 @@ const { t } = useI18n();
|
||||||
const { hasAccount } = toRefs($props);
|
const { hasAccount } = toRefs($props);
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { notify } = useNotify();
|
const { notify } = useQuasar();
|
||||||
const account = computed(() => useArrayData('AccountId').store.data[0]);
|
const account = computed(() => useArrayData('AccountId').store.data[0]);
|
||||||
account.value.hasAccount = hasAccount.value;
|
account.value.hasAccount = hasAccount.value;
|
||||||
const entityId = computed(() => +route.params.id);
|
const entityId = computed(() => +route.params.id);
|
||||||
|
|
|
@ -41,8 +41,12 @@ const fetchAccountExistence = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchMailForwards = async () => {
|
const fetchMailForwards = async () => {
|
||||||
|
try {
|
||||||
const response = await axios.get(`MailForwards/${route.params.id}`);
|
const response = await axios.get(`MailForwards/${route.params.id}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
|
|
|
@ -13,12 +13,7 @@ const props = defineProps({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnFilterPanel
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true" :redirect="false">
|
||||||
:data-key="props.dataKey"
|
|
||||||
:search-button="true"
|
|
||||||
:hidden-tags="['search']"
|
|
||||||
:redirect="false"
|
|
||||||
>
|
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`role.${tag.label}`) }}: </strong>
|
<strong>{{ t(`role.${tag.label}`) }}: </strong>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { onBeforeMount, ref, watch } from 'vue';
|
import { onBeforeMount, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
|
@ -52,7 +53,6 @@ const addressFilter = {
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
const { id } = route.params;
|
const { id } = route.params;
|
||||||
getAddressesData(id);
|
|
||||||
getClientData(id);
|
getClientData(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,23 +60,10 @@ watch(
|
||||||
() => route.params.id,
|
() => route.params.id,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
if (!newValue) return;
|
if (!newValue) return;
|
||||||
getAddressesData(newValue);
|
|
||||||
getClientData(newValue);
|
getClientData(newValue);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const getAddressesData = async (id) => {
|
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Clients/${id}/addresses`, {
|
|
||||||
params: { filter: JSON.stringify(addressFilter) },
|
|
||||||
});
|
|
||||||
addresses.value = data;
|
|
||||||
sortAddresses();
|
|
||||||
} catch (error) {
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getClientData = async (id) => {
|
const getClientData = async (id) => {
|
||||||
try {
|
try {
|
||||||
const { data } = await axios.get(`Clients/${id}`);
|
const { data } = await axios.get(`Clients/${id}`);
|
||||||
|
@ -101,9 +88,9 @@ const setDefault = (address) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortAddresses = () => {
|
const sortAddresses = (data) => {
|
||||||
if (!client.value || !addresses.value) return;
|
if (!client.value || !data) return;
|
||||||
addresses.value = addresses.value.sort((a, b) => {
|
addresses.value = data.sort((a, b) => {
|
||||||
return isDefaultAddress(b) - isDefaultAddress(a);
|
return isDefaultAddress(b) - isDefaultAddress(a);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -124,8 +111,17 @@ const toCustomerAddressEdit = (addressId) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
@on-fetch="sortAddresses"
|
||||||
|
auto-load
|
||||||
|
data-key="CustomerAddresses"
|
||||||
|
order="id DESC"
|
||||||
|
ref="vnPaginateRef"
|
||||||
|
:filter="addressFilter"
|
||||||
|
:url="`Clients/${route.params.id}/addresses`"
|
||||||
|
/>
|
||||||
<div class="full-width flex justify-center">
|
<div class="full-width flex justify-center">
|
||||||
<QCard class="card-width q-pa-lg" v-if="addresses.length">
|
<QCard class="card-width q-pa-lg">
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in addresses"
|
v-for="(item, index) in addresses"
|
||||||
|
|
|
@ -8,14 +8,14 @@ import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
import { getDifferences, getUpdatedValues } from 'src/filters';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const businessTypes = ref([]);
|
const businessTypes = ref([]);
|
||||||
const contactChannels = ref([]);
|
const contactChannels = ref([]);
|
||||||
const title = ref();
|
|
||||||
const handleSalesModelValue = (val) => ({
|
const handleSalesModelValue = (val) => ({
|
||||||
or: [
|
or: [
|
||||||
{ id: val },
|
{ id: val },
|
||||||
|
@ -30,6 +30,13 @@ const exprBuilder = (param, value) => {
|
||||||
and: [{ active: { neq: false } }, handleSalesModelValue(value)],
|
and: [{ active: { neq: false } }, handleSalesModelValue(value)],
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function onBeforeSave(formData, originalData) {
|
||||||
|
return getUpdatedValues(
|
||||||
|
Object.keys(getDifferences(formData, originalData)),
|
||||||
|
formData
|
||||||
|
);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -43,7 +50,12 @@ const exprBuilder = (param, value) => {
|
||||||
@on-fetch="(data) => (businessTypes = data)"
|
@on-fetch="(data) => (businessTypes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FormModel :url="`Clients/${route.params.id}`" auto-load model="customer">
|
<FormModel
|
||||||
|
:url="`Clients/${route.params.id}`"
|
||||||
|
auto-load
|
||||||
|
model="customer"
|
||||||
|
:mapper="onBeforeSave"
|
||||||
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -94,6 +106,7 @@ const exprBuilder = (param, value) => {
|
||||||
:rules="validate('client.phone')"
|
:rules="validate('client.phone')"
|
||||||
clearable
|
clearable
|
||||||
v-model="data.phone"
|
v-model="data.phone"
|
||||||
|
data-cy="customerPhone"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('customer.summary.mobile')"
|
:label="t('customer.summary.mobile')"
|
||||||
|
@ -103,41 +116,17 @@ const exprBuilder = (param, value) => {
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
url="Workers/search"
|
|
||||||
v-model="data.salesPersonFk"
|
|
||||||
:label="t('customer.summary.salesPerson')"
|
:label="t('customer.summary.salesPerson')"
|
||||||
|
v-model="data.salesPersonFk"
|
||||||
:params="{
|
:params="{
|
||||||
departmentCodes: ['VT', 'shopping'],
|
departmentCodes: ['VT', 'shopping'],
|
||||||
}"
|
}"
|
||||||
:fields="['id', 'nickname']"
|
:has-avatar="true"
|
||||||
sort-by="nickname ASC"
|
|
||||||
option-label="nickname"
|
|
||||||
option-value="id"
|
|
||||||
:rules="validate('client.salesPersonFk')"
|
:rules="validate('client.salesPersonFk')"
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
emit-value
|
emit-value
|
||||||
auto-load
|
|
||||||
>
|
|
||||||
<template #prepend>
|
|
||||||
<VnAvatar
|
|
||||||
:worker-id="data.salesPersonFk"
|
|
||||||
color="primary"
|
|
||||||
:title="title"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
|
||||||
<QItemLabel caption
|
|
||||||
>{{ scope.opt?.nickname }},
|
|
||||||
{{ scope.opt?.code }}</QItemLabel
|
|
||||||
>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
v-model="data.contactChannelFk"
|
v-model="data.contactChannelFk"
|
||||||
:options="contactChannels"
|
:options="contactChannels"
|
||||||
|
@ -155,7 +144,6 @@ const exprBuilder = (param, value) => {
|
||||||
url="Clients"
|
url="Clients"
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
:label="t('customer.basicData.previousClient')"
|
:label="t('customer.basicData.previousClient')"
|
||||||
:options="clients"
|
|
||||||
:rules="validate('client.transferorFk')"
|
:rules="validate('client.transferorFk')"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
|
@ -28,12 +28,7 @@ const getBankEntities = (data, formData) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FormModel
|
<FormModel :url-update="`Clients/${route.params.id}`" auto-load model="customer">
|
||||||
:url-update="`Clients/${route.params.id}`"
|
|
||||||
:url="`Clients/${route.params.id}/getCard`"
|
|
||||||
auto-load
|
|
||||||
model="customer"
|
|
||||||
>
|
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
|
|
@ -93,22 +93,6 @@ const columns = computed(() => [
|
||||||
<WorkerDescriptorProxy :id="row.worker.id" />
|
<WorkerDescriptorProxy :id="row.worker.id" />
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
<!-- <QTable
|
|
||||||
:columns="columns"
|
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
|
||||||
:rows="rows"
|
|
||||||
hide-bottom
|
|
||||||
row-key="id"
|
|
||||||
v-model:selected="selected"
|
|
||||||
class="card-width q-px-lg"
|
|
||||||
>
|
|
||||||
<template #body-cell-employee="{ row }">
|
|
||||||
<QTd @click.stop>
|
|
||||||
<span class="link">{{ row.worker.user.nickname }}</span>
|
|
||||||
<WorkerDescriptorProxy :id="row.clientFk" />
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
</QTable> -->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -36,7 +36,10 @@ const entityId = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = ref(useCardDescription());
|
const data = ref(useCardDescription());
|
||||||
const setData = (entity) => (data.value = useCardDescription(entity?.name, entity?.id));
|
const setData = (entity) => {
|
||||||
|
data.value = useCardDescription(entity?.name, entity?.id);
|
||||||
|
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
|
||||||
|
};
|
||||||
const debtWarning = computed(() => {
|
const debtWarning = computed(() => {
|
||||||
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,6 @@ function handleLocation(data, location) {
|
||||||
/>
|
/>
|
||||||
<FormModel
|
<FormModel
|
||||||
:url-update="`Clients/${route.params.id}/updateFiscalData`"
|
:url-update="`Clients/${route.params.id}/updateFiscalData`"
|
||||||
:url="`Clients/${route.params.id}/getCard`"
|
|
||||||
auto-load
|
auto-load
|
||||||
model="customer"
|
model="customer"
|
||||||
>
|
>
|
||||||
|
@ -68,6 +67,7 @@ function handleLocation(data, location) {
|
||||||
option-label="vat"
|
option-label="vat"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="data.sageTaxTypeFk"
|
v-model="data.sageTaxTypeFk"
|
||||||
|
data-cy="sageTaxTypeFk"
|
||||||
:required="data.isTaxDataChecked"
|
:required="data.isTaxDataChecked"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
@ -76,6 +76,7 @@ function handleLocation(data, location) {
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="transaction"
|
option-label="transaction"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
data-cy="sageTransactionTypeFk"
|
||||||
v-model="data.sageTransactionTypeFk"
|
v-model="data.sageTransactionTypeFk"
|
||||||
:required="data.isTaxDataChecked"
|
:required="data.isTaxDataChecked"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, onMounted } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||||
|
|
||||||
import { toCurrency, toPercentage, toDate, dashOrCurrency } from 'src/filters';
|
import { toCurrency, toPercentage, toDate, dashOrCurrency } from 'src/filters';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||||
import VnLinkMail from 'src/components/ui/VnLinkMail.vue';
|
import VnLinkMail from 'src/components/ui/VnLinkMail.vue';
|
||||||
|
@ -95,13 +94,14 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:phone-number="entity.mobile"
|
:phone-number="entity.mobile"
|
||||||
:channel="entity.country?.saySimpleCountry?.channel"
|
:channel="entity.country?.saySimpleCountry?.channel"
|
||||||
class="q-ml-xs"
|
class="q-ml-xs"
|
||||||
|
:country="entity.country?.code"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :value="entity.email" copy
|
<VnLv :value="entity.email" copy
|
||||||
><template #label>
|
><template #label>
|
||||||
{{ t('globals.params.email') }}
|
{{ t('globals.params.email') }}
|
||||||
<VnLinkMail email="entity.email"></VnLinkMail> </template
|
<VnLinkMail :email="entity.email"></VnLinkMail> </template
|
||||||
></VnLv>
|
></VnLv>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.salesPerson')"
|
:label="t('customer.summary.salesPerson')"
|
||||||
|
|
|
@ -1,164 +1,82 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onBeforeMount, ref, watch, nextTick } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import axios from 'axios';
|
const formModelRef = ref(false);
|
||||||
import useNotify from 'src/composables/useNotify';
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { notify } = useNotify();
|
|
||||||
const stateStore = useStateStore();
|
|
||||||
|
|
||||||
const amountInputRef = ref(null);
|
const amountInputRef = ref(null);
|
||||||
const initialDated = Date.vnNew();
|
|
||||||
const unpaidClient = ref(false);
|
|
||||||
const isLoading = ref(false);
|
|
||||||
const amount = ref(null);
|
|
||||||
const dated = ref(initialDated);
|
|
||||||
|
|
||||||
const initialData = ref({
|
const initialData = ref({
|
||||||
dated: initialDated,
|
dated: Date.vnNew(),
|
||||||
|
amount: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasChanged = computed(() => {
|
const filterClientFindOne = {
|
||||||
return (
|
fields: ['unpaid', 'dated', 'amount'],
|
||||||
initialData.value.dated !== dated.value ||
|
where: {
|
||||||
initialData.value.amount !== amount.value
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
onBeforeMount(() => {
|
|
||||||
getData(route.params.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => route.params.id,
|
|
||||||
(newValue) => {
|
|
||||||
if (!newValue) return;
|
|
||||||
getData(newValue);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const getData = async (id) => {
|
|
||||||
const filter = { where: { clientFk: id } };
|
|
||||||
try {
|
|
||||||
const { data } = await axios.get('ClientUnpaids', {
|
|
||||||
params: { filter: JSON.stringify(filter) },
|
|
||||||
});
|
|
||||||
if (data.length) {
|
|
||||||
setValues(data[0]);
|
|
||||||
} else {
|
|
||||||
defaultValues();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
defaultValues();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const setValues = (data) => {
|
|
||||||
unpaidClient.value = true;
|
|
||||||
amount.value = data.amount;
|
|
||||||
dated.value = data.dated;
|
|
||||||
initialData.value = data;
|
|
||||||
};
|
|
||||||
|
|
||||||
const defaultValues = () => {
|
|
||||||
unpaidClient.value = false;
|
|
||||||
initialData.value.amount = null;
|
|
||||||
setInitialData();
|
|
||||||
};
|
|
||||||
|
|
||||||
const setInitialData = () => {
|
|
||||||
amount.value = initialData.value.amount;
|
|
||||||
dated.value = initialData.value.dated;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onSubmit = async () => {
|
|
||||||
isLoading.value = true;
|
|
||||||
|
|
||||||
const payload = {
|
|
||||||
amount: amount.value,
|
|
||||||
clientFk: route.params.id,
|
clientFk: route.params.id,
|
||||||
dated: dated.value,
|
},
|
||||||
};
|
};
|
||||||
try {
|
|
||||||
await axios.patch('ClientUnpaids', payload);
|
|
||||||
notify('globals.dataSaved', 'positive');
|
|
||||||
unpaidClient.value = true;
|
|
||||||
} catch (error) {
|
|
||||||
notify('errors.writeRequest', 'negative');
|
|
||||||
} finally {
|
|
||||||
isLoading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => unpaidClient.value,
|
|
||||||
async (val) => {
|
|
||||||
await nextTick();
|
|
||||||
if (val) amountInputRef.value.focus();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Teleport v-if="stateStore?.isSubToolbarShown()" to="#st-actions">
|
<FetchData
|
||||||
<QBtnGroup push class="q-gutter-x-sm">
|
:filter="filterClientFindOne"
|
||||||
<QBtn
|
auto-load
|
||||||
:disabled="!hasChanged"
|
url="ClientUnpaids"
|
||||||
:label="t('globals.reset')"
|
@on-fetch="
|
||||||
:loading="isLoading"
|
(data) => {
|
||||||
@click="setInitialData"
|
const unpaid = data.length == 1;
|
||||||
color="primary"
|
initialData = { ...data[0], unpaid };
|
||||||
flat
|
}
|
||||||
icon="restart_alt"
|
"
|
||||||
type="reset"
|
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QCard>
|
||||||
:disabled="!hasChanged"
|
<FormModel
|
||||||
:label="t('globals.save')"
|
v-if="'unpaid' in initialData"
|
||||||
:loading="isLoading"
|
:observe-form-changes="false"
|
||||||
@click="onSubmit"
|
ref="formModelRef"
|
||||||
color="primary"
|
model="unpaid"
|
||||||
icon="save"
|
url-update="ClientUnpaids"
|
||||||
/>
|
:mapper="(formData) => ({ ...formData, clientFk: route.params.id })"
|
||||||
</QBtnGroup>
|
:form-initial-data="initialData"
|
||||||
</Teleport>
|
>
|
||||||
|
<template #form="{ data }">
|
||||||
<div class="full-width flex justify-center">
|
|
||||||
<QCard class="card-width q-pa-lg">
|
|
||||||
<QForm>
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
<QCheckbox :label="t('Unpaid client')" v-model="data.unpaid" />
|
||||||
<QCheckbox :label="t('Unpaid client')" v-model="unpaidClient" />
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md" v-show="unpaidClient">
|
<VnRow class="row q-gutter-md q-mb-md" v-show="data.unpaid">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInputDate :label="t('Date')" v-model="dated" />
|
<VnInputDate
|
||||||
|
data-cy="customerUnpaidDate"
|
||||||
|
:label="t('Date')"
|
||||||
|
v-model="data.dated"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput
|
<VnInputNumber
|
||||||
|
data-cy="customerUnpaidAmount"
|
||||||
ref="amountInputRef"
|
ref="amountInputRef"
|
||||||
:label="t('Amount')"
|
:label="t('Amount')"
|
||||||
clearable
|
clearable
|
||||||
type="number"
|
v-model="data.amount"
|
||||||
v-model="amount"
|
|
||||||
autofocus
|
autofocus
|
||||||
>
|
>
|
||||||
<template #append>€</template></VnInput
|
<template #append>€</template></VnInputNumber
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</QForm>
|
</template>
|
||||||
|
</FormModel>
|
||||||
</QCard>
|
</QCard>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -25,12 +25,12 @@ async function hasCustomerRole() {
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FormModel
|
<FormModel
|
||||||
url="VnUsers/preview"
|
|
||||||
:url-update="`Clients/${route.params.id}/updateUser`"
|
:url-update="`Clients/${route.params.id}/updateUser`"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
model="webAccess"
|
model="customer"
|
||||||
:mapper="
|
:mapper="
|
||||||
({ active, name, email }) => {
|
({ account }) => {
|
||||||
|
const { name, email, active } = account;
|
||||||
return {
|
return {
|
||||||
active,
|
active,
|
||||||
name,
|
name,
|
||||||
|
@ -42,14 +42,14 @@ async function hasCustomerRole() {
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<QCheckbox :label="t('Enable web access')" v-model="data.active" />
|
<QCheckbox :label="t('Enable web access')" v-model="data.account.active" />
|
||||||
<VnInput :label="t('User')" clearable v-model="data.name" />
|
<VnInput :label="t('User')" clearable v-model="data.account.name" />
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Recovery email')"
|
:label="t('Recovery email')"
|
||||||
:rules="validate('client.email')"
|
:rules="validate('client.email')"
|
||||||
clearable
|
clearable
|
||||||
type="email"
|
type="email"
|
||||||
v-model="data.email"
|
v-model="data.account.email"
|
||||||
class="q-mt-sm"
|
class="q-mt-sm"
|
||||||
:info="t('This email is used for user to regain access their account')"
|
:info="t('This email is used for user to regain access their account')"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onBeforeMount, ref, watch } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import axios from 'axios';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
|
||||||
import { toCurrency, toDateHourMin } from 'src/filters';
|
import { toCurrency, toDateHourMin } from 'src/filters';
|
||||||
|
|
||||||
|
@ -20,10 +20,11 @@ const filter = {
|
||||||
{ relation: 'mandateType', scope: { fields: ['id', 'name'] } },
|
{ relation: 'mandateType', scope: { fields: ['id', 'name'] } },
|
||||||
{ relation: 'company', scope: { fields: ['id', 'code'] } },
|
{ relation: 'company', scope: { fields: ['id', 'code'] } },
|
||||||
],
|
],
|
||||||
where: { clientFk: null },
|
where: { clientFk: route.params.id },
|
||||||
order: ['created DESC'],
|
order: ['created DESC'],
|
||||||
limit: 20,
|
limit: 20,
|
||||||
};
|
};
|
||||||
|
const ClientDmsRef = ref(false);
|
||||||
|
|
||||||
const tableColumnComponents = {
|
const tableColumnComponents = {
|
||||||
state: {
|
state: {
|
||||||
|
@ -50,7 +51,7 @@ const tableColumnComponents = {
|
||||||
component: CustomerCheckIconTooltip,
|
component: CustomerCheckIconTooltip,
|
||||||
props: ({ row }) => ({
|
props: ({ row }) => ({
|
||||||
transaction: row,
|
transaction: row,
|
||||||
promise: refreshData,
|
promise: () => ClientDmsRef.value.fetch(),
|
||||||
}),
|
}),
|
||||||
event: () => {},
|
event: () => {},
|
||||||
},
|
},
|
||||||
|
@ -89,38 +90,16 @@ const columns = computed(() => [
|
||||||
name: 'validate',
|
name: 'validate',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
onBeforeMount(() => {
|
|
||||||
getData(route.params.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => route.params.id,
|
|
||||||
(newValue) => {
|
|
||||||
if (!newValue) return;
|
|
||||||
getData(newValue);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const getData = async (id) => {
|
|
||||||
filter.where.clientFk = id;
|
|
||||||
try {
|
|
||||||
const { data } = await axios.get('clients/transactions', {
|
|
||||||
params: { filter: JSON.stringify(filter) },
|
|
||||||
});
|
|
||||||
rows.value = data;
|
|
||||||
} catch (error) {
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const refreshData = () => {
|
|
||||||
getData(route.params.id);
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="full-width flex justify-center">
|
<FetchData
|
||||||
|
ref="ClientDmsRef"
|
||||||
|
:filter="filter"
|
||||||
|
@on-fetch="(data) => (rows = data)"
|
||||||
|
auto-load
|
||||||
|
url="Clients/transactions"
|
||||||
|
/>
|
||||||
<QPage class="card-width q-pa-lg">
|
<QPage class="card-width q-pa-lg">
|
||||||
<QTable
|
<QTable
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
@ -135,13 +114,9 @@ const refreshData = () => {
|
||||||
<QTr :props="props">
|
<QTr :props="props">
|
||||||
<component
|
<component
|
||||||
:is="tableColumnComponents[props.col.name].component"
|
:is="tableColumnComponents[props.col.name].component"
|
||||||
@click="
|
@click="tableColumnComponents[props.col.name].event(props)"
|
||||||
tableColumnComponents[props.col.name].event(props)
|
|
||||||
"
|
|
||||||
class="rounded-borders q-pa-sm"
|
class="rounded-borders q-pa-sm"
|
||||||
v-bind="
|
v-bind="tableColumnComponents[props.col.name].props(props)"
|
||||||
tableColumnComponents[props.col.name].props(props)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ props.value }}
|
{{ props.value }}
|
||||||
</component>
|
</component>
|
||||||
|
@ -154,7 +129,6 @@ const refreshData = () => {
|
||||||
{{ t('globals.noResults') }}
|
{{ t('globals.noResults') }}
|
||||||
</h5>
|
</h5>
|
||||||
</QPage>
|
</QPage>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
defineProps({
|
defineProps({
|
||||||
|
@ -65,19 +66,14 @@ const exprBuilder = (param, value) => {
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QItem class="q-mb-sm">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
url="Workers/search"
|
:label="t('Salesperson')"
|
||||||
|
v-model="params.salesPersonFk"
|
||||||
:params="{
|
:params="{
|
||||||
departmentCodes: ['VT'],
|
departmentCodes: ['VT'],
|
||||||
}"
|
}"
|
||||||
auto-load
|
|
||||||
:label="t('Salesperson')"
|
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
v-model="params.salesPersonFk"
|
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
sort-by="nickname ASC"
|
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
use-input
|
use-input
|
||||||
|
@ -86,23 +82,12 @@ const exprBuilder = (param, value) => {
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
>
|
/>
|
||||||
<template #option="{ itemProps, opt }">
|
|
||||||
<QItem v-bind="itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
|
||||||
<QItemLabel caption>
|
|
||||||
{{ opt.nickname }},{{ opt.code }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template></VnSelect
|
|
||||||
>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QItem class="q-mb-sm">
|
||||||
<QItemSection
|
<QItemSection>
|
||||||
><VnSelect
|
<VnSelect
|
||||||
url="Provinces"
|
url="Provinces"
|
||||||
:label="t('Province')"
|
:label="t('Province')"
|
||||||
v-model="params.provinceFk"
|
v-model="params.provinceFk"
|
||||||
|
@ -120,14 +105,12 @@ const exprBuilder = (param, value) => {
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-md">
|
<QItem class="q-mb-sm">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput :label="t('City')" v-model="params.city" is-outlined />
|
<VnInput :label="t('City')" v-model="params.city" is-outlined />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QItem class="q-mb-sm">
|
||||||
<QExpansionItem :label="t('More options')" expand-separator>
|
|
||||||
<QItem>
|
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput :label="t('Phone')" v-model="params.phone" is-outlined>
|
<VnInput :label="t('Phone')" v-model="params.phone" is-outlined>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
|
@ -136,7 +119,7 @@ const exprBuilder = (param, value) => {
|
||||||
</VnInput>
|
</VnInput>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem class="q-mb-sm">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput :label="t('Email')" v-model="params.email" is-outlined>
|
<VnInput :label="t('Email')" v-model="params.email" is-outlined>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
|
@ -145,7 +128,8 @@ const exprBuilder = (param, value) => {
|
||||||
</VnInput>
|
</VnInput>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem class="q-mb-sm">
|
||||||
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Zones"
|
url="Zones"
|
||||||
:label="t('Zone')"
|
:label="t('Zone')"
|
||||||
|
@ -160,9 +144,9 @@ const exprBuilder = (param, value) => {
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/></QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem class="q-mb-sm">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Postcode')"
|
:label="t('Postcode')"
|
||||||
|
@ -171,7 +155,6 @@ const exprBuilder = (param, value) => {
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</QExpansionItem>
|
|
||||||
</template>
|
</template>
|
||||||
</VnFilterPanel>
|
</VnFilterPanel>
|
||||||
</template>
|
</template>
|
||||||
|
@ -203,7 +186,6 @@ es:
|
||||||
Salesperson: Comercial
|
Salesperson: Comercial
|
||||||
Province: Provincia
|
Province: Provincia
|
||||||
City: Ciudad
|
City: Ciudad
|
||||||
More options: Más opciones
|
|
||||||
Phone: Teléfono
|
Phone: Teléfono
|
||||||
Email: Email
|
Email: Email
|
||||||
Zone: Zona
|
Zone: Zona
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import { ref, computed, markRaw } from 'vue';
|
import { ref, computed, markRaw } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
|
@ -12,6 +11,7 @@ import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||||
import { toDate } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
import CustomerFilter from './CustomerFilter.vue';
|
import CustomerFilter from './CustomerFilter.vue';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -421,40 +421,17 @@ function handleLocation(data, location) {
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
url="Workers/search"
|
|
||||||
v-model="data.salesPersonFk"
|
|
||||||
:label="t('customer.summary.salesPerson')"
|
:label="t('customer.summary.salesPerson')"
|
||||||
|
v-model="data.salesPersonFk"
|
||||||
:params="{
|
:params="{
|
||||||
departmentCodes: ['VT', 'shopping'],
|
departmentCodes: ['VT', 'shopping'],
|
||||||
}"
|
}"
|
||||||
:fields="['id', 'nickname', 'code']"
|
:has-avatar="true"
|
||||||
sort-by="nickname ASC"
|
:id-value="data.salesPersonFk"
|
||||||
option-label="nickname"
|
|
||||||
option-value="id"
|
|
||||||
emit-value
|
emit-value
|
||||||
auto-load
|
auto-load
|
||||||
>
|
|
||||||
<template #prepend>
|
|
||||||
<VnAvatar
|
|
||||||
:worker-id="data.salesPersonFk"
|
|
||||||
color="primary"
|
|
||||||
:title="title"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
|
||||||
<QItemLabel caption
|
|
||||||
>{{ scope.opt?.nickname }},
|
|
||||||
{{ scope.opt?.code }}</QItemLabel
|
|
||||||
>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
|
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.location"
|
v-model="data.location"
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount, reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
import axios from 'axios';
|
|
||||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
|
@ -19,26 +18,10 @@ const router = useRouter();
|
||||||
|
|
||||||
const formInitialData = reactive({ isDefaultAddress: false });
|
const formInitialData = reactive({ isDefaultAddress: false });
|
||||||
|
|
||||||
const urlCreate = ref('');
|
|
||||||
|
|
||||||
const agencyModes = ref([]);
|
const agencyModes = ref([]);
|
||||||
const incoterms = ref([]);
|
const incoterms = ref([]);
|
||||||
const customsAgents = ref([]);
|
const customsAgents = ref([]);
|
||||||
|
|
||||||
onBeforeMount(() => {
|
|
||||||
urlCreate.value = `Clients/${route.params.id}/createAddress`;
|
|
||||||
getCustomsAgents();
|
|
||||||
});
|
|
||||||
|
|
||||||
const getCustomsAgents = async () => {
|
|
||||||
const { data } = await axios.get('CustomsAgents');
|
|
||||||
customsAgents.value = data;
|
|
||||||
};
|
|
||||||
|
|
||||||
const refreshData = () => {
|
|
||||||
getCustomsAgents();
|
|
||||||
};
|
|
||||||
|
|
||||||
const toCustomerAddress = () => {
|
const toCustomerAddress = () => {
|
||||||
router.push({
|
router.push({
|
||||||
name: 'CustomerAddress',
|
name: 'CustomerAddress',
|
||||||
|
@ -54,9 +37,19 @@ function handleLocation(data, location) {
|
||||||
data.provinceFk = provinceFk;
|
data.provinceFk = provinceFk;
|
||||||
data.countryFk = countryFk;
|
data.countryFk = countryFk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onAgentCreated({ id, fiscalName }, data) {
|
||||||
|
customsAgents.value.push({ id, fiscalName });
|
||||||
|
data.customsAgentFk = id;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
@on-fetch="(data) => (customsAgents = data)"
|
||||||
|
auto-load
|
||||||
|
url="CustomsAgents"
|
||||||
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
@on-fetch="(data) => (agencyModes = data)"
|
@on-fetch="(data) => (agencyModes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
|
@ -67,7 +60,7 @@ function handleLocation(data, location) {
|
||||||
<FormModel
|
<FormModel
|
||||||
:form-initial-data="formInitialData"
|
:form-initial-data="formInitialData"
|
||||||
:observe-form-changes="false"
|
:observe-form-changes="false"
|
||||||
:url-create="urlCreate"
|
:url-create="`Clients/${route.params.id}/createAddress`"
|
||||||
@on-data-saved="toCustomerAddress()"
|
@on-data-saved="toCustomerAddress()"
|
||||||
model="client"
|
model="client"
|
||||||
>
|
>
|
||||||
|
@ -139,6 +132,7 @@ function handleLocation(data, location) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
|
url="CustomsAgents"
|
||||||
:label="t('Customs agent')"
|
:label="t('Customs agent')"
|
||||||
:options="customsAgents"
|
:options="customsAgents"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
@ -148,7 +142,11 @@ function handleLocation(data, location) {
|
||||||
:tooltip="t('Create a new expense')"
|
:tooltip="t('Create a new expense')"
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CustomerNewCustomsAgent @on-data-saved="refreshData()" />
|
<CustomerNewCustomsAgent
|
||||||
|
@on-data-saved="
|
||||||
|
(requestResponse) => onAgentCreated(requestResponse, data)
|
||||||
|
"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnSelectDialog>
|
</VnSelectDialog>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
|
@ -144,7 +144,7 @@ function handleLocation(data, location) {
|
||||||
:url="`Addresses/${route.params.addressId}`"
|
:url="`Addresses/${route.params.addressId}`"
|
||||||
@on-data-saved="onDataSaved()"
|
@on-data-saved="onDataSaved()"
|
||||||
auto-load
|
auto-load
|
||||||
model="client"
|
model="customer"
|
||||||
>
|
>
|
||||||
<template #moreActions>
|
<template #moreActions>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
|
|
@ -6,6 +6,7 @@ import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -48,14 +49,9 @@ const { t } = useI18n();
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
:label="t('department.bossDepartment')"
|
:label="t('department.bossDepartment')"
|
||||||
v-model="data.workerFk"
|
v-model="data.workerFk"
|
||||||
url="Workers/search"
|
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
hide-selected
|
|
||||||
map-options
|
|
||||||
:rules="validate('department.workerFk')"
|
:rules="validate('department.workerFk')"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
|
|
@ -82,11 +82,11 @@ const entriesTableColumns = computed(() => [
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardActions align="right">
|
<QCardActions align="right">
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('printLabels')"
|
:label="t('myEntries.printLabels')"
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="print"
|
icon="print"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@click="openReport(`Entries/${entityId}/print`)"
|
@click="openReport(`Entries/${entityId}/labelSupplier`)"
|
||||||
unelevated
|
unelevated
|
||||||
autofocus
|
autofocus
|
||||||
/>
|
/>
|
||||||
|
@ -126,7 +126,9 @@ const entriesTableColumns = computed(() => [
|
||||||
"
|
"
|
||||||
unelevated
|
unelevated
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('viewLabel') }}</QTooltip>
|
<QTooltip>{{
|
||||||
|
t('myEntries.viewLabel')
|
||||||
|
}}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -101,7 +101,7 @@ const columns = computed(() => [
|
||||||
name: 'tableActions',
|
name: 'tableActions',
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
title: t('printLabels'),
|
title: t('myEntries.printLabels'),
|
||||||
icon: 'print',
|
icon: 'print',
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
action: (row) => printBuys(row.id),
|
action: (row) => printBuys(row.id),
|
||||||
|
|
|
@ -184,5 +184,4 @@ es:
|
||||||
Amount: Importe
|
Amount: Importe
|
||||||
Issued: Fecha factura
|
Issued: Fecha factura
|
||||||
Id or supplier: Id o proveedor
|
Id or supplier: Id o proveedor
|
||||||
More options: Más opciones
|
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -83,8 +83,6 @@ const states = ref();
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
|
||||||
<QExpansionItem :label="t('More options')" expand-separator>
|
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
|
@ -105,14 +103,9 @@ const states = ref();
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate v-model="params.dued" :label="t('Dued')" is-outlined />
|
||||||
v-model="params.dued"
|
|
||||||
:label="t('Dued')"
|
|
||||||
is-outlined
|
|
||||||
/>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</QExpansionItem>
|
|
||||||
</template>
|
</template>
|
||||||
</VnFilterPanel>
|
</VnFilterPanel>
|
||||||
</template>
|
</template>
|
||||||
|
@ -149,5 +142,4 @@ es:
|
||||||
Issued: Fecha emisión
|
Issued: Fecha emisión
|
||||||
Created: Fecha creación
|
Created: Fecha creación
|
||||||
Dued: Fecha vencimiento
|
Dued: Fecha vencimiento
|
||||||
More options: Más opciones
|
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -52,7 +52,9 @@ const columns = computed(() => [
|
||||||
label: t('invoiceOutList.tableVisibleColumns.id'),
|
label: t('invoiceOutList.tableVisibleColumns.id'),
|
||||||
chip: { condition: () => true },
|
chip: { condition: () => true },
|
||||||
isId: true,
|
isId: true,
|
||||||
columnFilter: { name: 'search' },
|
columnFilter: {
|
||||||
|
name: 'id',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -60,8 +62,15 @@ const columns = computed(() => [
|
||||||
label: t('globals.reference'),
|
label: t('globals.reference'),
|
||||||
isTitle: true,
|
isTitle: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: { url: MODEL, optionLabel: 'ref', optionValue: 'id' },
|
attrs: {
|
||||||
|
url: MODEL,
|
||||||
|
optionLabel: 'ref',
|
||||||
|
optionValue: 'ref',
|
||||||
|
},
|
||||||
columnField: { component: null },
|
columnField: { component: null },
|
||||||
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -77,8 +86,15 @@ const columns = computed(() => [
|
||||||
label: t('globals.client'),
|
label: t('globals.client'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: { url: 'Clients', fields: ['id', 'name'] },
|
attrs: {
|
||||||
columnField: { component: null },
|
url: 'Clients',
|
||||||
|
fields: ['id', 'socialName'],
|
||||||
|
optionLabel: 'socialName',
|
||||||
|
optionValue: 'id',
|
||||||
|
},
|
||||||
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -146,9 +162,7 @@ function downloadPdf() {
|
||||||
const [invoiceOut] = selectedCardsArray;
|
const [invoiceOut] = selectedCardsArray;
|
||||||
openPdf(invoiceOut.id);
|
openPdf(invoiceOut.id);
|
||||||
} else {
|
} else {
|
||||||
const invoiceOutIdsArray = selectedCardsArray.map(
|
const invoiceOutIdsArray = selectedCardsArray.map((invoiceOut) => invoiceOut.id);
|
||||||
(invoiceOut) => invoiceOut.id
|
|
||||||
);
|
|
||||||
const invoiceOutIds = invoiceOutIdsArray.join(',');
|
const invoiceOutIds = invoiceOutIdsArray.join(',');
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -157,7 +171,6 @@ function downloadPdf() {
|
||||||
|
|
||||||
openReport(`${MODEL}/downloadZip`, params);
|
openReport(`${MODEL}/downloadZip`, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
watchEffect(selectedRows);
|
watchEffect(selectedRows);
|
||||||
|
|
|
@ -11,7 +11,7 @@ invoiceOutList:
|
||||||
ref: Referencia
|
ref: Referencia
|
||||||
issued: Fecha emisión
|
issued: Fecha emisión
|
||||||
created: F. creación
|
created: F. creación
|
||||||
dueDate: F. máxima
|
dueDate: Fecha vencimiento
|
||||||
invoiceOutSerial: Serial
|
invoiceOutSerial: Serial
|
||||||
ticket: Ticket
|
ticket: Ticket
|
||||||
taxArea: Area
|
taxArea: Area
|
||||||
|
|
|
@ -2,12 +2,15 @@
|
||||||
import { ref, nextTick } from 'vue';
|
import { ref, nextTick } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const itemBarcodeRef = ref(null);
|
const itemBarcodeRef = ref(null);
|
||||||
|
|
||||||
|
@ -23,6 +26,24 @@ const focusLastInput = () => {
|
||||||
if (lastInput) lastInput.focus();
|
if (lastInput) lastInput.focus();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const removeRow = (row) => {
|
||||||
|
itemBarcodeRef.value.remove([row]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const submit = async (rows) => {
|
||||||
|
const params = rows[rows.length - 1];
|
||||||
|
let { data } = await axios.get('ItemBarcodes');
|
||||||
|
const code = params.code;
|
||||||
|
|
||||||
|
if (data.some((codes) => codes.code === code)) {
|
||||||
|
notify(t('Codes can not be repeated'), 'negative');
|
||||||
|
itemBarcodeRef.value.reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await axios.patch(`ItemBarcodes`, params);
|
||||||
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="full-width flex justify-center">
|
<div class="full-width flex justify-center">
|
||||||
|
@ -39,6 +60,7 @@ const focusLastInput = () => {
|
||||||
ref="itemBarcodeRef"
|
ref="itemBarcodeRef"
|
||||||
url="ItemBarcodes"
|
url="ItemBarcodes"
|
||||||
auto-load
|
auto-load
|
||||||
|
:save-fn="submit"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<QCard class="q-px-lg q-py-md">
|
<QCard class="q-px-lg q-py-md">
|
||||||
|
@ -54,7 +76,7 @@ const focusLastInput = () => {
|
||||||
focusable-input
|
focusable-input
|
||||||
/>
|
/>
|
||||||
<QIcon
|
<QIcon
|
||||||
@click="itemBarcodeRef.remove([row])"
|
@click="removeRow(row)"
|
||||||
class="cursor-pointer q-ml-md"
|
class="cursor-pointer q-ml-md"
|
||||||
color="primary"
|
color="primary"
|
||||||
name="delete"
|
name="delete"
|
||||||
|
@ -89,4 +111,5 @@ es:
|
||||||
Code: Código
|
Code: Código
|
||||||
Remove barcode: Quitar código de barras
|
Remove barcode: Quitar código de barras
|
||||||
Add barcode: Añadir código de barras
|
Add barcode: Añadir código de barras
|
||||||
|
Codes can not be repeated: Los códigos no puden ser repetidos
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -70,6 +70,7 @@ const onIntrastatCreated = (response, formData) => {
|
||||||
option-label="name"
|
option-label="name"
|
||||||
hide-selected
|
hide-selected
|
||||||
map-options
|
map-options
|
||||||
|
required
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, reactive, computed } from 'vue';
|
import { ref, reactive, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ const handlePhotoUpdated = (evt = false) => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="relative-position">
|
<div class="relative-position">
|
||||||
<VnImg ref="image" :id="$props.entityId" zoom-resolution="1600x900">
|
<VnImg ref="image" :id="parseInt($props.entityId)" zoom-resolution="1600x900">
|
||||||
<template #error>
|
<template #error>
|
||||||
<div class="absolute-full picture text-center q-pa-md flex flex-center">
|
<div class="absolute-full picture text-center q-pa-md flex flex-center">
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, computed, onUnmounted, reactive, ref, nextTick, watch } from 'vue';
|
import { onMounted, computed, reactive, ref, nextTick, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
@ -12,20 +12,18 @@ import FetchData from 'components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import { toDateFormat } from 'src/filters/date.js';
|
import { toDateFormat } from 'src/filters/date.js';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import VnSubToolbar from 'components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const stateStore = useStateStore();
|
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const today = ref(Date.vnNew());
|
const today = ref(Date.vnNew());
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
|
@ -145,8 +143,6 @@ onMounted(async () => {
|
||||||
await updateWarehouse(warehouseFk.value);
|
await updateWarehouse(warehouseFk.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => router.currentRoute.value.params.id,
|
() => router.currentRoute.value.params.id,
|
||||||
(newId) => {
|
(newId) => {
|
||||||
|
@ -205,8 +201,8 @@ async function updateWarehouse(warehouseFk) {
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="(data) => (warehousesOptions = data)"
|
@on-fetch="(data) => (warehousesOptions = data)"
|
||||||
/>
|
/>
|
||||||
<template v-if="stateStore.isHeaderMounted()">
|
<VnSubToolbar class="q-mb-md">
|
||||||
<Teleport to="#st-data">
|
<template #st-data>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('itemDiary.warehouse')"
|
:label="t('itemDiary.warehouse')"
|
||||||
|
@ -235,9 +231,8 @@ async function updateWarehouse(warehouseFk) {
|
||||||
@update:model-value="fetchItemBalances"
|
@update:model-value="fetchItemBalances"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Teleport>
|
|
||||||
<Teleport to="#st-actions"> </Teleport>
|
|
||||||
</template>
|
</template>
|
||||||
|
</VnSubToolbar>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QTable
|
<QTable
|
||||||
:rows="itemBalances"
|
:rows="itemBalances"
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, computed, onUnmounted, ref, watch } from 'vue';
|
import { onMounted, computed, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { dateRange } from 'src/filters';
|
import { dateRange } from 'src/filters';
|
||||||
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import { toDateTimeFormat } from 'src/filters/date.js';
|
import { toDateTimeFormat } from 'src/filters/date.js';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
import { toCurrency } from 'filters/index';
|
import { toCurrency } from 'filters/index';
|
||||||
|
@ -15,7 +13,6 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const stateStore = useStateStore();
|
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -180,8 +177,6 @@ onMounted(async () => {
|
||||||
updateFilter();
|
updateFilter();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, computed, reactive } from 'vue';
|
import { onMounted, ref, computed, reactive, watchEffect } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
|
|
||||||
import { toDateFormat } from 'src/filters/date.js';
|
import { toDateFormat } from 'src/filters/date.js';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
|
||||||
|
@ -21,8 +17,9 @@ const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
const tableRef = ref();
|
||||||
const rowsSelected = ref([]);
|
const selectedRows = ref([]);
|
||||||
|
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -36,6 +33,11 @@ const exprBuilder = (param, value) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const params = reactive({ itemFk: route.params.id });
|
const params = reactive({ itemFk: route.params.id });
|
||||||
|
const filter = reactive({
|
||||||
|
where: {
|
||||||
|
itemFk: route.params.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const arrayData = useArrayData('ItemShelvings', {
|
const arrayData = useArrayData('ItemShelvings', {
|
||||||
url: 'ItemShelvingPlacementSupplyStocks',
|
url: 'ItemShelvingPlacementSupplyStocks',
|
||||||
|
@ -44,58 +46,32 @@ const arrayData = useArrayData('ItemShelvings', {
|
||||||
});
|
});
|
||||||
const rows = computed(() => arrayData.store.data || []);
|
const rows = computed(() => arrayData.store.data || []);
|
||||||
|
|
||||||
const applyColumnFilter = async (col) => {
|
|
||||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
|
||||||
params[paramKey] = col.columnFilter.filterValue;
|
|
||||||
await arrayData.addFilter({ filter: null, params });
|
|
||||||
};
|
|
||||||
|
|
||||||
const getInputEvents = (col) => {
|
|
||||||
return col.columnFilter.type === 'select'
|
|
||||||
? { 'update:modelValue': () => applyColumnFilter(col) }
|
|
||||||
: {
|
|
||||||
'keyup.enter': () => applyColumnFilter(col),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
label: t('shelvings.created'),
|
label: t('shelvings.created'),
|
||||||
name: 'created',
|
name: 'created',
|
||||||
field: 'created',
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
columnFilter: false,
|
||||||
columnFilter: null,
|
format: (row) => toDateFormat(row.created),
|
||||||
format: (val) => toDateFormat(val),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: t('shelvings.item'),
|
label: t('shelvings.item'),
|
||||||
name: 'item',
|
name: 'itemFk',
|
||||||
field: 'itemFk',
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
columnFilter: false,
|
||||||
columnFilter: null,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.concept'),
|
label: t('shelvings.concept'),
|
||||||
name: 'concept',
|
name: 'longName',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
columnFilter: false,
|
||||||
columnFilter: null,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.parking'),
|
label: t('shelvings.parking'),
|
||||||
name: 'parking',
|
name: 'parking',
|
||||||
field: 'parking',
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
component: 'select',
|
||||||
format: (val) => dashIfEmpty(val),
|
|
||||||
columnFilter: {
|
|
||||||
component: VnSelect,
|
|
||||||
type: 'select',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'parkings',
|
url: 'parkings',
|
||||||
fields: ['code'],
|
fields: ['code'],
|
||||||
|
@ -104,20 +80,13 @@ const columns = computed(() => [
|
||||||
'option-label': 'code',
|
'option-label': 'code',
|
||||||
dense: true,
|
dense: true,
|
||||||
},
|
},
|
||||||
},
|
columnField: { component: null },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.shelving'),
|
label: t('shelvings.shelving'),
|
||||||
name: 'shelving',
|
name: 'shelving',
|
||||||
field: 'shelving',
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
component: 'select',
|
||||||
format: (val) => dashIfEmpty(val),
|
|
||||||
columnFilter: {
|
|
||||||
component: VnSelect,
|
|
||||||
type: 'select',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'shelvings',
|
url: 'shelvings',
|
||||||
fields: ['code'],
|
fields: ['code'],
|
||||||
|
@ -126,41 +95,20 @@ const columns = computed(() => [
|
||||||
'option-label': 'code',
|
'option-label': 'code',
|
||||||
dense: true,
|
dense: true,
|
||||||
},
|
},
|
||||||
},
|
columnField: { component: null },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.label'),
|
label: t('shelvings.label'),
|
||||||
name: 'label',
|
name: 'label',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
columnFilter: { inWhere: true },
|
||||||
format: (_, row) => (row.stock / row.packing).toFixed(2),
|
format: (row) => (row.stock / row.packing).toFixed(2),
|
||||||
columnFilter: {
|
|
||||||
component: VnInput,
|
|
||||||
type: 'text',
|
|
||||||
filterParamKey: 'label',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('shelvings.packing'),
|
label: t('shelvings.packing'),
|
||||||
field: 'packing',
|
|
||||||
name: 'packing',
|
name: 'packing',
|
||||||
|
attrs: { inWhere: true },
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
|
||||||
columnFilter: {
|
|
||||||
component: VnInput,
|
|
||||||
type: 'text',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
format: (val) => dashIfEmpty(val),
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -169,15 +117,16 @@ const totalLabels = computed(() =>
|
||||||
);
|
);
|
||||||
|
|
||||||
const removeLines = async () => {
|
const removeLines = async () => {
|
||||||
const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk);
|
const itemShelvingIds = selectedRows.value.map((row) => row.itemShelvingFk);
|
||||||
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
|
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
|
||||||
rowsSelected.value = [];
|
selectedRows.value = [];
|
||||||
notify('shelvings.shelvingsRemoved', 'positive');
|
notify('shelvings.shelvingsRemoved', 'positive');
|
||||||
await arrayData.fetch({ append: false });
|
await tableRef.value.reload();
|
||||||
};
|
};
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false });
|
||||||
});
|
});
|
||||||
|
watchEffect(selectedRows);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -203,7 +152,7 @@ onMounted(async () => {
|
||||||
<QBtn
|
<QBtn
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="delete"
|
icon="delete"
|
||||||
:disabled="!rowsSelected.length"
|
:disabled="!hasSelectedCards"
|
||||||
@click="
|
@click="
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('shelvings.removeConfirmTitle'),
|
t('shelvings.removeConfirmTitle'),
|
||||||
|
@ -219,41 +168,27 @@ onMounted(async () => {
|
||||||
</Teleport>
|
</Teleport>
|
||||||
</template>
|
</template>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QTable
|
<VnTable
|
||||||
:rows="rows"
|
ref="tableRef"
|
||||||
|
data-key="ItemShelving"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
row-key="id"
|
:url="`ItemShelvingPlacementSupplyStocks`"
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:filter="filter"
|
||||||
class="full-width q-mt-md"
|
:expr-builder="exprBuilder"
|
||||||
selection="multiple"
|
:right-search="false"
|
||||||
v-model:selected="rowsSelected"
|
v-model:selected="selectedRows"
|
||||||
:no-data-label="t('globals.noResults')"
|
:table="{
|
||||||
|
'row-key': 'itemShelvingFk',
|
||||||
|
selection: 'multiple',
|
||||||
|
}"
|
||||||
|
auto-load
|
||||||
>
|
>
|
||||||
<template #top-row="{ cols }">
|
<template #column-longName="{ row }">
|
||||||
<QTr>
|
<span class="link" @click.stop>
|
||||||
<QTd />
|
{{ row.longName }}
|
||||||
<QTd
|
|
||||||
v-for="(col, index) in cols"
|
|
||||||
:key="index"
|
|
||||||
style="max-width: 100px"
|
|
||||||
>
|
|
||||||
<component
|
|
||||||
:is="col.columnFilter.component"
|
|
||||||
v-if="col.columnFilter"
|
|
||||||
v-model="col.columnFilter.filterValue"
|
|
||||||
v-bind="col.columnFilter.attrs"
|
|
||||||
v-on="col.columnFilter.event(col)"
|
|
||||||
dense
|
|
||||||
/>
|
|
||||||
</QTd>
|
|
||||||
</QTr>
|
|
||||||
</template>
|
|
||||||
<template #body-cell-concept="{ row }">
|
|
||||||
<QTd @click.stop>
|
|
||||||
<span class="link">{{ row.longName }}</span>
|
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
</QTd>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</VnTable>
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -89,7 +89,7 @@ const getUrl = (id, param) => `#/Item/${id}/${param}`;
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="getUrl(entityId, 'basic-data')"
|
:url="getUrl(entityId, 'basic-data')"
|
||||||
:text="t('item.summary.otherData')"
|
:text="t('item.summary.basicData')"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('item.summary.intrastatCode')"
|
:label="t('item.summary.intrastatCode')"
|
||||||
|
|
|
@ -8,7 +8,6 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -60,12 +59,17 @@ const insertTag = (rows) => {
|
||||||
itemTagsRef.value.formData[itemTagsRef.value.formData.length - 1].priority =
|
itemTagsRef.value.formData[itemTagsRef.value.formData.length - 1].priority =
|
||||||
getHighestPriority(rows);
|
getHighestPriority(rows);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const submitTags = async (data) => {
|
||||||
|
itemTagsRef.value.onSubmit(data);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Tags"
|
url="Tags"
|
||||||
:filter="{ fields: ['id', 'name', 'isFree', 'sourceTable'] }"
|
:filter="{ fields: ['id', 'name', 'isFree', 'sourceTable'] }"
|
||||||
|
sort-by="name"
|
||||||
@on-fetch="(data) => (tagOptions = data)"
|
@on-fetch="(data) => (tagOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
@ -76,7 +80,6 @@ const insertTag = (rows) => {
|
||||||
data-key="ItemTags"
|
data-key="ItemTags"
|
||||||
model="ItemTags"
|
model="ItemTags"
|
||||||
url="ItemTags"
|
url="ItemTags"
|
||||||
update-url="Tags/onSubmit"
|
|
||||||
:data-required="{
|
:data-required="{
|
||||||
$index: undefined,
|
$index: undefined,
|
||||||
itemFk: route.params.id,
|
itemFk: route.params.id,
|
||||||
|
@ -137,6 +140,7 @@ const insertTag = (rows) => {
|
||||||
:required="false"
|
:required="false"
|
||||||
:rules="validate('itemTag.tagFk')"
|
:rules="validate('itemTag.tagFk')"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
|
sort-by="value"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
v-else-if="
|
v-else-if="
|
||||||
|
@ -145,6 +149,7 @@ const insertTag = (rows) => {
|
||||||
v-model="row.value"
|
v-model="row.value"
|
||||||
:label="t('itemTags.value')"
|
:label="t('itemTags.value')"
|
||||||
:is-clearable="false"
|
:is-clearable="false"
|
||||||
|
@keyup.enter.stop="submitTags(row)"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('itemBasicData.relevancy')"
|
:label="t('itemBasicData.relevancy')"
|
||||||
|
@ -152,6 +157,7 @@ const insertTag = (rows) => {
|
||||||
v-model="row.priority"
|
v-model="row.priority"
|
||||||
:required="true"
|
:required="true"
|
||||||
:rules="validate('itemTag.priority')"
|
:rules="validate('itemTag.priority')"
|
||||||
|
@keyup.enter.stop="submitTags(row)"
|
||||||
/>
|
/>
|
||||||
<div class="row justify-center" style="flex: 0">
|
<div class="row justify-center" style="flex: 0">
|
||||||
<QIcon
|
<QIcon
|
||||||
|
@ -187,3 +193,8 @@ const insertTag = (rows) => {
|
||||||
</QPage>
|
</QPage>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Tags can not be repeated: Las etiquetas no pueden repetirse
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -28,7 +28,7 @@ const taxesFilter = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const ItemTaxRef = ref(null);
|
const ItemTaxRef = ref();
|
||||||
const taxesOptions = ref([]);
|
const taxesOptions = ref([]);
|
||||||
|
|
||||||
const submitTaxes = async (data) => {
|
const submitTaxes = async (data) => {
|
||||||
|
@ -36,7 +36,10 @@ const submitTaxes = async (data) => {
|
||||||
id: tax.id,
|
id: tax.id,
|
||||||
taxClassFk: tax.taxClassFk,
|
taxClassFk: tax.taxClassFk,
|
||||||
}));
|
}));
|
||||||
|
if (payload.some((item) => item.taxClassFk === null)) {
|
||||||
|
notify(t('Tax class cannot be blank'), 'negative');
|
||||||
|
return;
|
||||||
|
}
|
||||||
await axios.post(`Items/updateTaxes`, payload);
|
await axios.post(`Items/updateTaxes`, payload);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, reactive, onUnmounted, nextTick, computed } from 'vue';
|
import { onMounted, ref, onUnmounted, nextTick, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||||
|
@ -37,11 +37,9 @@ const fixedPrices = ref([]);
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
const rowsSelected = ref([]);
|
const rowsSelected = ref([]);
|
||||||
const itemFixedPriceFilterRef = ref();
|
const itemFixedPriceFilterRef = ref();
|
||||||
const params = reactive({});
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
params.warehouseFk = user.value.warehouseFk;
|
|
||||||
});
|
});
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
|
|
||||||
|
@ -137,8 +135,17 @@ const columns = computed(() => [
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
columnClass: 'shrink',
|
columnClass: 'shrink',
|
||||||
component: 'select',
|
component: 'select',
|
||||||
|
|
||||||
options: warehousesOptions,
|
options: warehousesOptions,
|
||||||
|
columnFilter: {
|
||||||
|
name: 'warehouseFk',
|
||||||
|
inWhere: true,
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
options: warehousesOptions,
|
||||||
|
'option-label': 'name',
|
||||||
|
'option-value': 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
@ -210,8 +217,6 @@ const getRowUpdateInputEvents = (props, resetMinPrice, inputType = 'text') => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMinPrice = async (value, props) => {
|
const updateMinPrice = async (value, props) => {
|
||||||
// El checkbox hasMinPrice se encuentra en la misma columna que el input hasMinPrice
|
|
||||||
// Por lo tanto le mandamos otro objeto con las mismas propiedades pero con el campo 'field' cambiado
|
|
||||||
props.row.hasMinPrice = value;
|
props.row.hasMinPrice = value;
|
||||||
await upsertPrice({
|
await upsertPrice({
|
||||||
row: props.row,
|
row: props.row,
|
||||||
|
@ -220,12 +225,33 @@ const updateMinPrice = async (value, props) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const validations = ({ row }) => {
|
||||||
|
const requiredFields = [
|
||||||
|
'itemFk',
|
||||||
|
'started',
|
||||||
|
'ended',
|
||||||
|
'rate2',
|
||||||
|
'rate3',
|
||||||
|
'warehouseFk',
|
||||||
|
];
|
||||||
|
const isValid = requiredFields.every(
|
||||||
|
(field) => row[field] !== null && row[field] !== undefined
|
||||||
|
);
|
||||||
|
return isValid;
|
||||||
|
};
|
||||||
const upsertPrice = async (props, resetMinPrice = false) => {
|
const upsertPrice = async (props, resetMinPrice = false) => {
|
||||||
const { row } = props;
|
const isValid = validations({ ...props });
|
||||||
if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) {
|
if (!isValid) {
|
||||||
if (resetMinPrice) row.hasMinPrice = 0;
|
return;
|
||||||
await upsertFixedPrice(row);
|
|
||||||
}
|
}
|
||||||
|
const { row } = props;
|
||||||
|
const changes = tableRef.value.CrudModelRef.getChanges();
|
||||||
|
if (changes?.updates?.length > 0) {
|
||||||
|
if (resetMinPrice) row.hasMinPrice = 0;
|
||||||
|
}
|
||||||
|
if (!changes.updates && !changes.creates) return;
|
||||||
|
const data = await upsertFixedPrice(row);
|
||||||
|
tableRef.value.CrudModelRef.formData[props.rowIndex] = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
async function upsertFixedPrice(row) {
|
async function upsertFixedPrice(row) {
|
||||||
|
@ -233,13 +259,6 @@ async function upsertFixedPrice(row) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveOnRowChange(row) {
|
|
||||||
if (rowsSelected.value.length > 1) return;
|
|
||||||
if (rowsSelected.value[0]?.id === row.id) return;
|
|
||||||
else if (rowsSelected.value.length === 1) await upsertPrice(rowsSelected.value[0]);
|
|
||||||
rowsSelected.value = [row];
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkLastVisibleRow() {
|
function checkLastVisibleRow() {
|
||||||
let lastVisibleRow = null;
|
let lastVisibleRow = null;
|
||||||
|
|
||||||
|
@ -255,7 +274,6 @@ function checkLastVisibleRow() {
|
||||||
|
|
||||||
const addRow = (original = null) => {
|
const addRow = (original = null) => {
|
||||||
let copy = null;
|
let copy = null;
|
||||||
if (!original) {
|
|
||||||
const today = Date.vnNew();
|
const today = Date.vnNew();
|
||||||
const millisecsInDay = 86400000;
|
const millisecsInDay = 86400000;
|
||||||
const daysInWeek = 7;
|
const daysInWeek = 7;
|
||||||
|
@ -268,26 +286,6 @@ const addRow = (original = null) => {
|
||||||
hasMinPrice: 0,
|
hasMinPrice: 0,
|
||||||
$index: 0,
|
$index: 0,
|
||||||
};
|
};
|
||||||
} else
|
|
||||||
copy = {
|
|
||||||
$index: original.$index - 1,
|
|
||||||
itemFk: original.itemFk,
|
|
||||||
name: original.name,
|
|
||||||
subName: original.subName,
|
|
||||||
value5: original.value5,
|
|
||||||
value6: original.value6,
|
|
||||||
value7: original.value7,
|
|
||||||
value8: original.value8,
|
|
||||||
value9: original.value9,
|
|
||||||
value10: original.value10,
|
|
||||||
warehouseFk: original.warehouseFk,
|
|
||||||
rate2: original.rate2,
|
|
||||||
rate3: original.rate3,
|
|
||||||
hasMinPrice: original.hasMinPrice,
|
|
||||||
minPrice: original.minPrice,
|
|
||||||
started: Date.vnNew(),
|
|
||||||
ended: Date.vnNew(),
|
|
||||||
};
|
|
||||||
return { original, copy };
|
return { original, copy };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -300,7 +298,7 @@ function highlightNewRow({ $index: index }) {
|
||||||
row.classList.add('highlight');
|
row.classList.add('highlight');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
row.classList.remove('highlight');
|
row.classList.remove('highlight');
|
||||||
}, 3000); // Duración de la animación en milisegundos
|
}, 3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const openEditTableCellDialog = () => {
|
const openEditTableCellDialog = () => {
|
||||||
|
@ -411,9 +409,13 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
url="FixedPrices/filter"
|
url="FixedPrices/filter"
|
||||||
:order="['itemFk DESC', 'name DESC']"
|
:order="['itemFk DESC', 'name DESC']"
|
||||||
save-url="FixedPrices/crud"
|
save-url="FixedPrices/crud"
|
||||||
:user-params="{ warehouseFk: user.warehouseFk }"
|
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
dense
|
dense
|
||||||
|
:filter="{
|
||||||
|
where: {
|
||||||
|
warehouseFk: user.warehouseFk,
|
||||||
|
},
|
||||||
|
}"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
auto-load
|
auto-load
|
||||||
|
@ -427,7 +429,6 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
disableInfiniteScroll: true,
|
disableInfiniteScroll: true,
|
||||||
}"
|
}"
|
||||||
v-model:selected="rowsSelected"
|
v-model:selected="rowsSelected"
|
||||||
:row-click="saveOnRowChange"
|
|
||||||
:create-as-dialog="false"
|
:create-as-dialog="false"
|
||||||
:create="{
|
:create="{
|
||||||
onDataSaved: handleOnDataSave,
|
onDataSaved: handleOnDataSave,
|
||||||
|
|
|
@ -55,17 +55,6 @@ const columns = computed(() => [
|
||||||
label: '',
|
label: '',
|
||||||
name: 'image',
|
name: 'image',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
columnField: {
|
|
||||||
component: VnImg,
|
|
||||||
attrs: ({ row }) => {
|
|
||||||
return {
|
|
||||||
id: row?.id,
|
|
||||||
zoomResolution: '1600x900',
|
|
||||||
zoom: true,
|
|
||||||
class: 'rounded',
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
|
@ -184,7 +173,7 @@ const columns = computed(() => [
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('globals.origin'),
|
label: t('item.list.origin'),
|
||||||
name: 'origin',
|
name: 'origin',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
component: 'select',
|
component: 'select',
|
||||||
|
@ -228,7 +217,8 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.list.weightByPiece'),
|
label: t('item.list.weight'),
|
||||||
|
toolTip: t('item.list.weightByPiece'),
|
||||||
name: 'weightByPiece',
|
name: 'weightByPiece',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
component: 'input',
|
component: 'input',
|
||||||
|
@ -322,7 +312,6 @@ const columns = computed(() => [
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="ItemList"
|
data-key="ItemList"
|
||||||
url="Items/filter"
|
url="Items/filter"
|
||||||
url-create="Items"
|
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'Items',
|
urlCreate: 'Items',
|
||||||
title: t('Create Item'),
|
title: t('Create Item'),
|
||||||
|
@ -333,12 +322,19 @@ const columns = computed(() => [
|
||||||
}"
|
}"
|
||||||
:order="['isActive DESC', 'name', 'id']"
|
:order="['isActive DESC', 'name', 'id']"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
auto-load
|
|
||||||
redirect="Item"
|
redirect="Item"
|
||||||
:is-editable="false"
|
:is-editable="false"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:filer="itemFilter"
|
:filter="itemFilter"
|
||||||
>
|
>
|
||||||
|
<template #column-image="{ row }">
|
||||||
|
<VnImg
|
||||||
|
:id="row?.id"
|
||||||
|
zoom-resolution="1600x900"
|
||||||
|
:zoom="true"
|
||||||
|
class="rounded"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
<template #column-id="{ row }">
|
<template #column-id="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
{{ row.id }}
|
{{ row.id }}
|
||||||
|
@ -348,7 +344,7 @@ const columns = computed(() => [
|
||||||
<template #column-userName="{ row }">
|
<template #column-userName="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
{{ row.userName }}
|
{{ row.userName }}
|
||||||
<WorkerDescriptorProxy :id="row.workerFk" />
|
<WorkerDescriptorProxy :id="row.buyerFk" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #column-description="{ row }">
|
<template #column-description="{ row }">
|
||||||
|
|
|
@ -199,7 +199,17 @@ onMounted(async () => {
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
/>
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{
|
||||||
|
t(`params.${scope.opt?.name}`)
|
||||||
|
}}</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
|
@ -434,6 +444,13 @@ en:
|
||||||
description: Description
|
description: Description
|
||||||
name: Name
|
name: Name
|
||||||
id: Id
|
id: Id
|
||||||
|
Accessories: Accessories
|
||||||
|
Artificial: Artificial
|
||||||
|
Flower: Flower
|
||||||
|
Fruit: Fruit
|
||||||
|
Green: Green
|
||||||
|
Handmade: Handmade
|
||||||
|
Plant: Plant
|
||||||
es:
|
es:
|
||||||
More fields: Más campos
|
More fields: Más campos
|
||||||
params:
|
params:
|
||||||
|
@ -450,4 +467,11 @@ es:
|
||||||
description: Descripción
|
description: Descripción
|
||||||
name: Nombre
|
name: Nombre
|
||||||
id: Id
|
id: Id
|
||||||
|
Accessories: Accesorios
|
||||||
|
Artificial: Artificial
|
||||||
|
Flower: Flor
|
||||||
|
Fruit: Fruta
|
||||||
|
Green: Verde
|
||||||
|
Handmade: Hecho a mano
|
||||||
|
Plant: Planta
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -5,13 +5,16 @@ import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.v
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { dashIfEmpty, toCurrency } from 'filters/index';
|
import { toCurrency } from 'filters/index';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import ItemRequestDenyForm from './ItemRequestDenyForm.vue';
|
import ItemRequestDenyForm from './ItemRequestDenyForm.vue';
|
||||||
import { toDate } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
import ItemRequestFilter from './ItemRequestFilter.vue';
|
||||||
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
@ -228,6 +231,11 @@ onMounted(async () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<RightMenu>
|
||||||
|
<template #right-panel>
|
||||||
|
<ItemRequestFilter data-key="itemRequest" />
|
||||||
|
</template>
|
||||||
|
</RightMenu>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="itemRequest"
|
data-key="itemRequest"
|
||||||
|
@ -239,6 +247,7 @@ onMounted(async () => {
|
||||||
auto-load
|
auto-load
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
chip-locale="item.params"
|
chip-locale="item.params"
|
||||||
|
:right-search="false"
|
||||||
>
|
>
|
||||||
<template #column-ticketFk="{ row }">
|
<template #column-ticketFk="{ row }">
|
||||||
<span class="link">
|
<span class="link">
|
||||||
|
@ -306,7 +315,6 @@ onMounted(async () => {
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #column-denyOptions="{ row, rowIndex }">
|
<template #column-denyOptions="{ row, rowIndex }">
|
||||||
<QTd class="sticky no-padding">
|
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="row.response?.length"
|
v-if="row.response?.length"
|
||||||
name="insert_drive_file"
|
name="insert_drive_file"
|
||||||
|
@ -329,7 +337,6 @@ onMounted(async () => {
|
||||||
{{ t('Discard') }}
|
{{ t('Discard') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
<QDialog ref="denyFormRef" transition-show="scale" transition-hide="scale">
|
<QDialog ref="denyFormRef" transition-show="scale" transition-hide="scale">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { dateRange } from 'src/filters';
|
import { dateRange } from 'src/filters';
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
|
@ -7,6 +7,8 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -21,7 +23,8 @@ const stateOptions = [
|
||||||
{ code: 'accepted', name: t('accepted') },
|
{ code: 'accepted', name: t('accepted') },
|
||||||
{ code: 'denied', name: t('denied') },
|
{ code: 'denied', name: t('denied') },
|
||||||
];
|
];
|
||||||
|
const arrayData = useArrayData(props.dataKey);
|
||||||
|
const fieldFiltersValues = ref([]);
|
||||||
const itemTypesOptions = ref([]);
|
const itemTypesOptions = ref([]);
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
|
|
||||||
|
@ -56,6 +59,19 @@ const decrement = (paramsObj, key) => {
|
||||||
|
|
||||||
paramsObj[key]--;
|
paramsObj[key]--;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
if (arrayData.store?.userParams) {
|
||||||
|
fieldFiltersValues.value = Object.entries(arrayData.store.userParams).map(
|
||||||
|
([key, value]) => ({
|
||||||
|
name: key,
|
||||||
|
value,
|
||||||
|
selectedField: { name: key, label: t(`params.${key}`) },
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
exprBuilder('state', arrayData.store?.userParams?.state);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -145,33 +161,17 @@ const decrement = (paramsObj, key) => {
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
:label="t('params.requesterFk')"
|
:label="t('params.requesterFk')"
|
||||||
v-model="params.requesterFk"
|
v-model="params.requesterFk"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
url="Workers/search"
|
|
||||||
:fields="['id', 'name']"
|
:fields="['id', 'name']"
|
||||||
order="name ASC"
|
|
||||||
:params="{ departmentCodes: ['VT'] }"
|
:params="{ departmentCodes: ['VT'] }"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
hide-selected
|
hide-selected
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
>
|
/>
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
|
||||||
<QItemLabel caption
|
|
||||||
>{{ scope.opt?.nickname }},
|
|
||||||
{{ scope.opt?.code }}</QItemLabel
|
|
||||||
>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
|
|
|
@ -10,7 +10,6 @@ const { t } = useI18n();
|
||||||
url="ItemTypes"
|
url="ItemTypes"
|
||||||
:label="t('Search item type')"
|
:label="t('Search item type')"
|
||||||
:info="t('Search itemType by id, name or code')"
|
:info="t('Search itemType by id, name or code')"
|
||||||
search-url="table"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -6,6 +6,7 @@ import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import ItemTypeFilter from './ItemType/ItemTypeFilter.vue';
|
import ItemTypeFilter from './ItemType/ItemTypeFilter.vue';
|
||||||
|
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
@ -31,13 +32,14 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
label: t('name'),
|
label: t('globals.name'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
create: true,
|
create: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('worker'),
|
label: t('worker'),
|
||||||
|
name: 'workerFk',
|
||||||
create: true,
|
create: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -45,20 +47,20 @@ const columns = computed(() => [
|
||||||
optionLabel: 'nickname',
|
optionLabel: 'nickname',
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
},
|
},
|
||||||
|
format: (row) => row.worker?.user?.name,
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
visible: true,
|
columnField: { component: null },
|
||||||
columnField: {
|
|
||||||
component: 'userLink',
|
|
||||||
attrs: ({ row }) => {
|
|
||||||
return {
|
|
||||||
workerId: row?.worker?.id,
|
|
||||||
name: row.worker?.user?.name,
|
|
||||||
defaultName: true,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
name: 'workerFk',
|
attrs: {
|
||||||
|
url: 'Workers/activeWithInheritedRole',
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
where: { role: 'buyer' },
|
||||||
|
optionFilter: 'firstName',
|
||||||
|
optionLabel: 'name',
|
||||||
|
optionValue: 'id',
|
||||||
|
useLike: false,
|
||||||
|
},
|
||||||
|
inWhere: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -135,24 +137,27 @@ const columns = computed(() => [
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
auto-load
|
auto-load
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:is-editable="false"
|
|
||||||
:use-model="true"
|
|
||||||
redirect="item/item-type"
|
redirect="item/item-type"
|
||||||
/>
|
>
|
||||||
|
<template #column-workerFk="{ row }">
|
||||||
|
<span class="link" @click.stop>
|
||||||
|
{{ row.worker?.user?.name }}
|
||||||
|
<WorkerDescriptorProxy :id="row.workerFk" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
id: Id
|
id: Id
|
||||||
code: Código
|
code: Código
|
||||||
name: Nombre
|
|
||||||
worker: Trabajador
|
worker: Trabajador
|
||||||
ItemCategory: Reino
|
ItemCategory: Reino
|
||||||
Temperature: Temperatura
|
Temperature: Temperatura
|
||||||
Create ItemTypes: Crear familia
|
Create ItemTypes: Crear familia
|
||||||
en:
|
en:
|
||||||
code: Code
|
code: Code
|
||||||
name: Name
|
|
||||||
worker: Worker
|
worker: Worker
|
||||||
ItemCategory: ItemCategory
|
ItemCategory: ItemCategory
|
||||||
Temperature: Temperature
|
Temperature: Temperature
|
||||||
|
|
|
@ -95,6 +95,15 @@ item:
|
||||||
mine: For me
|
mine: For me
|
||||||
state: State
|
state: State
|
||||||
myTeam: My team
|
myTeam: My team
|
||||||
|
shipped: Shipped
|
||||||
|
description: Description
|
||||||
|
quantity: Quantity
|
||||||
|
price: Price
|
||||||
|
item: Item
|
||||||
|
achieved: Achieved
|
||||||
|
concept: Concept
|
||||||
|
denyOptions: Deny
|
||||||
|
scopeDays: Scope days
|
||||||
searchbar:
|
searchbar:
|
||||||
label: Search item
|
label: Search item
|
||||||
descriptor:
|
descriptor:
|
||||||
|
@ -112,7 +121,7 @@ item:
|
||||||
title: All its properties will be copied
|
title: All its properties will be copied
|
||||||
subTitle: Do you want to clone this item?
|
subTitle: Do you want to clone this item?
|
||||||
list:
|
list:
|
||||||
id: Identifier
|
id: Id
|
||||||
grouping: Grouping
|
grouping: Grouping
|
||||||
packing: Packing
|
packing: Packing
|
||||||
description: Description
|
description: Description
|
||||||
|
@ -122,8 +131,9 @@ item:
|
||||||
intrastat: Intrastat
|
intrastat: Intrastat
|
||||||
isActive: Active
|
isActive: Active
|
||||||
size: Size
|
size: Size
|
||||||
origin: Origin
|
origin: Orig.
|
||||||
userName: Buyer
|
userName: Buyer
|
||||||
|
weight: Weight
|
||||||
weightByPiece: Weight/Piece
|
weightByPiece: Weight/Piece
|
||||||
stemMultiplier: Multiplier
|
stemMultiplier: Multiplier
|
||||||
producer: Producer
|
producer: Producer
|
||||||
|
|
|
@ -97,6 +97,15 @@ item:
|
||||||
mine: Para mi
|
mine: Para mi
|
||||||
state: Estado
|
state: Estado
|
||||||
myTeam: Mi equipo
|
myTeam: Mi equipo
|
||||||
|
shipped: Enviado
|
||||||
|
description: Descripción
|
||||||
|
quantity: Cantidad
|
||||||
|
price: Precio
|
||||||
|
item: Artículo
|
||||||
|
achieved: Conseguido
|
||||||
|
concept: Concepto
|
||||||
|
denyOptions: Denegado
|
||||||
|
scopeDays: Días en adelante
|
||||||
searchbar:
|
searchbar:
|
||||||
label: Buscar artículo
|
label: Buscar artículo
|
||||||
descriptor:
|
descriptor:
|
||||||
|
@ -114,7 +123,7 @@ item:
|
||||||
title: Todas sus propiedades serán copiadas
|
title: Todas sus propiedades serán copiadas
|
||||||
subTitle: ¿Desea clonar este artículo?
|
subTitle: ¿Desea clonar este artículo?
|
||||||
list:
|
list:
|
||||||
id: Identificador
|
id: Id
|
||||||
grouping: Grouping
|
grouping: Grouping
|
||||||
packing: Packing
|
packing: Packing
|
||||||
description: Descripción
|
description: Descripción
|
||||||
|
@ -124,7 +133,8 @@ item:
|
||||||
intrastat: Intrastat
|
intrastat: Intrastat
|
||||||
isActive: Activo
|
isActive: Activo
|
||||||
size: Medida
|
size: Medida
|
||||||
origin: Origen
|
origin: Orig.
|
||||||
|
weight: Peso
|
||||||
weightByPiece: Peso (gramos)/tallo
|
weightByPiece: Peso (gramos)/tallo
|
||||||
userName: Comprador
|
userName: Comprador
|
||||||
stemMultiplier: Multiplicador
|
stemMultiplier: Multiplicador
|
||||||
|
|
|
@ -9,6 +9,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import { dateRange } from 'src/filters';
|
import { dateRange } from 'src/filters';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
defineProps({ dataKey: { type: String, required: true } });
|
defineProps({ dataKey: { type: String, required: true } });
|
||||||
const { t, te } = useI18n();
|
const { t, te } = useI18n();
|
||||||
|
@ -18,7 +19,7 @@ const groupedStates = ref();
|
||||||
const handleScopeDays = (params, days, callback) => {
|
const handleScopeDays = (params, days, callback) => {
|
||||||
const [from, to] = dateRange(Date.vnNew());
|
const [from, to] = dateRange(Date.vnNew());
|
||||||
if (!days) {
|
if (!days) {
|
||||||
Object.assign(params, { from, to, scopeDays: 1 });
|
Object.assign(params, { from, to, scopeDays: 0 });
|
||||||
} else {
|
} else {
|
||||||
params.from = from;
|
params.from = from;
|
||||||
to.setDate(to.getDate() + days);
|
to.setDate(to.getDate() + days);
|
||||||
|
@ -59,7 +60,11 @@ const getLocale = (label) => {
|
||||||
</template>
|
</template>
|
||||||
<template #customTags="{ params, searchFn, formatFn }">
|
<template #customTags="{ params, searchFn, formatFn }">
|
||||||
<VnFilterPanelChip
|
<VnFilterPanelChip
|
||||||
v-if="params.scopeDays"
|
v-if="
|
||||||
|
params.scopeDays !== undefined ||
|
||||||
|
params.scopeDays !== '' ||
|
||||||
|
params.scopeDays !== null
|
||||||
|
"
|
||||||
removable
|
removable
|
||||||
@remove="handleScopeDays(params, null, searchFn)"
|
@remove="handleScopeDays(params, null, searchFn)"
|
||||||
>
|
>
|
||||||
|
@ -108,33 +113,16 @@ const getLocale = (label) => {
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
:label="t('globals.params.salesPersonFk')"
|
:label="t('globals.params.salesPersonFk')"
|
||||||
v-model="params.salesPersonFk"
|
v-model="params.salesPersonFk"
|
||||||
url="Workers/search"
|
|
||||||
:params="{ departmentCodes: ['VT'] }"
|
:params="{ departmentCodes: ['VT'] }"
|
||||||
is-outlined
|
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
:no-one="true"
|
:no-one="true"
|
||||||
>
|
>
|
||||||
<template #option="{ opt, itemProps }">
|
</VnSelectWorker>
|
||||||
<QItem v-bind="itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
|
||||||
<QItemLabel
|
|
||||||
v-if="opt.code"
|
|
||||||
class="text-grey text-caption"
|
|
||||||
>
|
|
||||||
{{ `${opt.nickname}, ${opt.code}` }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
|
@ -197,6 +185,18 @@ const getLocale = (label) => {
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnSelect
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
rounded
|
||||||
|
:label="t('globals.params.countryFk')"
|
||||||
|
v-model="params.countryFk"
|
||||||
|
url="Countries"
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
|
|
@ -25,11 +25,8 @@ const provinceOpts = ref([]);
|
||||||
const stateOpts = ref([]);
|
const stateOpts = ref([]);
|
||||||
const zoneOpts = ref([]);
|
const zoneOpts = ref([]);
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const from = Date.vnNew();
|
|
||||||
from.setHours(0, 0, 0, 0);
|
const [from, to] = dateRange(Date.vnNew());
|
||||||
const to = new Date(from.getTime());
|
|
||||||
to.setDate(to.getDate() + 1);
|
|
||||||
to.setHours(23, 59, 59, 999);
|
|
||||||
const stateColors = {
|
const stateColors = {
|
||||||
notice: 'info',
|
notice: 'info',
|
||||||
success: 'positive',
|
success: 'positive',
|
||||||
|
@ -340,7 +337,7 @@ const openTab = (id) =>
|
||||||
auto-load
|
auto-load
|
||||||
:row-click="({ id }) => openTab(id)"
|
:row-click="({ id }) => openTab(id)"
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
:user-params="{ from, to, scopeDays: 1 }"
|
:user-params="{ from, to, scopeDays: 0 }"
|
||||||
>
|
>
|
||||||
<template #top-left>
|
<template #top-left>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
|
|
@ -36,7 +36,6 @@ const getSelectedTagValues = async (tag) => {
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['value'],
|
fields: ['value'],
|
||||||
order: 'value ASC',
|
order: 'value ASC',
|
||||||
limit: 30,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const url = `Tags/${tag?.id}/filterValue`;
|
const url = `Tags/${tag?.id}/filterValue`;
|
||||||
|
@ -50,7 +49,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QForm @submit="applyTags()" class="all-pointer-events">
|
<QForm @submit="applyTags()" class="all-pointer-events">
|
||||||
<QCard class="q-pa-sm column q-pa-lg">
|
<QCard class="q-pa-sm column q-pa-lg" data-cy="catalogFilterValueDialog">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('params.tag')"
|
:label="t('params.tag')"
|
||||||
v-model="selectedTag"
|
v-model="selectedTag"
|
||||||
|
@ -64,6 +63,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
use-input
|
use-input
|
||||||
@update:model-value="getSelectedTagValues"
|
@update:model-value="getSelectedTagValues"
|
||||||
|
data-cy="catalogFilterValueDialogTagSelect"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-for="(value, index) in tagValues"
|
v-for="(value, index) in tagValues"
|
||||||
|
@ -94,6 +94,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
:disable="!value"
|
:disable="!value"
|
||||||
is-outlined
|
is-outlined
|
||||||
class="col"
|
class="col"
|
||||||
|
data-cy="catalogFilterValueDialogValueInput"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="delete"
|
icon="delete"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { onMounted, onUnmounted, ref, computed, watch } from 'vue';
|
import { onMounted, ref, computed, watch, provide } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
|
@ -18,6 +18,7 @@ const dataKey = 'OrderCatalogList';
|
||||||
const arrayData = useArrayData(dataKey);
|
const arrayData = useArrayData(dataKey);
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const tags = ref([]);
|
const tags = ref([]);
|
||||||
|
const itemRefs = ref({});
|
||||||
|
|
||||||
let catalogParams = {
|
let catalogParams = {
|
||||||
orderFk: route.params.id,
|
orderFk: route.params.id,
|
||||||
|
@ -29,8 +30,6 @@ onMounted(() => {
|
||||||
checkOrderConfirmation();
|
checkOrderConfirmation();
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
|
||||||
|
|
||||||
async function checkOrderConfirmation() {
|
async function checkOrderConfirmation() {
|
||||||
const response = await axios.get(`Orders/${route.params.id}`);
|
const response = await axios.get(`Orders/${route.params.id}`);
|
||||||
if (response.data.isConfirmed === 1) {
|
if (response.data.isConfirmed === 1) {
|
||||||
|
@ -76,6 +75,19 @@ watch(
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
const onItemSaved = (updatedItem) => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
scrollToItem(updatedItem.items[0].itemFk);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const scrollToItem = async (id) => {
|
||||||
|
const element = itemRefs.value[id]?.$el;
|
||||||
|
if (element) {
|
||||||
|
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
provide('onItemSaved', onItemSaved);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -98,7 +110,7 @@ watch(
|
||||||
/>
|
/>
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md" data-cy="orderCatalogPage">
|
||||||
<div class="full-width">
|
<div class="full-width">
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
|
@ -115,9 +127,11 @@ watch(
|
||||||
<CatalogItem
|
<CatalogItem
|
||||||
v-for="row in rows"
|
v-for="row in rows"
|
||||||
:key="row.id"
|
:key="row.id"
|
||||||
|
:ref="(el) => (itemRefs[row.id] = el)"
|
||||||
:item="row"
|
:item="row"
|
||||||
is-catalog
|
is-catalog
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
|
data-cy="orderCatalogItem"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -178,6 +178,7 @@ function addOrder(value, field, params) {
|
||||||
? resetCategory(params, searchFn)
|
? resetCategory(params, searchFn)
|
||||||
: removeTagGroupParam(params, searchFn, valIndex)
|
: removeTagGroupParam(params, searchFn, valIndex)
|
||||||
"
|
"
|
||||||
|
data-cy="catalogFilterCustomTag"
|
||||||
>
|
>
|
||||||
<strong v-if="customTag.label === 'categoryFk' && categoryList">
|
<strong v-if="customTag.label === 'categoryFk' && categoryList">
|
||||||
{{
|
{{
|
||||||
|
@ -211,6 +212,7 @@ function addOrder(value, field, params) {
|
||||||
:name="category.icon"
|
:name="category.icon"
|
||||||
class="category-icon"
|
class="category-icon"
|
||||||
@click="selectCategory(params, category, searchFn)"
|
@click="selectCategory(params, category, searchFn)"
|
||||||
|
data-cy="catalogFilterCategory"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t(category.name) }}
|
{{ t(category.name) }}
|
||||||
|
@ -234,6 +236,7 @@ function addOrder(value, field, params) {
|
||||||
sort-by="name ASC"
|
sort-by="name ASC"
|
||||||
:disable="!params.categoryFk"
|
:disable="!params.categoryFk"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
|
data-cy="catalogFilterType"
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -285,6 +288,7 @@ function addOrder(value, field, params) {
|
||||||
:is-clearable="false"
|
:is-clearable="false"
|
||||||
v-model="searchByTag"
|
v-model="searchByTag"
|
||||||
@keyup.enter="(val) => onSearchByTag(val, params)"
|
@keyup.enter="(val) => onSearchByTag(val, params)"
|
||||||
|
data-cy="catalogFilterValueInput"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon name="search" />
|
<QIcon name="search" />
|
||||||
|
@ -297,6 +301,7 @@ function addOrder(value, field, params) {
|
||||||
color="primary"
|
color="primary"
|
||||||
size="md"
|
size="md"
|
||||||
dense
|
dense
|
||||||
|
data-cy="catalogFilterValueDialogBtn"
|
||||||
/>
|
/>
|
||||||
<QPopupProxy>
|
<QPopupProxy>
|
||||||
<CatalogFilterValueDialog
|
<CatalogFilterValueDialog
|
||||||
|
|
|
@ -1,41 +1,53 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import toCurrency from '../../../filters/toCurrency';
|
import toCurrency from 'src/filters/toCurrency';
|
||||||
import { ref } from 'vue';
|
import { inject, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import useNotify from 'composables/useNotify';
|
import useNotify from 'composables/useNotify';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const emit = defineEmits(['added']);
|
const emit = defineEmits(['added']);
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
prices: {
|
item: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const onItemSaved = inject('onItemSaved');
|
||||||
const fields = ref((props.prices || []).map((item) => ({ ...item, quantity: 0 })));
|
const prices = ref((props.item.prices || []).map((item) => ({ ...item, quantity: 0 })));
|
||||||
const descriptorData = useArrayData('orderData');
|
const descriptorData = useArrayData('orderData');
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const addToOrder = async () => {
|
const addToOrder = async () => {
|
||||||
if (isLoading.value) return;
|
if (isLoading.value) return;
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const items = (fields.value || []).filter((item) => Number(item.quantity) > 0);
|
const items = (prices.value || []).filter((item) => Number(item.quantity) > 0);
|
||||||
await axios.post('/OrderRows/addToOrder', {
|
await axios.post('/OrderRows/addToOrder', {
|
||||||
items,
|
items,
|
||||||
orderFk: Number(route.params.id),
|
orderFk: Number(route.params.id),
|
||||||
});
|
});
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
emit('added');
|
await descriptorData.fetch({});
|
||||||
descriptorData.fetch({});
|
onItemSaved({ ...props, items, saved: true });
|
||||||
|
emit('added', items);
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
};
|
};
|
||||||
const canAddToOrder = () => {
|
const canAddToOrder = () => {
|
||||||
return (fields.value || []).some((item) => Number(item.quantity) > 0);
|
let canAddToOrder = (prices.value || []).some((price) => Number(price.quantity) > 0);
|
||||||
|
if (canAddToOrder) {
|
||||||
|
const excedQuantity = prices.value.reduce(
|
||||||
|
(acc, { quantity }) => acc + quantity,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
if (excedQuantity > props.item.available) {
|
||||||
|
canAddToOrder = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return canAddToOrder;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -44,30 +56,33 @@ const canAddToOrder = () => {
|
||||||
<QForm @submit="addToOrder">
|
<QForm @submit="addToOrder">
|
||||||
<QMarkupTable class="shadow-0">
|
<QMarkupTable class="shadow-0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="item in fields" :key="item.warehouse">
|
<tr v-for="price in prices" :key="price.warehouse">
|
||||||
<td class="text-bold q-pr-md td" style="width: 35%">
|
<td class="text-bold q-pr-md td" style="width: 35%">
|
||||||
{{ item.warehouse }}
|
{{ price.warehouse }}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right" style="width: 35%">
|
<td class="text-right" style="width: 35%">
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
@click="
|
@click.shift="
|
||||||
() => {
|
() => {
|
||||||
item.quantity += item.grouping;
|
price.quantity -= price.grouping;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
@click.exact="
|
||||||
|
() => {
|
||||||
|
price.quantity += price.grouping;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ item.grouping }}
|
{{ price.grouping }}
|
||||||
</span>
|
</span>
|
||||||
x {{ toCurrency(item.price) }}
|
x {{ toCurrency(price.price) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<QInput
|
<VnInputNumber
|
||||||
v-model.number="item.quantity"
|
v-model.number="price.quantity"
|
||||||
type="number"
|
:step="price.grouping"
|
||||||
:step="item.grouping"
|
|
||||||
min="0"
|
min="0"
|
||||||
dense
|
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { reactive, onMounted, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useState } from 'composables/useState';
|
|
||||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
@ -11,29 +10,12 @@ import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import { useDialogPluginComponent } from 'quasar';
|
import { useDialogPluginComponent } from 'quasar';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const state = useState();
|
|
||||||
const ORDER_MODEL = 'order';
|
const ORDER_MODEL = 'order';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const agencyList = ref([]);
|
const agencyList = ref([]);
|
||||||
const addressList = ref([]);
|
|
||||||
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||||
|
|
||||||
const fetchAddressList = async (addressId) => {
|
|
||||||
const { data } = await axios.get('addresses', {
|
|
||||||
params: {
|
|
||||||
filter: JSON.stringify({
|
|
||||||
fields: ['id', 'nickname', 'street', 'city'],
|
|
||||||
where: { id: addressId },
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
addressList.value = data;
|
|
||||||
if (addressList.value?.length === 1) {
|
|
||||||
state.get(ORDER_MODEL).addressId = addressList.value[0].id;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchAgencyList = async (landed, addressFk) => {
|
const fetchAgencyList = async (landed, addressFk) => {
|
||||||
if (!landed || !addressFk) {
|
if (!landed || !addressFk) {
|
||||||
return;
|
return;
|
||||||
|
@ -59,17 +41,9 @@ const initialFormState = reactive({
|
||||||
clientFk: $props.clientFk,
|
clientFk: $props.clientFk,
|
||||||
});
|
});
|
||||||
|
|
||||||
const onClientChange = async (clientId = $props.clientFk) => {
|
|
||||||
const { data } = await axios.get(`Clients/${clientId}`);
|
|
||||||
await fetchAddressList(data.defaultAddressFk);
|
|
||||||
};
|
|
||||||
|
|
||||||
async function onDataSaved(_, id) {
|
async function onDataSaved(_, id) {
|
||||||
await router.push({ path: `/order/${id}/catalog` });
|
await router.push({ path: `/order/${id}/catalog` });
|
||||||
}
|
}
|
||||||
onMounted(async () => {
|
|
||||||
await onClientChange();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -90,10 +64,9 @@ onMounted(async () => {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
:filter="{
|
:filter="{
|
||||||
fields: ['id', 'name', 'defaultAddressFk'],
|
fields: ['id', 'name'],
|
||||||
}"
|
}"
|
||||||
hide-selected
|
hide-selected
|
||||||
@update:model-value="onClientChange"
|
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -110,7 +83,7 @@ onMounted(async () => {
|
||||||
:label="t('order.form.addressFk')"
|
:label="t('order.form.addressFk')"
|
||||||
v-model="data.addressId"
|
v-model="data.addressId"
|
||||||
url="addresses"
|
url="addresses"
|
||||||
:fields="['id', 'nickname', 'defaultAddressFk', 'street', 'city']"
|
:fields="['id', 'nickname', 'street', 'city']"
|
||||||
sort-by="id"
|
sort-by="id"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="street"
|
option-label="street"
|
||||||
|
|
|
@ -6,6 +6,7 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInput from 'components/common/VnInput.vue';
|
import VnInput from 'components/common/VnInput.vue';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -61,28 +62,16 @@ const sourceList = ref([]);
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
:label="t('salesPerson')"
|
:label="t('globals.salesPerson')"
|
||||||
v-model="params.workerFk"
|
v-model="params.workerFk"
|
||||||
url="Workers/search"
|
:params="{
|
||||||
:filter="{ departmentCodes: ['VT'] }"
|
departmentCodes: ['VT'],
|
||||||
sort-by="nickname ASC"
|
}"
|
||||||
option-label="nickname"
|
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
>
|
/>
|
||||||
<template #option="{ itemProps, opt }">
|
|
||||||
<QItem v-bind="itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
|
||||||
<QItemLabel caption>
|
|
||||||
{{ opt.nickname }},{{ opt.code }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
v-model="params.from"
|
v-model="params.from"
|
||||||
:label="t('fromLanded')"
|
:label="t('fromLanded')"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, ref, onMounted } from 'vue';
|
||||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||||
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
|
@ -20,8 +20,8 @@ const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const agencyList = ref([]);
|
const agencyList = ref([]);
|
||||||
const addressesList = ref([]);
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const addressOptions = ref([]);
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -147,11 +147,12 @@ onMounted(() => {
|
||||||
const id = JSON.parse(clientId);
|
const id = JSON.parse(clientId);
|
||||||
fetchClientAddress(id.clientFk);
|
fetchClientAddress(id.clientFk);
|
||||||
});
|
});
|
||||||
|
|
||||||
async function fetchClientAddress(id, formData = {}) {
|
async function fetchClientAddress(id, formData = {}) {
|
||||||
const { data } = await axios.get(`Clients/${id}`, {
|
const { data } = await axios.get(
|
||||||
params: { filter: { include: { relation: 'addresses' } } },
|
`Clients/${id}/addresses?filter[order]=isActive DESC`
|
||||||
});
|
);
|
||||||
addressesList.value = data.addresses;
|
addressOptions.value = data;
|
||||||
formData.addressId = data.defaultAddressFk;
|
formData.addressId = data.defaultAddressFk;
|
||||||
fetchAgencies(formData);
|
fetchAgencies(formData);
|
||||||
}
|
}
|
||||||
|
@ -246,7 +247,7 @@ const getDateColor = (date) => {
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
v-model="data.addressId"
|
v-model="data.addressId"
|
||||||
:options="addressesList"
|
:options="addressOptions"
|
||||||
:label="t('module.address')"
|
:label="t('module.address')"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
|
|
|
@ -4,6 +4,7 @@ import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInput from 'components/common/VnInput.vue';
|
import VnInput from 'components/common/VnInput.vue';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -31,29 +32,13 @@ const emit = defineEmits(['search']);
|
||||||
<template #body="{ params }">
|
<template #body="{ params }">
|
||||||
<QItem class="q-my-sm">
|
<QItem class="q-my-sm">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelectWorker
|
||||||
:label="t('Worker')"
|
|
||||||
v-model="params.workerFk"
|
v-model="params.workerFk"
|
||||||
url="Workers/search"
|
|
||||||
sort-by="nickname ASC"
|
|
||||||
option-value="id"
|
|
||||||
option-label="nickname"
|
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
>
|
/>
|
||||||
<template #option="{ itemProps, opt }">
|
|
||||||
<QItem v-bind="itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
|
||||||
<QItemLabel caption>
|
|
||||||
{{ opt.nickname }},{{ opt.code }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-my-sm">
|
<QItem class="q-my-sm">
|
||||||
|
|
|
@ -11,6 +11,7 @@ import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInput from 'components/common/VnInput.vue';
|
import VnInput from 'components/common/VnInput.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -94,26 +95,7 @@ const onSave = (data, response) => {
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelectWorker v-model="data.workerFk" />
|
||||||
:label="t('Worker')"
|
|
||||||
v-model="data.workerFk"
|
|
||||||
url="Workers/search"
|
|
||||||
sort-by="nickname ASC"
|
|
||||||
option-value="id"
|
|
||||||
option-label="nickname"
|
|
||||||
:input-debounce="0"
|
|
||||||
>
|
|
||||||
<template #option="{ itemProps, opt }">
|
|
||||||
<QItem v-bind="itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
|
||||||
<QItemLabel caption>
|
|
||||||
{{ opt.nickname }}, {{ opt.code }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Vehicle')"
|
:label="t('Vehicle')"
|
||||||
v-model="data.vehicleFk"
|
v-model="data.vehicleFk"
|
||||||
|
|
|
@ -223,10 +223,10 @@ function navigate(id) {
|
||||||
router.push({ path: `/route/${id}` });
|
router.push({ path: `/route/${id}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
const cloneRoutes = () => {
|
const cloneRoutes = async () => {
|
||||||
if (!selectedRows.value.length || !startingDate.value) return;
|
if (!selectedRows.value.length || !startingDate.value) return;
|
||||||
axios.post('Routes/clone', {
|
await axios.post('Routes/clone', {
|
||||||
created: startingDate.value,
|
dated: startingDate.value,
|
||||||
ids: selectedRows.value.map((row) => row?.id),
|
ids: selectedRows.value.map((row) => row?.id),
|
||||||
});
|
});
|
||||||
startingDate.value = null;
|
startingDate.value = null;
|
||||||
|
@ -274,7 +274,6 @@ const openTicketsDialog = (id) => {
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
<p class="text-h6 q-ma-none">{{ t('route.Select the starting date') }}</p>
|
<p class="text-h6 q-ma-none">{{ t('route.Select the starting date') }}</p>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
|
|
||||||
<QCardSection class="q-pt-none">
|
<QCardSection class="q-pt-none">
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('route.Stating date')"
|
:label="t('route.Stating date')"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { onMounted, onUnmounted } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
import CardList from 'components/ui/CardList.vue';
|
import CardList from 'components/ui/CardList.vue';
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
@ -21,7 +21,6 @@ const filter = {
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => (stateStore.rightDrawer = true));
|
onMounted(() => (stateStore.rightDrawer = true));
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
|
||||||
|
|
||||||
function navigate(id) {
|
function navigate(id) {
|
||||||
router.push({ path: `/shelving/${id}` });
|
router.push({ path: `/shelving/${id}` });
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue