diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6fa232f..1a234c7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,6 +56,9 @@ importers: '@msgpack/msgpack': specifier: ^2.7.2 version: 2.8.0 + '@svelte-put/dragscroll': + specifier: ^3.0.0 + version: 3.0.0 '@tailwindcss/forms': specifier: ^0.5.3 version: 0.5.7(tailwindcss@3.3.5) @@ -1181,6 +1184,10 @@ packages: engines: {node: '>=10'} dev: true + /@svelte-put/dragscroll@3.0.0: + resolution: {integrity: sha512-h9MkYBQ9pDmCo/zHtMPzKrTSjGIogbbtRjtoTJH9hjBZGxPhpcGKgS3UA8wLF+IqB47Hcp97LblB855iZlo5nA==} + dev: false + /@sveltejs/adapter-static@2.0.3(@sveltejs/kit@1.30.3): resolution: {integrity: sha512-VUqTfXsxYGugCpMqQv1U0LIdbR3S5nBkMMDmpjGVJyM6Q2jHVMFtdWJCkeHMySc6mZxJ+0eZK3T7IgmUCDrcUQ==} peerDependencies: diff --git a/ui/package.json b/ui/package.json index 36a1c2c..b7bb683 100644 --- a/ui/package.json +++ b/ui/package.json @@ -28,7 +28,8 @@ "leaflet": "^1.9.3", "svelte-apollo": "^0.5.0", "svelte-leafletjs": "^0.10.0", - "ws": "^8.13.0" + "ws": "^8.13.0", + "@svelte-put/dragscroll": "^3.0.0" }, "devDependencies": { "@rollup/plugin-replace": "^4.0.0", diff --git a/ui/src/lib/CommitmentModal.svelte b/ui/src/lib/CommitmentModal.svelte index a1b8e03..3de6877 100644 --- a/ui/src/lib/CommitmentModal.svelte +++ b/ui/src/lib/CommitmentModal.svelte @@ -29,6 +29,17 @@ let agents: Agent[]; let resourceSpecifications: any[]; let units: any[]; + let saveCost: boolean = false; + + $: saveCost; + + $: if (selectedCommitment) { + if (selectedCommitment.clauseOf && selectedCommitment.clauseOf.commitments.length > 0) { + saveCost = true + } else { + saveCost = false + } + } // $: if (open) { // newCommitment.id = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); @@ -399,10 +410,12 @@ const GET_ALL_RESOURCE_SPECIFICATIONS = gql` id="defaultUnitOfResource" name="defaultUnitOfResource" class="mt-2 block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6" - bind:value={newCommitment.resourceConformsTo.name} + value={newCommitment.resourceConformsTo.name} on:change={(e) => { newCommitment.resourceQuantity.hasUnit = resourceSpecifications.find((rs) => rs.name === e.target.value).defaultUnitOfResource - newCommitment.resourceConformsTo.defaultUnitOfResource = resourceSpecifications.find((rs) => rs.name === e.target.value).defaultUnitOfResource + // newCommitment.resourceConformsTo.defaultUnitOfResource = resourceSpecifications.find((rs) => rs.name === e.target.value).defaultUnitOfResource + let x = resourceSpecifications.find((rs) => rs.name === e.target.value) + newCommitment.resourceConformsTo = x }} > {#each resourceSpecifications as rs} @@ -491,7 +504,7 @@ const GET_ALL_RESOURCE_SPECIFICATIONS = gql` > {#if units} {#each units as unit} - + {/each} {/if} @@ -525,6 +538,22 @@ const GET_ALL_RESOURCE_SPECIFICATIONS = gql` /> {/if} + + +
+ { + saveCost = e.target.checked + }} + class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500" + /> + +
+ @@ -577,13 +606,13 @@ const GET_ALL_RESOURCE_SPECIFICATIONS = gql` // selectedCommitment = Object.assign({}, newCommitmentTemplate) } - // console.log("hihi") dispatch('submit', { column: commitmentModalColumn, process: commitmentModalProcess, side: commitmentModalSide, commitment: updatedCommitment, - useAs: 'update' + useAs: 'update', + saveCost: saveCost }); open = false; }} @@ -614,7 +643,8 @@ const GET_ALL_RESOURCE_SPECIFICATIONS = gql` ...newCommitment, id: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) }, - useAs: 'new' + useAs: 'new', + saveCost: saveCost }); // } diff --git a/ui/src/lib/EconomicEventModal.svelte b/ui/src/lib/EconomicEventModal.svelte index af4b3b0..6df87db 100644 --- a/ui/src/lib/EconomicEventModal.svelte +++ b/ui/src/lib/EconomicEventModal.svelte @@ -426,7 +426,7 @@ const GET_ALL_RESOURCE_SPECIFICATIONS = gql` > {#if units} {#each units as unit} - + {/each} {/if} @@ -461,19 +461,33 @@ const GET_ALL_RESOURCE_SPECIFICATIONS = gql` {/if}
-
- - + { + saveCost = e.target.checked + }} + class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500" + /> + +
--> +
+ { - console.log("lkjjjjjjj", e) selectedCommitment.finished = e.target.checked console.log(selectedCommitment.finished) }} - bind:checked={finished} class="mt-2"> + bind:checked={finished} + class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500" + > + +
diff --git a/ui/src/lib/Header.svelte b/ui/src/lib/Header.svelte index 6e3a651..c88abc3 100644 --- a/ui/src/lib/Header.svelte +++ b/ui/src/lib/Header.svelte @@ -26,7 +26,7 @@