- the great reformat

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-02-06 18:20:58 -05:00
parent 30c530bcc4
commit e83badb454
912 changed files with 108516 additions and 107493 deletions

View File

@@ -72,7 +72,7 @@ jobs:
command: npm i
- run: npm run build
- aws-cli/setup:
aws_access_key_id: AWS_ACCESS_KEY_ID
aws_secret_access_key: AWS_SECRET_ACCESS_KEY

View File

@@ -8,7 +8,6 @@
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"

1
.vscode/launch.json vendored
View File

@@ -8,7 +8,6 @@
"type": "pwa-chrome",
"webRoot": "${workspaceFolder}/client/src"
},
{
"name": "Chrome",
"type": "chrome",

View File

@@ -6,8 +6,9 @@ npx deadfile ./src/index.js --exclude build templates
#Crushing all hasura migrations by creating a new initialization from the server.
hasura migrate create "Init" --from-server --endpoint https://db.imex.online/ --admin-secret 'Production-ImEXOnline!@#'
hasura migrate apply --version "1620771761757" --skip-execution --endpoint https://db.imex.online/ --admin-secret 'Production-ImEXOnline!@#'
hasura migrate apply --version "1620771761757" --skip-execution --endpoint https://db.imex.online/ --admin-secret '
Production-ImEXOnline!@#'
hasura migrate status --endpoint https://db.imex.online/ --admin-secret 'Production-ImEXOnline!@#'
Generate the license file:
Generate the license file:
$ generate-license-file --input package.json --output third-party-licenses.txt --overwrite

View File

@@ -1,5 +1,4 @@
Ensure following environment variables are set:
Ensure following environment variables are set:
__S3 Related__
AWSAccessKeyId=

View File

@@ -16,9 +16,11 @@ jsreport configure
sudo apt-get install -y libgconf-2-4
sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >>
/etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst --no-install-recommends
sudo apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst
--no-install-recommends
# on ubuntu 20 run also

View File

@@ -6,7 +6,9 @@
</div>
_I recommend [Mrm](https://github.com/sapegin/mrm-tasks/tree/master/packages/mrm-task-jest) and [jest-codemods](https://github.com/skovhus/jest-codemods) for single-command Jest installation and easy migration from other frameworks._
_I recommend [Mrm](https://github.com/sapegin/mrm-tasks/tree/master/packages/mrm-task-jest)
and [jest-codemods](https://github.com/skovhus/jest-codemods) for single-command Jest installation and easy migration
from other frameworks._
<!-- To reformat run: npx prettier --print-width 100 --single-quote --no-semi --prose-wrap never --write Readme.md -->
@@ -16,31 +18,31 @@ _I recommend [Mrm](https://github.com/sapegin/mrm-tasks/tree/master/packages/mrm
- [Test structure](#test-structure)
- [Matchers](#matchers)
- [Basic matchers](#basic-matchers)
- [Truthiness](#truthiness)
- [Numbers](#numbers)
- [Strings](#strings)
- [Arrays](#arrays)
- [Objects](#objects)
- [Exceptions](#exceptions)
- [Snapshots](#snapshots)
- [Mock functions](#mock-functions)
- [Misc](#misc)
- [Promise matchers (Jest 20+)](#promise-matchers-jest-20)
- [Basic matchers](#basic-matchers)
- [Truthiness](#truthiness)
- [Numbers](#numbers)
- [Strings](#strings)
- [Arrays](#arrays)
- [Objects](#objects)
- [Exceptions](#exceptions)
- [Snapshots](#snapshots)
- [Mock functions](#mock-functions)
- [Misc](#misc)
- [Promise matchers (Jest 20+)](#promise-matchers-jest-20)
- [Async tests](#async-tests)
- [async/await](#asyncawait)
- [Promises](#promises)
- [done() callback](#done-callback)
- [async/await](#asyncawait)
- [Promises](#promises)
- [done() callback](#done-callback)
- [Mocks](#mocks)
- [Mock functions](#mock-functions-1)
- [Mock modules using jest.mock method](#mock-modules-using-jestmock-method)
- [Mock modules using a mock file](#mock-modules-using-a-mock-file)
- [Mock object methods](#mock-object-methods)
- [Mock getters and setters (Jest 22.1.0+)](#mock-getters-and-setters-jest-2210)
- [Mock getters and setters](#mock-getters-and-setters)
- [Clearing and restoring mocks](#clearing-and-restoring-mocks)
- [Accessing the original module when using mocks](#accessing-the-original-module-when-using-mocks)
- [Timer mocks](#timer-mocks)
- [Mock functions](#mock-functions-1)
- [Mock modules using jest.mock method](#mock-modules-using-jestmock-method)
- [Mock modules using a mock file](#mock-modules-using-a-mock-file)
- [Mock object methods](#mock-object-methods)
- [Mock getters and setters (Jest 22.1.0+)](#mock-getters-and-setters-jest-2210)
- [Mock getters and setters](#mock-getters-and-setters)
- [Clearing and restoring mocks](#clearing-and-restoring-mocks)
- [Accessing the original module when using mocks](#accessing-the-original-module-when-using-mocks)
- [Timer mocks](#timer-mocks)
- [Data-driven tests (Jest 23+)](#data-driven-tests-jest-23)
- [Skipping tests](#skipping-tests)
- [Testing modules with side effects](#testing-modules-with-side-effects)
@@ -205,8 +207,8 @@ expect(fn.mock.calls[0][0]).toBe(2) // fn.mock.calls[0][0] — the first argumen
- `nthCalledWith``toHaveBeenNthCalledWith`
- `toReturnTimes``toHaveReturnedTimes`
- `toReturnWith``toHaveReturnedWith`
- `lastReturnedWith` `toHaveLastReturnedWith`
- `nthReturnedWith` `toHaveNthReturnedWith`
- `lastReturnedWith``toHaveLastReturnedWith`
- `nthReturnedWith``toHaveNthReturnedWith`
</details>
### Misc
@@ -244,7 +246,8 @@ test('resolve to lemon', async () => {
See [more examples](https://facebook.github.io/jest/docs/en/tutorial-async.html) in Jest docs.
Its a good practice to specify a number of expected assertions in async tests, so the test will fail if your assertions werent called at all.
Its a good practice to specify a number of expected assertions in async tests, so the test will fail if your assertions
werent called at all.
```js
test('async test', () => {
@@ -343,23 +346,25 @@ jest.mock('lodash/memoize', () => a => a, { virtual: true }) // The original lod
[jest.mock docs](https://facebook.github.io/jest/docs/jest-object.html#jestmockmodulename-factory-options)
> Note: When using `babel-jest`, calls to `jest.mock` will automatically be hoisted to the top of the code block. Use `jest.doMock` if you want to explicitly avoid this behavior.
> Note: When using `babel-jest`, calls to `jest.mock` will automatically be hoisted to the top of the code block.
> Use `jest.doMock` if you want to explicitly avoid this behavior.
### Mock modules using a mock file
1. Create a file like `__mocks__/lodash/memoize.js`:
1. Create a file like `__mocks__/lodash/memoize.js`:
```js
module.exports = a => a
```
```js
module.exports = a => a
```
2. Add to your test:
2. Add to your test:
```js
jest.mock('lodash/memoize')
```
```js
jest.mock('lodash/memoize')
```
> Note: When using `babel-jest`, calls to `jest.mock` will automatically be hoisted to the top of the code block. Use `jest.doMock` if you want to explicitly avoid this behavior.
> Note: When using `babel-jest`, calls to `jest.mock` will automatically be hoisted to the top of the code block.
> Use `jest.doMock` if you want to explicitly avoid this behavior.
[Manual mocks docs](https://facebook.github.io/jest/docs/manual-mocks.html)
@@ -407,7 +412,7 @@ fn.mockReset() // Clears and removes any mocked return values or implementations
fn.mockRestore() // Resets and restores the initial implementation
```
> Note: `mockRestore` works only with mocks created by `jest.spyOn`.
> Note: `mockRestore`works only with mocks created by `jest.spyOn`.
For all mocks:
@@ -427,7 +432,8 @@ const fs = require.requireActual('fs') // Original module
### Timer mocks
Write synchronous test for code that uses native timer functions (`setTimeout`, `setInterval`, `clearTimeout`, `clearInterval`).
Write synchronous test for code that uses native timer
functions (`setTimeout`, `setInterval`, `clearTimeout`, `clearInterval`).
```js
// Enable fake timers
@@ -471,7 +477,7 @@ test.each`
})
```
Or on `describe` level:
Or on `describe` level:
```js
describe.each([['mobile'], ['tablet'], ['desktop']])('checkout flow on %s', (viewport) => {
@@ -481,7 +487,7 @@ describe.each([['mobile'], ['tablet'], ['desktop']])('checkout flow on %s', (vie
})
```
[describe.each() docs](https://jestjs.io/docs/en/api.html#describeeachtablename-fn-timeout), [test.each() docs](https://jestjs.io/docs/en/api.html#testeachtablename-fn-timeout),
[describe.each() docs](https://jestjs.io/docs/en/api.html#describeeachtablename-fn-timeout), [test.each() docs](https://jestjs.io/docs/en/api.html#testeachtablename-fn-timeout),
## Skipping tests
@@ -501,7 +507,8 @@ tests.only('make each pony pink'...
## Testing modules with side effects
Node.js and Jest will cache modules you `require`. To test modules with side effects youll need to reset the module registry between tests:
Node.js and Jest will cache modules you `require`. To test modules with side effects youll need to reset the module
registry between tests:
```js
const modulePath = '../module-to-test'
@@ -525,7 +532,8 @@ test('second text', () => {
## Usage with Babel and TypeScript
Add [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jest) or [ts-jest](https://github.com/kulshekhar/ts-jest). Check their docs for installation instructions.
Add [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jest)
or [ts-jest](https://github.com/kulshekhar/ts-jest). Check their docs for installation instructions.
## Resources
@@ -536,10 +544,14 @@ Add [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jes
- [Effective Snapshot Testing](https://blog.kentcdodds.com/effective-snapshot-testing-e0d1a2c28eca) by Kent C. Dodds
- [Migrating to Jest](https://medium.com/@kentcdodds/migrating-to-jest-881f75366e7e#.pc4s5ut6z) by Kent C. Dodds
- [Migrating AVA to Jest](http://browniefed.com/blog/migrating-ava-to-jest/) by Jason Brown
- [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest) by Will Stern
- [Testing React Intl components with Jest and Enzyme](https://medium.com/@sapegin/testing-react-intl-components-with-jest-and-enzyme-f9d43d9c923e) by Artem Sapegin
- [Testing with Jest: 15 Awesome Tips and Tricks](https://medium.com/@stipsan/testing-with-jest-15-awesome-tips-and-tricks-42150ec4c262) by Stian Didriksen
- Taking Advantage of Jest Matchers by Ben McCormick: [Part 1](https://benmccormick.org/2017/08/15/jest-matchers-1/), [Part 2](https://benmccormick.org/2017/09/04/jest-matchers-2/)
- [How to Test React and MobX with Jest](https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest)
by Will Stern
- [Testing React Intl components with Jest and Enzyme](https://medium.com/@sapegin/testing-react-intl-components-with-jest-and-enzyme-f9d43d9c923e)
by Artem Sapegin
- [Testing with Jest: 15 Awesome Tips and Tricks](https://medium.com/@stipsan/testing-with-jest-15-awesome-tips-and-tricks-42150ec4c262)
by Stian Didriksen
- Taking Advantage of Jest Matchers by Ben
McCormick: [Part 1](https://benmccormick.org/2017/08/15/jest-matchers-1/), [Part 2](https://benmccormick.org/2017/09/04/jest-matchers-2/)
---
@@ -559,6 +571,8 @@ This software has been developed with lots of coffee, buy me one more cup to kee
## Author and license
[Artem Sapegin](http://sapegin.me/), a frontend engineer at [Omio](https://omio.com/) and the creator of [React Styleguidist](https://react-styleguidist.js.org/). I also write about frontend at [my blog](https://blog.sapegin.me/).
[Artem Sapegin](http://sapegin.me/), a frontend engineer at [Omio](https://omio.com/) and the creator
of [React Styleguidist](https://react-styleguidist.js.org/). I also write about frontend
at [my blog](https://blog.sapegin.me/).
CC0 1.0 Universal license, see the included [License.md](/License.md) file.

View File

@@ -46,7 +46,8 @@ $ hasura migrate create "init" --from-server
## mark the migration as applied on this server
$ hasura migrate apply --version "<version>" --skip-execution
If you are using schemas other than public, use --schema "schema_name" flag to indicate each one of them in the create command. This flag can be used multiple times. See more details about the usage in the docs.
If you are using schemas other than public, use --schema "schema_name" flag to indicate each one of them in the create
command. This flag can be used multiple times. See more details about the usage in the docs.
Step 4: Verify the status
Execute the following command to verify status of migration:
@@ -54,4 +55,5 @@ Execute the following command to verify status of migration:
$ hasura migrate status
You have brand new migrations now!
This can also be used to combine (kind of squash) all of your migration files into a single one. You're snapshotting the state of a server and adding it as a new migration.
This can also be used to combine (kind of squash) all of your migration files into a single one. You're snapshotting the
state of a server and adding it as a new migration.

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:for-each select="//TranslatedData">
<xsl:element name="TranslatedData">
@@ -8,23 +8,23 @@
</xsl:attribute>
<xsl:choose>
<xsl:when test="Details/@PrgID">
<xsl:copy-of select="Details" />
<xsl:copy-of select="Details"/>
</xsl:when>
<xsl:otherwise>
<xsl:element name="Details">
<xsl:attribute name="PrgID">OECTrans.ImportTrans</xsl:attribute>
<xsl:for-each select="Details/@*">
<xsl:copy-of select="." />
<xsl:copy-of select="."/>
</xsl:for-each>
<xsl:for-each select="Details/*">
<xsl:copy-of select="." />
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
<xsl:element name="Header">
<xsl:attribute name="RONum">
<xsl:value-of select="//Envelope/@RONum" />
<xsl:value-of select="//Envelope/@RONum"/>
</xsl:attribute>
<xsl:attribute name="OwnerFName">
<xsl:value-of select="//Admin/@OwnerF"/>
@@ -33,49 +33,49 @@
<xsl:value-of select="//Admin/@OwnerL"/>
</xsl:attribute>
<xsl:attribute name="VIN">
<xsl:value-of select="//Vehicle/@TransVIN" />
<xsl:value-of select="//Vehicle/@TransVIN"/>
</xsl:attribute>
<xsl:attribute name="Mileage">
<xsl:value-of select="//Vehicle/@TransMileage" />
<xsl:value-of select="//Vehicle/@TransMileage"/>
</xsl:attribute>
<xsl:attribute name="Year">
<xsl:value-of select="//Vehicle/@TransYear" />
<xsl:value-of select="//Vehicle/@TransYear"/>
</xsl:attribute>
<xsl:attribute name="Make">
<xsl:if test="//Vehicle/@ManufName[. != '']" >
<xsl:if test="//Vehicle/@ManufName[. != '']">
<xsl:choose>
<xsl:when test="//Vehicle/@ManufName[. = 'Geo']">CHEV</xsl:when>
<xsl:when test="//Vehicle/@ManufName[. = 'Chev-GMC Truck']">CHEV</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Vehicle/@ManufName" />
<xsl:value-of select="//Vehicle/@ManufName"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="//Vehicle/@ManufName[. = '']" >
<xsl:value-of select="//Vehicle/@ManufCode" />
<xsl:if test="//Vehicle/@ManufName[. = '']">
<xsl:value-of select="//Vehicle/@ManufCode"/>
</xsl:if>
</xsl:attribute>
<xsl:attribute name="Model">
<xsl:value-of select="//Vehicle/@TransModel" />
<xsl:value-of select="//Vehicle/@TransModel"/>
</xsl:attribute>
<xsl:attribute name="Description">
<xsl:value-of select="//Vehicle/@TransYear" />
<xsl:text> </xsl:text>
<xsl:value-of select="//Vehicle/@ManufName" />
<xsl:text> </xsl:text>
<xsl:value-of select="//Vehicle/@TransModel" />
<xsl:value-of select="//Vehicle/@TransYear"/>
<xsl:text></xsl:text>
<xsl:value-of select="//Vehicle/@ManufName"/>
<xsl:text></xsl:text>
<xsl:value-of select="//Vehicle/@TransModel"/>
</xsl:attribute>
<xsl:attribute name="LastSupplLevel">
<xsl:choose>
<xsl:when test="//Envelope/@TransactionType = 'E'">0</xsl:when>
<xsl:when test="substring(//Envelope/@SupplementNum, 1, 1) = 'S'">
<xsl:value-of select="substring(//Envelope/@SupplementNum, 2)" />
<xsl:value-of select="substring(//Envelope/@SupplementNum, 2)"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:element>
<xsl:apply-templates select="PartsList" />
<xsl:apply-templates select="PartsList"/>
<xsl:element name="Envelope">
<xsl:element name="Software">
<xsl:attribute name="Manifest">Audatex.xml</xsl:attribute>
@@ -96,10 +96,13 @@
<xsl:value-of select="//Envelope/@UniqueFileID"/>
</xsl:attribute>
<xsl:attribute name="EstimateID">
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-<xsl:value-of select="//Envelope/@SoftwareVersion"/>-<xsl:value-of select="//Envelope/@UniqueFileID"/>
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-<xsl:value-of
select="//Envelope/@SoftwareVersion"/>-
<xsl:value-of select="//Envelope/@UniqueFileID"/>
</xsl:attribute>
<xsl:attribute name="EstimateIDv2">
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-<xsl:value-of select="//Envelope/@UniqueFileID"/>
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-
<xsl:value-of select="//Envelope/@UniqueFileID"/>
</xsl:attribute>
<xsl:attribute name="EstimateFormatVersion">
<xsl:value-of select="//Envelope/@EMSVersion"/>
@@ -107,9 +110,9 @@
</xsl:element>
</xsl:element>
<xsl:element name="Totals">
<xsl:attribute name="GrandTotalAmount">
<xsl:value-of select="//Total/@GrandTotalAmount"/>
</xsl:attribute>
<xsl:attribute name="GrandTotalAmount">
<xsl:value-of select="//Total/@GrandTotalAmount"/>
</xsl:attribute>
</xsl:element>
<xsl:element name="Administrative">
<xsl:element name="Owner">
@@ -220,7 +223,8 @@
<xsl:choose>
<xsl:when test="string-length(substring-before(//Admin/@InsuranceZip, '-'))=5">
<xsl:choose>
<xsl:when test="string-length(substring-after(//Admin/@InsuranceZip, '-'))=4">
<xsl:when
test="string-length(substring-after(//Admin/@InsuranceZip, '-'))=4">
<xsl:value-of select="//Admin/@InsuranceZip"/>
</xsl:when>
<xsl:otherwise>
@@ -231,7 +235,8 @@
</xsl:choose>
</xsl:when>
<xsl:when test="string-length(//Admin/@InsuranceZip)=9">
<xsl:value-of select="substring(//Admin/@InsuranceZip, 1, 5)"/>-<xsl:value-of select="substring(//Admin/@InsuranceZip, 6, 4)"/>
<xsl:value-of select="substring(//Admin/@InsuranceZip, 1, 5)"/>-
<xsl:value-of select="substring(//Admin/@InsuranceZip, 6, 4)"/>
</xsl:when>
<xsl:when test="string-length(//Admin/@InsuranceZip)&gt;4">
<xsl:value-of select="substring(//Admin/@InsuranceZip, 1, 5)"/>
@@ -244,7 +249,8 @@
<xsl:attribute name="Phone">
<xsl:choose>
<xsl:when test="//Admin/@InsurancePhone1Ext[. != '']">
<xsl:value-of select="//Admin/@InsurancePhone1"/>&#32;x<xsl:value-of select="//Admin/@InsurancePhone1Ext"/>
<xsl:value-of select="//Admin/@InsurancePhone1"/>&#32;x
<xsl:value-of select="//Admin/@InsurancePhone1Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin/@InsurancePhone1"/>
@@ -254,7 +260,8 @@
<xsl:attribute name="Phone2">
<xsl:choose>
<xsl:when test="//Admin/@InsurancePhone2Ext[. != '']">
<xsl:value-of select="//Admin/@InsurancePhone2"/>&#32;x<xsl:value-of select="//Admin/@InsurancePhone2Ext"/>
<xsl:value-of select="//Admin/@InsurancePhone2"/>&#32;x
<xsl:value-of select="//Admin/@InsurancePhone2Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin/@InsurancePhone2"/>
@@ -264,7 +271,8 @@
<xsl:attribute name="Fax">
<xsl:choose>
<xsl:when test="//Admin/@InsuranceFaxExt[. != '']">
<xsl:value-of select="//Admin/@InsuranceFax"/>&#32;x<xsl:value-of select="//Admin/@InsuranceFaxExt"/>
<xsl:value-of select="//Admin/@InsuranceFax"/>&#32;x
<xsl:value-of select="//Admin/@InsuranceFaxExt"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin/@InsuranceFax"/>
@@ -277,7 +285,7 @@
</xsl:element>
<xsl:element name="Insured">
<xsl:attribute name="LastName">
<xsl:value-of select="//Admin/@InsuranceLName" />
<xsl:value-of select="//Admin/@InsuranceLName"/>
</xsl:attribute>
</xsl:element>
<xsl:element name="Claim">
@@ -319,7 +327,8 @@
<xsl:choose>
<xsl:when test="string-length(substring-before(//Admin2/@EstimatorZip, '-'))=5">
<xsl:choose>
<xsl:when test="string-length(substring-after(//Admin2/@EstimatorZip, '-'))=4">
<xsl:when
test="string-length(substring-after(//Admin2/@EstimatorZip, '-'))=4">
<xsl:value-of select="//Admin2/@EstimatorZip"/>
</xsl:when>
<xsl:otherwise>
@@ -330,7 +339,8 @@
</xsl:choose>
</xsl:when>
<xsl:when test="string-length(//Admin2/@EstimatorZip)=9">
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 1, 5)"/>-<xsl:value-of select="substring(//Admin2/@EstimatorZip, 6, 4)"/>
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 1, 5)"/>-
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 6, 4)"/>
</xsl:when>
<xsl:when test="string-length(//Admin2/@EstimatorZip)&gt;4">
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 1, 5)"/>
@@ -343,7 +353,8 @@
<xsl:attribute name="Phone">
<xsl:choose>
<xsl:when test="//Admin2/@EstimatorPhone1Ext[. != '']">
<xsl:value-of select="//Admin2/@EstimatorPhone1"/>&#32;x<xsl:value-of select="//Admin2/@EstimatorPhone1Ext"/>
<xsl:value-of select="//Admin2/@EstimatorPhone1"/>&#32;x
<xsl:value-of select="//Admin2/@EstimatorPhone1Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin2/@EstimatorPhone1"/>
@@ -353,7 +364,8 @@
<xsl:attribute name="Phone2">
<xsl:choose>
<xsl:when test="//Admin2/@EstimatorPhone2Ext[. != '']">
<xsl:value-of select="//Admin2/@EstimatorPhone2"/>&#32;x<xsl:value-of select="//Admin2/@EstimatorPhone2Ext"/>
<xsl:value-of select="//Admin2/@EstimatorPhone2"/>&#32;x
<xsl:value-of select="//Admin2/@EstimatorPhone2Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin2/@EstimatorPhone2"/>
@@ -363,7 +375,8 @@
<xsl:attribute name="Fax">
<xsl:choose>
<xsl:when test="//Admin2/@EstimatorFaxExt[. != '']">
<xsl:value-of select="//Admin2/@EstimatorFax"/>&#32;x<xsl:value-of select="//Admin2/@EstimatorFaxExt"/>
<xsl:value-of select="//Admin2/@EstimatorFax"/>&#32;x
<xsl:value-of select="//Admin2/@EstimatorFaxExt"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin2/@EstimatorFax"/>
@@ -379,7 +392,8 @@
<xsl:if test="string-length(//Admin2/@VehicleInDate)&gt;6">
<xsl:value-of select="substring-before(//Admin2/@VehicleInDate, ' ')"/>
<xsl:if test="string-length(//Admin2/@VehicleInTime)=4">
&#32;<xsl:value-of select="substring(//Admin2/@VehicleInTime, 1, 2)"/>:<xsl:value-of select="substring(//Admin2/@VehicleInTime, 3, 2)"/>
&#32;<xsl:value-of select="substring(//Admin2/@VehicleInTime, 1, 2)"/>:
<xsl:value-of select="substring(//Admin2/@VehicleInTime, 3, 2)"/>
</xsl:if>
</xsl:if>
</xsl:attribute>
@@ -387,7 +401,8 @@
<xsl:if test="string-length(//Admin2/@TargetVehicleOutDate)&gt;6">
<xsl:value-of select="substring-before(//Admin2/@TargetVehicleOutDate,' ')"/>
<xsl:if test="string-length(//Admin2/@TargetVehicleOutTime)=4">
&#32;<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 1, 2)"/>:<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 3, 2)"/>
&#32;<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 1, 2)"/>:
<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 3, 2)"/>
</xsl:if>
</xsl:if>
</xsl:attribute>
@@ -395,7 +410,8 @@
<xsl:if test="string-length(//Admin2/@VehicleOutDate)&gt;6">
<xsl:value-of select="substring-before(//Admin2/@VehicleOutDate, ' ')"/>
<xsl:if test="string-length(//Admin2/@VehicleOutTime)=4">
&#32;<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 1, 2)"/>:<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 3, 2)"/>
&#32;<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 1, 2)"/>:
<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 3, 2)"/>
</xsl:if>
</xsl:if>
</xsl:attribute>
@@ -405,16 +421,16 @@
</xsl:for-each>
</xsl:template>
<xsl:template match="PartsList">
<xsl:element name="PartsList" >
<xsl:element name="PartsList">
<xsl:for-each select="Part">
<xsl:element name="Part" >
<xsl:element name="Part">
<!-- Part number translation rules -->
<xsl:variable name="OEMPartNumber">
<xsl:if test="substring(@TDPartNum, string-length(@TDPartNum) - 7) != ' GM PART'">
<xsl:value-of select="@TDPartNum" />
<xsl:value-of select="@TDPartNum"/>
</xsl:if>
<xsl:if test="substring(@TDPartNum, string-length(@TDPartNum) - 7) = ' GM PART'">
<xsl:value-of select="substring-before(@TDPartNum,' GM PART')" />
<xsl:value-of select="substring-before(@TDPartNum,' GM PART')"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="AltPartNumber">
@@ -457,20 +473,22 @@
<xsl:value-of select="$PrimaryPartNumber"/>
</xsl:attribute>
<xsl:attribute name="AltPartNum">
<xsl:value-of select="$SecondaryPartNumber" />
<xsl:value-of select="$SecondaryPartNumber"/>
</xsl:attribute>
<xsl:attribute name="ExternalPartType">
<xsl:value-of select="$PrimaryPartType" />
<xsl:value-of select="$PrimaryPartType"/>
</xsl:attribute>
<xsl:attribute name="ExternalAltPartType">
<xsl:value-of select="$SecondaryPartType" />
<xsl:value-of select="$SecondaryPartType"/>
</xsl:attribute>
<xsl:attribute name="TDPartType">
<xsl:choose>
<xsl:when test="$PrimaryPartType='PAN' or $PrimaryPartType='PAP'">1</xsl:when>
<xsl:when test="$PrimaryPartType='PAA' or $PrimaryPartType='PATR'">2</xsl:when>
<xsl:when test="$PrimaryPartType='PAL'">3</xsl:when>
<xsl:when test="$PrimaryPartType='PAM' or $PrimaryPartType='PAC' or $PrimaryPartType='PAR'">4</xsl:when>
<xsl:when test="$PrimaryPartType='PAM' or $PrimaryPartType='PAC' or $PrimaryPartType='PAR'">
4
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
@@ -479,64 +497,67 @@
<xsl:when test="$SecondaryPartType='PAN'">1</xsl:when>
<xsl:when test="$SecondaryPartType='PAA' or $SecondaryPartType='PATR'">2</xsl:when>
<xsl:when test="$SecondaryPartType='PAL'">3</xsl:when>
<xsl:when test="$SecondaryPartType='PAM' or $SecondaryPartType='PAC' or $SecondaryPartType='PAR'">4</xsl:when>
<xsl:when
test="$SecondaryPartType='PAM' or $SecondaryPartType='PAC' or $SecondaryPartType='PAR'">
4
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="TDPartDesc">
<xsl:value-of select="@TDPartDesc" />
<xsl:value-of select="@TDPartDesc"/>
</xsl:attribute>
<xsl:attribute name="TDEstimate">
<xsl:choose>
<xsl:when test="@PartType='PAN'">
<xsl:value-of select="@TDEstimate" />
<xsl:value-of select="@TDEstimate"/>
</xsl:when>
<xsl:when test="@PartType='PAM'">
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:when>
<xsl:when test="@PartType='PAA'">
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:when>
<xsl:when test="@PartType='PAL'">
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="TDPartQty">
<xsl:value-of select="@TDPartQty" />
<xsl:value-of select="@TDPartQty"/>
</xsl:attribute>
<xsl:attribute name="LineNumber">
<xsl:value-of select="@LineNumber" />
<xsl:value-of select="@LineNumber"/>
</xsl:attribute>
<xsl:attribute name="SequenceNumber">
<xsl:value-of select="@SequenceNumber" />
<xsl:value-of select="@SequenceNumber"/>
</xsl:attribute>
<xsl:attribute name="SupplLevel">
<xsl:choose>
<xsl:when test="@SupplementLevel = 'E'">0</xsl:when>
<xsl:when test="substring(@SupplementLevel, 1, 1) = 'S'">
<xsl:value-of select="substring(@SupplementLevel, 2)" />
<xsl:value-of select="substring(@SupplementLevel, 2)"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="LaborType">
<xsl:value-of select="@LaborType" />
<xsl:value-of select="@LaborType"/>
</xsl:attribute>
<xsl:attribute name="LaborHours">
<xsl:value-of select="@LaborHours" />
<xsl:value-of select="@LaborHours"/>
</xsl:attribute>
<xsl:attribute name="OperationCode">
<xsl:value-of select="@LaborOp" />
<xsl:value-of select="@LaborOp"/>
</xsl:attribute>
<xsl:attribute name="PriceIncluded">
<xsl:value-of select="@PriceIncluded" />
<xsl:value-of select="@PriceIncluded"/>
</xsl:attribute>
<xsl:attribute name="MarkUp">
<xsl:value-of select="@MarkUp" />
<xsl:value-of select="@MarkUp"/>
</xsl:attribute>
<xsl:attribute name="CLPart">
<!-- CLPart is false if TRAN_CODE == 2 or TRAN_CODE == 3 -->
@@ -546,11 +567,16 @@
<!-- If LaborOp is OP1, then allow the part to import CP 12/28/08 for Shop Client Release 4.1.4 -->
<xsl:choose>
<xsl:when test="@TransactionCode='3'">False</xsl:when>
<xsl:when test="@TransactionCode='1' or @TransactionCode=' ' or @TransactionCode='' or @TransactionCode='2'">
<xsl:when
test="@TransactionCode='1' or @TransactionCode=' ' or @TransactionCode='' or @TransactionCode='2'">
<xsl:choose>
<xsl:when test="@PartType='PAN' or @PartType='PAG' or @PartType='PAM' or @PartType='PAP' or @PartType='PAL' or @PartType='PAA' or @PartType='PAC' or @PartType='PATR'">
<xsl:when
test="@PartType='PAN' or @PartType='PAG' or @PartType='PAM' or @PartType='PAP' or @PartType='PAL' or @PartType='PAA' or @PartType='PAC' or @PartType='PATR'">
<xsl:choose>
<xsl:when test="@LaborType='LAD' or @LaborType='LAE' or @LaborType='LAU' or @LaborType='LAT'">False</xsl:when>
<xsl:when
test="@LaborType='LAD' or @LaborType='LAE' or @LaborType='LAU' or @LaborType='LAT'">
False
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<!--xsl:when test="@LaborOp='OP0'">False</xsl:when -->

View File

@@ -1,128 +1,223 @@
<?xml version="1.0" encoding="UTF-8"?>
<TranslationDescriptor>
<FileTranslations FormatName="ADP EMS" ElementName="Estimate" Description="Translation Descriptor for a ADP ShopLink Estimate, Version EMS 2.0">
<FileTranslations FormatName="ADP EMS" ElementName="Estimate"
Description="Translation Descriptor for a ADP ShopLink Estimate, Version EMS 2.0">
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.env">
<DBFFileTranslation ID="ID1" ElementName="Envelope" Description="Envelope Table">
<DBFFieldSpec FieldName="RO_ID" Form="attribute" Name="RONum" FieldType="" Description="RO Number"/>
<DBFFieldSpec FieldName="UNQFILE_ID" Form="attribute" Name="UniqueFileID" FieldType="" Description="Unique File Identifier"/>
<DBFFieldSpec FieldName="ESTFILE_ID" Form="attribute" Name="EstimateFileID" FieldType="" Description="Estimate File Identifier"/>
<DBFFieldSpec FieldName="INCL_ADMIN" Form="attribute" Name="IncludesAdminInfo" FieldType="Boolean" Description="Includes Admin Info Flag"/>
<DBFFieldSpec FieldName="INCL_VEH" Form="attribute" Name="IncludesVehicleInfo" FieldType="Boolean" Description="Includes Vehicle Info Flag"/>
<DBFFieldSpec FieldName="INCL_EST" Form="attribute" Name="IncludesEstimateInfo" FieldType="Boolean" Description="Includes Estimate Info Flag"/>
<DBFFieldSpec FieldName="INCL_PROFL" Form="attribute" Name="IncludesProfileInfo" FieldType="Boolean" Description="Includes Profile Info Flag"/>
<DBFFieldSpec FieldName="INCL_TOTAL" Form="attribute" Name="IncludesTotalsInfo" FieldType="Boolean" Description="Includes Totals Info Flag"/>
<DBFFieldSpec FieldName="INCL_VENDR" Form="attribute" Name="IncludesVendorInfo" FieldType="Boolean" Description="Includes Vendor Info Flag"/>
<DBFFieldSpec FieldName="EMS_VER" Form="attribute" Name="EMSVersion" FieldType="" Description="EMS Version Number"/>
<DBFFieldSpec FieldName="SUPP_NO" Form="attribute" Name="SupplementNum" FieldType="" Description="Supplement Number"/>
<DBFFieldSpec FieldName="TRANS_TYPE" Form="attribute" Name="TransactionType" FieldType="" Description="Transaction Type"/>
<DBFFieldSpec FieldName="EST_SYSTEM" Form="attribute" Name="EstimatingSystem" FieldType="" Description="Estimating System Software"/>
<DBFFieldSpec FieldName="SW_VERSION" Form="attribute" Name="SoftwareVersion" FieldType="" Description="Software Version Identifier"/>
<DBFFieldSpec FieldName="UNQFILE_ID" Form="attribute" Name="UniqueFileID" FieldType=""
Description="Unique File Identifier"/>
<DBFFieldSpec FieldName="ESTFILE_ID" Form="attribute" Name="EstimateFileID" FieldType=""
Description="Estimate File Identifier"/>
<DBFFieldSpec FieldName="INCL_ADMIN" Form="attribute" Name="IncludesAdminInfo" FieldType="Boolean"
Description="Includes Admin Info Flag"/>
<DBFFieldSpec FieldName="INCL_VEH" Form="attribute" Name="IncludesVehicleInfo" FieldType="Boolean"
Description="Includes Vehicle Info Flag"/>
<DBFFieldSpec FieldName="INCL_EST" Form="attribute" Name="IncludesEstimateInfo" FieldType="Boolean"
Description="Includes Estimate Info Flag"/>
<DBFFieldSpec FieldName="INCL_PROFL" Form="attribute" Name="IncludesProfileInfo" FieldType="Boolean"
Description="Includes Profile Info Flag"/>
<DBFFieldSpec FieldName="INCL_TOTAL" Form="attribute" Name="IncludesTotalsInfo" FieldType="Boolean"
Description="Includes Totals Info Flag"/>
<DBFFieldSpec FieldName="INCL_VENDR" Form="attribute" Name="IncludesVendorInfo" FieldType="Boolean"
Description="Includes Vendor Info Flag"/>
<DBFFieldSpec FieldName="EMS_VER" Form="attribute" Name="EMSVersion" FieldType=""
Description="EMS Version Number"/>
<DBFFieldSpec FieldName="SUPP_NO" Form="attribute" Name="SupplementNum" FieldType=""
Description="Supplement Number"/>
<DBFFieldSpec FieldName="TRANS_TYPE" Form="attribute" Name="TransactionType" FieldType=""
Description="Transaction Type"/>
<DBFFieldSpec FieldName="EST_SYSTEM" Form="attribute" Name="EstimatingSystem" FieldType=""
Description="Estimating System Software"/>
<DBFFieldSpec FieldName="SW_VERSION" Form="attribute" Name="SoftwareVersion" FieldType=""
Description="Software Version Identifier"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.LIN">
<DBFFileTranslation ID="ID2" ElementSetName="PartsList" ElementName="Part" Description="Parts List Table">
<DBFFieldSpec FieldName="OEM_PARTNO" Form="attribute" Name="TDPartNum" FieldType="" Description="Part Number"/>
<DBFFieldSpec FieldName="ALT_PARTNO" Form="attribute" Name="AltPartNum" FieldType="" Description="Alternate Part Number"/>
<DBFFieldSpec FieldName="ACT_PRICE" Form="attribute" Name="ActPrice" FieldType="" Description="Actual Part Price"/>
<DBFFieldSpec FieldName="LINE_DESC" Form="attribute" Name="TDPartDesc" FieldType="" Description="Part Description"/>
<DBFFieldSpec FieldName="DB_PRICE" Form="attribute" Name="TDEstimate" FieldType="" Description="DB_Price"/>
<DBFFieldSpec FieldName="PART_QTY" Form="attribute" Name="TDPartQty" FieldType="" Description="Part Quantity"/>
<DBFFieldSpec FieldName="PART_TYPE" Form="attribute" Name="PartType" FieldType="" Description="Part Type"/>
<DBFFieldSpec FieldName="MOD_LBR_TY" Form="attribute" Name="LaborType" FieldType="" Description="Labor Type"/>
<DBFFieldSpec FieldName="MOD_LB_HRS" Form="attribute" Name="LaborHours" FieldType="" Description="Labor Hours"/>
<DBFFieldSpec FieldName="OEM_PARTNO" Form="attribute" Name="TDPartNum" FieldType=""
Description="Part Number"/>
<DBFFieldSpec FieldName="ALT_PARTNO" Form="attribute" Name="AltPartNum" FieldType=""
Description="Alternate Part Number"/>
<DBFFieldSpec FieldName="ACT_PRICE" Form="attribute" Name="ActPrice" FieldType=""
Description="Actual Part Price"/>
<DBFFieldSpec FieldName="LINE_DESC" Form="attribute" Name="TDPartDesc" FieldType=""
Description="Part Description"/>
<DBFFieldSpec FieldName="DB_PRICE" Form="attribute" Name="TDEstimate" FieldType=""
Description="DB_Price"/>
<DBFFieldSpec FieldName="PART_QTY" Form="attribute" Name="TDPartQty" FieldType=""
Description="Part Quantity"/>
<DBFFieldSpec FieldName="PART_TYPE" Form="attribute" Name="PartType" FieldType=""
Description="Part Type"/>
<DBFFieldSpec FieldName="MOD_LBR_TY" Form="attribute" Name="LaborType" FieldType=""
Description="Labor Type"/>
<DBFFieldSpec FieldName="MOD_LB_HRS" Form="attribute" Name="LaborHours" FieldType=""
Description="Labor Hours"/>
<DBFFieldSpec FieldName="LBR_OP" Form="attribute" Name="LaborOp" FieldType="" Description="Labor Op"/>
<DBFFieldSpec FieldName="LINE_NO" Form="attribute" Name="LineNumber" FieldType="" Description="Line number"/>
<DBFFieldSpec FieldName="LINE_NO" Form="attribute" Name="LineNumber" FieldType=""
Description="Line number"/>
<DBFFieldSpec FieldName="UNQ_SEQ" Form="attribute" Name="SequenceNumber" FieldType="" Description=""/>
<DBFFieldSpec FieldName="LINE_IND" Form="attribute" Name="SupplementLevel" FieldType="" Description="Supplement Level"/>
<DBFFieldSpec FieldName="TRAN_CODE" Form="attribute" Name="TransactionCode" FieldType="" Description="Transaction Code"/>
<DBFFieldSpec FieldName="PRICE_INC" Form="attribute" Name="PriceIncluded" FieldType="" Description="Price Included"/>
<DBFFieldSpec FieldName="PRT_DSMK_P" Form="attribute" Name="MarkUp" FieldType="" Description="Price Mark up for non OEM parts"/>
<DBFFieldSpec FieldName="LINE_IND" Form="attribute" Name="SupplementLevel" FieldType=""
Description="Supplement Level"/>
<DBFFieldSpec FieldName="TRAN_CODE" Form="attribute" Name="TransactionCode" FieldType=""
Description="Transaction Code"/>
<DBFFieldSpec FieldName="PRICE_INC" Form="attribute" Name="PriceIncluded" FieldType=""
Description="Price Included"/>
<DBFFieldSpec FieldName="PRT_DSMK_P" Form="attribute" Name="MarkUp" FieldType=""
Description="Price Mark up for non OEM parts"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.VEH">
<DBFFileTranslation ID="ID3" ElementName="Vehicle" Description="Vehicle Table">
<DBFFieldSpec FieldName="V_VIN" Form="attribute" Name="TransVIN" FieldType="" Description=""/>
<DBFFieldSpec FieldName="V_MODEL_YR" Form="attribute" Name="TransYear" FieldType="" Description="V_MODEL_YR"/>
<DBFFieldSpec FieldName="V_MAKEDESC" Form="attribute" Name="ManufName" FieldType="" Description="V_MAKEDESC"/>
<DBFFieldSpec FieldName="V_MAKECODE" Form="attribute" Name="ManufCode" FieldType="" Description="V_MAKECODE"/>
<DBFFieldSpec FieldName="V_MODEL" Form="attribute" Name="TransModel" FieldType="" Description="V_MODEL"/>
<DBFFieldSpec FieldName="V_MILEAGE" Form="attribute" Name="TransMileage" FieldType="" Description="V_MILEAGE"/>
<DBFFieldSpec FieldName="V_MODEL_YR" Form="attribute" Name="TransYear" FieldType=""
Description="V_MODEL_YR"/>
<DBFFieldSpec FieldName="V_MAKEDESC" Form="attribute" Name="ManufName" FieldType=""
Description="V_MAKEDESC"/>
<DBFFieldSpec FieldName="V_MAKECODE" Form="attribute" Name="ManufCode" FieldType=""
Description="V_MAKECODE"/>
<DBFFieldSpec FieldName="V_MODEL" Form="attribute" Name="TransModel" FieldType=""
Description="V_MODEL"/>
<DBFFieldSpec FieldName="V_MILEAGE" Form="attribute" Name="TransMileage" FieldType=""
Description="V_MILEAGE"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.AD1">
<DBFFileTranslation ID="ID4" ElementName="Admin" Description="Administrative information">
<DBFFieldSpec FieldName="OWNR_LN" Form="attribute" Name="OwnerL" FieldType="" Description="Owner Lastname"/>
<DBFFieldSpec FieldName="OWNR_FN" Form="attribute" Name="OwnerF" FieldType="" Description="Owner Firstname"/>
<DBFFieldSpec FieldName="OWNR_CO_NM" Form="attribute" Name="OwnerCompanyName" FieldType="" Description="Owner Company Name"/>
<DBFFieldSpec FieldName="OWNR_TITLE" Form="attribute" Name="OwnerTitle" FieldType="" Description="Owner Title"/>
<DBFFieldSpec FieldName="OWNR_ADDR1" Form="attribute" Name="OwnerAddr1" FieldType="" Description="Owner Address Line 1"/>
<DBFFieldSpec FieldName="OWNR_ADDR2" Form="attribute" Name="OwnerAddr2" FieldType="" Description="Owner Address Line 2"/>
<DBFFieldSpec FieldName="OWNR_CITY" Form="attribute" Name="OwnerCity" FieldType="" Description="Owner City"/>
<DBFFieldSpec FieldName="OWNR_ST" Form="attribute" Name="OwnerState" FieldType="" Description="Owner State"/>
<DBFFieldSpec FieldName="OWNR_ZIP" Form="attribute" Name="OwnerZip" FieldType="" Description="Owner Zip"/>
<DBFFieldSpec FieldName="OWNR_CTRY" Form="attribute" Name="OwnerCountry" FieldType="" Description="Owner Country"/>
<DBFFieldSpec FieldName="OWNR_PH1" Form="attribute" Name="OwnerPhone1" FieldType="" Description="Owner Primary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH1X" Form="attribute" Name="OwnerPhone1Ext" FieldType="" Description="Owner Primary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_PH2" Form="attribute" Name="OwnerPhone2" FieldType="" Description="Owner Secondary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH2X" Form="attribute" Name="OwnerPhone2Ext" FieldType="" Description="Owner Secondary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_FAX" Form="attribute" Name="OwnerFax" FieldType="" Description="Owner Fax"/>
<DBFFieldSpec FieldName="OWNR_FAXX" Form="attribute" Name="OwnerFaxExt" FieldType="" Description="Owner Fax Extension"/>
<DBFFieldSpec FieldName="OWNR_EA" Form="attribute" Name="OwnerEmail" FieldType="" Description="Owner Email Address"/>
<DBFFieldSpec FieldName="INS_CO_NM" Form="attribute" Name="InsuranceCompanyName" FieldType="" Description="Insurance Company Name"/>
<DBFFieldSpec FieldName="INS_CO_ID" Form="attribute" Name="InsuranceCompanyID" FieldType="" Description="Insurance Company Identifier"/>
<DBFFieldSpec FieldName="INS_ADDR1" Form="attribute" Name="InsuranceAddr1" FieldType="" Description="Insurance Address Line 1"/>
<DBFFieldSpec FieldName="INS_ADDR2" Form="attribute" Name="InsuranceAddr2" FieldType="" Description="Insurance Address Line 2"/>
<DBFFieldSpec FieldName="INS_CITY" Form="attribute" Name="InsuranceCity" FieldType="" Description="Insurance City"/>
<DBFFieldSpec FieldName="INS_ST" Form="attribute" Name="InsuranceState" FieldType="" Description="Insurance State"/>
<DBFFieldSpec FieldName="INS_ZIP" Form="attribute" Name="InsuranceZip" FieldType="" Description="Insurance Zip"/>
<DBFFieldSpec FieldName="INS_CTRY" Form="attribute" Name="InsuranceCountry" FieldType="" Description="Insurance Country"/>
<DBFFieldSpec FieldName="INS_PH1" Form="attribute" Name="InsurancePhone1" FieldType="" Description="Insurance Primary Phone"/>
<DBFFieldSpec FieldName="INS_PH1X" Form="attribute" Name="InsurancePhone1Ext" FieldType="" Description="Insurance Primary Phone Extension"/>
<DBFFieldSpec FieldName="INS_PH2" Form="attribute" Name="InsurancePhone2" FieldType="" Description="Insurance Secondary Phone"/>
<DBFFieldSpec FieldName="INS_PH2X" Form="attribute" Name="InsurancePhone2Ext" FieldType="" Description="Insurance Secondary Phone Extension"/>
<DBFFieldSpec FieldName="INS_FAX" Form="attribute" Name="InsuranceFax" FieldType="" Description="Insurance Fax"/>
<DBFFieldSpec FieldName="INS_FAXX" Form="attribute" Name="InsuranceFaxExt" FieldType="" Description="Insurance Fax Extension"/>
<DBFFieldSpec FieldName="INS_EA" Form="attribute" Name="InsuranceEmail" FieldType="" Description="Insurance Email Address"/>
<DBFFieldSpec FieldName="INSD_LN" Form="attribute" Name="InsuranceLName" FieldType="" Description="Insurance Last Name"/>
<DBFFieldSpec FieldName="CLM_NO" Form="attribute" Name="ClaimNumber" FieldType="" Description="Claim Number"/>
<DBFFieldSpec FieldName="OWNR_LN" Form="attribute" Name="OwnerL" FieldType=""
Description="Owner Lastname"/>
<DBFFieldSpec FieldName="OWNR_FN" Form="attribute" Name="OwnerF" FieldType=""
Description="Owner Firstname"/>
<DBFFieldSpec FieldName="OWNR_CO_NM" Form="attribute" Name="OwnerCompanyName" FieldType=""
Description="Owner Company Name"/>
<DBFFieldSpec FieldName="OWNR_TITLE" Form="attribute" Name="OwnerTitle" FieldType=""
Description="Owner Title"/>
<DBFFieldSpec FieldName="OWNR_ADDR1" Form="attribute" Name="OwnerAddr1" FieldType=""
Description="Owner Address Line 1"/>
<DBFFieldSpec FieldName="OWNR_ADDR2" Form="attribute" Name="OwnerAddr2" FieldType=""
Description="Owner Address Line 2"/>
<DBFFieldSpec FieldName="OWNR_CITY" Form="attribute" Name="OwnerCity" FieldType=""
Description="Owner City"/>
<DBFFieldSpec FieldName="OWNR_ST" Form="attribute" Name="OwnerState" FieldType=""
Description="Owner State"/>
<DBFFieldSpec FieldName="OWNR_ZIP" Form="attribute" Name="OwnerZip" FieldType=""
Description="Owner Zip"/>
<DBFFieldSpec FieldName="OWNR_CTRY" Form="attribute" Name="OwnerCountry" FieldType=""
Description="Owner Country"/>
<DBFFieldSpec FieldName="OWNR_PH1" Form="attribute" Name="OwnerPhone1" FieldType=""
Description="Owner Primary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH1X" Form="attribute" Name="OwnerPhone1Ext" FieldType=""
Description="Owner Primary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_PH2" Form="attribute" Name="OwnerPhone2" FieldType=""
Description="Owner Secondary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH2X" Form="attribute" Name="OwnerPhone2Ext" FieldType=""
Description="Owner Secondary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_FAX" Form="attribute" Name="OwnerFax" FieldType=""
Description="Owner Fax"/>
<DBFFieldSpec FieldName="OWNR_FAXX" Form="attribute" Name="OwnerFaxExt" FieldType=""
Description="Owner Fax Extension"/>
<DBFFieldSpec FieldName="OWNR_EA" Form="attribute" Name="OwnerEmail" FieldType=""
Description="Owner Email Address"/>
<DBFFieldSpec FieldName="INS_CO_NM" Form="attribute" Name="InsuranceCompanyName" FieldType=""
Description="Insurance Company Name"/>
<DBFFieldSpec FieldName="INS_CO_ID" Form="attribute" Name="InsuranceCompanyID" FieldType=""
Description="Insurance Company Identifier"/>
<DBFFieldSpec FieldName="INS_ADDR1" Form="attribute" Name="InsuranceAddr1" FieldType=""
Description="Insurance Address Line 1"/>
<DBFFieldSpec FieldName="INS_ADDR2" Form="attribute" Name="InsuranceAddr2" FieldType=""
Description="Insurance Address Line 2"/>
<DBFFieldSpec FieldName="INS_CITY" Form="attribute" Name="InsuranceCity" FieldType=""
Description="Insurance City"/>
<DBFFieldSpec FieldName="INS_ST" Form="attribute" Name="InsuranceState" FieldType=""
Description="Insurance State"/>
<DBFFieldSpec FieldName="INS_ZIP" Form="attribute" Name="InsuranceZip" FieldType=""
Description="Insurance Zip"/>
<DBFFieldSpec FieldName="INS_CTRY" Form="attribute" Name="InsuranceCountry" FieldType=""
Description="Insurance Country"/>
<DBFFieldSpec FieldName="INS_PH1" Form="attribute" Name="InsurancePhone1" FieldType=""
Description="Insurance Primary Phone"/>
<DBFFieldSpec FieldName="INS_PH1X" Form="attribute" Name="InsurancePhone1Ext" FieldType=""
Description="Insurance Primary Phone Extension"/>
<DBFFieldSpec FieldName="INS_PH2" Form="attribute" Name="InsurancePhone2" FieldType=""
Description="Insurance Secondary Phone"/>
<DBFFieldSpec FieldName="INS_PH2X" Form="attribute" Name="InsurancePhone2Ext" FieldType=""
Description="Insurance Secondary Phone Extension"/>
<DBFFieldSpec FieldName="INS_FAX" Form="attribute" Name="InsuranceFax" FieldType=""
Description="Insurance Fax"/>
<DBFFieldSpec FieldName="INS_FAXX" Form="attribute" Name="InsuranceFaxExt" FieldType=""
Description="Insurance Fax Extension"/>
<DBFFieldSpec FieldName="INS_EA" Form="attribute" Name="InsuranceEmail" FieldType=""
Description="Insurance Email Address"/>
<DBFFieldSpec FieldName="INSD_LN" Form="attribute" Name="InsuranceLName" FieldType=""
Description="Insurance Last Name"/>
<DBFFieldSpec FieldName="CLM_NO" Form="attribute" Name="ClaimNumber" FieldType=""
Description="Claim Number"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.AD2">
<DBFFileTranslation ID="ID5" ElementName="Admin2" Description="Administrative information2">
<DBFFieldSpec FieldName="EST_CT_LN" Form="attribute" Name="EstimatorL" FieldType="" Description="Estimator Lastname"/>
<DBFFieldSpec FieldName="EST_CT_FN" Form="attribute" Name="EstimatorF" FieldType="" Description="Estimator Firstname"/>
<DBFFieldSpec FieldName="EST_CO_NM" Form="attribute" Name="EstimatorCompanyName" FieldType="" Description="Estimator Company Name"/>
<DBFFieldSpec FieldName="EST_CO_ID" Form="attribute" Name="EstimatorCompanyID" FieldType="" Description="Estimator Company Identifier"/>
<DBFFieldSpec FieldName="EST_ADDR1" Form="attribute" Name="EstimatorAddr1" FieldType="" Description="Estimator Address1"/>
<DBFFieldSpec FieldName="EST_ADDR2" Form="attribute" Name="EstimatorAddr2" FieldType="" Description="Estimator Address2"/>
<DBFFieldSpec FieldName="EST_CITY" Form="attribute" Name="EstimatorCity" FieldType="" Description="Estimator City"/>
<DBFFieldSpec FieldName="EST_ST" Form="attribute" Name="EstimatorState" FieldType="" Description="Estimator State"/>
<DBFFieldSpec FieldName="EST_ZIP" Form="attribute" Name="EstimatorZip" FieldType="" Description="Estimator Zip"/>
<DBFFieldSpec FieldName="EST_CTRY" Form="attribute" Name="EstimatorCountry" FieldType="" Description="Estimator Country"/>
<DBFFieldSpec FieldName="EST_PH1" Form="attribute" Name="EstimatorPhone1" FieldType="" Description="Estimator Primary Phone"/>
<DBFFieldSpec FieldName="EST_PH1X" Form="attribute" Name="EstimatorPhone1Ext" FieldType="" Description="Estimator Primary Phone Extension"/>
<DBFFieldSpec FieldName="EST_PH2" Form="attribute" Name="EstimatorPhone2" FieldType="" Description="Estimator Secondary Phone"/>
<DBFFieldSpec FieldName="EST_PH2X" Form="attribute" Name="EstimatorPhone2Ext" FieldType="" Description="Estimator Secondary Phone Extension"/>
<DBFFieldSpec FieldName="EST_FAX" Form="attribute" Name="EstimatorFax" FieldType="" Description="Estimator Fax"/>
<DBFFieldSpec FieldName="EST_FAXX" Form="attribute" Name="EstimatorFaxExt" FieldType="" Description="Estimator Fax Extension"/>
<DBFFieldSpec FieldName="EST_EA" Form="attribute" Name="EstimatorEmail" FieldType="" Description="Estimator Email Address"/>
<DBFFieldSpec FieldName="EST_LIC_NO" Form="attribute" Name="EstimatorLicenseNumber" FieldType="" Description="Estimator License Number"/>
<DBFFieldSpec FieldName="EST_FILENO" Form="attribute" Name="EstimatorFileNumber" FieldType="" Description="Estimator File Number"/>
<DBFFieldSpec FieldName="RO_IN_DATE" Form="attribute" Name="VehicleInDate" FieldType="" Description="Date arrived in shop"/>
<DBFFieldSpec FieldName="RO_IN_TIME" Form="attribute" Name="VehicleInTime" FieldType="" Description="Time arrived in shop"/>
<DBFFieldSpec FieldName="TAR_DATE" Form="attribute" Name="TargetVehicleOutDate" FieldType="" Description="Target date to be completed"/>
<DBFFieldSpec FieldName="TAR_TIME" Form="attribute" Name="TargetVehicleOutTime" FieldType="" Description="Target time to be completed"/>
<DBFFieldSpec FieldName="RO_CMPDATE" Form="attribute" Name="VehicleOutDate" FieldType="" Description="Date completed"/>
<DBFFieldSpec FieldName="RO_CMPTIME" Form="attribute" Name="VehicleOutTime" FieldType="" Description="Time completed"/>
<DBFFieldSpec FieldName="RF_CITY" Form="attribute" Name="BodyShopCity" FieldType="" Description="Body Shop City"/>
<DBFFieldSpec FieldName="RF_CO_NM" Form="attribute" Name="BodyShopName" FieldType="" Description="Body Shop Name"/>
<DBFFieldSpec FieldName="EST_CT_LN" Form="attribute" Name="EstimatorL" FieldType=""
Description="Estimator Lastname"/>
<DBFFieldSpec FieldName="EST_CT_FN" Form="attribute" Name="EstimatorF" FieldType=""
Description="Estimator Firstname"/>
<DBFFieldSpec FieldName="EST_CO_NM" Form="attribute" Name="EstimatorCompanyName" FieldType=""
Description="Estimator Company Name"/>
<DBFFieldSpec FieldName="EST_CO_ID" Form="attribute" Name="EstimatorCompanyID" FieldType=""
Description="Estimator Company Identifier"/>
<DBFFieldSpec FieldName="EST_ADDR1" Form="attribute" Name="EstimatorAddr1" FieldType=""
Description="Estimator Address1"/>
<DBFFieldSpec FieldName="EST_ADDR2" Form="attribute" Name="EstimatorAddr2" FieldType=""
Description="Estimator Address2"/>
<DBFFieldSpec FieldName="EST_CITY" Form="attribute" Name="EstimatorCity" FieldType=""
Description="Estimator City"/>
<DBFFieldSpec FieldName="EST_ST" Form="attribute" Name="EstimatorState" FieldType=""
Description="Estimator State"/>
<DBFFieldSpec FieldName="EST_ZIP" Form="attribute" Name="EstimatorZip" FieldType=""
Description="Estimator Zip"/>
<DBFFieldSpec FieldName="EST_CTRY" Form="attribute" Name="EstimatorCountry" FieldType=""
Description="Estimator Country"/>
<DBFFieldSpec FieldName="EST_PH1" Form="attribute" Name="EstimatorPhone1" FieldType=""
Description="Estimator Primary Phone"/>
<DBFFieldSpec FieldName="EST_PH1X" Form="attribute" Name="EstimatorPhone1Ext" FieldType=""
Description="Estimator Primary Phone Extension"/>
<DBFFieldSpec FieldName="EST_PH2" Form="attribute" Name="EstimatorPhone2" FieldType=""
Description="Estimator Secondary Phone"/>
<DBFFieldSpec FieldName="EST_PH2X" Form="attribute" Name="EstimatorPhone2Ext" FieldType=""
Description="Estimator Secondary Phone Extension"/>
<DBFFieldSpec FieldName="EST_FAX" Form="attribute" Name="EstimatorFax" FieldType=""
Description="Estimator Fax"/>
<DBFFieldSpec FieldName="EST_FAXX" Form="attribute" Name="EstimatorFaxExt" FieldType=""
Description="Estimator Fax Extension"/>
<DBFFieldSpec FieldName="EST_EA" Form="attribute" Name="EstimatorEmail" FieldType=""
Description="Estimator Email Address"/>
<DBFFieldSpec FieldName="EST_LIC_NO" Form="attribute" Name="EstimatorLicenseNumber" FieldType=""
Description="Estimator License Number"/>
<DBFFieldSpec FieldName="EST_FILENO" Form="attribute" Name="EstimatorFileNumber" FieldType=""
Description="Estimator File Number"/>
<DBFFieldSpec FieldName="RO_IN_DATE" Form="attribute" Name="VehicleInDate" FieldType=""
Description="Date arrived in shop"/>
<DBFFieldSpec FieldName="RO_IN_TIME" Form="attribute" Name="VehicleInTime" FieldType=""
Description="Time arrived in shop"/>
<DBFFieldSpec FieldName="TAR_DATE" Form="attribute" Name="TargetVehicleOutDate" FieldType=""
Description="Target date to be completed"/>
<DBFFieldSpec FieldName="TAR_TIME" Form="attribute" Name="TargetVehicleOutTime" FieldType=""
Description="Target time to be completed"/>
<DBFFieldSpec FieldName="RO_CMPDATE" Form="attribute" Name="VehicleOutDate" FieldType=""
Description="Date completed"/>
<DBFFieldSpec FieldName="RO_CMPTIME" Form="attribute" Name="VehicleOutTime" FieldType=""
Description="Time completed"/>
<DBFFieldSpec FieldName="RF_CITY" Form="attribute" Name="BodyShopCity" FieldType=""
Description="Body Shop City"/>
<DBFFieldSpec FieldName="RF_CO_NM" Form="attribute" Name="BodyShopName" FieldType=""
Description="Body Shop Name"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.TTL">
<DBFFileTranslation ID="ID6" ElementName="Total" Description="Total Table">
<DBFFieldSpec FieldName="G_TTL_AMT" Form="attribute" Name="GrandTotalAmount" FieldType="" Description=""/>
</DBFFileTranslation>
<DBFFileTranslation ID="ID6" ElementName="Total" Description="Total Table">
<DBFFieldSpec FieldName="G_TTL_AMT" Form="attribute" Name="GrandTotalAmount" FieldType=""
Description=""/>
</DBFFileTranslation>
</FileTranslation>
</FileTranslations>
<StyleSheetTranslation>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:for-each select="//TranslatedData">
<xsl:element name="TranslatedData">
@@ -9,23 +8,23 @@
</xsl:attribute>
<xsl:choose>
<xsl:when test="Details/@PrgID">
<xsl:copy-of select="Details" />
<xsl:copy-of select="Details"/>
</xsl:when>
<xsl:otherwise>
<xsl:element name="Details">
<xsl:attribute name="PrgID">OECTrans.ImportTrans</xsl:attribute>
<xsl:for-each select="Details/@*">
<xsl:copy-of select="." />
<xsl:copy-of select="."/>
</xsl:for-each>
<xsl:for-each select="Details/*">
<xsl:copy-of select="." />
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
<xsl:element name="Header">
<xsl:attribute name="RONum">
<xsl:value-of select="//Envelope/@RONum" />
<xsl:value-of select="//Envelope/@RONum"/>
</xsl:attribute>
<xsl:attribute name="OwnerFName">
<xsl:value-of select="//Admin/@OwnerF"/>
@@ -34,43 +33,43 @@
<xsl:value-of select="//Admin/@OwnerL"/>
</xsl:attribute>
<xsl:attribute name="VIN">
<xsl:value-of select="//Vehicle/@TransVIN" />
<xsl:value-of select="//Vehicle/@TransVIN"/>
</xsl:attribute>
<xsl:attribute name="Mileage">
<xsl:value-of select="//Vehicle/@TransMileage" />
<xsl:value-of select="//Vehicle/@TransMileage"/>
</xsl:attribute>
<xsl:attribute name="Year">
<xsl:value-of select="//Vehicle/@TransYear" />
<xsl:value-of select="//Vehicle/@TransYear"/>
</xsl:attribute>
<xsl:attribute name="Make">
<xsl:if test="//Vehicle/@ManufName[. != '']" >
<xsl:value-of select="//Vehicle/@ManufName" />
<xsl:if test="//Vehicle/@ManufName[. != '']">
<xsl:value-of select="//Vehicle/@ManufName"/>
</xsl:if>
<xsl:if test="//Vehicle/@ManufName[. = '']" >
<xsl:value-of select="//Vehicle/@ManufCode" />
<xsl:if test="//Vehicle/@ManufName[. = '']">
<xsl:value-of select="//Vehicle/@ManufCode"/>
</xsl:if>
</xsl:attribute>
<xsl:attribute name="Model">
<xsl:value-of select="//Vehicle/@TransModel" />
<xsl:value-of select="//Vehicle/@TransModel"/>
</xsl:attribute>
<xsl:attribute name="Description">
<xsl:value-of select="//Vehicle/@TransYear" />
<xsl:text> </xsl:text>
<xsl:value-of select="//Vehicle/@ManufName" />
<xsl:text> </xsl:text>
<xsl:value-of select="//Vehicle/@TransModel" />
<xsl:value-of select="//Vehicle/@TransYear"/>
<xsl:text></xsl:text>
<xsl:value-of select="//Vehicle/@ManufName"/>
<xsl:text></xsl:text>
<xsl:value-of select="//Vehicle/@TransModel"/>
</xsl:attribute>
<xsl:attribute name="LastSupplLevel">
<xsl:choose>
<xsl:when test="//Envelope/@TransactionType = 'E'">0</xsl:when>
<xsl:when test="//Envelope/@TransactionType = 'S'">
<xsl:value-of select="substring(//Envelope/@SupplementNum, 2)" />
<xsl:value-of select="substring(//Envelope/@SupplementNum, 2)"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:element>
<xsl:apply-templates select="PartsList" />
<xsl:apply-templates select="PartsList"/>
<xsl:element name="Envelope">
<xsl:element name="Software">
<xsl:attribute name="Manifest">CCC.xml</xsl:attribute>
@@ -91,10 +90,13 @@
<xsl:value-of select="//Envelope/@UniqueFileID"/>
</xsl:attribute>
<xsl:attribute name="EstimateID">
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-<xsl:value-of select="//Envelope/@SoftwareVersion"/>-<xsl:value-of select="//Envelope/@UniqueFileID"/>
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-<xsl:value-of
select="//Envelope/@SoftwareVersion"/>-
<xsl:value-of select="//Envelope/@UniqueFileID"/>
</xsl:attribute>
<xsl:attribute name="EstimateIDv2">
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-<xsl:value-of select="//Envelope/@UniqueFileID"/>
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-
<xsl:value-of select="//Envelope/@UniqueFileID"/>
</xsl:attribute>
<xsl:attribute name="EstimateFormatVersion">
<xsl:value-of select="//Envelope/@EMSVersion"/>
@@ -102,9 +104,9 @@
</xsl:element>
</xsl:element>
<xsl:element name="Totals">
<xsl:attribute name="GrandTotalAmount">
<xsl:value-of select="//Total/@GrandTotalAmount"/>
</xsl:attribute>
<xsl:attribute name="GrandTotalAmount">
<xsl:value-of select="//Total/@GrandTotalAmount"/>
</xsl:attribute>
</xsl:element>
<xsl:element name="Administrative">
<xsl:element name="Owner">
@@ -215,7 +217,8 @@
<xsl:choose>
<xsl:when test="string-length(substring-before(//Admin/@InsuranceZip, '-'))=5">
<xsl:choose>
<xsl:when test="string-length(substring-after(//Admin/@InsuranceZip, '-'))=4">
<xsl:when
test="string-length(substring-after(//Admin/@InsuranceZip, '-'))=4">
<xsl:value-of select="//Admin/@InsuranceZip"/>
</xsl:when>
<xsl:otherwise>
@@ -226,7 +229,8 @@
</xsl:choose>
</xsl:when>
<xsl:when test="string-length(//Admin/@InsuranceZip)=9">
<xsl:value-of select="substring(//Admin/@InsuranceZip, 1, 5)"/>-<xsl:value-of select="substring(//Admin/@InsuranceZip, 6, 4)"/>
<xsl:value-of select="substring(//Admin/@InsuranceZip, 1, 5)"/>-
<xsl:value-of select="substring(//Admin/@InsuranceZip, 6, 4)"/>
</xsl:when>
<xsl:when test="string-length(//Admin/@InsuranceZip)&gt;4">
<xsl:value-of select="substring(//Admin/@InsuranceZip, 1, 5)"/>
@@ -239,7 +243,8 @@
<xsl:attribute name="Phone">
<xsl:choose>
<xsl:when test="//Admin/@InsurancePhone1Ext[. != '']">
<xsl:value-of select="//Admin/@InsurancePhone1"/>&#32;x<xsl:value-of select="//Admin/@InsurancePhone1Ext"/>
<xsl:value-of select="//Admin/@InsurancePhone1"/>&#32;x
<xsl:value-of select="//Admin/@InsurancePhone1Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin/@InsurancePhone1"/>
@@ -249,7 +254,8 @@
<xsl:attribute name="Phone2">
<xsl:choose>
<xsl:when test="//Admin/@InsurancePhone2Ext[. != '']">
<xsl:value-of select="//Admin/@InsurancePhone2"/>&#32;x<xsl:value-of select="//Admin/@InsurancePhone2Ext"/>
<xsl:value-of select="//Admin/@InsurancePhone2"/>&#32;x
<xsl:value-of select="//Admin/@InsurancePhone2Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin/@InsurancePhone2"/>
@@ -259,7 +265,8 @@
<xsl:attribute name="Fax">
<xsl:choose>
<xsl:when test="//Admin/@InsuranceFaxExt[. != '']">
<xsl:value-of select="//Admin/@InsuranceFax"/>&#32;x<xsl:value-of select="//Admin/@InsuranceFaxExt"/>
<xsl:value-of select="//Admin/@InsuranceFax"/>&#32;x
<xsl:value-of select="//Admin/@InsuranceFaxExt"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin/@InsuranceFax"/>
@@ -272,7 +279,7 @@
</xsl:element>
<xsl:element name="Insured">
<xsl:attribute name="LastName">
<xsl:value-of select="//Admin/@InsuranceLName" />
<xsl:value-of select="//Admin/@InsuranceLName"/>
</xsl:attribute>
</xsl:element>
<xsl:element name="Claim">
@@ -308,7 +315,8 @@
<xsl:choose>
<xsl:when test="string-length(substring-before(//Admin2/@EstimatorZip, '-'))=5">
<xsl:choose>
<xsl:when test="string-length(substring-after(//Admin2/@EstimatorZip, '-'))=4">
<xsl:when
test="string-length(substring-after(//Admin2/@EstimatorZip, '-'))=4">
<xsl:value-of select="//Admin2/@EstimatorZip"/>
</xsl:when>
<xsl:otherwise>
@@ -319,7 +327,8 @@
</xsl:choose>
</xsl:when>
<xsl:when test="string-length(//Admin2/@EstimatorZip)=9">
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 1, 5)"/>-<xsl:value-of select="substring(//Admin2/@EstimatorZip, 6, 4)"/>
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 1, 5)"/>-
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 6, 4)"/>
</xsl:when>
<xsl:when test="string-length(//Admin2/@EstimatorZip)&gt;4">
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 1, 5)"/>
@@ -332,7 +341,8 @@
<xsl:attribute name="Phone">
<xsl:choose>
<xsl:when test="//Admin2/@EstimatorPhone1Ext[. != '']">
<xsl:value-of select="//Admin2/@EstimatorPhone1"/>&#32;x<xsl:value-of select="//Admin2/@EstimatorPhone1Ext"/>
<xsl:value-of select="//Admin2/@EstimatorPhone1"/>&#32;x
<xsl:value-of select="//Admin2/@EstimatorPhone1Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin2/@EstimatorPhone1"/>
@@ -342,7 +352,8 @@
<xsl:attribute name="Phone2">
<xsl:choose>
<xsl:when test="//Admin2/@EstimatorPhone2Ext[. != '']">
<xsl:value-of select="//Admin2/@EstimatorPhone2"/>&#32;x<xsl:value-of select="//Admin2/@EstimatorPhone2Ext"/>
<xsl:value-of select="//Admin2/@EstimatorPhone2"/>&#32;x
<xsl:value-of select="//Admin2/@EstimatorPhone2Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin2/@EstimatorPhone2"/>
@@ -352,7 +363,8 @@
<xsl:attribute name="Fax">
<xsl:choose>
<xsl:when test="//Admin2/@EstimatorFaxExt[. != '']">
<xsl:value-of select="//Admin2/@EstimatorFax"/>&#32;x<xsl:value-of select="//Admin2/@EstimatorFaxExt"/>
<xsl:value-of select="//Admin2/@EstimatorFax"/>&#32;x
<xsl:value-of select="//Admin2/@EstimatorFaxExt"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin2/@EstimatorFax"/>
@@ -368,7 +380,8 @@
<xsl:if test="string-length(//Admin2/@VehicleInDate)&gt;6">
<xsl:value-of select="substring-before(//Admin2/@VehicleInDate, ' ')"/>
<xsl:if test="string-length(//Admin2/@VehicleInTime)=4">
&#32;<xsl:value-of select="substring(//Admin2/@VehicleInTime, 1, 2)"/>:<xsl:value-of select="substring(//Admin2/@VehicleInTime, 3, 2)"/>
&#32;<xsl:value-of select="substring(//Admin2/@VehicleInTime, 1, 2)"/>:
<xsl:value-of select="substring(//Admin2/@VehicleInTime, 3, 2)"/>
</xsl:if>
</xsl:if>
</xsl:attribute>
@@ -376,7 +389,8 @@
<xsl:if test="string-length(//Admin2/@TargetVehicleOutDate)&gt;6">
<xsl:value-of select="substring-before(//Admin2/@TargetVehicleOutDate,' ')"/>
<xsl:if test="string-length(//Admin2/@TargetVehicleOutTime)=4">
&#32;<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 1, 2)"/>:<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 3, 2)"/>
&#32;<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 1, 2)"/>:
<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 3, 2)"/>
</xsl:if>
</xsl:if>
</xsl:attribute>
@@ -384,7 +398,8 @@
<xsl:if test="string-length(//Admin2/@VehicleOutDate)&gt;6">
<xsl:value-of select="substring-before(//Admin2/@VehicleOutDate, ' ')"/>
<xsl:if test="string-length(//Admin2/@VehicleOutTime)=4">
&#32;<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 1, 2)"/>:<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 3, 2)"/>
&#32;<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 1, 2)"/>:
<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 3, 2)"/>
</xsl:if>
</xsl:if>
</xsl:attribute>
@@ -394,16 +409,16 @@
</xsl:for-each>
</xsl:template>
<xsl:template match="PartsList">
<xsl:element name="PartsList" >
<xsl:element name="PartsList">
<xsl:for-each select="Part">
<xsl:element name="Part" >
<xsl:element name="Part">
<!-- Part number translation rules -->
<xsl:variable name="OEMPartNumber">
<xsl:if test="substring(@TDPartNum, string-length(@TDPartNum) - 7) != ' GM PART'">
<xsl:value-of select="@TDPartNum" />
<xsl:value-of select="@TDPartNum"/>
</xsl:if>
<xsl:if test="substring(@TDPartNum, string-length(@TDPartNum) - 7) = ' GM PART'">
<xsl:value-of select="substring-before(@TDPartNum,' GM PART')" />
<xsl:value-of select="substring-before(@TDPartNum,' GM PART')"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="AltPartNumber">
@@ -476,13 +491,13 @@
<xsl:value-of select="$PrimaryPartNumber"/>
</xsl:attribute>
<xsl:attribute name="AltPartNum">
<xsl:value-of select="$SecondaryPartNumber" />
<xsl:value-of select="$SecondaryPartNumber"/>
</xsl:attribute>
<xsl:attribute name="ExternalPartType">
<xsl:value-of select="$PrimaryPartType" />
<xsl:value-of select="$PrimaryPartType"/>
</xsl:attribute>
<xsl:attribute name="ExternalAltPartType">
<xsl:value-of select="$SecondaryPartType" />
<xsl:value-of select="$SecondaryPartType"/>
</xsl:attribute>
<xsl:attribute name="TDPartType">
<xsl:choose>
@@ -505,56 +520,56 @@
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="TDPartDesc">
<xsl:value-of select="@TDPartDesc" />
<xsl:value-of select="@TDPartDesc"/>
</xsl:attribute>
<xsl:attribute name="TDLineRef">
<xsl:value-of select="@TDLineRef" />
<xsl:value-of select="@TDLineRef"/>
</xsl:attribute>
<xsl:attribute name="TDEstimate">
<xsl:choose>
<xsl:when test="@PartType='PAN'">
<xsl:value-of select="@TDEstimate" />
<xsl:value-of select="@TDEstimate"/>
</xsl:when>
<xsl:when test="@PartType='PAM'">
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:when>
<xsl:when test="@PartType='PAA'">
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:when>
<xsl:when test="@PartType='PAL'">
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="TDPartQty">
<xsl:value-of select="@TDPartQty" />
<xsl:value-of select="@TDPartQty"/>
</xsl:attribute>
<xsl:attribute name="LineNumber">
<xsl:value-of select="@LineNumber" />
<xsl:value-of select="@LineNumber"/>
</xsl:attribute>
<xsl:attribute name="SequenceNumber">
<xsl:value-of select="@SequenceNumber" />
<xsl:value-of select="@SequenceNumber"/>
</xsl:attribute>
<xsl:attribute name="SupplLevel">
<xsl:choose>
<xsl:when test="@SupplementLevel = 'E01'">0</xsl:when>
<xsl:when test="substring(@SupplementLevel, 1, 1) = 'S'">
<xsl:value-of select="substring(@SupplementLevel, 2)" />
<xsl:value-of select="substring(@SupplementLevel, 2)"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="LaborType">
<xsl:value-of select="@LaborType" />
<xsl:value-of select="@LaborType"/>
</xsl:attribute>
<xsl:attribute name="LaborHours">
<xsl:value-of select="@LaborHours" />
<xsl:value-of select="@LaborHours"/>
</xsl:attribute>
<xsl:attribute name="OperationCode">
<xsl:value-of select="@LaborOp" />
<xsl:value-of select="@LaborOp"/>
</xsl:attribute>
<xsl:attribute name="CLPart">
<!-- CLPart is false if TRAN_CODE == 2 or TRAN_CODE == 3 -->
@@ -565,10 +580,14 @@
<xsl:when test="@TransactionCode='3'">False</xsl:when>
<xsl:when test="@TransactionCode='1' or @TransactionCode ='2'">
<xsl:choose>
<xsl:when test="@PartType='PAN' or @PartType='PAG' or @PartType='PAM' or @PartType='PAP' or @PartType='PAL' or @PartType='PAA' or @PartType='PAO' or @PartType='PAR' or @PartType=''" >
<xsl:when
test="@PartType='PAN' or @PartType='PAG' or @PartType='PAM' or @PartType='PAP' or @PartType='PAL' or @PartType='PAA' or @PartType='PAO' or @PartType='PAR' or @PartType=''">
<!-- we now handle blank part types-->
<xsl:choose>
<xsl:when test="@LaborType='LAD' or @LaborType='LAE' or @LaborType='LAU' or @LaborType='LAT'">False</xsl:when>
<xsl:when
test="@LaborType='LAD' or @LaborType='LAE' or @LaborType='LAU' or @LaborType='LAT'">
False
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@LaborOp=''">False</xsl:when>

View File

@@ -1,126 +1,217 @@
<?xml version="1.0" encoding="UTF-8"?>
<TranslationDescriptor>
<FileTranslations FormatName="CCC" ElementName="Estimate" Description="Translation Descriptor for a CCC Estimate, Version 2.0">
<FileTranslations FormatName="CCC" ElementName="Estimate"
Description="Translation Descriptor for a CCC Estimate, Version 2.0">
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.env">
<DBFFileTranslation ID="ID1" ElementName="Envelope" Description="Envelope Table">
<DBFFieldSpec FieldName="RO_ID" Form="attribute" Name="RONum" FieldType="" Description="RO Number"/>
<DBFFieldSpec FieldName="UNQFILE_ID" Form="attribute" Name="UniqueFileID" FieldType="" Description="Unique File Identifier"/>
<DBFFieldSpec FieldName="ESTFILE_ID" Form="attribute" Name="EstimateFileID" FieldType="" Description="Estimate File Identifier"/>
<DBFFieldSpec FieldName="INCL_ADMIN" Form="attribute" Name="IncludesAdminInfo" FieldType="Boolean" Description="Includes Admin Info Flag"/>
<DBFFieldSpec FieldName="INCL_VEH" Form="attribute" Name="IncludesVehicleInfo" FieldType="Boolean" Description="Includes Vehicle Info Flag"/>
<DBFFieldSpec FieldName="INCL_EST" Form="attribute" Name="IncludesEstimateInfo" FieldType="Boolean" Description="Includes Estimate Info Flag"/>
<DBFFieldSpec FieldName="INCL_PROFL" Form="attribute" Name="IncludesProfileInfo" FieldType="Boolean" Description="Includes Profile Info Flag"/>
<DBFFieldSpec FieldName="INCL_TOTAL" Form="attribute" Name="IncludesTotalsInfo" FieldType="Boolean" Description="Includes Totals Info Flag"/>
<DBFFieldSpec FieldName="INCL_VENDR" Form="attribute" Name="IncludesVendorInfo" FieldType="Boolean" Description="Includes Vendor Info Flag"/>
<DBFFieldSpec FieldName="EMS_VER" Form="attribute" Name="EMSVersion" FieldType="" Description="EMS Version Number"/>
<DBFFieldSpec FieldName="SUPP_NO" Form="attribute" Name="SupplementNum" FieldType="" Description="Supplement Number"/>
<DBFFieldSpec FieldName="TRANS_TYPE" Form="attribute" Name="TransactionType" FieldType="" Description="Transaction Type"/>
<DBFFieldSpec FieldName="EST_SYSTEM" Form="attribute" Name="EstimatingSystem" FieldType="" Description="Estimating System Software"/>
<DBFFieldSpec FieldName="SW_VERSION" Form="attribute" Name="SoftwareVersion" FieldType="" Description="Software Version Identifier"/>
<DBFFieldSpec FieldName="UNQFILE_ID" Form="attribute" Name="UniqueFileID" FieldType=""
Description="Unique File Identifier"/>
<DBFFieldSpec FieldName="ESTFILE_ID" Form="attribute" Name="EstimateFileID" FieldType=""
Description="Estimate File Identifier"/>
<DBFFieldSpec FieldName="INCL_ADMIN" Form="attribute" Name="IncludesAdminInfo" FieldType="Boolean"
Description="Includes Admin Info Flag"/>
<DBFFieldSpec FieldName="INCL_VEH" Form="attribute" Name="IncludesVehicleInfo" FieldType="Boolean"
Description="Includes Vehicle Info Flag"/>
<DBFFieldSpec FieldName="INCL_EST" Form="attribute" Name="IncludesEstimateInfo" FieldType="Boolean"
Description="Includes Estimate Info Flag"/>
<DBFFieldSpec FieldName="INCL_PROFL" Form="attribute" Name="IncludesProfileInfo" FieldType="Boolean"
Description="Includes Profile Info Flag"/>
<DBFFieldSpec FieldName="INCL_TOTAL" Form="attribute" Name="IncludesTotalsInfo" FieldType="Boolean"
Description="Includes Totals Info Flag"/>
<DBFFieldSpec FieldName="INCL_VENDR" Form="attribute" Name="IncludesVendorInfo" FieldType="Boolean"
Description="Includes Vendor Info Flag"/>
<DBFFieldSpec FieldName="EMS_VER" Form="attribute" Name="EMSVersion" FieldType=""
Description="EMS Version Number"/>
<DBFFieldSpec FieldName="SUPP_NO" Form="attribute" Name="SupplementNum" FieldType=""
Description="Supplement Number"/>
<DBFFieldSpec FieldName="TRANS_TYPE" Form="attribute" Name="TransactionType" FieldType=""
Description="Transaction Type"/>
<DBFFieldSpec FieldName="EST_SYSTEM" Form="attribute" Name="EstimatingSystem" FieldType=""
Description="Estimating System Software"/>
<DBFFieldSpec FieldName="SW_VERSION" Form="attribute" Name="SoftwareVersion" FieldType=""
Description="Software Version Identifier"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.LIN">
<DBFFileTranslation ID="ID2" ElementSetName="PartsList" ElementName="Part" Description="Parts List Table">
<DBFFieldSpec FieldName="OEM_PARTNO" Form="attribute" Name="TDPartNum" FieldType="" Description="Part Number"/>
<DBFFieldSpec FieldName="ALT_PARTNO" Form="attribute" Name="AltPartNum" FieldType="" Description="Alternate Part Number"/>
<DBFFieldSpec FieldName="ACT_PRICE" Form="attribute" Name="ActPrice" FieldType="" Description="Actual Part Price"/>
<DBFFieldSpec FieldName="LINE_DESC" Form="attribute" Name="TDPartDesc" FieldType="" Description="Part Description"/>
<DBFFieldSpec FieldName="DB_PRICE" Form="attribute" Name="TDEstimate" FieldType="" Description="DB_Price"/>
<DBFFieldSpec FieldName="PART_QTY" Form="attribute" Name="TDPartQty" FieldType="" Description="PART_QTY"/>
<DBFFieldSpec FieldName="OEM_PARTNO" Form="attribute" Name="TDPartNum" FieldType=""
Description="Part Number"/>
<DBFFieldSpec FieldName="ALT_PARTNO" Form="attribute" Name="AltPartNum" FieldType=""
Description="Alternate Part Number"/>
<DBFFieldSpec FieldName="ACT_PRICE" Form="attribute" Name="ActPrice" FieldType=""
Description="Actual Part Price"/>
<DBFFieldSpec FieldName="LINE_DESC" Form="attribute" Name="TDPartDesc" FieldType=""
Description="Part Description"/>
<DBFFieldSpec FieldName="DB_PRICE" Form="attribute" Name="TDEstimate" FieldType=""
Description="DB_Price"/>
<DBFFieldSpec FieldName="PART_QTY" Form="attribute" Name="TDPartQty" FieldType=""
Description="PART_QTY"/>
<DBFFieldSpec FieldName="LINE_NO" Form="attribute" Name="LineNumber" FieldType="" Description=""/>
<DBFFieldSpec FieldName="UNQ_SEQ" Form="attribute" Name="SequenceNumber" FieldType="" Description=""/>
<DBFFieldSpec FieldName="PART_TYPE" Form="attribute" Name="PartType" FieldType="" Description="Part Type"/>
<DBFFieldSpec FieldName="MOD_LBR_TY" Form="attribute" Name="LaborType" FieldType="" Description="Labor Type"/>
<DBFFieldSpec FieldName="MOD_LB_HRS" Form="attribute" Name="LaborHours" FieldType="" Description="Labor Hours"/>
<DBFFieldSpec FieldName="PART_TYPE" Form="attribute" Name="PartType" FieldType=""
Description="Part Type"/>
<DBFFieldSpec FieldName="MOD_LBR_TY" Form="attribute" Name="LaborType" FieldType=""
Description="Labor Type"/>
<DBFFieldSpec FieldName="MOD_LB_HRS" Form="attribute" Name="LaborHours" FieldType=""
Description="Labor Hours"/>
<DBFFieldSpec FieldName="LBR_OP" Form="attribute" Name="LaborOp" FieldType="" Description="Labor Op"/>
<DBFFieldSpec FieldName="LINE_IND" Form="attribute" Name="SupplementLevel" FieldType="" Description="Supplement Level"/>
<DBFFieldSpec FieldName="TRAN_CODE" Form="attribute" Name="TransactionCode" FieldType="" Description="Transaction Code"/>
<DBFFieldSpec FieldName="LINE_REF" Form="attribute" Name="TDLineRef" FieldType="" Description="Line Reference Number"/>
<DBFFieldSpec FieldName="LINE_IND" Form="attribute" Name="SupplementLevel" FieldType=""
Description="Supplement Level"/>
<DBFFieldSpec FieldName="TRAN_CODE" Form="attribute" Name="TransactionCode" FieldType=""
Description="Transaction Code"/>
<DBFFieldSpec FieldName="LINE_REF" Form="attribute" Name="TDLineRef" FieldType=""
Description="Line Reference Number"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.VEH">
<DBFFileTranslation ID="ID3" ElementName="Vehicle" Description="Vehicle Table">
<DBFFieldSpec FieldName="V_VIN" Form="attribute" Name="TransVIN" FieldType="" Description="V_VIN"/>
<DBFFieldSpec FieldName="V_MODEL_YR" Form="attribute" Name="TransYear" FieldType="" Description="V_MODEL_YR"/>
<DBFFieldSpec FieldName="V_MAKEDESC" Form="attribute" Name="ManufName" FieldType="" Description="V_MAKEDESC"/>
<DBFFieldSpec FieldName="V_MAKECODE" Form="attribute" Name="ManufCode" FieldType="" Description="V_MAKECODE"/>
<DBFFieldSpec FieldName="V_MODEL" Form="attribute" Name="TransModel" FieldType="" Description="V_MODEL"/>
<DBFFieldSpec FieldName="V_MILEAGE" Form="attribute" Name="TransMileage" FieldType="" Description="V_MILEAGE"/>
<DBFFieldSpec FieldName="V_MODEL_YR" Form="attribute" Name="TransYear" FieldType=""
Description="V_MODEL_YR"/>
<DBFFieldSpec FieldName="V_MAKEDESC" Form="attribute" Name="ManufName" FieldType=""
Description="V_MAKEDESC"/>
<DBFFieldSpec FieldName="V_MAKECODE" Form="attribute" Name="ManufCode" FieldType=""
Description="V_MAKECODE"/>
<DBFFieldSpec FieldName="V_MODEL" Form="attribute" Name="TransModel" FieldType=""
Description="V_MODEL"/>
<DBFFieldSpec FieldName="V_MILEAGE" Form="attribute" Name="TransMileage" FieldType=""
Description="V_MILEAGE"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.AD1">
<DBFFileTranslation ID="ID4" ElementName="Admin" Description="Administrative information">
<DBFFieldSpec FieldName="OWNR_LN" Form="attribute" Name="OwnerL" FieldType="" Description="Owner Lastname"/>
<DBFFieldSpec FieldName="OWNR_FN" Form="attribute" Name="OwnerF" FieldType="" Description="Owner Firstname"/>
<DBFFieldSpec FieldName="OWNR_CO_NM" Form="attribute" Name="OwnerCompanyName" FieldType="" Description="Owner Company Name"/>
<DBFFieldSpec FieldName="OWNR_TITLE" Form="attribute" Name="OwnerTitle" FieldType="" Description="Owner Title"/>
<DBFFieldSpec FieldName="OWNR_ADDR1" Form="attribute" Name="OwnerAddr1" FieldType="" Description="Owner Address Line 1"/>
<DBFFieldSpec FieldName="OWNR_ADDR2" Form="attribute" Name="OwnerAddr2" FieldType="" Description="Owner Address Line 2"/>
<DBFFieldSpec FieldName="OWNR_CITY" Form="attribute" Name="OwnerCity" FieldType="" Description="Owner City"/>
<DBFFieldSpec FieldName="OWNR_ST" Form="attribute" Name="OwnerState" FieldType="" Description="Owner State"/>
<DBFFieldSpec FieldName="OWNR_ZIP" Form="attribute" Name="OwnerZip" FieldType="" Description="Owner Zip"/>
<DBFFieldSpec FieldName="OWNR_CTRY" Form="attribute" Name="OwnerCountry" FieldType="" Description="Owner Country"/>
<DBFFieldSpec FieldName="OWNR_PH1" Form="attribute" Name="OwnerPhone1" FieldType="" Description="Owner Primary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH1X" Form="attribute" Name="OwnerPhone1Ext" FieldType="" Description="Owner Primary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_PH2" Form="attribute" Name="OwnerPhone2" FieldType="" Description="Owner Secondary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH2X" Form="attribute" Name="OwnerPhone2Ext" FieldType="" Description="Owner Secondary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_FAX" Form="attribute" Name="OwnerFax" FieldType="" Description="Owner Fax"/>
<DBFFieldSpec FieldName="OWNR_FAXX" Form="attribute" Name="OwnerFaxExt" FieldType="" Description="Owner Fax Extension"/>
<DBFFieldSpec FieldName="OWNR_EA" Form="attribute" Name="OwnerEmail" FieldType="" Description="Owner Email Address"/>
<DBFFieldSpec FieldName="INS_CO_NM" Form="attribute" Name="InsuranceCompanyName" FieldType="" Description="Insurance Company Name"/>
<DBFFieldSpec FieldName="INS_CO_ID" Form="attribute" Name="InsuranceCompanyID" FieldType="" Description="Insurance Company Identifier"/>
<DBFFieldSpec FieldName="INS_ADDR1" Form="attribute" Name="InsuranceAddr1" FieldType="" Description="Insurance Address Line 1"/>
<DBFFieldSpec FieldName="INS_ADDR2" Form="attribute" Name="InsuranceAddr2" FieldType="" Description="Insurance Address Line 2"/>
<DBFFieldSpec FieldName="INS_CITY" Form="attribute" Name="InsuranceCity" FieldType="" Description="Insurance City"/>
<DBFFieldSpec FieldName="INS_ST" Form="attribute" Name="InsuranceState" FieldType="" Description="Insurance State"/>
<DBFFieldSpec FieldName="INS_ZIP" Form="attribute" Name="InsuranceZip" FieldType="" Description="Insurance Zip"/>
<DBFFieldSpec FieldName="INS_CTRY" Form="attribute" Name="InsuranceCountry" FieldType="" Description="Insurance Country"/>
<DBFFieldSpec FieldName="INS_PH1" Form="attribute" Name="InsurancePhone1" FieldType="" Description="Insurance Primary Phone"/>
<DBFFieldSpec FieldName="INS_PH1X" Form="attribute" Name="InsurancePhone1Ext" FieldType="" Description="Insurance Primary Phone Extension"/>
<DBFFieldSpec FieldName="INS_PH2" Form="attribute" Name="InsurancePhone2" FieldType="" Description="Insurance Secondary Phone"/>
<DBFFieldSpec FieldName="INS_PH2X" Form="attribute" Name="InsurancePhone2Ext" FieldType="" Description="Insurance Secondary Phone Extension"/>
<DBFFieldSpec FieldName="INS_FAX" Form="attribute" Name="InsuranceFax" FieldType="" Description="Insurance Fax"/>
<DBFFieldSpec FieldName="INS_FAXX" Form="attribute" Name="InsuranceFaxExt" FieldType="" Description="Insurance Fax Extension"/>
<DBFFieldSpec FieldName="INS_EA" Form="attribute" Name="InsuranceEmail" FieldType="" Description="Insurance Email Address"/>
<DBFFieldSpec FieldName="INSD_LN" Form="attribute" Name="InsuranceLName" FieldType="" Description="Insurance Last Name"/>
<DBFFieldSpec FieldName="CLM_NO" Form="attribute" Name="ClaimNumber" FieldType="" Description="Claim Number"/>
<DBFFieldSpec FieldName="OWNR_LN" Form="attribute" Name="OwnerL" FieldType=""
Description="Owner Lastname"/>
<DBFFieldSpec FieldName="OWNR_FN" Form="attribute" Name="OwnerF" FieldType=""
Description="Owner Firstname"/>
<DBFFieldSpec FieldName="OWNR_CO_NM" Form="attribute" Name="OwnerCompanyName" FieldType=""
Description="Owner Company Name"/>
<DBFFieldSpec FieldName="OWNR_TITLE" Form="attribute" Name="OwnerTitle" FieldType=""
Description="Owner Title"/>
<DBFFieldSpec FieldName="OWNR_ADDR1" Form="attribute" Name="OwnerAddr1" FieldType=""
Description="Owner Address Line 1"/>
<DBFFieldSpec FieldName="OWNR_ADDR2" Form="attribute" Name="OwnerAddr2" FieldType=""
Description="Owner Address Line 2"/>
<DBFFieldSpec FieldName="OWNR_CITY" Form="attribute" Name="OwnerCity" FieldType=""
Description="Owner City"/>
<DBFFieldSpec FieldName="OWNR_ST" Form="attribute" Name="OwnerState" FieldType=""
Description="Owner State"/>
<DBFFieldSpec FieldName="OWNR_ZIP" Form="attribute" Name="OwnerZip" FieldType=""
Description="Owner Zip"/>
<DBFFieldSpec FieldName="OWNR_CTRY" Form="attribute" Name="OwnerCountry" FieldType=""
Description="Owner Country"/>
<DBFFieldSpec FieldName="OWNR_PH1" Form="attribute" Name="OwnerPhone1" FieldType=""
Description="Owner Primary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH1X" Form="attribute" Name="OwnerPhone1Ext" FieldType=""
Description="Owner Primary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_PH2" Form="attribute" Name="OwnerPhone2" FieldType=""
Description="Owner Secondary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH2X" Form="attribute" Name="OwnerPhone2Ext" FieldType=""
Description="Owner Secondary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_FAX" Form="attribute" Name="OwnerFax" FieldType=""
Description="Owner Fax"/>
<DBFFieldSpec FieldName="OWNR_FAXX" Form="attribute" Name="OwnerFaxExt" FieldType=""
Description="Owner Fax Extension"/>
<DBFFieldSpec FieldName="OWNR_EA" Form="attribute" Name="OwnerEmail" FieldType=""
Description="Owner Email Address"/>
<DBFFieldSpec FieldName="INS_CO_NM" Form="attribute" Name="InsuranceCompanyName" FieldType=""
Description="Insurance Company Name"/>
<DBFFieldSpec FieldName="INS_CO_ID" Form="attribute" Name="InsuranceCompanyID" FieldType=""
Description="Insurance Company Identifier"/>
<DBFFieldSpec FieldName="INS_ADDR1" Form="attribute" Name="InsuranceAddr1" FieldType=""
Description="Insurance Address Line 1"/>
<DBFFieldSpec FieldName="INS_ADDR2" Form="attribute" Name="InsuranceAddr2" FieldType=""
Description="Insurance Address Line 2"/>
<DBFFieldSpec FieldName="INS_CITY" Form="attribute" Name="InsuranceCity" FieldType=""
Description="Insurance City"/>
<DBFFieldSpec FieldName="INS_ST" Form="attribute" Name="InsuranceState" FieldType=""
Description="Insurance State"/>
<DBFFieldSpec FieldName="INS_ZIP" Form="attribute" Name="InsuranceZip" FieldType=""
Description="Insurance Zip"/>
<DBFFieldSpec FieldName="INS_CTRY" Form="attribute" Name="InsuranceCountry" FieldType=""
Description="Insurance Country"/>
<DBFFieldSpec FieldName="INS_PH1" Form="attribute" Name="InsurancePhone1" FieldType=""
Description="Insurance Primary Phone"/>
<DBFFieldSpec FieldName="INS_PH1X" Form="attribute" Name="InsurancePhone1Ext" FieldType=""
Description="Insurance Primary Phone Extension"/>
<DBFFieldSpec FieldName="INS_PH2" Form="attribute" Name="InsurancePhone2" FieldType=""
Description="Insurance Secondary Phone"/>
<DBFFieldSpec FieldName="INS_PH2X" Form="attribute" Name="InsurancePhone2Ext" FieldType=""
Description="Insurance Secondary Phone Extension"/>
<DBFFieldSpec FieldName="INS_FAX" Form="attribute" Name="InsuranceFax" FieldType=""
Description="Insurance Fax"/>
<DBFFieldSpec FieldName="INS_FAXX" Form="attribute" Name="InsuranceFaxExt" FieldType=""
Description="Insurance Fax Extension"/>
<DBFFieldSpec FieldName="INS_EA" Form="attribute" Name="InsuranceEmail" FieldType=""
Description="Insurance Email Address"/>
<DBFFieldSpec FieldName="INSD_LN" Form="attribute" Name="InsuranceLName" FieldType=""
Description="Insurance Last Name"/>
<DBFFieldSpec FieldName="CLM_NO" Form="attribute" Name="ClaimNumber" FieldType=""
Description="Claim Number"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.AD2">
<DBFFileTranslation ID="ID5" ElementName="Admin2" Description="Administrative information2">
<DBFFieldSpec FieldName="EST_CT_LN" Form="attribute" Name="EstimatorL" FieldType="" Description="Estimator Lastname"/>
<DBFFieldSpec FieldName="EST_CT_FN" Form="attribute" Name="EstimatorF" FieldType="" Description="Estimator Firstname"/>
<DBFFieldSpec FieldName="EST_CO_NM" Form="attribute" Name="EstimatorCompanyName" FieldType="" Description="Estimator Company Name"/>
<DBFFieldSpec FieldName="EST_CO_ID" Form="attribute" Name="EstimatorCompanyID" FieldType="" Description="Estimator Company Identifier"/>
<DBFFieldSpec FieldName="EST_ADDR1" Form="attribute" Name="EstimatorAddr1" FieldType="" Description="Estimator Address1"/>
<DBFFieldSpec FieldName="EST_ADDR2" Form="attribute" Name="EstimatorAddr2" FieldType="" Description="Estimator Address2"/>
<DBFFieldSpec FieldName="EST_CITY" Form="attribute" Name="EstimatorCity" FieldType="" Description="Estimator City"/>
<DBFFieldSpec FieldName="EST_ST" Form="attribute" Name="EstimatorState" FieldType="" Description="Estimator State"/>
<DBFFieldSpec FieldName="EST_ZIP" Form="attribute" Name="EstimatorZip" FieldType="" Description="Estimator Zip"/>
<DBFFieldSpec FieldName="EST_CTRY" Form="attribute" Name="EstimatorCountry" FieldType="" Description="Estimator Country"/>
<DBFFieldSpec FieldName="EST_PH1" Form="attribute" Name="EstimatorPhone1" FieldType="" Description="Estimator Primary Phone"/>
<DBFFieldSpec FieldName="EST_PH1X" Form="attribute" Name="EstimatorPhone1Ext" FieldType="" Description="Estimator Primary Phone Extension"/>
<DBFFieldSpec FieldName="EST_PH2" Form="attribute" Name="EstimatorPhone2" FieldType="" Description="Estimator Secondary Phone"/>
<DBFFieldSpec FieldName="EST_PH2X" Form="attribute" Name="EstimatorPhone2Ext" FieldType="" Description="Estimator Secondary Phone Extension"/>
<DBFFieldSpec FieldName="EST_FAX" Form="attribute" Name="EstimatorFax" FieldType="" Description="Estimator Fax"/>
<DBFFieldSpec FieldName="EST_FAXX" Form="attribute" Name="EstimatorFaxExt" FieldType="" Description="Estimator Fax Extension"/>
<DBFFieldSpec FieldName="EST_EA" Form="attribute" Name="EstimatorEmail" FieldType="" Description="Estimator Email Address"/>
<DBFFieldSpec FieldName="EST_LIC_NO" Form="attribute" Name="EstimatorLicenseNumber" FieldType="" Description="Estimator License Number"/>
<DBFFieldSpec FieldName="EST_FILENO" Form="attribute" Name="EstimatorFileNumber" FieldType="" Description="Estimator File Number"/>
<DBFFieldSpec FieldName="RO_IN_DATE" Form="attribute" Name="VehicleInDate" FieldType="" Description="Date arrived in shop"/>
<DBFFieldSpec FieldName="RO_IN_TIME" Form="attribute" Name="VehicleInTime" FieldType="" Description="Time arrived in shop"/>
<DBFFieldSpec FieldName="TAR_DATE" Form="attribute" Name="TargetVehicleOutDate" FieldType="" Description="Target date to be completed"/>
<DBFFieldSpec FieldName="TAR_TIME" Form="attribute" Name="TargetVehicleOutTime" FieldType="" Description="Target time to be completed"/>
<DBFFieldSpec FieldName="RO_CMPDATE" Form="attribute" Name="VehicleOutDate" FieldType="" Description="Date completed"/>
<DBFFieldSpec FieldName="RO_CMPTIME" Form="attribute" Name="VehicleOutTime" FieldType="" Description="Time completed"/>
<DBFFieldSpec FieldName="EST_CT_LN" Form="attribute" Name="EstimatorL" FieldType=""
Description="Estimator Lastname"/>
<DBFFieldSpec FieldName="EST_CT_FN" Form="attribute" Name="EstimatorF" FieldType=""
Description="Estimator Firstname"/>
<DBFFieldSpec FieldName="EST_CO_NM" Form="attribute" Name="EstimatorCompanyName" FieldType=""
Description="Estimator Company Name"/>
<DBFFieldSpec FieldName="EST_CO_ID" Form="attribute" Name="EstimatorCompanyID" FieldType=""
Description="Estimator Company Identifier"/>
<DBFFieldSpec FieldName="EST_ADDR1" Form="attribute" Name="EstimatorAddr1" FieldType=""
Description="Estimator Address1"/>
<DBFFieldSpec FieldName="EST_ADDR2" Form="attribute" Name="EstimatorAddr2" FieldType=""
Description="Estimator Address2"/>
<DBFFieldSpec FieldName="EST_CITY" Form="attribute" Name="EstimatorCity" FieldType=""
Description="Estimator City"/>
<DBFFieldSpec FieldName="EST_ST" Form="attribute" Name="EstimatorState" FieldType=""
Description="Estimator State"/>
<DBFFieldSpec FieldName="EST_ZIP" Form="attribute" Name="EstimatorZip" FieldType=""
Description="Estimator Zip"/>
<DBFFieldSpec FieldName="EST_CTRY" Form="attribute" Name="EstimatorCountry" FieldType=""
Description="Estimator Country"/>
<DBFFieldSpec FieldName="EST_PH1" Form="attribute" Name="EstimatorPhone1" FieldType=""
Description="Estimator Primary Phone"/>
<DBFFieldSpec FieldName="EST_PH1X" Form="attribute" Name="EstimatorPhone1Ext" FieldType=""
Description="Estimator Primary Phone Extension"/>
<DBFFieldSpec FieldName="EST_PH2" Form="attribute" Name="EstimatorPhone2" FieldType=""
Description="Estimator Secondary Phone"/>
<DBFFieldSpec FieldName="EST_PH2X" Form="attribute" Name="EstimatorPhone2Ext" FieldType=""
Description="Estimator Secondary Phone Extension"/>
<DBFFieldSpec FieldName="EST_FAX" Form="attribute" Name="EstimatorFax" FieldType=""
Description="Estimator Fax"/>
<DBFFieldSpec FieldName="EST_FAXX" Form="attribute" Name="EstimatorFaxExt" FieldType=""
Description="Estimator Fax Extension"/>
<DBFFieldSpec FieldName="EST_EA" Form="attribute" Name="EstimatorEmail" FieldType=""
Description="Estimator Email Address"/>
<DBFFieldSpec FieldName="EST_LIC_NO" Form="attribute" Name="EstimatorLicenseNumber" FieldType=""
Description="Estimator License Number"/>
<DBFFieldSpec FieldName="EST_FILENO" Form="attribute" Name="EstimatorFileNumber" FieldType=""
Description="Estimator File Number"/>
<DBFFieldSpec FieldName="RO_IN_DATE" Form="attribute" Name="VehicleInDate" FieldType=""
Description="Date arrived in shop"/>
<DBFFieldSpec FieldName="RO_IN_TIME" Form="attribute" Name="VehicleInTime" FieldType=""
Description="Time arrived in shop"/>
<DBFFieldSpec FieldName="TAR_DATE" Form="attribute" Name="TargetVehicleOutDate" FieldType=""
Description="Target date to be completed"/>
<DBFFieldSpec FieldName="TAR_TIME" Form="attribute" Name="TargetVehicleOutTime" FieldType=""
Description="Target time to be completed"/>
<DBFFieldSpec FieldName="RO_CMPDATE" Form="attribute" Name="VehicleOutDate" FieldType=""
Description="Date completed"/>
<DBFFieldSpec FieldName="RO_CMPTIME" Form="attribute" Name="VehicleOutTime" FieldType=""
Description="Time completed"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.TTL">
<DBFFileTranslation ID="ID6" ElementName="Total" Description="Total Table">
<DBFFieldSpec FieldName="G_TTL_AMT" Form="attribute" Name="GrandTotalAmount" FieldType="" Description=""/>
</DBFFileTranslation>
<DBFFileTranslation ID="ID6" ElementName="Total" Description="Total Table">
<DBFFieldSpec FieldName="G_TTL_AMT" Form="attribute" Name="GrandTotalAmount" FieldType=""
Description=""/>
</DBFFileTranslation>
</FileTranslation>
</FileTranslations>
<StyleSheetTranslation>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:for-each select="//TranslatedData">
@@ -9,23 +9,23 @@
</xsl:attribute>
<xsl:choose>
<xsl:when test="Details/@PrgID">
<xsl:copy-of select="Details" />
<xsl:copy-of select="Details"/>
</xsl:when>
<xsl:otherwise>
<xsl:element name="Details">
<xsl:attribute name="PrgID">OECTrans.ImportTrans</xsl:attribute>
<xsl:for-each select="Details/@*">
<xsl:copy-of select="." />
<xsl:copy-of select="."/>
</xsl:for-each>
<xsl:for-each select="Details/*">
<xsl:copy-of select="." />
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
<xsl:element name="Header">
<xsl:attribute name="RONum">
<xsl:value-of select="//Envelope/@RONum" />
<xsl:value-of select="//Envelope/@RONum"/>
</xsl:attribute>
<xsl:attribute name="OwnerFName">
<xsl:value-of select="//Admin/@OwnerF"/>
@@ -34,42 +34,42 @@
<xsl:value-of select="//Admin/@OwnerL"/>
</xsl:attribute>
<xsl:attribute name="VIN">
<xsl:value-of select="//Vehicle/@TransVIN" />
<xsl:value-of select="//Vehicle/@TransVIN"/>
</xsl:attribute>
<xsl:attribute name="Mileage">
<xsl:value-of select="//Vehicle/@TransMileage" />
<xsl:value-of select="//Vehicle/@TransMileage"/>
</xsl:attribute>
<xsl:attribute name="Year">
<xsl:value-of select="//Vehicle/@TransYear" />
<xsl:value-of select="//Vehicle/@TransYear"/>
</xsl:attribute>
<xsl:attribute name="Make">
<xsl:if test="//Vehicle/@ManufName[. != '']" >
<xsl:value-of select="//Vehicle/@ManufName" />
<xsl:if test="//Vehicle/@ManufName[. != '']">
<xsl:value-of select="//Vehicle/@ManufName"/>
</xsl:if>
<xsl:if test="//Vehicle/@ManufName[. = '']" >
<xsl:value-of select="//Vehicle/@ManufCode" />
<xsl:if test="//Vehicle/@ManufName[. = '']">
<xsl:value-of select="//Vehicle/@ManufCode"/>
</xsl:if>
</xsl:attribute>
<xsl:attribute name="Model">
<xsl:value-of select="//Vehicle/@TransModel" />
<xsl:value-of select="//Vehicle/@TransModel"/>
</xsl:attribute>
<xsl:attribute name="Description">
<xsl:value-of select="//Vehicle/@TransYear" />
<xsl:text> </xsl:text>
<xsl:value-of select="//Vehicle/@ManufName" />
<xsl:text> </xsl:text>
<xsl:value-of select="//Vehicle/@TransModel" />
<xsl:value-of select="//Vehicle/@TransYear"/>
<xsl:text></xsl:text>
<xsl:value-of select="//Vehicle/@ManufName"/>
<xsl:text></xsl:text>
<xsl:value-of select="//Vehicle/@TransModel"/>
</xsl:attribute>
<xsl:attribute name="LastSupplLevel">
<xsl:choose>
<xsl:when test="string-length(//Envelope/@SupplementNum) > 0">
<xsl:value-of select="//Envelope/@SupplementNum" />
<xsl:value-of select="//Envelope/@SupplementNum"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:element>
<xsl:apply-templates select="PartsList" />
<xsl:apply-templates select="PartsList"/>
<xsl:element name="Envelope">
<xsl:element name="Software">
<xsl:attribute name="Manifest">Mitchell.xml</xsl:attribute>
@@ -90,10 +90,13 @@
<xsl:value-of select="//Envelope/@UniqueFileID"/>
</xsl:attribute>
<xsl:attribute name="EstimateID">
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-<xsl:value-of select="//Envelope/@SoftwareVersion"/>-<xsl:value-of select="//Envelope/@EstimateFileID"/>
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-<xsl:value-of
select="//Envelope/@SoftwareVersion"/>-
<xsl:value-of select="//Envelope/@EstimateFileID"/>
</xsl:attribute>
<xsl:attribute name="EstimateIDv2">
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-<xsl:value-of select="//Envelope/@EstimateFileID"/>
<xsl:value-of select="//Envelope/@EstimatingSystem"/>-
<xsl:value-of select="//Envelope/@EstimateFileID"/>
</xsl:attribute>
<xsl:attribute name="EstimateFormatVersion">
<xsl:value-of select="//Envelope/@EMSVersion"/>
@@ -102,7 +105,7 @@
</xsl:element>
<xsl:element name="Totals">
<xsl:attribute name="GrandTotalAmount">
<xsl:value-of select="//Total/@GrandTotalAmount"/>
<xsl:value-of select="//Total/@GrandTotalAmount"/>
</xsl:attribute>
</xsl:element>
<xsl:element name="Administrative">
@@ -214,7 +217,8 @@
<xsl:choose>
<xsl:when test="string-length(substring-before(//Admin/@InsuranceZip, '-'))=5">
<xsl:choose>
<xsl:when test="string-length(substring-after(//Admin/@InsuranceZip, '-'))=4">
<xsl:when
test="string-length(substring-after(//Admin/@InsuranceZip, '-'))=4">
<xsl:value-of select="//Admin/@InsuranceZip"/>
</xsl:when>
<xsl:otherwise>
@@ -225,7 +229,8 @@
</xsl:choose>
</xsl:when>
<xsl:when test="string-length(//Admin/@InsuranceZip)=9">
<xsl:value-of select="substring(//Admin/@InsuranceZip, 1, 5)"/>-<xsl:value-of select="substring(//Admin/@InsuranceZip, 6, 4)"/>
<xsl:value-of select="substring(//Admin/@InsuranceZip, 1, 5)"/>-
<xsl:value-of select="substring(//Admin/@InsuranceZip, 6, 4)"/>
</xsl:when>
<xsl:when test="string-length(//Admin/@InsuranceZip)&gt;4">
<xsl:value-of select="substring(//Admin/@InsuranceZip, 1, 5)"/>
@@ -238,7 +243,8 @@
<xsl:attribute name="Phone">
<xsl:choose>
<xsl:when test="//Admin/@InsurancePhone1Ext[. != '']">
<xsl:value-of select="//Admin/@InsurancePhone1"/>&#32;x<xsl:value-of select="//Admin/@InsurancePhone1Ext"/>
<xsl:value-of select="//Admin/@InsurancePhone1"/>&#32;x
<xsl:value-of select="//Admin/@InsurancePhone1Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin/@InsurancePhone1"/>
@@ -248,7 +254,8 @@
<xsl:attribute name="Phone2">
<xsl:choose>
<xsl:when test="//Admin/@InsurancePhone2Ext[. != '']">
<xsl:value-of select="//Admin/@InsurancePhone2"/>&#32;x<xsl:value-of select="//Admin/@InsurancePhone2Ext"/>
<xsl:value-of select="//Admin/@InsurancePhone2"/>&#32;x
<xsl:value-of select="//Admin/@InsurancePhone2Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin/@InsurancePhone2"/>
@@ -258,7 +265,8 @@
<xsl:attribute name="Fax">
<xsl:choose>
<xsl:when test="//Admin/@InsuranceFaxExt[. != '']">
<xsl:value-of select="//Admin/@InsuranceFax"/>&#32;x<xsl:value-of select="//Admin/@InsuranceFaxExt"/>
<xsl:value-of select="//Admin/@InsuranceFax"/>&#32;x
<xsl:value-of select="//Admin/@InsuranceFaxExt"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin/@InsuranceFax"/>
@@ -310,7 +318,8 @@
<xsl:choose>
<xsl:when test="string-length(substring-before(//Admin2/@EstimatorZip, '-'))=5">
<xsl:choose>
<xsl:when test="string-length(substring-after(//Admin2/@EstimatorZip, '-'))=4">
<xsl:when
test="string-length(substring-after(//Admin2/@EstimatorZip, '-'))=4">
<xsl:value-of select="//Admin2/@EstimatorZip"/>
</xsl:when>
<xsl:otherwise>
@@ -321,7 +330,8 @@
</xsl:choose>
</xsl:when>
<xsl:when test="string-length(//Admin2/@EstimatorZip)=9">
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 1, 5)"/>-<xsl:value-of select="substring(//Admin2/@EstimatorZip, 6, 4)"/>
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 1, 5)"/>-
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 6, 4)"/>
</xsl:when>
<xsl:when test="string-length(//Admin2/@EstimatorZip)&gt;4">
<xsl:value-of select="substring(//Admin2/@EstimatorZip, 1, 5)"/>
@@ -334,7 +344,8 @@
<xsl:attribute name="Phone">
<xsl:choose>
<xsl:when test="//Admin2/@EstimatorPhone1Ext[. != '']">
<xsl:value-of select="//Admin2/@EstimatorPhone1"/>&#32;x<xsl:value-of select="//Admin2/@EstimatorPhone1Ext"/>
<xsl:value-of select="//Admin2/@EstimatorPhone1"/>&#32;x
<xsl:value-of select="//Admin2/@EstimatorPhone1Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin2/@EstimatorPhone1"/>
@@ -344,7 +355,8 @@
<xsl:attribute name="Phone2">
<xsl:choose>
<xsl:when test="//Admin2/@EstimatorPhone2Ext[. != '']">
<xsl:value-of select="//Admin2/@EstimatorPhone2"/>&#32;x<xsl:value-of select="//Admin2/@EstimatorPhone2Ext"/>
<xsl:value-of select="//Admin2/@EstimatorPhone2"/>&#32;x
<xsl:value-of select="//Admin2/@EstimatorPhone2Ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin2/@EstimatorPhone2"/>
@@ -354,7 +366,8 @@
<xsl:attribute name="Fax">
<xsl:choose>
<xsl:when test="//Admin2/@EstimatorFaxExt[. != '']">
<xsl:value-of select="//Admin2/@EstimatorFax"/>&#32;x<xsl:value-of select="//Admin2/@EstimatorFaxExt"/>
<xsl:value-of select="//Admin2/@EstimatorFax"/>&#32;x
<xsl:value-of select="//Admin2/@EstimatorFaxExt"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Admin2/@EstimatorFax"/>
@@ -370,7 +383,8 @@
<xsl:if test="string-length(//Admin2/@VehicleInDate)&gt;6">
<xsl:value-of select="substring-before(//Admin2/@VehicleInDate, ' ')"/>
<xsl:if test="string-length(//Admin2/@VehicleInTime)=4">
&#32;<xsl:value-of select="substring(//Admin2/@VehicleInTime, 1, 2)"/>:<xsl:value-of select="substring(//Admin2/@VehicleInTime, 3, 2)"/>
&#32;<xsl:value-of select="substring(//Admin2/@VehicleInTime, 1, 2)"/>:
<xsl:value-of select="substring(//Admin2/@VehicleInTime, 3, 2)"/>
</xsl:if>
</xsl:if>
</xsl:attribute>
@@ -378,7 +392,8 @@
<xsl:if test="string-length(//Admin2/@TargetVehicleOutDate)&gt;6">
<xsl:value-of select="substring-before(//Admin2/@TargetVehicleOutDate,' ')"/>
<xsl:if test="string-length(//Admin2/@TargetVehicleOutTime)=4">
&#32;<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 1, 2)"/>:<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 3, 2)"/>
&#32;<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 1, 2)"/>:
<xsl:value-of select="substring(//Admin2/@TargetVehicleOutTime, 3, 2)"/>
</xsl:if>
</xsl:if>
</xsl:attribute>
@@ -386,7 +401,8 @@
<xsl:if test="string-length(//Admin2/@VehicleOutDate)&gt;6">
<xsl:value-of select="substring-before(//Admin2/@VehicleOutDate, ' ')"/>
<xsl:if test="string-length(//Admin2/@VehicleOutTime)=4">
&#32;<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 1, 2)"/>:<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 3, 2)"/>
&#32;<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 1, 2)"/>:
<xsl:value-of select="substring(//Admin2/@VehicleOutTime, 3, 2)"/>
</xsl:if>
</xsl:if>
</xsl:attribute>
@@ -396,16 +412,16 @@
</xsl:for-each>
</xsl:template>
<xsl:template match="PartsList">
<xsl:element name="PartsList" >
<xsl:element name="PartsList">
<xsl:for-each select="Part">
<xsl:element name="Part" >
<xsl:element name="Part">
<!-- Part number translation rules -->
<xsl:variable name="OEMPartNumber">
<xsl:if test="substring(@TDPartNum, string-length(@TDPartNum) - 7) != ' GM PART'">
<xsl:value-of select="@TDPartNum" />
<xsl:value-of select="@TDPartNum"/>
</xsl:if>
<xsl:if test="substring(@TDPartNum, string-length(@TDPartNum) - 7) = ' GM PART'">
<xsl:value-of select="substring-before(@TDPartNum,' GM PART')" />
<xsl:value-of select="substring-before(@TDPartNum,' GM PART')"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="AltPartNumber">
@@ -448,13 +464,13 @@
<xsl:value-of select="$PrimaryPartNumber"/>
</xsl:attribute>
<xsl:attribute name="AltPartNum">
<xsl:value-of select="$SecondaryPartNumber" />
<xsl:value-of select="$SecondaryPartNumber"/>
</xsl:attribute>
<xsl:attribute name="ExternalPartType">
<xsl:value-of select="$PrimaryPartType" />
<xsl:value-of select="$PrimaryPartType"/>
</xsl:attribute>
<xsl:attribute name="ExternalAltPartType">
<xsl:value-of select="$SecondaryPartType" />
<xsl:value-of select="$SecondaryPartType"/>
</xsl:attribute>
<xsl:attribute name="TDPartType">
<xsl:choose>
@@ -479,59 +495,59 @@
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="TDPartDesc">
<xsl:value-of select="@TDPartDesc" />
<xsl:value-of select="@TDPartDesc"/>
</xsl:attribute>
<xsl:attribute name="TDEstimate">
<xsl:choose>
<xsl:when test="@PartType='PAN'">
<xsl:value-of select="@TDEstimate" />
<xsl:value-of select="@TDEstimate"/>
</xsl:when>
<xsl:when test="@PartType='PAM'">
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:when>
<xsl:when test="@PartType='PAA'">
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:when>
<xsl:when test="@PartType='PAL'">
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@ActPrice" />
<xsl:value-of select="@ActPrice"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="TDPartQty">
<xsl:value-of select="@TDPartQty" />
<xsl:value-of select="@TDPartQty"/>
</xsl:attribute>
<xsl:attribute name="LineNumber">
<xsl:value-of select="@LineNumber" />
<xsl:value-of select="@LineNumber"/>
</xsl:attribute>
<xsl:attribute name="SequenceNumber">
<xsl:value-of select="@SequenceNumber" />
<xsl:value-of select="@SequenceNumber"/>
</xsl:attribute>
<xsl:attribute name="SupplLevel">
<xsl:choose>
<xsl:when test="@SupplementLevel = 'E'">0</xsl:when>
<xsl:when test="substring(@SupplementLevel, 1, 1) = 'S'">
<xsl:value-of select="substring(@SupplementLevel, 2)" />
<xsl:value-of select="substring(@SupplementLevel, 2)"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="LaborType">
<xsl:value-of select="@LaborType" />
<xsl:value-of select="@LaborType"/>
</xsl:attribute>
<xsl:attribute name="LaborHours">
<xsl:value-of select="@LaborHours" />
<xsl:value-of select="@LaborHours"/>
</xsl:attribute>
<xsl:attribute name="OperationCode">
<xsl:value-of select="@LaborOp" />
<xsl:value-of select="@LaborOp"/>
</xsl:attribute>
<xsl:attribute name="GlassFlag">
<xsl:value-of select="@GlassFlag" />
<xsl:value-of select="@GlassFlag"/>
</xsl:attribute>
<xsl:attribute name="MarkUp">
<xsl:value-of select="@MarkUp" />
<xsl:value-of select="@MarkUp"/>
</xsl:attribute>
<xsl:attribute name="CLPart">
<!-- CLPart is false if TRAN_CODE == 2 or TRAN_CODE == 3 -->
@@ -542,9 +558,13 @@
<xsl:when test="@TransactionCode='3'">False</xsl:when>
<xsl:when test="@TransactionCode='1' or @TransactionCode='2'">
<xsl:choose>
<xsl:when test="@PartType='PAN' or @PartType='PAG' or @PartType='PAM' or @PartType='PAP' or @PartType='PAL' or @PartType='PAA' or @PartType='PAR' or @PartType='PAC'">
<xsl:when
test="@PartType='PAN' or @PartType='PAG' or @PartType='PAM' or @PartType='PAP' or @PartType='PAL' or @PartType='PAA' or @PartType='PAR' or @PartType='PAC'">
<xsl:choose>
<xsl:when test="@LaborType='LAD' or @LaborType='LAE' or @LaborType='LAU' or @LaborType='LAT'">False</xsl:when>
<xsl:when
test="@LaborType='LAD' or @LaborType='LAE' or @LaborType='LAU' or @LaborType='LAT'">
False
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@LaborOp='OP0'">False</xsl:when>

View File

@@ -1,129 +1,222 @@
<?xml version="1.0" encoding="UTF-8"?>
<TranslationDescriptor>
<FileTranslations FormatName="Mitchell" ElementName="Estimate" Description="Translation Descriptor for a Mitchell Estimate, Version EMS 2.0">
<FileTranslations FormatName="Mitchell" ElementName="Estimate"
Description="Translation Descriptor for a Mitchell Estimate, Version EMS 2.0">
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.env">
<DBFFileTranslation ID="ID1" ElementName="Envelope" Description="Envelope Table">
<DBFFieldSpec FieldName="RO_ID" Form="attribute" Name="RONum" FieldType="" Description="RO Number"/>
<DBFFieldSpec FieldName="UNQFILE_ID" Form="attribute" Name="UniqueFileID" FieldType="" Description="Unique File Identifier"/>
<DBFFieldSpec FieldName="ESTFILE_ID" Form="attribute" Name="EstimateFileID" FieldType="" Description="Estimate File Identifier"/>
<DBFFieldSpec FieldName="INCL_ADMIN" Form="attribute" Name="IncludesAdminInfo" FieldType="Boolean" Description="Includes Admin Info Flag"/>
<DBFFieldSpec FieldName="INCL_VEH" Form="attribute" Name="IncludesVehicleInfo" FieldType="Boolean" Description="Includes Vehicle Info Flag"/>
<DBFFieldSpec FieldName="INCL_EST" Form="attribute" Name="IncludesEstimateInfo" FieldType="Boolean" Description="Includes Estimate Info Flag"/>
<DBFFieldSpec FieldName="INCL_PROFL" Form="attribute" Name="IncludesProfileInfo" FieldType="Boolean" Description="Includes Profile Info Flag"/>
<DBFFieldSpec FieldName="INCL_TOTAL" Form="attribute" Name="IncludesTotalsInfo" FieldType="Boolean" Description="Includes Totals Info Flag"/>
<DBFFieldSpec FieldName="INCL_VENDR" Form="attribute" Name="IncludesVendorInfo" FieldType="Boolean" Description="Includes Vendor Info Flag"/>
<DBFFieldSpec FieldName="EMS_VER" Form="attribute" Name="EMSVersion" FieldType="" Description="EMS Version Number"/>
<DBFFieldSpec FieldName="SUPP_NO" Form="attribute" Name="SupplementNum" FieldType="" Description="Supplement Number"/>
<DBFFieldSpec FieldName="TRANS_TYPE" Form="attribute" Name="TransactionType" FieldType="" Description="Transaction Type"/>
<DBFFieldSpec FieldName="EST_SYSTEM" Form="attribute" Name="EstimatingSystem" FieldType="" Description="Estimating System Software"/>
<DBFFieldSpec FieldName="SW_VERSION" Form="attribute" Name="SoftwareVersion" FieldType="" Description="Software Version Identifier"/>
<DBFFieldSpec FieldName="UNQFILE_ID" Form="attribute" Name="UniqueFileID" FieldType=""
Description="Unique File Identifier"/>
<DBFFieldSpec FieldName="ESTFILE_ID" Form="attribute" Name="EstimateFileID" FieldType=""
Description="Estimate File Identifier"/>
<DBFFieldSpec FieldName="INCL_ADMIN" Form="attribute" Name="IncludesAdminInfo" FieldType="Boolean"
Description="Includes Admin Info Flag"/>
<DBFFieldSpec FieldName="INCL_VEH" Form="attribute" Name="IncludesVehicleInfo" FieldType="Boolean"
Description="Includes Vehicle Info Flag"/>
<DBFFieldSpec FieldName="INCL_EST" Form="attribute" Name="IncludesEstimateInfo" FieldType="Boolean"
Description="Includes Estimate Info Flag"/>
<DBFFieldSpec FieldName="INCL_PROFL" Form="attribute" Name="IncludesProfileInfo" FieldType="Boolean"
Description="Includes Profile Info Flag"/>
<DBFFieldSpec FieldName="INCL_TOTAL" Form="attribute" Name="IncludesTotalsInfo" FieldType="Boolean"
Description="Includes Totals Info Flag"/>
<DBFFieldSpec FieldName="INCL_VENDR" Form="attribute" Name="IncludesVendorInfo" FieldType="Boolean"
Description="Includes Vendor Info Flag"/>
<DBFFieldSpec FieldName="EMS_VER" Form="attribute" Name="EMSVersion" FieldType=""
Description="EMS Version Number"/>
<DBFFieldSpec FieldName="SUPP_NO" Form="attribute" Name="SupplementNum" FieldType=""
Description="Supplement Number"/>
<DBFFieldSpec FieldName="TRANS_TYPE" Form="attribute" Name="TransactionType" FieldType=""
Description="Transaction Type"/>
<DBFFieldSpec FieldName="EST_SYSTEM" Form="attribute" Name="EstimatingSystem" FieldType=""
Description="Estimating System Software"/>
<DBFFieldSpec FieldName="SW_VERSION" Form="attribute" Name="SoftwareVersion" FieldType=""
Description="Software Version Identifier"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.LIN">
<DBFFileTranslation ID="ID2" ElementSetName="PartsList" ElementName="Part" Description="Parts List Table">
<DBFFieldSpec FieldName="OEM_PARTNO" Form="attribute" Name="TDPartNum" FieldType="" Description="Part Number"/>
<DBFFieldSpec FieldName="ALT_PARTNO" Form="attribute" Name="AltPartNum" FieldType="" Description="Alternate Part Number"/>
<DBFFieldSpec FieldName="ACT_PRICE" Form="attribute" Name="ActPrice" FieldType="" Description="Actual Part Price"/>
<DBFFieldSpec FieldName="LINE_DESC" Form="attribute" Name="TDPartDesc" FieldType="" Description="Part Description"/>
<DBFFieldSpec FieldName="DB_PRICE" Form="attribute" Name="TDEstimate" FieldType="" Description="DB_Price"/>
<DBFFieldSpec FieldName="PART_QTY" Form="attribute" Name="TDPartQty" FieldType="" Description="Part Quantity"/>
<DBFFieldSpec FieldName="OEM_PARTNO" Form="attribute" Name="TDPartNum" FieldType=""
Description="Part Number"/>
<DBFFieldSpec FieldName="ALT_PARTNO" Form="attribute" Name="AltPartNum" FieldType=""
Description="Alternate Part Number"/>
<DBFFieldSpec FieldName="ACT_PRICE" Form="attribute" Name="ActPrice" FieldType=""
Description="Actual Part Price"/>
<DBFFieldSpec FieldName="LINE_DESC" Form="attribute" Name="TDPartDesc" FieldType=""
Description="Part Description"/>
<DBFFieldSpec FieldName="DB_PRICE" Form="attribute" Name="TDEstimate" FieldType=""
Description="DB_Price"/>
<DBFFieldSpec FieldName="PART_QTY" Form="attribute" Name="TDPartQty" FieldType=""
Description="Part Quantity"/>
<DBFFieldSpec FieldName="LINE_NO" Form="attribute" Name="LineNumber" FieldType="" Description=""/>
<DBFFieldSpec FieldName="UNQ_SEQ" Form="attribute" Name="SequenceNumber" FieldType="" Description=""/>
<DBFFieldSpec FieldName="PART_TYPE" Form="attribute" Name="PartType" FieldType="" Description="Part Type"/>
<DBFFieldSpec FieldName="MOD_LBR_TY" Form="attribute" Name="LaborType" FieldType="" Description="Labor Type"/>
<DBFFieldSpec FieldName="MOD_LB_HRS" Form="attribute" Name="LaborHours" FieldType="" Description="Labor Hours"/>
<DBFFieldSpec FieldName="PART_TYPE" Form="attribute" Name="PartType" FieldType=""
Description="Part Type"/>
<DBFFieldSpec FieldName="MOD_LBR_TY" Form="attribute" Name="LaborType" FieldType=""
Description="Labor Type"/>
<DBFFieldSpec FieldName="MOD_LB_HRS" Form="attribute" Name="LaborHours" FieldType=""
Description="Labor Hours"/>
<DBFFieldSpec FieldName="LBR_OP" Form="attribute" Name="LaborOp" FieldType="" Description="Labor Op"/>
<DBFFieldSpec FieldName="LINE_IND" Form="attribute" Name="SupplementLevel" FieldType="" Description="Supplement Level"/>
<DBFFieldSpec FieldName="TRAN_CODE" Form="attribute" Name="TransactionCode" FieldType="" Description="Transaction Code"/>
<DBFFieldSpec FieldName="GLASS_FLAG" Form="attribute" Name="GlassFlag" FieldType="" Description="Glass Flag"/>
<DBFFieldSpec FieldName="PRT_DSMK_M" Form="attribute" Name="MarkUp" FieldType="" Description="Price Mark up for non OEM parts"/>
<DBFFieldSpec FieldName="LINE_IND" Form="attribute" Name="SupplementLevel" FieldType=""
Description="Supplement Level"/>
<DBFFieldSpec FieldName="TRAN_CODE" Form="attribute" Name="TransactionCode" FieldType=""
Description="Transaction Code"/>
<DBFFieldSpec FieldName="GLASS_FLAG" Form="attribute" Name="GlassFlag" FieldType=""
Description="Glass Flag"/>
<DBFFieldSpec FieldName="PRT_DSMK_M" Form="attribute" Name="MarkUp" FieldType=""
Description="Price Mark up for non OEM parts"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.VEH">
<DBFFileTranslation ID="ID3" ElementName="Vehicle" Description="Vehicle Table">
<DBFFieldSpec FieldName="V_VIN" Form="attribute" Name="TransVIN" FieldType="" Description=""/>
<DBFFieldSpec FieldName="V_MODEL_YR" Form="attribute" Name="TransYear" FieldType="" Description="V_MODEL_YR"/>
<DBFFieldSpec FieldName="V_MAKEDESC" Form="attribute" Name="ManufName" FieldType="" Description="V_MAKEDESC"/>
<DBFFieldSpec FieldName="V_MAKECODE" Form="attribute" Name="ManufCode" FieldType="" Description="V_MAKECODE"/>
<DBFFieldSpec FieldName="V_MODEL" Form="attribute" Name="TransModel" FieldType="" Description="V_MODEL"/>
<DBFFieldSpec FieldName="V_MILEAGE" Form="attribute" Name="TransMileage" FieldType="" Description="V_MILEAGE"/>
<DBFFieldSpec FieldName="V_MODEL_YR" Form="attribute" Name="TransYear" FieldType=""
Description="V_MODEL_YR"/>
<DBFFieldSpec FieldName="V_MAKEDESC" Form="attribute" Name="ManufName" FieldType=""
Description="V_MAKEDESC"/>
<DBFFieldSpec FieldName="V_MAKECODE" Form="attribute" Name="ManufCode" FieldType=""
Description="V_MAKECODE"/>
<DBFFieldSpec FieldName="V_MODEL" Form="attribute" Name="TransModel" FieldType=""
Description="V_MODEL"/>
<DBFFieldSpec FieldName="V_MILEAGE" Form="attribute" Name="TransMileage" FieldType=""
Description="V_MILEAGE"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.AD1">
<DBFFileTranslation ID="ID4" ElementName="Admin" Description="Administrative information">
<DBFFieldSpec FieldName="OWNR_LN" Form="attribute" Name="OwnerL" FieldType="" Description="Owner Lastname"/>
<DBFFieldSpec FieldName="OWNR_FN" Form="attribute" Name="OwnerF" FieldType="" Description="Owner Firstname"/>
<DBFFieldSpec FieldName="OWNR_CO_NM" Form="attribute" Name="OwnerCompanyName" FieldType="" Description="Owner Company Name"/>
<DBFFieldSpec FieldName="OWNR_TITLE" Form="attribute" Name="OwnerTitle" FieldType="" Description="Owner Title"/>
<DBFFieldSpec FieldName="OWNR_ADDR1" Form="attribute" Name="OwnerAddr1" FieldType="" Description="Owner Address Line 1"/>
<DBFFieldSpec FieldName="OWNR_ADDR2" Form="attribute" Name="OwnerAddr2" FieldType="" Description="Owner Address Line 2"/>
<DBFFieldSpec FieldName="OWNR_CITY" Form="attribute" Name="OwnerCity" FieldType="" Description="Owner City"/>
<DBFFieldSpec FieldName="OWNR_ST" Form="attribute" Name="OwnerState" FieldType="" Description="Owner State"/>
<DBFFieldSpec FieldName="OWNR_ZIP" Form="attribute" Name="OwnerZip" FieldType="" Description="Owner Zip"/>
<DBFFieldSpec FieldName="OWNR_CTRY" Form="attribute" Name="OwnerCountry" FieldType="" Description="Owner Country"/>
<DBFFieldSpec FieldName="OWNR_PH1" Form="attribute" Name="OwnerPhone1" FieldType="" Description="Owner Primary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH1X" Form="attribute" Name="OwnerPhone1Ext" FieldType="" Description="Owner Primary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_PH2" Form="attribute" Name="OwnerPhone2" FieldType="" Description="Owner Secondary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH2X" Form="attribute" Name="OwnerPhone2Ext" FieldType="" Description="Owner Secondary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_FAX" Form="attribute" Name="OwnerFax" FieldType="" Description="Owner Fax"/>
<DBFFieldSpec FieldName="OWNR_FAXX" Form="attribute" Name="OwnerFaxExt" FieldType="" Description="Owner Fax Extension"/>
<DBFFieldSpec FieldName="OWNR_EA" Form="attribute" Name="OwnerEmail" FieldType="" Description="Owner Email Address"/>
<DBFFieldSpec FieldName="INS_CO_NM" Form="attribute" Name="InsuranceCompanyName" FieldType="" Description="Insurance Company Name"/>
<DBFFieldSpec FieldName="INS_CO_ID" Form="attribute" Name="InsuranceCompanyID" FieldType="" Description="Insurance Company Identifier"/>
<DBFFieldSpec FieldName="INS_ADDR1" Form="attribute" Name="InsuranceAddr1" FieldType="" Description="Insurance Address Line 1"/>
<DBFFieldSpec FieldName="INS_ADDR2" Form="attribute" Name="InsuranceAddr2" FieldType="" Description="Insurance Address Line 2"/>
<DBFFieldSpec FieldName="INS_CITY" Form="attribute" Name="InsuranceCity" FieldType="" Description="Insurance City"/>
<DBFFieldSpec FieldName="INS_ST" Form="attribute" Name="InsuranceState" FieldType="" Description="Insurance State"/>
<DBFFieldSpec FieldName="INS_ZIP" Form="attribute" Name="InsuranceZip" FieldType="" Description="Insurance Zip"/>
<DBFFieldSpec FieldName="INS_CTRY" Form="attribute" Name="InsuranceCountry" FieldType="" Description="Insurance Country"/>
<DBFFieldSpec FieldName="INS_PH1" Form="attribute" Name="InsurancePhone1" FieldType="" Description="Insurance Primary Phone"/>
<DBFFieldSpec FieldName="INS_PH1X" Form="attribute" Name="InsurancePhone1Ext" FieldType="" Description="Insurance Primary Phone Extension"/>
<DBFFieldSpec FieldName="INS_PH2" Form="attribute" Name="InsurancePhone2" FieldType="" Description="Insurance Secondary Phone"/>
<DBFFieldSpec FieldName="INS_PH2X" Form="attribute" Name="InsurancePhone2Ext" FieldType="" Description="Insurance Secondary Phone Extension"/>
<DBFFieldSpec FieldName="INS_FAX" Form="attribute" Name="InsuranceFax" FieldType="" Description="Insurance Fax"/>
<DBFFieldSpec FieldName="INS_FAXX" Form="attribute" Name="InsuranceFaxExt" FieldType="" Description="Insurance Fax Extension"/>
<DBFFieldSpec FieldName="INS_EA" Form="attribute" Name="InsuranceEmail" FieldType="" Description="Insurance Email Address"/>
<DBFFieldSpec FieldName="INSD_LN" Form="attribute" Name="InsuranceLName" FieldType="" Description="Insurance Last Name"/>
<DBFFieldSpec FieldName="CLM_NO" Form="attribute" Name="ClaimNumber" FieldType="" Description="Claim Number"/>
<DBFFieldSpec FieldName="OWNR_LN" Form="attribute" Name="OwnerL" FieldType=""
Description="Owner Lastname"/>
<DBFFieldSpec FieldName="OWNR_FN" Form="attribute" Name="OwnerF" FieldType=""
Description="Owner Firstname"/>
<DBFFieldSpec FieldName="OWNR_CO_NM" Form="attribute" Name="OwnerCompanyName" FieldType=""
Description="Owner Company Name"/>
<DBFFieldSpec FieldName="OWNR_TITLE" Form="attribute" Name="OwnerTitle" FieldType=""
Description="Owner Title"/>
<DBFFieldSpec FieldName="OWNR_ADDR1" Form="attribute" Name="OwnerAddr1" FieldType=""
Description="Owner Address Line 1"/>
<DBFFieldSpec FieldName="OWNR_ADDR2" Form="attribute" Name="OwnerAddr2" FieldType=""
Description="Owner Address Line 2"/>
<DBFFieldSpec FieldName="OWNR_CITY" Form="attribute" Name="OwnerCity" FieldType=""
Description="Owner City"/>
<DBFFieldSpec FieldName="OWNR_ST" Form="attribute" Name="OwnerState" FieldType=""
Description="Owner State"/>
<DBFFieldSpec FieldName="OWNR_ZIP" Form="attribute" Name="OwnerZip" FieldType=""
Description="Owner Zip"/>
<DBFFieldSpec FieldName="OWNR_CTRY" Form="attribute" Name="OwnerCountry" FieldType=""
Description="Owner Country"/>
<DBFFieldSpec FieldName="OWNR_PH1" Form="attribute" Name="OwnerPhone1" FieldType=""
Description="Owner Primary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH1X" Form="attribute" Name="OwnerPhone1Ext" FieldType=""
Description="Owner Primary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_PH2" Form="attribute" Name="OwnerPhone2" FieldType=""
Description="Owner Secondary Phone"/>
<DBFFieldSpec FieldName="OWNR_PH2X" Form="attribute" Name="OwnerPhone2Ext" FieldType=""
Description="Owner Secondary Phone Extension"/>
<DBFFieldSpec FieldName="OWNR_FAX" Form="attribute" Name="OwnerFax" FieldType=""
Description="Owner Fax"/>
<DBFFieldSpec FieldName="OWNR_FAXX" Form="attribute" Name="OwnerFaxExt" FieldType=""
Description="Owner Fax Extension"/>
<DBFFieldSpec FieldName="OWNR_EA" Form="attribute" Name="OwnerEmail" FieldType=""
Description="Owner Email Address"/>
<DBFFieldSpec FieldName="INS_CO_NM" Form="attribute" Name="InsuranceCompanyName" FieldType=""
Description="Insurance Company Name"/>
<DBFFieldSpec FieldName="INS_CO_ID" Form="attribute" Name="InsuranceCompanyID" FieldType=""
Description="Insurance Company Identifier"/>
<DBFFieldSpec FieldName="INS_ADDR1" Form="attribute" Name="InsuranceAddr1" FieldType=""
Description="Insurance Address Line 1"/>
<DBFFieldSpec FieldName="INS_ADDR2" Form="attribute" Name="InsuranceAddr2" FieldType=""
Description="Insurance Address Line 2"/>
<DBFFieldSpec FieldName="INS_CITY" Form="attribute" Name="InsuranceCity" FieldType=""
Description="Insurance City"/>
<DBFFieldSpec FieldName="INS_ST" Form="attribute" Name="InsuranceState" FieldType=""
Description="Insurance State"/>
<DBFFieldSpec FieldName="INS_ZIP" Form="attribute" Name="InsuranceZip" FieldType=""
Description="Insurance Zip"/>
<DBFFieldSpec FieldName="INS_CTRY" Form="attribute" Name="InsuranceCountry" FieldType=""
Description="Insurance Country"/>
<DBFFieldSpec FieldName="INS_PH1" Form="attribute" Name="InsurancePhone1" FieldType=""
Description="Insurance Primary Phone"/>
<DBFFieldSpec FieldName="INS_PH1X" Form="attribute" Name="InsurancePhone1Ext" FieldType=""
Description="Insurance Primary Phone Extension"/>
<DBFFieldSpec FieldName="INS_PH2" Form="attribute" Name="InsurancePhone2" FieldType=""
Description="Insurance Secondary Phone"/>
<DBFFieldSpec FieldName="INS_PH2X" Form="attribute" Name="InsurancePhone2Ext" FieldType=""
Description="Insurance Secondary Phone Extension"/>
<DBFFieldSpec FieldName="INS_FAX" Form="attribute" Name="InsuranceFax" FieldType=""
Description="Insurance Fax"/>
<DBFFieldSpec FieldName="INS_FAXX" Form="attribute" Name="InsuranceFaxExt" FieldType=""
Description="Insurance Fax Extension"/>
<DBFFieldSpec FieldName="INS_EA" Form="attribute" Name="InsuranceEmail" FieldType=""
Description="Insurance Email Address"/>
<DBFFieldSpec FieldName="INSD_LN" Form="attribute" Name="InsuranceLName" FieldType=""
Description="Insurance Last Name"/>
<DBFFieldSpec FieldName="CLM_NO" Form="attribute" Name="ClaimNumber" FieldType=""
Description="Claim Number"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.AD2">
<DBFFileTranslation ID="ID5" ElementName="Admin2" Description="Administrative information2">
<DBFFieldSpec FieldName="EST_CT_LN" Form="attribute" Name="EstimatorL" FieldType="" Description="Estimator Lastname"/>
<DBFFieldSpec FieldName="EST_CT_FN" Form="attribute" Name="EstimatorF" FieldType="" Description="Estimator Firstname"/>
<DBFFieldSpec FieldName="EST_CO_NM" Form="attribute" Name="EstimatorCompanyName" FieldType="" Description="Estimator Company Name"/>
<DBFFieldSpec FieldName="EST_CO_ID" Form="attribute" Name="EstimatorCompanyID" FieldType="" Description="Estimator Company Identifier"/>
<DBFFieldSpec FieldName="EST_ADDR1" Form="attribute" Name="EstimatorAddr1" FieldType="" Description="Estimator Address1"/>
<DBFFieldSpec FieldName="EST_ADDR2" Form="attribute" Name="EstimatorAddr2" FieldType="" Description="Estimator Address2"/>
<DBFFieldSpec FieldName="EST_CITY" Form="attribute" Name="EstimatorCity" FieldType="" Description="Estimator City"/>
<DBFFieldSpec FieldName="EST_ST" Form="attribute" Name="EstimatorState" FieldType="" Description="Estimator State"/>
<DBFFieldSpec FieldName="EST_ZIP" Form="attribute" Name="EstimatorZip" FieldType="" Description="Estimator Zip"/>
<DBFFieldSpec FieldName="EST_CTRY" Form="attribute" Name="EstimatorCountry" FieldType="" Description="Estimator Country"/>
<DBFFieldSpec FieldName="EST_PH1" Form="attribute" Name="EstimatorPhone1" FieldType="" Description="Estimator Primary Phone"/>
<DBFFieldSpec FieldName="EST_PH1X" Form="attribute" Name="EstimatorPhone1Ext" FieldType="" Description="Estimator Primary Phone Extension"/>
<DBFFieldSpec FieldName="EST_PH2" Form="attribute" Name="EstimatorPhone2" FieldType="" Description="Estimator Secondary Phone"/>
<DBFFieldSpec FieldName="EST_PH2X" Form="attribute" Name="EstimatorPhone2Ext" FieldType="" Description="Estimator Secondary Phone Extension"/>
<DBFFieldSpec FieldName="EST_FAX" Form="attribute" Name="EstimatorFax" FieldType="" Description="Estimator Fax"/>
<DBFFieldSpec FieldName="EST_FAXX" Form="attribute" Name="EstimatorFaxExt" FieldType="" Description="Estimator Fax Extension"/>
<DBFFieldSpec FieldName="EST_EA" Form="attribute" Name="EstimatorEmail" FieldType="" Description="Estimator Email Address"/>
<DBFFieldSpec FieldName="EST_LIC_NO" Form="attribute" Name="EstimatorLicenseNumber" FieldType="" Description="Estimator License Number"/>
<DBFFieldSpec FieldName="EST_FILENO" Form="attribute" Name="EstimatorFileNumber" FieldType="" Description="Estimator File Number"/>
<DBFFieldSpec FieldName="RO_IN_DATE" Form="attribute" Name="VehicleInDate" FieldType="" Description="Date arrived in shop"/>
<DBFFieldSpec FieldName="RO_IN_TIME" Form="attribute" Name="VehicleInTime" FieldType="" Description="Time arrived in shop"/>
<DBFFieldSpec FieldName="TAR_DATE" Form="attribute" Name="TargetVehicleOutDate" FieldType="" Description="Target date to be completed"/>
<DBFFieldSpec FieldName="TAR_TIME" Form="attribute" Name="TargetVehicleOutTime" FieldType="" Description="Target time to be completed"/>
<DBFFieldSpec FieldName="RO_CMPDATE" Form="attribute" Name="VehicleOutDate" FieldType="" Description="Date completed"/>
<DBFFieldSpec FieldName="RO_CMPTIME" Form="attribute" Name="VehicleOutTime" FieldType="" Description="Time completed"/>
<DBFFieldSpec FieldName="RF_CO_NM" Form="attribute" Name="BodyShopName" FieldType="" Description="Body Shop Name"/>
<DBFFieldSpec FieldName="EST_CT_LN" Form="attribute" Name="EstimatorL" FieldType=""
Description="Estimator Lastname"/>
<DBFFieldSpec FieldName="EST_CT_FN" Form="attribute" Name="EstimatorF" FieldType=""
Description="Estimator Firstname"/>
<DBFFieldSpec FieldName="EST_CO_NM" Form="attribute" Name="EstimatorCompanyName" FieldType=""
Description="Estimator Company Name"/>
<DBFFieldSpec FieldName="EST_CO_ID" Form="attribute" Name="EstimatorCompanyID" FieldType=""
Description="Estimator Company Identifier"/>
<DBFFieldSpec FieldName="EST_ADDR1" Form="attribute" Name="EstimatorAddr1" FieldType=""
Description="Estimator Address1"/>
<DBFFieldSpec FieldName="EST_ADDR2" Form="attribute" Name="EstimatorAddr2" FieldType=""
Description="Estimator Address2"/>
<DBFFieldSpec FieldName="EST_CITY" Form="attribute" Name="EstimatorCity" FieldType=""
Description="Estimator City"/>
<DBFFieldSpec FieldName="EST_ST" Form="attribute" Name="EstimatorState" FieldType=""
Description="Estimator State"/>
<DBFFieldSpec FieldName="EST_ZIP" Form="attribute" Name="EstimatorZip" FieldType=""
Description="Estimator Zip"/>
<DBFFieldSpec FieldName="EST_CTRY" Form="attribute" Name="EstimatorCountry" FieldType=""
Description="Estimator Country"/>
<DBFFieldSpec FieldName="EST_PH1" Form="attribute" Name="EstimatorPhone1" FieldType=""
Description="Estimator Primary Phone"/>
<DBFFieldSpec FieldName="EST_PH1X" Form="attribute" Name="EstimatorPhone1Ext" FieldType=""
Description="Estimator Primary Phone Extension"/>
<DBFFieldSpec FieldName="EST_PH2" Form="attribute" Name="EstimatorPhone2" FieldType=""
Description="Estimator Secondary Phone"/>
<DBFFieldSpec FieldName="EST_PH2X" Form="attribute" Name="EstimatorPhone2Ext" FieldType=""
Description="Estimator Secondary Phone Extension"/>
<DBFFieldSpec FieldName="EST_FAX" Form="attribute" Name="EstimatorFax" FieldType=""
Description="Estimator Fax"/>
<DBFFieldSpec FieldName="EST_FAXX" Form="attribute" Name="EstimatorFaxExt" FieldType=""
Description="Estimator Fax Extension"/>
<DBFFieldSpec FieldName="EST_EA" Form="attribute" Name="EstimatorEmail" FieldType=""
Description="Estimator Email Address"/>
<DBFFieldSpec FieldName="EST_LIC_NO" Form="attribute" Name="EstimatorLicenseNumber" FieldType=""
Description="Estimator License Number"/>
<DBFFieldSpec FieldName="EST_FILENO" Form="attribute" Name="EstimatorFileNumber" FieldType=""
Description="Estimator File Number"/>
<DBFFieldSpec FieldName="RO_IN_DATE" Form="attribute" Name="VehicleInDate" FieldType=""
Description="Date arrived in shop"/>
<DBFFieldSpec FieldName="RO_IN_TIME" Form="attribute" Name="VehicleInTime" FieldType=""
Description="Time arrived in shop"/>
<DBFFieldSpec FieldName="TAR_DATE" Form="attribute" Name="TargetVehicleOutDate" FieldType=""
Description="Target date to be completed"/>
<DBFFieldSpec FieldName="TAR_TIME" Form="attribute" Name="TargetVehicleOutTime" FieldType=""
Description="Target time to be completed"/>
<DBFFieldSpec FieldName="RO_CMPDATE" Form="attribute" Name="VehicleOutDate" FieldType=""
Description="Date completed"/>
<DBFFieldSpec FieldName="RO_CMPTIME" Form="attribute" Name="VehicleOutTime" FieldType=""
Description="Time completed"/>
<DBFFieldSpec FieldName="RF_CO_NM" Form="attribute" Name="BodyShopName" FieldType=""
Description="Body Shop Name"/>
</DBFFileTranslation>
</FileTranslation>
<FileTranslation TranslatorID="OECImportEngine.DBFTranslator" FileNameMask="*.TTL">
<DBFFileTranslation ID="ID6" ElementName="Total" Description="Total Table">
<DBFFieldSpec FieldName="G_TTL_AMT" Form="attribute" Name="GrandTotalAmount" FieldType="" Description=""/>
</DBFFileTranslation>
<DBFFileTranslation ID="ID6" ElementName="Total" Description="Total Table">
<DBFFieldSpec FieldName="G_TTL_AMT" Form="attribute" Name="GrandTotalAmount" FieldType=""
Description=""/>
</DBFFileTranslation>
</FileTranslation>
</FileTranslations>
<StyleSheetTranslation>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -13,47 +13,47 @@ Copy the new key to clipboard:
Add the SSH key to the drop creation screen.
1. Create a new user to replace root user
1. # adduser imex
2. # usermod -aG sudo imex
3. # su - imex
4. $ mkdir ~/.ssh
5. $ chmod 700 ~/.ssh
6. $ nano ~/.ssh/authorized_keys
7. Add the copied SSH key and save.
8. $ chmod 600 ~/.ssh/authorized_keys #Restrict access to authorized keys.
1. # adduser imex
2. # usermod -aG sudo imex
3. # su - imex
4. $ mkdir ~/.ssh
5. $ chmod 700 ~/.ssh
6. $ nano ~/.ssh/authorized_keys
7. Add the copied SSH key and save.
8. $ chmod 600 ~/.ssh/authorized_keys #Restrict access to authorized keys.
2. Setup the Firewall
1. $ sudo ufw allow OpenSSH.
2. $ sudo ufw enable
1. $ sudo ufw allow OpenSSH.
2. $ sudo ufw enable
3. Add Nginx & Configure
1. $ sudo apt-get update
2. $ sudo apt-get install nginx
3. $ sudo ufw allow 'Nginx Full'
4. $ sudo ufw app list
1. Nginx Full: Opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)
2. Nginx Http: Opens only port 80 (normal, unencrypted web traffic)
3. Nginx Https: Opens only port 443 (TLS/SSL encrypted traffic)
5. Should now be able to go to IP and see nginx responding with a blank page.
1. $ sudo apt-get update
2. $ sudo apt-get install nginx
3. $ sudo ufw allow 'Nginx Full'
4. $ sudo ufw app list
1. Nginx Full: Opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)
2. Nginx Http: Opens only port 80 (normal, unencrypted web traffic)
3. Nginx Https: Opens only port 443 (TLS/SSL encrypted traffic)
5. Should now be able to go to IP and see nginx responding with a blank page.
4. Install NodeJs
1. $ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
2. $ sudo apt install nodejs
3. $ node --version
1. $ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
2. $ sudo apt install nodejs
3. $ node --version
5. Clone Source Code
1. $ git clone git@bitbucket.org:snaptsoft/bodyshop.git //Requires SSH setup.
2. $ cd bodyshop && npm install //Install all server dependencies.
1. $ git clone git@bitbucket.org:snaptsoft/bodyshop.git //Requires SSH setup.
2. $ cd bodyshop && npm install //Install all server dependencies.
6. Setup PM2
1. $ npm install pm2 -g //Had to be run as root.
2. $ pm2 start ecosystem.config.js
3. $ pm2 startup ubuntu //Ensure it starts when server does.
1. $ npm install pm2 -g //Had to be run as root.
2. $ pm2 start ecosystem.config.js
3. $ pm2 startup ubuntu //Ensure it starts when server does.
7. Alter Nginx config
1. sudo nano /etc/nginx/sites-available/default
2. //Add Appropriate server names to the file. www. and non-www.
3. Add the following inside the location of the server block: (Remove the 404 bit.)
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
1. sudo nano /etc/nginx/sites-available/default
2. //Add Appropriate server names to the file. www. and non-www.
3. Add the following inside the location of the server block: (Remove the 404 bit.)
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
8. Install Certbot
9. $ sudo add-apt-repository ppa:certbot/certbot //Potential issue on ubuntu 20.04
10. $ sudo apt-get update

View File

@@ -1,16 +1,16 @@
1. Create a new project
2. Setup sign in methods to be user and email only.
3. Update .env to include config.
4. Setup the Firebase CLI
1. cd to client firebase at server directory.
2. ensure all dependencies installed
1. $ npm install firebase-functions@latest firebase-admin@latest --save
2. $ npm install -g firebase-tools
3. $ firebase login //Login as needed.
3. Update .env to include config.
4. Setup the Firebase CLI
1. cd to client firebase at server directory.
2. ensure all dependencies installed
1. $ npm install firebase-functions@latest firebase-admin@latest --save
2. $ npm install -g firebase-tools
3. $ firebase login //Login as needed.
5. Set the current projct
1. firebase use <projectname>
1. firebase use <projectname>
6. Deploy the function
1. $ firebase deploy --only functions
7. Add the allowed domains.
1. $ firebase deploy --only functions
7. Add the allowed domains.
8. Update server variables including FIREBASE_ADMINSDK_JSON, FIREBASE_DATABASE_URL
9. Create the firestore and copy the rules from dev for userinstances.

View File

@@ -1,20 +1,20 @@
module.exports = {
apps: [
{
name: "IO Test API",
cwd: "./io",
script: "./server.js",
env: {
NODE_ENV: "test",
},
},
apps: [
{
name: "IO Test API",
cwd: "./io",
script: "./server.js",
env: {
NODE_ENV: "test",
},
},
{
name: "Bitbucket Webhook",
script: "./webhook/index.js",
env: {
NODE_ENV: "production",
},
},
],
{
name: "Bitbucket Webhook",
script: "./webhook/index.js",
env: {
NODE_ENV: "production",
},
},
],
};

View File

@@ -15,7 +15,8 @@ You will also see any lint errors in the console.
### `yarn test`
Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more
information.
### `yarn build`
@@ -31,15 +32,21 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will
remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right
into your project so you have full control over them. All of the commands except `eject` will still work, but they will
point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you
shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt
customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
You can learn more in
the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
@@ -65,4 +72,5 @@ This section has moved here: https://facebook.github.io/create-react-app/docs/de
### `yarn build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
This section has moved
here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

View File

@@ -1,17 +1,17 @@
const { defineConfig } = require('cypress')
const {defineConfig} = require('cypress')
module.exports = defineConfig({
experimentalStudio: true,
env: {
FIREBASE_USERNAME: 'cypress@imex.test',
FIREBASE_PASSWORD: 'cypress',
},
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
experimentalStudio: true,
env: {
FIREBASE_USERNAME: 'cypress@imex.test',
FIREBASE_PASSWORD: 'cypress',
},
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
baseUrl: 'http://localhost:3000',
},
baseUrl: 'http://localhost:3000',
},
})

View File

@@ -1,23 +1,24 @@
/// <reference types="Cypress" />
const { FIREBASE_USERNAME, FIREBASE_PASSWORcD } = Cypress.env();
const {FIREBASE_USERNAME, FIREBASE_PASSWORcD} = Cypress.env();
describe("Renders the General Page", () => {
beforeEach(() => {
cy.visit("/");
});
it("Renders Correctly", () => {});
it("Has the Slogan", () => {
cy.findByText("A whole x22new kind of shop management system.").should(
"exist"
);
/* ==== Generated with Cypress Studio ==== */
cy.get(
".ant-menu-item-active > .ant-menu-title-content > .header0-item-block"
).click();
cy.get("#email").clear();
cy.get("#email").type("patrick@imex.dev");
cy.get("#password").clear();
cy.get("#password").type("patrick123{enter}");
cy.get(".ant-form > .ant-btn").click();
/* ==== End Cypress Studio ==== */
});
beforeEach(() => {
cy.visit("/");
});
it("Renders Correctly", () => {
});
it("Has the Slogan", () => {
cy.findByText("A whole x22new kind of shop management system.").should(
"exist"
);
/* ==== Generated with Cypress Studio ==== */
cy.get(
".ant-menu-item-active > .ant-menu-title-content > .header0-item-block"
).click();
cy.get("#email").clear();
cy.get("#email").type("patrick@imex.dev");
cy.get("#password").clear();
cy.get("#password").type("patrick123{enter}");
cy.get(".ant-form > .ant-btn").click();
/* ==== End Cypress Studio ==== */
});
});

View File

@@ -12,132 +12,132 @@
// https://on.cypress.io/introduction-to-cypress
describe('example to-do app', () => {
beforeEach(() => {
// Cypress starts out with a blank slate for each test
// so we must tell it to visit our website with the `cy.visit()` command.
// Since we want to visit the same URL at the start of all our tests,
// we include it in our beforeEach function so that it runs before each test
cy.visit('https://example.cypress.io/todo')
})
it('displays two todo items by default', () => {
// We use the `cy.get()` command to get all elements that match the selector.
// Then, we use `should` to assert that there are two matched items,
// which are the two default items.
cy.get('.todo-list li').should('have.length', 2)
// We can go even further and check that the default todos each contain
// the correct text. We use the `first` and `last` functions
// to get just the first and last matched elements individually,
// and then perform an assertion with `should`.
cy.get('.todo-list li').first().should('have.text', 'Pay electric bill')
cy.get('.todo-list li').last().should('have.text', 'Walk the dog')
})
it('can add new todo items', () => {
// We'll store our item text in a variable so we can reuse it
const newItem = 'Feed the cat'
// Let's get the input element and use the `type` command to
// input our new list item. After typing the content of our item,
// we need to type the enter key as well in order to submit the input.
// This input has a data-test attribute so we'll use that to select the
// element in accordance with best practices:
// https://on.cypress.io/selecting-elements
cy.get('[data-test=new-todo]').type(`${newItem}{enter}`)
// Now that we've typed our new item, let's check that it actually was added to the list.
// Since it's the newest item, it should exist as the last element in the list.
// In addition, with the two default items, we should have a total of 3 elements in the list.
// Since assertions yield the element that was asserted on,
// we can chain both of these assertions together into a single statement.
cy.get('.todo-list li')
.should('have.length', 3)
.last()
.should('have.text', newItem)
})
it('can check off an item as completed', () => {
// In addition to using the `get` command to get an element by selector,
// we can also use the `contains` command to get an element by its contents.
// However, this will yield the <label>, which is lowest-level element that contains the text.
// In order to check the item, we'll find the <input> element for this <label>
// by traversing up the dom to the parent element. From there, we can `find`
// the child checkbox <input> element and use the `check` command to check it.
cy.contains('Pay electric bill')
.parent()
.find('input[type=checkbox]')
.check()
// Now that we've checked the button, we can go ahead and make sure
// that the list element is now marked as completed.
// Again we'll use `contains` to find the <label> element and then use the `parents` command
// to traverse multiple levels up the dom until we find the corresponding <li> element.
// Once we get that element, we can assert that it has the completed class.
cy.contains('Pay electric bill')
.parents('li')
.should('have.class', 'completed')
})
context('with a checked task', () => {
beforeEach(() => {
// We'll take the command we used above to check off an element
// Since we want to perform multiple tests that start with checking
// one element, we put it in the beforeEach hook
// so that it runs at the start of every test.
cy.contains('Pay electric bill')
.parent()
.find('input[type=checkbox]')
.check()
// Cypress starts out with a blank slate for each test
// so we must tell it to visit our website with the `cy.visit()` command.
// Since we want to visit the same URL at the start of all our tests,
// we include it in our beforeEach function so that it runs before each test
cy.visit('https://example.cypress.io/todo')
})
it('can filter for uncompleted tasks', () => {
// We'll click on the "active" button in order to
// display only incomplete items
cy.contains('Active').click()
it('displays two todo items by default', () => {
// We use the `cy.get()` command to get all elements that match the selector.
// Then, we use `should` to assert that there are two matched items,
// which are the two default items.
cy.get('.todo-list li').should('have.length', 2)
// After filtering, we can assert that there is only the one
// incomplete item in the list.
cy.get('.todo-list li')
.should('have.length', 1)
.first()
.should('have.text', 'Walk the dog')
// For good measure, let's also assert that the task we checked off
// does not exist on the page.
cy.contains('Pay electric bill').should('not.exist')
// We can go even further and check that the default todos each contain
// the correct text. We use the `first` and `last` functions
// to get just the first and last matched elements individually,
// and then perform an assertion with `should`.
cy.get('.todo-list li').first().should('have.text', 'Pay electric bill')
cy.get('.todo-list li').last().should('have.text', 'Walk the dog')
})
it('can filter for completed tasks', () => {
// We can perform similar steps as the test above to ensure
// that only completed tasks are shown
cy.contains('Completed').click()
it('can add new todo items', () => {
// We'll store our item text in a variable so we can reuse it
const newItem = 'Feed the cat'
cy.get('.todo-list li')
.should('have.length', 1)
.first()
.should('have.text', 'Pay electric bill')
// Let's get the input element and use the `type` command to
// input our new list item. After typing the content of our item,
// we need to type the enter key as well in order to submit the input.
// This input has a data-test attribute so we'll use that to select the
// element in accordance with best practices:
// https://on.cypress.io/selecting-elements
cy.get('[data-test=new-todo]').type(`${newItem}{enter}`)
cy.contains('Walk the dog').should('not.exist')
// Now that we've typed our new item, let's check that it actually was added to the list.
// Since it's the newest item, it should exist as the last element in the list.
// In addition, with the two default items, we should have a total of 3 elements in the list.
// Since assertions yield the element that was asserted on,
// we can chain both of these assertions together into a single statement.
cy.get('.todo-list li')
.should('have.length', 3)
.last()
.should('have.text', newItem)
})
it('can delete all completed tasks', () => {
// First, let's click the "Clear completed" button
// `contains` is actually serving two purposes here.
// First, it's ensuring that the button exists within the dom.
// This button only appears when at least one task is checked
// so this command is implicitly verifying that it does exist.
// Second, it selects the button so we can click it.
cy.contains('Clear completed').click()
it('can check off an item as completed', () => {
// In addition to using the `get` command to get an element by selector,
// we can also use the `contains` command to get an element by its contents.
// However, this will yield the <label>, which is lowest-level element that contains the text.
// In order to check the item, we'll find the <input> element for this <label>
// by traversing up the dom to the parent element. From there, we can `find`
// the child checkbox <input> element and use the `check` command to check it.
cy.contains('Pay electric bill')
.parent()
.find('input[type=checkbox]')
.check()
// Then we can make sure that there is only one element
// in the list and our element does not exist
cy.get('.todo-list li')
.should('have.length', 1)
.should('not.have.text', 'Pay electric bill')
// Finally, make sure that the clear button no longer exists.
cy.contains('Clear completed').should('not.exist')
// Now that we've checked the button, we can go ahead and make sure
// that the list element is now marked as completed.
// Again we'll use `contains` to find the <label> element and then use the `parents` command
// to traverse multiple levels up the dom until we find the corresponding <li> element.
// Once we get that element, we can assert that it has the completed class.
cy.contains('Pay electric bill')
.parents('li')
.should('have.class', 'completed')
})
context('with a checked task', () => {
beforeEach(() => {
// We'll take the command we used above to check off an element
// Since we want to perform multiple tests that start with checking
// one element, we put it in the beforeEach hook
// so that it runs at the start of every test.
cy.contains('Pay electric bill')
.parent()
.find('input[type=checkbox]')
.check()
})
it('can filter for uncompleted tasks', () => {
// We'll click on the "active" button in order to
// display only incomplete items
cy.contains('Active').click()
// After filtering, we can assert that there is only the one
// incomplete item in the list.
cy.get('.todo-list li')
.should('have.length', 1)
.first()
.should('have.text', 'Walk the dog')
// For good measure, let's also assert that the task we checked off
// does not exist on the page.
cy.contains('Pay electric bill').should('not.exist')
})
it('can filter for completed tasks', () => {
// We can perform similar steps as the test above to ensure
// that only completed tasks are shown
cy.contains('Completed').click()
cy.get('.todo-list li')
.should('have.length', 1)
.first()
.should('have.text', 'Pay electric bill')
cy.contains('Walk the dog').should('not.exist')
})
it('can delete all completed tasks', () => {
// First, let's click the "Clear completed" button
// `contains` is actually serving two purposes here.
// First, it's ensuring that the button exists within the dom.
// This button only appears when at least one task is checked
// so this command is implicitly verifying that it does exist.
// Second, it selects the button so we can click it.
cy.contains('Clear completed').click()
// Then we can make sure that there is only one element
// in the list and our element does not exist
cy.get('.todo-list li')
.should('have.length', 1)
.should('not.have.text', 'Pay electric bill')
// Finally, make sure that the clear button no longer exists.
cy.contains('Clear completed').should('not.exist')
})
})
})
})

View File

@@ -1,299 +1,299 @@
/// <reference types="cypress" />
context('Actions', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/actions')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/actions')
})
// https://on.cypress.io/interacting-with-elements
// https://on.cypress.io/interacting-with-elements
it('.type() - type into a DOM element', () => {
// https://on.cypress.io/type
cy.get('.action-email')
.type('fake@email.com').should('have.value', 'fake@email.com')
it('.type() - type into a DOM element', () => {
// https://on.cypress.io/type
cy.get('.action-email')
.type('fake@email.com').should('have.value', 'fake@email.com')
// .type() with special character sequences
.type('{leftarrow}{rightarrow}{uparrow}{downarrow}')
.type('{del}{selectall}{backspace}')
// .type() with special character sequences
.type('{leftarrow}{rightarrow}{uparrow}{downarrow}')
.type('{del}{selectall}{backspace}')
// .type() with key modifiers
.type('{alt}{option}') //these are equivalent
.type('{ctrl}{control}') //these are equivalent
.type('{meta}{command}{cmd}') //these are equivalent
.type('{shift}')
// .type() with key modifiers
.type('{alt}{option}') //these are equivalent
.type('{ctrl}{control}') //these are equivalent
.type('{meta}{command}{cmd}') //these are equivalent
.type('{shift}')
// Delay each keypress by 0.1 sec
.type('slow.typing@email.com', { delay: 100 })
.should('have.value', 'slow.typing@email.com')
// Delay each keypress by 0.1 sec
.type('slow.typing@email.com', {delay: 100})
.should('have.value', 'slow.typing@email.com')
cy.get('.action-disabled')
// Ignore error checking prior to type
// like whether the input is visible or disabled
.type('disabled error checking', { force: true })
.should('have.value', 'disabled error checking')
})
cy.get('.action-disabled')
// Ignore error checking prior to type
// like whether the input is visible or disabled
.type('disabled error checking', {force: true})
.should('have.value', 'disabled error checking')
})
it('.focus() - focus on a DOM element', () => {
// https://on.cypress.io/focus
cy.get('.action-focus').focus()
.should('have.class', 'focus')
.prev().should('have.attr', 'style', 'color: orange;')
})
it('.focus() - focus on a DOM element', () => {
// https://on.cypress.io/focus
cy.get('.action-focus').focus()
.should('have.class', 'focus')
.prev().should('have.attr', 'style', 'color: orange;')
})
it('.blur() - blur off a DOM element', () => {
// https://on.cypress.io/blur
cy.get('.action-blur').type('About to blur').blur()
.should('have.class', 'error')
.prev().should('have.attr', 'style', 'color: red;')
})
it('.blur() - blur off a DOM element', () => {
// https://on.cypress.io/blur
cy.get('.action-blur').type('About to blur').blur()
.should('have.class', 'error')
.prev().should('have.attr', 'style', 'color: red;')
})
it('.clear() - clears an input or textarea element', () => {
// https://on.cypress.io/clear
cy.get('.action-clear').type('Clear this text')
.should('have.value', 'Clear this text')
.clear()
.should('have.value', '')
})
it('.clear() - clears an input or textarea element', () => {
// https://on.cypress.io/clear
cy.get('.action-clear').type('Clear this text')
.should('have.value', 'Clear this text')
.clear()
.should('have.value', '')
})
it('.submit() - submit a form', () => {
// https://on.cypress.io/submit
cy.get('.action-form')
.find('[type="text"]').type('HALFOFF')
it('.submit() - submit a form', () => {
// https://on.cypress.io/submit
cy.get('.action-form')
.find('[type="text"]').type('HALFOFF')
cy.get('.action-form').submit()
.next().should('contain', 'Your form has been submitted!')
})
cy.get('.action-form').submit()
.next().should('contain', 'Your form has been submitted!')
})
it('.click() - click on a DOM element', () => {
// https://on.cypress.io/click
cy.get('.action-btn').click()
it('.click() - click on a DOM element', () => {
// https://on.cypress.io/click
cy.get('.action-btn').click()
// You can click on 9 specific positions of an element:
// -----------------------------------
// | topLeft top topRight |
// | |
// | |
// | |
// | left center right |
// | |
// | |
// | |
// | bottomLeft bottom bottomRight |
// -----------------------------------
// You can click on 9 specific positions of an element:
// -----------------------------------
// | topLeft top topRight |
// | |
// | |
// | |
// | left center right |
// | |
// | |
// | |
// | bottomLeft bottom bottomRight |
// -----------------------------------
// clicking in the center of the element is the default
cy.get('#action-canvas').click()
// clicking in the center of the element is the default
cy.get('#action-canvas').click()
cy.get('#action-canvas').click('topLeft')
cy.get('#action-canvas').click('top')
cy.get('#action-canvas').click('topRight')
cy.get('#action-canvas').click('left')
cy.get('#action-canvas').click('right')
cy.get('#action-canvas').click('bottomLeft')
cy.get('#action-canvas').click('bottom')
cy.get('#action-canvas').click('bottomRight')
cy.get('#action-canvas').click('topLeft')
cy.get('#action-canvas').click('top')
cy.get('#action-canvas').click('topRight')
cy.get('#action-canvas').click('left')
cy.get('#action-canvas').click('right')
cy.get('#action-canvas').click('bottomLeft')
cy.get('#action-canvas').click('bottom')
cy.get('#action-canvas').click('bottomRight')
// .click() accepts an x and y coordinate
// that controls where the click occurs :)
// .click() accepts an x and y coordinate
// that controls where the click occurs :)
cy.get('#action-canvas')
.click(80, 75) // click 80px on x coord and 75px on y coord
.click(170, 75)
.click(80, 165)
.click(100, 185)
.click(125, 190)
.click(150, 185)
.click(170, 165)
cy.get('#action-canvas')
.click(80, 75) // click 80px on x coord and 75px on y coord
.click(170, 75)
.click(80, 165)
.click(100, 185)
.click(125, 190)
.click(150, 185)
.click(170, 165)
// click multiple elements by passing multiple: true
cy.get('.action-labels>.label').click({ multiple: true })
// click multiple elements by passing multiple: true
cy.get('.action-labels>.label').click({multiple: true})
// Ignore error checking prior to clicking
cy.get('.action-opacity>.btn').click({ force: true })
})
// Ignore error checking prior to clicking
cy.get('.action-opacity>.btn').click({force: true})
})
it('.dblclick() - double click on a DOM element', () => {
// https://on.cypress.io/dblclick
it('.dblclick() - double click on a DOM element', () => {
// https://on.cypress.io/dblclick
// Our app has a listener on 'dblclick' event in our 'scripts.js'
// that hides the div and shows an input on double click
cy.get('.action-div').dblclick().should('not.be.visible')
cy.get('.action-input-hidden').should('be.visible')
})
// Our app has a listener on 'dblclick' event in our 'scripts.js'
// that hides the div and shows an input on double click
cy.get('.action-div').dblclick().should('not.be.visible')
cy.get('.action-input-hidden').should('be.visible')
})
it('.rightclick() - right click on a DOM element', () => {
// https://on.cypress.io/rightclick
it('.rightclick() - right click on a DOM element', () => {
// https://on.cypress.io/rightclick
// Our app has a listener on 'contextmenu' event in our 'scripts.js'
// that hides the div and shows an input on right click
cy.get('.rightclick-action-div').rightclick().should('not.be.visible')
cy.get('.rightclick-action-input-hidden').should('be.visible')
})
// Our app has a listener on 'contextmenu' event in our 'scripts.js'
// that hides the div and shows an input on right click
cy.get('.rightclick-action-div').rightclick().should('not.be.visible')
cy.get('.rightclick-action-input-hidden').should('be.visible')
})
it('.check() - check a checkbox or radio element', () => {
// https://on.cypress.io/check
it('.check() - check a checkbox or radio element', () => {
// https://on.cypress.io/check
// By default, .check() will check all
// matching checkbox or radio elements in succession, one after another
cy.get('.action-checkboxes [type="checkbox"]').not('[disabled]')
.check().should('be.checked')
// By default, .check() will check all
// matching checkbox or radio elements in succession, one after another
cy.get('.action-checkboxes [type="checkbox"]').not('[disabled]')
.check().should('be.checked')
cy.get('.action-radios [type="radio"]').not('[disabled]')
.check().should('be.checked')
cy.get('.action-radios [type="radio"]').not('[disabled]')
.check().should('be.checked')
// .check() accepts a value argument
cy.get('.action-radios [type="radio"]')
.check('radio1').should('be.checked')
// .check() accepts a value argument
cy.get('.action-radios [type="radio"]')
.check('radio1').should('be.checked')
// .check() accepts an array of values
cy.get('.action-multiple-checkboxes [type="checkbox"]')
.check(['checkbox1', 'checkbox2']).should('be.checked')
// .check() accepts an array of values
cy.get('.action-multiple-checkboxes [type="checkbox"]')
.check(['checkbox1', 'checkbox2']).should('be.checked')
// Ignore error checking prior to checking
cy.get('.action-checkboxes [disabled]')
.check({ force: true }).should('be.checked')
// Ignore error checking prior to checking
cy.get('.action-checkboxes [disabled]')
.check({force: true}).should('be.checked')
cy.get('.action-radios [type="radio"]')
.check('radio3', { force: true }).should('be.checked')
})
cy.get('.action-radios [type="radio"]')
.check('radio3', {force: true}).should('be.checked')
})
it('.uncheck() - uncheck a checkbox element', () => {
// https://on.cypress.io/uncheck
it('.uncheck() - uncheck a checkbox element', () => {
// https://on.cypress.io/uncheck
// By default, .uncheck() will uncheck all matching
// checkbox elements in succession, one after another
cy.get('.action-check [type="checkbox"]')
.not('[disabled]')
.uncheck().should('not.be.checked')
// By default, .uncheck() will uncheck all matching
// checkbox elements in succession, one after another
cy.get('.action-check [type="checkbox"]')
.not('[disabled]')
.uncheck().should('not.be.checked')
// .uncheck() accepts a value argument
cy.get('.action-check [type="checkbox"]')
.check('checkbox1')
.uncheck('checkbox1').should('not.be.checked')
// .uncheck() accepts a value argument
cy.get('.action-check [type="checkbox"]')
.check('checkbox1')
.uncheck('checkbox1').should('not.be.checked')
// .uncheck() accepts an array of values
cy.get('.action-check [type="checkbox"]')
.check(['checkbox1', 'checkbox3'])
.uncheck(['checkbox1', 'checkbox3']).should('not.be.checked')
// .uncheck() accepts an array of values
cy.get('.action-check [type="checkbox"]')
.check(['checkbox1', 'checkbox3'])
.uncheck(['checkbox1', 'checkbox3']).should('not.be.checked')
// Ignore error checking prior to unchecking
cy.get('.action-check [disabled]')
.uncheck({ force: true }).should('not.be.checked')
})
// Ignore error checking prior to unchecking
cy.get('.action-check [disabled]')
.uncheck({force: true}).should('not.be.checked')
})
it('.select() - select an option in a <select> element', () => {
// https://on.cypress.io/select
it('.select() - select an option in a <select> element', () => {
// https://on.cypress.io/select
// at first, no option should be selected
cy.get('.action-select')
.should('have.value', '--Select a fruit--')
// at first, no option should be selected
cy.get('.action-select')
.should('have.value', '--Select a fruit--')
// Select option(s) with matching text content
cy.get('.action-select').select('apples')
// confirm the apples were selected
// note that each value starts with "fr-" in our HTML
cy.get('.action-select').should('have.value', 'fr-apples')
// Select option(s) with matching text content
cy.get('.action-select').select('apples')
// confirm the apples were selected
// note that each value starts with "fr-" in our HTML
cy.get('.action-select').should('have.value', 'fr-apples')
cy.get('.action-select-multiple')
.select(['apples', 'oranges', 'bananas'])
// when getting multiple values, invoke "val" method first
.invoke('val')
.should('deep.equal', ['fr-apples', 'fr-oranges', 'fr-bananas'])
cy.get('.action-select-multiple')
.select(['apples', 'oranges', 'bananas'])
// when getting multiple values, invoke "val" method first
.invoke('val')
.should('deep.equal', ['fr-apples', 'fr-oranges', 'fr-bananas'])
// Select option(s) with matching value
cy.get('.action-select').select('fr-bananas')
// can attach an assertion right away to the element
.should('have.value', 'fr-bananas')
// Select option(s) with matching value
cy.get('.action-select').select('fr-bananas')
// can attach an assertion right away to the element
.should('have.value', 'fr-bananas')
cy.get('.action-select-multiple')
.select(['fr-apples', 'fr-oranges', 'fr-bananas'])
.invoke('val')
.should('deep.equal', ['fr-apples', 'fr-oranges', 'fr-bananas'])
cy.get('.action-select-multiple')
.select(['fr-apples', 'fr-oranges', 'fr-bananas'])
.invoke('val')
.should('deep.equal', ['fr-apples', 'fr-oranges', 'fr-bananas'])
// assert the selected values include oranges
cy.get('.action-select-multiple')
.invoke('val').should('include', 'fr-oranges')
})
// assert the selected values include oranges
cy.get('.action-select-multiple')
.invoke('val').should('include', 'fr-oranges')
})
it('.scrollIntoView() - scroll an element into view', () => {
// https://on.cypress.io/scrollintoview
it('.scrollIntoView() - scroll an element into view', () => {
// https://on.cypress.io/scrollintoview
// normally all of these buttons are hidden,
// because they're not within
// the viewable area of their parent
// (we need to scroll to see them)
cy.get('#scroll-horizontal button')
.should('not.be.visible')
// normally all of these buttons are hidden,
// because they're not within
// the viewable area of their parent
// (we need to scroll to see them)
cy.get('#scroll-horizontal button')
.should('not.be.visible')
// scroll the button into view, as if the user had scrolled
cy.get('#scroll-horizontal button').scrollIntoView()
.should('be.visible')
// scroll the button into view, as if the user had scrolled
cy.get('#scroll-horizontal button').scrollIntoView()
.should('be.visible')
cy.get('#scroll-vertical button')
.should('not.be.visible')
cy.get('#scroll-vertical button')
.should('not.be.visible')
// Cypress handles the scroll direction needed
cy.get('#scroll-vertical button').scrollIntoView()
.should('be.visible')
// Cypress handles the scroll direction needed
cy.get('#scroll-vertical button').scrollIntoView()
.should('be.visible')
cy.get('#scroll-both button')
.should('not.be.visible')
cy.get('#scroll-both button')
.should('not.be.visible')
// Cypress knows to scroll to the right and down
cy.get('#scroll-both button').scrollIntoView()
.should('be.visible')
})
// Cypress knows to scroll to the right and down
cy.get('#scroll-both button').scrollIntoView()
.should('be.visible')
})
it('.trigger() - trigger an event on a DOM element', () => {
// https://on.cypress.io/trigger
it('.trigger() - trigger an event on a DOM element', () => {
// https://on.cypress.io/trigger
// To interact with a range input (slider)
// we need to set its value & trigger the
// event to signal it changed
// To interact with a range input (slider)
// we need to set its value & trigger the
// event to signal it changed
// Here, we invoke jQuery's val() method to set
// the value and trigger the 'change' event
cy.get('.trigger-input-range')
.invoke('val', 25)
.trigger('change')
.get('input[type=range]').siblings('p')
.should('have.text', '25')
})
// Here, we invoke jQuery's val() method to set
// the value and trigger the 'change' event
cy.get('.trigger-input-range')
.invoke('val', 25)
.trigger('change')
.get('input[type=range]').siblings('p')
.should('have.text', '25')
})
it('cy.scrollTo() - scroll the window or element to a position', () => {
// https://on.cypress.io/scrollto
it('cy.scrollTo() - scroll the window or element to a position', () => {
// https://on.cypress.io/scrollto
// You can scroll to 9 specific positions of an element:
// -----------------------------------
// | topLeft top topRight |
// | |
// | |
// | |
// | left center right |
// | |
// | |
// | |
// | bottomLeft bottom bottomRight |
// -----------------------------------
// You can scroll to 9 specific positions of an element:
// -----------------------------------
// | topLeft top topRight |
// | |
// | |
// | |
// | left center right |
// | |
// | |
// | |
// | bottomLeft bottom bottomRight |
// -----------------------------------
// if you chain .scrollTo() off of cy, we will
// scroll the entire window
cy.scrollTo('bottom')
// if you chain .scrollTo() off of cy, we will
// scroll the entire window
cy.scrollTo('bottom')
cy.get('#scrollable-horizontal').scrollTo('right')
cy.get('#scrollable-horizontal').scrollTo('right')
// or you can scroll to a specific coordinate:
// (x axis, y axis) in pixels
cy.get('#scrollable-vertical').scrollTo(250, 250)
// or you can scroll to a specific coordinate:
// (x axis, y axis) in pixels
cy.get('#scrollable-vertical').scrollTo(250, 250)
// or you can scroll to a specific percentage
// of the (width, height) of the element
cy.get('#scrollable-both').scrollTo('75%', '25%')
// or you can scroll to a specific percentage
// of the (width, height) of the element
cy.get('#scrollable-both').scrollTo('75%', '25%')
// control the easing of the scroll (default is 'swing')
cy.get('#scrollable-vertical').scrollTo('center', { easing: 'linear' })
// control the easing of the scroll (default is 'swing')
cy.get('#scrollable-vertical').scrollTo('center', {easing: 'linear'})
// control the duration of the scroll (in ms)
cy.get('#scrollable-both').scrollTo('center', { duration: 2000 })
})
// control the duration of the scroll (in ms)
cy.get('#scrollable-both').scrollTo('center', {duration: 2000})
})
})

View File

@@ -1,39 +1,39 @@
/// <reference types="cypress" />
context('Aliasing', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/aliasing')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/aliasing')
})
it('.as() - alias a DOM element for later use', () => {
// https://on.cypress.io/as
it('.as() - alias a DOM element for later use', () => {
// https://on.cypress.io/as
// Alias a DOM element for use later
// We don't have to traverse to the element
// later in our code, we reference it with @
// Alias a DOM element for use later
// We don't have to traverse to the element
// later in our code, we reference it with @
cy.get('.as-table').find('tbody>tr')
.first().find('td').first()
.find('button').as('firstBtn')
cy.get('.as-table').find('tbody>tr')
.first().find('td').first()
.find('button').as('firstBtn')
// when we reference the alias, we place an
// @ in front of its name
cy.get('@firstBtn').click()
// when we reference the alias, we place an
// @ in front of its name
cy.get('@firstBtn').click()
cy.get('@firstBtn')
.should('have.class', 'btn-success')
.and('contain', 'Changed')
})
cy.get('@firstBtn')
.should('have.class', 'btn-success')
.and('contain', 'Changed')
})
it('.as() - alias a route for later use', () => {
// Alias the route to wait for its response
cy.intercept('GET', '**/comments/*').as('getComment')
it('.as() - alias a route for later use', () => {
// Alias the route to wait for its response
cy.intercept('GET', '**/comments/*').as('getComment')
// we have code that gets a comment when
// the button is clicked in scripts.js
cy.get('.network-btn').click()
// we have code that gets a comment when
// the button is clicked in scripts.js
cy.get('.network-btn').click()
// https://on.cypress.io/wait
cy.wait('@getComment').its('response.statusCode').should('eq', 200)
})
// https://on.cypress.io/wait
cy.wait('@getComment').its('response.statusCode').should('eq', 200)
})
})

View File

@@ -1,177 +1,177 @@
/// <reference types="cypress" />
context('Assertions', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/assertions')
})
describe('Implicit Assertions', () => {
it('.should() - make an assertion about the current subject', () => {
// https://on.cypress.io/should
cy.get('.assertion-table')
.find('tbody tr:last')
.should('have.class', 'success')
.find('td')
.first()
// checking the text of the <td> element in various ways
.should('have.text', 'Column content')
.should('contain', 'Column content')
.should('have.html', 'Column content')
// chai-jquery uses "is()" to check if element matches selector
.should('match', 'td')
// to match text content against a regular expression
// first need to invoke jQuery method text()
// and then match using regular expression
.invoke('text')
.should('match', /column content/i)
// a better way to check element's text content against a regular expression
// is to use "cy.contains"
// https://on.cypress.io/contains
cy.get('.assertion-table')
.find('tbody tr:last')
// finds first <td> element with text content matching regular expression
.contains('td', /column content/i)
.should('be.visible')
// for more information about asserting element's text
// see https://on.cypress.io/using-cypress-faq#How-do-I-get-an-elements-text-contents
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/assertions')
})
it('.and() - chain multiple assertions together', () => {
// https://on.cypress.io/and
cy.get('.assertions-link')
.should('have.class', 'active')
.and('have.attr', 'href')
.and('include', 'cypress.io')
})
})
describe('Implicit Assertions', () => {
it('.should() - make an assertion about the current subject', () => {
// https://on.cypress.io/should
cy.get('.assertion-table')
.find('tbody tr:last')
.should('have.class', 'success')
.find('td')
.first()
// checking the text of the <td> element in various ways
.should('have.text', 'Column content')
.should('contain', 'Column content')
.should('have.html', 'Column content')
// chai-jquery uses "is()" to check if element matches selector
.should('match', 'td')
// to match text content against a regular expression
// first need to invoke jQuery method text()
// and then match using regular expression
.invoke('text')
.should('match', /column content/i)
describe('Explicit Assertions', () => {
// https://on.cypress.io/assertions
it('expect - make an assertion about a specified subject', () => {
// We can use Chai's BDD style assertions
expect(true).to.be.true
const o = { foo: 'bar' }
// a better way to check element's text content against a regular expression
// is to use "cy.contains"
// https://on.cypress.io/contains
cy.get('.assertion-table')
.find('tbody tr:last')
// finds first <td> element with text content matching regular expression
.contains('td', /column content/i)
.should('be.visible')
expect(o).to.equal(o)
expect(o).to.deep.equal({ foo: 'bar' })
// matching text using regular expression
expect('FooBar').to.match(/bar$/i)
})
// for more information about asserting element's text
// see https://on.cypress.io/using-cypress-faq#How-do-I-get-an-elements-text-contents
})
it('pass your own callback function to should()', () => {
// Pass a function to should that can have any number
// of explicit assertions within it.
// The ".should(cb)" function will be retried
// automatically until it passes all your explicit assertions or times out.
cy.get('.assertions-p')
.find('p')
.should(($p) => {
// https://on.cypress.io/$
// return an array of texts from all of the p's
// @ts-ignore TS6133 unused variable
const texts = $p.map((i, el) => Cypress.$(el).text())
// jquery map returns jquery object
// and .get() convert this to simple array
const paragraphs = texts.get()
// array should have length of 3
expect(paragraphs, 'has 3 paragraphs').to.have.length(3)
// use second argument to expect(...) to provide clear
// message with each assertion
expect(paragraphs, 'has expected text in each paragraph').to.deep.eq([
'Some text from first p',
'More text from second p',
'And even more text from third p',
])
it('.and() - chain multiple assertions together', () => {
// https://on.cypress.io/and
cy.get('.assertions-link')
.should('have.class', 'active')
.and('have.attr', 'href')
.and('include', 'cypress.io')
})
})
it('finds element by class name regex', () => {
cy.get('.docs-header')
.find('div')
// .should(cb) callback function will be retried
.should(($div) => {
expect($div).to.have.length(1)
describe('Explicit Assertions', () => {
// https://on.cypress.io/assertions
it('expect - make an assertion about a specified subject', () => {
// We can use Chai's BDD style assertions
expect(true).to.be.true
const o = {foo: 'bar'}
const className = $div[0].className
expect(className).to.match(/heading-/)
expect(o).to.equal(o)
expect(o).to.deep.equal({foo: 'bar'})
// matching text using regular expression
expect('FooBar').to.match(/bar$/i)
})
// .then(cb) callback is not retried,
// it either passes or fails
.then(($div) => {
expect($div, 'text content').to.have.text('Introduction')
it('pass your own callback function to should()', () => {
// Pass a function to should that can have any number
// of explicit assertions within it.
// The ".should(cb)" function will be retried
// automatically until it passes all your explicit assertions or times out.
cy.get('.assertions-p')
.find('p')
.should(($p) => {
// https://on.cypress.io/$
// return an array of texts from all of the p's
// @ts-ignore TS6133 unused variable
const texts = $p.map((i, el) => Cypress.$(el).text())
// jquery map returns jquery object
// and .get() convert this to simple array
const paragraphs = texts.get()
// array should have length of 3
expect(paragraphs, 'has 3 paragraphs').to.have.length(3)
// use second argument to expect(...) to provide clear
// message with each assertion
expect(paragraphs, 'has expected text in each paragraph').to.deep.eq([
'Some text from first p',
'More text from second p',
'And even more text from third p',
])
})
})
it('finds element by class name regex', () => {
cy.get('.docs-header')
.find('div')
// .should(cb) callback function will be retried
.should(($div) => {
expect($div).to.have.length(1)
const className = $div[0].className
expect(className).to.match(/heading-/)
})
// .then(cb) callback is not retried,
// it either passes or fails
.then(($div) => {
expect($div, 'text content').to.have.text('Introduction')
})
})
it('can throw any error', () => {
cy.get('.docs-header')
.find('div')
.should(($div) => {
if ($div.length !== 1) {
// you can throw your own errors
throw new Error('Did not find 1 element')
}
const className = $div[0].className
if (!className.match(/heading-/)) {
throw new Error(`Could not find class "heading-" in ${className}`)
}
})
})
it('matches unknown text between two elements', () => {
/**
* Text from the first element.
* @type {string}
*/
let text
/**
* Normalizes passed text,
* useful before comparing text with spaces and different capitalization.
* @param {string} s Text to normalize
*/
const normalizeText = (s) => s.replace(/\s/g, '').toLowerCase()
cy.get('.two-elements')
.find('.first')
.then(($first) => {
// save text from the first element
text = normalizeText($first.text())
})
cy.get('.two-elements')
.find('.second')
.should(($div) => {
// we can massage text before comparing
const secondText = normalizeText($div.text())
expect(secondText, 'second text').to.equal(text)
})
})
it('assert - assert shape of an object', () => {
const person = {
name: 'Joe',
age: 20,
}
assert.isObject(person, 'value is object')
})
it('retries the should callback until assertions pass', () => {
cy.get('#random-number')
.should(($div) => {
const n = parseFloat($div.text())
expect(n).to.be.gte(1).and.be.lte(10)
})
})
})
it('can throw any error', () => {
cy.get('.docs-header')
.find('div')
.should(($div) => {
if ($div.length !== 1) {
// you can throw your own errors
throw new Error('Did not find 1 element')
}
const className = $div[0].className
if (!className.match(/heading-/)) {
throw new Error(`Could not find class "heading-" in ${className}`)
}
})
})
it('matches unknown text between two elements', () => {
/**
* Text from the first element.
* @type {string}
*/
let text
/**
* Normalizes passed text,
* useful before comparing text with spaces and different capitalization.
* @param {string} s Text to normalize
*/
const normalizeText = (s) => s.replace(/\s/g, '').toLowerCase()
cy.get('.two-elements')
.find('.first')
.then(($first) => {
// save text from the first element
text = normalizeText($first.text())
})
cy.get('.two-elements')
.find('.second')
.should(($div) => {
// we can massage text before comparing
const secondText = normalizeText($div.text())
expect(secondText, 'second text').to.equal(text)
})
})
it('assert - assert shape of an object', () => {
const person = {
name: 'Joe',
age: 20,
}
assert.isObject(person, 'value is object')
})
it('retries the should callback until assertions pass', () => {
cy.get('#random-number')
.should(($div) => {
const n = parseFloat($div.text())
expect(n).to.be.gte(1).and.be.lte(10)
})
})
})
})

View File

@@ -1,97 +1,97 @@
/// <reference types="cypress" />
context('Connectors', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/connectors')
})
it('.each() - iterate over an array of elements', () => {
// https://on.cypress.io/each
cy.get('.connectors-each-ul>li')
.each(($el, index, $list) => {
console.log($el, index, $list)
})
})
it('.its() - get properties on the current subject', () => {
// https://on.cypress.io/its
cy.get('.connectors-its-ul>li')
// calls the 'length' property yielding that value
.its('length')
.should('be.gt', 2)
})
it('.invoke() - invoke a function on the current subject', () => {
// our div is hidden in our script.js
// $('.connectors-div').hide()
// https://on.cypress.io/invoke
cy.get('.connectors-div').should('be.hidden')
// call the jquery method 'show' on the 'div.container'
.invoke('show')
.should('be.visible')
})
it('.spread() - spread an array as individual args to callback function', () => {
// https://on.cypress.io/spread
const arr = ['foo', 'bar', 'baz']
cy.wrap(arr).spread((foo, bar, baz) => {
expect(foo).to.eq('foo')
expect(bar).to.eq('bar')
expect(baz).to.eq('baz')
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/connectors')
})
})
describe('.then()', () => {
it('invokes a callback function with the current subject', () => {
// https://on.cypress.io/then
cy.get('.connectors-list > li')
.then(($lis) => {
expect($lis, '3 items').to.have.length(3)
expect($lis.eq(0), 'first item').to.contain('Walk the dog')
expect($lis.eq(1), 'second item').to.contain('Feed the cat')
expect($lis.eq(2), 'third item').to.contain('Write JavaScript')
it('.each() - iterate over an array of elements', () => {
// https://on.cypress.io/each
cy.get('.connectors-each-ul>li')
.each(($el, index, $list) => {
console.log($el, index, $list)
})
})
it('.its() - get properties on the current subject', () => {
// https://on.cypress.io/its
cy.get('.connectors-its-ul>li')
// calls the 'length' property yielding that value
.its('length')
.should('be.gt', 2)
})
it('.invoke() - invoke a function on the current subject', () => {
// our div is hidden in our script.js
// $('.connectors-div').hide()
// https://on.cypress.io/invoke
cy.get('.connectors-div').should('be.hidden')
// call the jquery method 'show' on the 'div.container'
.invoke('show')
.should('be.visible')
})
it('.spread() - spread an array as individual args to callback function', () => {
// https://on.cypress.io/spread
const arr = ['foo', 'bar', 'baz']
cy.wrap(arr).spread((foo, bar, baz) => {
expect(foo).to.eq('foo')
expect(bar).to.eq('bar')
expect(baz).to.eq('baz')
})
})
it('yields the returned value to the next command', () => {
cy.wrap(1)
.then((num) => {
expect(num).to.equal(1)
return 2
describe('.then()', () => {
it('invokes a callback function with the current subject', () => {
// https://on.cypress.io/then
cy.get('.connectors-list > li')
.then(($lis) => {
expect($lis, '3 items').to.have.length(3)
expect($lis.eq(0), 'first item').to.contain('Walk the dog')
expect($lis.eq(1), 'second item').to.contain('Feed the cat')
expect($lis.eq(2), 'third item').to.contain('Write JavaScript')
})
})
.then((num) => {
expect(num).to.equal(2)
it('yields the returned value to the next command', () => {
cy.wrap(1)
.then((num) => {
expect(num).to.equal(1)
return 2
})
.then((num) => {
expect(num).to.equal(2)
})
})
it('yields the original subject without return', () => {
cy.wrap(1)
.then((num) => {
expect(num).to.equal(1)
// note that nothing is returned from this callback
})
.then((num) => {
// this callback receives the original unchanged value 1
expect(num).to.equal(1)
})
})
it('yields the value yielded by the last Cypress command inside', () => {
cy.wrap(1)
.then((num) => {
expect(num).to.equal(1)
// note how we run a Cypress command
// the result yielded by this Cypress command
// will be passed to the second ".then"
cy.wrap(2)
})
.then((num) => {
// this callback receives the value yielded by "cy.wrap(2)"
expect(num).to.equal(2)
})
})
})
it('yields the original subject without return', () => {
cy.wrap(1)
.then((num) => {
expect(num).to.equal(1)
// note that nothing is returned from this callback
})
.then((num) => {
// this callback receives the original unchanged value 1
expect(num).to.equal(1)
})
})
it('yields the value yielded by the last Cypress command inside', () => {
cy.wrap(1)
.then((num) => {
expect(num).to.equal(1)
// note how we run a Cypress command
// the result yielded by this Cypress command
// will be passed to the second ".then"
cy.wrap(2)
})
.then((num) => {
// this callback receives the value yielded by "cy.wrap(2)"
expect(num).to.equal(2)
})
})
})
})

View File

@@ -1,77 +1,77 @@
/// <reference types="cypress" />
context('Cookies', () => {
beforeEach(() => {
Cypress.Cookies.debug(true)
beforeEach(() => {
Cypress.Cookies.debug(true)
cy.visit('https://example.cypress.io/commands/cookies')
cy.visit('https://example.cypress.io/commands/cookies')
// clear cookies again after visiting to remove
// any 3rd party cookies picked up such as cloudflare
cy.clearCookies()
})
it('cy.getCookie() - get a browser cookie', () => {
// https://on.cypress.io/getcookie
cy.get('#getCookie .set-a-cookie').click()
// cy.getCookie() yields a cookie object
cy.getCookie('token').should('have.property', 'value', '123ABC')
})
it('cy.getCookies() - get browser cookies', () => {
// https://on.cypress.io/getcookies
cy.getCookies().should('be.empty')
cy.get('#getCookies .set-a-cookie').click()
// cy.getCookies() yields an array of cookies
cy.getCookies().should('have.length', 1).should((cookies) => {
// each cookie has these properties
expect(cookies[0]).to.have.property('name', 'token')
expect(cookies[0]).to.have.property('value', '123ABC')
expect(cookies[0]).to.have.property('httpOnly', false)
expect(cookies[0]).to.have.property('secure', false)
expect(cookies[0]).to.have.property('domain')
expect(cookies[0]).to.have.property('path')
// clear cookies again after visiting to remove
// any 3rd party cookies picked up such as cloudflare
cy.clearCookies()
})
})
it('cy.setCookie() - set a browser cookie', () => {
// https://on.cypress.io/setcookie
cy.getCookies().should('be.empty')
it('cy.getCookie() - get a browser cookie', () => {
// https://on.cypress.io/getcookie
cy.get('#getCookie .set-a-cookie').click()
cy.setCookie('foo', 'bar')
// cy.getCookie() yields a cookie object
cy.getCookie('token').should('have.property', 'value', '123ABC')
})
// cy.getCookie() yields a cookie object
cy.getCookie('foo').should('have.property', 'value', 'bar')
})
it('cy.getCookies() - get browser cookies', () => {
// https://on.cypress.io/getcookies
cy.getCookies().should('be.empty')
it('cy.clearCookie() - clear a browser cookie', () => {
// https://on.cypress.io/clearcookie
cy.getCookie('token').should('be.null')
cy.get('#getCookies .set-a-cookie').click()
cy.get('#clearCookie .set-a-cookie').click()
// cy.getCookies() yields an array of cookies
cy.getCookies().should('have.length', 1).should((cookies) => {
// each cookie has these properties
expect(cookies[0]).to.have.property('name', 'token')
expect(cookies[0]).to.have.property('value', '123ABC')
expect(cookies[0]).to.have.property('httpOnly', false)
expect(cookies[0]).to.have.property('secure', false)
expect(cookies[0]).to.have.property('domain')
expect(cookies[0]).to.have.property('path')
})
})
cy.getCookie('token').should('have.property', 'value', '123ABC')
it('cy.setCookie() - set a browser cookie', () => {
// https://on.cypress.io/setcookie
cy.getCookies().should('be.empty')
// cy.clearCookies() yields null
cy.clearCookie('token').should('be.null')
cy.setCookie('foo', 'bar')
cy.getCookie('token').should('be.null')
})
// cy.getCookie() yields a cookie object
cy.getCookie('foo').should('have.property', 'value', 'bar')
})
it('cy.clearCookies() - clear browser cookies', () => {
// https://on.cypress.io/clearcookies
cy.getCookies().should('be.empty')
it('cy.clearCookie() - clear a browser cookie', () => {
// https://on.cypress.io/clearcookie
cy.getCookie('token').should('be.null')
cy.get('#clearCookies .set-a-cookie').click()
cy.get('#clearCookie .set-a-cookie').click()
cy.getCookies().should('have.length', 1)
cy.getCookie('token').should('have.property', 'value', '123ABC')
// cy.clearCookies() yields null
cy.clearCookies()
// cy.clearCookies() yields null
cy.clearCookie('token').should('be.null')
cy.getCookies().should('be.empty')
})
cy.getCookie('token').should('be.null')
})
it('cy.clearCookies() - clear browser cookies', () => {
// https://on.cypress.io/clearcookies
cy.getCookies().should('be.empty')
cy.get('#clearCookies .set-a-cookie').click()
cy.getCookies().should('have.length', 1)
// cy.clearCookies() yields null
cy.clearCookies()
cy.getCookies().should('be.empty')
})
})

View File

@@ -1,202 +1,202 @@
/// <reference types="cypress" />
context('Cypress.Commands', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
// https://on.cypress.io/custom-commands
it('.add() - create a custom command', () => {
Cypress.Commands.add('console', {
prevSubject: true,
}, (subject, method) => {
// the previous subject is automatically received
// and the commands arguments are shifted
// allow us to change the console method used
method = method || 'log'
// log the subject to the console
// @ts-ignore TS7017
console[method]('The subject is', subject)
// whatever we return becomes the new subject
// we don't want to change the subject so
// we return whatever was passed in
return subject
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
// @ts-ignore TS2339
cy.get('button').console('info').then(($button) => {
// subject is still $button
// https://on.cypress.io/custom-commands
it('.add() - create a custom command', () => {
Cypress.Commands.add('console', {
prevSubject: true,
}, (subject, method) => {
// the previous subject is automatically received
// and the commands arguments are shifted
// allow us to change the console method used
method = method || 'log'
// log the subject to the console
// @ts-ignore TS7017
console[method]('The subject is', subject)
// whatever we return becomes the new subject
// we don't want to change the subject so
// we return whatever was passed in
return subject
})
// @ts-ignore TS2339
cy.get('button').console('info').then(($button) => {
// subject is still $button
})
})
})
})
context('Cypress.Cookies', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
// https://on.cypress.io/cookies
it('.debug() - enable or disable debugging', () => {
Cypress.Cookies.debug(true)
// Cypress will now log in the console when
// cookies are set or cleared
cy.setCookie('fakeCookie', '123ABC')
cy.clearCookie('fakeCookie')
cy.setCookie('fakeCookie', '123ABC')
cy.clearCookie('fakeCookie')
cy.setCookie('fakeCookie', '123ABC')
})
it('.preserveOnce() - preserve cookies by key', () => {
// normally cookies are reset after each test
cy.getCookie('fakeCookie').should('not.be.ok')
// preserving a cookie will not clear it when
// the next test starts
cy.setCookie('lastCookie', '789XYZ')
Cypress.Cookies.preserveOnce('lastCookie')
})
it('.defaults() - set defaults for all cookies', () => {
// now any cookie with the name 'session_id' will
// not be cleared before each new test runs
Cypress.Cookies.defaults({
preserve: 'session_id',
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
// https://on.cypress.io/cookies
it('.debug() - enable or disable debugging', () => {
Cypress.Cookies.debug(true)
// Cypress will now log in the console when
// cookies are set or cleared
cy.setCookie('fakeCookie', '123ABC')
cy.clearCookie('fakeCookie')
cy.setCookie('fakeCookie', '123ABC')
cy.clearCookie('fakeCookie')
cy.setCookie('fakeCookie', '123ABC')
})
it('.preserveOnce() - preserve cookies by key', () => {
// normally cookies are reset after each test
cy.getCookie('fakeCookie').should('not.be.ok')
// preserving a cookie will not clear it when
// the next test starts
cy.setCookie('lastCookie', '789XYZ')
Cypress.Cookies.preserveOnce('lastCookie')
})
it('.defaults() - set defaults for all cookies', () => {
// now any cookie with the name 'session_id' will
// not be cleared before each new test runs
Cypress.Cookies.defaults({
preserve: 'session_id',
})
})
})
})
context('Cypress.arch', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
it('Get CPU architecture name of underlying OS', () => {
// https://on.cypress.io/arch
expect(Cypress.arch).to.exist
})
it('Get CPU architecture name of underlying OS', () => {
// https://on.cypress.io/arch
expect(Cypress.arch).to.exist
})
})
context('Cypress.config()', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
it('Get and set configuration options', () => {
// https://on.cypress.io/config
let myConfig = Cypress.config()
it('Get and set configuration options', () => {
// https://on.cypress.io/config
let myConfig = Cypress.config()
expect(myConfig).to.have.property('animationDistanceThreshold', 5)
expect(myConfig).to.have.property('baseUrl', null)
expect(myConfig).to.have.property('defaultCommandTimeout', 4000)
expect(myConfig).to.have.property('requestTimeout', 5000)
expect(myConfig).to.have.property('responseTimeout', 30000)
expect(myConfig).to.have.property('viewportHeight', 660)
expect(myConfig).to.have.property('viewportWidth', 1000)
expect(myConfig).to.have.property('pageLoadTimeout', 60000)
expect(myConfig).to.have.property('waitForAnimations', true)
expect(myConfig).to.have.property('animationDistanceThreshold', 5)
expect(myConfig).to.have.property('baseUrl', null)
expect(myConfig).to.have.property('defaultCommandTimeout', 4000)
expect(myConfig).to.have.property('requestTimeout', 5000)
expect(myConfig).to.have.property('responseTimeout', 30000)
expect(myConfig).to.have.property('viewportHeight', 660)
expect(myConfig).to.have.property('viewportWidth', 1000)
expect(myConfig).to.have.property('pageLoadTimeout', 60000)
expect(myConfig).to.have.property('waitForAnimations', true)
expect(Cypress.config('pageLoadTimeout')).to.eq(60000)
expect(Cypress.config('pageLoadTimeout')).to.eq(60000)
// this will change the config for the rest of your tests!
Cypress.config('pageLoadTimeout', 20000)
// this will change the config for the rest of your tests!
Cypress.config('pageLoadTimeout', 20000)
expect(Cypress.config('pageLoadTimeout')).to.eq(20000)
expect(Cypress.config('pageLoadTimeout')).to.eq(20000)
Cypress.config('pageLoadTimeout', 60000)
})
Cypress.config('pageLoadTimeout', 60000)
})
})
context('Cypress.dom', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
// https://on.cypress.io/dom
it('.isHidden() - determine if a DOM element is hidden', () => {
let hiddenP = Cypress.$('.dom-p p.hidden').get(0)
let visibleP = Cypress.$('.dom-p p.visible').get(0)
// https://on.cypress.io/dom
it('.isHidden() - determine if a DOM element is hidden', () => {
let hiddenP = Cypress.$('.dom-p p.hidden').get(0)
let visibleP = Cypress.$('.dom-p p.visible').get(0)
// our first paragraph has css class 'hidden'
expect(Cypress.dom.isHidden(hiddenP)).to.be.true
expect(Cypress.dom.isHidden(visibleP)).to.be.false
})
// our first paragraph has css class 'hidden'
expect(Cypress.dom.isHidden(hiddenP)).to.be.true
expect(Cypress.dom.isHidden(visibleP)).to.be.false
})
})
context('Cypress.env()', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
// We can set environment variables for highly dynamic values
// https://on.cypress.io/environment-variables
it('Get environment variables', () => {
// https://on.cypress.io/env
// set multiple environment variables
Cypress.env({
host: 'veronica.dev.local',
api_server: 'http://localhost:8888/v1/',
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
// get environment variable
expect(Cypress.env('host')).to.eq('veronica.dev.local')
// We can set environment variables for highly dynamic values
// set environment variable
Cypress.env('api_server', 'http://localhost:8888/v2/')
expect(Cypress.env('api_server')).to.eq('http://localhost:8888/v2/')
// https://on.cypress.io/environment-variables
it('Get environment variables', () => {
// https://on.cypress.io/env
// set multiple environment variables
Cypress.env({
host: 'veronica.dev.local',
api_server: 'http://localhost:8888/v1/',
})
// get all environment variable
expect(Cypress.env()).to.have.property('host', 'veronica.dev.local')
expect(Cypress.env()).to.have.property('api_server', 'http://localhost:8888/v2/')
})
// get environment variable
expect(Cypress.env('host')).to.eq('veronica.dev.local')
// set environment variable
Cypress.env('api_server', 'http://localhost:8888/v2/')
expect(Cypress.env('api_server')).to.eq('http://localhost:8888/v2/')
// get all environment variable
expect(Cypress.env()).to.have.property('host', 'veronica.dev.local')
expect(Cypress.env()).to.have.property('api_server', 'http://localhost:8888/v2/')
})
})
context('Cypress.log', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
it('Control what is printed to the Command Log', () => {
// https://on.cypress.io/cypress-log
})
it('Control what is printed to the Command Log', () => {
// https://on.cypress.io/cypress-log
})
})
context('Cypress.platform', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
it('Get underlying OS name', () => {
// https://on.cypress.io/platform
expect(Cypress.platform).to.be.exist
})
it('Get underlying OS name', () => {
// https://on.cypress.io/platform
expect(Cypress.platform).to.be.exist
})
})
context('Cypress.version', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
it('Get current version of Cypress being run', () => {
// https://on.cypress.io/version
expect(Cypress.version).to.be.exist
})
it('Get current version of Cypress being run', () => {
// https://on.cypress.io/version
expect(Cypress.version).to.be.exist
})
})
context('Cypress.spec', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api')
})
it('Get current spec information', () => {
// https://on.cypress.io/spec
// wrap the object so we can inspect it easily by clicking in the command log
cy.wrap(Cypress.spec).should('include.keys', ['name', 'relative', 'absolute'])
})
it('Get current spec information', () => {
// https://on.cypress.io/spec
// wrap the object so we can inspect it easily by clicking in the command log
cy.wrap(Cypress.spec).should('include.keys', ['name', 'relative', 'absolute'])
})
})

View File

@@ -6,83 +6,83 @@
const requiredExample = require('../../fixtures/example')
context('Files', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/files')
})
beforeEach(() => {
// load example.json fixture file and store
// in the test context object
cy.fixture('example.json').as('example')
})
it('cy.fixture() - load a fixture', () => {
// https://on.cypress.io/fixture
// Instead of writing a response inline you can
// use a fixture file's content.
// when application makes an Ajax request matching "GET **/comments/*"
// Cypress will intercept it and reply with the object in `example.json` fixture
cy.intercept('GET', '**/comments/*', { fixture: 'example.json' }).as('getComment')
// we have code that gets a comment when
// the button is clicked in scripts.js
cy.get('.fixture-btn').click()
cy.wait('@getComment').its('response.body')
.should('have.property', 'name')
.and('include', 'Using fixtures to represent data')
})
it('cy.fixture() or require - load a fixture', function () {
// we are inside the "function () { ... }"
// callback and can use test context object "this"
// "this.example" was loaded in "beforeEach" function callback
expect(this.example, 'fixture in the test context')
.to.deep.equal(requiredExample)
// or use "cy.wrap" and "should('deep.equal', ...)" assertion
cy.wrap(this.example)
.should('deep.equal', requiredExample)
})
it('cy.readFile() - read file contents', () => {
// https://on.cypress.io/readfile
// You can read a file and yield its contents
// The filePath is relative to your project's root.
cy.readFile('cypress.json').then((json) => {
expect(json).to.be.an('object')
})
})
it('cy.writeFile() - write to a file', () => {
// https://on.cypress.io/writefile
// You can write to a file
// Use a response from a request to automatically
// generate a fixture file for use later
cy.request('https://jsonplaceholder.cypress.io/users')
.then((response) => {
cy.writeFile('cypress/fixtures/users.json', response.body)
})
cy.fixture('users').should((users) => {
expect(users[0].name).to.exist
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/files')
})
// JavaScript arrays and objects are stringified
// and formatted into text.
cy.writeFile('cypress/fixtures/profile.json', {
id: 8739,
name: 'Jane',
email: 'jane@example.com',
beforeEach(() => {
// load example.json fixture file and store
// in the test context object
cy.fixture('example.json').as('example')
})
cy.fixture('profile').should((profile) => {
expect(profile.name).to.eq('Jane')
it('cy.fixture() - load a fixture', () => {
// https://on.cypress.io/fixture
// Instead of writing a response inline you can
// use a fixture file's content.
// when application makes an Ajax request matching "GET **/comments/*"
// Cypress will intercept it and reply with the object in `example.json` fixture
cy.intercept('GET', '**/comments/*', {fixture: 'example.json'}).as('getComment')
// we have code that gets a comment when
// the button is clicked in scripts.js
cy.get('.fixture-btn').click()
cy.wait('@getComment').its('response.body')
.should('have.property', 'name')
.and('include', 'Using fixtures to represent data')
})
it('cy.fixture() or require - load a fixture', function () {
// we are inside the "function () { ... }"
// callback and can use test context object "this"
// "this.example" was loaded in "beforeEach" function callback
expect(this.example, 'fixture in the test context')
.to.deep.equal(requiredExample)
// or use "cy.wrap" and "should('deep.equal', ...)" assertion
cy.wrap(this.example)
.should('deep.equal', requiredExample)
})
it('cy.readFile() - read file contents', () => {
// https://on.cypress.io/readfile
// You can read a file and yield its contents
// The filePath is relative to your project's root.
cy.readFile('cypress.json').then((json) => {
expect(json).to.be.an('object')
})
})
it('cy.writeFile() - write to a file', () => {
// https://on.cypress.io/writefile
// You can write to a file
// Use a response from a request to automatically
// generate a fixture file for use later
cy.request('https://jsonplaceholder.cypress.io/users')
.then((response) => {
cy.writeFile('cypress/fixtures/users.json', response.body)
})
cy.fixture('users').should((users) => {
expect(users[0].name).to.exist
})
// JavaScript arrays and objects are stringified
// and formatted into text.
cy.writeFile('cypress/fixtures/profile.json', {
id: 8739,
name: 'Jane',
email: 'jane@example.com',
})
cy.fixture('profile').should((profile) => {
expect(profile.name).to.eq('Jane')
})
})
})
})

View File

@@ -1,52 +1,52 @@
/// <reference types="cypress" />
context('Local Storage', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/local-storage')
})
// Although local storage is automatically cleared
// in between tests to maintain a clean state
// sometimes we need to clear the local storage manually
it('cy.clearLocalStorage() - clear all data in local storage', () => {
// https://on.cypress.io/clearlocalstorage
cy.get('.ls-btn').click().should(() => {
expect(localStorage.getItem('prop1')).to.eq('red')
expect(localStorage.getItem('prop2')).to.eq('blue')
expect(localStorage.getItem('prop3')).to.eq('magenta')
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/local-storage')
})
// Although local storage is automatically cleared
// in between tests to maintain a clean state
// sometimes we need to clear the local storage manually
// clearLocalStorage() yields the localStorage object
cy.clearLocalStorage().should((ls) => {
expect(ls.getItem('prop1')).to.be.null
expect(ls.getItem('prop2')).to.be.null
expect(ls.getItem('prop3')).to.be.null
})
it('cy.clearLocalStorage() - clear all data in local storage', () => {
// https://on.cypress.io/clearlocalstorage
cy.get('.ls-btn').click().should(() => {
expect(localStorage.getItem('prop1')).to.eq('red')
expect(localStorage.getItem('prop2')).to.eq('blue')
expect(localStorage.getItem('prop3')).to.eq('magenta')
})
cy.get('.ls-btn').click().should(() => {
expect(localStorage.getItem('prop1')).to.eq('red')
expect(localStorage.getItem('prop2')).to.eq('blue')
expect(localStorage.getItem('prop3')).to.eq('magenta')
})
// clearLocalStorage() yields the localStorage object
cy.clearLocalStorage().should((ls) => {
expect(ls.getItem('prop1')).to.be.null
expect(ls.getItem('prop2')).to.be.null
expect(ls.getItem('prop3')).to.be.null
})
// Clear key matching string in Local Storage
cy.clearLocalStorage('prop1').should((ls) => {
expect(ls.getItem('prop1')).to.be.null
expect(ls.getItem('prop2')).to.eq('blue')
expect(ls.getItem('prop3')).to.eq('magenta')
})
cy.get('.ls-btn').click().should(() => {
expect(localStorage.getItem('prop1')).to.eq('red')
expect(localStorage.getItem('prop2')).to.eq('blue')
expect(localStorage.getItem('prop3')).to.eq('magenta')
})
cy.get('.ls-btn').click().should(() => {
expect(localStorage.getItem('prop1')).to.eq('red')
expect(localStorage.getItem('prop2')).to.eq('blue')
expect(localStorage.getItem('prop3')).to.eq('magenta')
})
// Clear key matching string in Local Storage
cy.clearLocalStorage('prop1').should((ls) => {
expect(ls.getItem('prop1')).to.be.null
expect(ls.getItem('prop2')).to.eq('blue')
expect(ls.getItem('prop3')).to.eq('magenta')
})
// Clear keys matching regex in Local Storage
cy.clearLocalStorage(/prop1|2/).should((ls) => {
expect(ls.getItem('prop1')).to.be.null
expect(ls.getItem('prop2')).to.be.null
expect(ls.getItem('prop3')).to.eq('magenta')
cy.get('.ls-btn').click().should(() => {
expect(localStorage.getItem('prop1')).to.eq('red')
expect(localStorage.getItem('prop2')).to.eq('blue')
expect(localStorage.getItem('prop3')).to.eq('magenta')
})
// Clear keys matching regex in Local Storage
cy.clearLocalStorage(/prop1|2/).should((ls) => {
expect(ls.getItem('prop1')).to.be.null
expect(ls.getItem('prop2')).to.be.null
expect(ls.getItem('prop3')).to.eq('magenta')
})
})
})
})

View File

@@ -1,32 +1,32 @@
/// <reference types="cypress" />
context('Location', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/location')
})
it('cy.hash() - get the current URL hash', () => {
// https://on.cypress.io/hash
cy.hash().should('be.empty')
})
it('cy.location() - get window.location', () => {
// https://on.cypress.io/location
cy.location().should((location) => {
expect(location.hash).to.be.empty
expect(location.href).to.eq('https://example.cypress.io/commands/location')
expect(location.host).to.eq('example.cypress.io')
expect(location.hostname).to.eq('example.cypress.io')
expect(location.origin).to.eq('https://example.cypress.io')
expect(location.pathname).to.eq('/commands/location')
expect(location.port).to.eq('')
expect(location.protocol).to.eq('https:')
expect(location.search).to.be.empty
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/location')
})
})
it('cy.url() - get the current URL', () => {
// https://on.cypress.io/url
cy.url().should('eq', 'https://example.cypress.io/commands/location')
})
it('cy.hash() - get the current URL hash', () => {
// https://on.cypress.io/hash
cy.hash().should('be.empty')
})
it('cy.location() - get window.location', () => {
// https://on.cypress.io/location
cy.location().should((location) => {
expect(location.hash).to.be.empty
expect(location.href).to.eq('https://example.cypress.io/commands/location')
expect(location.host).to.eq('example.cypress.io')
expect(location.hostname).to.eq('example.cypress.io')
expect(location.origin).to.eq('https://example.cypress.io')
expect(location.pathname).to.eq('/commands/location')
expect(location.port).to.eq('')
expect(location.protocol).to.eq('https:')
expect(location.search).to.be.empty
})
})
it('cy.url() - get the current URL', () => {
// https://on.cypress.io/url
cy.url().should('eq', 'https://example.cypress.io/commands/location')
})
})

View File

@@ -1,104 +1,106 @@
/// <reference types="cypress" />
context('Misc', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/misc')
})
it('.end() - end the command chain', () => {
// https://on.cypress.io/end
// cy.end is useful when you want to end a chain of commands
// and force Cypress to re-query from the root element
cy.get('.misc-table').within(() => {
// ends the current chain and yields null
cy.contains('Cheryl').click().end()
// queries the entire table again
cy.contains('Charles').click()
})
})
it('cy.exec() - execute a system command', () => {
// execute a system command.
// so you can take actions necessary for
// your test outside the scope of Cypress.
// https://on.cypress.io/exec
// we can use Cypress.platform string to
// select appropriate command
// https://on.cypress/io/platform
cy.log(`Platform ${Cypress.platform} architecture ${Cypress.arch}`)
// on CircleCI Windows build machines we have a failure to run bash shell
// https://github.com/cypress-io/cypress/issues/5169
// so skip some of the tests by passing flag "--env circle=true"
const isCircleOnWindows = Cypress.platform === 'win32' && Cypress.env('circle')
if (isCircleOnWindows) {
cy.log('Skipping test on CircleCI')
return
}
// cy.exec problem on Shippable CI
// https://github.com/cypress-io/cypress/issues/6718
const isShippable = Cypress.platform === 'linux' && Cypress.env('shippable')
if (isShippable) {
cy.log('Skipping test on ShippableCI')
return
}
cy.exec('echo Jane Lane')
.its('stdout').should('contain', 'Jane Lane')
if (Cypress.platform === 'win32') {
cy.exec('print cypress.json')
.its('stderr').should('be.empty')
} else {
cy.exec('cat cypress.json')
.its('stderr').should('be.empty')
cy.exec('pwd')
.its('code').should('eq', 0)
}
})
it('cy.focused() - get the DOM element that has focus', () => {
// https://on.cypress.io/focused
cy.get('.misc-form').find('#name').click()
cy.focused().should('have.id', 'name')
cy.get('.misc-form').find('#description').click()
cy.focused().should('have.id', 'description')
})
context('Cypress.Screenshot', function () {
it('cy.screenshot() - take a screenshot', () => {
// https://on.cypress.io/screenshot
cy.screenshot('my-image')
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/misc')
})
it('Cypress.Screenshot.defaults() - change default config of screenshots', function () {
Cypress.Screenshot.defaults({
blackout: ['.foo'],
capture: 'viewport',
clip: { x: 0, y: 0, width: 200, height: 200 },
scale: false,
disableTimersAndAnimations: true,
screenshotOnRunFailure: true,
onBeforeScreenshot () { },
onAfterScreenshot () { },
})
})
})
it('.end() - end the command chain', () => {
// https://on.cypress.io/end
it('cy.wrap() - wrap an object', () => {
// https://on.cypress.io/wrap
cy.wrap({ foo: 'bar' })
.should('have.property', 'foo')
.and('include', 'bar')
})
// cy.end is useful when you want to end a chain of commands
// and force Cypress to re-query from the root element
cy.get('.misc-table').within(() => {
// ends the current chain and yields null
cy.contains('Cheryl').click().end()
// queries the entire table again
cy.contains('Charles').click()
})
})
it('cy.exec() - execute a system command', () => {
// execute a system command.
// so you can take actions necessary for
// your test outside the scope of Cypress.
// https://on.cypress.io/exec
// we can use Cypress.platform string to
// select appropriate command
// https://on.cypress/io/platform
cy.log(`Platform ${Cypress.platform} architecture ${Cypress.arch}`)
// on CircleCI Windows build machines we have a failure to run bash shell
// https://github.com/cypress-io/cypress/issues/5169
// so skip some of the tests by passing flag "--env circle=true"
const isCircleOnWindows = Cypress.platform === 'win32' && Cypress.env('circle')
if (isCircleOnWindows) {
cy.log('Skipping test on CircleCI')
return
}
// cy.exec problem on Shippable CI
// https://github.com/cypress-io/cypress/issues/6718
const isShippable = Cypress.platform === 'linux' && Cypress.env('shippable')
if (isShippable) {
cy.log('Skipping test on ShippableCI')
return
}
cy.exec('echo Jane Lane')
.its('stdout').should('contain', 'Jane Lane')
if (Cypress.platform === 'win32') {
cy.exec('print cypress.json')
.its('stderr').should('be.empty')
} else {
cy.exec('cat cypress.json')
.its('stderr').should('be.empty')
cy.exec('pwd')
.its('code').should('eq', 0)
}
})
it('cy.focused() - get the DOM element that has focus', () => {
// https://on.cypress.io/focused
cy.get('.misc-form').find('#name').click()
cy.focused().should('have.id', 'name')
cy.get('.misc-form').find('#description').click()
cy.focused().should('have.id', 'description')
})
context('Cypress.Screenshot', function () {
it('cy.screenshot() - take a screenshot', () => {
// https://on.cypress.io/screenshot
cy.screenshot('my-image')
})
it('Cypress.Screenshot.defaults() - change default config of screenshots', function () {
Cypress.Screenshot.defaults({
blackout: ['.foo'],
capture: 'viewport',
clip: {x: 0, y: 0, width: 200, height: 200},
scale: false,
disableTimersAndAnimations: true,
screenshotOnRunFailure: true,
onBeforeScreenshot() {
},
onAfterScreenshot() {
},
})
})
})
it('cy.wrap() - wrap an object', () => {
// https://on.cypress.io/wrap
cy.wrap({foo: 'bar'})
.should('have.property', 'foo')
.and('include', 'bar')
})
})

View File

@@ -1,56 +1,56 @@
/// <reference types="cypress" />
context('Navigation', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io')
cy.get('.navbar-nav').contains('Commands').click()
cy.get('.dropdown-menu').contains('Navigation').click()
})
it('cy.go() - go back or forward in the browser\'s history', () => {
// https://on.cypress.io/go
cy.location('pathname').should('include', 'navigation')
cy.go('back')
cy.location('pathname').should('not.include', 'navigation')
cy.go('forward')
cy.location('pathname').should('include', 'navigation')
// clicking back
cy.go(-1)
cy.location('pathname').should('not.include', 'navigation')
// clicking forward
cy.go(1)
cy.location('pathname').should('include', 'navigation')
})
it('cy.reload() - reload the page', () => {
// https://on.cypress.io/reload
cy.reload()
// reload the page without using the cache
cy.reload(true)
})
it('cy.visit() - visit a remote url', () => {
// https://on.cypress.io/visit
// Visit any sub-domain of your current domain
// Pass options to the visit
cy.visit('https://example.cypress.io/commands/navigation', {
timeout: 50000, // increase total time for the visit to resolve
onBeforeLoad (contentWindow) {
// contentWindow is the remote page's window object
expect(typeof contentWindow === 'object').to.be.true
},
onLoad (contentWindow) {
// contentWindow is the remote page's window object
expect(typeof contentWindow === 'object').to.be.true
},
beforeEach(() => {
cy.visit('https://example.cypress.io')
cy.get('.navbar-nav').contains('Commands').click()
cy.get('.dropdown-menu').contains('Navigation').click()
})
it('cy.go() - go back or forward in the browser\'s history', () => {
// https://on.cypress.io/go
cy.location('pathname').should('include', 'navigation')
cy.go('back')
cy.location('pathname').should('not.include', 'navigation')
cy.go('forward')
cy.location('pathname').should('include', 'navigation')
// clicking back
cy.go(-1)
cy.location('pathname').should('not.include', 'navigation')
// clicking forward
cy.go(1)
cy.location('pathname').should('include', 'navigation')
})
it('cy.reload() - reload the page', () => {
// https://on.cypress.io/reload
cy.reload()
// reload the page without using the cache
cy.reload(true)
})
it('cy.visit() - visit a remote url', () => {
// https://on.cypress.io/visit
// Visit any sub-domain of your current domain
// Pass options to the visit
cy.visit('https://example.cypress.io/commands/navigation', {
timeout: 50000, // increase total time for the visit to resolve
onBeforeLoad(contentWindow) {
// contentWindow is the remote page's window object
expect(typeof contentWindow === 'object').to.be.true
},
onLoad(contentWindow) {
// contentWindow is the remote page's window object
expect(typeof contentWindow === 'object').to.be.true
},
})
})
})

View File

@@ -1,163 +1,163 @@
/// <reference types="cypress" />
context('Network Requests', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/network-requests')
})
// Manage HTTP requests in your app
it('cy.request() - make an XHR request', () => {
// https://on.cypress.io/request
cy.request('https://jsonplaceholder.cypress.io/comments')
.should((response) => {
expect(response.status).to.eq(200)
// the server sometimes gets an extra comment posted from another machine
// which gets returned as 1 extra object
expect(response.body).to.have.property('length').and.be.oneOf([500, 501])
expect(response).to.have.property('headers')
expect(response).to.have.property('duration')
})
})
it('cy.request() - verify response using BDD syntax', () => {
cy.request('https://jsonplaceholder.cypress.io/comments')
.then((response) => {
// https://on.cypress.io/assertions
expect(response).property('status').to.equal(200)
expect(response).property('body').to.have.property('length').and.be.oneOf([500, 501])
expect(response).to.include.keys('headers', 'duration')
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/network-requests')
})
})
it('cy.request() with query parameters', () => {
// will execute request
// https://jsonplaceholder.cypress.io/comments?postId=1&id=3
cy.request({
url: 'https://jsonplaceholder.cypress.io/comments',
qs: {
postId: 1,
id: 3,
},
})
.its('body')
.should('be.an', 'array')
.and('have.length', 1)
.its('0') // yields first element of the array
.should('contain', {
postId: 1,
id: 3,
})
})
// Manage HTTP requests in your app
it('cy.request() - pass result to the second request', () => {
// first, let's find out the userId of the first user we have
cy.request('https://jsonplaceholder.cypress.io/users?_limit=1')
.its('body') // yields the response object
.its('0') // yields the first element of the returned list
// the above two commands its('body').its('0')
// can be written as its('body.0')
// if you do not care about TypeScript checks
.then((user) => {
expect(user).property('id').to.be.a('number')
// make a new post on behalf of the user
cy.request('POST', 'https://jsonplaceholder.cypress.io/posts', {
userId: user.id,
title: 'Cypress Test Runner',
body: 'Fast, easy and reliable testing for anything that runs in a browser.',
it('cy.request() - make an XHR request', () => {
// https://on.cypress.io/request
cy.request('https://jsonplaceholder.cypress.io/comments')
.should((response) => {
expect(response.status).to.eq(200)
// the server sometimes gets an extra comment posted from another machine
// which gets returned as 1 extra object
expect(response.body).to.have.property('length').and.be.oneOf([500, 501])
expect(response).to.have.property('headers')
expect(response).to.have.property('duration')
})
})
it('cy.request() - verify response using BDD syntax', () => {
cy.request('https://jsonplaceholder.cypress.io/comments')
.then((response) => {
// https://on.cypress.io/assertions
expect(response).property('status').to.equal(200)
expect(response).property('body').to.have.property('length').and.be.oneOf([500, 501])
expect(response).to.include.keys('headers', 'duration')
})
})
it('cy.request() with query parameters', () => {
// will execute request
// https://jsonplaceholder.cypress.io/comments?postId=1&id=3
cy.request({
url: 'https://jsonplaceholder.cypress.io/comments',
qs: {
postId: 1,
id: 3,
},
})
})
// note that the value here is the returned value of the 2nd request
// which is the new post object
.then((response) => {
expect(response).property('status').to.equal(201) // new entity created
expect(response).property('body').to.contain({
title: 'Cypress Test Runner',
.its('body')
.should('be.an', 'array')
.and('have.length', 1)
.its('0') // yields first element of the array
.should('contain', {
postId: 1,
id: 3,
})
})
it('cy.request() - pass result to the second request', () => {
// first, let's find out the userId of the first user we have
cy.request('https://jsonplaceholder.cypress.io/users?_limit=1')
.its('body') // yields the response object
.its('0') // yields the first element of the returned list
// the above two commands its('body').its('0')
// can be written as its('body.0')
// if you do not care about TypeScript checks
.then((user) => {
expect(user).property('id').to.be.a('number')
// make a new post on behalf of the user
cy.request('POST', 'https://jsonplaceholder.cypress.io/posts', {
userId: user.id,
title: 'Cypress Test Runner',
body: 'Fast, easy and reliable testing for anything that runs in a browser.',
})
})
// note that the value here is the returned value of the 2nd request
// which is the new post object
.then((response) => {
expect(response).property('status').to.equal(201) // new entity created
expect(response).property('body').to.contain({
title: 'Cypress Test Runner',
})
// we don't know the exact post id - only that it will be > 100
// since JSONPlaceholder has built-in 100 posts
expect(response.body).property('id').to.be.a('number')
.and.to.be.gt(100)
// we don't know the user id here - since it was in above closure
// so in this test just confirm that the property is there
expect(response.body).property('userId').to.be.a('number')
})
})
it('cy.request() - save response in the shared test context', () => {
// https://on.cypress.io/variables-and-aliases
cy.request('https://jsonplaceholder.cypress.io/users?_limit=1')
.its('body').its('0') // yields the first element of the returned list
.as('user') // saves the object in the test context
.then(function () {
// NOTE 👀
// By the time this callback runs the "as('user')" command
// has saved the user object in the test context.
// To access the test context we need to use
// the "function () { ... }" callback form,
// otherwise "this" points at a wrong or undefined object!
cy.request('POST', 'https://jsonplaceholder.cypress.io/posts', {
userId: this.user.id,
title: 'Cypress Test Runner',
body: 'Fast, easy and reliable testing for anything that runs in a browser.',
})
.its('body').as('post') // save the new post from the response
})
.then(function () {
// When this callback runs, both "cy.request" API commands have finished
// and the test context has "user" and "post" objects set.
// Let's verify them.
expect(this.post, 'post has the right user id').property('userId').to.equal(this.user.id)
})
})
it('cy.intercept() - route responses to matching requests', () => {
// https://on.cypress.io/intercept
let message = 'whoa, this comment does not exist'
// Listen to GET to comments/1
cy.intercept('GET', '**/comments/*').as('getComment')
// we have code that gets a comment when
// the button is clicked in scripts.js
cy.get('.network-btn').click()
// https://on.cypress.io/wait
cy.wait('@getComment').its('response.statusCode').should('be.oneOf', [200, 304])
// Listen to POST to comments
cy.intercept('POST', '**/comments').as('postComment')
// we have code that posts a comment when
// the button is clicked in scripts.js
cy.get('.network-post').click()
cy.wait('@postComment').should(({request, response}) => {
expect(request.body).to.include('email')
expect(request.headers).to.have.property('content-type')
expect(response && response.body).to.have.property('name', 'Using POST in cy.intercept()')
})
// we don't know the exact post id - only that it will be > 100
// since JSONPlaceholder has built-in 100 posts
expect(response.body).property('id').to.be.a('number')
.and.to.be.gt(100)
// Stub a response to PUT comments/ ****
cy.intercept({
method: 'PUT',
url: '**/comments/*',
}, {
statusCode: 404,
body: {error: message},
headers: {'access-control-allow-origin': '*'},
delayMs: 500,
}).as('putComment')
// we don't know the user id here - since it was in above closure
// so in this test just confirm that the property is there
expect(response.body).property('userId').to.be.a('number')
})
})
// we have code that puts a comment when
// the button is clicked in scripts.js
cy.get('.network-put').click()
it('cy.request() - save response in the shared test context', () => {
// https://on.cypress.io/variables-and-aliases
cy.request('https://jsonplaceholder.cypress.io/users?_limit=1')
.its('body').its('0') // yields the first element of the returned list
.as('user') // saves the object in the test context
.then(function () {
// NOTE 👀
// By the time this callback runs the "as('user')" command
// has saved the user object in the test context.
// To access the test context we need to use
// the "function () { ... }" callback form,
// otherwise "this" points at a wrong or undefined object!
cy.request('POST', 'https://jsonplaceholder.cypress.io/posts', {
userId: this.user.id,
title: 'Cypress Test Runner',
body: 'Fast, easy and reliable testing for anything that runs in a browser.',
})
.its('body').as('post') // save the new post from the response
})
.then(function () {
// When this callback runs, both "cy.request" API commands have finished
// and the test context has "user" and "post" objects set.
// Let's verify them.
expect(this.post, 'post has the right user id').property('userId').to.equal(this.user.id)
})
})
cy.wait('@putComment')
it('cy.intercept() - route responses to matching requests', () => {
// https://on.cypress.io/intercept
let message = 'whoa, this comment does not exist'
// Listen to GET to comments/1
cy.intercept('GET', '**/comments/*').as('getComment')
// we have code that gets a comment when
// the button is clicked in scripts.js
cy.get('.network-btn').click()
// https://on.cypress.io/wait
cy.wait('@getComment').its('response.statusCode').should('be.oneOf', [200, 304])
// Listen to POST to comments
cy.intercept('POST', '**/comments').as('postComment')
// we have code that posts a comment when
// the button is clicked in scripts.js
cy.get('.network-post').click()
cy.wait('@postComment').should(({ request, response }) => {
expect(request.body).to.include('email')
expect(request.headers).to.have.property('content-type')
expect(response && response.body).to.have.property('name', 'Using POST in cy.intercept()')
// our 404 statusCode logic in scripts.js executed
cy.get('.network-put-comment').should('contain', message)
})
// Stub a response to PUT comments/ ****
cy.intercept({
method: 'PUT',
url: '**/comments/*',
}, {
statusCode: 404,
body: { error: message },
headers: { 'access-control-allow-origin': '*' },
delayMs: 500,
}).as('putComment')
// we have code that puts a comment when
// the button is clicked in scripts.js
cy.get('.network-put').click()
cy.wait('@putComment')
// our 404 statusCode logic in scripts.js executed
cy.get('.network-put-comment').should('contain', message)
})
})

View File

@@ -1,114 +1,114 @@
/// <reference types="cypress" />
context('Querying', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/querying')
})
// The most commonly used query is 'cy.get()', you can
// think of this like the '$' in jQuery
it('cy.get() - query DOM elements', () => {
// https://on.cypress.io/get
cy.get('#query-btn').should('contain', 'Button')
cy.get('.query-btn').should('contain', 'Button')
cy.get('#querying .well>button:first').should('contain', 'Button')
// ↲
// Use CSS selectors just like jQuery
cy.get('[data-test-id="test-example"]').should('have.class', 'example')
// 'cy.get()' yields jQuery object, you can get its attribute
// by invoking `.attr()` method
cy.get('[data-test-id="test-example"]')
.invoke('attr', 'data-test-id')
.should('equal', 'test-example')
// or you can get element's CSS property
cy.get('[data-test-id="test-example"]')
.invoke('css', 'position')
.should('equal', 'static')
// or use assertions directly during 'cy.get()'
// https://on.cypress.io/assertions
cy.get('[data-test-id="test-example"]')
.should('have.attr', 'data-test-id', 'test-example')
.and('have.css', 'position', 'static')
})
it('cy.contains() - query DOM elements with matching content', () => {
// https://on.cypress.io/contains
cy.get('.query-list')
.contains('bananas')
.should('have.class', 'third')
// we can pass a regexp to `.contains()`
cy.get('.query-list')
.contains(/^b\w+/)
.should('have.class', 'third')
cy.get('.query-list')
.contains('apples')
.should('have.class', 'first')
// passing a selector to contains will
// yield the selector containing the text
cy.get('#querying')
.contains('ul', 'oranges')
.should('have.class', 'query-list')
cy.get('.query-button')
.contains('Save Form')
.should('have.class', 'btn')
})
it('.within() - query DOM elements within a specific element', () => {
// https://on.cypress.io/within
cy.get('.query-form').within(() => {
cy.get('input:first').should('have.attr', 'placeholder', 'Email')
cy.get('input:last').should('have.attr', 'placeholder', 'Password')
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/querying')
})
})
it('cy.root() - query the root DOM element', () => {
// https://on.cypress.io/root
// The most commonly used query is 'cy.get()', you can
// think of this like the '$' in jQuery
// By default, root is the document
cy.root().should('match', 'html')
it('cy.get() - query DOM elements', () => {
// https://on.cypress.io/get
cy.get('.query-ul').within(() => {
// In this within, the root is now the ul DOM element
cy.root().should('have.class', 'query-ul')
cy.get('#query-btn').should('contain', 'Button')
cy.get('.query-btn').should('contain', 'Button')
cy.get('#querying .well>button:first').should('contain', 'Button')
// ↲
// Use CSS selectors just like jQuery
cy.get('[data-test-id="test-example"]').should('have.class', 'example')
// 'cy.get()' yields jQuery object, you can get its attribute
// by invoking `.attr()` method
cy.get('[data-test-id="test-example"]')
.invoke('attr', 'data-test-id')
.should('equal', 'test-example')
// or you can get element's CSS property
cy.get('[data-test-id="test-example"]')
.invoke('css', 'position')
.should('equal', 'static')
// or use assertions directly during 'cy.get()'
// https://on.cypress.io/assertions
cy.get('[data-test-id="test-example"]')
.should('have.attr', 'data-test-id', 'test-example')
.and('have.css', 'position', 'static')
})
})
it('best practices - selecting elements', () => {
// https://on.cypress.io/best-practices#Selecting-Elements
cy.get('[data-cy=best-practices-selecting-elements]').within(() => {
// Worst - too generic, no context
cy.get('button').click()
it('cy.contains() - query DOM elements with matching content', () => {
// https://on.cypress.io/contains
cy.get('.query-list')
.contains('bananas')
.should('have.class', 'third')
// Bad. Coupled to styling. Highly subject to change.
cy.get('.btn.btn-large').click()
// we can pass a regexp to `.contains()`
cy.get('.query-list')
.contains(/^b\w+/)
.should('have.class', 'third')
// Average. Coupled to the `name` attribute which has HTML semantics.
cy.get('[name=submission]').click()
cy.get('.query-list')
.contains('apples')
.should('have.class', 'first')
// Better. But still coupled to styling or JS event listeners.
cy.get('#main').click()
// passing a selector to contains will
// yield the selector containing the text
cy.get('#querying')
.contains('ul', 'oranges')
.should('have.class', 'query-list')
// Slightly better. Uses an ID but also ensures the element
// has an ARIA role attribute
cy.get('#main[role=button]').click()
// Much better. But still coupled to text content that may change.
cy.contains('Submit').click()
// Best. Insulated from all changes.
cy.get('[data-cy=submit]').click()
cy.get('.query-button')
.contains('Save Form')
.should('have.class', 'btn')
})
it('.within() - query DOM elements within a specific element', () => {
// https://on.cypress.io/within
cy.get('.query-form').within(() => {
cy.get('input:first').should('have.attr', 'placeholder', 'Email')
cy.get('input:last').should('have.attr', 'placeholder', 'Password')
})
})
it('cy.root() - query the root DOM element', () => {
// https://on.cypress.io/root
// By default, root is the document
cy.root().should('match', 'html')
cy.get('.query-ul').within(() => {
// In this within, the root is now the ul DOM element
cy.root().should('have.class', 'query-ul')
})
})
it('best practices - selecting elements', () => {
// https://on.cypress.io/best-practices#Selecting-Elements
cy.get('[data-cy=best-practices-selecting-elements]').within(() => {
// Worst - too generic, no context
cy.get('button').click()
// Bad. Coupled to styling. Highly subject to change.
cy.get('.btn.btn-large').click()
// Average. Coupled to the `name` attribute which has HTML semantics.
cy.get('[name=submission]').click()
// Better. But still coupled to styling or JS event listeners.
cy.get('#main').click()
// Slightly better. Uses an ID but also ensures the element
// has an ARIA role attribute
cy.get('#main[role=button]').click()
// Much better. But still coupled to text content that may change.
cy.contains('Submit').click()
// Best. Insulated from all changes.
cy.get('[data-cy=submit]').click()
})
})
})
})

View File

@@ -3,203 +3,204 @@
// https://github.com/cypress-io/cypress/issues/6720
context('Spies, Stubs, and Clock', () => {
it('cy.spy() - wrap a method in a spy', () => {
// https://on.cypress.io/spy
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks')
it('cy.spy() - wrap a method in a spy', () => {
// https://on.cypress.io/spy
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks')
const obj = {
foo () {},
}
const obj = {
foo() {
},
}
const spy = cy.spy(obj, 'foo').as('anyArgs')
const spy = cy.spy(obj, 'foo').as('anyArgs')
obj.foo()
obj.foo()
expect(spy).to.be.called
})
expect(spy).to.be.called
})
it('cy.spy() retries until assertions pass', () => {
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks')
it('cy.spy() retries until assertions pass', () => {
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks')
const obj = {
/**
* Prints the argument passed
* @param x {any}
*/
foo (x) {
console.log('obj.foo called with', x)
},
}
const obj = {
/**
* Prints the argument passed
* @param x {any}
*/
foo(x) {
console.log('obj.foo called with', x)
},
}
cy.spy(obj, 'foo').as('foo')
cy.spy(obj, 'foo').as('foo')
setTimeout(() => {
obj.foo('first')
}, 500)
setTimeout(() => {
obj.foo('first')
}, 500)
setTimeout(() => {
obj.foo('second')
}, 2500)
setTimeout(() => {
obj.foo('second')
}, 2500)
cy.get('@foo').should('have.been.calledTwice')
})
cy.get('@foo').should('have.been.calledTwice')
})
it('cy.stub() - create a stub and/or replace a function with stub', () => {
// https://on.cypress.io/stub
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks')
it('cy.stub() - create a stub and/or replace a function with stub', () => {
// https://on.cypress.io/stub
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks')
const obj = {
/**
* prints both arguments to the console
* @param a {string}
* @param b {string}
*/
foo (a, b) {
console.log('a', a, 'b', b)
},
}
const obj = {
/**
* prints both arguments to the console
* @param a {string}
* @param b {string}
*/
foo(a, b) {
console.log('a', a, 'b', b)
},
}
const stub = cy.stub(obj, 'foo').as('foo')
const stub = cy.stub(obj, 'foo').as('foo')
obj.foo('foo', 'bar')
obj.foo('foo', 'bar')
expect(stub).to.be.called
})
expect(stub).to.be.called
})
it('cy.clock() - control time in the browser', () => {
// https://on.cypress.io/clock
it('cy.clock() - control time in the browser', () => {
// https://on.cypress.io/clock
// create the date in UTC so its always the same
// no matter what local timezone the browser is running in
const now = new Date(Date.UTC(2017, 2, 14)).getTime()
// create the date in UTC so its always the same
// no matter what local timezone the browser is running in
const now = new Date(Date.UTC(2017, 2, 14)).getTime()
cy.clock(now)
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks')
cy.get('#clock-div').click()
.should('have.text', '1489449600')
})
cy.clock(now)
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks')
cy.get('#clock-div').click()
.should('have.text', '1489449600')
})
it('cy.tick() - move time in the browser', () => {
// https://on.cypress.io/tick
it('cy.tick() - move time in the browser', () => {
// https://on.cypress.io/tick
// create the date in UTC so its always the same
// no matter what local timezone the browser is running in
const now = new Date(Date.UTC(2017, 2, 14)).getTime()
// create the date in UTC so its always the same
// no matter what local timezone the browser is running in
const now = new Date(Date.UTC(2017, 2, 14)).getTime()
cy.clock(now)
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks')
cy.get('#tick-div').click()
.should('have.text', '1489449600')
cy.clock(now)
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks')
cy.get('#tick-div').click()
.should('have.text', '1489449600')
cy.tick(10000) // 10 seconds passed
cy.get('#tick-div').click()
.should('have.text', '1489449610')
})
cy.tick(10000) // 10 seconds passed
cy.get('#tick-div').click()
.should('have.text', '1489449610')
})
it('cy.stub() matches depending on arguments', () => {
// see all possible matchers at
// https://sinonjs.org/releases/latest/matchers/
const greeter = {
/**
* Greets a person
* @param {string} name
*/
greet (name) {
return `Hello, ${name}!`
},
}
it('cy.stub() matches depending on arguments', () => {
// see all possible matchers at
// https://sinonjs.org/releases/latest/matchers/
const greeter = {
/**
* Greets a person
* @param {string} name
*/
greet(name) {
return `Hello, ${name}!`
},
}
cy.stub(greeter, 'greet')
.callThrough() // if you want non-matched calls to call the real method
.withArgs(Cypress.sinon.match.string).returns('Hi')
.withArgs(Cypress.sinon.match.number).throws(new Error('Invalid name'))
cy.stub(greeter, 'greet')
.callThrough() // if you want non-matched calls to call the real method
.withArgs(Cypress.sinon.match.string).returns('Hi')
.withArgs(Cypress.sinon.match.number).throws(new Error('Invalid name'))
expect(greeter.greet('World')).to.equal('Hi')
// @ts-ignore
expect(() => greeter.greet(42)).to.throw('Invalid name')
expect(greeter.greet).to.have.been.calledTwice
expect(greeter.greet('World')).to.equal('Hi')
// @ts-ignore
expect(() => greeter.greet(42)).to.throw('Invalid name')
expect(greeter.greet).to.have.been.calledTwice
// non-matched calls goes the actual method
// @ts-ignore
expect(greeter.greet()).to.equal('Hello, undefined!')
})
// non-matched calls goes the actual method
// @ts-ignore
expect(greeter.greet()).to.equal('Hello, undefined!')
})
it('matches call arguments using Sinon matchers', () => {
// see all possible matchers at
// https://sinonjs.org/releases/latest/matchers/
const calculator = {
/**
* returns the sum of two arguments
* @param a {number}
* @param b {number}
*/
add (a, b) {
return a + b
},
}
it('matches call arguments using Sinon matchers', () => {
// see all possible matchers at
// https://sinonjs.org/releases/latest/matchers/
const calculator = {
/**
* returns the sum of two arguments
* @param a {number}
* @param b {number}
*/
add(a, b) {
return a + b
},
}
const spy = cy.spy(calculator, 'add').as('add')
const spy = cy.spy(calculator, 'add').as('add')
expect(calculator.add(2, 3)).to.equal(5)
expect(calculator.add(2, 3)).to.equal(5)
// if we want to assert the exact values used during the call
expect(spy).to.be.calledWith(2, 3)
// if we want to assert the exact values used during the call
expect(spy).to.be.calledWith(2, 3)
// let's confirm "add" method was called with two numbers
expect(spy).to.be.calledWith(Cypress.sinon.match.number, Cypress.sinon.match.number)
// let's confirm "add" method was called with two numbers
expect(spy).to.be.calledWith(Cypress.sinon.match.number, Cypress.sinon.match.number)
// alternatively, provide the value to match
expect(spy).to.be.calledWith(Cypress.sinon.match(2), Cypress.sinon.match(3))
// alternatively, provide the value to match
expect(spy).to.be.calledWith(Cypress.sinon.match(2), Cypress.sinon.match(3))
// match any value
expect(spy).to.be.calledWith(Cypress.sinon.match.any, 3)
// match any value
expect(spy).to.be.calledWith(Cypress.sinon.match.any, 3)
// match any value from a list
expect(spy).to.be.calledWith(Cypress.sinon.match.in([1, 2, 3]), 3)
// match any value from a list
expect(spy).to.be.calledWith(Cypress.sinon.match.in([1, 2, 3]), 3)
/**
* Returns true if the given number is event
* @param {number} x
*/
const isEven = (x) => x % 2 === 0
/**
* Returns true if the given number is event
* @param {number} x
*/
const isEven = (x) => x % 2 === 0
// expect the value to pass a custom predicate function
// the second argument to "sinon.match(predicate, message)" is
// shown if the predicate does not pass and assertion fails
expect(spy).to.be.calledWith(Cypress.sinon.match(isEven, 'isEven'), 3)
// expect the value to pass a custom predicate function
// the second argument to "sinon.match(predicate, message)" is
// shown if the predicate does not pass and assertion fails
expect(spy).to.be.calledWith(Cypress.sinon.match(isEven, 'isEven'), 3)
/**
* Returns a function that checks if a given number is larger than the limit
* @param {number} limit
* @returns {(x: number) => boolean}
*/
const isGreaterThan = (limit) => (x) => x > limit
/**
* Returns a function that checks if a given number is larger than the limit
* @param {number} limit
* @returns {(x: number) => boolean}
*/
const isGreaterThan = (limit) => (x) => x > limit
/**
* Returns a function that checks if a given number is less than the limit
* @param {number} limit
* @returns {(x: number) => boolean}
*/
const isLessThan = (limit) => (x) => x < limit
/**
* Returns a function that checks if a given number is less than the limit
* @param {number} limit
* @returns {(x: number) => boolean}
*/
const isLessThan = (limit) => (x) => x < limit
// you can combine several matchers using "and", "or"
expect(spy).to.be.calledWith(
Cypress.sinon.match.number,
Cypress.sinon.match(isGreaterThan(2), '> 2').and(Cypress.sinon.match(isLessThan(4), '< 4')),
)
// you can combine several matchers using "and", "or"
expect(spy).to.be.calledWith(
Cypress.sinon.match.number,
Cypress.sinon.match(isGreaterThan(2), '> 2').and(Cypress.sinon.match(isLessThan(4), '< 4')),
)
expect(spy).to.be.calledWith(
Cypress.sinon.match.number,
Cypress.sinon.match(isGreaterThan(200), '> 200').or(Cypress.sinon.match(3)),
)
expect(spy).to.be.calledWith(
Cypress.sinon.match.number,
Cypress.sinon.match(isGreaterThan(200), '> 200').or(Cypress.sinon.match(3)),
)
// matchers can be used from BDD assertions
cy.get('@add').should('have.been.calledWith',
Cypress.sinon.match.number, Cypress.sinon.match(3))
// matchers can be used from BDD assertions
cy.get('@add').should('have.been.calledWith',
Cypress.sinon.match.number, Cypress.sinon.match(3))
// you can alias matchers for shorter test code
const { match: M } = Cypress.sinon
// you can alias matchers for shorter test code
const {match: M} = Cypress.sinon
cy.get('@add').should('have.been.calledWith', M.number, M(3))
})
cy.get('@add').should('have.been.calledWith', M.number, M(3))
})
})

View File

@@ -1,121 +1,121 @@
/// <reference types="cypress" />
context('Traversal', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/traversal')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/traversal')
})
it('.children() - get child DOM elements', () => {
// https://on.cypress.io/children
cy.get('.traversal-breadcrumb')
.children('.active')
.should('contain', 'Data')
})
it('.children() - get child DOM elements', () => {
// https://on.cypress.io/children
cy.get('.traversal-breadcrumb')
.children('.active')
.should('contain', 'Data')
})
it('.closest() - get closest ancestor DOM element', () => {
// https://on.cypress.io/closest
cy.get('.traversal-badge')
.closest('ul')
.should('have.class', 'list-group')
})
it('.closest() - get closest ancestor DOM element', () => {
// https://on.cypress.io/closest
cy.get('.traversal-badge')
.closest('ul')
.should('have.class', 'list-group')
})
it('.eq() - get a DOM element at a specific index', () => {
// https://on.cypress.io/eq
cy.get('.traversal-list>li')
.eq(1).should('contain', 'siamese')
})
it('.eq() - get a DOM element at a specific index', () => {
// https://on.cypress.io/eq
cy.get('.traversal-list>li')
.eq(1).should('contain', 'siamese')
})
it('.filter() - get DOM elements that match the selector', () => {
// https://on.cypress.io/filter
cy.get('.traversal-nav>li')
.filter('.active').should('contain', 'About')
})
it('.filter() - get DOM elements that match the selector', () => {
// https://on.cypress.io/filter
cy.get('.traversal-nav>li')
.filter('.active').should('contain', 'About')
})
it('.find() - get descendant DOM elements of the selector', () => {
// https://on.cypress.io/find
cy.get('.traversal-pagination')
.find('li').find('a')
.should('have.length', 7)
})
it('.find() - get descendant DOM elements of the selector', () => {
// https://on.cypress.io/find
cy.get('.traversal-pagination')
.find('li').find('a')
.should('have.length', 7)
})
it('.first() - get first DOM element', () => {
// https://on.cypress.io/first
cy.get('.traversal-table td')
.first().should('contain', '1')
})
it('.first() - get first DOM element', () => {
// https://on.cypress.io/first
cy.get('.traversal-table td')
.first().should('contain', '1')
})
it('.last() - get last DOM element', () => {
// https://on.cypress.io/last
cy.get('.traversal-buttons .btn')
.last().should('contain', 'Submit')
})
it('.last() - get last DOM element', () => {
// https://on.cypress.io/last
cy.get('.traversal-buttons .btn')
.last().should('contain', 'Submit')
})
it('.next() - get next sibling DOM element', () => {
// https://on.cypress.io/next
cy.get('.traversal-ul')
.contains('apples').next().should('contain', 'oranges')
})
it('.next() - get next sibling DOM element', () => {
// https://on.cypress.io/next
cy.get('.traversal-ul')
.contains('apples').next().should('contain', 'oranges')
})
it('.nextAll() - get all next sibling DOM elements', () => {
// https://on.cypress.io/nextall
cy.get('.traversal-next-all')
.contains('oranges')
.nextAll().should('have.length', 3)
})
it('.nextAll() - get all next sibling DOM elements', () => {
// https://on.cypress.io/nextall
cy.get('.traversal-next-all')
.contains('oranges')
.nextAll().should('have.length', 3)
})
it('.nextUntil() - get next sibling DOM elements until next el', () => {
// https://on.cypress.io/nextuntil
cy.get('#veggies')
.nextUntil('#nuts').should('have.length', 3)
})
it('.nextUntil() - get next sibling DOM elements until next el', () => {
// https://on.cypress.io/nextuntil
cy.get('#veggies')
.nextUntil('#nuts').should('have.length', 3)
})
it('.not() - remove DOM elements from set of DOM elements', () => {
// https://on.cypress.io/not
cy.get('.traversal-disabled .btn')
.not('[disabled]').should('not.contain', 'Disabled')
})
it('.not() - remove DOM elements from set of DOM elements', () => {
// https://on.cypress.io/not
cy.get('.traversal-disabled .btn')
.not('[disabled]').should('not.contain', 'Disabled')
})
it('.parent() - get parent DOM element from DOM elements', () => {
// https://on.cypress.io/parent
cy.get('.traversal-mark')
.parent().should('contain', 'Morbi leo risus')
})
it('.parent() - get parent DOM element from DOM elements', () => {
// https://on.cypress.io/parent
cy.get('.traversal-mark')
.parent().should('contain', 'Morbi leo risus')
})
it('.parents() - get parent DOM elements from DOM elements', () => {
// https://on.cypress.io/parents
cy.get('.traversal-cite')
.parents().should('match', 'blockquote')
})
it('.parents() - get parent DOM elements from DOM elements', () => {
// https://on.cypress.io/parents
cy.get('.traversal-cite')
.parents().should('match', 'blockquote')
})
it('.parentsUntil() - get parent DOM elements from DOM elements until el', () => {
// https://on.cypress.io/parentsuntil
cy.get('.clothes-nav')
.find('.active')
.parentsUntil('.clothes-nav')
.should('have.length', 2)
})
it('.parentsUntil() - get parent DOM elements from DOM elements until el', () => {
// https://on.cypress.io/parentsuntil
cy.get('.clothes-nav')
.find('.active')
.parentsUntil('.clothes-nav')
.should('have.length', 2)
})
it('.prev() - get previous sibling DOM element', () => {
// https://on.cypress.io/prev
cy.get('.birds').find('.active')
.prev().should('contain', 'Lorikeets')
})
it('.prev() - get previous sibling DOM element', () => {
// https://on.cypress.io/prev
cy.get('.birds').find('.active')
.prev().should('contain', 'Lorikeets')
})
it('.prevAll() - get all previous sibling DOM elements', () => {
// https://on.cypress.io/prevall
cy.get('.fruits-list').find('.third')
.prevAll().should('have.length', 2)
})
it('.prevAll() - get all previous sibling DOM elements', () => {
// https://on.cypress.io/prevall
cy.get('.fruits-list').find('.third')
.prevAll().should('have.length', 2)
})
it('.prevUntil() - get all previous sibling DOM elements until el', () => {
// https://on.cypress.io/prevuntil
cy.get('.foods-list').find('#nuts')
.prevUntil('#veggies').should('have.length', 3)
})
it('.prevUntil() - get all previous sibling DOM elements until el', () => {
// https://on.cypress.io/prevuntil
cy.get('.foods-list').find('#nuts')
.prevUntil('#veggies').should('have.length', 3)
})
it('.siblings() - get all sibling DOM elements', () => {
// https://on.cypress.io/siblings
cy.get('.traversal-pills .active')
.siblings().should('have.length', 2)
})
it('.siblings() - get all sibling DOM elements', () => {
// https://on.cypress.io/siblings
cy.get('.traversal-pills .active')
.siblings().should('have.length', 2)
})
})

View File

@@ -1,110 +1,110 @@
/// <reference types="cypress" />
context('Utilities', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/utilities')
})
it('Cypress._ - call a lodash method', () => {
// https://on.cypress.io/_
cy.request('https://jsonplaceholder.cypress.io/users')
.then((response) => {
let ids = Cypress._.chain(response.body).map('id').take(3).value()
expect(ids).to.deep.eq([1, 2, 3])
})
})
it('Cypress.$ - call a jQuery method', () => {
// https://on.cypress.io/$
let $li = Cypress.$('.utility-jquery li:first')
cy.wrap($li)
.should('not.have.class', 'active')
.click()
.should('have.class', 'active')
})
it('Cypress.Blob - blob utilities and base64 string conversion', () => {
// https://on.cypress.io/blob
cy.get('.utility-blob').then(($div) => {
// https://github.com/nolanlawson/blob-util#imgSrcToDataURL
// get the dataUrl string for the javascript-logo
return Cypress.Blob.imgSrcToDataURL('https://example.cypress.io/assets/img/javascript-logo.png', undefined, 'anonymous')
.then((dataUrl) => {
// create an <img> element and set its src to the dataUrl
let img = Cypress.$('<img />', { src: dataUrl })
// need to explicitly return cy here since we are initially returning
// the Cypress.Blob.imgSrcToDataURL promise to our test
// append the image
$div.append(img)
cy.get('.utility-blob img').click()
.should('have.attr', 'src', dataUrl)
})
})
})
it('Cypress.minimatch - test out glob patterns against strings', () => {
// https://on.cypress.io/minimatch
let matching = Cypress.minimatch('/users/1/comments', '/users/*/comments', {
matchBase: true,
beforeEach(() => {
cy.visit('https://example.cypress.io/utilities')
})
expect(matching, 'matching wildcard').to.be.true
it('Cypress._ - call a lodash method', () => {
// https://on.cypress.io/_
cy.request('https://jsonplaceholder.cypress.io/users')
.then((response) => {
let ids = Cypress._.chain(response.body).map('id').take(3).value()
matching = Cypress.minimatch('/users/1/comments/2', '/users/*/comments', {
matchBase: true,
expect(ids).to.deep.eq([1, 2, 3])
})
})
expect(matching, 'comments').to.be.false
it('Cypress.$ - call a jQuery method', () => {
// https://on.cypress.io/$
let $li = Cypress.$('.utility-jquery li:first')
// ** matches against all downstream path segments
matching = Cypress.minimatch('/foo/bar/baz/123/quux?a=b&c=2', '/foo/**', {
matchBase: true,
cy.wrap($li)
.should('not.have.class', 'active')
.click()
.should('have.class', 'active')
})
expect(matching, 'comments').to.be.true
it('Cypress.Blob - blob utilities and base64 string conversion', () => {
// https://on.cypress.io/blob
cy.get('.utility-blob').then(($div) => {
// https://github.com/nolanlawson/blob-util#imgSrcToDataURL
// get the dataUrl string for the javascript-logo
return Cypress.Blob.imgSrcToDataURL('https://example.cypress.io/assets/img/javascript-logo.png', undefined, 'anonymous')
.then((dataUrl) => {
// create an <img> element and set its src to the dataUrl
let img = Cypress.$('<img />', {src: dataUrl})
// whereas * matches only the next path segment
// need to explicitly return cy here since we are initially returning
// the Cypress.Blob.imgSrcToDataURL promise to our test
// append the image
$div.append(img)
matching = Cypress.minimatch('/foo/bar/baz/123/quux?a=b&c=2', '/foo/*', {
matchBase: false,
cy.get('.utility-blob img').click()
.should('have.attr', 'src', dataUrl)
})
})
})
expect(matching, 'comments').to.be.false
})
it('Cypress.minimatch - test out glob patterns against strings', () => {
// https://on.cypress.io/minimatch
let matching = Cypress.minimatch('/users/1/comments', '/users/*/comments', {
matchBase: true,
})
it('Cypress.Promise - instantiate a bluebird promise', () => {
// https://on.cypress.io/promise
let waited = false
expect(matching, 'matching wildcard').to.be.true
/**
* @return Bluebird<string>
*/
function waitOneSecond () {
// return a promise that resolves after 1 second
// @ts-ignore TS2351 (new Cypress.Promise)
return new Cypress.Promise((resolve, reject) => {
setTimeout(() => {
// set waited to true
waited = true
matching = Cypress.minimatch('/users/1/comments/2', '/users/*/comments', {
matchBase: true,
})
// resolve with 'foo' string
resolve('foo')
}, 1000)
})
}
expect(matching, 'comments').to.be.false
cy.then(() => {
// return a promise to cy.then() that
// is awaited until it resolves
// @ts-ignore TS7006
return waitOneSecond().then((str) => {
expect(str).to.eq('foo')
expect(waited).to.be.true
})
// ** matches against all downstream path segments
matching = Cypress.minimatch('/foo/bar/baz/123/quux?a=b&c=2', '/foo/**', {
matchBase: true,
})
expect(matching, 'comments').to.be.true
// whereas * matches only the next path segment
matching = Cypress.minimatch('/foo/bar/baz/123/quux?a=b&c=2', '/foo/*', {
matchBase: false,
})
expect(matching, 'comments').to.be.false
})
it('Cypress.Promise - instantiate a bluebird promise', () => {
// https://on.cypress.io/promise
let waited = false
/**
* @return Bluebird<string>
*/
function waitOneSecond() {
// return a promise that resolves after 1 second
// @ts-ignore TS2351 (new Cypress.Promise)
return new Cypress.Promise((resolve, reject) => {
setTimeout(() => {
// set waited to true
waited = true
// resolve with 'foo' string
resolve('foo')
}, 1000)
})
}
cy.then(() => {
// return a promise to cy.then() that
// is awaited until it resolves
// @ts-ignore TS7006
return waitOneSecond().then((str) => {
expect(str).to.eq('foo')
expect(waited).to.be.true
})
})
})
})
})

View File

@@ -1,59 +1,59 @@
/// <reference types="cypress" />
context('Viewport', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/viewport')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/viewport')
})
it('cy.viewport() - set the viewport size and dimension', () => {
// https://on.cypress.io/viewport
it('cy.viewport() - set the viewport size and dimension', () => {
// https://on.cypress.io/viewport
cy.get('#navbar').should('be.visible')
cy.viewport(320, 480)
cy.get('#navbar').should('be.visible')
cy.viewport(320, 480)
// the navbar should have collapse since our screen is smaller
cy.get('#navbar').should('not.be.visible')
cy.get('.navbar-toggle').should('be.visible').click()
cy.get('.nav').find('a').should('be.visible')
// the navbar should have collapse since our screen is smaller
cy.get('#navbar').should('not.be.visible')
cy.get('.navbar-toggle').should('be.visible').click()
cy.get('.nav').find('a').should('be.visible')
// lets see what our app looks like on a super large screen
cy.viewport(2999, 2999)
// lets see what our app looks like on a super large screen
cy.viewport(2999, 2999)
// cy.viewport() accepts a set of preset sizes
// to easily set the screen to a device's width and height
// cy.viewport() accepts a set of preset sizes
// to easily set the screen to a device's width and height
// We added a cy.wait() between each viewport change so you can see
// the change otherwise it is a little too fast to see :)
// We added a cy.wait() between each viewport change so you can see
// the change otherwise it is a little too fast to see :)
cy.viewport('macbook-15')
cy.wait(200)
cy.viewport('macbook-13')
cy.wait(200)
cy.viewport('macbook-11')
cy.wait(200)
cy.viewport('ipad-2')
cy.wait(200)
cy.viewport('ipad-mini')
cy.wait(200)
cy.viewport('iphone-6+')
cy.wait(200)
cy.viewport('iphone-6')
cy.wait(200)
cy.viewport('iphone-5')
cy.wait(200)
cy.viewport('iphone-4')
cy.wait(200)
cy.viewport('iphone-3')
cy.wait(200)
cy.viewport('macbook-15')
cy.wait(200)
cy.viewport('macbook-13')
cy.wait(200)
cy.viewport('macbook-11')
cy.wait(200)
cy.viewport('ipad-2')
cy.wait(200)
cy.viewport('ipad-mini')
cy.wait(200)
cy.viewport('iphone-6+')
cy.wait(200)
cy.viewport('iphone-6')
cy.wait(200)
cy.viewport('iphone-5')
cy.wait(200)
cy.viewport('iphone-4')
cy.wait(200)
cy.viewport('iphone-3')
cy.wait(200)
// cy.viewport() accepts an orientation for all presets
// the default orientation is 'portrait'
cy.viewport('ipad-2', 'portrait')
cy.wait(200)
cy.viewport('iphone-4', 'landscape')
cy.wait(200)
// cy.viewport() accepts an orientation for all presets
// the default orientation is 'portrait'
cy.viewport('ipad-2', 'portrait')
cy.wait(200)
cy.viewport('iphone-4', 'landscape')
cy.wait(200)
// The viewport will be reset back to the default dimensions
// in between tests (the default can be set in cypress.json)
})
// The viewport will be reset back to the default dimensions
// in between tests (the default can be set in cypress.json)
})
})

View File

@@ -1,31 +1,31 @@
/// <reference types="cypress" />
context('Waiting', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/waiting')
})
// BE CAREFUL of adding unnecessary wait times.
// https://on.cypress.io/best-practices#Unnecessary-Waiting
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/waiting')
})
// BE CAREFUL of adding unnecessary wait times.
// https://on.cypress.io/best-practices#Unnecessary-Waiting
// https://on.cypress.io/wait
it('cy.wait() - wait for a specific amount of time', () => {
cy.get('.wait-input1').type('Wait 1000ms after typing')
cy.wait(1000)
cy.get('.wait-input2').type('Wait 1000ms after typing')
cy.wait(1000)
cy.get('.wait-input3').type('Wait 1000ms after typing')
cy.wait(1000)
})
// https://on.cypress.io/wait
it('cy.wait() - wait for a specific amount of time', () => {
cy.get('.wait-input1').type('Wait 1000ms after typing')
cy.wait(1000)
cy.get('.wait-input2').type('Wait 1000ms after typing')
cy.wait(1000)
cy.get('.wait-input3').type('Wait 1000ms after typing')
cy.wait(1000)
})
it('cy.wait() - wait for a specific route', () => {
// Listen to GET to comments/1
cy.intercept('GET', '**/comments/*').as('getComment')
it('cy.wait() - wait for a specific route', () => {
// Listen to GET to comments/1
cy.intercept('GET', '**/comments/*').as('getComment')
// we have code that gets a comment when
// the button is clicked in scripts.js
cy.get('.network-btn').click()
// we have code that gets a comment when
// the button is clicked in scripts.js
cy.get('.network-btn').click()
// wait for GET comments/1
cy.wait('@getComment').its('response.statusCode').should('be.oneOf', [200, 304])
})
// wait for GET comments/1
cy.wait('@getComment').its('response.statusCode').should('be.oneOf', [200, 304])
})
})

View File

@@ -1,22 +1,22 @@
/// <reference types="cypress" />
context('Window', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/window')
})
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/window')
})
it('cy.window() - get the global window object', () => {
// https://on.cypress.io/window
cy.window().should('have.property', 'top')
})
it('cy.window() - get the global window object', () => {
// https://on.cypress.io/window
cy.window().should('have.property', 'top')
})
it('cy.document() - get the document object', () => {
// https://on.cypress.io/document
cy.document().should('have.property', 'charset').and('eq', 'UTF-8')
})
it('cy.document() - get the document object', () => {
// https://on.cypress.io/document
cy.document().should('have.property', 'charset').and('eq', 'UTF-8')
})
it('cy.title() - get the title', () => {
// https://on.cypress.io/title
cy.title().should('include', 'Kitchen Sink')
})
it('cy.title() - get the title', () => {
// https://on.cypress.io/title
cy.title().should('include', 'Kitchen Sink')
})
})

View File

@@ -17,6 +17,6 @@
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

View File

@@ -2,7 +2,11 @@
"compilerOptions": {
"allowJs": true,
"baseUrl": "../node_modules",
"types": ["cypress"]
"types": [
"cypress"
]
},
"include": ["**/*.*"]
"include": [
"**/*.*"
]
}

View File

@@ -5,41 +5,41 @@ importScripts("https://www.gstatic.com/firebasejs/8.2.0/firebase-messaging.js");
// Initialize the Firebase app in the service worker by passing the generated config
let firebaseConfig;
switch (this.location.hostname) {
case "localhost":
firebaseConfig = {
apiKey: "AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc",
authDomain: "imex-dev.firebaseapp.com",
databaseURL: "https://imex-dev.firebaseio.com",
projectId: "imex-dev",
storageBucket: "imex-dev.appspot.com",
messagingSenderId: "759548147434",
appId: "1:759548147434:web:e8239868a48ceb36700993",
measurementId: "G-K5XRBVVB4S",
};
break;
case "test.imex.online":
firebaseConfig = {
apiKey: "AIzaSyBw7_GTy7GtQyfkIRPVrWHEGKfcqeyXw0c",
authDomain: "imex-test.firebaseapp.com",
projectId: "imex-test",
storageBucket: "imex-test.appspot.com",
messagingSenderId: "991923618608",
appId: "1:991923618608:web:633437569cdad78299bef5",
// measurementId: "${config.measurementId}",
};
break;
case "imex.online":
default:
firebaseConfig = {
apiKey: "AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU",
authDomain: "imex-prod.firebaseapp.com",
databaseURL: "https://imex-prod.firebaseio.com",
projectId: "imex-prod",
storageBucket: "imex-prod.appspot.com",
messagingSenderId: "253497221485",
appId: "1:253497221485:web:3c81c483b94db84b227a64",
measurementId: "G-NTWBKG2L0M",
};
case "localhost":
firebaseConfig = {
apiKey: "AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc",
authDomain: "imex-dev.firebaseapp.com",
databaseURL: "https://imex-dev.firebaseio.com",
projectId: "imex-dev",
storageBucket: "imex-dev.appspot.com",
messagingSenderId: "759548147434",
appId: "1:759548147434:web:e8239868a48ceb36700993",
measurementId: "G-K5XRBVVB4S",
};
break;
case "test.imex.online":
firebaseConfig = {
apiKey: "AIzaSyBw7_GTy7GtQyfkIRPVrWHEGKfcqeyXw0c",
authDomain: "imex-test.firebaseapp.com",
projectId: "imex-test",
storageBucket: "imex-test.appspot.com",
messagingSenderId: "991923618608",
appId: "1:991923618608:web:633437569cdad78299bef5",
// measurementId: "${config.measurementId}",
};
break;
case "imex.online":
default:
firebaseConfig = {
apiKey: "AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU",
authDomain: "imex-prod.firebaseapp.com",
databaseURL: "https://imex-prod.firebaseio.com",
projectId: "imex-prod",
storageBucket: "imex-prod.appspot.com",
messagingSenderId: "253497221485",
appId: "1:253497221485:web:3c81c483b94db84b227a64",
measurementId: "G-NTWBKG2L0M",
};
}
firebase.initializeApp(firebaseConfig);
@@ -48,9 +48,9 @@ firebase.initializeApp(firebaseConfig);
const messaging = firebase.messaging();
messaging.onBackgroundMessage(function (payload) {
// Customize notification here
const channel = new BroadcastChannel("imex-sw-messages");
channel.postMessage(payload);
// Customize notification here
const channel = new BroadcastChannel("imex-sw-messages");
channel.postMessage(payload);
//self.registration.showNotification(notificationTitle, notificationOptions);
//self.registration.showNotification(notificationTitle, notificationOptions);
});

View File

@@ -1,73 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#002366" />
<meta name="description" content="ImEX Online" />
<head>
<meta charset="utf-8"/>
<link href="%PUBLIC_URL%/favicon.png" rel="icon"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta content="#002366" name="theme-color"/>
<meta content="ImEX Online" name="description"/>
<!-- <link rel="apple-touch-icon" href="logo192.png" /> -->
<link rel="apple-touch-icon" href="logo192.png" />
<link href="logo192.png" rel="apple-touch-icon"/>
<script type="text/javascript">
window.$crisp = [];
window.CRISP_WEBSITE_ID = "36724f62-2eb0-4b29-9cdd-9905fb99913e";
(function () {
d = document;
s = d.createElement("script");
s.src = "https://client.crisp.chat/l.js";
s.async = 1;
d.getElementsByTagName("head")[0].appendChild(s);
})();
window.$crisp = [];
window.CRISP_WEBSITE_ID = "36724f62-2eb0-4b29-9cdd-9905fb99913e";
(function () {
d = document;
s = d.createElement("script");
s.src = "https://client.crisp.chat/l.js";
s.async = 1;
d.getElementsByTagName("head")[0].appendChild(s);
})();
</script>
<script>
!(function () {
"use strict";
var e = [
"debug",
"destroy",
"do",
"help",
"identify",
"is",
"off",
"on",
"ready",
"render",
"reset",
"safe",
"set",
];
if (window.noticeable)
console.warn("Noticeable SDK code snippet loaded more than once");
else {
var n = (window.noticeable = window.noticeable || []);
function t(e) {
return function () {
var t = Array.prototype.slice.call(arguments);
return t.unshift(e), n.push(t), n;
};
}
!(function () {
for (var o = 0; o < e.length; o++) {
var r = e[o];
n[r] = t(r);
!(function () {
"use strict";
var e = [
"debug",
"destroy",
"do",
"help",
"identify",
"is",
"off",
"on",
"ready",
"render",
"reset",
"safe",
"set",
];
if (window.noticeable)
console.warn("Noticeable SDK code snippet loaded more than once");
else {
var n = (window.noticeable = window.noticeable || []);
function t(e) {
return function () {
var t = Array.prototype.slice.call(arguments);
return t.unshift(e), n.push(t), n;
};
}
!(function () {
for (var o = 0; o < e.length; o++) {
var r = e[o];
n[r] = t(r);
}
})(),
(function () {
var e = document.createElement("script");
(e.async = !0), (e.src = "https://sdk.noticeable.io/l.js");
var n = document.head;
n.insertBefore(e, n.firstChild);
})();
}
})(),
(function () {
var e = document.createElement("script");
(e.async = !0), (e.src = "https://sdk.noticeable.io/l.js");
var n = document.head;
n.insertBefore(e, n.firstChild);
})();
}
})();
})();
</script>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link href="%PUBLIC_URL%/manifest.json" rel="manifest"/>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
@@ -78,9 +80,9 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>ImEX Online</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>

View File

@@ -2,12 +2,12 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
xmlns="http://www.w3.org/2000/svg"
id="etuajo-oikeus"
width="450"
height="450">
<path d="M 0,225 L 225,0 L 450,225 L 225,450" fill="#000000" />
<path d="M 225,431.25 L 18.75,225 L 225,18.75 L 431.25,225" fill="#ffffff" />
<path d="M 56.25,225 L 225,56.25 L 393.75,225 L 225,393.75" fill="#000000" />
<path d="M 225,386.25 L 63.75,225 L 225,63.75 L 386.25,225" fill="#ffd90f" />
xmlns="http://www.w3.org/2000/svg"
id="etuajo-oikeus"
width="450"
height="450">
<path d="M 0,225 L 225,0 L 450,225 L 225,450" fill="#000000"/>
<path d="M 225,431.25 L 18.75,225 L 225,18.75 L 431.25,225" fill="#ffffff"/>
<path d="M 56.25,225 L 225,56.25 L 393.75,225 L 225,393.75" fill="#000000"/>
<path d="M 225,386.25 L 63.75,225 L 225,63.75 L 386.25,225" fill="#ffd90f"/>
</svg>

Before

Width:  |  Height:  |  Size: 552 B

After

Width:  |  Height:  |  Size: 572 B

View File

@@ -56,7 +56,7 @@ export function App({bodyshop, checkUserSession, currentUser, online, setOnline,
}
checkUserSession();
}, [checkUserSession, setOnline]);
}, [checkUserSession, setOnline]);
//const b = Grid.useBreakpoint();
// console.log("Breakpoints:", b);

View File

@@ -83,6 +83,7 @@
animation: alertBlinker 1s linear infinite;
color: blue;
}
@keyframes alertBlinker {
50% {
color: red;
@@ -99,6 +100,7 @@
color: rgba(255, 140, 0, 0.8);
font-weight: bold;
}
.production-completion-past {
color: rgba(255, 0, 0, 0.8);
font-weight: bold;

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 52 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 -256 1792 1792">
<g transform="matrix(1,0,0,-1,197.42373,1300.6102)">
<path d="M 1408,131 Q 1408,11 1335,-58.5 1262,-128 1141,-128 H 267 Q 146,-128 73,-58.5 0,11 0,131 0,184 3.5,234.5 7,285 17.5,343.5 28,402 44,452 q 16,50 43,97.5 27,47.5 62,81 35,33.5 85.5,53.5 50.5,20 111.5,20 9,0 42,-21.5 33,-21.5 74.5,-48 41.5,-26.5 108,-48 Q 637,565 704,565 q 67,0 133.5,21.5 66.5,21.5 108,48 41.5,26.5 74.5,48 33,21.5 42,21.5 61,0 111.5,-20 50.5,-20 85.5,-53.5 35,-33.5 62,-81 27,-47.5 43,-97.5 16,-50 26.5,-108.5 10.5,-58.5 14,-109 Q 1408,184 1408,131 z m -320,893 Q 1088,865 975.5,752.5 863,640 704,640 545,640 432.5,752.5 320,865 320,1024 320,1183 432.5,1295.5 545,1408 704,1408 863,1408 975.5,1295.5 1088,1183 1088,1024 z"/>
</g>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
viewBox="0 -256 1792 1792">
<g transform="matrix(1,0,0,-1,197.42373,1300.6102)">
<path d="M 1408,131 Q 1408,11 1335,-58.5 1262,-128 1141,-128 H 267 Q 146,-128 73,-58.5 0,11 0,131 0,184 3.5,234.5 7,285 17.5,343.5 28,402 44,452 q 16,50 43,97.5 27,47.5 62,81 35,33.5 85.5,53.5 50.5,20 111.5,20 9,0 42,-21.5 33,-21.5 74.5,-48 41.5,-26.5 108,-48 Q 637,565 704,565 q 67,0 133.5,21.5 66.5,21.5 108,48 41.5,26.5 74.5,48 33,21.5 42,21.5 61,0 111.5,-20 50.5,-20 85.5,-53.5 35,-33.5 62,-81 27,-47.5 43,-97.5 16,-50 26.5,-108.5 10.5,-58.5 14,-109 Q 1408,184 1408,131 z m -320,893 Q 1088,865 975.5,752.5 863,640 704,640 545,640 432.5,752.5 320,865 320,1024 320,1183 432.5,1295.5 545,1408 704,1408 863,1408 975.5,1295.5 1088,1183 1088,1024 z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 981 B

After

Width:  |  Height:  |  Size: 955 B

View File

@@ -1 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M23.5 7c.276 0 .5.224.5.5v.511c0 .793-.926.989-1.616.989l-1.086-2h2.202zm-1.441 3.506c.639 1.186.946 2.252.946 3.666 0 1.37-.397 2.533-1.005 3.981v1.847c0 .552-.448 1-1 1h-1.5c-.552 0-1-.448-1-1v-1h-13v1c0 .552-.448 1-1 1h-1.5c-.552 0-1-.448-1-1v-1.847c-.608-1.448-1.005-2.611-1.005-3.981 0-1.414.307-2.48.946-3.666.829-1.537 1.851-3.453 2.93-5.252.828-1.382 1.262-1.707 2.278-1.889 1.532-.275 2.918-.365 4.851-.365s3.319.09 4.851.365c1.016.182 1.45.507 2.278 1.889 1.079 1.799 2.101 3.715 2.93 5.252zm-16.059 2.994c0-.828-.672-1.5-1.5-1.5s-1.5.672-1.5 1.5.672 1.5 1.5 1.5 1.5-.672 1.5-1.5zm10 1c0-.276-.224-.5-.5-.5h-7c-.276 0-.5.224-.5.5s.224.5.5.5h7c.276 0 .5-.224.5-.5zm2.941-5.527s-.74-1.826-1.631-3.142c-.202-.298-.515-.502-.869-.566-1.511-.272-2.835-.359-4.441-.359s-2.93.087-4.441.359c-.354.063-.667.267-.869.566-.891 1.315-1.631 3.142-1.631 3.142 1.64.313 4.309.497 6.941.497s5.301-.184 6.941-.497zm2.059 4.527c0-.828-.672-1.5-1.5-1.5s-1.5.672-1.5 1.5.672 1.5 1.5 1.5 1.5-.672 1.5-1.5zm-18.298-6.5h-2.202c-.276 0-.5.224-.5.5v.511c0 .793.926.989 1.616.989l1.086-2z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M23.5 7c.276 0 .5.224.5.5v.511c0 .793-.926.989-1.616.989l-1.086-2h2.202zm-1.441 3.506c.639 1.186.946 2.252.946 3.666 0 1.37-.397 2.533-1.005 3.981v1.847c0 .552-.448 1-1 1h-1.5c-.552 0-1-.448-1-1v-1h-13v1c0 .552-.448 1-1 1h-1.5c-.552 0-1-.448-1-1v-1.847c-.608-1.448-1.005-2.611-1.005-3.981 0-1.414.307-2.48.946-3.666.829-1.537 1.851-3.453 2.93-5.252.828-1.382 1.262-1.707 2.278-1.889 1.532-.275 2.918-.365 4.851-.365s3.319.09 4.851.365c1.016.182 1.45.507 2.278 1.889 1.079 1.799 2.101 3.715 2.93 5.252zm-16.059 2.994c0-.828-.672-1.5-1.5-1.5s-1.5.672-1.5 1.5.672 1.5 1.5 1.5 1.5-.672 1.5-1.5zm10 1c0-.276-.224-.5-.5-.5h-7c-.276 0-.5.224-.5.5s.224.5.5.5h7c.276 0 .5-.224.5-.5zm2.941-5.527s-.74-1.826-1.631-3.142c-.202-.298-.515-.502-.869-.566-1.511-.272-2.835-.359-4.441-.359s-2.93.087-4.441.359c-.354.063-.667.267-.869.566-.891 1.315-1.631 3.142-1.631 3.142 1.64.313 4.309.497 6.941.497s5.301-.184 6.941-.497zm2.059 4.527c0-.828-.672-1.5-1.5-1.5s-1.5.672-1.5 1.5.672 1.5 1.5 1.5 1.5-.672 1.5-1.5zm-18.298-6.5h-2.202c-.276 0-.5.224-.5.5v.511c0 .793.926.989 1.616.989l1.086-2z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1,5 +1,21 @@
<?xml version="1.0" ?><svg style="enable-background:new 0 0 128 128;" version="1.1" viewBox="0 0 128 128" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><style type="text/css">
<?xml version="1.0" ?>
<svg style="enable-background:new 0 0 128 128;" version="1.1" viewBox="0 0 128 128" xml:space="preserve"
xmlns="http://www.w3.org/2000/svg"><style type="text/css">
.st0{fill:none;stroke:#000000;stroke-width:8;stroke-miterlimit:10;}
.st1{display:none;}
.st2{display:inline;opacity:0.25;fill:#F45EFD;}
</style><g id="_x31_2_3D_Printing"/><g id="_x31_1_VR_Gear"/><g id="_x31_0_Virtual_reality"/><g id="_x39__Augmented_reality"/><g id="_x38__Teleport"/><g id="_x37__Glassess"/><g id="_x36__Folding_phone"/><g id="_x35__Drone"/><g id="_x34__Retina_scan"/><g id="_x33__Smartwatch"/><g id="_x32__Bionic_Arm"/><g id="_x31__Chip"><g><path d="M108,40c-5.2,0-9.6,3.3-11.3,8H84V32h-8V20h-8v12h-8V20h-8v12h-8v16H24v-8.7c4.7-1.7,8-6.1,8-11.3c0-6.6-5.4-12-12-12 S8,21.4,8,28c0,5.2,3.3,9.6,8,11.3V56h28v8H16v16.7c-4.7,1.7-8,6.1-8,11.3c0,6.6,5.4,12,12,12s12-5.4,12-12c0-5.2-3.3-9.6-8-11.3 V72h20v16h8v12h8V88h8v12h8V88h8V72h8v16.7c-4.7,1.7-8,6.1-8,11.3c0,6.6,5.4,12,12,12s12-5.4,12-12c0-5.2-3.3-9.6-8-11.3V64H84v-8 h12.7c1.7,4.7,6.1,8,11.3,8c6.6,0,12-5.4,12-12S114.6,40,108,40z M20,32c-2.2,0-4-1.8-4-4s1.8-4,4-4s4,1.8,4,4S22.2,32,20,32z M20,96c-2.2,0-4-1.8-4-4s1.8-4,4-4s4,1.8,4,4S22.2,96,20,96z M76,80H52V40h24V80z M96,96c2.2,0,4,1.8,4,4s-1.8,4-4,4s-4-1.8-4-4 S93.8,96,96,96z M108,56c-2.2,0-4-1.8-4-4s1.8-4,4-4s4,1.8,4,4S110.2,56,108,56z"/><rect height="8" width="8" x="56" y="64"/></g></g><g class="st1" id="Guide"><path class="st2" d="M120,8v112H8V8H120 M128,0H0v128h128V0L128,0z"/></g></svg>
</style>
<g id="_x31_2_3D_Printing"/>
<g id="_x31_1_VR_Gear"/>
<g id="_x31_0_Virtual_reality"/>
<g id="_x39__Augmented_reality"/>
<g id="_x38__Teleport"/>
<g id="_x37__Glassess"/>
<g id="_x36__Folding_phone"/>
<g id="_x35__Drone"/>
<g id="_x34__Retina_scan"/>
<g id="_x33__Smartwatch"/>
<g id="_x32__Bionic_Arm"/>
<g id="_x31__Chip"><g><path d="M108,40c-5.2,0-9.6,3.3-11.3,8H84V32h-8V20h-8v12h-8V20h-8v12h-8v16H24v-8.7c4.7-1.7,8-6.1,8-11.3c0-6.6-5.4-12-12-12 S8,21.4,8,28c0,5.2,3.3,9.6,8,11.3V56h28v8H16v16.7c-4.7,1.7-8,6.1-8,11.3c0,6.6,5.4,12,12,12s12-5.4,12-12c0-5.2-3.3-9.6-8-11.3 V72h20v16h8v12h8V88h8v12h8V88h8V72h8v16.7c-4.7,1.7-8,6.1-8,11.3c0,6.6,5.4,12,12,12s12-5.4,12-12c0-5.2-3.3-9.6-8-11.3V64H84v-8 h12.7c1.7,4.7,6.1,8,11.3,8c6.6,0,12-5.4,12-12S114.6,40,108,40z M20,32c-2.2,0-4-1.8-4-4s1.8-4,4-4s4,1.8,4,4S22.2,32,20,32z M20,96c-2.2,0-4-1.8-4-4s1.8-4,4-4s4,1.8,4,4S22.2,96,20,96z M76,80H52V40h24V80z M96,96c2.2,0,4,1.8,4,4s-1.8,4-4,4s-4-1.8-4-4 S93.8,96,96,96z M108,56c-2.2,0-4-1.8-4-4s1.8-4,4-4s4,1.8,4,4S110.2,56,108,56z"/><rect
height="8" width="8" x="56" y="64"/></g></g>
<g class="st1" id="Guide"><path class="st2" d="M120,8v112H8V8H120 M128,0H0v128h128V0L128,0z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 50 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -1,144 +1,216 @@
<svg id="svg166" version="1.1" viewBox="0 0 1668 1160" xmlns="http://www.w3.org/2000/svg">
<g id="g158" transform="translate(254 -254)">
<g id="g34" transform="translate(-13.78 3.524)" stroke="#000">
<path id="path10" d="m494.57 1006.9c41.429-15.714 140-11.427 191.43-12.857 51.429-1.429 160.48 10.23 201.43 27.143 40.995 16.93 134.78 67.656 151.43 72.857 22.857 7.143 41.429 7.143 80 20 38.572 12.857 25.714 32.857 25.714 32.857l-30-4.286-5.756 52.92s37.185 1.366 41.47 15.652c4.286 14.286 5.715 31.428-2.856 41.428-8.572 10-14.286-1.428-18.572 12.858-4.286 14.285-2.857 28.571-27.143 27.142-24.285-1.428-98.571 0-98.571 0s-15.714-108.57-98.573-105.71c-82.857 2.857-95.714 105.71-95.714 105.71h-500s-5.714-104.28-97.143-105.71c-91.428-1.428-98.571 105.71-98.571 105.71h-65.713l-18.572-38.571c-0.515 0-26.243 0-21.428-17.143 4.651-16.561-4.286-41.428 17.142-41.428 21.429 0 47.143 1.428 47.143 1.428l15.715-44.286-41.429-2.857s34.286-24.285 118.57-32.857c84.286-8.571 157.14-8.571 192.86-31.428 35.714-22.858 137.14-78.572 137.14-78.572z" fill="none" stroke-width="5"/>
<path id="path12" d="m28.857 1254h92.857m180 0h517.14m172.86 0h151.43" fill="none" stroke-width="2"/>
<path id="path14" d="m364.57 1101.1c15.715-18.572 123.37-81.525 151.43-88.572 29.502-7.41 103-7.142 103-7.142l-7.143 95.714z" fill="#f0ffeb" stroke-width="5"/>
<path id="path16" d="m404.57 1071.1v28.571" fill="none" stroke-width="2"/>
<path id="path18" d="m644.7 1006.8-4.285 94.328h207.16c-11.307-20.753-46.612-74.906-72.857-88.572-14.285-10-82.878-4.327-130.02-5.756zm167.02 7.164s80 84.286 85.715 87.143c5.714 2.857 115.71 1.428 115.71 1.428s-77.143-47.141-102.86-58.571c-25.715-11.429-90-31.429-98.572-30z" fill="#f0ffeb" stroke-width="5"/>
<g fill="none">
<path id="path20" d="m345.64 1091.7c-14.075 30.968-18.298 71.788-18.298 94.31 0 22.521 4.223 91.493 22.521 105.57m282.93-298.41c-1.408 5.63-4.047 81.903-6.51 106.93-3.67 18.715-4.989 51.219-6.159 87.315 0 22.522 7.038 80.233 12.669 105.57" stroke-width="5"/>
<path id="path22" d="m103.53 1252.1s15.483-85.864 106.98-85.864c91.494 0 109.79 87.271 109.79 87.271m479.99 0s15.483-85.863 106.98-85.863c91.493 0 109.79 87.27 109.79 87.27m-947.31-57.711h63.342" stroke-width="2"/>
<path id="path24" d="m779.18 1000.2c18.299 12.668 56.304 50.673 92.9 104.16 36.598 53.489 8.447 59.12-18.298 74.603-26.744 15.483-49.266 42.227-67.564 112.61" stroke-width="5"/>
<path id="path26" d="m1112.8 1196h-129.5m-696.76-0.222h544.74m-22.522-150.61v54.896" stroke-width="2"/>
</g>
<g stroke-width="2">
<rect id="rect28" x="558.65" y="1144.9" width="41.286" height="14.541" rx="2.933" ry="7.379" fill="#e6e6e6"/>
<rect id="rect30" x="816.24" y="1144.9" width="41.286" height="14.541" rx="2.933" ry="7.379" fill="#e6e6e6"/>
<rect id="rect32" x="259.53" y="1146.3" width="18.776" height="11.738" rx="1.63" ry="7.692" fill="#ffcb00"/>
</g>
</g>
<g id="g54" transform="translate(-13.78 15.524)" stroke="#000">
<path id="path36" d="m62.767 812.59-11.712 16.12-18.95-6.157v-19.925l18.95-6.158z" fill="none" stroke-width="5"/>
<path id="path38" d="m31.742 745.02 315.3-111.2m-316.71 254.77 315.3 115.42" fill="none" stroke-width="2"/>
<path id="path40" d="m341.41 632.78 140.76 38.005s-8.446 49.222-8.446 71.963v147.62c0 30.967 8.445 78.825 8.445 78.825l-140.76 33.782s-17.242-61.902-17.242-92.901l2.111-185.8c-1.408-30.967 15.132-91.493 15.132-91.493z" fill="#f0ffeb" stroke-width="5"/>
<g fill="none">
<path id="path42" d="m482.17 670.79s94.309 5.63 152.02 5.63c106.98 0 201.29-5.63 201.29-5.63m-1.408 297s-77.418-5.63-199.88-5.63c-68.972 0-152.02 7.038-152.02 7.038" stroke-width="5"/>
<rect id="rect44" x="528.62" y="729.2" width="106.98" height="181.58" rx="31.19" ry="34.436" stroke-width="2"/>
<path id="path46" d="m345.78 632.78h-294.19l-14.076 102.75-7.038 11.26v142.17l7.038 14.076 15.483 101.35h288.56m491.11-333.6s-12.668 47.858-12.668 73.195v146.39c0 25.336 12.668 77.417 12.668 77.417l205.51 38.005h108.38s14.076-81.64 14.076-115.42v-147.8c0-38.005-14.076-109.79-14.076-109.79h-108.38z" stroke-width="5"/>
</g>
<path id="path48" d="m843.92 689.09s-8.445 40.82-8.445 56.303v144.98c0 19.706 7.038 57.711 7.038 57.711s94.308 26.744 123.87 26.744h42.228v-312.49h-47.859c-25.336 0-116.83 26.745-116.83 26.745z" fill="#f0ffeb" stroke-width="5"/>
<path id="path50" d="m1038.2 632.78s30.967 40.82 30.967 111.2v146.39c0 64.749-30.967 116.83-30.967 116.83m-713.65-263.22 32.374-32.375v-40.82 112.61m-33.078 81.641 32.374-32.375v-40.82 112.61m648.9-116.83-32.375-32.374v-40.82 112.61" fill="none" stroke-width="2"/>
<path id="path52" d="m341.41 632.78s-42.228 78.825-42.228 111.2v146.39c0 40.82 42.228 114.02 42.228 114.02" fill="none" stroke-width="2"/>
</g>
<g fill="none" stroke="#000">
<path id="path56" d="m-106.79 740.92 1.407-91.493s5.63-23.93-25.337-25.337c-30.967-1.408-26.744 2.815-26.744 2.815l1.408 415.24h28.152c28.152 0 22.521-22.52 22.521-22.52v-95.717c-12.677 0-11.26-9.614-11.26-16.891v-149.2c0.45-18.89 9.853-16.892 9.853-16.892z" stroke-width="5"/>
<path id="path58" d="m-155.99 646.16h49.265m-48.415 374.27h49.266m-50.82-315.37h49.266m-46.451 259.81h49.266" stroke-width="2.2"/>
<path id="path60" d="m-147.1 703.82v260.4m9.853-258.84v260.4" stroke-width="2"/>
</g>
<g id="g88" transform="translate(-13.78 15.524)" stroke="#000">
<path id="path62" d="m494.57 641.61c41.429 15.714 140 11.428 191.43 12.856s160.48-10.23 201.43-27.143c40.995-16.93 134.78-67.656 151.43-72.857 22.857-7.143 41.429-7.143 80-20 38.572-12.857 25.714-32.857 25.714-32.857l-30 4.285-5.756-52.92s37.185-1.365 41.47-15.651c4.286-14.286 5.715-31.429-2.856-41.429-8.572-10-14.286 1.429-18.572-12.857-4.286-14.285-2.857-28.571-27.143-27.143-24.285 1.429-98.571 0-98.571 0s-15.714 108.57-98.572 105.72c-82.857-2.857-95.714-105.72-95.714-105.72h-500s-5.714 104.29-97.143 105.72c-91.428 1.428-98.571-105.72-98.571-105.72h-65.714l-18.572 38.572c-0.515 0-26.243 0-21.428 17.143 4.651 16.561-4.286 41.428 17.142 41.428 21.429 0 47.143-1.428 47.143-1.428l15.715 44.285-41.429 2.859s34.286 24.285 118.57 32.857c84.286 8.571 157.14 8.571 192.86 31.428 35.714 22.857 137.14 78.572 137.14 78.572z" fill="none" stroke-width="5"/>
<path id="path64" d="m28.857 394.47h92.857m180 0h517.14m172.86 0h151.43" fill="none" stroke-width="2"/>
<path id="path66" d="m364.57 547.33c15.715 18.571 123.37 81.524 151.43 88.571 29.502 7.41 103 7.143 103 7.143l-7.143-95.714z" fill="#f0ffeb" stroke-width="5"/>
<path id="path68" d="m404.57 577.33v-28.571" fill="none" stroke-width="2"/>
<path id="path70" d="m644.7 641.64-4.285-94.328h207.16c-11.307 20.753-46.612 74.906-72.857 88.571-14.285 10-82.878 4.328-130.02 5.757zm167.02-7.165s80-84.285 85.715-87.142c5.714-2.857 115.71-1.429 115.71-1.429s-77.143 47.143-102.86 58.572c-25.715 11.428-90 31.428-98.572 30z" fill="#f0ffeb" stroke-width="5"/>
<g fill="none">
<path id="path72" d="m345.64 556.81c-14.075-30.967-18.298-71.787-18.298-94.309 0-22.521 4.223-91.493 22.521-105.57m282.93 298.41c-1.408-5.63-4.047-81.905-6.51-106.93-3.67-18.714-4.989-51.218-6.159-87.314 0-22.522 7.038-80.233 12.669-105.57" stroke-width="5"/>
<path id="path74" d="m103.53 396.34s15.483 85.864 106.98 85.864c91.494 0 109.79-87.271 109.79-87.271m479.99 0s15.483 85.863 106.98 85.863c91.493 0 109.79-87.27 109.79-87.27m-947.31 57.71h63.342" stroke-width="2"/>
<path id="path76" d="m779.18 648.3c18.299-12.669 56.304-50.674 92.9-104.16 36.598-53.489 8.447-59.12-18.298-74.603-26.744-15.483-49.266-42.228-67.564-112.61" stroke-width="5"/>
<path id="path78" d="m1112.8 452.42h-129.5m-696.76 0.223h544.74m-22.522 150.61v-54.895" stroke-width="2"/>
</g>
<g stroke-width="2">
<rect id="rect80" transform="scale(1 -1)" x="558.65" y="-503.55" width="41.286" height="14.541" rx="2.933" ry="7.379" fill="#e6e6e6"/>
<rect id="rect82" transform="scale(1 -1)" x="816.24" y="-503.55" width="41.286" height="14.541" rx="2.933" ry="7.379" fill="#e6e6e6"/>
<rect id="rect84" transform="scale(1 -1)" x="259.53" y="-502.15" width="18.776" height="11.738" rx="1.63" ry="7.692" fill="#ffcb00"/>
<circle id="circle86" transform="translate(941.34 284)" cx="59.119" cy="211.28" r="16.891" fill="#fff"/>
</g>
</g>
<path id="path90" d="m-126.58 704.93v260.4" fill="none" stroke="#000" stroke-width="2"/>
<path id="path92" d="m-153.88 992.49v-26.041h45.043v52.08h-45.043zm0-316.71v-27.448h45.043v54.898h-45.043z" fill="#ffffc0"/>
<g fill="none" stroke="#000">
<path id="path94" d="m-157.4 624.38s-4.223-12.669-18.299-12.669-14.076 8.446-14.076 8.446v423.69s1.408 9.853 14.076 9.853c12.669 0 18.3-9.853 18.3-9.853" stroke-width="5"/>
<path id="path96" d="m-191.18 624.38s-35.19-1.408-35.19 21.114v371.6c0 22.521 36.597 25.336 36.597 25.336" stroke-width="5"/>
<g stroke-width="2">
<rect id="rect98" x="-216.51" y="648.31" width="16.891" height="35.19" rx="7.742" ry="6.284"/>
<rect id="rect100" x="-216.51" y="985.58" width="16.891" height="35.19" rx="7.742" ry="6.284"/>
<path id="path102" d="m-62.939 645.49h30.967v377.24h-30.967z"/>
</g>
<path id="path104" d="m1200.9 633.86v73.195h67.565v-83.048l-25.337-14.076zm0 329.38h67.565v78.826l-23.93 14.076-43.635-18.3zm0-270.26v284.33m67.565-283.74v284.33" stroke-width="5"/>
<path id="path106" d="m1216.6 759.51h14.076v147.8h-14.076zm7.631-1.408v-53.488m0 257.37v-53.49m30.375-201.06v256.18" stroke-width="2"/>
<path id="path108" d="m1268.8 624.97s4.223-12.668 18.299-12.668 14.076 8.445 14.076 8.445v423.69s-1.408 9.853-14.076 9.853c-12.669 0-18.299-9.853-18.299-9.853m33.783-419.46s35.19-1.408 35.19 21.114v371.6c0 22.521-36.598 25.337-36.598 25.337" stroke-width="5"/>
<g stroke-width="2">
<rect id="rect110" transform="scale(-1 1)" x="-1329.9" y="648.9" width="16.891" height="35.19" rx="7.742" ry="6.284"/>
<rect id="rect112" transform="scale(-1 1)" x="-1329.9" y="986.17" width="16.891" height="35.19" rx="7.742" ry="6.284"/>
<path id="path114" d="m1199.7 632.82 67.565 74.603m-67.565 0.592 67.565-73.195m-67.342 328.16 67.565 74.602m-67.565 0.593 67.565-73.195"/>
</g>
</g>
<g stroke="#000">
<g stroke-width="2">
<circle id="circle116" transform="translate(78.489 1074.7)" cx="119.65" cy="202.84" r="76.01" fill="#c8c8c8"/>
<circle id="circle118" transform="translate(94.676 1204.9)" cx="103.46" cy="72.633" r="44.339" fill="#fff"/>
<circle id="circle120" transform="translate(78.489 187.66)" cx="119.65" cy="202.84" r="76.01" fill="#c8c8c8"/>
<circle id="circle122" transform="translate(94.676 317.86)" cx="103.46" cy="72.633" r="44.339" fill="#fff"/>
<circle id="circle124" transform="translate(773.02 187.66)" cx="119.65" cy="202.84" r="76.01" fill="#c8c8c8"/>
<circle id="circle126" transform="translate(789.21 317.86)" cx="103.46" cy="72.633" r="44.339" fill="#fff"/>
<circle id="circle128" transform="translate(773.02 1074.7)" cx="119.65" cy="202.84" r="76.01" fill="#c8c8c8"/>
<circle id="circle130" transform="translate(789.21 1204.9)" cx="103.46" cy="72.633" r="44.339" fill="#fff"/>
</g>
<path id="path132" d="m1338.5 829.07h40.82" fill="none" stroke-width="5"/>
<circle id="circle134" transform="translate(1441.3 600.31)" cx="-59.119" cy="229.58" r="4.223" fill="#3c3c3c" stroke-width="5"/>
<g stroke-width="2">
<path id="path136" d="m778.06 845.37-38.709-38.709" fill="none"/>
<g id="g146" transform="translate(-13.78 15.524)" fill="#3c3c3c">
<circle id="circle138" transform="translate(-79.458 449.8)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle140" transform="translate(-79.458 569.92)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle142" transform="translate(-79.458 690.03)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle144" transform="translate(-79.458 810.15)" cx="-81.641" cy="188.76" r="4.223"/>
<g id="g158" transform="translate(254 -254)">
<g id="g34" transform="translate(-13.78 3.524)" stroke="#000">
<path id="path10"
d="m494.57 1006.9c41.429-15.714 140-11.427 191.43-12.857 51.429-1.429 160.48 10.23 201.43 27.143 40.995 16.93 134.78 67.656 151.43 72.857 22.857 7.143 41.429 7.143 80 20 38.572 12.857 25.714 32.857 25.714 32.857l-30-4.286-5.756 52.92s37.185 1.366 41.47 15.652c4.286 14.286 5.715 31.428-2.856 41.428-8.572 10-14.286-1.428-18.572 12.858-4.286 14.285-2.857 28.571-27.143 27.142-24.285-1.428-98.571 0-98.571 0s-15.714-108.57-98.573-105.71c-82.857 2.857-95.714 105.71-95.714 105.71h-500s-5.714-104.28-97.143-105.71c-91.428-1.428-98.571 105.71-98.571 105.71h-65.713l-18.572-38.571c-0.515 0-26.243 0-21.428-17.143 4.651-16.561-4.286-41.428 17.142-41.428 21.429 0 47.143 1.428 47.143 1.428l15.715-44.286-41.429-2.857s34.286-24.285 118.57-32.857c84.286-8.571 157.14-8.571 192.86-31.428 35.714-22.858 137.14-78.572 137.14-78.572z"
fill="none" stroke-width="5"/>
<path id="path12" d="m28.857 1254h92.857m180 0h517.14m172.86 0h151.43" fill="none" stroke-width="2"/>
<path id="path14"
d="m364.57 1101.1c15.715-18.572 123.37-81.525 151.43-88.572 29.502-7.41 103-7.142 103-7.142l-7.143 95.714z"
fill="#f0ffeb" stroke-width="5"/>
<path id="path16" d="m404.57 1071.1v28.571" fill="none" stroke-width="2"/>
<path id="path18"
d="m644.7 1006.8-4.285 94.328h207.16c-11.307-20.753-46.612-74.906-72.857-88.572-14.285-10-82.878-4.327-130.02-5.756zm167.02 7.164s80 84.286 85.715 87.143c5.714 2.857 115.71 1.428 115.71 1.428s-77.143-47.141-102.86-58.571c-25.715-11.429-90-31.429-98.572-30z"
fill="#f0ffeb" stroke-width="5"/>
<g fill="none">
<path id="path20"
d="m345.64 1091.7c-14.075 30.968-18.298 71.788-18.298 94.31 0 22.521 4.223 91.493 22.521 105.57m282.93-298.41c-1.408 5.63-4.047 81.903-6.51 106.93-3.67 18.715-4.989 51.219-6.159 87.315 0 22.522 7.038 80.233 12.669 105.57"
stroke-width="5"/>
<path id="path22"
d="m103.53 1252.1s15.483-85.864 106.98-85.864c91.494 0 109.79 87.271 109.79 87.271m479.99 0s15.483-85.863 106.98-85.863c91.493 0 109.79 87.27 109.79 87.27m-947.31-57.711h63.342"
stroke-width="2"/>
<path id="path24"
d="m779.18 1000.2c18.299 12.668 56.304 50.673 92.9 104.16 36.598 53.489 8.447 59.12-18.298 74.603-26.744 15.483-49.266 42.227-67.564 112.61"
stroke-width="5"/>
<path id="path26" d="m1112.8 1196h-129.5m-696.76-0.222h544.74m-22.522-150.61v54.896" stroke-width="2"/>
</g>
<g stroke-width="2">
<rect id="rect28" x="558.65" y="1144.9" width="41.286" height="14.541" rx="2.933" ry="7.379"
fill="#e6e6e6"/>
<rect id="rect30" x="816.24" y="1144.9" width="41.286" height="14.541" rx="2.933" ry="7.379"
fill="#e6e6e6"/>
<rect id="rect32" x="259.53" y="1146.3" width="18.776" height="11.738" rx="1.63" ry="7.692"
fill="#ffcb00"/>
</g>
</g>
<g id="g54" transform="translate(-13.78 15.524)" stroke="#000">
<path id="path36" d="m62.767 812.59-11.712 16.12-18.95-6.157v-19.925l18.95-6.158z" fill="none"
stroke-width="5"/>
<path id="path38" d="m31.742 745.02 315.3-111.2m-316.71 254.77 315.3 115.42" fill="none" stroke-width="2"/>
<path id="path40"
d="m341.41 632.78 140.76 38.005s-8.446 49.222-8.446 71.963v147.62c0 30.967 8.445 78.825 8.445 78.825l-140.76 33.782s-17.242-61.902-17.242-92.901l2.111-185.8c-1.408-30.967 15.132-91.493 15.132-91.493z"
fill="#f0ffeb" stroke-width="5"/>
<g fill="none">
<path id="path42"
d="m482.17 670.79s94.309 5.63 152.02 5.63c106.98 0 201.29-5.63 201.29-5.63m-1.408 297s-77.418-5.63-199.88-5.63c-68.972 0-152.02 7.038-152.02 7.038"
stroke-width="5"/>
<rect id="rect44" x="528.62" y="729.2" width="106.98" height="181.58" rx="31.19" ry="34.436"
stroke-width="2"/>
<path id="path46"
d="m345.78 632.78h-294.19l-14.076 102.75-7.038 11.26v142.17l7.038 14.076 15.483 101.35h288.56m491.11-333.6s-12.668 47.858-12.668 73.195v146.39c0 25.336 12.668 77.417 12.668 77.417l205.51 38.005h108.38s14.076-81.64 14.076-115.42v-147.8c0-38.005-14.076-109.79-14.076-109.79h-108.38z"
stroke-width="5"/>
</g>
<path id="path48"
d="m843.92 689.09s-8.445 40.82-8.445 56.303v144.98c0 19.706 7.038 57.711 7.038 57.711s94.308 26.744 123.87 26.744h42.228v-312.49h-47.859c-25.336 0-116.83 26.745-116.83 26.745z"
fill="#f0ffeb" stroke-width="5"/>
<path id="path50"
d="m1038.2 632.78s30.967 40.82 30.967 111.2v146.39c0 64.749-30.967 116.83-30.967 116.83m-713.65-263.22 32.374-32.375v-40.82 112.61m-33.078 81.641 32.374-32.375v-40.82 112.61m648.9-116.83-32.375-32.374v-40.82 112.61"
fill="none" stroke-width="2"/>
<path id="path52" d="m341.41 632.78s-42.228 78.825-42.228 111.2v146.39c0 40.82 42.228 114.02 42.228 114.02"
fill="none" stroke-width="2"/>
</g>
<g fill="none" stroke="#000">
<path id="path56"
d="m-106.79 740.92 1.407-91.493s5.63-23.93-25.337-25.337c-30.967-1.408-26.744 2.815-26.744 2.815l1.408 415.24h28.152c28.152 0 22.521-22.52 22.521-22.52v-95.717c-12.677 0-11.26-9.614-11.26-16.891v-149.2c0.45-18.89 9.853-16.892 9.853-16.892z"
stroke-width="5"/>
<path id="path58"
d="m-155.99 646.16h49.265m-48.415 374.27h49.266m-50.82-315.37h49.266m-46.451 259.81h49.266"
stroke-width="2.2"/>
<path id="path60" d="m-147.1 703.82v260.4m9.853-258.84v260.4" stroke-width="2"/>
</g>
<g id="g88" transform="translate(-13.78 15.524)" stroke="#000">
<path id="path62"
d="m494.57 641.61c41.429 15.714 140 11.428 191.43 12.856s160.48-10.23 201.43-27.143c40.995-16.93 134.78-67.656 151.43-72.857 22.857-7.143 41.429-7.143 80-20 38.572-12.857 25.714-32.857 25.714-32.857l-30 4.285-5.756-52.92s37.185-1.365 41.47-15.651c4.286-14.286 5.715-31.429-2.856-41.429-8.572-10-14.286 1.429-18.572-12.857-4.286-14.285-2.857-28.571-27.143-27.143-24.285 1.429-98.571 0-98.571 0s-15.714 108.57-98.572 105.72c-82.857-2.857-95.714-105.72-95.714-105.72h-500s-5.714 104.29-97.143 105.72c-91.428 1.428-98.571-105.72-98.571-105.72h-65.714l-18.572 38.572c-0.515 0-26.243 0-21.428 17.143 4.651 16.561-4.286 41.428 17.142 41.428 21.429 0 47.143-1.428 47.143-1.428l15.715 44.285-41.429 2.859s34.286 24.285 118.57 32.857c84.286 8.571 157.14 8.571 192.86 31.428 35.714 22.857 137.14 78.572 137.14 78.572z"
fill="none" stroke-width="5"/>
<path id="path64" d="m28.857 394.47h92.857m180 0h517.14m172.86 0h151.43" fill="none" stroke-width="2"/>
<path id="path66"
d="m364.57 547.33c15.715 18.571 123.37 81.524 151.43 88.571 29.502 7.41 103 7.143 103 7.143l-7.143-95.714z"
fill="#f0ffeb" stroke-width="5"/>
<path id="path68" d="m404.57 577.33v-28.571" fill="none" stroke-width="2"/>
<path id="path70"
d="m644.7 641.64-4.285-94.328h207.16c-11.307 20.753-46.612 74.906-72.857 88.571-14.285 10-82.878 4.328-130.02 5.757zm167.02-7.165s80-84.285 85.715-87.142c5.714-2.857 115.71-1.429 115.71-1.429s-77.143 47.143-102.86 58.572c-25.715 11.428-90 31.428-98.572 30z"
fill="#f0ffeb" stroke-width="5"/>
<g fill="none">
<path id="path72"
d="m345.64 556.81c-14.075-30.967-18.298-71.787-18.298-94.309 0-22.521 4.223-91.493 22.521-105.57m282.93 298.41c-1.408-5.63-4.047-81.905-6.51-106.93-3.67-18.714-4.989-51.218-6.159-87.314 0-22.522 7.038-80.233 12.669-105.57"
stroke-width="5"/>
<path id="path74"
d="m103.53 396.34s15.483 85.864 106.98 85.864c91.494 0 109.79-87.271 109.79-87.271m479.99 0s15.483 85.863 106.98 85.863c91.493 0 109.79-87.27 109.79-87.27m-947.31 57.71h63.342"
stroke-width="2"/>
<path id="path76"
d="m779.18 648.3c18.299-12.669 56.304-50.674 92.9-104.16 36.598-53.489 8.447-59.12-18.298-74.603-26.744-15.483-49.266-42.228-67.564-112.61"
stroke-width="5"/>
<path id="path78" d="m1112.8 452.42h-129.5m-696.76 0.223h544.74m-22.522 150.61v-54.895"
stroke-width="2"/>
</g>
<g stroke-width="2">
<rect id="rect80" transform="scale(1 -1)" x="558.65" y="-503.55" width="41.286" height="14.541"
rx="2.933" ry="7.379" fill="#e6e6e6"/>
<rect id="rect82" transform="scale(1 -1)" x="816.24" y="-503.55" width="41.286" height="14.541"
rx="2.933" ry="7.379" fill="#e6e6e6"/>
<rect id="rect84" transform="scale(1 -1)" x="259.53" y="-502.15" width="18.776" height="11.738"
rx="1.63" ry="7.692" fill="#ffcb00"/>
<circle id="circle86" transform="translate(941.34 284)" cx="59.119" cy="211.28" r="16.891" fill="#fff"/>
</g>
</g>
<path id="path90" d="m-126.58 704.93v260.4" fill="none" stroke="#000" stroke-width="2"/>
<path id="path92" d="m-153.88 992.49v-26.041h45.043v52.08h-45.043zm0-316.71v-27.448h45.043v54.898h-45.043z"
fill="#ffffc0"/>
<g fill="none" stroke="#000">
<path id="path94"
d="m-157.4 624.38s-4.223-12.669-18.299-12.669-14.076 8.446-14.076 8.446v423.69s1.408 9.853 14.076 9.853c12.669 0 18.3-9.853 18.3-9.853"
stroke-width="5"/>
<path id="path96" d="m-191.18 624.38s-35.19-1.408-35.19 21.114v371.6c0 22.521 36.597 25.336 36.597 25.336"
stroke-width="5"/>
<g stroke-width="2">
<rect id="rect98" x="-216.51" y="648.31" width="16.891" height="35.19" rx="7.742" ry="6.284"/>
<rect id="rect100" x="-216.51" y="985.58" width="16.891" height="35.19" rx="7.742" ry="6.284"/>
<path id="path102" d="m-62.939 645.49h30.967v377.24h-30.967z"/>
</g>
<path id="path104"
d="m1200.9 633.86v73.195h67.565v-83.048l-25.337-14.076zm0 329.38h67.565v78.826l-23.93 14.076-43.635-18.3zm0-270.26v284.33m67.565-283.74v284.33"
stroke-width="5"/>
<path id="path106"
d="m1216.6 759.51h14.076v147.8h-14.076zm7.631-1.408v-53.488m0 257.37v-53.49m30.375-201.06v256.18"
stroke-width="2"/>
<path id="path108"
d="m1268.8 624.97s4.223-12.668 18.299-12.668 14.076 8.445 14.076 8.445v423.69s-1.408 9.853-14.076 9.853c-12.669 0-18.299-9.853-18.299-9.853m33.783-419.46s35.19-1.408 35.19 21.114v371.6c0 22.521-36.598 25.337-36.598 25.337"
stroke-width="5"/>
<g stroke-width="2">
<rect id="rect110" transform="scale(-1 1)" x="-1329.9" y="648.9" width="16.891" height="35.19"
rx="7.742" ry="6.284"/>
<rect id="rect112" transform="scale(-1 1)" x="-1329.9" y="986.17" width="16.891" height="35.19"
rx="7.742" ry="6.284"/>
<path id="path114"
d="m1199.7 632.82 67.565 74.603m-67.565 0.592 67.565-73.195m-67.342 328.16 67.565 74.602m-67.565 0.593 67.565-73.195"/>
</g>
</g>
<g stroke="#000">
<g stroke-width="2">
<circle id="circle116" transform="translate(78.489 1074.7)" cx="119.65" cy="202.84" r="76.01"
fill="#c8c8c8"/>
<circle id="circle118" transform="translate(94.676 1204.9)" cx="103.46" cy="72.633" r="44.339"
fill="#fff"/>
<circle id="circle120" transform="translate(78.489 187.66)" cx="119.65" cy="202.84" r="76.01"
fill="#c8c8c8"/>
<circle id="circle122" transform="translate(94.676 317.86)" cx="103.46" cy="72.633" r="44.339"
fill="#fff"/>
<circle id="circle124" transform="translate(773.02 187.66)" cx="119.65" cy="202.84" r="76.01"
fill="#c8c8c8"/>
<circle id="circle126" transform="translate(789.21 317.86)" cx="103.46" cy="72.633" r="44.339"
fill="#fff"/>
<circle id="circle128" transform="translate(773.02 1074.7)" cx="119.65" cy="202.84" r="76.01"
fill="#c8c8c8"/>
<circle id="circle130" transform="translate(789.21 1204.9)" cx="103.46" cy="72.633" r="44.339"
fill="#fff"/>
</g>
<path id="path132" d="m1338.5 829.07h40.82" fill="none" stroke-width="5"/>
<circle id="circle134" transform="translate(1441.3 600.31)" cx="-59.119" cy="229.58" r="4.223"
fill="#3c3c3c" stroke-width="5"/>
<g stroke-width="2">
<path id="path136" d="m778.06 845.37-38.709-38.709" fill="none"/>
<g id="g146" transform="translate(-13.78 15.524)" fill="#3c3c3c">
<circle id="circle138" transform="translate(-79.458 449.8)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle140" transform="translate(-79.458 569.92)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle142" transform="translate(-79.458 690.03)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle144" transform="translate(-79.458 810.15)" cx="-81.641" cy="188.76" r="4.223"/>
</g>
<g id="g156" transform="translate(-13.78 17.524)" fill="#3c3c3c">
<circle id="circle148" transform="translate(1381.6 448.25)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle150" transform="translate(1381.6 568.36)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle152" transform="translate(1381.6 688.48)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle154" transform="translate(1381.6 808.59)" cx="-81.641" cy="188.76" r="4.223"/>
</g>
</g>
</g>
</g>
<g id="g156" transform="translate(-13.78 17.524)" fill="#3c3c3c">
<circle id="circle148" transform="translate(1381.6 448.25)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle150" transform="translate(1381.6 568.36)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle152" transform="translate(1381.6 688.48)" cx="-81.641" cy="188.76" r="4.223"/>
<circle id="circle154" transform="translate(1381.6 808.59)" cx="-81.641" cy="188.76" r="4.223"/>
<g id="layer2" fill="#d00000">
<circle id="p02" cx="503.65" cy="248.75" r="61.935"/>
<circle id="p03" cx="863.41" cy="248.75" r="61.935"/>
<circle id="p04" cx="1181.5" cy="248.75" r="61.935"/>
<circle id="p05" cx="1378.4" cy="151.16" r="61.935"/>
<circle id="p06" cx="1535.1" cy="581.37" r="61.935"/>
<circle id="p07" cx="1378.4" cy="997.9" r="61.935"/>
<circle id="p08" cx="1181.5" cy="914.24" r="61.935"/>
<circle id="p09" transform="scale(1,-1)" cx="863.41" cy="-914.24" r="61.935"/>
<circle id="p10" cx="503.65" cy="914.24" r="61.935"/>
<circle id="p11" cx="297.77" cy="997.9" r="61.935"/>
<circle id="p12" cx="93.269" cy="581.37" r="61.935"/>
<circle id="p25" cx="424.31" cy="581.37" r="61.935"/>
<circle id="p27" cx="972.84" cy="581.37" r="61.935"/>
<circle id="p01" cx="297.77" cy="151.16" r="61.935"/>
<circle id="p26" cx="1339.4" cy="581.37" r="61.935"/>
</g>
<g id="g4994" fill="#ffef00">
<circle id="s02" cx="503.65" cy="248.75" r="61.935"/>
<circle id="s03" cx="863.41" cy="248.75" r="61.935"/>
<circle id="s04" cx="1181.5" cy="248.75" r="61.935"/>
<circle id="s05" cx="1378.4" cy="151.16" r="61.935"/>
<circle id="s06" cx="1535.1" cy="581.37" r="61.935"/>
<circle id="s07" cx="1378.4" cy="997.9" r="61.935"/>
<circle id="s08" cx="1181.5" cy="914.24" r="61.935"/>
<circle id="s09" transform="scale(1,-1)" cx="863.41" cy="-914.24" r="61.935"/>
<circle id="s10" cx="503.65" cy="914.24" r="61.935"/>
<circle id="s11" cx="297.77" cy="997.9" r="61.935"/>
<circle id="s12" cx="93.269" cy="581.37" r="61.935"/>
<circle id="s25" cx="424.31" cy="581.37" r="61.935"/>
<circle id="s27" cx="972.84" cy="581.37" r="61.935"/>
<circle id="s01" cx="297.77" cy="151.16" r="61.935"/>
<circle id="s26" cx="1339.4" cy="581.37" r="61.935"/>
</g>
<g id="layer3">
<text id="p15" opacity="0" x="382.62802" y="1034.3463" fill="#fd0000" font-family="sans-serif"
font-size="1696.9px" letter-spacing="0px" stroke-width="17.676" word-spacing="0px"
style="line-height:5.25" xml:space="preserve"><tspan id="tspan4997" x="382.62802" y="1034.3463" fill="#fd0000" stroke-width="17.676">x</tspan></text>
</g>
</g>
</g>
</g>
<g id="layer2" fill="#d00000">
<circle id="p02" cx="503.65" cy="248.75" r="61.935" />
<circle id="p03" cx="863.41" cy="248.75" r="61.935"/>
<circle id="p04" cx="1181.5" cy="248.75" r="61.935"/>
<circle id="p05" cx="1378.4" cy="151.16" r="61.935"/>
<circle id="p06" cx="1535.1" cy="581.37" r="61.935"/>
<circle id="p07" cx="1378.4" cy="997.9" r="61.935"/>
<circle id="p08" cx="1181.5" cy="914.24" r="61.935"/>
<circle id="p09" transform="scale(1,-1)" cx="863.41" cy="-914.24" r="61.935"/>
<circle id="p10" cx="503.65" cy="914.24" r="61.935"/>
<circle id="p11" cx="297.77" cy="997.9" r="61.935"/>
<circle id="p12" cx="93.269" cy="581.37" r="61.935"/>
<circle id="p25" cx="424.31" cy="581.37" r="61.935"/>
<circle id="p27" cx="972.84" cy="581.37" r="61.935"/>
<circle id="p01" cx="297.77" cy="151.16" r="61.935"/>
<circle id="p26" cx="1339.4" cy="581.37" r="61.935"/>
</g>
<g id="g4994" fill="#ffef00">
<circle id="s02" cx="503.65" cy="248.75" r="61.935"/>
<circle id="s03" cx="863.41" cy="248.75" r="61.935"/>
<circle id="s04" cx="1181.5" cy="248.75" r="61.935"/>
<circle id="s05" cx="1378.4" cy="151.16" r="61.935"/>
<circle id="s06" cx="1535.1" cy="581.37" r="61.935"/>
<circle id="s07" cx="1378.4" cy="997.9" r="61.935"/>
<circle id="s08" cx="1181.5" cy="914.24" r="61.935"/>
<circle id="s09" transform="scale(1,-1)" cx="863.41" cy="-914.24" r="61.935"/>
<circle id="s10" cx="503.65" cy="914.24" r="61.935"/>
<circle id="s11" cx="297.77" cy="997.9" r="61.935"/>
<circle id="s12" cx="93.269" cy="581.37" r="61.935"/>
<circle id="s25" cx="424.31" cy="581.37" r="61.935"/>
<circle id="s27" cx="972.84" cy="581.37" r="61.935"/>
<circle id="s01" cx="297.77" cy="151.16" r="61.935"/>
<circle id="s26" cx="1339.4" cy="581.37" r="61.935"/>
</g>
<g id="layer3">
<text id="p15" opacity="0" x="382.62802" y="1034.3463" fill="#fd0000" font-family="sans-serif" font-size="1696.9px" letter-spacing="0px" stroke-width="17.676" word-spacing="0px" style="line-height:5.25" xml:space="preserve"><tspan id="tspan4997" x="382.62802" y="1034.3463" fill="#fd0000" stroke-width="17.676">x</tspan></text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -9,7 +9,7 @@ function PrivateRoute({component: Component, isAuthorized, ...rest}) {
if (!isAuthorized) {
navigate(`/signin?redirect=${location.pathname}`);
}
}, [isAuthorized, navigate,location]);
}, [isAuthorized, navigate, location]);
return <Outlet/>;
}

View File

@@ -1,31 +1,31 @@
import { Button } from "antd";
import {Button} from "antd";
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { setModalContext } from "../../redux/modals/modals.actions";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {setModalContext} from "../../redux/modals/modals.actions";
const mapStateToProps = createStructuredSelector({});
const mapDispatchToProps = (dispatch) => ({
setRefundPaymentContext: (context) =>
dispatch(setModalContext({ context: context, modal: "refund_payment" })),
setRefundPaymentContext: (context) =>
dispatch(setModalContext({context: context, modal: "refund_payment"})),
});
function Test({ setRefundPaymentContext, refundPaymentModal }) {
console.log("refundPaymentModal", refundPaymentModal);
return (
<div>
<Button
onClick={() =>
setRefundPaymentContext({
context: {},
})
}
>
Open Modal
</Button>
</div>
);
function Test({setRefundPaymentContext, refundPaymentModal}) {
console.log("refundPaymentModal", refundPaymentModal);
return (
<div>
<Button
onClick={() =>
setRefundPaymentContext({
context: {},
})
}
>
Open Modal
</Button>
</div>
);
}
export default connect(mapStateToProps, mapDispatchToProps)(Test);

View File

@@ -1,233 +1,233 @@
import { Input, Table, Checkbox, Card, Space } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import {Card, Checkbox, Input, Space, Table} from "antd";
import React, {useState} from "react";
import {useTranslation} from "react-i18next";
import {Link} from "react-router-dom";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { alphaSort, dateSort } from "../../utils/sorters";
import {alphaSort, dateSort} from "../../utils/sorters";
import PayableExportButton from "../payable-export-button/payable-export-button.component";
import PayableExportAll from "../payable-export-all-button/payable-export-all-button.component";
import { DateFormatter } from "../../utils/DateFormatter";
import {DateFormatter} from "../../utils/DateFormatter";
import queryString from "query-string";
import { logImEXEvent } from "../../firebase/firebase.utils";
import {logImEXEvent} from "../../firebase/firebase.utils";
import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {selectBodyshop} from "../../redux/user/user.selectors";
import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component";
import BillMarkSelectedExported from "../payable-mark-selected-exported/payable-mark-selected-exported.component";
import {pageLimit} from "../../utils/config";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(
mapStateToProps,
mapDispatchToProps
mapStateToProps,
mapDispatchToProps
)(AccountingPayablesTableComponent);
export function AccountingPayablesTableComponent({
bodyshop,
loading,
bills,
refetch,
}) {
const { t } = useTranslation();
const [selectedBills, setSelectedBills] = useState([]);
const [transInProgress, setTransInProgress] = useState(false);
const [state, setState] = useState({
sortedInfo: {},
search: "",
});
bodyshop,
loading,
bills,
refetch,
}) {
const {t} = useTranslation();
const [selectedBills, setSelectedBills] = useState([]);
const [transInProgress, setTransInProgress] = useState(false);
const [state, setState] = useState({
sortedInfo: {},
search: "",
});
const handleTableChange = (pagination, filters, sorter) => {
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
};
const handleTableChange = (pagination, filters, sorter) => {
setState({...state, filteredInfo: filters, sortedInfo: sorter});
};
const columns = [
{
title: t("bills.fields.vendorname"),
dataIndex: "vendorname",
key: "vendorname",
sorter: (a, b) => alphaSort(a.vendor.name, b.vendor.name),
sortOrder:
state.sortedInfo.columnKey === "vendorname" && state.sortedInfo.order,
render: (text, record) => (
<Link
to={{
pathname: `/manage/shop/vendors`,
search: queryString.stringify({ selectedvendor: record.vendor.id }),
}}
const columns = [
{
title: t("bills.fields.vendorname"),
dataIndex: "vendorname",
key: "vendorname",
sorter: (a, b) => alphaSort(a.vendor.name, b.vendor.name),
sortOrder:
state.sortedInfo.columnKey === "vendorname" && state.sortedInfo.order,
render: (text, record) => (
<Link
to={{
pathname: `/manage/shop/vendors`,
search: queryString.stringify({selectedvendor: record.vendor.id}),
}}
>
{record.vendor.name}
</Link>
),
},
{
title: t("bills.fields.invoice_number"),
dataIndex: "invoice_number",
key: "invoice_number",
sorter: (a, b) => alphaSort(a.invoice_number, b.invoice_number),
sortOrder:
state.sortedInfo.columnKey === "invoice_number" &&
state.sortedInfo.order,
render: (text, record) => (
<Link
to={{
pathname: `/manage/bills`,
search: queryString.stringify({
billid: record.id,
vendorid: record.vendor.id,
}),
}}
>
{record.invoice_number}
</Link>
),
},
{
title: t("jobs.fields.ro_number"),
dataIndex: "ro_number",
key: "ro_number",
sorter: (a, b) => alphaSort(a.job.ro_number, b.job.ro_number),
sortOrder:
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
render: (text, record) => (
<Link to={`/manage/jobs/${record.job.id}`}>{record.job.ro_number}</Link>
),
},
{
title: t("bills.fields.date"),
dataIndex: "date",
key: "date",
sorter: (a, b) => dateSort(a.date, b.date),
sortOrder:
state.sortedInfo.columnKey === "date" && state.sortedInfo.order,
render: (text, record) => <DateFormatter>{record.date}</DateFormatter>,
},
{
title: t("bills.fields.total"),
dataIndex: "total",
key: "total",
sorter: (a, b) => a.total - b.total,
sortOrder:
state.sortedInfo.columnKey === "total" && state.sortedInfo.order,
render: (text, record) => (
<CurrencyFormatter>{record.total}</CurrencyFormatter>
),
},
{
title: t("bills.fields.is_credit_memo"),
dataIndex: "is_credit_memo",
key: "is_credit_memo",
sorter: (a, b) => a.is_credit_memo - b.is_credit_memo,
sortOrder:
state.sortedInfo.columnKey === "is_credit_memo" &&
state.sortedInfo.order,
render: (text, record) => (
<Checkbox disabled checked={record.is_credit_memo}/>
),
},
{
title: t("exportlogs.labels.attempts"),
dataIndex: "attempts",
key: "attempts",
render: (text, record) => (
<ExportLogsCountDisplay logs={record.exportlogs}/>
),
},
{
title: t("general.labels.actions"),
dataIndex: "actions",
key: "actions",
sorter: (a, b) => a.clm_total - b.clm_total,
render: (text, record) => (
<PayableExportButton
billId={record.id}
disabled={transInProgress || !!record.exported}
loadingCallback={setTransInProgress}
setSelectedBills={setSelectedBills}
refetch={refetch}
/>
),
},
];
const handleSearch = (e) => {
setState({...state, search: e.target.value});
logImEXEvent("accounting_payables_table_search");
};
const dataSource = state.search
? bills.filter(
(v) =>
(v.vendor.name || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.invoice_number || "")
.toLowerCase()
.includes(state.search.toLowerCase())
)
: bills;
return (
<Card
extra={
<Space wrap>
<BillMarkSelectedExported
billids={selectedBills}
disabled={transInProgress || selectedBills.length === 0}
loadingCallback={setTransInProgress}
completedCallback={setSelectedBills}
refetch={refetch}
/>
<PayableExportAll
billids={selectedBills}
disabled={transInProgress || selectedBills.length === 0}
loadingCallback={setTransInProgress}
completedCallback={setSelectedBills}
refetch={refetch}
/>
{bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && (
<QboAuthorizeComponent/>
)}
<Input
value={state.search}
onChange={handleSearch}
placeholder={t("general.labels.search")}
allowClear
/>
</Space>
}
>
{record.vendor.name}
</Link>
),
},
{
title: t("bills.fields.invoice_number"),
dataIndex: "invoice_number",
key: "invoice_number",
sorter: (a, b) => alphaSort(a.invoice_number, b.invoice_number),
sortOrder:
state.sortedInfo.columnKey === "invoice_number" &&
state.sortedInfo.order,
render: (text, record) => (
<Link
to={{
pathname: `/manage/bills`,
search: queryString.stringify({
billid: record.id,
vendorid: record.vendor.id,
}),
}}
>
{record.invoice_number}
</Link>
),
},
{
title: t("jobs.fields.ro_number"),
dataIndex: "ro_number",
key: "ro_number",
sorter: (a, b) => alphaSort(a.job.ro_number, b.job.ro_number),
sortOrder:
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
render: (text, record) => (
<Link to={`/manage/jobs/${record.job.id}`}>{record.job.ro_number}</Link>
),
},
{
title: t("bills.fields.date"),
dataIndex: "date",
key: "date",
sorter: (a, b) => dateSort(a.date, b.date),
sortOrder:
state.sortedInfo.columnKey === "date" && state.sortedInfo.order,
render: (text, record) => <DateFormatter>{record.date}</DateFormatter>,
},
{
title: t("bills.fields.total"),
dataIndex: "total",
key: "total",
sorter: (a, b) => a.total - b.total,
sortOrder:
state.sortedInfo.columnKey === "total" && state.sortedInfo.order,
render: (text, record) => (
<CurrencyFormatter>{record.total}</CurrencyFormatter>
),
},
{
title: t("bills.fields.is_credit_memo"),
dataIndex: "is_credit_memo",
key: "is_credit_memo",
sorter: (a, b) => a.is_credit_memo - b.is_credit_memo,
sortOrder:
state.sortedInfo.columnKey === "is_credit_memo" &&
state.sortedInfo.order,
render: (text, record) => (
<Checkbox disabled checked={record.is_credit_memo} />
),
},
{
title: t("exportlogs.labels.attempts"),
dataIndex: "attempts",
key: "attempts",
render: (text, record) => (
<ExportLogsCountDisplay logs={record.exportlogs} />
),
},
{
title: t("general.labels.actions"),
dataIndex: "actions",
key: "actions",
sorter: (a, b) => a.clm_total - b.clm_total,
render: (text, record) => (
<PayableExportButton
billId={record.id}
disabled={transInProgress || !!record.exported}
loadingCallback={setTransInProgress}
setSelectedBills={setSelectedBills}
refetch={refetch}
/>
),
},
];
const handleSearch = (e) => {
setState({ ...state, search: e.target.value });
logImEXEvent("accounting_payables_table_search");
};
const dataSource = state.search
? bills.filter(
(v) =>
(v.vendor.name || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.invoice_number || "")
.toLowerCase()
.includes(state.search.toLowerCase())
)
: bills;
return (
<Card
extra={
<Space wrap>
<BillMarkSelectedExported
billids={selectedBills}
disabled={transInProgress || selectedBills.length === 0}
loadingCallback={setTransInProgress}
completedCallback={setSelectedBills}
refetch={refetch}
/>
<PayableExportAll
billids={selectedBills}
disabled={transInProgress || selectedBills.length === 0}
loadingCallback={setTransInProgress}
completedCallback={setSelectedBills}
refetch={refetch}
/>
{bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && (
<QboAuthorizeComponent />
)}
<Input
value={state.search}
onChange={handleSearch}
placeholder={t("general.labels.search")}
allowClear
/>
</Space>
}
>
<Table
loading={loading}
dataSource={dataSource}
pagination={{ position: "top", pageSize: pageLimit }}
columns={columns}
rowKey="id"
onChange={handleTableChange}
rowSelection={{
onSelectAll: (selected, selectedRows) =>
setSelectedBills(selectedRows.map((i) => i.id)),
onSelect: (record, selected, selectedRows, nativeEvent) => {
setSelectedBills(selectedRows.map((i) => i.id));
},
getCheckboxProps: (record) => ({
disabled: record.exported,
}),
selectedRowKeys: selectedBills,
type: "checkbox",
}}
/>
</Card>
);
<Table
loading={loading}
dataSource={dataSource}
pagination={{position: "top", pageSize: pageLimit}}
columns={columns}
rowKey="id"
onChange={handleTableChange}
rowSelection={{
onSelectAll: (selected, selectedRows) =>
setSelectedBills(selectedRows.map((i) => i.id)),
onSelect: (record, selected, selectedRows, nativeEvent) => {
setSelectedBills(selectedRows.map((i) => i.id));
},
getCheckboxProps: (record) => ({
disabled: record.exported,
}),
selectedRowKeys: selectedBills,
type: "checkbox",
}}
/>
</Card>
);
}

View File

@@ -1,14 +1,14 @@
import { Card, Input, Space, Table } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { logImEXEvent } from "../../firebase/firebase.utils";
import { selectBodyshop } from "../../redux/user/user.selectors";
import {Card, Input, Space, Table} from "antd";
import React, {useState} from "react";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {Link} from "react-router-dom";
import {createStructuredSelector} from "reselect";
import {logImEXEvent} from "../../firebase/firebase.utils";
import {selectBodyshop} from "../../redux/user/user.selectors";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
import { alphaSort, dateSort } from "../../utils/sorters";
import {DateFormatter, DateTimeFormatter} from "../../utils/DateFormatter";
import {alphaSort, dateSort} from "../../utils/sorters";
import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component";
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
import PaymentExportButton from "../payment-export-button/payment-export-button.component";
@@ -18,215 +18,215 @@ import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component";
import {pageLimit} from "../../utils/config";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(
mapStateToProps,
mapDispatchToProps
mapStateToProps,
mapDispatchToProps
)(AccountingPayablesTableComponent);
export function AccountingPayablesTableComponent({
bodyshop,
loading,
payments,
refetch,
}) {
const { t } = useTranslation();
const [selectedPayments, setSelectedPayments] = useState([]);
const [transInProgress, setTransInProgress] = useState(false);
const [state, setState] = useState({
sortedInfo: {},
search: "",
});
bodyshop,
loading,
payments,
refetch,
}) {
const {t} = useTranslation();
const [selectedPayments, setSelectedPayments] = useState([]);
const [transInProgress, setTransInProgress] = useState(false);
const [state, setState] = useState({
sortedInfo: {},
search: "",
});
const handleTableChange = (pagination, filters, sorter) => {
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
};
const handleTableChange = (pagination, filters, sorter) => {
setState({...state, filteredInfo: filters, sortedInfo: sorter});
};
const columns = [
{
title: t("jobs.fields.ro_number"),
dataIndex: "ro_number",
key: "ro_number",
sorter: (a, b) => alphaSort(a.job.ro_number, b.job.ro_number),
sortOrder:
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
render: (text, record) => (
<Link to={"/manage/jobs/" + record.job.id}>{record.job.ro_number}</Link>
),
},
{
title: t("payments.fields.date"),
dataIndex: "date",
key: "date",
sorter: (a, b) => dateSort(a.date, b.date),
sortOrder:
state.sortedInfo.columnKey === "date" && state.sortedInfo.order,
render: (text, record) => <DateFormatter>{record.date}</DateFormatter>,
},
const columns = [
{
title: t("jobs.fields.ro_number"),
dataIndex: "ro_number",
key: "ro_number",
sorter: (a, b) => alphaSort(a.job.ro_number, b.job.ro_number),
sortOrder:
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
render: (text, record) => (
<Link to={"/manage/jobs/" + record.job.id}>{record.job.ro_number}</Link>
),
},
{
title: t("payments.fields.date"),
dataIndex: "date",
key: "date",
sorter: (a, b) => dateSort(a.date, b.date),
sortOrder:
state.sortedInfo.columnKey === "date" && state.sortedInfo.order,
render: (text, record) => <DateFormatter>{record.date}</DateFormatter>,
},
{
title: t("jobs.fields.owner"),
dataIndex: "owner",
key: "owner",
ellipsis: true,
sorter: (a, b) => alphaSort(a.job.ownr_ln, b.job.ownr_ln),
sortOrder:
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
render: (text, record) => {
return record.job.owner ? (
<Link to={"/manage/owners/" + record.job.owner.id}>
<OwnerNameDisplay ownerObject={record.job} />
</Link>
) : (
<span>
<OwnerNameDisplay ownerObject={record.job} />
{
title: t("jobs.fields.owner"),
dataIndex: "owner",
key: "owner",
ellipsis: true,
sorter: (a, b) => alphaSort(a.job.ownr_ln, b.job.ownr_ln),
sortOrder:
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
render: (text, record) => {
return record.job.owner ? (
<Link to={"/manage/owners/" + record.job.owner.id}>
<OwnerNameDisplay ownerObject={record.job}/>
</Link>
) : (
<span>
<OwnerNameDisplay ownerObject={record.job}/>
</span>
);
},
},
{
title: t("payments.fields.amount"),
dataIndex: "amount",
key: "amount",
render: (text, record) => (
<CurrencyFormatter>{record.amount}</CurrencyFormatter>
),
},
{
title: t("payments.fields.memo"),
dataIndex: "memo",
key: "memo",
},
{
title: t("payments.fields.transactionid"),
dataIndex: "transactionid",
key: "transactionid",
},
{
title: t("payments.fields.created_at"),
dataIndex: "created_at",
key: "created_at",
render: (text, record) => (
<DateTimeFormatter>{record.created_at}</DateTimeFormatter>
),
},
{
title: t("payments.fields.exportedat"),
dataIndex: "exportedat",
key: "exportedat",
render: (text, record) => (
<DateTimeFormatter>{record.exportedat}</DateTimeFormatter>
),
},
{
title: t("exportlogs.labels.attempts"),
dataIndex: "attempts",
key: "attempts",
);
},
},
{
title: t("payments.fields.amount"),
dataIndex: "amount",
key: "amount",
render: (text, record) => (
<CurrencyFormatter>{record.amount}</CurrencyFormatter>
),
},
{
title: t("payments.fields.memo"),
dataIndex: "memo",
key: "memo",
},
{
title: t("payments.fields.transactionid"),
dataIndex: "transactionid",
key: "transactionid",
},
{
title: t("payments.fields.created_at"),
dataIndex: "created_at",
key: "created_at",
render: (text, record) => (
<DateTimeFormatter>{record.created_at}</DateTimeFormatter>
),
},
{
title: t("payments.fields.exportedat"),
dataIndex: "exportedat",
key: "exportedat",
render: (text, record) => (
<DateTimeFormatter>{record.exportedat}</DateTimeFormatter>
),
},
{
title: t("exportlogs.labels.attempts"),
dataIndex: "attempts",
key: "attempts",
render: (text, record) => (
<ExportLogsCountDisplay logs={record.exportlogs} />
),
},
{
title: t("general.labels.actions"),
dataIndex: "actions",
key: "actions",
sorter: (a, b) => a.clm_total - b.clm_total,
render: (text, record) => (
<ExportLogsCountDisplay logs={record.exportlogs}/>
),
},
{
title: t("general.labels.actions"),
dataIndex: "actions",
key: "actions",
sorter: (a, b) => a.clm_total - b.clm_total,
render: (text, record) => (
<PaymentExportButton
paymentId={record.id}
disabled={transInProgress || !!record.exportedat}
loadingCallback={setTransInProgress}
setSelectedPayments={setSelectedPayments}
refetch={refetch}
/>
),
},
];
render: (text, record) => (
<PaymentExportButton
paymentId={record.id}
disabled={transInProgress || !!record.exportedat}
loadingCallback={setTransInProgress}
setSelectedPayments={setSelectedPayments}
refetch={refetch}
/>
),
},
];
const handleSearch = (e) => {
setState({ ...state, search: e.target.value });
logImEXEvent("account_payments_table_search");
};
const handleSearch = (e) => {
setState({...state, search: e.target.value});
logImEXEvent("account_payments_table_search");
};
const dataSource = state.search
? payments.filter(
(v) =>
(v.paymentnum || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
((v.job && v.job.ro_number) || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
((v.job && v.job.ownr_fn) || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
((v.job && v.job.ownr_ln) || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
((v.job && v.job.ownr_co_nm) || "")
.toLowerCase()
.includes(state.search.toLowerCase())
)
: payments;
const dataSource = state.search
? payments.filter(
(v) =>
(v.paymentnum || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
((v.job && v.job.ro_number) || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
((v.job && v.job.ownr_fn) || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
((v.job && v.job.ownr_ln) || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
((v.job && v.job.ownr_co_nm) || "")
.toLowerCase()
.includes(state.search.toLowerCase())
)
: payments;
return (
<Card
extra={
<Space wrap>
<PaymentMarkSelectedExported
paymentIds={selectedPayments}
disabled={transInProgress || selectedPayments.length === 0}
loadingCallback={setTransInProgress}
completedCallback={setSelectedPayments}
refetch={refetch}
/>
<PaymentsExportAllButton
paymentIds={selectedPayments}
disabled={transInProgress || selectedPayments.length === 0}
loadingCallback={setTransInProgress}
completedCallback={setSelectedPayments}
refetch={refetch}
/>
{bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && (
<QboAuthorizeComponent />
)}
<Input
value={state.search}
onChange={handleSearch}
placeholder={t("general.labels.search")}
allowClear
/>
</Space>
}
>
<Table
loading={loading}
dataSource={dataSource}
pagination={{ position: "top", pageSize: pageLimit }}
columns={columns}
rowKey="id"
onChange={handleTableChange}
rowSelection={{
onSelectAll: (selected, selectedRows) =>
setSelectedPayments(selectedRows.map((i) => i.id)),
onSelect: (record, selected, selectedRows, nativeEvent) => {
setSelectedPayments(selectedRows.map((i) => i.id));
},
getCheckboxProps: (record) => ({
disabled: record.exported,
}),
selectedRowKeys: selectedPayments,
type: "checkbox",
}}
/>
</Card>
);
return (
<Card
extra={
<Space wrap>
<PaymentMarkSelectedExported
paymentIds={selectedPayments}
disabled={transInProgress || selectedPayments.length === 0}
loadingCallback={setTransInProgress}
completedCallback={setSelectedPayments}
refetch={refetch}
/>
<PaymentsExportAllButton
paymentIds={selectedPayments}
disabled={transInProgress || selectedPayments.length === 0}
loadingCallback={setTransInProgress}
completedCallback={setSelectedPayments}
refetch={refetch}
/>
{bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && (
<QboAuthorizeComponent/>
)}
<Input
value={state.search}
onChange={handleSearch}
placeholder={t("general.labels.search")}
allowClear
/>
</Space>
}
>
<Table
loading={loading}
dataSource={dataSource}
pagination={{position: "top", pageSize: pageLimit}}
columns={columns}
rowKey="id"
onChange={handleTableChange}
rowSelection={{
onSelectAll: (selected, selectedRows) =>
setSelectedPayments(selectedRows.map((i) => i.id)),
onSelect: (record, selected, selectedRows, nativeEvent) => {
setSelectedPayments(selectedRows.map((i) => i.id));
},
getCheckboxProps: (record) => ({
disabled: record.exported,
}),
selectedRowKeys: selectedPayments,
type: "checkbox",
}}
/>
</Card>
);
}

View File

@@ -1,247 +1,247 @@
import { Button, Card, Input, Space, Table } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { logImEXEvent } from "../../firebase/firebase.utils";
import {Button, Card, Input, Space, Table} from "antd";
import React, {useState} from "react";
import {useTranslation} from "react-i18next";
import {Link} from "react-router-dom";
import {logImEXEvent} from "../../firebase/firebase.utils";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { alphaSort, dateSort } from "../../utils/sorters";
import {alphaSort, dateSort} from "../../utils/sorters";
import JobExportButton from "../jobs-close-export-button/jobs-close-export-button.component";
import JobsExportAllButton from "../jobs-export-all-button/jobs-export-all-button.component";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {selectBodyshop} from "../../redux/user/user.selectors";
import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component";
import { DateFormatter } from "../../utils/DateFormatter";
import {DateFormatter} from "../../utils/DateFormatter";
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(
mapStateToProps,
mapDispatchToProps
mapStateToProps,
mapDispatchToProps
)(AccountingReceivablesTableComponent);
export function AccountingReceivablesTableComponent({
bodyshop,
loading,
jobs,
refetch,
}) {
const { t } = useTranslation();
const [selectedJobs, setSelectedJobs] = useState([]);
const [transInProgress, setTransInProgress] = useState(false);
bodyshop,
loading,
jobs,
refetch,
}) {
const {t} = useTranslation();
const [selectedJobs, setSelectedJobs] = useState([]);
const [transInProgress, setTransInProgress] = useState(false);
const [state, setState] = useState({
sortedInfo: {},
search: "",
});
const [state, setState] = useState({
sortedInfo: {},
search: "",
});
const handleTableChange = (pagination, filters, sorter) => {
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
};
const handleTableChange = (pagination, filters, sorter) => {
setState({...state, filteredInfo: filters, sortedInfo: sorter});
};
const columns = [
{
title: t("jobs.fields.ro_number"),
dataIndex: "ro_number",
key: "ro_number",
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
sortOrder:
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
render: (text, record) => (
<Link to={"/manage/jobs/" + record.id}>{record.ro_number}</Link>
),
},
const columns = [
{
title: t("jobs.fields.ro_number"),
dataIndex: "ro_number",
key: "ro_number",
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
sortOrder:
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
render: (text, record) => (
<Link to={"/manage/jobs/" + record.id}>{record.ro_number}</Link>
),
},
{
title: t("jobs.fields.status"),
dataIndex: "status",
key: "status",
sorter: (a, b) => a.status - b.status,
sortOrder:
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
},
{
title: t("jobs.fields.date_invoiced"),
dataIndex: "date_invoiced",
key: "date_invoiced",
sorter: (a, b) => dateSort(a.date_invoiced, b.date_invoiced),
sortOrder:
state.sortedInfo.columnKey === "date_invoiced" &&
state.sortedInfo.order,
render: (text, record) => (
<DateFormatter>{record.date_invoiced}</DateFormatter>
),
},
{
title: t("jobs.fields.owner"),
dataIndex: "owner",
key: "owner",
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
sortOrder:
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
render: (text, record) => {
return record.owner ? (
<Link to={"/manage/owners/" + record.owner.id}>
<OwnerNameDisplay ownerObject={record} />
</Link>
) : (
<span>
<OwnerNameDisplay ownerObject={record} />
{
title: t("jobs.fields.status"),
dataIndex: "status",
key: "status",
sorter: (a, b) => a.status - b.status,
sortOrder:
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
},
{
title: t("jobs.fields.date_invoiced"),
dataIndex: "date_invoiced",
key: "date_invoiced",
sorter: (a, b) => dateSort(a.date_invoiced, b.date_invoiced),
sortOrder:
state.sortedInfo.columnKey === "date_invoiced" &&
state.sortedInfo.order,
render: (text, record) => (
<DateFormatter>{record.date_invoiced}</DateFormatter>
),
},
{
title: t("jobs.fields.owner"),
dataIndex: "owner",
key: "owner",
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
sortOrder:
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
render: (text, record) => {
return record.owner ? (
<Link to={"/manage/owners/" + record.owner.id}>
<OwnerNameDisplay ownerObject={record}/>
</Link>
) : (
<span>
<OwnerNameDisplay ownerObject={record}/>
</span>
);
},
},
{
title: t("jobs.fields.vehicle"),
dataIndex: "vehicle",
key: "vehicle",
ellipsis: true,
render: (text, record) => {
return record.vehicleid ? (
<Link to={"/manage/vehicles/" + record.vehicleid}>
{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
record.v_model_desc || ""
}`}
</Link>
) : (
<span>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
record.v_model_desc || ""
}`}</span>
);
},
},
{
title: t("jobs.fields.clm_no"),
dataIndex: "clm_no",
key: "clm_no",
ellipsis: true,
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
sortOrder:
state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order,
},
{
title: t("jobs.fields.clm_total"),
dataIndex: "clm_total",
key: "clm_total",
sorter: (a, b) => a.clm_total - b.clm_total,
sortOrder:
state.sortedInfo.columnKey === "clm_total" && state.sortedInfo.order,
render: (text, record) => {
return <CurrencyFormatter>{record.clm_total}</CurrencyFormatter>;
},
},
{
title: t("exportlogs.labels.attempts"),
dataIndex: "attempts",
key: "attempts",
render: (text, record) => (
<ExportLogsCountDisplay logs={record.exportlogs} />
),
},
{
title: t("general.labels.actions"),
dataIndex: "actions",
key: "actions",
);
},
},
{
title: t("jobs.fields.vehicle"),
dataIndex: "vehicle",
key: "vehicle",
ellipsis: true,
render: (text, record) => {
return record.vehicleid ? (
<Link to={"/manage/vehicles/" + record.vehicleid}>
{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
record.v_model_desc || ""
}`}
</Link>
) : (
<span>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
record.v_model_desc || ""
}`}</span>
);
},
},
{
title: t("jobs.fields.clm_no"),
dataIndex: "clm_no",
key: "clm_no",
ellipsis: true,
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
sortOrder:
state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order,
},
{
title: t("jobs.fields.clm_total"),
dataIndex: "clm_total",
key: "clm_total",
sorter: (a, b) => a.clm_total - b.clm_total,
sortOrder:
state.sortedInfo.columnKey === "clm_total" && state.sortedInfo.order,
render: (text, record) => {
return <CurrencyFormatter>{record.clm_total}</CurrencyFormatter>;
},
},
{
title: t("exportlogs.labels.attempts"),
dataIndex: "attempts",
key: "attempts",
render: (text, record) => (
<ExportLogsCountDisplay logs={record.exportlogs}/>
),
},
{
title: t("general.labels.actions"),
dataIndex: "actions",
key: "actions",
render: (text, record) => (
<Space wrap>
<JobExportButton
jobId={record.id}
disabled={!!record.date_exported}
setSelectedJobs={setSelectedJobs}
refetch={refetch}
/>
<Link to={`/manage/jobs/${record.id}/close`}>
<Button>{t("jobs.labels.viewallocations")}</Button>
</Link>
</Space>
),
},
];
render: (text, record) => (
<Space wrap>
<JobExportButton
jobId={record.id}
disabled={!!record.date_exported}
setSelectedJobs={setSelectedJobs}
refetch={refetch}
/>
<Link to={`/manage/jobs/${record.id}/close`}>
<Button>{t("jobs.labels.viewallocations")}</Button>
</Link>
</Space>
),
},
];
const handleSearch = (e) => {
setState({ ...state, search: e.target.value });
logImEXEvent("accounting_receivables_search");
};
const handleSearch = (e) => {
setState({...state, search: e.target.value});
logImEXEvent("accounting_receivables_search");
};
const dataSource = state.search
? jobs.filter(
(v) =>
(v.ro_number || "")
.toString()
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.ownr_fn || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.ownr_ln || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.ownr_co_nm || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.v_model_desc || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.v_make_desc || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.clm_no || "").toLowerCase().includes(state.search.toLowerCase())
)
: jobs;
const dataSource = state.search
? jobs.filter(
(v) =>
(v.ro_number || "")
.toString()
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.ownr_fn || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.ownr_ln || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.ownr_co_nm || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.v_model_desc || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.v_make_desc || "")
.toLowerCase()
.includes(state.search.toLowerCase()) ||
(v.clm_no || "").toLowerCase().includes(state.search.toLowerCase())
)
: jobs;
return (
<Card
extra={
<Space wrap>
{!bodyshop.cdk_dealerid && !bodyshop.pbs_serialnumber && (
<JobsExportAllButton
jobIds={selectedJobs}
disabled={transInProgress || selectedJobs.length === 0}
loadingCallback={setTransInProgress}
completedCallback={setSelectedJobs}
refetch={refetch}
return (
<Card
extra={
<Space wrap>
{!bodyshop.cdk_dealerid && !bodyshop.pbs_serialnumber && (
<JobsExportAllButton
jobIds={selectedJobs}
disabled={transInProgress || selectedJobs.length === 0}
loadingCallback={setTransInProgress}
completedCallback={setSelectedJobs}
refetch={refetch}
/>
)}
{bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && (
<QboAuthorizeComponent/>
)}
<Input.Search
value={state.search}
onChange={handleSearch}
placeholder={t("general.labels.search")}
allowClear
/>
</Space>
}
>
<Table
loading={loading}
dataSource={dataSource}
pagination={{position: "top"}}
columns={columns}
rowKey="id"
onChange={handleTableChange}
rowSelection={{
onSelectAll: (selected, selectedRows) =>
setSelectedJobs(selectedRows.map((i) => i.id)),
onSelect: (record, selected, selectedRows, nativeEvent) => {
setSelectedJobs(selectedRows.map((i) => i.id));
},
getCheckboxProps: (record) => ({
disabled: record.exported,
}),
selectedRowKeys: selectedJobs,
type: "checkbox",
}}
/>
)}
{bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && (
<QboAuthorizeComponent />
)}
<Input.Search
value={state.search}
onChange={handleSearch}
placeholder={t("general.labels.search")}
allowClear
/>
</Space>
}
>
<Table
loading={loading}
dataSource={dataSource}
pagination={{ position: "top" }}
columns={columns}
rowKey="id"
onChange={handleTableChange}
rowSelection={{
onSelectAll: (selected, selectedRows) =>
setSelectedJobs(selectedRows.map((i) => i.id)),
onSelect: (record, selected, selectedRows, nativeEvent) => {
setSelectedJobs(selectedRows.map((i) => i.id));
},
getCheckboxProps: (record) => ({
disabled: record.exported,
}),
selectedRowKeys: selectedJobs,
type: "checkbox",
}}
/>
</Card>
);
</Card>
);
}

View File

@@ -1,6 +1,6 @@
import { Alert } from "antd";
import {Alert} from "antd";
import React from "react";
export default function AlertComponent(props) {
return <Alert {...props} />;
return <Alert {...props} />;
}

View File

@@ -1,19 +1,19 @@
import { shallow } from "enzyme";
import {shallow} from "enzyme";
import React from "react";
import Alert from "./alert.component";
describe("Alert component", () => {
let wrapper;
beforeEach(() => {
const mockProps = {
type: "error",
message: "Test error message.",
};
let wrapper;
beforeEach(() => {
const mockProps = {
type: "error",
message: "Test error message.",
};
wrapper = shallow(<Alert {...mockProps} />);
});
wrapper = shallow(<Alert {...mockProps} />);
});
it("should render Alert component", () => {
expect(wrapper).toMatchSnapshot();
});
it("should render Alert component", () => {
expect(wrapper).toMatchSnapshot();
});
});

View File

@@ -1,72 +1,72 @@
import { Select, Button, Popover, InputNumber } from "antd";
import {Button, InputNumber, Popover, Select} from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {selectBodyshop} from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop
bodyshop: selectBodyshop
});
export function AllocationsAssignmentComponent({
bodyshop,
handleAssignment,
assignment,
setAssignment,
visibilityState,
maxHours
}) {
const { t } = useTranslation();
bodyshop,
handleAssignment,
assignment,
setAssignment,
visibilityState,
maxHours
}) {
const {t} = useTranslation();
const onChange = e => {
setAssignment({ ...assignment, employeeid: e });
};
const onChange = e => {
setAssignment({...assignment, employeeid: e});
};
const [visibility, setVisibility] = visibilityState;
const [visibility, setVisibility] = visibilityState;
const popContent = (
<div>
<Select id="employeeSelector"
showSearch
style={{ width: 200 }}
placeholder='Select a person'
optionFilterProp='children'
onChange={onChange}
filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}>
{bodyshop.employees.map(emp => (
<Select.Option value={emp.id} key={emp.id}>
{`${emp.first_name} ${emp.last_name}`}
</Select.Option>
))}
</Select>
<InputNumber
defaultValue={assignment.hours}
placeholder={t("joblines.fields.mod_lb_hrs")}
max={parseFloat(maxHours)}
min={0}
onChange={e => setAssignment({ ...assignment, hours: e })}
/>
const popContent = (
<div>
<Select id="employeeSelector"
showSearch
style={{width: 200}}
placeholder='Select a person'
optionFilterProp='children'
onChange={onChange}
filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}>
{bodyshop.employees.map(emp => (
<Select.Option value={emp.id} key={emp.id}>
{`${emp.first_name} ${emp.last_name}`}
</Select.Option>
))}
</Select>
<InputNumber
defaultValue={assignment.hours}
placeholder={t("joblines.fields.mod_lb_hrs")}
max={parseFloat(maxHours)}
min={0}
onChange={e => setAssignment({...assignment, hours: e})}
/>
<Button
type='primary'
disabled={!assignment.employeeid}
onClick={handleAssignment}>
Assign
</Button>
<Button onClick={() => setVisibility(false)}>Close</Button>
</div>
);
<Button
type='primary'
disabled={!assignment.employeeid}
onClick={handleAssignment}>
Assign
</Button>
<Button onClick={() => setVisibility(false)}>Close</Button>
</div>
);
return (
<Popover content={popContent} open={visibility}>
<Button onClick={() => setVisibility(true)}>
{t("allocations.actions.assign")}
</Button>
</Popover>
);
return (
<Popover content={popContent} open={visibility}>
<Button onClick={() => setVisibility(true)}>
{t("allocations.actions.assign")}
</Button>
</Popover>
);
}
export default connect(mapStateToProps, null)(AllocationsAssignmentComponent);

View File

@@ -1,35 +1,35 @@
import { mount } from "enzyme";
import {mount} from "enzyme";
import React from "react";
import { MockBodyshop } from "../../utils/TestingHelpers";
import { AllocationsAssignmentComponent } from "./allocations-assignment.component";
import {MockBodyshop} from "../../utils/TestingHelpers";
import {AllocationsAssignmentComponent} from "./allocations-assignment.component";
describe("AllocationsAssignmentComponent component", () => {
let wrapper;
let wrapper;
beforeEach(() => {
const mockProps = {
bodyshop: MockBodyshop,
handleAssignment: jest.fn(),
assignment: {},
setAssignment: jest.fn(),
visibilityState: [false, jest.fn()],
maxHours: 4,
};
beforeEach(() => {
const mockProps = {
bodyshop: MockBodyshop,
handleAssignment: jest.fn(),
assignment: {},
setAssignment: jest.fn(),
visibilityState: [false, jest.fn()],
maxHours: 4,
};
wrapper = mount(<AllocationsAssignmentComponent {...mockProps} />);
});
wrapper = mount(<AllocationsAssignmentComponent {...mockProps} />);
});
it("should render AllocationsAssignmentComponent component", () => {
expect(wrapper).toMatchSnapshot();
});
it("should render AllocationsAssignmentComponent component", () => {
expect(wrapper).toMatchSnapshot();
});
it("should render a list of employees", () => {
const empList = wrapper.find("#employeeSelector");
expect(empList.children()).to.have.lengthOf(2);
});
it("should render a list of employees", () => {
const empList = wrapper.find("#employeeSelector");
expect(empList.children()).to.have.lengthOf(2);
});
it("should create an allocation on save", () => {
wrapper.find("Button").simulate("click");
expect(wrapper).toMatchSnapshot();
});
it("should create an allocation on save", () => {
wrapper.find("Button").simulate("click");
expect(wrapper).toMatchSnapshot();
});
});

View File

@@ -1,47 +1,47 @@
import React, { useState } from "react";
import React, {useState} from "react";
import AllocationsAssignmentComponent from "./allocations-assignment.component";
import { useMutation } from "@apollo/client";
import { INSERT_ALLOCATION } from "../../graphql/allocations.queries";
import { useTranslation } from "react-i18next";
import { notification } from "antd";
import {useMutation} from "@apollo/client";
import {INSERT_ALLOCATION} from "../../graphql/allocations.queries";
import {useTranslation} from "react-i18next";
import {notification} from "antd";
export default function AllocationsAssignmentContainer({
jobLineId,
hours,
refetch,
}) {
const visibilityState = useState(false);
const { t } = useTranslation();
const [assignment, setAssignment] = useState({
joblineid: jobLineId,
hours: parseFloat(hours),
employeeid: null,
});
const [insertAllocation] = useMutation(INSERT_ALLOCATION);
jobLineId,
hours,
refetch,
}) {
const visibilityState = useState(false);
const {t} = useTranslation();
const [assignment, setAssignment] = useState({
joblineid: jobLineId,
hours: parseFloat(hours),
employeeid: null,
});
const [insertAllocation] = useMutation(INSERT_ALLOCATION);
const handleAssignment = () => {
insertAllocation({ variables: { alloc: { ...assignment } } })
.then((r) => {
notification["success"]({
message: t("allocations.successes.save"),
});
visibilityState[1](false);
if (refetch) refetch();
})
.catch((error) => {
notification["error"]({
message: t("employees.errors.saving", { message: error.message }),
});
});
};
const handleAssignment = () => {
insertAllocation({variables: {alloc: {...assignment}}})
.then((r) => {
notification["success"]({
message: t("allocations.successes.save"),
});
visibilityState[1](false);
if (refetch) refetch();
})
.catch((error) => {
notification["error"]({
message: t("employees.errors.saving", {message: error.message}),
});
});
};
return (
<AllocationsAssignmentComponent
handleAssignment={handleAssignment}
maxHours={hours}
assignment={assignment}
setAssignment={setAssignment}
visibilityState={visibilityState}
/>
);
return (
<AllocationsAssignmentComponent
handleAssignment={handleAssignment}
maxHours={hours}
assignment={assignment}
setAssignment={setAssignment}
visibilityState={visibilityState}
/>
);
}

View File

@@ -1,68 +1,68 @@
import { Button, Popover, Select } from "antd";
import {Button, Popover, Select} from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {selectBodyshop} from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
bodyshop: selectBodyshop,
});
export default connect(
mapStateToProps,
null
mapStateToProps,
null
)(function AllocationsBulkAssignmentComponent({
disabled,
bodyshop,
handleAssignment,
assignment,
setAssignment,
visibilityState,
}) {
const { t } = useTranslation();
disabled,
bodyshop,
handleAssignment,
assignment,
setAssignment,
visibilityState,
}) {
const {t} = useTranslation();
const onChange = (e) => {
setAssignment({ ...assignment, employeeid: e });
};
const onChange = (e) => {
setAssignment({...assignment, employeeid: e});
};
const [visibility, setVisibility] = visibilityState;
const [visibility, setVisibility] = visibilityState;
const popContent = (
<div>
<Select
showSearch
style={{ width: 200 }}
placeholder="Select a person"
optionFilterProp="children"
onChange={onChange}
filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
{bodyshop.employees.map((emp) => (
<Select.Option value={emp.id} key={emp.id}>
{`${emp.first_name} ${emp.last_name}`}
</Select.Option>
))}
</Select>
const popContent = (
<div>
<Select
showSearch
style={{width: 200}}
placeholder="Select a person"
optionFilterProp="children"
onChange={onChange}
filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
{bodyshop.employees.map((emp) => (
<Select.Option value={emp.id} key={emp.id}>
{`${emp.first_name} ${emp.last_name}`}
</Select.Option>
))}
</Select>
<Button
type="primary"
disabled={!assignment.employeeid}
onClick={handleAssignment}
>
Assign
</Button>
<Button onClick={() => setVisibility(false)}>Close</Button>
</div>
);
<Button
type="primary"
disabled={!assignment.employeeid}
onClick={handleAssignment}
>
Assign
</Button>
<Button onClick={() => setVisibility(false)}>Close</Button>
</div>
);
return (
<Popover content={popContent} open={visibility}>
<Button disabled={disabled} onClick={() => setVisibility(true)}>
{t("allocations.actions.assign")}
</Button>
</Popover>
);
return (
<Popover content={popContent} open={visibility}>
<Button disabled={disabled} onClick={() => setVisibility(true)}>
{t("allocations.actions.assign")}
</Button>
</Popover>
);
});

View File

@@ -1,47 +1,47 @@
import React, { useState } from "react";
import React, {useState} from "react";
import AllocationsBulkAssignment from "./allocations-bulk-assignment.component";
import { useMutation } from "@apollo/client";
import { INSERT_ALLOCATION } from "../../graphql/allocations.queries";
import { useTranslation } from "react-i18next";
import { notification } from "antd";
import {useMutation} from "@apollo/client";
import {INSERT_ALLOCATION} from "../../graphql/allocations.queries";
import {useTranslation} from "react-i18next";
import {notification} from "antd";
export default function AllocationsBulkAssignmentContainer({
jobLines,
refetch,
}) {
const visibilityState = useState(false);
const { t } = useTranslation();
const [assignment, setAssignment] = useState({
employeeid: null,
});
const [insertAllocation] = useMutation(INSERT_ALLOCATION);
const handleAssignment = () => {
const allocs = jobLines.reduce((acc, value) => {
acc.push({
joblineid: value.id,
hours: parseFloat(value.mod_lb_hrs) || 0,
employeeid: assignment.employeeid,
});
return acc;
}, []);
insertAllocation({ variables: { alloc: allocs } }).then((r) => {
notification["success"]({
message: t("employees.successes.save"),
});
visibilityState[1](false);
if (refetch) refetch();
jobLines,
refetch,
}) {
const visibilityState = useState(false);
const {t} = useTranslation();
const [assignment, setAssignment] = useState({
employeeid: null,
});
};
const [insertAllocation] = useMutation(INSERT_ALLOCATION);
return (
<AllocationsBulkAssignment
disabled={jobLines.length > 0 ? false : true}
handleAssignment={handleAssignment}
assignment={assignment}
setAssignment={setAssignment}
visibilityState={visibilityState}
/>
);
const handleAssignment = () => {
const allocs = jobLines.reduce((acc, value) => {
acc.push({
joblineid: value.id,
hours: parseFloat(value.mod_lb_hrs) || 0,
employeeid: assignment.employeeid,
});
return acc;
}, []);
insertAllocation({variables: {alloc: allocs}}).then((r) => {
notification["success"]({
message: t("employees.successes.save"),
});
visibilityState[1](false);
if (refetch) refetch();
});
};
return (
<AllocationsBulkAssignment
disabled={jobLines.length > 0 ? false : true}
handleAssignment={handleAssignment}
assignment={assignment}
setAssignment={setAssignment}
visibilityState={visibilityState}
/>
);
}

View File

@@ -1,20 +1,20 @@
import Icon from "@ant-design/icons";
import React from "react";
import { MdRemoveCircleOutline } from "react-icons/md";
import {MdRemoveCircleOutline} from "react-icons/md";
export default function AllocationsLabelComponent({ allocation, handleClick }) {
return (
<div style={{ display: "flex", alignItems: "center" }}>
export default function AllocationsLabelComponent({allocation, handleClick}) {
return (
<div style={{display: "flex", alignItems: "center"}}>
<span>
{`${allocation.employee.first_name || ""} ${
allocation.employee.last_name || ""
allocation.employee.last_name || ""
} (${allocation.hours || ""})`}
</span>
<Icon
style={{ color: "red", padding: "0px 4px" }}
component={MdRemoveCircleOutline}
onClick={handleClick}
/>
</div>
);
<Icon
style={{color: "red", padding: "0px 4px"}}
component={MdRemoveCircleOutline}
onClick={handleClick}
/>
</div>
);
}

View File

@@ -1,32 +1,32 @@
import React from "react";
import { useMutation } from "@apollo/client";
import { DELETE_ALLOCATION } from "../../graphql/allocations.queries";
import {useMutation} from "@apollo/client";
import {DELETE_ALLOCATION} from "../../graphql/allocations.queries";
import AllocationsLabelComponent from "./allocations-employee-label.component";
import { notification } from "antd";
import { useTranslation } from "react-i18next";
import {notification} from "antd";
import {useTranslation} from "react-i18next";
export default function AllocationsLabelContainer({ allocation, refetch }) {
const [deleteAllocation] = useMutation(DELETE_ALLOCATION);
const { t } = useTranslation();
export default function AllocationsLabelContainer({allocation, refetch}) {
const [deleteAllocation] = useMutation(DELETE_ALLOCATION);
const {t} = useTranslation();
const handleClick = (e) => {
e.preventDefault();
deleteAllocation({ variables: { id: allocation.id } })
.then((r) => {
notification["success"]({
message: t("allocations.successes.deleted"),
});
if (refetch) refetch();
})
.catch((error) => {
notification["error"]({ message: t("allocations.errors.deleting") });
});
};
const handleClick = (e) => {
e.preventDefault();
deleteAllocation({variables: {id: allocation.id}})
.then((r) => {
notification["success"]({
message: t("allocations.successes.deleted"),
});
if (refetch) refetch();
})
.catch((error) => {
notification["error"]({message: t("allocations.errors.deleting")});
});
};
return (
<AllocationsLabelComponent
allocation={allocation}
handleClick={handleClick}
/>
);
return (
<AllocationsLabelComponent
allocation={allocation}
handleClick={handleClick}
/>
);
}

View File

@@ -1,85 +1,85 @@
import React, { useState } from "react";
import { Table } from "antd";
import { alphaSort } from "../../utils/sorters";
import { DateTimeFormatter } from "../../utils/DateFormatter";
import { useTranslation } from "react-i18next";
import React, {useState} from "react";
import {Table} from "antd";
import {alphaSort} from "../../utils/sorters";
import {DateTimeFormatter} from "../../utils/DateFormatter";
import {useTranslation} from "react-i18next";
import AuditTrailValuesComponent from "../audit-trail-values/audit-trail-values.component";
import {pageLimit} from "../../utils/config";
export default function AuditTrailListComponent({ loading, data }) {
const [state, setState] = useState({
sortedInfo: {},
filteredInfo: {},
});
const { t } = useTranslation();
const columns = [
{
title: t("audit.fields.created"),
dataIndex: " created",
key: " created",
width: "10%",
render: (text, record) => (
<DateTimeFormatter>{record.created}</DateTimeFormatter>
),
sorter: (a, b) => a.created - b.created,
sortOrder:
state.sortedInfo.columnKey === "created" && state.sortedInfo.order,
},
{
title: t("audit.fields.operation"),
dataIndex: "operation",
key: "operation",
width: "10%",
sorter: (a, b) => alphaSort(a.operation, b.operation),
sortOrder:
state.sortedInfo.columnKey === "operation" && state.sortedInfo.order,
},
{
title: t("audit.fields.values"),
dataIndex: " old_val",
key: " old_val",
width: "10%",
render: (text, record) => (
<AuditTrailValuesComponent
oldV={record.old_val}
newV={record.new_val}
export default function AuditTrailListComponent({loading, data}) {
const [state, setState] = useState({
sortedInfo: {},
filteredInfo: {},
});
const {t} = useTranslation();
const columns = [
{
title: t("audit.fields.created"),
dataIndex: " created",
key: " created",
width: "10%",
render: (text, record) => (
<DateTimeFormatter>{record.created}</DateTimeFormatter>
),
sorter: (a, b) => a.created - b.created,
sortOrder:
state.sortedInfo.columnKey === "created" && state.sortedInfo.order,
},
{
title: t("audit.fields.operation"),
dataIndex: "operation",
key: "operation",
width: "10%",
sorter: (a, b) => alphaSort(a.operation, b.operation),
sortOrder:
state.sortedInfo.columnKey === "operation" && state.sortedInfo.order,
},
{
title: t("audit.fields.values"),
dataIndex: " old_val",
key: " old_val",
width: "10%",
render: (text, record) => (
<AuditTrailValuesComponent
oldV={record.old_val}
newV={record.new_val}
/>
),
},
{
title: t("audit.fields.useremail"),
dataIndex: "useremail",
key: "useremail",
width: "10%",
sorter: (a, b) => alphaSort(a.useremail, b.useremail),
sortOrder:
state.sortedInfo.columnKey === "useremail" && state.sortedInfo.order,
},
];
const formItemLayout = {
labelCol: {
xs: {span: 12},
sm: {span: 5},
},
wrapperCol: {
xs: {span: 24},
sm: {span: 12},
},
};
const handleTableChange = (pagination, filters, sorter) => {
setState({...state, filteredInfo: filters, sortedInfo: sorter});
};
return (
<Table
{...formItemLayout}
loading={loading}
pagination={{position: "top", defaultPageSize: pageLimit}}
columns={columns}
rowKey="id"
dataSource={data}
onChange={handleTableChange}
/>
),
},
{
title: t("audit.fields.useremail"),
dataIndex: "useremail",
key: "useremail",
width: "10%",
sorter: (a, b) => alphaSort(a.useremail, b.useremail),
sortOrder:
state.sortedInfo.columnKey === "useremail" && state.sortedInfo.order,
},
];
const formItemLayout = {
labelCol: {
xs: { span: 12 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 12 },
},
};
const handleTableChange = (pagination, filters, sorter) => {
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
};
return (
<Table
{...formItemLayout}
loading={loading}
pagination={{ position: "top", defaultPageSize: pageLimit }}
columns={columns}
rowKey="id"
dataSource={data}
onChange={handleTableChange}
/>
);
);
}

View File

@@ -1,40 +1,40 @@
import React from "react";
import AuditTrailListComponent from "./audit-trail-list.component";
import { useQuery } from "@apollo/client";
import { QUERY_AUDIT_TRAIL } from "../../graphql/audit_trail.queries";
import {useQuery} from "@apollo/client";
import {QUERY_AUDIT_TRAIL} from "../../graphql/audit_trail.queries";
import AlertComponent from "../alert/alert.component";
import { logImEXEvent } from "../../firebase/firebase.utils";
import {logImEXEvent} from "../../firebase/firebase.utils";
import EmailAuditTrailListComponent from "./email-audit-trail-list.component";
import { Card, Row } from "antd";
import {Card, Row} from "antd";
export default function AuditTrailListContainer({ recordId }) {
const { loading, error, data } = useQuery(QUERY_AUDIT_TRAIL, {
variables: { id: recordId },
fetchPolicy: "network-only",
nextFetchPolicy: "network-only",
});
export default function AuditTrailListContainer({recordId}) {
const {loading, error, data} = useQuery(QUERY_AUDIT_TRAIL, {
variables: {id: recordId},
fetchPolicy: "network-only",
nextFetchPolicy: "network-only",
});
logImEXEvent("audittrail_view", { recordId });
return (
<div>
{error ? (
<AlertComponent type="error" message={error.message} />
) : (
<Row gutter={[16, 16]}>
<Card>
<AuditTrailListComponent
loading={loading}
data={data ? data.audit_trail : []}
/>
</Card>
<Card>
<EmailAuditTrailListComponent
loading={loading}
data={data ? data.audit_trail : []}
/>
</Card>
</Row>
)}
</div>
);
logImEXEvent("audittrail_view", {recordId});
return (
<div>
{error ? (
<AlertComponent type="error" message={error.message}/>
) : (
<Row gutter={[16, 16]}>
<Card>
<AuditTrailListComponent
loading={loading}
data={data ? data.audit_trail : []}
/>
</Card>
<Card>
<EmailAuditTrailListComponent
loading={loading}
data={data ? data.audit_trail : []}
/>
</Card>
</Row>
)}
</div>
);
}

View File

@@ -1,64 +1,64 @@
import { Table } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { DateTimeFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters";
import {Table} from "antd";
import React, {useState} from "react";
import {useTranslation} from "react-i18next";
import {DateTimeFormatter} from "../../utils/DateFormatter";
import {alphaSort} from "../../utils/sorters";
import {pageLimit} from "../../utils/config";
export default function EmailAuditTrailListComponent({ loading, data }) {
const [state, setState] = useState({
sortedInfo: {},
filteredInfo: {},
});
const { t } = useTranslation();
const columns = [
{
title: t("audit.fields.created"),
dataIndex: " created",
key: " created",
width: "10%",
render: (text, record) => (
<DateTimeFormatter>{record.created}</DateTimeFormatter>
),
sorter: (a, b) => a.created - b.created,
sortOrder:
state.sortedInfo.columnKey === "created" && state.sortedInfo.order,
},
export default function EmailAuditTrailListComponent({loading, data}) {
const [state, setState] = useState({
sortedInfo: {},
filteredInfo: {},
});
const {t} = useTranslation();
const columns = [
{
title: t("audit.fields.created"),
dataIndex: " created",
key: " created",
width: "10%",
render: (text, record) => (
<DateTimeFormatter>{record.created}</DateTimeFormatter>
),
sorter: (a, b) => a.created - b.created,
sortOrder:
state.sortedInfo.columnKey === "created" && state.sortedInfo.order,
},
{
title: t("audit.fields.useremail"),
dataIndex: "useremail",
key: "useremail",
width: "10%",
sorter: (a, b) => alphaSort(a.useremail, b.useremail),
sortOrder:
state.sortedInfo.columnKey === "useremail" && state.sortedInfo.order,
},
];
{
title: t("audit.fields.useremail"),
dataIndex: "useremail",
key: "useremail",
width: "10%",
sorter: (a, b) => alphaSort(a.useremail, b.useremail),
sortOrder:
state.sortedInfo.columnKey === "useremail" && state.sortedInfo.order,
},
];
const formItemLayout = {
labelCol: {
xs: { span: 12 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 12 },
},
};
const handleTableChange = (pagination, filters, sorter) => {
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
};
const formItemLayout = {
labelCol: {
xs: {span: 12},
sm: {span: 5},
},
wrapperCol: {
xs: {span: 24},
sm: {span: 12},
},
};
const handleTableChange = (pagination, filters, sorter) => {
setState({...state, filteredInfo: filters, sortedInfo: sorter});
};
return (
<Table
{...formItemLayout}
loading={loading}
pagination={{ position: "top", defaultPageSize: pageLimit }}
columns={columns}
rowKey="id"
dataSource={data}
onChange={handleTableChange}
/>
);
return (
<Table
{...formItemLayout}
loading={loading}
pagination={{position: "top", defaultPageSize: pageLimit}}
columns={columns}
rowKey="id"
dataSource={data}
onChange={handleTableChange}
/>
);
}

View File

@@ -1,29 +1,30 @@
import React from "react";
import { List } from "antd";
import {List} from "antd";
import Icon from "@ant-design/icons";
import { FaArrowRight } from "react-icons/fa";
export default function AuditTrailValuesComponent({ oldV, newV }) {
if (!oldV && !newV) return <div></div>;
import {FaArrowRight} from "react-icons/fa";
export default function AuditTrailValuesComponent({oldV, newV}) {
if (!oldV && !newV) return <div></div>;
if (!oldV && newV)
return (
<List style={{width: "800px"}} bordered size='small'>
{Object.keys(newV).map((key, idx) => (
<List.Item key={idx} value={key}>
{key}: {JSON.stringify(newV[key])}
</List.Item>
))}
</List>
);
if (!oldV && newV)
return (
<List style={{ width: "800px" }} bordered size='small'>
{Object.keys(newV).map((key, idx) => (
<List.Item key={idx} value={key}>
{key}: {JSON.stringify(newV[key])}
</List.Item>
))}
</List>
<List style={{width: "800px"}} bordered size='small'>
{Object.keys(oldV).map((key, idx) => (
<List.Item key={idx}>
{key}: {oldV[key]} <Icon component={FaArrowRight}/>
{JSON.stringify(newV[key])}
</List.Item>
))}
</List>
);
return (
<List style={{ width: "800px" }} bordered size='small'>
{Object.keys(oldV).map((key, idx) => (
<List.Item key={idx}>
{key}: {oldV[key]} <Icon component={FaArrowRight} />
{JSON.stringify(newV[key])}
</List.Item>
))}
</List>
);
}

View File

@@ -1,22 +1,23 @@
import { Tag, Popover } from "antd";
import {Popover, Tag} from "antd";
import React from "react";
import Barcode from "react-barcode";
import { useTranslation } from "react-i18next";
export default function BarcodePopupComponent({ value, children }) {
const { t } = useTranslation();
return (
<div>
<Popover
content={
<Barcode
value={value || ""}
background="transparent"
displayValue={false}
/>
}
>
{children ? children : <Tag>{t("general.labels.barcode")}</Tag>}
</Popover>
</div>
);
import {useTranslation} from "react-i18next";
export default function BarcodePopupComponent({value, children}) {
const {t} = useTranslation();
return (
<div>
<Popover
content={
<Barcode
value={value || ""}
background="transparent"
displayValue={false}
/>
}
>
{children ? children : <Tag>{t("general.labels.barcode")}</Tag>}
</Popover>
</div>
);
}

View File

@@ -1,135 +1,136 @@
import { Checkbox, Form, Skeleton, Typography } from "antd";
import React, { useEffect } from "react";
import { useTranslation } from "react-i18next";
import {Checkbox, Form, Skeleton, Typography} from "antd";
import React, {useEffect} from "react";
import {useTranslation} from "react-i18next";
import ReadOnlyFormItemComponent from "../form-items-formatted/read-only-form-item.component";
import "./bill-cm-returns-table.styles.scss";
export default function BillCmdReturnsTableComponent({
form,
returnLoading,
returnData,
}) {
const { t } = useTranslation();
form,
returnLoading,
returnData,
}) {
const {t} = useTranslation();
useEffect(() => {
if (returnData) {
form.setFieldsValue({
outstanding_returns: returnData.parts_order_lines,
});
}
}, [returnData, form]);
return (
<Form.Item
shouldUpdate={(prev, cur) =>
prev.jobid !== cur.jobid ||
prev.is_credit_memo !== cur.is_credit_memo ||
prev.vendorid !== cur.vendorid
}
noStyle
>
{() => {
const isReturn = form.getFieldValue("is_credit_memo");
if (!isReturn) {
return null;
useEffect(() => {
if (returnData) {
form.setFieldsValue({
outstanding_returns: returnData.parts_order_lines,
});
}
}, [returnData, form]);
if (returnLoading) return <Skeleton />;
return (
<Form.Item
shouldUpdate={(prev, cur) =>
prev.jobid !== cur.jobid ||
prev.is_credit_memo !== cur.is_credit_memo ||
prev.vendorid !== cur.vendorid
}
noStyle
>
{() => {
const isReturn = form.getFieldValue("is_credit_memo");
return (
<Form.List name="outstanding_returns">
{(fields, { add, remove, move }) => {
return (
<>
<Typography.Title level={4}>
{t("bills.labels.creditsnotreceived")}
</Typography.Title>
<table className="bill-cm-returns-table">
<thead>
<tr>
<th>{t("parts_orders.fields.line_desc")}</th>
<th>{t("parts_orders.fields.part_type")}</th>
<th>{t("parts_orders.fields.quantity")}</th>
<th>{t("parts_orders.fields.act_price")}</th>
<th>{t("parts_orders.fields.cost")}</th>
<th>{t("parts_orders.labels.mark_as_received")}</th>
</tr>
</thead>
<tbody>
{fields.map((field, index) => (
<tr key={field.key}>
<td>
<Form.Item
// label={t("joblines.fields.line_desc")}
key={`${index}line_desc`}
name={[field.name, "line_desc"]}
>
<ReadOnlyFormItemComponent />
</Form.Item>
</td>
if (!isReturn) {
return null;
}
<td>
<Form.Item
span={2}
//label={t("joblines.fields.mod_lb_hrs")}
key={`${index}part_type`}
name={[field.name, "part_type"]}
>
<ReadOnlyFormItemComponent />
</Form.Item>
</td>
<td>
<Form.Item
span={2}
//label={t("joblines.fields.mod_lb_hrs")}
key={`${index}quantity`}
name={[field.name, "quantity"]}
>
<ReadOnlyFormItemComponent />
</Form.Item>
</td>
<td>
<Form.Item
span={2}
//label={t("joblines.fields.mod_lb_hrs")}
key={`${index}act_price`}
name={[field.name, "act_price"]}
>
<ReadOnlyFormItemComponent type="currency" />
</Form.Item>
</td>
<td>
<Form.Item
span={2}
//label={t("joblines.fields.mod_lb_hrs")}
key={`${index}cost`}
name={[field.name, "cost"]}
>
<ReadOnlyFormItemComponent type="currency" />
</Form.Item>
</td>
if (returnLoading) return <Skeleton/>;
<td>
<Form.Item
span={2}
//label={t("joblines.fields.mod_lb_hrs")}
key={`${index}cm_received`}
name={[field.name, "cm_received"]}
valuePropName="checked"
>
<Checkbox />
</Form.Item>
</td>
</tr>
))}
</tbody>
</table>
</>
);
return (
<Form.List name="outstanding_returns">
{(fields, {add, remove, move}) => {
return (
<>
<Typography.Title level={4}>
{t("bills.labels.creditsnotreceived")}
</Typography.Title>
<table className="bill-cm-returns-table">
<thead>
<tr>
<th>{t("parts_orders.fields.line_desc")}</th>
<th>{t("parts_orders.fields.part_type")}</th>
<th>{t("parts_orders.fields.quantity")}</th>
<th>{t("parts_orders.fields.act_price")}</th>
<th>{t("parts_orders.fields.cost")}</th>
<th>{t("parts_orders.labels.mark_as_received")}</th>
</tr>
</thead>
<tbody>
{fields.map((field, index) => (
<tr key={field.key}>
<td>
<Form.Item
// label={t("joblines.fields.line_desc")}
key={`${index}line_desc`}
name={[field.name, "line_desc"]}
>
<ReadOnlyFormItemComponent/>
</Form.Item>
</td>
<td>
<Form.Item
span={2}
//label={t("joblines.fields.mod_lb_hrs")}
key={`${index}part_type`}
name={[field.name, "part_type"]}
>
<ReadOnlyFormItemComponent/>
</Form.Item>
</td>
<td>
<Form.Item
span={2}
//label={t("joblines.fields.mod_lb_hrs")}
key={`${index}quantity`}
name={[field.name, "quantity"]}
>
<ReadOnlyFormItemComponent/>
</Form.Item>
</td>
<td>
<Form.Item
span={2}
//label={t("joblines.fields.mod_lb_hrs")}
key={`${index}act_price`}
name={[field.name, "act_price"]}
>
<ReadOnlyFormItemComponent type="currency"/>
</Form.Item>
</td>
<td>
<Form.Item
span={2}
//label={t("joblines.fields.mod_lb_hrs")}
key={`${index}cost`}
name={[field.name, "cost"]}
>
<ReadOnlyFormItemComponent type="currency"/>
</Form.Item>
</td>
<td>
<Form.Item
span={2}
//label={t("joblines.fields.mod_lb_hrs")}
key={`${index}cm_received`}
name={[field.name, "cm_received"]}
valuePropName="checked"
>
<Checkbox/>
</Form.Item>
</td>
</tr>
))}
</tbody>
</table>
</>
);
}}
</Form.List>
);
}}
</Form.List>
);
}}
</Form.Item>
);
</Form.Item>
);
}

View File

@@ -1,19 +1,19 @@
.bill-cm-returns-table {
table-layout: fixed;
width: 100%;
table-layout: fixed;
width: 100%;
th,
td {
padding: 8px;
text-align: left;
border-bottom: 1px solid #ddd;
th,
td {
padding: 8px;
text-align: left;
border-bottom: 1px solid #ddd;
.ant-form-item {
margin-bottom: 0px !important;
}
.ant-form-item {
margin-bottom: 0px !important;
}
}
tr:hover {
background-color: #f5f5f5;
}
tr:hover {
background-color: #f5f5f5;
}
}

View File

@@ -1,80 +1,80 @@
import { DeleteFilled } from "@ant-design/icons";
import { useMutation } from "@apollo/client";
import { Button, notification, Popconfirm } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { DELETE_BILL } from "../../graphql/bills.queries";
import {DeleteFilled} from "@ant-design/icons";
import {useMutation} from "@apollo/client";
import {Button, notification, Popconfirm} from "antd";
import React, {useState} from "react";
import {useTranslation} from "react-i18next";
import {DELETE_BILL} from "../../graphql/bills.queries";
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
export default function BillDeleteButton({ bill, callback }) {
const [loading, setLoading] = useState(false);
const { t } = useTranslation();
const [deleteBill] = useMutation(DELETE_BILL);
export default function BillDeleteButton({bill, callback}) {
const [loading, setLoading] = useState(false);
const {t} = useTranslation();
const [deleteBill] = useMutation(DELETE_BILL);
const handleDelete = async () => {
setLoading(true);
const result = await deleteBill({
variables: { billId: bill.id },
update(cache, { errors }) {
if (errors) return;
cache.modify({
fields: {
bills(existingBills, { readField }) {
return existingBills.filter(
(billref) => bill.id !== readField("id", billref)
);
const handleDelete = async () => {
setLoading(true);
const result = await deleteBill({
variables: {billId: bill.id},
update(cache, {errors}) {
if (errors) return;
cache.modify({
fields: {
bills(existingBills, {readField}) {
return existingBills.filter(
(billref) => bill.id !== readField("id", billref)
);
},
search_bills(existingBills, {readField}) {
return existingBills.filter(
(billref) => bill.id !== readField("id", billref)
);
},
},
});
},
search_bills(existingBills, { readField }) {
return existingBills.filter(
(billref) => bill.id !== readField("id", billref)
);
},
},
});
},
});
if (!!!result.errors) {
notification["success"]({ message: t("bills.successes.deleted") });
if (!!!result.errors) {
notification["success"]({message: t("bills.successes.deleted")});
if (callback && typeof callback === "function") callback(bill.id);
} else {
//Check if it's an fkey violation.
const error = JSON.stringify(result.errors);
if (callback && typeof callback === "function") callback(bill.id);
} else {
//Check if it's an fkey violation.
const error = JSON.stringify(result.errors);
if (error.toLowerCase().includes("inventory_billid_fkey")) {
notification["error"]({
message: t("bills.errors.deleting", {
error: t("bills.errors.existinginventoryline"),
}),
});
} else {
notification["error"]({
message: t("bills.errors.deleting", {
error: JSON.stringify(result.errors),
}),
});
}
}
if (error.toLowerCase().includes("inventory_billid_fkey")) {
notification["error"]({
message: t("bills.errors.deleting", {
error: t("bills.errors.existinginventoryline"),
}),
});
} else {
notification["error"]({
message: t("bills.errors.deleting", {
error: JSON.stringify(result.errors),
}),
});
}
}
setLoading(false);
};
setLoading(false);
};
return (
<RbacWrapper action="bills:delete" noauth={<></>}>
<Popconfirm
disabled={bill.exported}
onConfirm={handleDelete}
title={t("bills.labels.deleteconfirm")}
>
<Button
disabled={bill.exported}
// onClick={handleDelete}
loading={loading}
>
<DeleteFilled />
</Button>
</Popconfirm>
</RbacWrapper>
);
return (
<RbacWrapper action="bills:delete" noauth={<></>}>
<Popconfirm
disabled={bill.exported}
onConfirm={handleDelete}
title={t("bills.labels.deleteconfirm")}
>
<Button
disabled={bill.exported}
// onClick={handleDelete}
loading={loading}
>
<DeleteFilled/>
</Button>
</Popconfirm>
</RbacWrapper>
);
}

View File

@@ -2,20 +2,16 @@ import {useMutation, useQuery} from "@apollo/client";
import {Button, Form, Popconfirm, Space} from "antd";
import dayjs from "../../utils/day";
import queryString from "query-string";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { useLocation } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import {
DELETE_BILL_LINE,
INSERT_NEW_BILL_LINES,
UPDATE_BILL_LINE
} from "../../graphql/bill-lines.queries";
import { QUERY_BILL_BY_PK, UPDATE_BILL } from "../../graphql/bills.queries";
import { insertAuditTrail } from "../../redux/application/application.actions";
import { setModalContext } from "../../redux/modals/modals.actions";
import { selectBodyshop } from "../../redux/user/user.selectors";
import React, {useState} from "react";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {useLocation} from "react-router-dom";
import {createStructuredSelector} from "reselect";
import {DELETE_BILL_LINE, INSERT_NEW_BILL_LINES, UPDATE_BILL_LINE} from "../../graphql/bill-lines.queries";
import {QUERY_BILL_BY_PK, UPDATE_BILL} from "../../graphql/bills.queries";
import {insertAuditTrail} from "../../redux/application/application.actions";
import {setModalContext} from "../../redux/modals/modals.actions";
import {selectBodyshop} from "../../redux/user/user.selectors";
import AuditTrailMapping from "../../utils/AuditTrailMappings";
import AlertComponent from "../alert/alert.component";
import BillFormContainer from "../bill-form/bill-form.container";
@@ -163,49 +159,49 @@ export function BillDetailEditcontainer({setPartsOrderContext, insertAuditTrail,
const exported = data && data.bills_by_pk && data.bills_by_pk.exported;
return (
<>
{loading && <LoadingSkeleton />}
{data && (
return (
<>
<PageHeader
title={
data &&
`${data.bills_by_pk.invoice_number} - ${data.bills_by_pk.vendor.name}`
}
extra={
<Space>
<BillDetailEditReturn data={data} />
<BillPrintButton billid={search.billid} />
<Popconfirm
open={open}
onConfirm={() => form.submit()}
onCancel={() => setOpen(false)}
okButtonProps={{ loading: updateLoading }}
title={t("bills.labels.editadjwarning")}
>
<Button
htmlType="submit"
disabled={exported}
onClick={handleSave}
loading={updateLoading}
type="primary"
>
{t("general.actions.save")}
</Button>
</Popconfirm>
<BillReeportButtonComponent bill={data && data.bills_by_pk} />
<BillMarkExportedButton bill={data && data.bills_by_pk} />
</Space>
}
/>
<Form
form={form}
onFinish={handleFinish}
initialValues={transformData(data)}
layout="vertical"
>
<BillFormContainer form={form} billEdit disabled={exported} />
{loading && <LoadingSkeleton/>}
{data && (
<>
<PageHeader
title={
data &&
`${data.bills_by_pk.invoice_number} - ${data.bills_by_pk.vendor.name}`
}
extra={
<Space>
<BillDetailEditReturn data={data}/>
<BillPrintButton billid={search.billid}/>
<Popconfirm
open={open}
onConfirm={() => form.submit()}
onCancel={() => setOpen(false)}
okButtonProps={{loading: updateLoading}}
title={t("bills.labels.editadjwarning")}
>
<Button
htmlType="submit"
disabled={exported}
onClick={handleSave}
loading={updateLoading}
type="primary"
>
{t("general.actions.save")}
</Button>
</Popconfirm>
<BillReeportButtonComponent bill={data && data.bills_by_pk}/>
<BillMarkExportedButton bill={data && data.bills_by_pk}/>
</Space>
}
/>
<Form
form={form}
onFinish={handleFinish}
initialValues={transformData(data)}
layout="vertical"
>
<BillFormContainer form={form} billEdit disabled={exported}/>
{bodyshop.uselocalmediaserver ? (
<JobsDocumentsLocalGallery

View File

@@ -1,185 +1,185 @@
import { Button, Checkbox, Form, Modal } from "antd";
import {Button, Checkbox, Form, Modal} from "antd";
import queryString from "query-string";
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { useLocation, useNavigate } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { insertAuditTrail } from "../../redux/application/application.actions";
import { setModalContext } from "../../redux/modals/modals.actions";
import { selectBodyshop } from "../../redux/user/user.selectors";
import React, {useEffect, useState} from "react";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {useLocation, useNavigate} from "react-router-dom";
import {createStructuredSelector} from "reselect";
import {insertAuditTrail} from "../../redux/application/application.actions";
import {setModalContext} from "../../redux/modals/modals.actions";
import {selectBodyshop} from "../../redux/user/user.selectors";
import ReadOnlyFormItemComponent from "../form-items-formatted/read-only-form-item.component";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
setPartsOrderContext: (context) =>
dispatch(setModalContext({ context: context, modal: "partsOrder" })),
insertAuditTrail: ({ jobid, operation }) =>
dispatch(insertAuditTrail({ jobid, operation })),
setPartsOrderContext: (context) =>
dispatch(setModalContext({context: context, modal: "partsOrder"})),
insertAuditTrail: ({jobid, operation}) =>
dispatch(insertAuditTrail({jobid, operation})),
});
export default connect(
mapStateToProps,
mapDispatchToProps
mapStateToProps,
mapDispatchToProps
)(BillDetailEditReturn);
export function BillDetailEditReturn({
setPartsOrderContext,
insertAuditTrail,
bodyshop,
data,
disabled,
}) {
const search = queryString.parse(useLocation().search);
const history = useNavigate();
const { t } = useTranslation();
const [form] = Form.useForm();
const [open, setOpen] = useState(false);
setPartsOrderContext,
insertAuditTrail,
bodyshop,
data,
disabled,
}) {
const search = queryString.parse(useLocation().search);
const history = useNavigate();
const {t} = useTranslation();
const [form] = Form.useForm();
const [open, setOpen] = useState(false);
const handleFinish = ({ billlines }) => {
const selectedLines = billlines.filter((l) => l.selected).map((l) => l.id);
const handleFinish = ({billlines}) => {
const selectedLines = billlines.filter((l) => l.selected).map((l) => l.id);
setPartsOrderContext({
actions: {},
context: {
jobId: data.bills_by_pk.jobid,
vendorId: data.bills_by_pk.vendorid,
returnFromBill: data.bills_by_pk.id,
invoiceNumber: data.bills_by_pk.invoice_number,
linesToOrder: data.bills_by_pk.billlines
.filter((l) => selectedLines.includes(l.id))
.map((i) => {
return {
line_desc: i.line_desc,
// db_price: i.actual_price,
act_price: i.actual_price,
cost: i.actual_cost,
quantity: i.quantity,
joblineid: i.joblineid,
oem_partno: i.jobline && i.jobline.oem_partno,
part_type: i.jobline && i.jobline.part_type,
};
}),
isReturn: true,
},
});
delete search.billid;
setPartsOrderContext({
actions: {},
context: {
jobId: data.bills_by_pk.jobid,
vendorId: data.bills_by_pk.vendorid,
returnFromBill: data.bills_by_pk.id,
invoiceNumber: data.bills_by_pk.invoice_number,
linesToOrder: data.bills_by_pk.billlines
.filter((l) => selectedLines.includes(l.id))
.map((i) => {
return {
line_desc: i.line_desc,
// db_price: i.actual_price,
act_price: i.actual_price,
cost: i.actual_cost,
quantity: i.quantity,
joblineid: i.joblineid,
oem_partno: i.jobline && i.jobline.oem_partno,
part_type: i.jobline && i.jobline.part_type,
};
}),
isReturn: true,
},
});
delete search.billid;
history({ search: queryString.stringify(search) });
setOpen(false);
};
useEffect(() => {
if (open === false) form.resetFields();
}, [open, form]);
history({search: queryString.stringify(search)});
setOpen(false);
};
useEffect(() => {
if (open === false) form.resetFields();
}, [open, form]);
return (
<>
<Modal
open={open}
onCancel={() => setOpen(false)}
destroyOnClose
title={t("bills.actions.return")}
onOk={() => form.submit()}
>
<Form
initialValues={data && data.bills_by_pk}
onFinish={handleFinish}
form={form}
>
<Form.List name={["billlines"]}>
{(fields, { add, remove, move }) => {
return (
<table style={{ tableLayout: "auto", width: "100%" }}>
<thead>
<tr>
<td>
<Checkbox
onChange={(e) => {
form.setFieldsValue({
billlines: form
.getFieldsValue()
.billlines.map((b) => ({
...b,
selected: e.target.checked,
})),
});
}}
/>
</td>
<td>{t("billlines.fields.line_desc")}</td>
<td>{t("billlines.fields.quantity")}</td>
<td>{t("billlines.fields.actual_price")}</td>
<td>{t("billlines.fields.actual_cost")}</td>
</tr>
</thead>
<tbody>
{fields.map((field, index) => (
<tr key={field.key}>
<td>
<Form.Item
// label={t("joblines.fields.selected")}
key={`${index}selected`}
name={[field.name, "selected"]}
valuePropName="checked"
>
<Checkbox />
</Form.Item>
</td>
<td>
<Form.Item
// label={t("joblines.fields.line_desc")}
key={`${index}line_desc`}
name={[field.name, "line_desc"]}
>
<ReadOnlyFormItemComponent />
</Form.Item>
</td>
<td>
<Form.Item
// label={t("joblines.fields.quantity")}
key={`${index}quantity`}
name={[field.name, "quantity"]}
>
<ReadOnlyFormItemComponent />
</Form.Item>
</td>
<td>
<Form.Item
// label={t("joblines.fields.actual_price")}
key={`${index}actual_price`}
name={[field.name, "actual_price"]}
>
<ReadOnlyFormItemComponent type="currency" />
</Form.Item>
</td>
<td>
<Form.Item
// label={t("joblines.fields.actual_cost")}
key={`${index}actual_cost`}
name={[field.name, "actual_cost"]}
>
<ReadOnlyFormItemComponent type="currency" />
</Form.Item>
</td>
</tr>
))}
</tbody>
</table>
);
}}
</Form.List>
</Form>
</Modal>
<Button
disabled={data.bills_by_pk.is_credit_memo || disabled}
onClick={() => {
setOpen(true);
}}
>
{t("bills.actions.return")}
</Button>
</>
);
return (
<>
<Modal
open={open}
onCancel={() => setOpen(false)}
destroyOnClose
title={t("bills.actions.return")}
onOk={() => form.submit()}
>
<Form
initialValues={data && data.bills_by_pk}
onFinish={handleFinish}
form={form}
>
<Form.List name={["billlines"]}>
{(fields, {add, remove, move}) => {
return (
<table style={{tableLayout: "auto", width: "100%"}}>
<thead>
<tr>
<td>
<Checkbox
onChange={(e) => {
form.setFieldsValue({
billlines: form
.getFieldsValue()
.billlines.map((b) => ({
...b,
selected: e.target.checked,
})),
});
}}
/>
</td>
<td>{t("billlines.fields.line_desc")}</td>
<td>{t("billlines.fields.quantity")}</td>
<td>{t("billlines.fields.actual_price")}</td>
<td>{t("billlines.fields.actual_cost")}</td>
</tr>
</thead>
<tbody>
{fields.map((field, index) => (
<tr key={field.key}>
<td>
<Form.Item
// label={t("joblines.fields.selected")}
key={`${index}selected`}
name={[field.name, "selected"]}
valuePropName="checked"
>
<Checkbox/>
</Form.Item>
</td>
<td>
<Form.Item
// label={t("joblines.fields.line_desc")}
key={`${index}line_desc`}
name={[field.name, "line_desc"]}
>
<ReadOnlyFormItemComponent/>
</Form.Item>
</td>
<td>
<Form.Item
// label={t("joblines.fields.quantity")}
key={`${index}quantity`}
name={[field.name, "quantity"]}
>
<ReadOnlyFormItemComponent/>
</Form.Item>
</td>
<td>
<Form.Item
// label={t("joblines.fields.actual_price")}
key={`${index}actual_price`}
name={[field.name, "actual_price"]}
>
<ReadOnlyFormItemComponent type="currency"/>
</Form.Item>
</td>
<td>
<Form.Item
// label={t("joblines.fields.actual_cost")}
key={`${index}actual_cost`}
name={[field.name, "actual_cost"]}
>
<ReadOnlyFormItemComponent type="currency"/>
</Form.Item>
</td>
</tr>
))}
</tbody>
</table>
);
}}
</Form.List>
</Form>
</Modal>
<Button
disabled={data.bills_by_pk.is_credit_memo || disabled}
onClick={() => {
setOpen(true);
}}
>
{t("bills.actions.return")}
</Button>
</>
);
}

View File

@@ -1,40 +1,40 @@
import { Drawer, Grid } from "antd";
import {Drawer, Grid} from "antd";
import queryString from "query-string";
import React from "react";
import { useLocation, useNavigate } from "react-router-dom";
import {useLocation, useNavigate} from "react-router-dom";
import BillDetailEditComponent from "./bill-detail-edit-component";
export default function BillDetailEditcontainer() {
const search = queryString.parse(useLocation().search);
const history = useNavigate();
const search = queryString.parse(useLocation().search);
const history = useNavigate();
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
.filter((screen) => !!screen[1])
.slice(-1)[0];
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
.filter((screen) => !!screen[1])
.slice(-1)[0];
const bpoints = {
xs: "100%",
sm: "100%",
md: "100%",
lg: "100%",
xl: "90%",
xxl: "90%",
};
const drawerPercentage = selectedBreakpoint
? bpoints[selectedBreakpoint[0]]
: "100%";
const bpoints = {
xs: "100%",
sm: "100%",
md: "100%",
lg: "100%",
xl: "90%",
xxl: "90%",
};
const drawerPercentage = selectedBreakpoint
? bpoints[selectedBreakpoint[0]]
: "100%";
return (
<Drawer
width={drawerPercentage}
onClose={() => {
delete search.billid;
history({ search: queryString.stringify(search) });
}}
destroyOnClose
open={search.billid}
>
<BillDetailEditComponent />
</Drawer>
);
return (
<Drawer
width={drawerPercentage}
onClose={() => {
delete search.billid;
history({search: queryString.stringify(search)});
}}
destroyOnClose
open={search.billid}
>
<BillDetailEditComponent/>
</Drawer>
);
}

View File

@@ -1,417 +1,411 @@
import { useApolloClient, useMutation } from "@apollo/client";
import { Button, Checkbox, Form, Modal, Space, notification } from "antd";
import {useApolloClient, useMutation} from "@apollo/client";
import {Button, Checkbox, Form, Modal, notification, Space} from "antd";
import _ from "lodash";
import React, { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { INSERT_NEW_BILL } from "../../graphql/bills.queries";
import { UPDATE_INVENTORY_LINES } from "../../graphql/inventory.queries";
import { UPDATE_JOB_LINE } from "../../graphql/jobs-lines.queries";
import {
QUERY_JOB_LBR_ADJUSTMENTS,
UPDATE_JOB,
} from "../../graphql/jobs.queries";
import { MUTATION_MARK_RETURN_RECEIVED } from "../../graphql/parts-orders.queries";
import { insertAuditTrail } from "../../redux/application/application.actions";
import { toggleModalVisible } from "../../redux/modals/modals.actions";
import { selectBillEnterModal } from "../../redux/modals/modals.selectors";
import {
selectBodyshop,
selectCurrentUser,
} from "../../redux/user/user.selectors";
import React, {useEffect, useMemo, useState} from "react";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {INSERT_NEW_BILL} from "../../graphql/bills.queries";
import {UPDATE_INVENTORY_LINES} from "../../graphql/inventory.queries";
import {UPDATE_JOB_LINE} from "../../graphql/jobs-lines.queries";
import {QUERY_JOB_LBR_ADJUSTMENTS, UPDATE_JOB,} from "../../graphql/jobs.queries";
import {MUTATION_MARK_RETURN_RECEIVED} from "../../graphql/parts-orders.queries";
import {insertAuditTrail} from "../../redux/application/application.actions";
import {toggleModalVisible} from "../../redux/modals/modals.actions";
import {selectBillEnterModal} from "../../redux/modals/modals.selectors";
import {selectBodyshop, selectCurrentUser,} from "../../redux/user/user.selectors";
import AuditTrailMapping from "../../utils/AuditTrailMappings";
import { GenerateDocument } from "../../utils/RenderTemplate";
import { TemplateList } from "../../utils/TemplateConstants";
import {GenerateDocument} from "../../utils/RenderTemplate";
import {TemplateList} from "../../utils/TemplateConstants";
import confirmDialog from "../../utils/asyncConfirm";
import useLocalStorage from "../../utils/useLocalStorage";
import BillFormContainer from "../bill-form/bill-form.container";
import { CalculateBillTotal } from "../bill-form/bill-form.totals.utility";
import { handleUpload as handleLocalUpload } from "../documents-local-upload/documents-local-upload.utility";
import { handleUpload } from "../documents-upload/documents-upload.utility";
import {CalculateBillTotal} from "../bill-form/bill-form.totals.utility";
import {handleUpload as handleLocalUpload} from "../documents-local-upload/documents-local-upload.utility";
import {handleUpload} from "../documents-upload/documents-upload.utility";
const mapStateToProps = createStructuredSelector({
billEnterModal: selectBillEnterModal,
bodyshop: selectBodyshop,
currentUser: selectCurrentUser,
billEnterModal: selectBillEnterModal,
bodyshop: selectBodyshop,
currentUser: selectCurrentUser,
});
const mapDispatchToProps = (dispatch) => ({
toggleModalVisible: () => dispatch(toggleModalVisible("billEnter")),
insertAuditTrail: ({ jobid, billid, operation }) =>
dispatch(insertAuditTrail({ jobid, billid, operation })),
toggleModalVisible: () => dispatch(toggleModalVisible("billEnter")),
insertAuditTrail: ({jobid, billid, operation}) =>
dispatch(insertAuditTrail({jobid, billid, operation})),
});
const Templates = TemplateList("job_special");
function BillEnterModalContainer({
billEnterModal,
toggleModalVisible,
bodyshop,
currentUser,
insertAuditTrail,
}) {
const [form] = Form.useForm();
const { t } = useTranslation();
const [enterAgain, setEnterAgain] = useState(false);
const [insertBill] = useMutation(INSERT_NEW_BILL);
const [updateJobLines] = useMutation(UPDATE_JOB_LINE);
const [updatePartsOrderLines] = useMutation(MUTATION_MARK_RETURN_RECEIVED);
const [updateInventoryLines] = useMutation(UPDATE_INVENTORY_LINES);
const [loading, setLoading] = useState(false);
const client = useApolloClient();
const [generateLabel, setGenerateLabel] = useLocalStorage(
"enter_bill_generate_label",
false
);
const formValues = useMemo(() => {
return {
...billEnterModal.context.bill,
jobid:
(billEnterModal.context.job && billEnterModal.context.job.id) || null,
federal_tax_rate:
(bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.federal_tax_rate) ||
0,
state_tax_rate:
(bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.state_tax_rate) ||
0,
local_tax_rate:
(bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.local_tax_rate) ||
0,
};
}, [billEnterModal, bodyshop]);
billEnterModal,
toggleModalVisible,
bodyshop,
currentUser,
insertAuditTrail,
}) {
const [form] = Form.useForm();
const {t} = useTranslation();
const [enterAgain, setEnterAgain] = useState(false);
const [insertBill] = useMutation(INSERT_NEW_BILL);
const [updateJobLines] = useMutation(UPDATE_JOB_LINE);
const [updatePartsOrderLines] = useMutation(MUTATION_MARK_RETURN_RECEIVED);
const [updateInventoryLines] = useMutation(UPDATE_INVENTORY_LINES);
const [loading, setLoading] = useState(false);
const client = useApolloClient();
const [generateLabel, setGenerateLabel] = useLocalStorage(
"enter_bill_generate_label",
false
);
const formValues = useMemo(() => {
return {
...billEnterModal.context.bill,
jobid:
(billEnterModal.context.job && billEnterModal.context.job.id) || null,
federal_tax_rate:
(bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.federal_tax_rate) ||
0,
state_tax_rate:
(bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.state_tax_rate) ||
0,
local_tax_rate:
(bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.local_tax_rate) ||
0,
};
}, [billEnterModal, bodyshop]);
const handleFinish = async (values) => {
let totals = CalculateBillTotal(values);
if (totals.discrepancy.getAmount() !== 0) {
if (!(await confirmDialog(t("bills.labels.savewithdiscrepancy")))) {
return;
}
}
const handleFinish = async (values) => {
let totals = CalculateBillTotal(values);
if (totals.discrepancy.getAmount() !== 0) {
if (!(await confirmDialog(t("bills.labels.savewithdiscrepancy")))) {
return;
}
}
setLoading(true);
const {
upload,
location,
outstanding_returns,
inventory,
...remainingValues
} = values;
setLoading(true);
const {
upload,
location,
outstanding_returns,
inventory,
...remainingValues
} = values;
let adjustmentsToInsert = {};
let adjustmentsToInsert = {};
const r1 = await insertBill({
variables: {
bill: [
{
...remainingValues,
billlines: {
data:
remainingValues.billlines &&
remainingValues.billlines.map((i) => {
const {
deductedfromlbr,
lbr_adjustment,
location: lineLocation,
part_type,
...restI
} = i;
const r1 = await insertBill({
variables: {
bill: [
{
...remainingValues,
billlines: {
data:
remainingValues.billlines &&
remainingValues.billlines.map((i) => {
const {
deductedfromlbr,
lbr_adjustment,
location: lineLocation,
part_type,
...restI
} = i;
if (deductedfromlbr) {
adjustmentsToInsert[lbr_adjustment.mod_lbr_ty] =
(adjustmentsToInsert[lbr_adjustment.mod_lbr_ty] || 0) -
restI.actual_price / lbr_adjustment.rate;
}
return {
...restI,
deductedfromlbr: deductedfromlbr,
lbr_adjustment,
joblineid: i.joblineid === "noline" ? null : i.joblineid,
applicable_taxes: {
federal:
(i.applicable_taxes && i.applicable_taxes.federal) ||
false,
state:
(i.applicable_taxes && i.applicable_taxes.state) ||
false,
local:
(i.applicable_taxes && i.applicable_taxes.local) ||
false,
if (deductedfromlbr) {
adjustmentsToInsert[lbr_adjustment.mod_lbr_ty] =
(adjustmentsToInsert[lbr_adjustment.mod_lbr_ty] || 0) -
restI.actual_price / lbr_adjustment.rate;
}
return {
...restI,
deductedfromlbr: deductedfromlbr,
lbr_adjustment,
joblineid: i.joblineid === "noline" ? null : i.joblineid,
applicable_taxes: {
federal:
(i.applicable_taxes && i.applicable_taxes.federal) ||
false,
state:
(i.applicable_taxes && i.applicable_taxes.state) ||
false,
local:
(i.applicable_taxes && i.applicable_taxes.local) ||
false,
},
};
}),
},
},
};
}),
],
},
},
],
},
refetchQueries: ["QUERY_PARTS_BILLS_BY_JOBID", "GET_JOB_BY_PK"],
});
refetchQueries: ["QUERY_PARTS_BILLS_BY_JOBID", "GET_JOB_BY_PK"],
});
const adjKeys = Object.keys(adjustmentsToInsert);
if (adjKeys.length > 0) {
//Query the adjustments, merge, and update them.
const existingAdjustments = await client.query({
query: QUERY_JOB_LBR_ADJUSTMENTS,
variables: {
id: values.jobid,
},
});
const adjKeys = Object.keys(adjustmentsToInsert);
if (adjKeys.length > 0) {
//Query the adjustments, merge, and update them.
const existingAdjustments = await client.query({
query: QUERY_JOB_LBR_ADJUSTMENTS,
variables: {
id: values.jobid,
},
});
const newAdjustments = _.cloneDeep(
existingAdjustments.data.jobs_by_pk.lbr_adjustments
);
const newAdjustments = _.cloneDeep(
existingAdjustments.data.jobs_by_pk.lbr_adjustments
);
adjKeys.forEach((key) => {
newAdjustments[key] =
(newAdjustments[key] || 0) + adjustmentsToInsert[key];
adjKeys.forEach((key) => {
newAdjustments[key] =
(newAdjustments[key] || 0) + adjustmentsToInsert[key];
insertAuditTrail({
jobid: values.jobid,
operation: AuditTrailMapping.jobmodifylbradj({
mod_lbr_ty: key,
hours: adjustmentsToInsert[key].toFixed(1),
}),
});
});
const jobUpdate = client.mutate({
mutation: UPDATE_JOB,
variables: {
jobId: values.jobid,
job: {lbr_adjustments: newAdjustments},
},
});
if (!!jobUpdate.errors) {
notification["error"]({
message: t("jobs.errors.saving", {
message: JSON.stringify(jobUpdate.errors),
}),
});
return;
}
}
const markPolReceived =
outstanding_returns &&
outstanding_returns.filter((o) => o.cm_received === true);
if (markPolReceived && markPolReceived.length > 0) {
const r2 = await updatePartsOrderLines({
variables: {partsLineIds: markPolReceived.map((p) => p.id)},
});
if (!!r2.errors) {
setLoading(false);
setEnterAgain(false);
notification["error"]({
message: t("parts_orders.errors.updating", {
message: JSON.stringify(r2.errors),
}),
});
}
}
if (!!r1.errors) {
setLoading(false);
setEnterAgain(false);
notification["error"]({
message: t("bills.errors.creating", {
message: JSON.stringify(r1.errors),
}),
});
}
const billId = r1.data.insert_bills.returning[0].id;
const markInventoryConsumed =
inventory && inventory.filter((i) => i.consumefrominventory);
if (markInventoryConsumed && markInventoryConsumed.length > 0) {
const r2 = await updateInventoryLines({
variables: {
InventoryIds: markInventoryConsumed.map((p) => p.id),
consumedbybillid: billId,
},
});
if (!!r2.errors) {
setLoading(false);
setEnterAgain(false);
notification["error"]({
message: t("inventory.errors.updating", {
message: JSON.stringify(r2.errors),
}),
});
}
}
//If it's not a credit memo, update the statuses.
if (!values.is_credit_memo) {
await Promise.all(
remainingValues.billlines
.filter((il) => il.joblineid !== "noline")
.map((li) => {
return updateJobLines({
variables: {
lineId: li.joblineid,
line: {
location: li.location || location,
status:
bodyshop.md_order_statuses.default_received || "Received*",
},
},
});
})
);
}
/////////////////////////
if (upload && upload.length > 0) {
//insert Each of the documents?
if (bodyshop.uselocalmediaserver) {
upload.forEach((u) => {
handleLocalUpload({
ev: {file: u.originFileObj},
context: {
jobid: values.jobid,
invoice_number: remainingValues.invoice_number,
vendorid: remainingValues.vendorid,
},
});
});
} else {
upload.forEach((u) => {
handleUpload(
{file: u.originFileObj},
{
bodyshop: bodyshop,
uploaded_by: currentUser.email,
jobId: values.jobid,
billId: billId,
tagsArray: null,
callback: null,
}
);
});
}
}
///////////////////////////
setLoading(false);
notification["success"]({
message: t("bills.successes.created"),
});
if (generateLabel) {
GenerateDocument(
{
name: Templates.parts_invoice_label_single.key,
variables: {
id: billId,
},
},
{},
"p"
);
}
if (billEnterModal.actions.refetch) billEnterModal.actions.refetch();
insertAuditTrail({
jobid: values.jobid,
operation: AuditTrailMapping.jobmodifylbradj({
mod_lbr_ty: key,
hours: adjustmentsToInsert[key].toFixed(1),
}),
jobid: values.jobid,
billid: billId,
operation: AuditTrailMapping.billposted(
r1.data.insert_bills.returning[0].invoice_number
),
});
});
const jobUpdate = client.mutate({
mutation: UPDATE_JOB,
variables: {
jobId: values.jobid,
job: { lbr_adjustments: newAdjustments },
},
});
if (!!jobUpdate.errors) {
notification["error"]({
message: t("jobs.errors.saving", {
message: JSON.stringify(jobUpdate.errors),
}),
});
return;
}
}
const markPolReceived =
outstanding_returns &&
outstanding_returns.filter((o) => o.cm_received === true);
if (markPolReceived && markPolReceived.length > 0) {
const r2 = await updatePartsOrderLines({
variables: { partsLineIds: markPolReceived.map((p) => p.id) },
});
if (!!r2.errors) {
setLoading(false);
setEnterAgain(false);
notification["error"]({
message: t("parts_orders.errors.updating", {
message: JSON.stringify(r2.errors),
}),
});
}
}
if (!!r1.errors) {
setLoading(false);
setEnterAgain(false);
notification["error"]({
message: t("bills.errors.creating", {
message: JSON.stringify(r1.errors),
}),
});
}
const billId = r1.data.insert_bills.returning[0].id;
const markInventoryConsumed =
inventory && inventory.filter((i) => i.consumefrominventory);
if (markInventoryConsumed && markInventoryConsumed.length > 0) {
const r2 = await updateInventoryLines({
variables: {
InventoryIds: markInventoryConsumed.map((p) => p.id),
consumedbybillid: billId,
},
});
if (!!r2.errors) {
setLoading(false);
setEnterAgain(false);
notification["error"]({
message: t("inventory.errors.updating", {
message: JSON.stringify(r2.errors),
}),
});
}
}
//If it's not a credit memo, update the statuses.
if (!values.is_credit_memo) {
await Promise.all(
remainingValues.billlines
.filter((il) => il.joblineid !== "noline")
.map((li) => {
return updateJobLines({
variables: {
lineId: li.joblineid,
line: {
location: li.location || location,
status:
bodyshop.md_order_statuses.default_received || "Received*",
},
},
if (enterAgain) {
form.resetFields();
form.resetFields();
form.setFieldsValue({
...formValues,
billlines: [],
});
})
);
}
} else {
toggleModalVisible();
}
setEnterAgain(false);
};
/////////////////////////
if (upload && upload.length > 0) {
//insert Each of the documents?
const handleCancel = () => {
const r = window.confirm(t("general.labels.cancel"));
if (r === true) {
toggleModalVisible();
}
};
if (bodyshop.uselocalmediaserver) {
upload.forEach((u) => {
handleLocalUpload({
ev: { file: u.originFileObj },
context: {
jobid: values.jobid,
invoice_number: remainingValues.invoice_number,
vendorid: remainingValues.vendorid,
},
});
});
} else {
upload.forEach((u) => {
handleUpload(
{ file: u.originFileObj },
{
bodyshop: bodyshop,
uploaded_by: currentUser.email,
jobId: values.jobid,
billId: billId,
tagsArray: null,
callback: null,
useEffect(() => {
if (enterAgain) form.submit();
}, [enterAgain, form]);
useEffect(() => {
if (billEnterModal.open) {
form.setFieldsValue(formValues);
} else {
form.resetFields();
}
}, [billEnterModal.open, form, formValues]);
return (
<Modal
title={t("bills.labels.new")}
width={"98%"}
open={billEnterModal.open}
okText={t("general.actions.save")}
keyboard="false"
onOk={() => form.submit()}
onCancel={handleCancel}
afterClose={() => {
form.resetFields();
setLoading(false);
}}
footer={
<Space>
<Checkbox
checked={generateLabel}
onChange={(e) => setGenerateLabel(e.target.checked)}
>
{t("bills.labels.generatepartslabel")}
</Checkbox>
<Button onClick={handleCancel}>{t("general.actions.cancel")}</Button>
<Button loading={loading} onClick={() => form.submit()}>
{t("general.actions.save")}
</Button>
{billEnterModal.context && billEnterModal.context.id ? null : (
<Button
type="primary"
loading={loading}
onClick={() => {
setEnterAgain(true);
}}
>
{t("general.actions.saveandnew")}
</Button>
)}
</Space>
}
);
});
}
}
///////////////////////////
setLoading(false);
notification["success"]({
message: t("bills.successes.created"),
});
if (generateLabel) {
GenerateDocument(
{
name: Templates.parts_invoice_label_single.key,
variables: {
id: billId,
},
},
{},
"p"
);
}
if (billEnterModal.actions.refetch) billEnterModal.actions.refetch();
insertAuditTrail({
jobid: values.jobid,
billid: billId,
operation: AuditTrailMapping.billposted(
r1.data.insert_bills.returning[0].invoice_number
),
});
if (enterAgain) {
form.resetFields();
form.resetFields();
form.setFieldsValue({
...formValues,
billlines: [],
});
} else {
toggleModalVisible();
}
setEnterAgain(false);
};
const handleCancel = () => {
const r = window.confirm(t("general.labels.cancel"));
if (r === true) {
toggleModalVisible();
}
};
useEffect(() => {
if (enterAgain) form.submit();
}, [enterAgain, form]);
useEffect(() => {
if (billEnterModal.open) {
form.setFieldsValue(formValues);
} else {
form.resetFields();
}
}, [billEnterModal.open, form, formValues]);
return (
<Modal
title={t("bills.labels.new")}
width={"98%"}
open={billEnterModal.open}
okText={t("general.actions.save")}
keyboard="false"
onOk={() => form.submit()}
onCancel={handleCancel}
afterClose={() => {
form.resetFields();
setLoading(false);
}}
footer={
<Space>
<Checkbox
checked={generateLabel}
onChange={(e) => setGenerateLabel(e.target.checked)}
>
{t("bills.labels.generatepartslabel")}
</Checkbox>
<Button onClick={handleCancel}>{t("general.actions.cancel")}</Button>
<Button loading={loading} onClick={() => form.submit()}>
{t("general.actions.save")}
</Button>
{billEnterModal.context && billEnterModal.context.id ? null : (
<Button
type="primary"
loading={loading}
onClick={() => {
setEnterAgain(true);
}}
destroyOnClose
>
<Form
onFinish={handleFinish}
autoComplete={"off"}
layout="vertical"
form={form}
onFinishFailed={() => {
setEnterAgain(false);
}}
>
{t("general.actions.saveandnew")}
</Button>
)}
</Space>
}
destroyOnClose
>
<Form
onFinish={handleFinish}
autoComplete={"off"}
layout="vertical"
form={form}
onFinishFailed={() => {
setEnterAgain(false);
}}
>
<BillFormContainer
form={form}
disableInvNumber={billEnterModal.context.disableInvNumber}
/>
</Form>
</Modal>
);
<BillFormContainer
form={form}
disableInvNumber={billEnterModal.context.disableInvNumber}
/>
</Form>
</Modal>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
mapStateToProps,
mapDispatchToProps
)(BillEnterModalContainer);

View File

@@ -1,135 +1,136 @@
import { Form, Input, Table } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import {Form, Input, Table} from "antd";
import React, {useState} from "react";
import {useTranslation} from "react-i18next";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { alphaSort } from "../../utils/sorters";
import {alphaSort} from "../../utils/sorters";
import BillFormItemsExtendedFormItem from "./bill-form-lines.extended.formitem.component";
export default function BillFormLinesExtended({
lineData,
discount,
form,
responsibilityCenters,
disabled,
}) {
const [search, setSearch] = useState("");
const { t } = useTranslation();
const columns = [
{
title: t("joblines.fields.line_desc"),
dataIndex: "line_desc",
key: "line_desc",
width: "10%",
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
},
{
title: t("joblines.fields.oem_partno"),
dataIndex: "oem_partno",
key: "oem_partno",
width: "10%",
sorter: (a, b) => alphaSort(a.oem_partno, b.oem_partno),
},
{
title: t("joblines.fields.part_type"),
dataIndex: "part_type",
key: "part_type",
width: "10%",
filters: [
lineData,
discount,
form,
responsibilityCenters,
disabled,
}) {
const [search, setSearch] = useState("");
const {t} = useTranslation();
const columns = [
{
text: t("jobs.labels.partsfilter"),
value: ["PAN", "PAP", "PAL", "PAA", "PAS", "PASL"],
title: t("joblines.fields.line_desc"),
dataIndex: "line_desc",
key: "line_desc",
width: "10%",
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
},
{
text: t("joblines.fields.part_types.PAN"),
value: ["PAN", "PAP"],
title: t("joblines.fields.oem_partno"),
dataIndex: "oem_partno",
key: "oem_partno",
width: "10%",
sorter: (a, b) => alphaSort(a.oem_partno, b.oem_partno),
},
{
text: t("joblines.fields.part_types.PAL"),
value: ["PAL"],
title: t("joblines.fields.part_type"),
dataIndex: "part_type",
key: "part_type",
width: "10%",
filters: [
{
text: t("jobs.labels.partsfilter"),
value: ["PAN", "PAP", "PAL", "PAA", "PAS", "PASL"],
},
{
text: t("joblines.fields.part_types.PAN"),
value: ["PAN", "PAP"],
},
{
text: t("joblines.fields.part_types.PAL"),
value: ["PAL"],
},
{
text: t("joblines.fields.part_types.PAA"),
value: ["PAA"],
},
{
text: t("joblines.fields.part_types.PAS"),
value: ["PAS", "PASL"],
},
],
onFilter: (value, record) => value.includes(record.part_type),
render: (text, record) =>
record.part_type
? t(`joblines.fields.part_types.${record.part_type}`)
: null,
},
{
text: t("joblines.fields.part_types.PAA"),
value: ["PAA"],
},
{
text: t("joblines.fields.part_types.PAS"),
value: ["PAS", "PASL"],
},
],
onFilter: (value, record) => value.includes(record.part_type),
render: (text, record) =>
record.part_type
? t(`joblines.fields.part_types.${record.part_type}`)
: null,
},
{
title: t("joblines.fields.act_price"),
dataIndex: "act_price",
key: "act_price",
width: "10%",
sorter: (a, b) => a.act_price - b.act_price,
shouldCellUpdate: false,
render: (text, record) => (
<>
<CurrencyFormatter>
{record.db_ref === "900510" || record.db_ref === "900511"
? record.prt_dsmk_m
: record.act_price}
</CurrencyFormatter>
{record.part_qty ? `(x ${record.part_qty})` : null}
{record.prt_dsmk_p && record.prt_dsmk_p !== 0 ? (
<span
style={{ marginLeft: ".2rem" }}
>{`(${record.prt_dsmk_p}%)`}</span>
) : (
<></>
)}
</>
),
},
{
title: t("billlines.fields.posting"),
dataIndex: "posting",
key: "posting",
{
title: t("joblines.fields.act_price"),
dataIndex: "act_price",
key: "act_price",
width: "10%",
sorter: (a, b) => a.act_price - b.act_price,
shouldCellUpdate: false,
render: (text, record) => (
<>
<CurrencyFormatter>
{record.db_ref === "900510" || record.db_ref === "900511"
? record.prt_dsmk_m
: record.act_price}
</CurrencyFormatter>
{record.part_qty ? `(x ${record.part_qty})` : null}
{record.prt_dsmk_p && record.prt_dsmk_p !== 0 ? (
<span
style={{marginLeft: ".2rem"}}
>{`(${record.prt_dsmk_p}%)`}</span>
) : (
<></>
)}
</>
),
},
{
title: t("billlines.fields.posting"),
dataIndex: "posting",
key: "posting",
render: (text, record, index) => (
<Form.Item noStyle name={["billlineskeys", record.id]}>
<BillFormItemsExtendedFormItem
form={form}
record={record}
index={index}
responsibilityCenters={responsibilityCenters}
discount={discount}
/>
render: (text, record, index) => (
<Form.Item noStyle name={["billlineskeys", record.id]}>
<BillFormItemsExtendedFormItem
form={form}
record={record}
index={index}
responsibilityCenters={responsibilityCenters}
discount={discount}
/>
</Form.Item>
),
},
];
const data =
search === ""
? lineData
: lineData.filter(
(l) =>
(l.line_desc &&
l.line_desc.toLowerCase().includes(search.toLowerCase())) ||
(l.oem_partno &&
l.oem_partno.toLowerCase().includes(search.toLowerCase())) ||
(l.act_price &&
l.act_price.toString().startsWith(search.toString()))
);
return (
<Form.Item noStyle name="billlineskeys">
<button onClick={() => console.log(form.getFieldsValue())}>form</button>
<Input onChange={(e) => setSearch(e.target.value)} allowClear/>
<Table
pagination={false}
size="small"
columns={columns}
rowKey="id"
dataSource={data}
/>
</Form.Item>
),
},
];
const data =
search === ""
? lineData
: lineData.filter(
(l) =>
(l.line_desc &&
l.line_desc.toLowerCase().includes(search.toLowerCase())) ||
(l.oem_partno &&
l.oem_partno.toLowerCase().includes(search.toLowerCase())) ||
(l.act_price &&
l.act_price.toString().startsWith(search.toString()))
);
return (
<Form.Item noStyle name="billlineskeys">
<button onClick={() => console.log(form.getFieldsValue())}>form</button>
<Input onChange={(e) => setSearch(e.target.value)} allowClear />
<Table
pagination={false}
size="small"
columns={columns}
rowKey="id"
dataSource={data}
/>
</Form.Item>
);
);
}

View File

@@ -1,288 +1,288 @@
import React from "react";
import {
PlusCircleFilled,
MinusCircleFilled,
WarningOutlined,
PlusCircleFilled,
MinusCircleFilled,
WarningOutlined,
} from "@ant-design/icons";
import { Form, Button, InputNumber, Input, Select, Switch, Space } from "antd";
import { useTranslation } from "react-i18next";
import {Form, Button, InputNumber, Input, Select, Switch, Space} from "antd";
import {useTranslation} from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {selectBodyshop} from "../../redux/user/user.selectors";
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
import CiecaSelect from "../../utils/Ciecaselect";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(
mapStateToProps,
mapDispatchToProps
mapStateToProps,
mapDispatchToProps
)(BillFormItemsExtendedFormItem);
export function BillFormItemsExtendedFormItem({
value,
bodyshop,
form,
record,
index,
disabled,
responsibilityCenters,
discount,
}) {
// const { billlineskeys } = form.getFieldsValue("billlineskeys");
value,
bodyshop,
form,
record,
index,
disabled,
responsibilityCenters,
discount,
}) {
// const { billlineskeys } = form.getFieldsValue("billlineskeys");
const {t} = useTranslation();
if (!value)
return (
<Button
onClick={() => {
const values = form.getFieldsValue("billlineskeys");
form.setFieldsValue({
...values,
billlineskeys: {
...(values.billlineskeys || {}),
[record.id]: {
joblineid: record.id,
line_desc: record.line_desc,
quantity: record.part_qty || 1,
actual_price: record.act_price,
cost_center: record.part_type
? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid
? record.part_type
: responsibilityCenters.defaults &&
(responsibilityCenters.defaults.costs[record.part_type] ||
null)
: null,
},
},
});
}}
>
<PlusCircleFilled/>
</Button>
);
const { t } = useTranslation();
if (!value)
return (
<Button
onClick={() => {
const values = form.getFieldsValue("billlineskeys");
<Space wrap>
<Form.Item
label={t("billlines.fields.line_desc")}
name={["billlineskeys", record.id, "line_desc"]}
>
<Input disabled={disabled}/>
</Form.Item>
<Form.Item
label={t("billlines.fields.quantity")}
name={["billlineskeys", record.id, "quantity"]}
>
<InputNumber precision={0} min={0} disabled={disabled}/>
</Form.Item>
<Form.Item
label={t("billlines.fields.actual_price")}
name={["billlineskeys", record.id, "actual_price"]}
>
<CurrencyInput
min={0}
disabled={disabled}
onBlur={(e) => {
const {billlineskeys} = form.getFieldsValue("billlineskeys");
form.setFieldsValue({
billlineskeys: {
...billlineskeys,
[record.id]: {
...billlineskeys[billlineskeys],
actual_cost: !!billlineskeys[billlineskeys].actual_cost
? billlineskeys[billlineskeys].actual_cost
: Math.round(
(parseFloat(e.target.value) * (1 - discount) +
Number.EPSILON) *
100
) / 100,
},
},
});
}}
/>
</Form.Item>
<Form.Item
label={t("billlines.fields.actual_cost")}
name={["billlineskeys", record.id, "actual_cost"]}
>
<CurrencyInput min={0} disabled={disabled}/>
</Form.Item>
<Form.Item shouldUpdate>
{() => {
const line = value;
if (!!!line) return null;
const lineDiscount = (
1 -
Math.round((line.actual_cost / line.actual_price) * 100) / 100
).toPrecision(2);
form.setFieldsValue({
...values,
billlineskeys: {
...(values.billlineskeys || {}),
[record.id]: {
joblineid: record.id,
line_desc: record.line_desc,
quantity: record.part_qty || 1,
actual_price: record.act_price,
cost_center: record.part_type
? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid
? record.part_type
: responsibilityCenters.defaults &&
(responsibilityCenters.defaults.costs[record.part_type] ||
null)
: null,
},
},
});
}}
>
<PlusCircleFilled />
</Button>
if (lineDiscount - discount === 0) return <div/>;
return <WarningOutlined style={{color: "red"}}/>;
}}
</Form.Item>
<Form.Item
label={t("billlines.fields.cost_center")}
name={["billlineskeys", record.id, "cost_center"]}
>
<Select showSearch style={{minWidth: "3rem"}} disabled={disabled}>
{bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
? CiecaSelect(true, false)
: responsibilityCenters.costs.map((item) => (
<Select.Option key={item.name}>{item.name}</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item
label={t("billlines.fields.location")}
name={["billlineskeys", record.id, "location"]}
>
<Select disabled={disabled}>
{bodyshop.md_parts_locations.map((loc, idx) => (
<Select.Option key={idx} value={loc}>
{loc}
</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item
label={t("billlines.fields.deductedfromlbr")}
name={["billlineskeys", record.id, "deductedfromlbr"]}
valuePropName="checked"
>
<Switch disabled={disabled}/>
</Form.Item>
<Form.Item shouldUpdate style={{display: "inline-block"}}>
{() => {
if (
form.getFieldsValue("billlineskeys").billlineskeys[record.id]
.deductedfromlbr
)
return (
<div>
<Form.Item
label={t("joblines.fields.mod_lbr_ty")}
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
name={[
"billlineskeys",
record.id,
"lbr_adjustment",
"mod_lbr_ty",
]}
>
<Select allowClear>
<Select.Option value="LAA">
{t("joblines.fields.lbr_types.LAA")}
</Select.Option>
<Select.Option value="LAB">
{t("joblines.fields.lbr_types.LAB")}
</Select.Option>
<Select.Option value="LAD">
{t("joblines.fields.lbr_types.LAD")}
</Select.Option>
<Select.Option value="LAE">
{t("joblines.fields.lbr_types.LAE")}
</Select.Option>
<Select.Option value="LAF">
{t("joblines.fields.lbr_types.LAF")}
</Select.Option>
<Select.Option value="LAG">
{t("joblines.fields.lbr_types.LAG")}
</Select.Option>
<Select.Option value="LAM">
{t("joblines.fields.lbr_types.LAM")}
</Select.Option>
<Select.Option value="LAR">
{t("joblines.fields.lbr_types.LAR")}
</Select.Option>
<Select.Option value="LAS">
{t("joblines.fields.lbr_types.LAS")}
</Select.Option>
<Select.Option value="LAU">
{t("joblines.fields.lbr_types.LAU")}
</Select.Option>
<Select.Option value="LA1">
{t("joblines.fields.lbr_types.LA1")}
</Select.Option>
<Select.Option value="LA2">
{t("joblines.fields.lbr_types.LA2")}
</Select.Option>
<Select.Option value="LA3">
{t("joblines.fields.lbr_types.LA3")}
</Select.Option>
<Select.Option value="LA4">
{t("joblines.fields.lbr_types.LA4")}
</Select.Option>
</Select>
</Form.Item>
<Form.Item
label={t("jobs.labels.adjustmentrate")}
name={["billlineskeys", record.id, "lbr_adjustment", "rate"]}
initialValue={bodyshop.default_adjustment_rate}
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<InputNumber precision={2} min={0.01}/>
</Form.Item>
</div>
);
return <></>;
}}
</Form.Item>
<Form.Item
label={t("billlines.fields.federal_tax_applicable")}
name={["billlineskeys", record.id, "applicable_taxes", "federal"]}
valuePropName="checked"
>
<Switch disabled={disabled}/>
</Form.Item>
<Form.Item
label={t("billlines.fields.state_tax_applicable")}
name={["billlineskeys", record.id, "applicable_taxes", "state"]}
valuePropName="checked"
>
<Switch disabled={disabled}/>
</Form.Item>
<Form.Item
label={t("billlines.fields.local_tax_applicable")}
name={["billlineskeys", record.id, "applicable_taxes", "local"]}
valuePropName="checked"
>
<Switch disabled={disabled}/>
</Form.Item>
<Button
onClick={() => {
const values = form.getFieldsValue("billlineskeys");
form.setFieldsValue({
...values,
billlineskeys: {
...(values.billlineskeys || {}),
[record.id]: null,
},
});
}}
>
<MinusCircleFilled/>
</Button>
</Space>
);
return (
<Space wrap>
<Form.Item
label={t("billlines.fields.line_desc")}
name={["billlineskeys", record.id, "line_desc"]}
>
<Input disabled={disabled} />
</Form.Item>
<Form.Item
label={t("billlines.fields.quantity")}
name={["billlineskeys", record.id, "quantity"]}
>
<InputNumber precision={0} min={0} disabled={disabled} />
</Form.Item>
<Form.Item
label={t("billlines.fields.actual_price")}
name={["billlineskeys", record.id, "actual_price"]}
>
<CurrencyInput
min={0}
disabled={disabled}
onBlur={(e) => {
const { billlineskeys } = form.getFieldsValue("billlineskeys");
form.setFieldsValue({
billlineskeys: {
...billlineskeys,
[record.id]: {
...billlineskeys[billlineskeys],
actual_cost: !!billlineskeys[billlineskeys].actual_cost
? billlineskeys[billlineskeys].actual_cost
: Math.round(
(parseFloat(e.target.value) * (1 - discount) +
Number.EPSILON) *
100
) / 100,
},
},
});
}}
/>
</Form.Item>
<Form.Item
label={t("billlines.fields.actual_cost")}
name={["billlineskeys", record.id, "actual_cost"]}
>
<CurrencyInput min={0} disabled={disabled} />
</Form.Item>
<Form.Item shouldUpdate>
{() => {
const line = value;
if (!!!line) return null;
const lineDiscount = (
1 -
Math.round((line.actual_cost / line.actual_price) * 100) / 100
).toPrecision(2);
if (lineDiscount - discount === 0) return <div />;
return <WarningOutlined style={{ color: "red" }} />;
}}
</Form.Item>
<Form.Item
label={t("billlines.fields.cost_center")}
name={["billlineskeys", record.id, "cost_center"]}
>
<Select showSearch style={{ minWidth: "3rem" }} disabled={disabled}>
{bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
? CiecaSelect(true, false)
: responsibilityCenters.costs.map((item) => (
<Select.Option key={item.name}>{item.name}</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item
label={t("billlines.fields.location")}
name={["billlineskeys", record.id, "location"]}
>
<Select disabled={disabled}>
{bodyshop.md_parts_locations.map((loc, idx) => (
<Select.Option key={idx} value={loc}>
{loc}
</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item
label={t("billlines.fields.deductedfromlbr")}
name={["billlineskeys", record.id, "deductedfromlbr"]}
valuePropName="checked"
>
<Switch disabled={disabled} />
</Form.Item>
<Form.Item shouldUpdate style={{ display: "inline-block" }}>
{() => {
if (
form.getFieldsValue("billlineskeys").billlineskeys[record.id]
.deductedfromlbr
)
return (
<div>
<Form.Item
label={t("joblines.fields.mod_lbr_ty")}
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
name={[
"billlineskeys",
record.id,
"lbr_adjustment",
"mod_lbr_ty",
]}
>
<Select allowClear>
<Select.Option value="LAA">
{t("joblines.fields.lbr_types.LAA")}
</Select.Option>
<Select.Option value="LAB">
{t("joblines.fields.lbr_types.LAB")}
</Select.Option>
<Select.Option value="LAD">
{t("joblines.fields.lbr_types.LAD")}
</Select.Option>
<Select.Option value="LAE">
{t("joblines.fields.lbr_types.LAE")}
</Select.Option>
<Select.Option value="LAF">
{t("joblines.fields.lbr_types.LAF")}
</Select.Option>
<Select.Option value="LAG">
{t("joblines.fields.lbr_types.LAG")}
</Select.Option>
<Select.Option value="LAM">
{t("joblines.fields.lbr_types.LAM")}
</Select.Option>
<Select.Option value="LAR">
{t("joblines.fields.lbr_types.LAR")}
</Select.Option>
<Select.Option value="LAS">
{t("joblines.fields.lbr_types.LAS")}
</Select.Option>
<Select.Option value="LAU">
{t("joblines.fields.lbr_types.LAU")}
</Select.Option>
<Select.Option value="LA1">
{t("joblines.fields.lbr_types.LA1")}
</Select.Option>
<Select.Option value="LA2">
{t("joblines.fields.lbr_types.LA2")}
</Select.Option>
<Select.Option value="LA3">
{t("joblines.fields.lbr_types.LA3")}
</Select.Option>
<Select.Option value="LA4">
{t("joblines.fields.lbr_types.LA4")}
</Select.Option>
</Select>
</Form.Item>
<Form.Item
label={t("jobs.labels.adjustmentrate")}
name={["billlineskeys", record.id, "lbr_adjustment", "rate"]}
initialValue={bodyshop.default_adjustment_rate}
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<InputNumber precision={2} min={0.01} />
</Form.Item>
</div>
);
return <></>;
}}
</Form.Item>
<Form.Item
label={t("billlines.fields.federal_tax_applicable")}
name={["billlineskeys", record.id, "applicable_taxes", "federal"]}
valuePropName="checked"
>
<Switch disabled={disabled} />
</Form.Item>
<Form.Item
label={t("billlines.fields.state_tax_applicable")}
name={["billlineskeys", record.id, "applicable_taxes", "state"]}
valuePropName="checked"
>
<Switch disabled={disabled} />
</Form.Item>
<Form.Item
label={t("billlines.fields.local_tax_applicable")}
name={["billlineskeys", record.id, "applicable_taxes", "local"]}
valuePropName="checked"
>
<Switch disabled={disabled} />
</Form.Item>
<Button
onClick={() => {
const values = form.getFieldsValue("billlineskeys");
form.setFieldsValue({
...values,
billlineskeys: {
...(values.billlineskeys || {}),
[record.id]: null,
},
});
}}
>
<MinusCircleFilled />
</Button>
</Space>
);
}

View File

@@ -27,13 +27,27 @@ const mapStateToProps = createStructuredSelector({
});
const mapDispatchToProps = (dispatch) => ({});
export function BillFormComponent({bodyshop, disabled, form, vendorAutoCompleteOptions, lineData, responsibilityCenters, loadLines, billEdit, disableInvNumber, job, loadOutstandingReturns, loadInventory, preferredMake}) {
export function BillFormComponent({
bodyshop,
disabled,
form,
vendorAutoCompleteOptions,
lineData,
responsibilityCenters,
loadLines,
billEdit,
disableInvNumber,
job,
loadOutstandingReturns,
loadInventory,
preferredMake
}) {
const {t} = useTranslation();
const client = useApolloClient();
const [discount, setDiscount] = useState(0);
const { treatments: {Extended_Bill_Posting, ClosingPeriod} } = useSplitTreatments({
const {treatments: {Extended_Bill_Posting, ClosingPeriod}} = useSplitTreatments({
attributes: {},
names: ["Extended_Bill_Posting", "ClosingPeriod"],
splitKey: bodyshop.imexshopid,
@@ -53,23 +67,23 @@ export function BillFormComponent({bodyshop, disabled, form, vendorAutoCompleteO
});
};
const handleFederalTaxExemptSwitchToggle = (checked) => {
// Early gate
if (!checked) return;
const values = form.getFieldsValue("billlines");
// Gate bill lines
if (!values?.billlines?.length) return;
const handleFederalTaxExemptSwitchToggle = (checked) => {
// Early gate
if (!checked) return;
const values = form.getFieldsValue("billlines");
// Gate bill lines
if (!values?.billlines?.length) return;
const billlines = values.billlines.map((b) => {
b.applicable_taxes.federal = false;
return b;
});
form.setFieldsValue({ billlines });
};
const billlines = values.billlines.map((b) => {
b.applicable_taxes.federal = false;
return b;
});
form.setFieldsValue({billlines});
};
useEffect(() => {
if (job) form.validateFields(["is_credit_memo"]);
}, [job, form]);
useEffect(() => {
if (job) form.validateFields(["is_credit_memo"]);
}, [job, form]);
useEffect(() => {
const vendorId = form.getFieldValue("vendorid");
@@ -322,143 +336,143 @@ export function BillFormComponent({bodyshop, disabled, form, vendorAutoCompleteO
return Promise.reject(t("bills.labels.onlycmforinvoiced"));
}
return Promise.resolve();
},
}),
]}
>
<Switch />
</Form.Item>
<Form.Item
label={t("bills.fields.total")}
name="total"
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<CurrencyInput min={0} disabled={disabled} />
</Form.Item>
{!billEdit && (
<Form.Item label={t("bills.fields.allpartslocation")} name="location">
<Select style={{ width: "10rem" }} disabled={disabled} allowClear>
{bodyshop.md_parts_locations.map((loc, idx) => (
<Select.Option key={idx} value={loc}>
{loc}
</Select.Option>
))}
</Select>
</Form.Item>
)}
</LayoutFormRow>
<LayoutFormRow>
<Form.Item
span={3}
label={t("bills.fields.federal_tax_rate")}
name="federal_tax_rate"
>
<CurrencyInput min={0} disabled={disabled} />
</Form.Item>
<Form.Item
span={3}
label={t("bills.fields.state_tax_rate")}
name="state_tax_rate"
>
<CurrencyInput min={0} disabled={disabled} />
</Form.Item>
<Form.Item
span={3}
label={t("bills.fields.local_tax_rate")}
name="local_tax_rate"
>
<CurrencyInput min={0} />
</Form.Item>
{bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid ? (
<Form.Item
span={2}
label={t("bills.labels.federal_tax_exempt")}
name="federal_tax_exempt"
>
<Switch onChange={handleFederalTaxExemptSwitchToggle} />
</Form.Item>
) : null}
<Form.Item shouldUpdate span={13}>
{() => {
const values = form.getFieldsValue([
"billlines",
"total",
"federal_tax_rate",
"state_tax_rate",
"local_tax_rate",
]);
let totals;
if (
!!values.total &&
!!values.billlines &&
values.billlines.length > 0
)
totals = CalculateBillTotal(values);
if (!!totals)
return (
<div align="right">
<Space wrap>
<Statistic
title={t("bills.labels.subtotal")}
value={totals.subtotal.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.federal_tax")}
value={totals.federalTax.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.state_tax")}
value={totals.stateTax.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.local_tax")}
value={totals.localTax.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.entered_total")}
value={totals.enteredTotal.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.bill_total")}
value={totals.invoiceTotal.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.discrepancy")}
valueStyle={{
color:
totals.discrepancy.getAmount() === 0
? "green"
: "red",
}}
value={totals.discrepancy.toFormat()}
precision={2}
/>
</Space>
{form.getFieldValue("is_credit_memo") ? (
<AlertComponent
type="warning"
message={t("bills.labels.enteringcreditmemo")}
/>
) : null}
</div>
);
return null;
}}
</Form.Item>
</LayoutFormRow>
<Divider orientation="left">{t("bills.labels.bill_lines")}</Divider>
return Promise.resolve();
},
}),
]}
>
<Switch/>
</Form.Item>
<Form.Item
label={t("bills.fields.total")}
name="total"
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<CurrencyInput min={0} disabled={disabled}/>
</Form.Item>
{!billEdit && (
<Form.Item label={t("bills.fields.allpartslocation")} name="location">
<Select style={{width: "10rem"}} disabled={disabled} allowClear>
{bodyshop.md_parts_locations.map((loc, idx) => (
<Select.Option key={idx} value={loc}>
{loc}
</Select.Option>
))}
</Select>
</Form.Item>
)}
</LayoutFormRow>
<LayoutFormRow>
<Form.Item
span={3}
label={t("bills.fields.federal_tax_rate")}
name="federal_tax_rate"
>
<CurrencyInput min={0} disabled={disabled}/>
</Form.Item>
<Form.Item
span={3}
label={t("bills.fields.state_tax_rate")}
name="state_tax_rate"
>
<CurrencyInput min={0} disabled={disabled}/>
</Form.Item>
<Form.Item
span={3}
label={t("bills.fields.local_tax_rate")}
name="local_tax_rate"
>
<CurrencyInput min={0}/>
</Form.Item>
{bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid ? (
<Form.Item
span={2}
label={t("bills.labels.federal_tax_exempt")}
name="federal_tax_exempt"
>
<Switch onChange={handleFederalTaxExemptSwitchToggle}/>
</Form.Item>
) : null}
<Form.Item shouldUpdate span={13}>
{() => {
const values = form.getFieldsValue([
"billlines",
"total",
"federal_tax_rate",
"state_tax_rate",
"local_tax_rate",
]);
let totals;
if (
!!values.total &&
!!values.billlines &&
values.billlines.length > 0
)
totals = CalculateBillTotal(values);
if (!!totals)
return (
<div align="right">
<Space wrap>
<Statistic
title={t("bills.labels.subtotal")}
value={totals.subtotal.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.federal_tax")}
value={totals.federalTax.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.state_tax")}
value={totals.stateTax.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.local_tax")}
value={totals.localTax.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.entered_total")}
value={totals.enteredTotal.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.bill_total")}
value={totals.invoiceTotal.toFormat()}
precision={2}
/>
<Statistic
title={t("bills.labels.discrepancy")}
valueStyle={{
color:
totals.discrepancy.getAmount() === 0
? "green"
: "red",
}}
value={totals.discrepancy.toFormat()}
precision={2}
/>
</Space>
{form.getFieldValue("is_credit_memo") ? (
<AlertComponent
type="warning"
message={t("bills.labels.enteringcreditmemo")}
/>
) : null}
</div>
);
return null;
}}
</Form.Item>
</LayoutFormRow>
<Divider orientation="left">{t("bills.labels.bill_lines")}</Divider>
{Extended_Bill_Posting.treatment === "on" ? (
<BillFormLinesExtended

View File

@@ -1,82 +1,83 @@
import { useLazyQuery, useQuery } from "@apollo/client";
import {useLazyQuery, useQuery} from "@apollo/client";
import {useSplitTreatments} from "@splitsoftware/splitio-react";
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { QUERY_OUTSTANDING_INVENTORY } from "../../graphql/inventory.queries";
import { GET_JOB_LINES_TO_ENTER_BILL } from "../../graphql/jobs-lines.queries";
import { QUERY_UNRECEIVED_LINES } from "../../graphql/parts-orders.queries";
import { SEARCH_VENDOR_AUTOCOMPLETE } from "../../graphql/vendors.queries";
import { selectBodyshop } from "../../redux/user/user.selectors";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {QUERY_OUTSTANDING_INVENTORY} from "../../graphql/inventory.queries";
import {GET_JOB_LINES_TO_ENTER_BILL} from "../../graphql/jobs-lines.queries";
import {QUERY_UNRECEIVED_LINES} from "../../graphql/parts-orders.queries";
import {SEARCH_VENDOR_AUTOCOMPLETE} from "../../graphql/vendors.queries";
import {selectBodyshop} from "../../redux/user/user.selectors";
import BillCmdReturnsTableComponent from "../bill-cm-returns-table/bill-cm-returns-table.component";
import BillInventoryTable from "../bill-inventory-table/bill-inventory-table.component";
import BillFormComponent from "./bill-form.component";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
bodyshop: selectBodyshop,
});
export function BillFormContainer({
bodyshop,
form,
billEdit,
disabled,
disableInvNumber,
}) {
const { treatments: {Simple_Inventory} } = useSplitTreatments({
attributes: {},
names: ["Simple_Inventory"],
splitKey: bodyshop && bodyshop.imexshopid,
});
bodyshop,
form,
billEdit,
disabled,
disableInvNumber,
}) {
const {treatments: {Simple_Inventory}} = useSplitTreatments({
attributes: {},
names: ["Simple_Inventory"],
splitKey: bodyshop && bodyshop.imexshopid,
});
const { data: VendorAutoCompleteData } = useQuery(
SEARCH_VENDOR_AUTOCOMPLETE,
{ fetchPolicy: "network-only", nextFetchPolicy: "network-only" }
);
const {data: VendorAutoCompleteData} = useQuery(
SEARCH_VENDOR_AUTOCOMPLETE,
{fetchPolicy: "network-only", nextFetchPolicy: "network-only"}
);
const [loadLines, { data: lineData }] = useLazyQuery(
GET_JOB_LINES_TO_ENTER_BILL
);
const [loadLines, {data: lineData}] = useLazyQuery(
GET_JOB_LINES_TO_ENTER_BILL
);
const [loadOutstandingReturns, { loading: returnLoading, data: returnData }] =
useLazyQuery(QUERY_UNRECEIVED_LINES);
const [loadInventory, { loading: inventoryLoading, data: inventoryData }] =
useLazyQuery(QUERY_OUTSTANDING_INVENTORY);
const [loadOutstandingReturns, {loading: returnLoading, data: returnData}] =
useLazyQuery(QUERY_UNRECEIVED_LINES);
const [loadInventory, {loading: inventoryLoading, data: inventoryData}] =
useLazyQuery(QUERY_OUTSTANDING_INVENTORY);
return (
<>
<BillFormComponent
disabled={disabled}
form={form}
billEdit={billEdit}
vendorAutoCompleteOptions={
VendorAutoCompleteData && VendorAutoCompleteData.vendors
}
loadLines={loadLines}
lineData={lineData ? lineData.joblines : []}
job={lineData ? lineData.jobs_by_pk : null}
responsibilityCenters={bodyshop.md_responsibility_centers || null}
disableInvNumber={disableInvNumber}
loadOutstandingReturns={loadOutstandingReturns}
loadInventory={loadInventory}
preferredMake={lineData ? lineData.jobs_by_pk.v_make_desc : null}
/>
{!billEdit && (
<BillCmdReturnsTableComponent
form={form}
returnLoading={returnLoading}
returnData={returnData}
/>
)}
{Simple_Inventory.treatment === "on" && (
<BillInventoryTable
form={form}
inventoryLoading={inventoryLoading}
inventoryData={billEdit ? [] : inventoryData}
billEdit={billEdit}
/>
)}
</>
);
return (
<>
<BillFormComponent
disabled={disabled}
form={form}
billEdit={billEdit}
vendorAutoCompleteOptions={
VendorAutoCompleteData && VendorAutoCompleteData.vendors
}
loadLines={loadLines}
lineData={lineData ? lineData.joblines : []}
job={lineData ? lineData.jobs_by_pk : null}
responsibilityCenters={bodyshop.md_responsibility_centers || null}
disableInvNumber={disableInvNumber}
loadOutstandingReturns={loadOutstandingReturns}
loadInventory={loadInventory}
preferredMake={lineData ? lineData.jobs_by_pk.v_make_desc : null}
/>
{!billEdit && (
<BillCmdReturnsTableComponent
form={form}
returnLoading={returnLoading}
returnData={returnData}
/>
)}
{Simple_Inventory.treatment === "on" && (
<BillInventoryTable
form={form}
inventoryLoading={inventoryLoading}
inventoryData={billEdit ? [] : inventoryData}
billEdit={billEdit}
/>
)}
</>
);
}
export default connect(mapStateToProps, null)(BillFormContainer);

Some files were not shown because too many files have changed in this diff Show More