Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions assets/images/product-illustrations/gps-track--orange.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/Icon/Illustrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import MoneyMousePink from '../../../assets/images/product-illustrations/money-m
import ReceiptYellow from '../../../assets/images/product-illustrations/receipt--yellow.svg';
import RocketOrange from '../../../assets/images/product-illustrations/rocket--orange.svg';
import TadaYellow from '../../../assets/images/product-illustrations/tada--yellow.svg';
import GpsTrackOrange from '../../../assets/images/product-illustrations/gps-track--orange.svg';

export {
BankArrowPink,
Expand All @@ -32,4 +33,5 @@ export {
ReceiptYellow,
RocketOrange,
TadaYellow,
GpsTrackOrange,
};
8 changes: 7 additions & 1 deletion src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ export default {
edit: 'Edit workspace',
delete: 'Delete Workspace',
settings: 'General settings',
reimburse: 'Reimburse receipts',
reimburse: 'Reimburse expenses',
bills: 'Pay bills',
invoices: 'Send invoices',
travel: 'Book travel',
Expand Down Expand Up @@ -762,8 +762,14 @@ export default {
reimburse: {
captureReceipts: 'Capture receipts',
fastReimbursementsHappyMembers: 'Fast reimbursements = happy members!',
kilometers: 'Kilometers',
miles: 'Miles',
viewAllReceipts: 'View all receipts',
reimburseReceipts: 'Reimburse receipts',
trackDistance: 'Track distance',
trackDistanceCopy: 'Set the per mile/km rate and choose a default unit to track.',
trackDistanceRate: 'Rate',
trackDistanceUnit: 'Unit',
unlockNextDayReimbursements: 'Unlock next-day reimbursements',
captureNoVBACopyBeforeEmail: 'Ask your workspace members to forward receipts to ',
captureNoVBACopyAfterEmail: ' and download the Expensify App to track cash expenses on the go.',
Expand Down
6 changes: 6 additions & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,14 @@ export default {
reimburse: {
captureReceipts: 'Captura recibos',
fastReimbursementsHappyMembers: '¡Reembolsos rápidos = miembros felices!',
kilometers: '',
miles: '',
viewAllReceipts: 'Ver todos los recibos',
reimburseReceipts: 'Reembolsar recibos',
trackDistance: '',
trackDistanceCopy: '',
trackDistanceRate: '',
trackDistanceUnit: '',
Comment on lines +767 to +774

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, you need to complete the translations for this language.
Since it was not done, it generated a few alerts. I am going to post them in the original issue so you can get them fixed @marktoman.
@deetergp you should've not merged this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lo siento! 😬 Not sure how I missed that but will get some translations to Mark Toman, so he can add them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the translations have already been added in main
Screen Shot 2022-02-17 at 9 22 00 AM

Is that all that was missing to fix those BugBot issues?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh did not see that, I just saw the bugbot issues and assumed it was still happening. Curious where were they added?
And yes, that's all we need to do to fix the issues.

@deetergp deetergp Feb 17, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll close them as my penance. The changes were added in this commit by @PrashantMangukiya, whom I now owe a 🍺.

unlockNextDayReimbursements: 'Desbloquea reembolsos diarios',
captureNoVBACopyBeforeEmail: 'Pide a los miembros de tu espacio de trabajo que envíen recibos a ',
captureNoVBACopyAfterEmail: ' y descarga la App de Expensify para controlar tus gastos en efectivo sobre la marcha.',
Expand Down
27 changes: 27 additions & 0 deletions src/libs/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,31 @@ function Policy_Create(parameters) {
return Network.post(commandName, parameters);
}

/**
* @param {Object} parameters
* @param {String} parameters.policyID
* @param {String} parameters.value
* @returns {Promise}
*/
function Policy_CustomUnit_Update(parameters) {
const commandName = 'Policy_CustomUnit_Update';
requireParameters(['policyID', 'customUnit'], parameters, commandName);
return Network.post(commandName, parameters);
}

/**
* @param {Object} parameters
* @param {String} parameters.policyID
* @param {String} parameters.customUnitID
* @param {String} parameters.value
* @returns {Promise}
*/
function Policy_CustomUnitRate_Update(parameters) {
const commandName = 'Policy_CustomUnitRate_Update';
requireParameters(['policyID', 'customUnitID', 'customUnitRate'], parameters, commandName);
return Network.post(commandName, parameters);
}

/**
* @param {Object} parameters
* @param {String} [parameters.policyID]
Expand Down Expand Up @@ -1267,6 +1292,8 @@ export {
GetLocalCurrency,
GetCurrencyList,
Policy_Create,
Policy_CustomUnit_Update,
Policy_CustomUnitRate_Update,
Policy_Employees_Remove,
PreferredLocale_Update,
Policy_Delete,
Expand Down
86 changes: 83 additions & 3 deletions src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,27 @@ function getSimplifiedEmployeeList(employeeList) {
* @param {String} [fullPolicyOrPolicySummary.avatarURL]
* @param {String} [fullPolicyOrPolicySummary.value.avatarURL]
* @param {Object} [fullPolicyOrPolicySummary.value.employeeList]
* @param {Object} [fullPolicyOrPolicySummary.value.customUnits]
* @param {Boolean} isFromFullPolicy,
* @returns {Object}
*/
function getSimplifiedPolicyObject(fullPolicyOrPolicySummary) {
function getSimplifiedPolicyObject(fullPolicyOrPolicySummary, isFromFullPolicy) {
const customUnit = lodashGet(fullPolicyOrPolicySummary, 'value.customUnits[0]', undefined);
const customUnitValue = lodashGet(customUnit, 'attributes.unit', 'mi');
const customUnitRate = lodashGet(customUnit, 'rates[0]', {});
const customUnitSimplified = customUnit && {
id: customUnit.customUnitID,
name: customUnit.name,
value: customUnitValue,
rate: {
id: customUnitRate.customUnitRateID,
name: customUnitRate.name,
currency: customUnitRate.currency,
value: Number(customUnitRate.rate),
},
};
return {
isFromFullPolicy,
id: fullPolicyOrPolicySummary.id,
name: fullPolicyOrPolicySummary.name,
role: fullPolicyOrPolicySummary.role,
Expand All @@ -68,6 +85,7 @@ function getSimplifiedPolicyObject(fullPolicyOrPolicySummary) {
// avatarUrl will be nested within the key "value"
avatarURL: fullPolicyOrPolicySummary.avatarURL || lodashGet(fullPolicyOrPolicySummary, 'value.avatarURL', ''),
employeeList: getSimplifiedEmployeeList(lodashGet(fullPolicyOrPolicySummary, 'value.employeeList')),
customUnit: customUnitSimplified,
};
}

Expand Down Expand Up @@ -192,7 +210,7 @@ function getPolicyList() {

const policyCollection = _.reduce(data.policySummaryList, (memo, policy) => ({
...memo,
[`${ONYXKEYS.COLLECTION.POLICY}${policy.id}`]: getSimplifiedPolicyObject(policy),
[`${ONYXKEYS.COLLECTION.POLICY}${policy.id}`]: getSimplifiedPolicyObject(policy, false),
}), {});

if (!_.isEmpty(policyCollection)) {
Expand Down Expand Up @@ -229,7 +247,7 @@ function loadFullPolicy(policyID) {
return;
}

Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policy.id}`, getSimplifiedPolicyObject(policy));
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policy.id}`, getSimplifiedPolicyObject(policy, true));
});
}

Expand Down Expand Up @@ -409,6 +427,66 @@ function hideWorkspaceAlertMessage(policyID) {
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {alertMessage: ''});
}

/**
* @param {String} policyID
* @param {Object} values
*/
function setCustomUnit(policyID, values) {
API.Policy_CustomUnit_Update({
policyID: policyID.toString(),
customUnit: JSON.stringify(values),
lastModified: null,
})
.then((response) => {
if (response.jsonCode !== 200) {
throw new Error();
}

updateLocalPolicyValues(policyID, {
customUnit: {
id: values.customUnitID,
name: values.name,
value: values.attributes.unit,
},
});
}).catch(() => {
// Show the user feedback
Growl.error(Localize.translateLocal('workspace.editor.genericFailureMessage'), 5000);
});
}

/**
* @param {String} policyID
* @param {String} customUnitID
* @param {Object} values
*/
function setCustomUnitRate(policyID, customUnitID, values) {
API.Policy_CustomUnitRate_Update({
policyID: policyID.toString(),
customUnitID: customUnitID.toString(),
customUnitRate: JSON.stringify(values),
lastModified: null,
})
.then((response) => {
if (response.jsonCode !== 200) {
throw new Error();
}

updateLocalPolicyValues(policyID, {
customUnit: {
rate: {
id: values.customUnitRateID,
name: values.name,
value: Number(values.rate),
},
},
});
}).catch(() => {
// Show the user feedback
Growl.error(Localize.translateLocal('workspace.editor.genericFailureMessage'), 5000);
});
}

/**
* Stores in Onyx the policy ID of the last workspace that was accessed by the user
* @param {String} policyID
Expand All @@ -431,5 +509,7 @@ export {
deletePolicy,
createAndNavigate,
createAndGetPolicyList,
setCustomUnit,
setCustomUnitRate,
updateLastAccessedWorkspace,
};
Loading