|
@@ -0,0 +1,44 @@
|
|
|
|
|
+const { register, Sequelize } = require('@alancnet/material-framework/auto-crud')
|
|
|
|
|
+
|
|
|
|
|
+register({
|
|
|
|
|
+ camelName: 'service',
|
|
|
|
|
+ iconAsset: 'userIcon',
|
|
|
|
|
+ schema: {
|
|
|
|
|
+ id: {
|
|
|
|
|
+ type: Sequelize.UUID,
|
|
|
|
|
+ defaultValue: Sequelize.UUIDV1,
|
|
|
|
|
+ primaryKey: true
|
|
|
|
|
+ },
|
|
|
|
|
+ workdayId: Sequelize.UUID,
|
|
|
|
|
+ retailerId: Sequelize.UUID,
|
|
|
|
|
+ date: Sequelize.DATEONLY, // Copy from Workday
|
|
|
|
|
+ delivered: Sequelize.INTEGER,
|
|
|
|
|
+ scanned: Sequelize.INTEGER
|
|
|
|
|
+ },
|
|
|
|
|
+ options: {
|
|
|
|
|
+ paranoid: true,
|
|
|
|
|
+ indexes: [
|
|
|
|
|
+ {
|
|
|
|
|
+ unique: true,
|
|
|
|
|
+ fields: ['workdayId', 'retailerId']
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ columns: [
|
|
|
|
|
+ { camelName: 'date', type: 'date' },
|
|
|
|
|
+ { camelName: 'workdayId', titleName: 'Workday', type: 'autocomplete', source: '/api/workdays' },
|
|
|
|
|
+ { camelName: 'retailerId', titleName: 'Retailer', type: 'autocomplete', source: '/api/retailers' },
|
|
|
|
|
+ { camelName: 'delivered', type: 'number' },
|
|
|
|
|
+ { camelName: 'scanned', type: 'number' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ layout: [
|
|
|
|
|
+ {
|
|
|
|
|
+ section: 'Details',
|
|
|
|
|
+ rows: [
|
|
|
|
|
+ [ 'name', 'key' ],
|
|
|
|
|
+ [ 'address' ]
|
|
|
|
|
+ [ 'locationId', 'distanceMiles' ]
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+})
|