left-menu with collapsable menu #780

This commit is contained in:
joan 2018-11-05 15:06:13 +01:00
parent 5a253af036
commit 25efbac793
17 changed files with 235 additions and 233 deletions

View File

@ -40,9 +40,6 @@
"params": {
"claim": "$ctrl.claim"
},
"menu": {
"icon": "settings"
},
"acl": ["salesPerson"]
},
{
@ -53,9 +50,6 @@
"params": {
"claim": "$ctrl.claim"
},
"menu": {
"icon": "icon-details"
},
"acl": ["salesPerson"]
},
{
@ -66,9 +60,6 @@
"params": {
"claim": "$ctrl.claim"
},
"menu": {
"icon": "icon-traceability"
},
"acl": ["salesAssistant"]
},
{
@ -79,10 +70,13 @@
"params": {
"claim": "$ctrl.claim"
},
"menu": {
"icon": "icon-actions"
},
"acl": ["salesAssistant"]
}
],
"menu": [
{"state": "claim.card.basicData", "icon": "settings"},
{"state": "claim.card.detail", "icon": "icon-details"},
{"state": "claim.card.development", "icon": "icon-traceability"},
{"state": "claim.card.action", "icon": "icon-actions"}
]
}

View File

@ -46,9 +46,6 @@
"description": "Basic data",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "settings"
}
},
{
@ -58,9 +55,6 @@
"description": "Fiscal data",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "account_balance"
}
},
{
@ -70,9 +64,6 @@
"description": "Pay method",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "icon-payment"
}
},
{
@ -88,10 +79,7 @@
"description": "Addresses",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "local_shipping"
}
}
},
{
"url": "/create",
@ -112,10 +100,7 @@
"description": "Web access",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "cloud"
}
}
},
{
"url": "/note",
@ -130,9 +115,6 @@
"description": "Notes",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "insert_drive_file"
}
},
{
@ -154,9 +136,6 @@
"description": "Credits",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "credit_card"
}
},
{
@ -182,9 +161,6 @@
"description": "Greuges",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "work"
}
},
{
@ -201,10 +177,7 @@
"url": "/mandate",
"state": "client.card.mandate",
"component": "vn-client-mandate",
"description": "Mandates",
"menu": {
"icon": "pan_tool"
}
"description": "Mandates"
},
{
"url": "/risk",
@ -219,9 +192,6 @@
"description": "Risk",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "icon-invoices"
}
},
{
@ -246,9 +216,6 @@
"description": "Recoveries",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "icon-recovery"
}
},
{
@ -259,7 +226,7 @@
"params": {
"client": "$ctrl.client"
}
},
},
{
"url": "/credit-insurance",
"abstract": true,
@ -274,11 +241,7 @@
"description": "Credit contracts",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "icon-solunion"
},
"acl": ["creditInsurance"]
}
},
{
"url": "/create",
@ -301,6 +264,7 @@
"state": "client.card.creditInsurance.insurance.index",
"component": "vn-client-credit-insurance-insurance-index",
"description": "Requested credits",
"acl": ["creditInsurance"],
"params": {
"client": "$ctrl.client"
}
@ -321,9 +285,6 @@
"description": "Contacts",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "contact_phone"
}
},
{
@ -339,9 +300,6 @@
"description": "Samples",
"params": {
"client": "$ctrl.client"
},
"menu": {
"icon": "mail"
}
},
{
@ -357,19 +315,37 @@
"url": "/web-payment",
"state": "client.card.webPayment",
"component": "vn-client-web-payment",
"description": "Web Payment",
"menu": {
"icon": ""
}
"description": "Web Payment"
},
{
"url" : "/log",
"state": "client.card.log",
"component": "vn-client-log",
"description": "Log",
"menu": {
"icon": "history"
}
"description": "Log"
}
],
"menu": [
{"state": "client.card.basicData", "icon": "settings"},
{"state": "client.card.fiscalData", "icon": "account_balance"},
{"state": "client.card.billingData", "icon": "icon-payment"},
{"state": "client.card.address.index", "icon": "local_shipping"},
{"state": "client.card.note.index", "icon": "insert_drive_file"},
{"state": "client.card.credit.index", "icon": "credit_card"},
{"state": "client.card.greuge.index", "icon": "work"},
{"state": "client.card.risk.index", "icon": "icon-invoices"},
{"state": "client.card.recovery.index", "icon": "icon-recovery"},
{"state": "client.card.log", "icon": "history"},
{
"description": "Others",
"icon": "more",
"childs": [
{"state": "client.card.webAccess", "icon": "cloud"},
{"state": "client.card.mandate", "icon": "pan_tool"},
{"state": "client.card.creditInsurance.index", "icon": "icon-solunion"},
{"state": "client.card.contact", "icon": "contact_phone"},
{"state": "client.card.sample.index", "icon": "mail"},
{"state": "client.card.webPayment", "icon": ""}
]
}
]
}

