From c3d04ba6a218f53c677a62f67d9f64292f98b146 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 27 Jul 2021 15:29:45 +0000 Subject: [PATCH] --- ayanova/src/views/svc-quote.vue | 590 +++++++++++++++++++++++++++- ayanova/src/views/svc-workorder.vue | 11 - 2 files changed, 588 insertions(+), 13 deletions(-) diff --git a/ayanova/src/views/svc-quote.vue b/ayanova/src/views/svc-quote.vue index 343b0696..6d497682 100644 --- a/ayanova/src/views/svc-quote.vue +++ b/ayanova/src/views/svc-quote.vue @@ -610,13 +610,599 @@ export default { }); }, generateWorkOrder() { + let cp = JSON.parse(JSON.stringify(this.obj)); + cp.states = []; + // console.log("source", this.obj); + // console.log("copy", cp); + //console.log("From quote", JSON.stringify(this.obj, null, 5)); + //FROM QUOTE + //TODO: + //delete quote specific fields, set fromQuoteId, add a default state for new wo from global settings, add partrequests empty collection and any missing servicewo stuff + //handle copy wiki and copy attachments (somehow for attachments, maybe set a flag on first save if success it then triggers an attachment route that copies attachments to another object so not duped in system) + + /* + { + "id": 4, + "concurrency": 12138458, + "serial": 4, + "notes": "Consequatur quibusdam inventore et adipisci quia non ducimus.", + "wiki": null, + "customFields": null, + "tags": [ + "black", + "violet", + "zebra", + "zone1", + "zone7" + ], + "preparedById": 12, + "preparedByViz": "Christopher McLaughlin - Sales", + "introduction": null, + "requested": "2020-11-15T18:00:00Z", + "validUntil": null, + "submitted": null, + "approved": null, + "copyWiki": false, + "copyAttachments": false, + "customerId": 35, + "customerViz": "McDermott Inc", + "customerTechNotesViz": null, + "projectId": 2, + "projectViz": "Blue Drive", + "internalReferenceNumber": "irf-4019", + "customerReferenceNumber": "crf-7302", + "customerContactName": null, + "createdDate": "2020-11-17T18:00:00Z", + "onsite": false, + "contractId": null, + "contractViz": "-", + "lastStatusId": 3, + "postAddress": "340 Kenya Freeway", + "postCity": "Lake Jenniferberg", + "postRegion": "New Mexico", + "postCountry": "Swaziland", + "postCode": "24673", + "address": "3540 Domenico Harbor", + "city": "Walkerburgh", + "region": "Vermont", + "country": "French Guiana", + "latitude": 33.3498, + "longitude": 136.711, + "items": [ + { + "id": 8, + "concurrency": 12138458, + "notes": "itemnotes - 0 ", + "wiki": null, + "customFields": null, + "tags": [], + "quoteId": 4, + "techNotes": "technotes - 0", + "workOrderItemStatusId": 1, + "workOrderItemPriorityId": 3, + "requestDate": "2020-11-17T18:00:00Z", + "warrantyService": false, + "sequence": 1, + "expenses": [ + { + "id": 15, + "concurrency": 12138458, + "description": null, + "name": "Refined Granite Mouse", + "totalCost": 0, + "chargeAmount": 6.573587728745111, + "taxPaid": 0, + "chargeTaxCodeId": 2, + "taxCodeViz": "Goods only", + "reimburseUser": true, + "userId": 10, + "userViz": "Marietta Predovic - Tech", + "chargeToCustomer": true, + "taxAViz": 0.46015114101215776, + "taxBViz": 0, + "lineTotalViz": 7.0337388697572685, + "quoteItemId": 8, + "uid": 0, + "isDirty": false + }, + { + "id": 16, + "concurrency": 12138458, + "description": null, + "name": "Generic Frozen Chicken", + "totalCost": 0, + "chargeAmount": 12.05157750269937, + "taxPaid": 0, + "chargeTaxCodeId": 2, + "taxCodeViz": "Goods only", + "reimburseUser": true, + "userId": 25, + "userViz": "Kylie Cummings", + "chargeToCustomer": true, + "taxAViz": 0.8436104251889559, + "taxBViz": 0, + "lineTotalViz": 12.895187927888326, + "quoteItemId": 8, + "uid": 1, + "isDirty": false + } + ], + "labors": [ + { + "id": 15, + "concurrency": 12138458, + "userId": 10, + "userViz": "Marietta Predovic - Tech", + "serviceStartDate": "2020-11-17T18:00:00Z", + "serviceStopDate": "2020-11-17T19:00:00Z", + "serviceRateId": 4, + "serviceRateViz": "Grey SE", + "serviceDetails": "Pariatur fuga consequatur aut sunt sit.", + "serviceRateQuantity": 1, + "noChargeQuantity": 0, + "taxCodeSaleId": null, + "taxCodeViz": null, + "priceOverride": null, + "costViz": 10.770141533119652, + "listPriceViz": 16.693719376335462, + "unitOfMeasureViz": "hour", + "priceViz": 16.693719376335462, + "netViz": 16.693719376335462, + "taxAViz": 0, + "taxBViz": 0, + "lineTotalViz": 16.693719376335462, + "quoteItemId": 8, + "uid": 0, + "isDirty": false + }, + { + "id": 16, + "concurrency": 12138458, + "userId": 10, + "userViz": "Marietta Predovic - Tech", + "serviceStartDate": "2020-11-17T18:00:00Z", + "serviceStopDate": "2020-11-17T19:00:00Z", + "serviceRateId": 3, + "serviceRateViz": "Gold service rate", + "serviceDetails": "Ut quis reiciendis.", + "serviceRateQuantity": 2, + "noChargeQuantity": 0, + "taxCodeSaleId": null, + "taxCodeViz": null, + "priceOverride": null, + "costViz": 34.748667749575645, + "listPriceViz": 53.86043501184225, + "unitOfMeasureViz": "hour", + "priceViz": 53.86043501184225, + "netViz": 107.7208700236845, + "taxAViz": 0, + "taxBViz": 0, + "lineTotalViz": 107.7208700236845, + "quoteItemId": 8, + "uid": 1, + "isDirty": false + } + ], + "loans": [ + { + "id": 15, + "concurrency": 12138466, + "notes": null, + "outDate": "2020-11-17T19:00:00Z", + "dueDate": "2020-11-17T22:00:00Z", + "returnDate": null, + "taxCodeId": null, + "taxCodeViz": null, + "loanUnitId": 3, + "loanUnitViz": "Tasty Fresh Salad", + "quantity": 4, + "rate": 1, + "cost": 3.506511063783668, + "listPrice": 7.013022127567336, + "priceOverride": null, + "unitOfMeasureViz": "Hourly charge", + "priceViz": 7.013022127567336, + "netViz": 28.052088510269343, + "taxAViz": 0, + "taxBViz": 0, + "lineTotalViz": 28.052088510269343, + "quoteItemId": 8, + "uid": 0, + "isDirty": false + }, + { + "id": 16, + "concurrency": 12138466, + "notes": null, + "outDate": "2020-11-17T20:00:00Z", + "dueDate": "2020-11-17T21:00:00Z", + "returnDate": null, + "taxCodeId": null, + "taxCodeViz": null, + "loanUnitId": 5, + "loanUnitViz": "Intelligent Rubber Cheese", + "quantity": 1, + "rate": 1, + "cost": 7.68581946715052, + "listPrice": 15.37163893430104, + "priceOverride": null, + "unitOfMeasureViz": "Hourly charge", + "priceViz": 15.37163893430104, + "netViz": 15.37163893430104, + "taxAViz": 0, + "taxBViz": 0, + "lineTotalViz": 15.37163893430104, + "quoteItemId": 8, + "uid": 1, + "isDirty": false + } + ], + "parts": [ + { + "id": 15, + "concurrency": 12138466, + "description": null, + "serials": null, + "partId": 16, + "partViz": "263002", + "partNameViz": null, + "upcViz": "5221801332083", + "partWarehouseId": 1, + "partWarehouseViz": "Default", + "quantity": 1, + "taxPartSaleId": null, + "taxCodeViz": null, + "cost": 6.826005048037504, + "listPrice": 8.191206057645005, + "priceOverride": null, + "unitOfMeasureViz": "each", + "priceViz": 8.191206057645005, + "netViz": 8.191206057645005, + "taxAViz": 0, + "taxBViz": 0, + "lineTotalViz": 8.191206057645005, + "quoteItemId": 8, + "uid": 0, + "isDirty": false + }, + { + "id": 16, + "concurrency": 12138466, + "description": null, + "serials": null, + "partId": 12, + "partViz": "416847", + "partNameViz": null, + "upcViz": "9785963001011", + "partWarehouseId": 1, + "partWarehouseViz": "Default", + "quantity": 1, + "taxPartSaleId": null, + "taxCodeViz": null, + "cost": 20.829316122377897, + "listPrice": 24.995179346853476, + "priceOverride": null, + "unitOfMeasureViz": "each", + "priceViz": 24.995179346853476, + "netViz": 24.995179346853476, + "taxAViz": 0, + "taxBViz": 0, + "lineTotalViz": 24.995179346853476, + "quoteItemId": 8, + "uid": 1, + "isDirty": false + } + ], + "scheduledUsers": [ + { + "id": 21, + "concurrency": 12138458, + "userId": 10, + "userViz": "Marietta Predovic - Tech", + "estimatedQuantity": 2, + "startDate": "2020-11-17T18:00:00Z", + "stopDate": "2020-11-17T19:00:00Z", + "serviceRateId": null, + "serviceRateViz": null, + "quoteItemId": 8, + "uid": 0, + "isDirty": false + }, + { + "id": 22, + "concurrency": 12138458, + "userId": 10, + "userViz": "Marietta Predovic - Tech", + "estimatedQuantity": 1, + "startDate": "2020-11-17T18:00:00Z", + "stopDate": "2020-11-17T19:00:00Z", + "serviceRateId": null, + "serviceRateViz": null, + "quoteItemId": 8, + "uid": 1, + "isDirty": false + } + ], + "tasks": [ + { + "id": 36, + "concurrency": 12138458, + "sequence": 1, + "task": "Dis-assemble", + "status": 1, + "statusViz": "To Do", + "completedByUserId": 10, + "completedByUserViz": "Marietta Predovic - Tech", + "completedDate": null, + "quoteItemId": 8, + "uid": 0, + "isDirty": false + }, + { + "id": 37, + "concurrency": 12138458, + "sequence": 2, + "task": "Lubricate", + "status": 1, + "statusViz": "To Do", + "completedByUserId": 10, + "completedByUserViz": "Marietta Predovic - Tech", + "completedDate": null, + "quoteItemId": 8, + "uid": 1, + "isDirty": false + }, + { + "id": 38, + "concurrency": 12138458, + "sequence": 3, + "task": "Repair", + "status": 1, + "statusViz": "To Do", + "completedByUserId": 10, + "completedByUserViz": "Marietta Predovic - Tech", + "completedDate": null, + "quoteItemId": 8, + "uid": 2, + "isDirty": false + }, + { + "id": 39, + "concurrency": 12138458, + "sequence": 4, + "task": "Re-assemble", + "status": 1, + "statusViz": "To Do", + "completedByUserId": 10, + "completedByUserViz": "Marietta Predovic - Tech", + "completedDate": null, + "quoteItemId": 8, + "uid": 3, + "isDirty": false + }, + { + "id": 40, + "concurrency": 12138458, + "sequence": 5, + "task": "Test and confirm repair", + "status": 1, + "statusViz": "To Do", + "completedByUserId": 10, + "completedByUserViz": "Marietta Predovic - Tech", + "completedDate": null, + "quoteItemId": 8, + "uid": 4, + "isDirty": false + } + ], + "travels": [ + { + "id": 15, + "concurrency": 12138458, + "userId": 10, + "userViz": "Marietta Predovic - Tech", + "travelStartDate": "2020-11-17T18:00:00Z", + "travelStopDate": "2020-11-17T19:00:00Z", + "travelRateId": 5, + "travelRateViz": "Olive FI", + "travelDetails": "Qui suscipit odit est maiores aliquam est repellendus accusamus blanditiis.", + "travelRateQuantity": 1, + "noChargeQuantity": 0, + "taxCodeSaleId": null, + "taxCodeViz": null, + "distance": 19.96074, + "priceOverride": null, + "costViz": 8.513512329553956, + "listPriceViz": 17.027024659107912, + "unitOfMeasureViz": "miles", + "priceViz": 17.027024659107912, + "netViz": 17.027024659107912, + "taxAViz": 0, + "taxBViz": 0, + "lineTotalViz": 17.027024659107912, + "quoteItemId": 8, + "uid": 0, + "isDirty": false + }, + { + "id": 16, + "concurrency": 12138458, + "userId": 25, + "userViz": "Kylie Cummings", + "travelStartDate": "2020-11-17T18:00:00Z", + "travelStopDate": "2020-11-17T19:00:00Z", + "travelRateId": 1, + "travelRateViz": "Bronze travel rate", + "travelDetails": "Dolorem similique magnam necessitatibus qui.", + "travelRateQuantity": 2, + "noChargeQuantity": 0, + "taxCodeSaleId": null, + "taxCodeViz": null, + "distance": 8.55441, + "priceOverride": null, + "costViz": 7.558098912964622, + "listPriceViz": 15.116197825929245, + "unitOfMeasureViz": "hours", + "priceViz": 15.116197825929245, + "netViz": 30.23239565185849, + "taxAViz": 0, + "taxBViz": 0, + "lineTotalViz": 30.23239565185849, + "quoteItemId": 8, + "uid": 1, + "isDirty": false + } + ], + "units": [ + { + "id": 15, + "concurrency": 12138458, + "notes": "Sunt et qui maxime consectetur sequi tenetur quibusdam eveniet.", + "wiki": null, + "customFields": null, + "tags": [], + "unitId": 678, + "unitViz": "23562179", + "quoteItemId": 8, + "unitModelNameViz": "Fortwo Kids", + "unitModelVendorViz": "Will - O'Conner", + "unitModelModelNumberViz": "180937", + "unitDescriptionViz": "Unbranded Cotton Pizza", + "addressViz": null, + "cityViz": null, + "regionViz": null, + "countryViz": null, + "latitudeViz": null, + "longitudeViz": null, + "uid": 0, + "isDirty": false, + "warrantyViz": null + }, + { + "id": 16, + "concurrency": 12138458, + "notes": "Aut voluptas nostrum qui libero aliquam vel ipsam et fugiat.", + "wiki": null, + "customFields": null, + "tags": [], + "unitId": 667, + "unitViz": "98744314", + "quoteItemId": 8, + "unitModelNameViz": "Durango Industrial", + "unitModelVendorViz": "Mohr LLC", + "unitModelModelNumberViz": "671576", + "unitDescriptionViz": "Small Cotton Shirt", + "addressViz": null, + "cityViz": null, + "regionViz": null, + "countryViz": null, + "latitudeViz": null, + "longitudeViz": null, + "uid": 1, + "isDirty": false, + "warrantyViz": null + } + ], + "outsideServices": [ + { + "id": 15, + "concurrency": 12138458, + "notes": "Nihil rerum dolore occaecati dolor vitae.", + "unitId": 678, + "unitViz": "23562179", + "vendorSentToId": 4, + "vendorSentToViz": "Willms Inc", + "vendorSentViaId": 15, + "vendorSentViaViz": "Rath - Romaguera", + "rmaNumber": "RMA075820", + "trackingNumber": "TR61563544", + "repairCost": 188.89254137822056, + "repairPrice": 283.3388120673308, + "shippingCost": 11.20520115187634, + "shippingPrice": 16.80780172781451, + "sentDate": "2020-11-17T18:00:00Z", + "etaDate": "2020-11-24T18:00:00Z", + "returnDate": "2020-11-25T18:00:00Z", + "taxCodeId": 1, + "taxCodeViz": "Services only", + "costViz": 200.0977425300969, + "priceViz": 300.14661379514536, + "netViz": 300.14661379514536, + "taxAViz": 15.007330689757266, + "taxBViz": 0, + "lineTotalViz": 315.1539444849026, + "quoteItemId": 8, + "uid": 0, + "isDirty": false + }, + { + "id": 16, + "concurrency": 12138458, + "notes": "Accusantium harum eos sunt blanditiis enim eos.", + "unitId": 672, + "unitViz": "28293051", + "vendorSentToId": 8, + "vendorSentToViz": "Nikolaus LLC", + "vendorSentViaId": 14, + "vendorSentViaViz": "Dooley Inc", + "rmaNumber": "RMA790082", + "trackingNumber": "TR64537989", + "repairCost": 485.5620948763388, + "repairPrice": 728.3431423145082, + "shippingCost": 18.26009206159976, + "shippingPrice": 27.39013809239964, + "sentDate": "2020-11-17T18:00:00Z", + "etaDate": "2020-11-24T18:00:00Z", + "returnDate": "2020-11-25T18:00:00Z", + "taxCodeId": 1, + "taxCodeViz": "Services only", + "costViz": 503.82218693793857, + "priceViz": 755.7332804069079, + "netViz": 755.7332804069079, + "taxAViz": 37.78666402034539, + "taxBViz": 0, + "lineTotalViz": 793.5199444272532, + "quoteItemId": 8, + "uid": 1, + "isDirty": false + } + ], + "uid": 0, + "isDirty": false + } + ], + "states": [ + { + "id": 4, + "concurrency": 12138458, + "quoteId": 4, + "quoteStatusId": 3, + "created": "2020-11-17T18:05:00Z", + "userId": 25, + "userViz": "Kylie Cummings" + } + ], + "isLockedAtServer": false, + "alertViz": null, + "isCompleteRecord": true, + "userIsRestrictedType": false, + "userIsTechRestricted": false, + "userIsSubContractorFull": false, + "userIsSubContractorRestricted": false, + "userCanViewPartCosts": true, + "userCanViewLaborOrTravelRateCosts": true, + "userCanViewLoanerCosts": true, + "isDirty": false +} + + */ + //Navigate to new record this.$router.push({ name: "workorder-edit", params: { recordid: 0, - obj: this.obj, - fromQuote: true + obj: cp } }); }, diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index 1b8a418b..a83d4239 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -100,17 +100,6 @@ export default { //DUPLICATE OR GEN FROM QUOTE OR PM this.obj = this.$route.params.obj; - if (this.$route.params.fromQuote) { - //FROM QUOTE - //TODO: - //delete quote specific fields, set fromQuoteId, add a default state for new wo from global settings, add partrequests empty collection and any missing servicewo stuff - //handle copy wiki and copy attachments (somehow for attachments, maybe set a flag on first save if success it then triggers an attachment route that copies attachments to another object so not duped in system) - } else if (this.$route.params.fromPM) { - //FROM PM - //TODO: - //delete pm specific fields, set fromPMId, add a default state for new wo from global settings, add partrequests empty collection - } - this.obj.concurrency = undefined; this.obj.id = 0; this.obj.serial = 0;