#760 ticket.ticketWeekly
This commit is contained in:
parent
12fc0941b7
commit
74d72fddfb
|
@ -212,6 +212,24 @@
|
|||
"menu": {
|
||||
"icon": "image"
|
||||
}
|
||||
},
|
||||
{
|
||||
"url" : "/log",
|
||||
"state": "ticket.card.log",
|
||||
"component": "vn-ticket-log",
|
||||
"description": "Log",
|
||||
"menu": {
|
||||
"icon": "history"
|
||||
}
|
||||
},
|
||||
{
|
||||
"url" : "/weekly",
|
||||
"state": "ticket.weekly",
|
||||
"component": "vn-ticket-weekly",
|
||||
"description": "Weekly",
|
||||
"menu": {
|
||||
"icon": "history"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -20,3 +20,5 @@ import './sale-checked';
|
|||
import './component';
|
||||
import './sale-tracking';
|
||||
import './picture';
|
||||
// import './log';
|
||||
import './weekly';
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="/ticket/api/TicketWeeklies"
|
||||
filter="::$ctrl.filter"
|
||||
limit="20"
|
||||
data="weeklies"
|
||||
primary-key="ticketFk"
|
||||
auto-save="true"
|
||||
on-save="$ctrl.onSave()">
|
||||
</vn-crud-model>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="weeklies"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form name="form">
|
||||
<div margin-medium>
|
||||
<vn-card margin-medium-v pad-medium>
|
||||
<vn-table model="model">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th number field="ticketFk">Ticket ID</vn-th>
|
||||
<vn-th field="weekDay">Client</vn-th>
|
||||
<vn-th>Turn</vn-th>
|
||||
<vn-th>Warehouse</vn-th>
|
||||
<vn-th>Salesperson</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="weekly in weeklies" class="clickable">
|
||||
<vn-td number>
|
||||
<span class="link"
|
||||
ng-click="$ctrl.showTicketDescriptor($event, weekly.ticketFk)">
|
||||
{{weekly.ticketFk}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td>
|
||||
<span class="link" ng-click="$ctrl.showClientDescriptor($event, weekly.ticket.client.id)">
|
||||
{{::weekly.ticket.client.name}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
field="weekly.weekDay"
|
||||
data="$ctrl.weekdays"
|
||||
show-field="name"
|
||||
translate-fields="['name']"
|
||||
value-field="id"
|
||||
order="id">
|
||||
</vn-autocomplete>
|
||||
</vn-td>
|
||||
<vn-td>{{::weekly.ticket.warehouse.name}}</vn-td>
|
||||
<vn-td>{{::weekly.ticket.client.salesPerson.firstName}} {{::weekly.ticket.client.salesPerson.name}}</vn-td>
|
||||
<vn-td>
|
||||
<vn-icon-button
|
||||
icon="delete"
|
||||
ng-click="model.remove($index)"
|
||||
vn-tooltip="Delete">
|
||||
</vn-icon-button>
|
||||
</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="model.data.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-card>
|
||||
<vn-pagination
|
||||
model="model"
|
||||
scroll-selector="ui-view">
|
||||
</vn-pagination>
|
||||
</div>
|
||||
</form>
|
||||
<vn-client-descriptor-popover vn-id="clientDescriptor"></vn-client-descriptor-popover>
|
||||
<vn-ticket-descriptor-popover
|
||||
vn-id="ticketDescriptor">
|
||||
</vn-ticket-descriptor-popover>
|
||||
<vn-confirm
|
||||
vn-id="deleteWeekly"
|
||||
on-response="$ctrl.returnDialog(response)"
|
||||
question="Delete weekly"
|
||||
message="Are you sure you want to delete this weekly?">
|
||||
</vn-confirm>
|
|
@ -0,0 +1,83 @@
|
|||
import ngModule from '../module';
|
||||
import './style.scss';
|
||||
|
||||
export default class Controller {
|
||||
constructor($scope) {
|
||||
this.$scope = $scope;
|
||||
this.ticketSelected = null;
|
||||
this.filter = {
|
||||
include: [
|
||||
{relation: 'ticket',
|
||||
scope: {
|
||||
fields: ['id', 'clientFk', 'companyFk', 'warehouseFk'],
|
||||
include: [
|
||||
{relation: 'client',
|
||||
scope: {
|
||||
fields: ['salesPersonFk', 'name'],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
fields: ['firstName', 'name']
|
||||
}
|
||||
}
|
||||
},
|
||||
{relation: 'warehouse'}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
this.weekdays = [
|
||||
{id: 0, name: 'Monday'},
|
||||
{id: 1, name: 'Tuesday'},
|
||||
{id: 2, name: 'Wednesday'},
|
||||
{id: 3, name: 'Thursday'},
|
||||
{id: 4, name: 'Friday'},
|
||||
{id: 5, name: 'Saturday'},
|
||||
{id: 6, name: 'Sunday'}
|
||||
];
|
||||
}
|
||||
|
||||
onSave() {
|
||||
this.$scope.watcher.notifySaved();
|
||||
}
|
||||
|
||||
showClientDescriptor(event, clientFk) {
|
||||
this.$scope.clientDescriptor.clientFk = clientFk;
|
||||
this.$scope.clientDescriptor.parent = event.target;
|
||||
this.$scope.clientDescriptor.show();
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
showTicketDescriptor(event, ticketFk) {
|
||||
this.$scope.ticketDescriptor.ticketFk = ticketFk;
|
||||
this.$scope.ticketDescriptor.parent = event.target;
|
||||
this.$scope.ticketDescriptor.show();
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
onDescriptorLoad() {
|
||||
this.$scope.popover.relocate();
|
||||
}
|
||||
|
||||
deleteWeekly(expedition) {
|
||||
this.expeditionId = expedition.id;
|
||||
this.$scope.deleteWeekly.show();
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$scope.watcher.check();
|
||||
this.$scope.model.save().then(() => {
|
||||
this.$scope.watcher.notifySaved();
|
||||
this.$scope.model.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope'];
|
||||
|
||||
ngModule.component('vnTicketWeekly', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -0,0 +1,2 @@
|
|||
Turn: Turno
|
||||
Ticket ID: ID Ticket
|
|
@ -0,0 +1,17 @@
|
|||
vn-ticket-weekly {
|
||||
vn-card {
|
||||
margin: auto;
|
||||
max-width: 880px;
|
||||
}
|
||||
vn-autocomplete {
|
||||
div.mdl-textfield {
|
||||
padding: 0px !important;
|
||||
}
|
||||
label.mdl-textfield__label:after {
|
||||
bottom: 0;
|
||||
}
|
||||
div.icons {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,12 +7,12 @@
|
|||
}
|
||||
},
|
||||
"properties": {
|
||||
"weekDay": {
|
||||
"type": "Number"
|
||||
},
|
||||
"ticketFk": {
|
||||
"id": true,
|
||||
"type": "Number"
|
||||
},
|
||||
"weekDay": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
Loading…
Reference in New Issue