View File

@ -22,7 +22,8 @@ Worker: Trabajador
Send: Enviar
Sample: Plantilla
Credit: Crédito
Are you sure you want to delete this expedition?: Está seguro de borrar esta expedición?
Are you sure you want to delete this expedition?: ¿Está seguro de borrar esta expedición?
Others: Otros
# Sections
Clients: Clientes

View File

@ -37,9 +37,6 @@
"params": {
"item": "$ctrl.item"
},
"menu": {
"icon": "settings"
},
"acl": ["buyer"]
},
{
@ -50,9 +47,6 @@
"params": {
"item-tags": "$ctrl.itemTags"
},
"menu": {
"icon": "icon-tags"
},
"acl": ["buyer"]
},
{
@ -60,9 +54,6 @@
"state": "item.card.tax",
"component": "vn-item-tax",
"description": "Tax",
"menu": {
"icon": "icon-tax"
},
"acl": ["administrative","buyer"]
},
{
@ -72,9 +63,6 @@
"description": "History",
"params": {
"item": "$ctrl.item"
},
"menu": {
"icon": "history"
}
},
{
@ -85,9 +73,6 @@
"params": {
"item": "$ctrl.item"
},
"menu": {
"icon": "place"
},
"acl": ["buyer","replenisher"]
},
{
@ -98,9 +83,6 @@
"params": {
"item": "$ctrl.item"
},
"menu": {
"icon": "local_florist"
},
"acl": ["buyer"]
},
{
@ -111,9 +93,6 @@
"params": {
"item": "$ctrl.item"
},
"menu": {
"icon": "icon-barcode"
},
"acl": ["buyer","replenisher"]
},
{
@ -133,9 +112,6 @@
"params": {
"item": "$ctrl.item"
},
"menu": {
"icon": "icon-transaction"
},
"acl": ["employee"]
},
{
@ -146,10 +122,18 @@
"params": {
"item": "$ctrl.item"
},
"menu": {
"icon": "icon-regentry"
},
"acl": ["employee"]
}
],
"menu": [
{"state": "item.card.data", "icon": "settings"},
{"state": "item.card.tags", "icon": "icon-tags"},
{"state": "item.card.tax", "icon": "icon-tax"},
{"state": "item.card.history", "icon": "history"},
{"state": "item.card.niche", "icon": "place"},
{"state": "item.card.botanical", "icon": "local_florist"},
{"state": "item.card.itemBarcode", "icon": "icon-barcode"},
{"state": "item.card.diary", "icon": "icon-transaction"},
{"state": "item.card.last-entries", "icon": "icon-regentry"}
]
}

View File

@ -39,9 +39,6 @@
"description": "Catalog",
"params": {
"order": "$ctrl.order"
},
"menu": {
"icon": "shopping_cart"
}
},
{
@ -51,9 +48,6 @@
"description": "Volume",
"params": {
"order": "$ctrl.order"
},
"menu": {
"icon": "icon-volume"
}
},
{
@ -63,9 +57,6 @@
"description": "Lines",
"params": {
"order": "$ctrl.order"
},
"menu": {
"icon": "icon-lines"
}
},
{
@ -74,5 +65,10 @@
"component": "vn-order-create",
"description": "New order"
}
],
"menu": [
{"state": "order.card.catalog", "icon": "shopping_cart"},
{"state": "order.card.volume", "icon": "icon-volume"},
{"state": "order.card.line", "icon": "icon-lines"}
]
}

