Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit has test failures
Details
gitea/salix/dev This commit has test failures
Details
This commit is contained in:
commit
86ef44c90d
|
@ -7,10 +7,10 @@ import './style.scss';
|
|||
/**
|
||||
* Input with option selector.
|
||||
*
|
||||
* @property {String} valueField The data field name that should be shown
|
||||
* @property {String} showFiled The data field name that should be used as value
|
||||
* @property {String} showFiled The data field name that should be shown
|
||||
* @property {String} valueField The data field name that should be used as value
|
||||
* @property {Array} data Static data for the autocomplete
|
||||
* @property {Object} intialData A initial data to avoid the server request used to get the selection
|
||||
* @property {Object} intialData An initial data to avoid the server request used to get the selection
|
||||
* @property {Boolean} multiple Wether to allow multiple selection
|
||||
* @property {Object} selection Current object selected
|
||||
*
|
||||
|
|
|
@ -39,7 +39,7 @@ export default class Watcher extends Component {
|
|||
throw new Error('URL parameter ommitted');
|
||||
}
|
||||
|
||||
$onChanges(changes) {
|
||||
$onChanges() {
|
||||
if (this.data)
|
||||
this.updateOriginalData();
|
||||
}
|
||||
|
@ -222,6 +222,15 @@ export default class Watcher extends Component {
|
|||
this.setPristine();
|
||||
}
|
||||
|
||||
loadOriginalData() {
|
||||
Object.keys(this.data).forEach(key => {
|
||||
delete this.data[key];
|
||||
});
|
||||
|
||||
this.data = Object.assign(this.data, this.orgData);
|
||||
this.setPristine();
|
||||
}
|
||||
|
||||
copyInNewObject(data) {
|
||||
let newCopy = {};
|
||||
if (data && typeof data === 'object') {
|
||||
|
|
|
@ -249,4 +249,14 @@ describe('Component vnWatcher', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe(`loadOriginalData()`, () => {
|
||||
it(`should iterate over the current data object, delete all properties then assign the ones from original data`, () => {
|
||||
controller.data = {name: 'Bruce'};
|
||||
controller.orgData = {name: 'Batman'};
|
||||
controller.loadOriginalData();
|
||||
|
||||
expect(controller.data).toEqual(controller.orgData);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -75,8 +75,7 @@
|
|||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"
|
||||
vn-acl="deliveryBoss">
|
||||
</vn-submit>
|
||||
<vn-submit label="Save" vn-acl="deliveryBoss"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="watcher.dataChanged()" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
|
|
|
@ -59,5 +59,6 @@
|
|||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="$ctrl.$scope.form.$dirty" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
disabled="false"
|
||||
field="$ctrl.client.salesPersonFk"
|
||||
url="/client/api/Clients/activeWorkersWithRole"
|
||||
show-field="nickname"
|
||||
|
@ -53,9 +52,8 @@
|
|||
label="Salesperson"
|
||||
vn-acl="salesAssistant">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
initial-data="$ctrl.client.contactChannel"
|
||||
field="$ctrl.client.contactChannelFk"
|
||||
url="/client/api/ContactChannels"
|
||||
label="Channel">
|
||||
|
@ -64,6 +62,7 @@
|
|||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="watcher.dataChanged()" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -11,4 +11,5 @@ You can save multiple emails: >-
|
|||
Puede guardar varios correos electrónicos encadenándolos mediante comas
|
||||
sin espacios, ejemplo: user@dominio.com, user2@dominio.com siendo el primer
|
||||
correo electrónico el principal
|
||||
Contact: Contacto
|
||||
Contact: Contacto
|
||||
Undo changes: Deshacer cambios
|
|
@ -85,6 +85,7 @@
|
|||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save" vn-acl="salesAssistant"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="watcher.dataChanged()" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -128,8 +128,8 @@
|
|||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save">
|
||||
</vn-submit>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="$ctrl.$.form.$dirty" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
<vn-confirm
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button ng-if="$ctrl.canChangePassword" label="Change password" vn-dialog="change-pass"></vn-button>
|
||||
<vn-button label="Undo changes" ng-if="$ctrl.$.form.$dirty" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
<vn-dialog
|
||||
|
|
|
@ -93,5 +93,6 @@
|
|||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="$ctrl.$scope.form.$dirty" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
|
|
|
@ -42,5 +42,6 @@
|
|||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="watcher.dataChanged()" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -4,6 +4,12 @@
|
|||
data="classes"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.taxes"
|
||||
form="form"
|
||||
save="patch">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.submit()" compact>
|
||||
<vn-card pad-large>
|
||||
<vn-horizontal ng-repeat="tax in $ctrl.taxes track by $index">
|
||||
|
@ -23,5 +29,6 @@
|
|||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="watcher.dataChanged()" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -67,5 +67,6 @@
|
|||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="watcher.dataChanged()" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
|
|
|
@ -72,5 +72,6 @@
|
|||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="watcher.dataChanged()" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
|
|
|
@ -32,5 +32,6 @@
|
|||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="watcher.dataChanged()" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
|
|
|
@ -15,5 +15,6 @@
|
|||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="$ctrl.$scope.form.$dirty" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue