Merge pull request '5934-clientSms' (!1675) from 5934-clientSms into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1675 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
484bcd3fde
|
@ -0,0 +1,15 @@
|
||||||
|
CREATE TABLE `vn`.`clientSms` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`clientFk` int(11) NOT NULL,
|
||||||
|
`smsFk` mediumint(8) unsigned NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `clientSms_FK` (`clientFk`),
|
||||||
|
KEY `clientSms_FK_1` (`smsFk`),
|
||||||
|
CONSTRAINT `clientSms_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `clientSms_FK_1` FOREIGN KEY (`smsFk`) REFERENCES `sms` (`id`) ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('ClientSms', 'find', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('ClientSms', 'create', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
@ -7,7 +7,7 @@ module.exports = Self => {
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The ticket id',
|
description: 'The client id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -33,6 +33,12 @@ module.exports = Self => {
|
||||||
Self.sendSms = async(ctx, id, destination, message) => {
|
Self.sendSms = async(ctx, id, destination, message) => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const sms = await models.Sms.send(ctx, destination, message);
|
const sms = await models.Sms.send(ctx, destination, message);
|
||||||
|
|
||||||
|
await models.ClientSms.create({
|
||||||
|
clientFk: id,
|
||||||
|
smsFk: sms.id
|
||||||
|
});
|
||||||
|
|
||||||
return sms;
|
return sms;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -95,6 +95,9 @@
|
||||||
"ClientSample": {
|
"ClientSample": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"ClientSms": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Sms": {
|
"Sms": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"name": "ClientSms",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "clientSms"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"clientFk": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"sms": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Sms",
|
||||||
|
"foreignKey": "smsFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,4 +48,5 @@ import './notification';
|
||||||
import './unpaid';
|
import './unpaid';
|
||||||
import './extended-list';
|
import './extended-list';
|
||||||
import './credit-management';
|
import './credit-management';
|
||||||
|
import './sms';
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
{"state": "client.card.recovery.index", "icon": "icon-recovery"},
|
{"state": "client.card.recovery.index", "icon": "icon-recovery"},
|
||||||
{"state": "client.card.webAccess", "icon": "cloud"},
|
{"state": "client.card.webAccess", "icon": "cloud"},
|
||||||
{"state": "client.card.log", "icon": "history"},
|
{"state": "client.card.log", "icon": "history"},
|
||||||
|
{"state": "client.card.sms", "icon": "sms"},
|
||||||
{
|
{
|
||||||
"description": "Credit management",
|
"description": "Credit management",
|
||||||
"icon": "monetization_on",
|
"icon": "monetization_on",
|
||||||
|
@ -373,6 +374,12 @@
|
||||||
"component": "vn-client-log",
|
"component": "vn-client-log",
|
||||||
"description": "Log"
|
"description": "Log"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"url" : "/sms",
|
||||||
|
"state": "client.card.sms",
|
||||||
|
"component": "vn-client-sms",
|
||||||
|
"description": "Sms"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"url": "/dms",
|
"url": "/dms",
|
||||||
"state": "client.card.dms",
|
"state": "client.card.dms",
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<vn-crud-model
|
||||||
|
vn-id="model"
|
||||||
|
url="ClientSms"
|
||||||
|
link="{clientFk: $ctrl.$params.id}"
|
||||||
|
filter="::$ctrl.filter"
|
||||||
|
data="clientSmsList"
|
||||||
|
limit="20"
|
||||||
|
auto-load="true">
|
||||||
|
</vn-crud-model>
|
||||||
|
<vn-data-viewer model="model">
|
||||||
|
<vn-card class="vn-w-md">
|
||||||
|
<vn-table model="model" auto-load="false">
|
||||||
|
<vn-thead>
|
||||||
|
<vn-tr>
|
||||||
|
<vn-th field="senderFk">Sender</vn-th>
|
||||||
|
<vn-th field="destination" number>Destination</vn-th>
|
||||||
|
<vn-th field="message">Message</vn-th>
|
||||||
|
<vn-th field="status">Status</vn-th>
|
||||||
|
<vn-th field="created" expand>Created</vn-th>
|
||||||
|
</vn-tr>
|
||||||
|
</vn-thead>
|
||||||
|
<vn-tbody>
|
||||||
|
<vn-tr ng-repeat="clientSms in clientSmsList">
|
||||||
|
<vn-td>
|
||||||
|
<span class="link" ng-click="workerDescriptor.show($event, clientSms.sms.senderFk)">
|
||||||
|
{{::clientSms.sms.sender.name}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td number expand>{{::clientSms.sms.destination}}</vn-td>
|
||||||
|
<vn-td>{{::clientSms.sms.message}}</vn-td>
|
||||||
|
<vn-td>{{::clientSms.sms.status}}</vn-td>
|
||||||
|
<vn-td shrink-datetime>{{::clientSms.sms.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||||
|
</vn-tr>
|
||||||
|
</vn-tbody>
|
||||||
|
</vn-table>
|
||||||
|
</vn-card>
|
||||||
|
</vn-data-viewer>
|
||||||
|
<vn-worker-descriptor-popover
|
||||||
|
vn-id="worker-descriptor">
|
||||||
|
</vn-worker-descriptor-popover>
|
|
@ -0,0 +1,39 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
|
export default class Controller extends Section {
|
||||||
|
constructor($element, $) {
|
||||||
|
super($element, $);
|
||||||
|
|
||||||
|
this.filter = {
|
||||||
|
fields: ['id', 'smsFk'],
|
||||||
|
include: {
|
||||||
|
relation: 'sms',
|
||||||
|
scope: {
|
||||||
|
fields: [
|
||||||
|
'senderFk',
|
||||||
|
'sender',
|
||||||
|
'destination',
|
||||||
|
'message',
|
||||||
|
'statusCode',
|
||||||
|
'status',
|
||||||
|
'created'],
|
||||||
|
include: {
|
||||||
|
relation: 'sender',
|
||||||
|
scope: {
|
||||||
|
fields: ['name']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnClientSms', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller,
|
||||||
|
bindings: {
|
||||||
|
client: '<'
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,2 @@
|
||||||
|
Sender: Remitente
|
||||||
|
Number sender: Número remitente
|
Loading…
Reference in New Issue