View File

@ -2,6 +2,5 @@ import './app/app';
import './home/home';
import './main-menu/main-menu';
import './left-menu/left-menu';
import './left-menu/menu-item';
import './topbar/topbar';
import './user-configuration-popover'

View File

@ -1,9 +1,25 @@
<vn-card ng-if="$ctrl.items.length > 0">
<vn-vertical pad-medium-top pad-medium-bottom>
<vn-horizontal>
<ul style="list-style-type: none; margin: 0; padding: 0; width: 100%;">
<vn-menu-item ng-repeat="item in ::$ctrl.items" item="::item"></vn-menu-item>
</ul>
</vn-horizontal>
</vn-vertical>
<vn-card ng-if="::$ctrl.items.length > 0">
<vn-vertical pad-medium-top pad-medium-bottom>
<vn-horizontal>
<ul>
<li ng-repeat="item in ::$ctrl.items" name="{{::item.description}}">
<a ui-sref="{{::item.state}}" ng-class="{active: item.childs.length == 0 && item.active, expanded: item.active, collapsed: !item.active}"
ng-click="$ctrl.setActive(item)">
<vn-icon icon="{{::item.icon}}" ng-if="::item.icon"></vn-icon>
<vn-icon icon="keyboard_arrow_down" ng-if="::item.childs.length > 0"></vn-icon>
<span translate>{{::item.description}}</span>
</a>
<ul ng-if="item.childs.length > 0 && item.active">
<li ng-repeat="child in ::item.childs">
<a ui-sref="{{::child.state}}" ng-class="{active: child.active}">
<vn-icon icon="{{::child.icon}}"></vn-icon>
<span translate>{{::child.description}}</span>
</a>
</li>
</ul>
</li>
</ul>
</vn-horizontal>
</vn-vertical>
</vn-card>

View File

