Initial cut - untested.

This commit is contained in:
2025-09-25 09:31:02 -07:00
parent 7a0666cc6c
commit 3775522265
33 changed files with 351 additions and 346 deletions

View File

@@ -42,8 +42,8 @@ const StaffEditor = ({value, close, defaultSiteId}) => {
const [lastName, setLastName] = useState(value.lastName || "")
const [siteId, setSiteId] = useState(value.siteId ? value.siteId : defaultSiteId)
const {sites} = useTracker(() => {
let sites = Sites.find({}).fetch();
const {sites} = useTracker(async () => {
let sites = await Sites.find({}).fetchAsync();
return {sites}
});
@@ -52,13 +52,13 @@ const StaffEditor = ({value, close, defaultSiteId}) => {
setSiteId(sites[0]._id)
}
const applyChanges = () => {
const applyChanges = async () => {
close()
//TODO Should invert this and only close if there was success on the server.
if(value._id)
Meteor.call("staff.update", value._id, id, firstName, lastName, email, siteId);
await Meteor.callAsync("staff.update", value._id, id, firstName, lastName, email, siteId);
else
Meteor.call("staff.add", id, firstName, lastName, email, siteId);
await Meteor.callAsync("staff.add", id, firstName, lastName, email, siteId);
}
const rejectChanges = () => {
close()
@@ -94,17 +94,17 @@ export default () => {
Meteor.subscribe('sites');
Meteor.subscribe('staff');
const {sites} = useTracker(() => {
const sites = Sites.find({}).fetch();
const {sites} = useTracker(async () => {
const sites = await Sites.find({}).fetchAsync();
sites.push(siteAll);
return {sites}
});
const {staff} = useTracker(() => {
const {staff} = useTracker(async () => {
const staffQuery = site === siteAll._id ? {} : {siteId: site}
let staff = Staff.find(staffQuery).fetch();
let staff = await Staff.find(staffQuery).fetchAsync();
return {staff}
});