This commit is contained in:
2021-02-27 18:00:04 +00:00
parent 9d4fbb70d7
commit 6beeae8ef4
3 changed files with 25 additions and 73 deletions

View File

@@ -10,6 +10,9 @@ TODO: SET DEADLINES
MISC ITEMS THAT CAME UP
## CLIENT MISC ITEMS
todo: bugbug sort a column in data table then remove that column from display will trigger error
needs to gracefully handle missing columns
todo: poitem edit form currency fields when updated by server on save lose currency format and show as raw decimal number
maybe currency control does not respond to underlying data changes it didn't initiate?
seems maybe it's ok in main form but that's maybe just because it doesn't change values automatically
@@ -175,7 +178,13 @@ todo: how to add locale keys in future after release without erasing all data?
CURRENTLY DOING: PurchaseOrder - restock required
todo: currently working on datatable to emit full row selections since there is no ID to select items in restocklist as it has no id
maybe a materialized view would but I want live data only
can't ever work because server only sends columns asked for, there is no concept of a hidden column but available
so instead either need to abandon the extension for this and do it in the form as before or
I have a crazy idea of server putting all the relevant data in the ID column somehow, maybe as part of query?
If this is a one off then I'm wasting too much time on this and should just put it into the form
but if will use elsewhere (besides woitempartrequest) for stuff then maybe...
what is going to need a list for an extension but is *not* based on some data with id's?? accounting plugins? No they deal with records. Hmm...
todo: restock required feature
Next step is to create an extension to copy to existing or new workorder for selected items

View File

@@ -451,10 +451,7 @@ export default {
type: Boolean,
default: false
},
selectReturnColumns: {
type: Array,
default: null
},
reload: {
type: Boolean,
default: false
@@ -659,66 +656,17 @@ export default {
};
},
handleSelectChange() {
if (
this.selectReturnColumns != null &&
this.selectReturnColumns.length > 0
) {
//todo: here need to check if calling form has asked for a template of certain fields instead of row id's
//and emit that as objects instead
//i.e. restock list provides selectReturnTemplate array of field key names:
// ['PartPartNumber','PartWarehouseName','PartWholesalerID','PartAlternativeWholesalerID','PartManufacturerID','PartByWarehouseInventoryReorderQuantity']
//select then saves exactly those columns into the selection instead of id's
//returns the id and name values or basically anything in that column ready for ease of use by extensions like partrestock extension which needs display and id values both
//maybe need to rename selectedRowIds if it can fit within that system too.
console.log("handleselectchange templated", {
selected: this.selected,
headers: this.headers
});
//build a map of column numbers that correspond with template fk names
/*
arrays of objects like this, fk corresponds to field template, value columns.cx equals actual column we need, text may be useful too save a translation to send it maybe?
align: "start"
fk: "PartPartNumber"
flt: true
text: "Part Number"
value: "columns.c0"
*/
//iterate the selected items which are like below, i is id number of record, t is type maybe useful, v is display value, key is only useless thing, maybe just strip the key and send the rest?
/*
c0: {…}
i: 3
key: "0-0"
t: 4
v: "017368"
*/
//return array like this:
/*
todo: work this out, array of arrays I guess??
[
{
fk:"PartPartNumber",
text:"Part number",
i: 3,
t: 4,
v: "01768"
}
*/
} else {
//due to making own template for items need to handle singleselect which only affects if select all checkbox at top is visible when making own item template
if (this.singleSelect) {
this.selected.splice(0, this.selected.length - 1);
}
//emit event to parent form of selected rows
this.$emit(
"selection-change",
this.selected.map(z => z.id)
);
//SINGLESELECT MODE?
//due to making own template for items need to handle singleselect which only affects if select all checkbox at top is visible when making own item template
if (this.singleSelect) {
this.selected.splice(0, this.selected.length - 1);
}
//emit event to parent form of selected rows
this.$emit(
"selection-change",
this.selected.map(z => z.id)
);
},
editColumnView() {
this.$router.push({
@@ -902,7 +850,9 @@ function buildHeaders(columnData) {
return ret;
}
/////////////////////////////////////////////////////////////////
//Called by getDataFromApi on retrieval of list with columnData
//
function buildRecords(listData, columndefinitions, ridColumnOpenable) {
//iterate data, build each object keyed with index name and display set to correct translated filter and then return
@@ -926,7 +876,7 @@ function buildRecords(listData, columndefinitions, ridColumnOpenable) {
//iterate row and build object representing row data keyed to index
//container object for row
//id will be set later when code below encounters the id column which could be in any position but is identified by it's rid property
//id will be set later when code below encounters the id column which could be in any position (or not at all) but is identified by it's rid property
let o = { id: undefined, columns: {} };
for (let iColumn = 0; iColumn < row.length; iColumn++) {
@@ -1105,6 +1055,7 @@ function buildRecords(listData, columndefinitions, ridColumnOpenable) {
o.columns["c" + iColumn.toString()] = columnObject;
}
ret.push(o);
}

View File

@@ -12,14 +12,6 @@
form-key="part-restocks"
data-list-key="PartRestockDataList"
:show-select="rights.read"
:select-return-columns="[
'PartPartNumber',
'PartWarehouseName',
'PartWholesalerID',
'PartAlternativeWholesalerID',
'PartManufacturerID',
'PartByWarehouseInventoryReorderQuantity'
]"
:reload="reload"
@selection-change="handleSelected"
data-cy="partRestocksTable"