| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- const { register, Sequelize } = require('@alancnet/material-framework/auto-crud')
- register({
- camelName: 'client',
- iconAsset: 'userIcon',
- appPrefix: '/clients/:terminal',
- apiPrefix: '/api/clients/:terminal',
- titles: {
- details: ctrl => ctrl.isNew
- ? `New ${ctrl.$routeParams.terminal == 'all' ? '' : ctrl.$routeParams.terminal} Client`
- : `${ctrl.$routeParams.terminal == 'all' ? '' : ctrl.$routeParams.terminal} Client Details`,
- list: ctrl => `${ctrl.$routeParams.terminal == 'all' ? 'All' : ctrl.$routeParams.terminal} Clients`
- },
- showNav: false,
- schema: {
- id: {
- type: Sequelize.UUID,
- defaultValue: Sequelize.UUIDV1,
- primaryKey: true
- },
- name: Sequelize.STRING,
- key: {
- type: Sequelize.STRING,
- unique: true
- },
- address: Sequelize.STRING,
- terminalId: Sequelize.UUID,
- distanceMiles: Sequelize.DOUBLE
- },
- options: {
- paranoid: true,
- indexes: [
- {
- unique: true,
- fields: ['key']
- }
- ]
- },
- columns: [
- { camelName: 'key' },
- { camelName: 'name' },
- { camelName: 'address', inList: false },
- { camelName: 'terminalId', titleName: 'terminal', type: 'autocomplete', apiPrefix: '/api/terminals', routeParam: 'terminal' },
- { camelName: 'distanceMiles', titleName: 'Distance in Miles', type: 'number' }
- ],
- layout: [
- {
- section: 'Details',
- rows: [
- [ 'name', 'key' ],
- [ 'address' ],
- [ 'terminalId', 'distanceMiles' ]
- ]
- }
- ]
- })
|