vhp-mongo-models 1.7.3 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,6 @@ module.exports = [{
4
4
  work:{type:String,default:""}, //just an array of work.id
5
5
  custcode:{type:String,default:''},
6
6
  name:{type:String,default:''}, //what checklist was used
7
- title:{type:String,default:''},
8
7
  sitems:{type:Array,default:[]}, //of service item ["ids"]
9
8
  scoring:{
10
9
  list:{type:Object,default:{}},
@@ -0,0 +1,8 @@
1
+ module.exports = [{
2
+ id:{type:String,default:''}, //what checklist was used
3
+ name:{type:String,default:''}, //optional name for THIS checklist
4
+ work:{type:Array,default:[]},
5
+ hhid:{type:String,default:''},
6
+ sitems:{type:Array,default:[]},//of service item ids
7
+ checks:{type:Object,default:{}} //to hold all of the checklist values
8
+ }]
@@ -7,7 +7,7 @@
7
7
  module.exports = [
8
8
  {
9
9
  coid:{type:String,default:''},
10
- custCode : {type:String,default:''},
10
+ custCode : {type:String,default:''}, //link in Jonas
11
11
  type:{type:String,default:'owner'}, // Owners | Occupants
12
12
  billTo:{type:String,default:''},
13
13
  custName:{type:String,default:''},
@@ -1,5 +1,14 @@
1
1
 
2
2
  /** Home Schema
3
+ *
4
+ * spaces = [{
5
+ * id:{type:String,default:''},
6
+ * title:{type:String,default:''}
7
+ * subspaces:{type:String,default:[{
8
+ * id:{type:String,default:''},
9
+ * title:{type:String,default:''}
10
+ * }]}
11
+ * }]
3
12
  *
4
13
  * index
5
14
  * - hhid - {unique:true,name:"hhid"}
@@ -1,15 +1,8 @@
1
- /*
2
- notes = [{
3
- tech:{type:String,default:''},
4
- date:{type:Date,default:null},
5
- work:{type:String,default:''},
6
- note:{type:String,default:''}
7
- }]
8
- */
9
1
  module.exports = [
10
2
  {
11
3
  //VHP ADD fields
12
4
  hhid:{type:String,default:''}, //must have a hhid
5
+ group:{type:String,default:''},//names the type of product it is. Would like to use this instead of type
13
6
  system:{type:String,default:''}, //way to link related service items
14
7
  space:{type:String,default:''},
15
8
  subspace:{type:String,default:''},
@@ -20,8 +13,8 @@ module.exports = [
20
13
  //JONAS props
21
14
  id:{type:String,default:''}, //must have an id, should match JONAS "lineNumber"
22
15
  custcode:{type:String,default:''}, //linked custcode in JONAS
23
- type:{type:String,default:''},//FU CU C etc
24
16
  tagid:{type:String,default:''},
17
+ type:{type:String,default:''},//understand what this is in jonas
25
18
  descr:{type:String,default:''},
26
19
  status:{type:String,default:''},//should be 'A' for active. Need to find other codes. Match JONAS
27
20
  insdate:{type:Date,default:''},
@@ -5,5 +5,6 @@ module.exports={
5
5
  PricingBEE:new Schema(...require('./schemas/pricingbee.js')),
6
6
  Pricing300:new Schema(...require('./schemas/pricing300.js')),
7
7
  Addition:new Schema(...require('./schemas/additions.js')),
8
- Finance:new Schema(...require('./schemas/financing.js'))
8
+ Finance:new Schema(...require('./schemas/financing.js')),
9
+ Discount:new Schema(...require('./schemas/discounts.js'))
9
10
  }
@@ -2,15 +2,24 @@ module.exports=[
2
2
  {
3
3
  name:{type:String,default:''}, // pricebook / collection name
4
4
  notes:{type:String,default:''}, // versioned | table
5
- cat:{type:String,default:''}, // pkid | update date?
6
- type:{type:String,default:''},
5
+ type:{type:String,default:''}, // the quote type ex. hvac | envelope | window
6
+ cat:{type:String,default:''}, // department provided groupings
7
7
  mfg:{type:String,default:''},
8
8
  model:{type:String,default:''},
9
- settings:{type:String,default:''},
10
- location:{type:Array,default:[]},
11
9
  labor:{type:Number,default:0},
12
10
  laborpart:{type:Number,default:0},
13
- price:{type:Number,default:0},
14
- pricededuct:{type:Number,default:0}
11
+ settings:{type:Object,default:{}},
12
+ pricededuct:{type:Number,default:0}, //price to take off
13
+ pricesale:{type:Number,default:0},
14
+ userCreated:{type:Boolean,default:false}, //may not need, is really for gui
15
+ tiers:{type:Array,default:[]} //may not need, is really for gui
15
16
  }
16
17
  ]
18
+
19
+ /*
20
+ settings = {
21
+
22
+ location:{type:Array,default:[]},
23
+ swap:{type:Array,default:[]}
24
+ }
25
+ */
@@ -0,0 +1,14 @@
1
+
2
+ module.exports=[
3
+ {
4
+ name:{type:String,default:''}, //unique
5
+ type:{type:String,default:'instant'}, // instant | postpurchase | credit
6
+ unit:{type:String,default:'dollar'}, // dollar | percent
7
+ level:{type:String,default:'tier'}, // tier | solution | project
8
+ amount:{type:Number,default:0},
9
+ source:{type:String,default:''}, //needs further explaining to id the purpose
10
+ notes:{type:String,default:''},
11
+ userCreated:{type:Boolean,default:false}, //may not need, is really for gui
12
+ tiers:{type:Array,default:[]} //may not need, is really for gui
13
+ }
14
+ ]
@@ -1,8 +1,18 @@
1
+
2
+ /*
3
+ manf:[{
4
+ manufacturer:{type:String,default:''},
5
+ promoRate:{type:Number,default:''},
6
+ credit:{type:Number,default:''}
7
+ }]
8
+ */
1
9
  module.exports=[
2
10
  {
3
- code:{type:String,default:''}, // pricebook / collection name
11
+ code:{type:String,default:''}, //the financing code
4
12
  stdRate:{type:String,default:''}, // versioned | table
5
13
  pymntFactor:{type:String,default:''}, // pkid | update date?
14
+ dept:{type:Array,default:''},
15
+ term:{type:String,default:''},
6
16
  desc:{type:String,default:''},
7
17
  min:{type:Number,default:0},
8
18
  max:{type:Number,default:0},
@@ -0,0 +1,71 @@
1
+
2
+
3
+ /*
4
+ constracts = [{
5
+ contractid: contractid,
6
+ jobnum: project.jobnum || '',
7
+ jobname: project.name || '',
8
+ solname: solution.name || '',
9
+ name: solution.name || '',
10
+ version: false,
11
+ strtdate: null,
12
+ solddate: null,
13
+ sold: sold,
14
+ estimator: project.estimator || '',
15
+ dept: project.dept,
16
+ type: solution.type || '', // not editable; helps determine which templates to use [string]
17
+ path: path,
18
+ hhid: project.hhid || '', // not editable; not shown anywhere
19
+ custcode: project.custid || '', // not editable
20
+ projectid: project.id || '',
21
+ customer: { // all editable (besides longCity and fullName) [strings]
22
+ clientFirst: project.clientfirst,
23
+ clientLast: project.clientlast,
24
+ name: `${project.clientfirst} ${project.clientlast}` || project.clientfirst || project.clientlast,
25
+ street: project.street,
26
+ unit: project.unit,
27
+ city: project.city,
28
+ state: project.state,
29
+ zip: project.zip,
30
+ longCity: project.city + ', ' + project.state + ' ' + project.zip,
31
+ phone: project.phone,
32
+ email: project.email
33
+ },
34
+ general:{
35
+ net:0,
36
+ projid:'',
37
+ contractid:'',
38
+ dept:''
39
+ },
40
+ subs:[], //list
41
+ finance: {
42
+ billto: '', // editable (searchable?) [string]
43
+
44
+ net: 0, // editable [price]
45
+
46
+ downAmount: 0, // editable [price]
47
+ downDate: '', // editable [date]
48
+ downVia: '', // editable ( check number | card last 4 | cash ) [string]
49
+
50
+ financed: financed,
51
+ fincode: '', // editable [string]
52
+ finAmount: 0, // editable [price]
53
+ finTerm: 0, // referenced from fintable via finCode string [number]
54
+ finAPR: '', // referenced from fintable via finCode string [string]
55
+
56
+ dueComplete: 0 // calculation (net - downAmount- dueComplete) [price]
57
+ },
58
+ discounts: [],
59
+ additions: [],
60
+ notes: '',
61
+ terms: { // not editable; not shown on editor or preview, shown on print; gathered from table in settings [string]
62
+ financing: '',
63
+ collections: ''
64
+ },
65
+ solution: { // editablilty will depend on solution. will be blank if STANDARD contract
66
+ //windows:[]
67
+ //envelope:[]
68
+ //vhc:[]
69
+ }
70
+ }]
71
+ */
@@ -10,8 +10,12 @@ const { aaddress, acontact } = require('../../core-models.js');
10
10
  * photos:{type:Boolean},
11
11
  * scheduled:{type:Boolean}
12
12
  * }]
13
- */
14
- let pvmaint = new Schema({
13
+ */
14
+
15
+ /**
16
+ *
17
+ */
18
+ let pvmaint = {
15
19
  contractNum:{type:String,default:''},
16
20
  rewardNum:{type:String,default:''},
17
21
  jobref:{type:String,default:''},
@@ -22,9 +26,8 @@ let pvmaint = new Schema({
22
26
  state:{type:String,default:''},
23
27
  zip:{type:String,default:''},
24
28
  visits:{type:Array,default:[]}
25
-
26
- })
27
- let lead = new Schema({
29
+ }
30
+ let lead = {
28
31
  apptdate:{type:Date,default:''},
29
32
  type:{type:String,default:''},
30
33
  prstdate:{type:Date,default:''},
@@ -36,16 +39,26 @@ let lead = new Schema({
36
39
  generator:{type:String,default:''},
37
40
  soldAmount:{type:Number,default:0},
38
41
  paid:{type:Date,default:''}
39
- })
40
- let info = new Schema({
42
+ }
43
+ let info = {
41
44
  pkids:{type:Array,default:[]},
42
- siteinfo:{type:Object,default:{}},
43
- spaces:{type:Object,default:[]},
45
+ spaces:{type:Array,default:[]},
44
46
  summary:{type:Object,default:{}},
45
47
  quotes:{type:Object,default:{}},
46
48
  joblog:{type:Object,default:{}},
47
49
  pvmaint:pvmaint,
48
- })
50
+ }
51
+ /*
52
+ info.spaces = [{
53
+ * id:{type:String,default:''},
54
+ * title:{type:String,default:''}
55
+ * subspaces:{type:String,default:[{
56
+ * id:{type:String,default:''},
57
+ * title:{type:String,default:''}
58
+ * }]}
59
+ * }]]
60
+ */
61
+
49
62
  /** Projects Schema
50
63
  *
51
64
  * index
@@ -0,0 +1,38 @@
1
+ /*
2
+ Quotes are currently held in project.info.quotes={
3
+ <quoteType>:{
4
+ coid:string
5
+ type:string
6
+ solutions:array
7
+ }
8
+ }
9
+
10
+ const aquote = {
11
+ coid: 'string',
12
+ type: 'string',
13
+ solutions: []
14
+ }
15
+
16
+ const asolution = {
17
+ name: 'string',
18
+ tiers: [],
19
+ space: 'string',
20
+ subspace: 'string',
21
+ details: 'object', // ie 'access point', 'heat load'
22
+ strategy: 'string',
23
+ additions: [],
24
+ discounts: [],
25
+ summary: { // main access point to 'get' information on the quote
26
+ tiers: [], // calculated totals for each option (base + additions + discounts + etc)
27
+ path: [], // 'path' to the selected option
28
+ contractid: 'string',
29
+ finance: {}
30
+ }
31
+ }
32
+
33
+ const atier= {
34
+ name: '',
35
+ {productInfo}
36
+ }
37
+
38
+ */
@@ -1,32 +1,12 @@
1
1
 
2
- const {aaddress}=require('../../core-models.js');
3
- const wo = require('./subs/jonaswo.js')
4
- const ticketFinal = require('./subs/final.js')
2
+ const aticket = require('./subs/ticket.js')
5
3
 
6
4
  module.exports = [
7
5
  {
8
- id: { type: String, default: '' },
9
- ref: { type: Object, default: {} },
6
+ ...aticket,
10
7
  status: { type: String, default: 'active' },
11
- techs: { type: Array, default: [] },
12
- custid: {type:String, default:''},
13
- cat:{type:String,default:''},
14
- dept:{type:String,default:''},
15
- hhid:{type:String,default:''},
16
-
17
- ...aaddress,
18
8
  documents: { type: Array, default: [] },
19
-
20
- checks: { type: Array, default: [] },
21
- conform: { type: Object, default: {} },
22
- contract: { type: Object, default: {} },
23
- final: ticketFinal,
24
- repairs: { type: Array, default: [] },
25
- salesrep:{type:String,default:''},
26
- sitems: { type: Array, default: [] },
27
- wo: wo,
28
- todo:{type:Object, default: {}},
29
- office: { type: Object, default: {} },
30
- logs:{type:Array,default:[]}
31
- }
9
+ approval:{type:String,default:'WORKING'}, // WORKING | SENT | APPROVED
10
+ approvalCode:{type:String,default:''}
11
+ },{minimize:false}
32
12
  ]
@@ -20,7 +20,7 @@
20
20
 
21
21
 
22
22
  */
23
- module.exports=[{
23
+ module.export=[{
24
24
  id:{type:String,default:''},
25
25
  title:{type:String,default:''},
26
26
  desc:{type:String,default:''},
@@ -1,32 +1,10 @@
1
+ const aticket = require('./subs/ticket.js')
1
2
 
2
- const {aaddress}=require('../../core-models.js');
3
- const wo = require('./subs/jonaswo.js')
4
- const ticketFinal = require('./subs/final.js')
5
3
 
6
4
  module.exports = [
7
5
  {
8
- id: { type: String, default: '' },
9
- ref: { type: Object, default: {} },
6
+ ...aticket,
10
7
  status: { type: String, default: 'complete' }, // active, complete, archived
11
- techs: { type: Array, default: [] },
12
- custid: {type:String, default:''},
13
- cat:{type:String,default:''},
14
- dept:{type:String,default:''},
15
- hhid:{type:String,default:''},
16
- documents: { type: Array, default: [] },
17
-
18
- ...aaddress,
19
-
20
- checks: { type: Array, default: [] },
21
- conform: { type: Object, default: {} },
22
- contract: { type: Object, default: {} },
23
- final: ticketFinal,
24
- repairs: { type: Array, default: [] },
25
- salesrep:{type:String,default:''},
26
- sitems: { type: Array, default: [] },
27
- wo: wo,
28
- todo:{type:Object, default: {}}, //remove
29
- office: { type: Array, default: [] },
30
- logs:{type:Array,default:[]}
31
- }
8
+ documents: { type: Array, default: [] } //could get rid of
9
+ },{minimize:false}
32
10
  ]
@@ -1,35 +1,61 @@
1
1
  const { Schema } = require('mongoose')
2
2
 
3
- let ticketInvoice = new Schema({
3
+ let ticketInvoice = {
4
4
  total:{type:Number,default:0},
5
5
  pricelevel:{type:String,default:''}
6
- })
7
- let ticketTime = new Schema({
8
- driveTime:{type:Date,default:''},
9
- startTime:{type:Date,default:''},
10
- endTime:{type:Date,default:''},
11
- adjustTime:{type:Number,default:0},
12
- totalTime:{type:Number,default:0},
13
- repairEstimate:{type:Number,default:0},
6
+ }
7
+
8
+ let repairEstimate = {
9
+ time:{type:Number,default:0}, //time to complete all repairs
14
10
  revenuePerEstimate:{type:Number,default:0},
15
- revenuePer:{type:Number,default:0}
16
- })
11
+ revenuePer:{type:Number,default:0},
12
+ techCount:{type:Number,default:0}
13
+ }
17
14
 
18
- let ticketFinal = new Schema({
15
+ let ticketFinal = {
19
16
  showReplacement:{type:Boolean,default:false},
17
+ summary:{type:Object,default:{}}, //a static version of the presentation
20
18
  conform:{type:Object,default:{}},
21
19
  invoice:ticketInvoice,
22
20
  signature:{type:String,default:''},
23
21
  emailed:{type:Boolean,default:false},
24
- officeSubmit:{type:String,default:''},
25
22
  paymentMethod:{type:String,default:''},
26
- returnVisit:{type:Boolean,default:false},
23
+ returnVisit:{type:String,default:''}, //change to String, and attach return ticket id
27
24
  returnNotes:{type:String,default:''},
28
25
  addlDetails:{type:String,default:''},
29
26
  serviceReferral:{type:Boolean,default:false},
30
- ticketTime:ticketTime,
27
+ repairEstimate:repairEstimate, //was ticketTime
31
28
  timelog:{type:Object,default:{}},
32
- completedBy:{type:Array,default:[]}
33
- })
29
+ officeSubmit:{type:String,default:''},
30
+ completedBy:{type:Array,default:[]} //change to string, lcoaland tag with the lead who completed
31
+ }
32
+
33
+ module.exports = ticketFinal
34
34
 
35
- module.exports = ticketFinal
35
+ /*
36
+ summary = {
37
+ approved:{
38
+ name:{type:String,default:''},
39
+ signature:{type:String,default:''}
40
+ }
41
+ total:{
42
+ mprice:{type:Number,default:0},
43
+ rprice:{type:Number,default:0},
44
+ msavings:{type:Number,default:0},
45
+ rsavings:{type:Number,default:0}
46
+ }
47
+ repairs:{
48
+ <sitem.id>:[{
49
+ repair:{
50
+ task:{type:String,default:''}
51
+ appr:{type:String,default:''} // YES | NO | RETURNFOR
52
+ }
53
+ pricing:{
54
+ <pl1>:{type:Number,default:0},
55
+ <pl2>:{type:Number,default:0},
56
+ ...
57
+ }
58
+ }]
59
+ }
60
+ }
61
+ */
@@ -1,5 +1,5 @@
1
1
  const { Schema } = require('mongoose')
2
- module.exports = new Schema({
2
+ module.exports = {
3
3
  id:{type:String,default:''},
4
4
  custcode:{type:String,default:''},
5
5
  contactname:{type:String,default:''},
@@ -35,4 +35,4 @@ module.exports = new Schema({
35
35
  timecomplete:{type:String,default:''},
36
36
  datecompletesched:{type:Date,default:''},
37
37
  timecompletesched:{type:String,default:''}
38
- })
38
+ }
@@ -0,0 +1,71 @@
1
+ const {aaddress}=require('../../../core-models.js');
2
+ const wo = require('./jonaswo.js')
3
+ const ticketFinal = require('./final.js')
4
+
5
+ /* TECHINFO *
6
+ [
7
+ <user>:{
8
+ name:{type:String,default:''},
9
+ assigned:{
10
+ <sitem.id>:{
11
+ id:{type:String,default:''}, //the service item id
12
+ name:{type:String,default:''},
13
+ type:{type:String,default:''}, //describes the
14
+ done:{type:String,default:false} //WORKING | READY | COMPLETE
15
+ work:{type:Array,default:[{
16
+ id:{type:String,default:''}, //the service item id
17
+ name:{type:String,default:''},
18
+ type:{type:String,default:''}, //describes the
19
+ done:{type:String,default:false} //WORKING | READY | COMPLETE
20
+ }]}
21
+ }
22
+ }]},
23
+ driveTime:{type:Date,default:''},
24
+ startTime:{type:Date,default:''},
25
+ endTime:{type:Date,default:''},
26
+ adjustTime:{type:Number,default:0},
27
+ totalTime:{type:Number,default:0}
28
+ revenue:{
29
+ perHour:{type:Number,default:0}, //techs revenue per hour based on their repairs
30
+ contribution:{type:Number,default:0} //the portion of revenue the tech worked on
31
+ }
32
+ }
33
+ ]
34
+ */
35
+
36
+ /*
37
+ sitems = [{
38
+ id:{type:String,default:''}
39
+ descr:{type:String,default:''}
40
+ needReplace:{type:Boolean:default:false}
41
+ }]
42
+ */
43
+ module.exports = {
44
+ id: { type: String, default: '' },
45
+ ref: { type: Object, default: {} },
46
+ custid: {type:String, default:''},
47
+ cat:{type:String,default:''}, //converted cat from jonas. Orginal cat can be found in wo.cat
48
+ dept:{type:String,default:''},
49
+
50
+ techs: { type: Array, default: [] },
51
+ techinfo: {type:Object, default:{}}, //hold all info on techs involved
52
+ salesrep:{type:String,default:''},
53
+
54
+ hhid:{type:String,default:''},
55
+ ...aaddress, //do not need?
56
+
57
+ checks: { type: Object, default: {} },
58
+ repairs: { type: Object, default: {} },
59
+ sitems: { type: Array, default: [] },
60
+
61
+ todo: {type:Object,default:{}},//used for all todos in workflow.
62
+ //remove the following and merge into 'todo' with a type
63
+ office: { type: Object, default: {} },//any todo items for the office
64
+ field: {type:Object,default:{}},//any todo items for the field
65
+
66
+ final: ticketFinal,
67
+ contract: { type: Object, default: {} }, // the contract attached to the client. Should move off of WO into separate query
68
+
69
+ wo: wo,
70
+ logs:{type:Array,default:[]} //match with project datelog. Would like it to stay as "logs" though
71
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vhp-mongo-models",
3
- "version": "1.7.3",
3
+ "version": "2.0.1",
4
4
  "productName": "VHP Mongo Models",
5
5
  "description": "Mongo Models library to setup Mongoose Schemas",
6
6
  "author": "VHPim",