@ -2,23 +2,46 @@ import ngModule from '../../module';
import './style.scss';
export default class LeftMenu {
constructor(aclService, $state, $transitions) {
this.aclService = aclService;
constructor($state, $transitions) {
this.$state = $state;
this.deregisterCallback = $transitions.onSuccess({},
transition => this.activateItem());
this._depth = 3;
let states = this.$state.router.stateRegistry.states;
let moduleIndex = this.$state.current.data.moduleIndex;
let moduleFile = window.routes[moduleIndex] || [];
let menu = moduleFile.menu;
let items = [];
let routes = this.$state.current.data.routes || [];
routes.forEach(i => {
if (i.menu && this.aclService.routeHasPermission(i))
items.push({
description: i.description,
icon: i.menu.icon,
href: i.state
});
});
for (let item of menu) {
let route = states[item.state];
let newItem = {
icon: item.icon,
childs: []
};
if (item.state && !route) continue;
if (item.state) {
newItem.description = route.self.description;
newItem.state = item.state;
} else {
for (let child of item.childs) {
let route = states[child.state];
if(!route) continue;
newItem.description = item.description;
newItem.childs.push({
description: route.self.description,
icon: child.icon,
state: child.state
});
};
}
items.push(newItem);
}
this.items = items;
this.activateItem();
@ -40,16 +63,30 @@ export default class LeftMenu {
.join('.');
let re = new RegExp(`^${myState}(\\..*)?$`);
if (this.items)
for (let item of this.items)
item.active = re.test(item.href);
if (this.items) {
// Check items matching current path
for (let item of this.items) {
item.active = re.test(item.state);
for (let child of item.childs) {
child.active = re.test(child.state);
if (child.active)
item.active = child.active;
}
}
}
}
setActive(item) {
if (item.state) return;
item.active = !item.active;
}
$onDestroy() {
this.deregisterCallback();
}
}
LeftMenu.$inject = ['aclService', '$state', '$transitions'];
LeftMenu.$inject = ['$state', '$transitions'];
ngModule.component('vnLeftMenu', {
template: require('./left-menu.html'),

View File

@ -1,31 +1,25 @@
import './left-menu.js';
describe('Component vnLeftMenu', () => {
let $scope;
let $state;
let $httpBackend;
let controller;
let aclService;
let $window;
beforeEach(() => {
angular.mock.module('salix');
});
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _aclService_, _$state_, _$httpBackend_) => {
$scope = $rootScope.$new();
beforeEach(angular.mock.inject((_$componentController_, _$state_, _$window_) => {
$state = _$state_;
$state.current.data = {
routes: []
};
$state.current.name = 'client.card.summary';
aclService = _aclService_;
$httpBackend = _$httpBackend_;
$httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
controller = _$componentController_('vnLeftMenu', {$scope: $scope, $state: $state, aclService: aclService});
$state.current.data = {moduleIndex: 0};
$window = _$window_;
$window.routes = [{menu: []}];
controller = _$componentController_('vnLeftMenu', {$state, $window});
controller.items = [
{description: 'Client', href: 'client', icon: null},
{description: 'Client', href: 'client.card', icon: null},
{description: 'Client summary', href: 'client.card.summary', icon: 'myicon'}
{description: 'Client', state: 'client', icon: null, childs: []},
{description: 'Client', state: 'client.card', icon: null, childs: []},
{description: 'Client summary', state: 'client.card.summary', icon: 'myicon', childs: []}
];
}));

View File

@ -1,9 +0,0 @@
<li ng-class="{active: $ctrl.item.active}">
<a ui-sref="{{::$ctrl.item.href}}"
class="vn-clickable"
style="display: block; text-decoration: none; padding: .5em 2em;">
<vn-icon icon="keyboard_arrow_right" class="material-icons" style="float: right; margin-left: .4em;"></vn-icon>
<vn-icon icon="{{::$ctrl.item.icon}}" class="material-icons" style="vertical-align: middle; margin-right: .4em;"></vn-icon>
<span translate>{{::$ctrl.item.description}}</span>
</a>
</li>

View File

@ -1,8 +0,0 @@
import ngModule from '../../module';
ngModule.component('vnMenuItem', {
template: require('./menu-item.html'),
bindings: {
item: '<'
}
});

View File

@ -1,12 +1,53 @@
@import "effects";
vn-menu-item {
& > li {
@extend %clickable;
vn-left-menu {
ul {
margin: 0;
padding: 0;
width: 100%;
&.active {
& > li {
list-style: none;
display: block;
& > ul > li > a {
padding-left: 2em
}
}
& > li > a {
@extend %clickable;
padding: .5em 1em;
display: block;
& > vn-icon:nth-child(1) {
vertical-align: middle;
margin-right: .4em
}
& > vn-icon:nth-child(2) {
float: right;
margin-left: .4em
}
}
& > li > a.active {
background-color: $main-header;
color: white;
}
& > li > a.expanded {
& > vn-icon[icon="keyboard_arrow_down"] {
transition: all 0.2s;
transform: rotate(180deg);
}
}
& > li > a.collapsed {
& > vn-icon[icon="keyboard_arrow_down"] {
transition: all 0.2s;
transform: rotate(0deg);
}
}
}
}

View File

@ -45,6 +45,7 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider, modulesF
let moduleName = window.routes[file].module;
let validations = window.routes[file].validations || false;
let mainModule = modulesFactory.$get().getMainRoute(fileRoutes);
if (mainModule) {
let count = fileRoutes.length;
for (let i = 0; i < count; i++) {
@ -59,7 +60,7 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider, modulesF
loader: loader(moduleName, validations)
},
data: {
routes: fileRoutes
moduleIndex: file
}
};
if (route.abstract)

View File

@ -48,9 +48,6 @@
"description": "Basic data",
"params": {
"ticket": "$ctrl.data"
},
"menu": {
"icon": "settings"
}
},
{
@ -78,9 +75,6 @@
"description": "Sale",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"icon": "icon-lines"
}
},
{
@ -90,9 +84,6 @@
"description": "Notes",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"icon": "insert_drive_file"
}
},
{
@ -102,9 +93,6 @@
"description": "Volume",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"icon": "icon-volume"
}
},
{
@ -114,9 +102,6 @@
"description": "Expedition",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"icon": "icon-volum"
}
},
{
@ -132,9 +117,6 @@
"description": "Packages",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"icon": "icon-bucket"
}
},
{
@ -150,9 +132,6 @@
"description": "Tracking",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"icon": "remove_red_eye"
}
},
{
@ -172,9 +151,6 @@
"description": "Sale checked",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"icon": "assignment"
}
},
{
@ -184,9 +160,6 @@
"description": "Components",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"icon": "icon-components"
}
},
{
@ -196,9 +169,6 @@
"description": "Sale tracking",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"icon": "assignment"
}
},
{
@ -208,28 +178,34 @@
"description": "Pictures",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"icon": "image"
}
},
{
"url" : "/log",
"state": "ticket.card.log",
"component": "vn-ticket-log",
"description": "Log",
"menu": {
"icon": "history"
}
"description": "Log"
},
{
"url" : "/weekly",
"state": "ticket.weekly",
"component": "vn-ticket-weekly",
"description": "Weekly",
"menu": {
"icon": "history"
}
"description": "Weekly"
}
],
"menu": [
{"state": "ticket.card.data.stepOne", "icon": "settings"},
{"state": "ticket.card.sale", "icon": "icon-lines"},
{"state": "ticket.card.observation", "icon": "insert_drive_file"},
{"state": "ticket.card.volume", "icon": "icon-volume"},
{"state": "ticket.card.expedition", "icon": "icon-volum"},
{"state": "ticket.card.package.index", "icon": "icon-bucket"},
{"state": "ticket.card.tracking.index", "icon": "remove_red_eye"},
{"state": "ticket.card.saleChecked", "icon": "assignment"},
{"state": "ticket.card.components", "icon": "icon-components"},
{"state": "ticket.card.saleTracking", "icon": "assignment"},
{"state": "ticket.card.picture", "icon": "image"},
{"state": "ticket.card.log", "icon": "history"},
{"state": "ticket.weekly", "icon": "history"}
]
}

View File

@ -18,7 +18,8 @@ export default {
searchClientInput: `${components.vnTextfield}`,
searchButton: `vn-searchbar vn-icon[icon="search"]`,
searchResult: `vn-item-client a`,
createClientButton: `${components.vnFloatButton}`
createClientButton: `${components.vnFloatButton}`,
othersButton: `vn-left-menu li[name="Others"] > a`
},
createClientView: {
name: `${components.vnTextfield}[name="name"]`,
@ -32,7 +33,7 @@ export default {
cancelButton: `vn-button[href="#!/client/index"]`
},
clientBasicData: {
basicDataButton: `vn-menu-item a[ui-sref="client.card.basicData"]`,
basicDataButton: `vn-left-menu a[ui-sref="client.card.basicData"]`,
nameInput: `${components.vnTextfield}[name="name"]`,
contactInput: `${components.vnTextfield}[name="contact"]`,
phoneInput: `${components.vnTextfield}[name="phone"]`,
@ -47,7 +48,7 @@ export default {
saveButton: `${components.vnSubmit}`
},
clientFiscalData: {
fiscalDataButton: `vn-menu-item a[ui-sref="client.card.fiscalData"]`,
fiscalDataButton: `vn-left-menu a[ui-sref="client.card.fiscalData"]`,
socialNameInput: `${components.vnTextfield}[name="socialName"]`,
fiscalIdInput: `${components.vnTextfield}[name="fi"]`,
equalizationTaxCheckboxLabel: `vn-check[label='Is equalizated'] > label > input`,
@ -74,7 +75,7 @@ export default {
saveButton: `${components.vnSubmit}`
},
clientPayMethod: {
payMethodButton: `vn-menu-item a[ui-sref="client.card.billingData"]`,
payMethodButton: `vn-left-menu a[ui-sref="client.card.billingData"]`,
payMethodInput: `vn-autocomplete[field="$ctrl.client.payMethodFk"] input`,
payMethodIBANOption: `vn-autocomplete[field="$ctrl.client.payMethodFk"] vn-drop-down ul > li:nth-child(5)`,
payMethodOptionOne: `vn-autocomplete[field="$ctrl.client.payMethodFk"] vn-drop-down ul > li:nth-child(2)`,
@ -91,7 +92,7 @@ export default {
saveButton: `${components.vnSubmit}`
},
clientAddresses: {
addressesButton: `vn-menu-item a[ui-sref="client.card.address.index"]`,
addressesButton: `vn-left-menu a[ui-sref="client.card.address.index"]`,
createAddress: `vn-client-address-index ${components.vnFloatButton}`,
defaultCheckboxInput: `vn-check[label='Default'] > label > input`,
consigneeInput: `${components.vnTextfield}[name="nickname"]`,
@ -124,27 +125,27 @@ export default {
cancelButton: `button[ui-sref="client.card.address.index"]`
},
clientWebAccess: {
webAccessButton: `vn-menu-item a[ui-sref="client.card.webAccess"]`,
webAccessButton: `vn-left-menu a[ui-sref="client.card.webAccess"]`,
enableWebAccessCheckbox: `vn-check[label='Enable web access'] > label > input`,
userNameInput: `${components.vnTextfield}[name="name"]`,
saveButton: `${components.vnSubmit}`
},
clientNotes: {
notesButton: `vn-menu-item a[ui-sref="client.card.note.index"]`,
notesButton: `vn-left-menu a[ui-sref="client.card.note.index"]`,
addNoteFloatButton: `${components.vnFloatButton}`,
noteInput: `vn-textarea[label="Note"]`,
saveButton: `${components.vnSubmit}`,
firstNoteText: 'vn-client-note .text'
},
clientCredit: {
creditButton: `vn-menu-item a[ui-sref="client.card.credit.index"]`,
creditButton: `vn-left-menu a[ui-sref="client.card.credit.index"]`,
addCreditFloatButton: `${components.vnFloatButton}`,
creditInput: `${components.vnTextfield}[name="credit"]`,
saveButton: `${components.vnSubmit}`,
firstCreditText: 'vn-client-credit-index vn-card > div vn-table vn-tbody > vn-tr'
},
clientGreuge: {
greugeButton: `vn-menu-item a[ui-sref="client.card.greuge.index"]`,
greugeButton: `vn-left-menu a[ui-sref="client.card.greuge.index"]`,
addGreugeFloatButton: `${components.vnFloatButton}`,
amountInput: `${components.vnTextfield}[name="amount"]`,
descriptionInput: `${components.vnTextfield}[name="description"]`,
@ -154,15 +155,15 @@ export default {
firstGreugeText: 'vn-client-greuge-index vn-card > div vn-table vn-tbody > vn-tr'
},
clientMandate: {
mandateButton: `vn-menu-item a[ui-sref="client.card.mandate"]`,
mandateButton: `vn-left-menu a[ui-sref="client.card.mandate"]`,
firstMandateText: 'vn-client-mandate vn-card > div vn-table vn-tbody > vn-tr'
},
clientInvoices: {
invoicesButton: `vn-menu-item a[ui-sref="client.card.invoice"]`,
invoicesButton: `vn-left-menu a[ui-sref="client.card.invoice"]`,
firstInvoiceText: 'vn-client-invoice vn-card > div vn-table vn-tbody > vn-tr'
},
clientLog: {
logButton: `vn-menu-item a[ui-sref="client.card.log"]`,
logButton: `vn-left-menu a[ui-sref="client.card.log"]`,
lastModificationPreviousValue: 'vn-client-log vn-table vn-td.before',
lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after'
@ -191,7 +192,7 @@ export default {
},
itemBasicData: {
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
basicDataButton: `vn-menu-item a[ui-sref="item.card.data"]`,
basicDataButton: `vn-left-menu a[ui-sref="item.card.data"]`,
typeSelect: `vn-autocomplete[field="$ctrl.item.typeFk"] input`,
typeSelectOptionThree: `vn-autocomplete[field="$ctrl.item.typeFk"] vn-drop-down ul > li:nth-child(3)`,
intrastatSelect: `vn-autocomplete[field="$ctrl.item.intrastatFk"] input`,
@ -208,7 +209,7 @@ export default {
},
itemTags: {
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
tagsButton: `vn-menu-item a[ui-sref="item.card.tags"]`,
tagsButton: `vn-left-menu a[ui-sref="item.card.tags"]`,
firstRemoveTagButton: `vn-item-tags vn-horizontal:nth-child(2) vn-icon-button[icon="remove_circle_outline"]`,
firstTagSelect: `vn-item-tags vn-horizontal:nth-child(2) > vn-autocomplete[field="itemTag.tagFk"] input`,
firstTagSelectOptionOne: `vn-item-tags vn-horizontal:nth-child(2) > vn-autocomplete[field="itemTag.tagFk"] vn-drop-down ul > li:nth-child(1)`,
@ -237,7 +238,7 @@ export default {
submitItemTagsButton: `${components.vnSubmit}`
},
itemTax: {
taxButton: `vn-menu-item a[ui-sref="item.card.tax"]`,
taxButton: `vn-left-menu a[ui-sref="item.card.tax"]`,
firstClassSelect: `vn-horizontal:nth-child(2) > vn-autocomplete[field="tax.taxClassFk"] input`,
firstClassSelectOptionTwo: `vn-horizontal:nth-child(2) > vn-autocomplete vn-drop-down ul > li:nth-child(2)`,
secondClassSelect: `vn-horizontal:nth-child(3) > vn-autocomplete[field="tax.taxClassFk"] input`,
@ -247,14 +248,14 @@ export default {
submitTaxButton: `${components.vnSubmit}`
},
itemBarcodes: {
barcodeButton: `vn-menu-item a[ui-sref="item.card.itemBarcode"]`,
barcodeButton: `vn-left-menu a[ui-sref="item.card.itemBarcode"]`,
addBarcodeButton: `vn-icon[icon="add_circle"]`,
thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(4) > ${components.vnTextfield}`,
submitBarcodesButton: `${components.vnSubmit}`,
firstCodeRemoveButton: `vn-item-barcode vn-horizontal vn-none vn-icon[icon="remove_circle_outline"]`
},
itemNiches: {
nicheButton: `vn-menu-item a[ui-sref="item.card.niche"]`,
nicheButton: `vn-left-menu a[ui-sref="item.card.niche"]`,
addNicheButton: `vn-icon[icon="add_circle"]`,
firstWarehouseSelect: `vn-autocomplete[field="niche.warehouseFk"] input`,
firstWarehouseSelectSecondOption: `vn-autocomplete[field="niche.warehouseFk"] vn-drop-down ul > li:nth-child(2)`,
@ -268,7 +269,7 @@ export default {
submitNichesButton: `${components.vnSubmit}`
},
itemBotanical: {
botanicalButton: `vn-menu-item a[ui-sref="item.card.botanical"]`,
botanicalButton: `vn-left-menu a[ui-sref="item.card.botanical"]`,
botanicalInput: `vn-horizontal:nth-child(2) > ${components.vnTextfield}`,
genusSelect: `vn-autocomplete[field="$ctrl.botanical.genusFk"] input`,
genusSelectOptionOne: `vn-autocomplete[field="$ctrl.botanical.genusFk"] vn-drop-down ul > li:nth-child(1)`,
@ -294,7 +295,7 @@ export default {
searchButton: `vn-ticket-index vn-searchbar vn-icon[icon="search"]`
},
ticketNotes: {
notesButton: `vn-menu-item a[ui-sref="ticket.card.observation"]`,
notesButton: `vn-left-menu a[ui-sref="ticket.card.observation"]`,
firstNoteRemoveButton: `vn-icon[icon="remove_circle_outline"]`,
addNoteButton: `vn-icon[icon="add_circle"]`,
firstNoteSelect: `vn-autocomplete[field="observation.observationTypeFk"] input`,
@ -303,13 +304,13 @@ export default {
submitNotesButton: `${components.vnSubmit}`
},
ticketExpedition: {
expeditionButton: `vn-menu-item a[ui-sref="ticket.card.expedition"]`,
expeditionButton: `vn-left-menu a[ui-sref="ticket.card.expedition"]`,
secondExpeditionRemoveButton: `vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]`,
acceptDeleteRowButton: `vn-ticket-expedition > vn-confirm[vn-id="delete-expedition"] button[response=ACCEPT]`,
expeditionRow: `vn-ticket-expedition vn-table vn-tbody > vn-tr`
},
ticketPackages: {
packagesButton: `vn-menu-item a[ui-sref="ticket.card.package.index"]`,
packagesButton: `vn-left-menu a[ui-sref="ticket.card.package.index"]`,
firstPackageSelect: `vn-autocomplete[label="Package"] > div > div > input`,
firstPackageSelectOptionTwo: `vn-autocomplete[label="Package"] vn-drop-down ul > li:nth-child(2)`,
firstQuantityInput: `vn-textfield[label="Quantity"] input`,
@ -322,7 +323,7 @@ export default {
saleLine: `vn-table div > vn-tbody > vn-tr`,
saleDescriptorPopover: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover',
saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[href="#!/item/1/summary"]',
saleButton: `vn-menu-item a[ui-sref="ticket.card.sale"]`,
saleButton: `vn-left-menu a[ui-sref="ticket.card.sale"]`,
descriptorItemDiaryButton: `vn-item-descriptor > vn-card > div > vn-horizontal.quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`,
firstSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(1)`,
firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(3) > img',
@ -375,7 +376,7 @@ export default {
saveButton: `${components.vnSubmit}`
},
ticketBasicData: {
basicDataButton: `vn-menu-item a[ui-sref="ticket.card.data.stepOne"]`,
basicDataButton: `vn-left-menu a[ui-sref="ticket.card.data.stepOne"]`,
clientSelect: `vn-autocomplete[field="$ctrl.clientFk"] input`,
clientSelectThirdOption: `vn-autocomplete[field="$ctrl.clientFk"] vn-drop-down ul > li:nth-child(3)`,
addressSelect: `vn-autocomplete[field="$ctrl.ticket.addressFk"] input`,
@ -390,7 +391,7 @@ export default {
chargesReasonFirstOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(1)`
},
ticketComponents: {
componentsButton: `vn-menu-item a[ui-sref="ticket.card.components"]`,
componentsButton: `vn-left-menu a[ui-sref="ticket.card.components"]`,
base: 'vn-ticket-components tfoot > tr:nth-child(1) > td',
margin: 'vn-ticket-components tfoot > tr:nth-child(2) > td',
total: 'vn-ticket-components tfoot > tr:nth-child(3) > td'
@ -407,7 +408,7 @@ export default {
searchButton: `vn-claim-index vn-searchbar vn-icon[icon="search"]`
},
claimBasicData: {
basicDataButton: `vn-menu-item a[ui-sref="claim.card.basicData"]`,
basicDataButton: `vn-left-menu a[ui-sref="claim.card.basicData"]`,
claimStateSelect: `vn-autocomplete[field="$ctrl.claim.claimStateFk"] input`,
claimStateSelectThirdOption: `vn-autocomplete[field="$ctrl.claim.claimStateFk"] vn-drop-down ul > li:nth-child(3)`,
claimStateSelectFourthOption: `vn-autocomplete[field="$ctrl.claim.claimStateFk"] vn-drop-down ul > li:nth-child(4)`,
@ -417,7 +418,7 @@ export default {
saveButton: `${components.vnSubmit}`
},
claimDetails: {
detailsButton: `vn-menu-item a[ui-sref="claim.card.detail"]`,
detailsButton: `vn-left-menu a[ui-sref="claim.card.detail"]`,
addItemButton: `vn-claim-detail a vn-float-button`
},
};

View File

@ -36,6 +36,7 @@ describe('Client', () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.othersButton)
.waitToClick(selectors.clientWebAccess.webAccessButton)
.waitForURL('web-access')
.url();
@ -58,6 +59,7 @@ describe('Client', () => {
const result = await nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientsIndex.othersButton)
.waitToClick(selectors.clientWebAccess.webAccessButton)
.wait(selectors.clientWebAccess.enableWebAccessCheckbox)
.evaluate((selector) => {

View File

@ -36,6 +36,7 @@ describe('Client', () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.othersButton)
.waitToClick(selectors.clientMandate.mandateButton)
.waitForURL('mandate')
.url();