Skip to content

Commit

Permalink
v1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zackatbrightbeam committed Jan 25, 2024
1 parent 0f8998c commit 00aba90
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 145 deletions.
51 changes: 7 additions & 44 deletions dist/voxgig-model-react.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -49361,50 +49361,13 @@ function BasicLed(props) {
}
);
case "button":
if (field.action === "approve") {
return /* @__PURE__ */ jsxRuntimeExports.jsx(
BasicButton,
{
type: "submit",
variant: "outlined",
size: "medium",
disabled: row.original.approvedAmount === row.original.amountOrdered,
onClick: () => __async(this, null, function* () {
let dataCopy = [];
for (let item2 in data) {
let copy2 = __spreadValues({}, data[item2]);
dataCopy.push(copy2);
}
entityId = row.original.id;
let supplier = dataCopy.find((entity) => {
return entity.id === entityId;
});
supplier.approvedAmount = supplier.amountOrdered;
const callbacks = custom.BasicLed;
const approve = callbacks.approve;
const approved = yield approve(supplier, seneca);
if (approved) {
console.log("approved?: ", approved);
setData(dataCopy);
} else {
console.log("approving failed: ", approved);
}
}),
children: field.actionLabel
}
);
} else {
return /* @__PURE__ */ jsxRuntimeExports.jsx(
Box$2,
{
sx: {
display: "flex",
justifyContent: field.justifyContent || "center"
},
children: /* @__PURE__ */ jsxRuntimeExports.jsx(BasicButton, { type: "submit", variant: "outlined", size: "medium", children: field.actionLabel })
}
);
}
const approveButton = ctx().cmp[field.action];
return approveButton({
field,
row,
data,
seneca
});
case "action":
entityId = row.original.id;
action2 = field.action;
Expand Down
51 changes: 7 additions & 44 deletions dist/voxgig-model-react.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -49373,50 +49373,13 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
}
);
case "button":
if (field.action === "approve") {
return /* @__PURE__ */ jsxRuntimeExports.jsx(
BasicButton,
{
type: "submit",
variant: "outlined",
size: "medium",
disabled: row.original.approvedAmount === row.original.amountOrdered,
onClick: () => __async(this, null, function* () {
let dataCopy = [];
for (let item2 in data) {
let copy2 = __spreadValues({}, data[item2]);
dataCopy.push(copy2);
}
entityId = row.original.id;
let supplier = dataCopy.find((entity) => {
return entity.id === entityId;
});
supplier.approvedAmount = supplier.amountOrdered;
const callbacks = custom.BasicLed;
const approve = callbacks.approve;
const approved = yield approve(supplier, seneca);
if (approved) {
console.log("approved?: ", approved);
setData(dataCopy);
} else {
console.log("approving failed: ", approved);
}
}),
children: field.actionLabel
}
);
} else {
return /* @__PURE__ */ jsxRuntimeExports.jsx(
material.Box,
{
sx: {
display: "flex",
justifyContent: field.justifyContent || "center"
},
children: /* @__PURE__ */ jsxRuntimeExports.jsx(BasicButton, { type: "submit", variant: "outlined", size: "medium", children: field.actionLabel })
}
);
}
const approveButton = ctx().cmp[field.action];
return approveButton({
field,
row,
data,
seneca
});
case "action":
entityId = row.original.id;
action2 = field.action;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@voxgig/model-react",
"version": "1.7.0",
"version": "1.8.0",
"license": "MIT",
"files": [
"dist"
Expand Down
63 changes: 7 additions & 56 deletions src/lib/BasicLed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,62 +194,13 @@ function BasicLed (props: any) {
)
// TODO: merge this case with 'navbutton'
case 'button':
if (field.action === 'approve') {
return (
<BasicButton
type='submit'
variant='outlined'
size='medium'
disabled={
row.original.approvedAmount === row.original.amountOrdered
}
onClick={async () => {
// make a copy of data
let dataCopy: any = []
for (let item in data) {
let copy = { ...data[item] }
dataCopy.push(copy)
}

// find current fox/supplierorder
entityId = row.original.id
let supplier = dataCopy.find((entity: any) => {
return entity.id === entityId
})

// update entity approve amount in dataCopy
supplier.approvedAmount = supplier.amountOrdered

// call approve function
const callbacks = custom.BasicLed
const approve = callbacks.approve
const approved = await approve(supplier, seneca)
if (approved) {
console.log('approved?: ', approved)
// update the data table
setData(dataCopy)
} else {
console.log('approving failed: ', approved)
}
}}
>
{field.actionLabel}
</BasicButton>
)
} else {
return (
<Box
sx={{
display: 'flex',
justifyContent: field.justifyContent || 'center'
}}
>
<BasicButton type='submit' variant='outlined' size='medium'>
{field.actionLabel}
</BasicButton>
</Box>
)
}
const approveButton = ctx().cmp[field.action]
return approveButton({
field: field,
row: row,
data: data,
seneca: seneca
})
// TODO: remove this case
case 'action':
entityId = row.original.id
Expand Down

0 comments on commit 00aba90

Please sign in to comment.