feat(client): section unpaid
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
67c53d7611
commit
b8a954caec
|
@ -4,5 +4,5 @@ CREATE TABLE `vn`.`claimConfig` (
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO vn.claimConfig (id, pickupContact)
|
INSERT INTO `vn`.`claimConfig` (id, pickupContact)
|
||||||
VALUES(1, 'Email: cmorenoa@logista.com Telf: 961594250 Extensión: 206');
|
VALUES(1, 'Email: cmorenoa@logista.com Telf: 961594250 Extensión: 206');
|
|
@ -1 +1 @@
|
||||||
ALTER TABLE vn.claim ADD packages smallint(10) unsigned DEFAULT 0 NULL COMMENT 'packages received by the client';
|
ALTER TABLE `vn`.`claim` ADD `packages` smallint(10) unsigned DEFAULT 0 NULL COMMENT 'packages received by the client';
|
|
@ -0,0 +1,10 @@
|
||||||
|
CREATE TABLE `vn`.`clientUnpaid` (
|
||||||
|
`clientFk` int(11) NOT NULL,
|
||||||
|
`dated` date NOT NULL,
|
||||||
|
`amount` double DEFAULT 0,
|
||||||
|
PRIMARY KEY (`clientFk`),
|
||||||
|
CONSTRAINT `clientUnpaid_clientFk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES('ClientUnpaid', '*', '*', 'ALLOW', 'ROLE', 'administrative');
|
|
@ -224,5 +224,6 @@
|
||||||
"The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo",
|
"The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo",
|
||||||
"date in the future": "Fecha en el futuro",
|
"date in the future": "Fecha en el futuro",
|
||||||
"reference duplicated": "Referencia duplicada",
|
"reference duplicated": "Referencia duplicada",
|
||||||
"This ticket is already a refund": "Este ticket ya es un abono"
|
"This ticket is already a refund": "Este ticket ya es un abono",
|
||||||
|
"can't be set": "can't be set"
|
||||||
}
|
}
|
|
@ -44,6 +44,9 @@
|
||||||
"ClientType": {
|
"ClientType": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"ClientUnpaid": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Defaulter": {
|
"Defaulter": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"name": "ClientUnpaid",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "clientUnpaid"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"clientFk": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"dated": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"amount": {
|
||||||
|
"type": "Number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"client": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Client",
|
||||||
|
"foreignKey": "clientFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -46,3 +46,4 @@ import './consumption';
|
||||||
import './consumption-search-panel';
|
import './consumption-search-panel';
|
||||||
import './defaulter';
|
import './defaulter';
|
||||||
import './notification';
|
import './notification';
|
||||||
|
import './unpaid';
|
||||||
|
|
|
@ -32,7 +32,8 @@
|
||||||
{"state": "client.card.creditInsurance.index", "icon": "icon-solunion"},
|
{"state": "client.card.creditInsurance.index", "icon": "icon-solunion"},
|
||||||
{"state": "client.card.contact", "icon": "contact_phone"},
|
{"state": "client.card.contact", "icon": "contact_phone"},
|
||||||
{"state": "client.card.webPayment", "icon": "icon-onlinepayment"},
|
{"state": "client.card.webPayment", "icon": "icon-onlinepayment"},
|
||||||
{"state": "client.card.dms.index", "icon": "cloud_upload"}
|
{"state": "client.card.dms.index", "icon": "cloud_upload"},
|
||||||
|
{"state": "client.card.unpaid", "icon": "contact_support"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -374,6 +375,12 @@
|
||||||
"state": "client.notification",
|
"state": "client.notification",
|
||||||
"component": "vn-client-notification",
|
"component": "vn-client-notification",
|
||||||
"description": "Notifications"
|
"description": "Notifications"
|
||||||
|
}, {
|
||||||
|
"url": "/unpaid",
|
||||||
|
"state": "client.card.unpaid",
|
||||||
|
"component": "vn-client-unpaid",
|
||||||
|
"acl": ["administrative"],
|
||||||
|
"description": "Unpaid"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
<div>
|
||||||
|
<vn-watcher
|
||||||
|
vn-id="watcher"
|
||||||
|
url="ClientUnpaids"
|
||||||
|
data="$ctrl.clientUnpaid"
|
||||||
|
id-value="$ctrl.$params.id"
|
||||||
|
id-field="clientFk"
|
||||||
|
form="form">
|
||||||
|
</vn-watcher>
|
||||||
|
<form
|
||||||
|
name="form"
|
||||||
|
ng-submit="watcher.submit()"
|
||||||
|
class="vn-w-md">
|
||||||
|
<vn-card class="vn-pa-lg">
|
||||||
|
<vn-vertical>
|
||||||
|
<vn-check
|
||||||
|
label="Unpaid client"
|
||||||
|
ng-model="watcher.hasData"
|
||||||
|
on-change="$ctrl.setDefaultDate(watcher.hasData)">
|
||||||
|
</vn-check>
|
||||||
|
</vn-vertical>
|
||||||
|
<vn-horizontal
|
||||||
|
ng-if="watcher.hasData">
|
||||||
|
<vn-date-picker
|
||||||
|
label="Date"
|
||||||
|
ng-model="$ctrl.clientUnpaid.dated"
|
||||||
|
vn-focus>
|
||||||
|
</vn-date-picker>
|
||||||
|
<vn-input-number
|
||||||
|
vn-focus
|
||||||
|
label="Amount"
|
||||||
|
ng-model="$ctrl.clientUnpaid.amount"
|
||||||
|
step="0.01"
|
||||||
|
required>
|
||||||
|
</vn-input-number>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-card>
|
||||||
|
<vn-button-bar>
|
||||||
|
<vn-submit
|
||||||
|
disabled="!watcher.dataChanged()"
|
||||||
|
label="Save">
|
||||||
|
</vn-submit>
|
||||||
|
<vn-button
|
||||||
|
class="cancel"
|
||||||
|
label="Undo changes"
|
||||||
|
disabled="!watcher.dataChanged()"
|
||||||
|
ng-click="watcher.loadOriginalData()">
|
||||||
|
</vn-button>
|
||||||
|
</vn-button-bar>
|
||||||
|
</form>
|
||||||
|
</div>
|
|
@ -0,0 +1,18 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
|
export default class Controller extends Section {
|
||||||
|
constructor($, $element) {
|
||||||
|
super($, $element);
|
||||||
|
}
|
||||||
|
|
||||||
|
setDefaultDate(hasData) {
|
||||||
|
if (hasData && !this.clientUnpaid.dated)
|
||||||
|
this.clientUnpaid.dated = new Date();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnClientUnpaid', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller
|
||||||
|
});
|
|
@ -0,0 +1,39 @@
|
||||||
|
import './index';
|
||||||
|
|
||||||
|
describe('client unpaid', () => {
|
||||||
|
describe('Component vnClientUnpaid', () => {
|
||||||
|
let controller;
|
||||||
|
|
||||||
|
beforeEach(ngModule('client'));
|
||||||
|
|
||||||
|
beforeEach(inject(($componentController, $rootScope) => {
|
||||||
|
const $element = angular.element('<vn-client-unpaid></vn-client-unpaid>');
|
||||||
|
controller = $componentController('vnClientUnpaid', {$element, $scope});
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('setDefaultDate()', () => {
|
||||||
|
it(`should not set today date if has data`, () => {
|
||||||
|
const hasData = true;
|
||||||
|
const yesterday = new Date();
|
||||||
|
yesterday.setDate(yesterday.getDate() - 1);
|
||||||
|
|
||||||
|
controller.clientUnpaid = {
|
||||||
|
dated: yesterday
|
||||||
|
};
|
||||||
|
controller.setDefaultDate(hasData);
|
||||||
|
|
||||||
|
expect(controller.clientUnpaid.dated).toEqual(yesterday);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should set today if not has data`, () => {
|
||||||
|
const hasData = false;
|
||||||
|
const today = new Date();
|
||||||
|
|
||||||
|
controller.clientUnpaid = {};
|
||||||
|
controller.setDefaultDate(hasData);
|
||||||
|
|
||||||
|
expect(controller.clientUnpaid.dated).toEqual(today);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1 @@
|
||||||
|
Unpaid client: Cliente impagado
|
Loading…
Reference in New Issue