Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
data() {
return {
mixinAttr: 'namespaceParams',
namespaceParams: {
team: null,
},
close: false,
};
},
validations: {
namespaceParams: {
team: {
required,
notSameAsTeam: not(sameAs(function () { return this.namespace.team.name; })),
},
},
},
methods: {
onEnter() {
this.$refs.modal.$el.focus();
},
onSubmit() {
const params = { namespace: this.namespaceParams };
NamespacesService.update(this.namespace.id, params).then((response) => {
const namespace = response.data;
this.$bus.$emit('namespaceUpdated', namespace);
export const startingDate: RuleDecl = {
validDate,
notBefore(value: string) {
const { input } = (this as any) as HasBirthdate;
if (!input) return false;
return !beforeDate(moment(input.birthdate))(value);
},
};
export const bookCheckInTime: RuleDecl = {
required,
validDate,
beforeDateTime: not(beforeDateTime()),
};
interface HasBookCheckInTime {
bookCheckInTime: string;
}
export const bookCheckOutTime = {
required,
validDate,
beforeDateTime(value: string) {
const { bookCheckInTime } = (this as any) as HasBookCheckInTime;
if (!bookCheckInTime) return false;
return !beforeDateTime(moment(bookCheckInTime))(value);
},
import { DataMixin, PopupMixin } from '~/components/mixins';
import { ReceiptCreateInput, GetBills } from '~/graphql/types';
import { createReceipt } from '~/graphql/documents';
import { optional, currency } from '~/modules/validator';
type PopupMixinType = PopupMixin<{ bill: GetBills.Bills }, ReceiptCreateInput>;
@Component({
name: 'popup-receipt-add-',
validations: {
input: {
money: currency,
bankAccountNumber: {
or: or(
and(numeric, minLength(6), maxLength(20)),
not(required),
),
},
},
},
})
export default class extends mixins(
PopupMixin,
DataMixin({ createReceipt, optional }),
) {
onOpen() {
this.input = {
money: 0,
bankAccountNumber: '',
bill: {
id: this.data.bill.id,
},
@Component({
name: 'popup-booking-and-check-in-',
validations: {
input: {
bill: {
patron: included('patron'),
},
bookings: {
required,
},
},
bookCheckOutTime: {
required,
validDate,
beforeDateTime: not(beforeDateTime()),
},
},
})
export default class extends mixins(
PopupMixin,
DataMixin({ bookAndCheckIn, getPatrons, getRoom }),
) {
bookCheckOutTime: string = moment()
.add(3, 'day')
.set({
hour: 11,
minute: 0,
second: 0,
})
.format();