Removed old asset assignment collection (delete from the db if you have it). Added proper history associated with assigning and unassigning. Need to still add events attached to a CB which then transition to the history when the CB is checked in.
This commit is contained in:
@@ -63,11 +63,14 @@
|
||||
}
|
||||
let assetId = "";
|
||||
let serial = "";
|
||||
let conditions = ['New', 'Like New', 'Good', 'Okay', 'Damaged'];
|
||||
let condition = "New";
|
||||
let conditionDetails = "";
|
||||
const addAsset = () => {
|
||||
if(selectedAssetType && selectedAssetType._id && assetId) {
|
||||
let result = Meteor.call("assets.add", selectedAssetType._id, assetId, serial, (err, res) => {
|
||||
let result = Meteor.call("assets.add", selectedAssetType._id, assetId, serial, condition, conditionDetails, (err, res) => {
|
||||
if (err) {
|
||||
if (err.error === 'duplicateAssetId')
|
||||
if (err.error === 'Duplicate Asset Id')
|
||||
alert("The asset ID `" + assetId + "` has already been used.");
|
||||
else
|
||||
alert(err);
|
||||
@@ -138,6 +141,15 @@
|
||||
<TextField type="text" style="width: 100%" bind:value={serial} label="Serial">
|
||||
</TextField>
|
||||
</div>
|
||||
<Select bind:value={condition} label="Condition">
|
||||
{#each conditions as next}
|
||||
<Option value={next}>{next}</Option>
|
||||
{/each}
|
||||
</Select>
|
||||
<div style="grid-column: 1/span 1">
|
||||
<TextField type="text" style="width: 100%" bind:value={conditionDetails} label="Condition Details">
|
||||
</TextField>
|
||||
</div>
|
||||
<div style="text-align: right; margin-top: 2rem">
|
||||
<Button on:click={addAsset} variant="raised">Add</Button>
|
||||
</div>
|
||||
|
||||
@@ -64,11 +64,14 @@
|
||||
],
|
||||
};
|
||||
const deleteAsset = asset => {
|
||||
if(asset && asset._id) Meteor.call("assets.remove", asset._id);
|
||||
if(asset && asset._id) {
|
||||
if(confirm("Delete Asset? This is permanent.")) Meteor.call("assets.remove", asset._id);
|
||||
}
|
||||
};
|
||||
// Create a holder for the site being edited. This allows us to clear the editor when the user finishes, and allows the table or parent view to setup the editor.
|
||||
let editedAsset = writable(null);
|
||||
let dirtyAsset = null;
|
||||
let conditions = ['New', 'Like New', 'Good', 'Okay', 'Damaged'];
|
||||
// Copy the edited site when ever it changes, set some defaults for a new site object (to make the view happy).
|
||||
editedAsset.subscribe(site => {
|
||||
if(site) {
|
||||
@@ -126,6 +129,15 @@
|
||||
<TextField type="text" style="width: 100%" bind:value={dirtyAsset.serial} label="Serial">
|
||||
</TextField>
|
||||
</div>
|
||||
<Select bind:value={dirtyAsset.condition} label="Condition">
|
||||
{#each conditions as next}
|
||||
<Option value={next}>{next}</Option>
|
||||
{/each}
|
||||
</Select>
|
||||
<div style="grid-column: 1/span 1">
|
||||
<TextField type="text" style="width: 100%" bind:value={dirtyAsset.conditionDetails} label="Condition Details">
|
||||
</TextField>
|
||||
</div>
|
||||
|
||||
<div style="grid-column: 1/span 1; white-space: nowrap; text-align: right; margin-top: 0.5rem">
|
||||
<button type="button" style="grid-column: 2/span 1;" class="button accept-button material-icons material-symbols-outlined" on:click={applyAssetChanges}>
|
||||
|
||||
Reference in New Issue
Block a user