Localizador: restablecer filtros, datePicker con formato 'es'
This commit is contained in:
parent
06537bcf8d
commit
f670c0f4fd
|
@ -402,6 +402,9 @@ export default class Autocomplete extends Component {
|
|||
|
||||
if (!this.locked)
|
||||
this.value = value;
|
||||
|
||||
if (this.onChange)
|
||||
this.onChange({item: this.value});
|
||||
}
|
||||
showItem(item) {
|
||||
this.input.value = item ? item[this.showField] : '';
|
||||
|
@ -422,6 +425,7 @@ module.component('vnAutocomplete', {
|
|||
valueField: '@?',
|
||||
selectFields: '@?',
|
||||
initialData: '<?',
|
||||
onChange: '&?',
|
||||
data: '<?',
|
||||
itemAs: '@?',
|
||||
field: '=',
|
||||
|
|
|
@ -7,8 +7,8 @@ import Flatpickr from 'vendor/src/flatpickr';
|
|||
const _NAME = 'datePicker';
|
||||
export const NAME = util.getName(_NAME);
|
||||
|
||||
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME, '$translate', '$document', '$transitions'];
|
||||
export function directive(resolve, normalizer, $translate, $document, $transitions) {
|
||||
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME, '$translate'];
|
||||
export function directive(resolve, normalizer, $translate) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: function(_, attrs) {
|
||||
|
@ -26,6 +26,9 @@ export function directive(resolve, normalizer, $translate, $document, $transitio
|
|||
if (!initOptions.locale)
|
||||
initOptions.locale = $translate.use();
|
||||
|
||||
if (!initOptions.dateFormat && initOptions.locale === 'es')
|
||||
initOptions.dateFormat = 'd-m-Y';
|
||||
|
||||
if (!input.matches('input'))
|
||||
input = input.querySelector('input');
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
|
|||
$translatePartialLoader.addPart(dep);
|
||||
// FIXME: https://github.com/angular-translate/angular-translate/pull/1674
|
||||
// promises.push($translate.refresh());
|
||||
setTimeout (() => $translate.refresh(), 500);
|
||||
setTimeout(() => $translate.refresh(), 500);
|
||||
}
|
||||
|
||||
let ocDeps = deps.map(item => { return { name: item } });
|
||||
|
|
|
@ -22,10 +22,11 @@
|
|||
show-field="name"
|
||||
value-field="id"
|
||||
field="$ctrl.filter.warehouseFk"
|
||||
url="/production/api/Warehouses/production"
|
||||
url="/production/api/Warehouses/production"
|
||||
on-change = "$ctrl.onChangeWareHouse(item)"
|
||||
label="Store">
|
||||
</vn-autocomplete>
|
||||
<vn-icon-button vn-none pad-ten-top icon="refresh" ng-click="$ctrl.searchTickets()"></vn-icon-button>
|
||||
<vn-icon-button vn-none pad-ten-top icon="refresh" ng-click="$ctrl.refreshTickets()"></vn-icon-button>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal vn-one margin-large-bottom>
|
||||
|
|
|
@ -72,8 +72,10 @@ export default class ProductionIndex {
|
|||
delete this.child;
|
||||
}
|
||||
searchTickets(filter) {
|
||||
this.filter = Object.assign({}, filter || {}, this.filter);
|
||||
|
||||
let filters = Object.assign({}, {
|
||||
where: Object.assign({}, filter, this.filter)
|
||||
where: this.filter
|
||||
}, {
|
||||
page: 1,
|
||||
limit: 700
|
||||
|
@ -87,6 +89,17 @@ export default class ProductionIndex {
|
|||
}
|
||||
);
|
||||
}
|
||||
refreshTickets() {
|
||||
this.filter = {};
|
||||
this.filter.warehouseFk = this.userProfile.warehouseId;
|
||||
this.searchTickets();
|
||||
}
|
||||
onChangeWareHouse(item) {
|
||||
if (item && item != this.filter.warehouseFk) {
|
||||
this.filter.warehouseFk = item;
|
||||
this.searchTickets();
|
||||
}
|
||||
}
|
||||
$onInit() {
|
||||
for (let i = 1; i <= 24; i++) {
|
||||
let hour = [i].join('');
|
||||
|
|
|
@ -40,10 +40,10 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider) {
|
|||
for (let file in routes) {
|
||||
let fileRoutes = routes[file].routes;
|
||||
let moduleName = routes[file].module;
|
||||
let validations = routes[file].validations;
|
||||
let validations = routes[file].validations || false;
|
||||
fileRoutes.forEach(function(route) {
|
||||
if (aclService.routeHasPermission(route)) {
|
||||
let routeOptions = {
|
||||
$stateProvider.state(route.state, {
|
||||
url: route.url,
|
||||
abstract: route.abstract || false,
|
||||
template: `<${route.component} ${getParams(route)}></${route.component}>`,
|
||||
|
@ -53,9 +53,7 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider) {
|
|||
data: {
|
||||
routes: fileRoutes
|
||||
}
|
||||
};
|
||||
|
||||
$stateProvider.state(route.state, routeOptions);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue