@things-factory/quotation 9.0.0-beta.24 → 9.0.0-beta.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/package.json +5 -5
  2. package/dist-client/actions/main.d.ts +0 -1
  3. package/dist-client/actions/main.js +0 -2
  4. package/dist-client/actions/main.js.map +0 -1
  5. package/dist-client/activities/activity-quotation-edit.d.ts +0 -14
  6. package/dist-client/activities/activity-quotation-edit.js +0 -87
  7. package/dist-client/activities/activity-quotation-edit.js.map +0 -1
  8. package/dist-client/activities/activity-quotation-view.d.ts +0 -14
  9. package/dist-client/activities/activity-quotation-view.js +0 -87
  10. package/dist-client/activities/activity-quotation-view.js.map +0 -1
  11. package/dist-client/bootstrap.d.ts +0 -1
  12. package/dist-client/bootstrap.js +0 -8
  13. package/dist-client/bootstrap.js.map +0 -1
  14. package/dist-client/index.d.ts +0 -1
  15. package/dist-client/index.js +0 -2
  16. package/dist-client/index.js.map +0 -1
  17. package/dist-client/pages/main.d.ts +0 -1
  18. package/dist-client/pages/main.js +0 -27
  19. package/dist-client/pages/main.js.map +0 -1
  20. package/dist-client/pages/quotation/quotation-importer.d.ts +0 -23
  21. package/dist-client/pages/quotation/quotation-importer.js +0 -94
  22. package/dist-client/pages/quotation/quotation-importer.js.map +0 -1
  23. package/dist-client/pages/quotation/quotation-list-page.d.ts +0 -61
  24. package/dist-client/pages/quotation/quotation-list-page.js +0 -306
  25. package/dist-client/pages/quotation/quotation-list-page.js.map +0 -1
  26. package/dist-client/reducers/main.d.ts +0 -6
  27. package/dist-client/reducers/main.js +0 -14
  28. package/dist-client/reducers/main.js.map +0 -1
  29. package/dist-client/route.d.ts +0 -1
  30. package/dist-client/route.js +0 -11
  31. package/dist-client/route.js.map +0 -1
  32. package/dist-client/tsconfig.tsbuildinfo +0 -1
  33. package/dist-server/activities/activity-quotation.d.ts +0 -42
  34. package/dist-server/activities/activity-quotation.js +0 -114
  35. package/dist-server/activities/activity-quotation.js.map +0 -1
  36. package/dist-server/activities/index.d.ts +0 -1
  37. package/dist-server/activities/index.js +0 -17
  38. package/dist-server/activities/index.js.map +0 -1
  39. package/dist-server/controllers/index.d.ts +0 -0
  40. package/dist-server/controllers/index.js +0 -1
  41. package/dist-server/controllers/index.js.map +0 -1
  42. package/dist-server/index.d.ts +0 -3
  43. package/dist-server/index.js +0 -7
  44. package/dist-server/index.js.map +0 -1
  45. package/dist-server/middlewares/index.d.ts +0 -1
  46. package/dist-server/middlewares/index.js +0 -7
  47. package/dist-server/middlewares/index.js.map +0 -1
  48. package/dist-server/migrations/index.d.ts +0 -1
  49. package/dist-server/migrations/index.js +0 -12
  50. package/dist-server/migrations/index.js.map +0 -1
  51. package/dist-server/routes.d.ts +0 -0
  52. package/dist-server/routes.js +0 -24
  53. package/dist-server/routes.js.map +0 -1
  54. package/dist-server/service/index.d.ts +0 -6
  55. package/dist-server/service/index.js +0 -23
  56. package/dist-server/service/index.js.map +0 -1
  57. package/dist-server/service/quotation/event-subscriber.d.ts +0 -7
  58. package/dist-server/service/quotation/event-subscriber.js +0 -21
  59. package/dist-server/service/quotation/event-subscriber.js.map +0 -1
  60. package/dist-server/service/quotation/index.d.ts +0 -7
  61. package/dist-server/service/quotation/index.js +0 -12
  62. package/dist-server/service/quotation/index.js.map +0 -1
  63. package/dist-server/service/quotation/quotation-history.d.ts +0 -25
  64. package/dist-server/service/quotation/quotation-history.js +0 -132
  65. package/dist-server/service/quotation/quotation-history.js.map +0 -1
  66. package/dist-server/service/quotation/quotation-mutation.d.ts +0 -10
  67. package/dist-server/service/quotation/quotation-mutation.js +0 -168
  68. package/dist-server/service/quotation/quotation-mutation.js.map +0 -1
  69. package/dist-server/service/quotation/quotation-query.d.ts +0 -12
  70. package/dist-server/service/quotation/quotation-query.js +0 -97
  71. package/dist-server/service/quotation/quotation-query.js.map +0 -1
  72. package/dist-server/service/quotation/quotation-type.d.ts +0 -23
  73. package/dist-server/service/quotation/quotation-type.js +0 -86
  74. package/dist-server/service/quotation/quotation-type.js.map +0 -1
  75. package/dist-server/service/quotation/quotation.d.ts +0 -25
  76. package/dist-server/service/quotation/quotation.js +0 -112
  77. package/dist-server/service/quotation/quotation.js.map +0 -1
  78. package/dist-server/tsconfig.tsbuildinfo +0 -1
@@ -1,306 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import '@operato/data-grist';
3
- import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
4
- import { PageView, store } from '@operato/shell';
5
- import { css, html } from 'lit';
6
- import { customElement, property, query } from 'lit/decorators.js';
7
- import { ScopedElementsMixin } from '@open-wc/scoped-elements';
8
- import { DataGrist } from '@operato/data-grist';
9
- import { client } from '@operato/graphql';
10
- import { i18next, localize } from '@operato/i18n';
11
- import { notify, openPopup } from '@operato/layout';
12
- import { isMobileDevice } from '@operato/utils';
13
- import { connect } from 'pwa-helpers/connect-mixin';
14
- import gql from 'graphql-tag';
15
- import { QuotationImporter } from './quotation-importer';
16
- let QuotationListPage = class QuotationListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
17
- constructor() {
18
- super(...arguments);
19
- this.mode = isMobileDevice() ? 'CARD' : 'GRID';
20
- }
21
- static get scopedElements() {
22
- return {
23
- 'quotation-importer': QuotationImporter
24
- };
25
- }
26
- get context() {
27
- var _a;
28
- return {
29
- title: i18next.t('title.quotation list'),
30
- search: {
31
- handler: (search) => {
32
- this.grist.searchText = search;
33
- },
34
- value: ((_a = this.grist) === null || _a === void 0 ? void 0 : _a.searchText) || ''
35
- },
36
- filter: {
37
- handler: () => {
38
- this.grist.toggleHeadroom();
39
- }
40
- },
41
- help: 'quotation/quotation',
42
- actions: [
43
- Object.assign({ title: i18next.t('button.save'), action: this._updateQuotation.bind(this) }, CommonButtonStyles.save),
44
- Object.assign({ title: i18next.t('button.delete'), action: this._deleteQuotation.bind(this) }, CommonButtonStyles.delete)
45
- ],
46
- exportable: {
47
- name: i18next.t('title.quotation list'),
48
- data: this.exportHandler.bind(this)
49
- },
50
- importable: {
51
- handler: this.importHandler.bind(this)
52
- }
53
- };
54
- }
55
- render() {
56
- const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
57
- return html `
58
- <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
59
- <div slot="headroom" class="header">
60
- <div class="filters">
61
- <ox-filters-form autofocus></ox-filters-form>
62
-
63
- <div id="modes">
64
- <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
65
- <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
66
- <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
67
- </div>
68
- </div>
69
- </div>
70
- </ox-grist>
71
- `;
72
- }
73
- async pageInitialized(lifecycle) {
74
- this.gristConfig = {
75
- list: {
76
- fields: ['name', 'description'],
77
- details: ['active', 'updatedAt']
78
- },
79
- columns: [
80
- { type: 'gutter', gutterName: 'sequence' },
81
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
82
- {
83
- type: 'string',
84
- name: 'name',
85
- header: i18next.t('field.name'),
86
- record: {
87
- editable: true
88
- },
89
- filter: 'search',
90
- sortable: true,
91
- width: 150
92
- },
93
- {
94
- type: 'string',
95
- name: 'description',
96
- header: i18next.t('field.description'),
97
- record: {
98
- editable: true
99
- },
100
- filter: 'search',
101
- width: 200
102
- },
103
- {
104
- type: 'checkbox',
105
- name: 'active',
106
- label: true,
107
- header: i18next.t('field.active'),
108
- record: {
109
- editable: true
110
- },
111
- filter: true,
112
- sortable: true,
113
- width: 60
114
- },
115
- {
116
- type: 'resource-object',
117
- name: 'updater',
118
- header: i18next.t('field.updater'),
119
- record: {
120
- editable: false
121
- },
122
- sortable: true,
123
- width: 120
124
- },
125
- {
126
- type: 'datetime',
127
- name: 'updatedAt',
128
- header: i18next.t('field.updated_at'),
129
- record: {
130
- editable: false
131
- },
132
- sortable: true,
133
- width: 180
134
- }
135
- ],
136
- rows: {
137
- selectable: {
138
- multiple: true
139
- }
140
- },
141
- sorters: [
142
- {
143
- name: 'name'
144
- }
145
- ]
146
- };
147
- }
148
- async pageUpdated(changes, lifecycle) {
149
- if (this.active) {
150
- // do something here when this page just became as active
151
- }
152
- }
153
- async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
154
- const response = await client.query({
155
- query: gql `
156
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
157
- responses: quotations(filters: $filters, pagination: $pagination, sortings: $sortings) {
158
- items {
159
- id
160
- name
161
- description
162
- active
163
- updater {
164
- id
165
- name
166
- }
167
- updatedAt
168
- }
169
- total
170
- }
171
- }
172
- `,
173
- variables: {
174
- filters,
175
- pagination: { page, limit },
176
- sortings
177
- }
178
- });
179
- return {
180
- total: response.data.responses.total || 0,
181
- records: response.data.responses.items || []
182
- };
183
- }
184
- async _deleteQuotation() {
185
- if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
186
- const ids = this.grist.selected.map(record => record.id);
187
- if (ids && ids.length > 0) {
188
- const response = await client.mutate({
189
- mutation: gql `
190
- mutation ($ids: [String!]!) {
191
- deleteQuotations(ids: $ids)
192
- }
193
- `,
194
- variables: {
195
- ids
196
- }
197
- });
198
- if (!response.errors) {
199
- this.grist.fetch();
200
- notify({
201
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
202
- });
203
- }
204
- }
205
- }
206
- }
207
- async _updateQuotation() {
208
- let patches = this.grist.dirtyRecords;
209
- if (patches && patches.length) {
210
- patches = patches.map(patch => {
211
- let patchField = patch.id ? { id: patch.id } : {};
212
- const dirtyFields = patch.__dirtyfields__;
213
- for (let key in dirtyFields) {
214
- patchField[key] = dirtyFields[key].after;
215
- }
216
- patchField.cuFlag = patch.__dirty__;
217
- return patchField;
218
- });
219
- const response = await client.mutate({
220
- mutation: gql `
221
- mutation ($patches: [QuotationPatch!]!) {
222
- updateMultipleQuotation(patches: $patches) {
223
- name
224
- }
225
- }
226
- `,
227
- variables: {
228
- patches
229
- }
230
- });
231
- if (!response.errors) {
232
- this.grist.fetch();
233
- }
234
- }
235
- }
236
- async exportHandler() {
237
- const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records;
238
- const targetFieldSet = new Set(['id', 'name', 'description', 'active']);
239
- return exportTargets.map(quotation => {
240
- let tempObj = {};
241
- for (const field of targetFieldSet) {
242
- tempObj[field] = quotation[field];
243
- }
244
- return tempObj;
245
- });
246
- }
247
- async importHandler(records) {
248
- const popup = openPopup(html `
249
- <quotation-importer
250
- .quotations=${records}
251
- @imported=${() => {
252
- history.back();
253
- this.grist.fetch();
254
- }}
255
- ></quotation-importer>
256
- `, {
257
- backdrop: true,
258
- size: 'large',
259
- title: i18next.t('title.import quotation')
260
- });
261
- popup.onclosed = () => {
262
- this.grist.fetch();
263
- };
264
- }
265
- };
266
- QuotationListPage.styles = [
267
- ScrollbarStyles,
268
- CommonGristStyles,
269
- CommonHeaderStyles,
270
- css `
271
- :host {
272
- display: flex;
273
-
274
- width: 100%;
275
-
276
- --grid-record-emphasized-background-color: #8b0000;
277
- --grid-record-emphasized-color: #ff6b6b;
278
- }
279
-
280
- ox-grist {
281
- overflow-y: auto;
282
- flex: 1;
283
- }
284
-
285
- ox-filters-form {
286
- flex: 1;
287
- }
288
- `
289
- ];
290
- __decorate([
291
- property({ type: Object }),
292
- __metadata("design:type", Object)
293
- ], QuotationListPage.prototype, "gristConfig", void 0);
294
- __decorate([
295
- property({ type: String }),
296
- __metadata("design:type", String)
297
- ], QuotationListPage.prototype, "mode", void 0);
298
- __decorate([
299
- query('ox-grist'),
300
- __metadata("design:type", DataGrist)
301
- ], QuotationListPage.prototype, "grist", void 0);
302
- QuotationListPage = __decorate([
303
- customElement('quotation-list-page')
304
- ], QuotationListPage);
305
- export { QuotationListPage };
306
- //# sourceMappingURL=quotation-list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c,EAAE,CAAC;gBACnC,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;YACnC,CAAC;YAED,OAAO,OAAO,CAAA;QAChB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAO;QACzB,MAAM,KAAK,GAAG,SAAS,CACrB,IAAI,CAAA;;wBAEc,OAAO;sBACT,GAAG,EAAE;YACf,OAAO,CAAC,IAAI,EAAE,CAAA;YACd,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC;;OAEJ,EACD;YACE,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;SAC3C,CACF,CAAA;QAED,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC,CAAA;IACH,CAAC;;AA7SM,wBAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBF;CACF,AAvBY,CAuBZ;AAQ2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;gDAAA;AAnCjC,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CA+S7B","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\nimport { QuotationImporter } from './quotation-importer'\n\n@customElement('quotation-list-page')\nexport class QuotationListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n\n ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'quotation-importer': QuotationImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.quotation list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'quotation/quotation',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateQuotation.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteQuotation.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.quotation list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['active', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: quotations(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n active\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteQuotation() {\n if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteQuotations(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateQuotation() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [QuotationPatch!]!) {\n updateMultipleQuotation(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(quotation => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = quotation[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <quotation-importer\n .quotations=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></quotation-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import quotation')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
@@ -1,6 +0,0 @@
1
- declare const quotation: (state: {
2
- quotation: string;
3
- } | undefined, action: any) => {
4
- quotation: string;
5
- };
6
- export default quotation;
@@ -1,14 +0,0 @@
1
- import { UPDATE_QUOTATION } from '../actions/main';
2
- const INITIAL_STATE = {
3
- quotation: 'ABC'
4
- };
5
- const quotation = (state = INITIAL_STATE, action) => {
6
- switch (action.type) {
7
- case UPDATE_QUOTATION:
8
- return Object.assign({}, state);
9
- default:
10
- return state;
11
- }
12
- };
13
- export default quotation;
14
- //# sourceMappingURL=main.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../client/reducers/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,KAAK;CACjB,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,aAAa,EAAE,MAAM,EAAE,EAAE;IAClD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,gBAAgB;YACnB,yBAAY,KAAK,EAAE;QAErB;YACE,OAAO,KAAK,CAAA;IAChB,CAAC;AACH,CAAC,CAAA;AAED,eAAe,SAAS,CAAA","sourcesContent":["import { UPDATE_QUOTATION } from '../actions/main'\n\nconst INITIAL_STATE = {\n quotation: 'ABC'\n}\n\nconst quotation = (state = INITIAL_STATE, action) => {\n switch (action.type) {\n case UPDATE_QUOTATION:\n return { ...state }\n\n default:\n return state\n }\n}\n\nexport default quotation\n"]}
@@ -1 +0,0 @@
1
- export default function route(page: string): "quotation-main" | "quotation-list" | undefined;
@@ -1,11 +0,0 @@
1
- export default function route(page) {
2
- switch (page) {
3
- case 'quotation-main':
4
- import('./pages/main');
5
- return page;
6
- case 'quotation-list':
7
- import('./pages/quotation/quotation-list-page');
8
- return page;
9
- }
10
- }
11
- //# sourceMappingURL=route.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../client/route.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAY;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,gBAAgB;YACnB,MAAM,CAAC,cAAc,CAAC,CAAA;YACtB,OAAO,IAAI,CAAA;QAEb,KAAK,gBAAgB;YACnB,MAAM,CAAC,uCAAuC,CAAC,CAAA;YAC/C,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC","sourcesContent":["export default function route(page: string) {\n switch (page) {\n case 'quotation-main':\n import('./pages/main')\n return page\n \n case 'quotation-list':\n import('./pages/quotation/quotation-list-page')\n return page\n }\n}\n"]}