retailer.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const { register, Sequelize } = require('@alancnet/material-framework/auto-crud')
  2. register({
  3. camelName: 'retailer',
  4. iconAsset: 'userIcon',
  5. appPrefix: '/retailers/:location',
  6. apiPrefix: '/api/retailers/:location',
  7. pascalName: 'Retailer',
  8. pascalPlural: 'Retailers',
  9. titleName: '{{ctrl.$routeParams.location == "all" ? "All" : ctrl.$routeParams.location}} Client',
  10. titlePlural: '{{ctrl.$routeParams.location == "all" ? "All" : ctrl.$routeParams.location}} Clients',
  11. showNav: false,
  12. schema: {
  13. id: {
  14. type: Sequelize.UUID,
  15. defaultValue: Sequelize.UUIDV1,
  16. primaryKey: true
  17. },
  18. name: Sequelize.STRING,
  19. key: {
  20. type: Sequelize.STRING,
  21. unique: true
  22. },
  23. address: Sequelize.STRING,
  24. locationId: Sequelize.UUID,
  25. distanceMiles: Sequelize.DOUBLE
  26. },
  27. options: {
  28. paranoid: true,
  29. indexes: [
  30. {
  31. unique: true,
  32. fields: ['key']
  33. }
  34. ]
  35. },
  36. columns: [
  37. { camelName: 'key' },
  38. { camelName: 'name' },
  39. { camelName: 'address', inList: false },
  40. { camelName: 'locationId', titleName: 'Location', type: 'autocomplete', apiPrefix: '/api/locations', routeParam: 'location' },
  41. { camelName: 'distanceMiles', titleName: 'Distance in Miles', type: 'number' }
  42. ],
  43. layout: [
  44. {
  45. section: 'Details',
  46. rows: [
  47. [ 'name', 'key' ],
  48. [ 'address' ],
  49. [ 'locationId', 'distanceMiles' ]
  50. ]
  51. }
  52. ]
  53. })