fix adding assignments
This commit is contained in:
@ -103,7 +103,7 @@ function ShiftComponent({ shift, onShiftSelect, isSelected, onPublisherSelect, a
|
|||||||
const newAssignment = {
|
const newAssignment = {
|
||||||
publisher: { connect: { id: publisher.id } },
|
publisher: { connect: { id: publisher.id } },
|
||||||
shift: { connect: { id: shiftId } },
|
shift: { connect: { id: shiftId } },
|
||||||
isactive: true,
|
//isactive: true,
|
||||||
isConfirmed: true
|
isConfirmed: true
|
||||||
};
|
};
|
||||||
const { data } = await axiosInstance.post("/api/data/assignments", newAssignment);
|
const { data } = await axiosInstance.post("/api/data/assignments", newAssignment);
|
||||||
|
@ -178,6 +178,7 @@ export default function ImportPage() {
|
|||||||
// let names = common.removeAccentsAndSpecialCharacters(row[2]).split(/[, ]+/);
|
// let names = common.removeAccentsAndSpecialCharacters(row[2]).split(/[, ]+/);
|
||||||
|
|
||||||
let personId = '';
|
let personId = '';
|
||||||
|
let personNames = names.join(' ');
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
const select = "&select=id,firstName,lastName,phone,isTrained,desiredShiftsPerMonth,isactive,type,availabilities";
|
const select = "&select=id,firstName,lastName,phone,isTrained,desiredShiftsPerMonth,isactive,type,availabilities";
|
||||||
@ -207,6 +208,7 @@ export default function ImportPage() {
|
|||||||
// Create a flag to check if update is needed
|
// Create a flag to check if update is needed
|
||||||
const updatedData = {};
|
const updatedData = {};
|
||||||
personId = existingPublisher?.id;
|
personId = existingPublisher?.id;
|
||||||
|
personNames = existingPublisher.firstName + ' ' + existingPublisher.lastName;
|
||||||
let fieldsToUpdateString = '';
|
let fieldsToUpdateString = '';
|
||||||
|
|
||||||
|
|
||||||
@ -458,7 +460,7 @@ export default function ImportPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
common.logger.debug("availabilities to save for " + personId + ": " + availabilities.length);
|
common.logger.debug("availabilities to save for " + personNames + ": " + availabilities.length);
|
||||||
// Send a single request to create all availabilities
|
// Send a single request to create all availabilities
|
||||||
axiosInstance.post('/api/?action=createAvailabilities', availabilities)
|
axiosInstance.post('/api/?action=createAvailabilities', availabilities)
|
||||||
.then(response => common.logger.debug('Availabilities created:', response.data))
|
.then(response => common.logger.debug('Availabilities created:', response.data))
|
||||||
|
Reference in New Issue
Block a user