Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 3752-claim_action
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
4a6873a0fd
|
@ -23,7 +23,13 @@ module.exports = Self => {
|
|||
let models = Self.app.models;
|
||||
|
||||
let user = await models.Account.findById(userId, {
|
||||
fields: ['id', 'name', 'nickname', 'email']
|
||||
fields: ['id', 'name', 'nickname', 'email', 'lang'],
|
||||
include: {
|
||||
relation: 'userConfig',
|
||||
scope: {
|
||||
fields: ['darkMode']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let roles = await models.RoleMapping.find({
|
||||
|
|
|
@ -71,6 +71,11 @@
|
|||
"type": "hasOne",
|
||||
"model": "Worker",
|
||||
"foreignKey": "userFk"
|
||||
},
|
||||
"userConfig": {
|
||||
"type": "hasOne",
|
||||
"model": "UserConfig",
|
||||
"foreignKey": "userFk"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
|
|
|
@ -9,20 +9,23 @@
|
|||
"properties": {
|
||||
"userFk": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
},
|
||||
"warehouseFk": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"companyFk": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"created": {
|
||||
"type": "Date"
|
||||
"type": "date"
|
||||
},
|
||||
"updated": {
|
||||
"type": "Date"
|
||||
"type": "date"
|
||||
},
|
||||
"darkMode": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -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');
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE `vn`.`userConfig` ADD darkMode tinyint(1) DEFAULT 1 NOT NULL COMMENT 'Salix interface dark mode';
|
|
@ -0,0 +1,6 @@
|
|||
UPDATE `salix`.`ACL`
|
||||
SET `property`='refund'
|
||||
WHERE `model`='Sale' AND `property`='payBack';
|
||||
|
||||
INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES('Sale', 'refundAll', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,113 @@
|
|||
DROP PROCEDURE IF EXISTS vn.ticket_doRefund;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_doRefund`(IN vOriginTicket INT, OUT vNewTicket INT)
|
||||
BEGIN
|
||||
|
||||
DECLARE vDone BIT DEFAULT 0;
|
||||
DECLARE vCustomer MEDIUMINT;
|
||||
DECLARE vWarehouse TINYINT;
|
||||
DECLARE vCompany MEDIUMINT;
|
||||
DECLARE vAddress MEDIUMINT;
|
||||
DECLARE vRefundAgencyMode INT;
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vQuantity DECIMAL (10,2);
|
||||
DECLARE vConcept VARCHAR(50);
|
||||
DECLARE vPrice DECIMAL (10,2);
|
||||
DECLARE vDiscount TINYINT;
|
||||
DECLARE vSaleNew INT;
|
||||
DECLARE vSaleMain INT;
|
||||
DECLARE vZoneFk INT;
|
||||
DECLARE vDescription VARCHAR(50);
|
||||
DECLARE vTaxClassFk INT;
|
||||
DECLARE vTicketServiceTypeFk INT;
|
||||
|
||||
DECLARE cSales CURSOR FOR
|
||||
SELECT *
|
||||
FROM tmp.sale;
|
||||
|
||||
DECLARE cTicketServices CURSOR FOR
|
||||
SELECT *
|
||||
FROM tmp.ticketService;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1;
|
||||
|
||||
SELECT id INTO vRefundAgencyMode
|
||||
FROM agencyMode WHERE `name` = 'ABONO';
|
||||
|
||||
SELECT clientFk, warehouseFk, companyFk, addressFk
|
||||
INTO vCustomer, vWarehouse, vCompany, vAddress
|
||||
FROM ticket
|
||||
WHERE id = vOriginTicket;
|
||||
|
||||
SELECT id INTO vZoneFk
|
||||
FROM zone WHERE agencyModeFk = vRefundAgencyMode
|
||||
LIMIT 1;
|
||||
|
||||
INSERT INTO vn.ticket (
|
||||
clientFk,
|
||||
shipped,
|
||||
addressFk,
|
||||
agencyModeFk,
|
||||
nickname,
|
||||
warehouseFk,
|
||||
companyFk,
|
||||
landed,
|
||||
zoneFk
|
||||
)
|
||||
SELECT
|
||||
vCustomer,
|
||||
CURDATE(),
|
||||
vAddress,
|
||||
vRefundAgencyMode,
|
||||
a.nickname,
|
||||
vWarehouse,
|
||||
vCompany,
|
||||
CURDATE(),
|
||||
vZoneFk
|
||||
FROM address a
|
||||
WHERE a.id = vAddress;
|
||||
|
||||
SET vNewTicket = LAST_INSERT_ID();
|
||||
|
||||
SET vDone := 0;
|
||||
OPEN cSales;
|
||||
FETCH cSales INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount;
|
||||
|
||||
WHILE NOT vDone DO
|
||||
|
||||
INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount)
|
||||
VALUES( vNewTicket, vItemFk, vQuantity, vConcept, vPrice, vDiscount );
|
||||
|
||||
SET vSaleNew = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO vn.saleComponent(saleFk,componentFk,`value`)
|
||||
SELECT vSaleNew,componentFk,`value`
|
||||
FROM vn.saleComponent
|
||||
WHERE saleFk = vSaleMain;
|
||||
|
||||
FETCH cSales INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount;
|
||||
|
||||
END WHILE;
|
||||
CLOSE cSales;
|
||||
|
||||
SET vDone := 0;
|
||||
OPEN cTicketServices;
|
||||
FETCH cTicketServices INTO vDescription, vQuantity, vPrice, vTaxClassFk, vTicketServiceTypeFk;
|
||||
|
||||
WHILE NOT vDone DO
|
||||
|
||||
INSERT INTO vn.ticketService(description, quantity, price, taxClassFk, ticketFk, ticketServiceTypeFk)
|
||||
VALUES(vDescription, vQuantity, vPrice, vTaxClassFk, vNewTicket, vTicketServiceTypeFk);
|
||||
|
||||
FETCH cTicketServices INTO vDescription, vQuantity, vPrice, vTaxClassFk, vTicketServiceTypeFk;
|
||||
|
||||
END WHILE;
|
||||
CLOSE cTicketServices;
|
||||
|
||||
INSERT INTO vn.ticketRefund(refundTicketFk, originalTicketFk)
|
||||
VALUES(vNewTicket, vOriginTicket);
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -181,12 +181,12 @@ let actions = {
|
|||
},
|
||||
|
||||
reloadSection: async function(state) {
|
||||
await this.click('vn-icon[icon="preview"]');
|
||||
await this.click('vn-icon[icon="launch"]');
|
||||
await this.accessToSection(state);
|
||||
},
|
||||
|
||||
forceReloadSection: async function(sectionRoute) {
|
||||
await this.waitToClick('vn-icon[icon="preview"]');
|
||||
await this.waitToClick('vn-icon[icon="launch"]');
|
||||
await this.waitToClick('button[response="accept"]');
|
||||
await this.waitForSelector('vn-card.summary');
|
||||
await this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
|
|
|
@ -321,6 +321,12 @@ export default {
|
|||
deleteFirstPhone: 'vn-client-contact vn-icon[icon="delete"]',
|
||||
saveButton: 'button[type=submit]'
|
||||
},
|
||||
clientUnpaid: {
|
||||
hasDataCheckBox: 'vn-client-unpaid vn-check[ng-model="watcher.hasData"]',
|
||||
dated: 'vn-client-unpaid vn-date-picker[ng-model="$ctrl.clientUnpaid.dated"]',
|
||||
amount: 'vn-client-unpaid vn-input-number[ng-model="$ctrl.clientUnpaid.amount"]',
|
||||
saveButton: 'vn-submit[label="Save"]'
|
||||
},
|
||||
itemsIndex: {
|
||||
createItemButton: `vn-float-button`,
|
||||
firstSearchResult: 'vn-item-index tbody tr:nth-child(1)',
|
||||
|
@ -570,7 +576,7 @@ export default {
|
|||
moreMenuUnmarkReseved: 'vn-item[name="unreserve"]',
|
||||
moreMenuUpdateDiscount: 'vn-item[name="discount"]',
|
||||
moreMenuRecalculatePrice: 'vn-item[name="calculatePrice"]',
|
||||
moreMenuPayBack: 'vn-item[name="payBack"]',
|
||||
moreMenuRefund: 'vn-item[name="refund"]',
|
||||
moreMenuUpdateDiscountInput: 'vn-input-number[ng-model="$ctrl.edit.discount"] input',
|
||||
transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text',
|
||||
transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable',
|
||||
|
@ -958,7 +964,7 @@ export default {
|
|||
supplierRef: 'vn-invoice-in-summary vn-label-value:nth-child(2) > section > span'
|
||||
},
|
||||
invoiceInDescriptor: {
|
||||
summaryIcon: 'vn-invoice-in-descriptor a[title="Preview"]',
|
||||
summaryIcon: 'vn-invoice-in-descriptor a[title="Go to module summary"]',
|
||||
moreMenu: 'vn-invoice-in-descriptor vn-icon-button[icon=more_vert]',
|
||||
moreMenuDeleteInvoiceIn: '.vn-menu [name="deleteInvoice"]',
|
||||
moreMenuCloneInvoiceIn: '.vn-menu [name="cloneInvoice"]',
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client unpaid path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Charles Xavier');
|
||||
await page.accessToSection('client.card.unpaid');
|
||||
await page.waitForState('client.card.unpaid');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should set cliet unpaid', async() => {
|
||||
await page.waitToClick(selectors.clientUnpaid.hasDataCheckBox);
|
||||
|
||||
await page.pickDate(selectors.clientUnpaid.dated);
|
||||
await page.write(selectors.clientUnpaid.amount, '500');
|
||||
});
|
||||
|
||||
it('should save unpaid', async() => {
|
||||
await page.waitToClick(selectors.clientUnpaid.saveButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the unpaid have been saved', async() => {
|
||||
await page.reloadSection('client.card.unpaid');
|
||||
const result = await page.waitToGetProperty(selectors.clientUnpaid.amount, 'value');
|
||||
|
||||
expect(result).toEqual('500');
|
||||
});
|
||||
});
|
|
@ -213,10 +213,10 @@ describe('Ticket Edit sale path', () => {
|
|||
await page.accessToSection('ticket.card.sale');
|
||||
});
|
||||
|
||||
it('should select the third sale and create a pay back', async() => {
|
||||
it('should select the third sale and create a refund', async() => {
|
||||
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
||||
await page.waitToClick(selectors.ticketSales.moreMenu);
|
||||
await page.waitToClick(selectors.ticketSales.moreMenuPayBack);
|
||||
await page.waitToClick(selectors.ticketSales.moreMenuRefund);
|
||||
await page.waitForState('ticket.card.sale');
|
||||
});
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ describe('Travel descriptor path', () => {
|
|||
});
|
||||
|
||||
it('should navigate to the summary and then clone the travel and its entries using the descriptor menu to get redirected to the cloned travel basic data', async() => {
|
||||
await page.waitToClick('vn-icon[icon="preview"]'); // summary icon
|
||||
await page.waitToClick('vn-icon[icon="launch"]');
|
||||
await page.waitForState('travel.card.summary');
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitToClick(selectors.travelDescriptor.dotMenu);
|
||||
|
|
|
@ -23,10 +23,21 @@
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
|
||||
.icon-agency-term:before {
|
||||
content: "\e950";
|
||||
}
|
||||
.icon-deaulter:before {
|
||||
content: "\e94b";
|
||||
}
|
||||
.icon-100:before {
|
||||
content: "\e95a";
|
||||
}
|
||||
.icon-history:before {
|
||||
content: "\e968";
|
||||
}
|
||||
.icon-Person:before {
|
||||
content: "\e901";
|
||||
}
|
||||
.icon-accessory:before {
|
||||
content: "\e90a";
|
||||
}
|
||||
|
@ -74,6 +85,7 @@
|
|||
}
|
||||
.icon-bucket:before {
|
||||
content: "\e97a";
|
||||
color: #000;
|
||||
}
|
||||
.icon-buscaman:before {
|
||||
content: "\e93b";
|
||||
|
@ -83,26 +95,32 @@
|
|||
}
|
||||
.icon-calc_volum .path1:before {
|
||||
content: "\e915";
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
.icon-calc_volum .path2:before {
|
||||
content: "\e916";
|
||||
margin-left: -1em;
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
.icon-calc_volum .path3:before {
|
||||
content: "\e917";
|
||||
margin-left: -1em;
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
.icon-calc_volum .path4:before {
|
||||
content: "\e918";
|
||||
margin-left: -1em;
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
.icon-calc_volum .path5:before {
|
||||
content: "\e919";
|
||||
margin-left: -1em;
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
.icon-calc_volum .path6:before {
|
||||
content: "\e91a";
|
||||
margin-left: -1em;
|
||||
color: rgb(255, 255, 255);
|
||||
}
|
||||
.icon-calendar:before {
|
||||
content: "\e93d";
|
||||
|
@ -137,9 +155,6 @@
|
|||
.icon-credit:before {
|
||||
content: "\e927";
|
||||
}
|
||||
.icon-defaulter:before {
|
||||
content: "\e94b";
|
||||
}
|
||||
.icon-deletedTicket:before {
|
||||
content: "\e935";
|
||||
}
|
||||
|
@ -206,9 +221,6 @@
|
|||
.icon-headercol:before {
|
||||
content: "\e958";
|
||||
}
|
||||
.icon-history:before {
|
||||
content: "\e968";
|
||||
}
|
||||
.icon-info:before {
|
||||
content: "\e952";
|
||||
}
|
||||
|
@ -281,9 +293,6 @@
|
|||
.icon-pbx:before {
|
||||
content: "\e93c";
|
||||
}
|
||||
.icon-Person:before {
|
||||
content: "\e901";
|
||||
}
|
||||
.icon-pets:before {
|
||||
content: "\e947";
|
||||
}
|
||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 160 KiB |
Binary file not shown.
Binary file not shown.
|
@ -4,8 +4,14 @@
|
|||
vn-descriptor-content > .descriptor {
|
||||
width: 256px;
|
||||
|
||||
& > .header > a:first-child {
|
||||
visibility: hidden;
|
||||
}
|
||||
& > .header {
|
||||
a:first-child {
|
||||
display: none;
|
||||
}
|
||||
vn-icon-button:nth-child(2) {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,15 @@
|
|||
name="goToModuleIndex">
|
||||
<vn-icon icon="{{$ctrl.moduleMap[$ctrl.module].icon}}"></vn-icon>
|
||||
</a>
|
||||
<vn-icon-button
|
||||
translate-attr="{title: 'Show summary'}"
|
||||
icon="preview"
|
||||
vn-click-stop="$ctrl.summary.show()">
|
||||
</vn-icon-button>
|
||||
<a
|
||||
translate-attr="{title: 'Preview'}"
|
||||
translate-attr="{title: 'Go to module summary'}"
|
||||
ui-sref="{{::$ctrl.summaryState}}({id: $ctrl.descriptor.id})">
|
||||
<vn-icon icon="preview"></vn-icon>
|
||||
<vn-icon icon="launch"></vn-icon>
|
||||
</a>
|
||||
<vn-icon-button ng-if="!$ctrl.$transclude.isSlotFilled('dotMenu')"
|
||||
ng-class="::{invisible: !$ctrl.$transclude.isSlotFilled('menu')}"
|
||||
|
|
|
@ -125,7 +125,8 @@ ngModule.vnComponent('vnDescriptorContent', {
|
|||
module: '@',
|
||||
baseState: '@?',
|
||||
description: '<',
|
||||
descriptor: '<?'
|
||||
descriptor: '<?',
|
||||
summary: '<?'
|
||||
},
|
||||
transclude: {
|
||||
body: 'slotBody',
|
||||
|
|
|
@ -60,6 +60,9 @@ vn-descriptor-content {
|
|||
font-size: 1.75rem;
|
||||
}
|
||||
}
|
||||
& > vn-icon-button:nth-child(2) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
& > .body {
|
||||
display: block;
|
||||
|
|
|
@ -13,6 +13,8 @@ Preview: Vista previa
|
|||
Profile: Perfil
|
||||
Push on applications menu: Para abrir un módulo pulsa en el menú de aplicaciones
|
||||
Go to module index: Ir al índice del módulo
|
||||
Go to module summary: Ir a la vista previa del módulo
|
||||
Show summary: Mostrar vista previa
|
||||
What is new: Novedades de la versión
|
||||
Settings: Ajustes
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@
|
|||
"The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
|
||||
"You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
|
||||
"Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
|
||||
"You don't have privileges to create pay back": "No tienes permisos para crear un abono",
|
||||
"You don't have privileges to create refund": "No tienes permisos para crear un abono",
|
||||
"The item is required": "El artículo es requerido",
|
||||
"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",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="account"
|
||||
description="$ctrl.user.nickname">
|
||||
description="$ctrl.user.nickname"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-menu>
|
||||
<vn-item
|
||||
ng-click="deleteUser.show()"
|
||||
|
@ -173,3 +174,6 @@
|
|||
<button response="accept" translate>Change password</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-user-summary user="$ctrl.user"></vn-user-summary>
|
||||
</vn-popup>
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="claim"
|
||||
description="$ctrl.claim.client.name">
|
||||
description="$ctrl.claim.client.name"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-menu>
|
||||
<vn-item
|
||||
ng-click="$ctrl.showPickupOrder()"
|
||||
|
@ -96,4 +97,7 @@
|
|||
</vn-worker-descriptor-popover>
|
||||
<vn-ticket-descriptor-popover
|
||||
vn-id="ticketDescriptor">
|
||||
</vn-ticket-descriptor-popover>
|
||||
</vn-ticket-descriptor-popover>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-claim-summary claim="$ctrl.claim"></vn-claim-summary>
|
||||
</vn-popup>
|
|
@ -44,6 +44,9 @@
|
|||
"ClientType": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ClientUnpaid": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Defaulter": {
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="client"
|
||||
description="$ctrl.client.name">
|
||||
description="$ctrl.client.name"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-menu>
|
||||
<a class="vn-item"
|
||||
ui-sref="ticket.create({clientFk: $ctrl.client.id})"
|
||||
|
@ -118,4 +119,7 @@
|
|||
</vn-client-sms>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor">
|
||||
</vn-worker-descriptor-popover>
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-client-summary client="$ctrl.client"></vn-client-summary>
|
||||
</vn-popup>
|
||||
|
|
|
@ -46,3 +46,4 @@ import './consumption';
|
|||
import './consumption-search-panel';
|
||||
import './defaulter';
|
||||
import './notification';
|
||||
import './unpaid';
|
||||
|
|
|
@ -61,4 +61,5 @@ Log: Historial
|
|||
Consumption: Consumo
|
||||
Compensation Account: Cuenta para compensar
|
||||
Amount to return: Cantidad a devolver
|
||||
Delivered amount: Cantidad entregada
|
||||
Delivered amount: Cantidad entregada
|
||||
Unpaid: Impagado
|
|
@ -32,7 +32,8 @@
|
|||
{"state": "client.card.creditInsurance.index", "icon": "icon-solunion"},
|
||||
{"state": "client.card.contact", "icon": "contact_phone"},
|
||||
{"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": "icon-defaulter"}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -374,6 +375,12 @@
|
|||
"state": "client.notification",
|
||||
"component": "vn-client-notification",
|
||||
"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,14 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
export default class Controller extends Section {
|
||||
setDefaultDate(hasData) {
|
||||
if (hasData && !this.clientUnpaid.dated)
|
||||
this.clientUnpaid.dated = new Date();
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnClientUnpaid', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -0,0 +1,38 @@
|
|||
import './index';
|
||||
|
||||
describe('client unpaid', () => {
|
||||
describe('Component vnClientUnpaid', () => {
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(inject($componentController => {
|
||||
const $element = angular.element('<vn-client-unpaid></vn-client-unpaid>');
|
||||
controller = $componentController('vnClientUnpaid', {$element});
|
||||
}));
|
||||
|
||||
describe('setDefaultDate()', () => {
|
||||
it(`should not set today date if has dated`, () => {
|
||||
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 dated`, () => {
|
||||
const hasData = true;
|
||||
|
||||
controller.clientUnpaid = {};
|
||||
controller.setDefaultDate(hasData);
|
||||
|
||||
expect(controller.clientUnpaid.dated).toBeDefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
Unpaid client: Cliente impagado
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="entry"
|
||||
description="$ctrl.entry.supplier.nickname">
|
||||
description="$ctrl.entry.supplier.nickname"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-menu>
|
||||
<vn-item
|
||||
ng-click="$ctrl.showEntryReport()"
|
||||
|
@ -59,3 +60,6 @@
|
|||
</div>
|
||||
</slot-body>
|
||||
</vn-descriptor-content>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-entry-summary entry="$ctrl.entry"></vn-entry-summary>
|
||||
</vn-popup>
|
|
@ -1,4 +1,7 @@
|
|||
<vn-descriptor-content module="invoiceIn" description="$ctrl.invoiceIn.supplierRef">
|
||||
<vn-descriptor-content
|
||||
module="invoiceIn"
|
||||
description="$ctrl.invoiceIn.supplierRef"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-menu>
|
||||
<vn-item
|
||||
ng-click="$ctrl.checkToBook()"
|
||||
|
@ -76,4 +79,7 @@
|
|||
vn-id="confirm-toBookAnyway"
|
||||
message="Are you sure you want to book this invoice?"
|
||||
on-accept="$ctrl.onAcceptToBook()">
|
||||
</vn-confirm>
|
||||
</vn-confirm>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-invoice-in-summary invoice-in="$ctrl.invoiceIn"></vn-invoice-in-summary>
|
||||
</vn-popup>
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="invoiceOut"
|
||||
description="$ctrl.invoiceOut.ref">
|
||||
description="$ctrl.invoiceOut.ref"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-dot-menu>
|
||||
<vn-invoice-out-descriptor-menu
|
||||
invoice-out="$ctrl.invoiceOut"
|
||||
|
@ -49,4 +50,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</slot-body>
|
||||
</vn-descriptor-content>
|
||||
</vn-descriptor-content>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-invoice-out-summary invoice-out="$ctrl.invoiceOut"></vn-invoice-out-summary>
|
||||
</vn-popup>
|
|
@ -29,6 +29,9 @@
|
|||
"ItemLog": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ItemPackingType": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ItemPlacement": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="item"
|
||||
description="$ctrl.item.name">
|
||||
description="$ctrl.item.name"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-menu>
|
||||
<vn-item
|
||||
ng-click="regularize.show()"
|
||||
|
@ -114,6 +115,9 @@
|
|||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor">
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-item-summary item="$ctrl.item"></vn-item-summary>
|
||||
</vn-popup>
|
||||
|
||||
<!-- Upload photo dialog -->
|
||||
<vn-upload-photo
|
||||
|
|
|
@ -66,7 +66,6 @@
|
|||
<tr ng-repeat="price in prices">
|
||||
<td shrink-field>
|
||||
<vn-autocomplete
|
||||
vn-focus
|
||||
class="dense"
|
||||
url="Items/withName"
|
||||
ng-model="price.itemFk"
|
||||
|
@ -170,12 +169,6 @@
|
|||
ng-click="$ctrl.add()">
|
||||
</vn-icon-button>
|
||||
</div>
|
||||
<vn-pagination
|
||||
model="model"
|
||||
class="vn-pt-md"
|
||||
scroll-selector="vn-item-price-fixed vn-table"
|
||||
scroll-offset="100">
|
||||
</vn-pagination>
|
||||
</slot-table>
|
||||
</smart-table>
|
||||
</vn-card>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="order"
|
||||
description="$ctrl.order.client.name">
|
||||
description="$ctrl.order.client.name"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-menu>
|
||||
<vn-item
|
||||
ng-click="deleteOrderConfirmation.show()"
|
||||
|
@ -71,4 +72,7 @@
|
|||
</vn-confirm>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor">
|
||||
</vn-worker-descriptor-popover>
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-order-summary order="$ctrl.order"></vn-order-summary>
|
||||
</vn-popup>
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="route"
|
||||
description="$ctrl.route.name">
|
||||
description="$ctrl.route.name"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-menu>
|
||||
<vn-item
|
||||
ng-click="$ctrl.showRouteReport()"
|
||||
|
@ -61,4 +62,7 @@
|
|||
vn-id="updateVolumeConfirmation"
|
||||
on-accept="$ctrl.updateVolume()"
|
||||
question="Are you sure you want to update the volume?">
|
||||
</vn-confirm>
|
||||
</vn-confirm>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-route-summary route="$ctrl.route"></vn-route-summary>
|
||||
</vn-popup>
|
|
@ -7,7 +7,7 @@
|
|||
"menus": {
|
||||
"main": [
|
||||
{"state": "route.index", "icon": "icon-delivery"},
|
||||
{"state": "route.agencyTerm.index", "icon": "contact_support"}
|
||||
{"state": "route.agencyTerm.index", "icon": "icon-agency-term"}
|
||||
],
|
||||
"card": [
|
||||
{"state": "route.card.basicData", "icon": "settings"},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="supplier"
|
||||
description="$ctrl.supplier.name">
|
||||
description="$ctrl.supplier.name"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-body>
|
||||
<div class="attributes">
|
||||
<vn-label-value label="Tax number"
|
||||
|
@ -60,3 +61,6 @@
|
|||
</div>
|
||||
</slot-body>
|
||||
</vn-descriptor-content>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-supplier-summary supplier="$ctrl.supplier"></vn-supplier-summary>
|
||||
</vn-popup>
|
|
@ -15,7 +15,7 @@
|
|||
{"state": "supplier.card.address.index", "icon": "icon-delivery"},
|
||||
{"state": "supplier.card.account", "icon": "icon-account"},
|
||||
{"state": "supplier.card.contact", "icon": "contact_phone"},
|
||||
{"state": "supplier.card.agencyTerm.index", "icon": "contact_support"},
|
||||
{"state": "supplier.card.agencyTerm.index", "icon": "icon-agency-term"},
|
||||
{"state": "supplier.card.log", "icon": "history"},
|
||||
{"state": "supplier.card.consumption", "icon": "show_chart"}
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('payBack', {
|
||||
Self.remoteMethodCtx('refund', {
|
||||
description: 'Create ticket with the selected lines changing the sign to the quantites',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
|
@ -21,12 +21,12 @@ module.exports = Self => {
|
|||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/payBack`,
|
||||
path: `/refund`,
|
||||
verb: 'post'
|
||||
}
|
||||
});
|
||||
|
||||
Self.payBack = async(ctx, sales, ticketId, options) => {
|
||||
Self.refund = async(ctx, sales, ticketId, options) => {
|
||||
const myOptions = {};
|
||||
let tx;
|
||||
|
||||
|
@ -47,21 +47,35 @@ module.exports = Self => {
|
|||
const hasValidRole = isClaimManager || isSalesAssistant;
|
||||
|
||||
if (!hasValidRole)
|
||||
throw new UserError(`You don't have privileges to create pay back`);
|
||||
throw new UserError(`You don't have privileges to create refund`);
|
||||
|
||||
for (let sale of sales)
|
||||
salesIds.push(sale.id);
|
||||
|
||||
const query = `
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketService;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp.sale
|
||||
SELECT s.id, s.itemFk, - s.quantity, s.concept, s.price, s.discount
|
||||
FROM sale s
|
||||
WHERE s.id IN (?);
|
||||
|
||||
CREATE TEMPORARY TABLE tmp.ticketService(
|
||||
description VARCHAR(50),
|
||||
quantity DECIMAL (10,2),
|
||||
price DECIMAL (10,2),
|
||||
taxClassFk INT,
|
||||
ticketServiceTypeFk INT
|
||||
);
|
||||
|
||||
CALL vn.ticket_doRefund(?, @newTicket);
|
||||
DROP TEMPORARY TABLE tmp.sale;`;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.sale;
|
||||
DROP TEMPORARY TABLE tmp.ticketService;`;
|
||||
|
||||
await Self.rawSql(query, [salesIds, ticketId], myOptions);
|
||||
|
||||
const [newTicket] = await Self.rawSql('SELECT @newTicket id', null, myOptions);
|
||||
ticketId = newTicket.id;
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('refundAll', {
|
||||
description: 'Create ticket with all lines and services changing the sign to the quantites',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'ticketId',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The ticket id'
|
||||
}],
|
||||
returns: {
|
||||
type: 'number',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/refundAll`,
|
||||
verb: 'post'
|
||||
}
|
||||
});
|
||||
|
||||
Self.refundAll = async(ctx, ticketId, options) => {
|
||||
const myOptions = {};
|
||||
let tx;
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
|
||||
try {
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
|
||||
const isClaimManager = await Self.app.models.Account.hasRole(userId, 'claimManager');
|
||||
const isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant');
|
||||
const hasValidRole = isClaimManager || isSalesAssistant;
|
||||
|
||||
if (!hasValidRole)
|
||||
throw new UserError(`You don't have privileges to create refund`);
|
||||
|
||||
const query = `
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketService;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp.sale
|
||||
SELECT s.id, s.itemFk, - s.quantity, s.concept, s.price, s.discount
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
WHERE t.id IN (?);
|
||||
|
||||
CREATE TEMPORARY TABLE tmp.ticketService
|
||||
SELECT ts.description, - ts.quantity, ts.price, ts.taxClassFk, ts.ticketServiceTypeFk
|
||||
FROM ticketService ts
|
||||
WHERE ts.ticketFk IN (?);
|
||||
|
||||
CALL vn.ticket_doRefund(?, @newTicket);
|
||||
|
||||
DROP TEMPORARY TABLE tmp.sale;
|
||||
DROP TEMPORARY TABLE tmp.ticketService;`;
|
||||
|
||||
await Self.rawSql(query, [ticketId, ticketId, ticketId], myOptions);
|
||||
|
||||
const [newTicket] = await Self.rawSql('SELECT @newTicket id', null, myOptions);
|
||||
ticketId = newTicket.id;
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
return ticketId;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('sale payBack()', () => {
|
||||
describe('sale refund()', () => {
|
||||
it('should create ticket with the selected lines changing the sign to the quantites', async() => {
|
||||
const tx = await models.Sale.beginTransaction({});
|
||||
const ctx = {req: {accessToken: {userId: 9}}};
|
||||
|
@ -14,7 +14,7 @@ describe('sale payBack()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const response = await models.Sale.payBack(ctx, sales, ticketId, options);
|
||||
const response = await models.Sale.refund(ctx, sales, ticketId, options);
|
||||
const [newTicketId] = await models.Sale.rawSql('SELECT MAX(t.id) id FROM vn.ticket t;', null, options);
|
||||
|
||||
expect(response).toEqual(newTicketId.id);
|
||||
|
@ -26,7 +26,7 @@ describe('sale payBack()', () => {
|
|||
}
|
||||
});
|
||||
|
||||
it(`should throw an error if the user doesn't have privileges to create a pay back`, async() => {
|
||||
it(`should throw an error if the user doesn't have privileges to create a refund`, async() => {
|
||||
const tx = await models.Sale.beginTransaction({});
|
||||
const ctx = {req: {accessToken: {userId: 1}}};
|
||||
|
||||
|
@ -40,7 +40,7 @@ describe('sale payBack()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
await models.Sale.payBack(ctx, sales, ticketId, options);
|
||||
await models.Sale.refund(ctx, sales, ticketId, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -49,6 +49,6 @@ describe('sale payBack()', () => {
|
|||
}
|
||||
|
||||
expect(error).toBeDefined();
|
||||
expect(error.message).toEqual(`You don't have privileges to create pay back`);
|
||||
expect(error.message).toEqual(`You don't have privileges to create refund`);
|
||||
});
|
||||
});
|
|
@ -6,7 +6,8 @@ module.exports = Self => {
|
|||
require('../methods/sale/updateQuantity')(Self);
|
||||
require('../methods/sale/updateConcept')(Self);
|
||||
require('../methods/sale/recalculatePrice')(Self);
|
||||
require('../methods/sale/payBack')(Self);
|
||||
require('../methods/sale/refund')(Self);
|
||||
require('../methods/sale/refundAll')(Self);
|
||||
require('../methods/sale/canEdit')(Self);
|
||||
|
||||
Self.validatesPresenceOf('concept', {
|
||||
|
|
|
@ -139,6 +139,11 @@
|
|||
translate>
|
||||
Recalculate components
|
||||
</vn-item>
|
||||
<vn-item
|
||||
ng-click="refundAllConfirmation.show()"
|
||||
translate>
|
||||
Refund all
|
||||
</vn-item>
|
||||
</vn-list>
|
||||
</vn-menu>
|
||||
|
||||
|
@ -292,4 +297,12 @@
|
|||
on-accept="$ctrl.recalculateComponents()"
|
||||
question="Are you sure you want to recalculate the components?"
|
||||
message="Recalculate components">
|
||||
</vn-confirm>
|
||||
|
||||
<!-- Refund all confirmation dialog -->
|
||||
<vn-confirm
|
||||
vn-id="refundAllConfirmation"
|
||||
on-accept="$ctrl.refundAll()"
|
||||
question="Are you sure you want to refund all?"
|
||||
message="Refund all">
|
||||
</vn-confirm>
|
|
@ -272,6 +272,14 @@ class Controller extends Section {
|
|||
.then(() => this.reload())
|
||||
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
||||
}
|
||||
|
||||
refundAll() {
|
||||
const params = {ticketId: this.id};
|
||||
const query = `Sales/refundAll`;
|
||||
return this.$http.post(query, params).then(res => {
|
||||
this.$state.go('ticket.card.sale', {id: res.data});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail'];
|
||||
|
|
|
@ -262,6 +262,19 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('refundAll()', () => {
|
||||
it('should make a query and go to ticket.card.sale', () => {
|
||||
jest.spyOn(controller.$state, 'go').mockReturnValue();
|
||||
const expectedParams = {ticketId: ticket.id};
|
||||
|
||||
$httpBackend.expect('POST', `Sales/refundAll`, expectedParams).respond({ticketId: 16});
|
||||
controller.refundAll();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.sale', {id: {ticketId: ticket.id}});
|
||||
});
|
||||
});
|
||||
|
||||
describe('showSMSDialog()', () => {
|
||||
it('should set the destionationFk and destination properties and then call the sms open() method', () => {
|
||||
controller.$.sms = {open: () => {}};
|
||||
|
|
|
@ -7,4 +7,5 @@ Send PDF: Enviar PDF
|
|||
Send CSV: Enviar CSV
|
||||
Send CSV Delivery Note: Enviar albarán en CSV
|
||||
Send PDF Delivery Note: Enviar albarán en PDF
|
||||
Show Proforma: Ver proforma
|
||||
Show Proforma: Ver proforma
|
||||
Refund all: Abonar todo
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="ticket"
|
||||
description="$ctrl.ticket.client.name">
|
||||
description="$ctrl.ticket.client.name"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-dot-menu>
|
||||
<vn-ticket-descriptor-menu
|
||||
vn-id="descriptorMenu"
|
||||
|
@ -127,4 +128,7 @@
|
|||
</vn-descriptor-content>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor">
|
||||
</vn-worker-descriptor-popover>
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-ticket-summary ticket="$ctrl.ticket"></vn-ticket-summary>
|
||||
</vn-popup>
|
|
@ -29,4 +29,5 @@ SMS Minimum import: 'SMS Importe minimo'
|
|||
SMS Pending payment: 'SMS Pago pendiente'
|
||||
Restore ticket: Restaurar ticket
|
||||
You are going to restore this ticket: Vas a restaurar este ticket
|
||||
Are you sure you want to restore this ticket?: ¿Seguro que quieres restaurar el ticket?
|
||||
Are you sure you want to restore this ticket?: ¿Seguro que quieres restaurar el ticket?
|
||||
Are you sure you want to refund all?: ¿Seguro que quieres abonar todo?
|
|
@ -512,10 +512,10 @@
|
|||
Unmark as reserved
|
||||
</vn-item>
|
||||
<vn-item translate
|
||||
name="payBack"
|
||||
ng-click="$ctrl.createPayBack()"
|
||||
name="refund"
|
||||
ng-click="$ctrl.createRefund()"
|
||||
vn-acl="claimManager, salesAssistant"
|
||||
vn-acl-action="remove">
|
||||
Pay Back
|
||||
Refund
|
||||
</vn-item>
|
||||
</vn-menu>
|
|
@ -479,12 +479,12 @@ class Controller extends Section {
|
|||
});
|
||||
}
|
||||
|
||||
createPayBack() {
|
||||
createRefund() {
|
||||
const sales = this.selectedValidSales();
|
||||
if (!sales) return;
|
||||
|
||||
const params = {sales: sales, ticketId: this.ticket.id};
|
||||
const query = `Sales/payBack`;
|
||||
const query = `Sales/refund`;
|
||||
this.resetChanges();
|
||||
this.$http.post(query, params).then(res => {
|
||||
this.$state.go('ticket.card.sale', {id: res.data});
|
||||
|
|
|
@ -703,15 +703,15 @@ describe('Ticket', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('createPayBack()', () => {
|
||||
describe('createRefund()', () => {
|
||||
it('should make an HTTP POST query and then call to the $state go() method', () => {
|
||||
jest.spyOn(controller, 'selectedValidSales').mockReturnValue(controller.sales);
|
||||
jest.spyOn(controller, 'resetChanges');
|
||||
jest.spyOn(controller.$state, 'go');
|
||||
|
||||
const expectedId = 9999;
|
||||
$httpBackend.expect('POST', `Sales/payBack`).respond(200, expectedId);
|
||||
controller.createPayBack();
|
||||
$httpBackend.expect('POST', `Sales/refund`).respond(200, expectedId);
|
||||
controller.createRefund();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.resetChanges).toHaveBeenCalledWith();
|
||||
|
|
|
@ -36,6 +36,6 @@ Warehouse: Almacen
|
|||
Agency: Agencia
|
||||
Shipped: F. envio
|
||||
Packaging: Encajado
|
||||
Pay Back: Abono
|
||||
Refund: Abono
|
||||
Promotion mana: Maná promoción
|
||||
Claim mana: Maná reclamación
|
||||
Claim mana: Maná reclamación
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="travel"
|
||||
description="$ctrl.travel.ref">
|
||||
description="$ctrl.travel.ref"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-dot-menu>
|
||||
<vn-travel-descriptor-menu travel-id="$ctrl.travel.id"/>
|
||||
</slot-dot-menu>
|
||||
|
@ -42,3 +43,6 @@
|
|||
</div>
|
||||
</slot-body>
|
||||
</vn-descriptor-content>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-travel-summary travel="$ctrl.travel"></vn-travel-summary>
|
||||
</vn-popup>
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="worker"
|
||||
description="$ctrl.worker.firstName +' '+ $ctrl.worker.lastName">
|
||||
description="$ctrl.worker.firstName +' '+ $ctrl.worker.lastName"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-before>
|
||||
<div class="photo" text-center>
|
||||
<img vn-id="photo"
|
||||
|
@ -57,6 +58,9 @@
|
|||
</div>
|
||||
</slot-body>
|
||||
</vn-descriptor-content>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-worker-summary worker="$ctrl.worker"></vn-worker-summary>
|
||||
</vn-popup>
|
||||
|
||||
<!-- Upload photo dialog -->
|
||||
<vn-upload-photo
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vn-descriptor-content
|
||||
module="zone"
|
||||
description="$ctrl.zone.name">
|
||||
description="$ctrl.zone.name"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-menu>
|
||||
<vn-item class="vn-item"
|
||||
ng-click="$ctrl.onDelete()"
|
||||
|
@ -39,6 +40,10 @@
|
|||
</div>
|
||||
</slot-body>
|
||||
</vn-descriptor-content>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-zone-summary zone="$ctrl.zone"></vn-zone-summary>
|
||||
</vn-popup>
|
||||
|
||||
<vn-confirm
|
||||
vn-id="deleteZone"
|
||||
on-accept="$ctrl.deleteZone()"
|
||||
|
|
Loading…
Reference in New Issue