Skip to content

Commit

Permalink
Merge branch 'release/1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
“Apoorv committed Mar 21, 2024
2 parents d6427c8 + 8ac6bf5 commit 74ac848
Show file tree
Hide file tree
Showing 171 changed files with 5,972 additions and 1,112 deletions.
3 changes: 3 additions & 0 deletions app/assets/images/Background.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
172 changes: 172 additions & 0 deletions app/assets/images/Banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions app/assets/images/Password.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions app/assets/stylesheets/mailers.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
.background {
position: absolute;
}

.banner {
position: relative;
}

.password {
position: relative;
top: -80px;
}

.header {
padding-top: 40px;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-style: normal;
font-weight: 800;
font-size: 24px;
line-height: 33px;
color: #5B34EA;
}

body {
align-items: center;
display: flex;
flex-direction: column;
}
.container {
text-align: center;
width: 640px;
font-family: 'Manrope';
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 19px;
text-align: center;
color: #777683;

.reset-password-button {
border-radius: 20px;
background: #5B34EA;
text-align: center;
display: inline-block;

a {
width: 129px;
height: 24px;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-weight: 700;
font-size: 12px;
line-height: 16px;
color: #FFFFFF;
text-decoration: none;
display: flex;
justify-content: center;
align-items: center;
}
}
}

.footer-container {
justify-content: center;
display: flex;

#footer {
width: 640px;
}
}
18 changes: 17 additions & 1 deletion app/controllers/internal_api/v1/expenses_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class InternalApi::V1::ExpensesController < ApplicationController
before_action :set_expense, only: :show
before_action :set_expense, only: [:show, :update, :destroy]

def index
authorize Expense
Expand All @@ -27,6 +27,22 @@ def show
render :show, locals: { expense: Expense::ShowPresenter.new(@expense).process }
end

def update
authorize @expense

@expense.update!(expense_params)

render json: { notice: I18n.t("expenses.update") }, status: :ok
end

def destroy
authorize @expense

@expense.destroy!

render json: { notice: I18n.t("expenses.destroy") }, status: :ok
end

private

def expense_params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ def index
authorize :report
render :index, locals: Reports::AccountsAging::FetchOverdueAmount.process(current_company), status: :ok
end

def download
authorize :report
send_data Reports::AccountsAging::DownloadService.new(params, current_company).process
end
end
6 changes: 3 additions & 3 deletions app/javascript/src/StyledComponents/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ const DASHED =

const DELETE = "bg-miru-red-400 hover:bg-miru-red-200 text-white";

const SMALL = "px-5/100 py-1vh text-xs font-bold leading-4";
const MEDIUM = "px-10/100 py-1vh text-base font-bold leading-5";
const LARGE = "px-15/100 py-1vh text-xl font-bold leading-7";
const SMALL = "p-2 text-xs font-bold leading-4";
const MEDIUM = "p-2 text-base font-bold leading-5";
const LARGE = "p-2 text-xl font-bold leading-7";

type ButtonProps = {
id?: string;
Expand Down
11 changes: 9 additions & 2 deletions app/javascript/src/apis/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ import axios from "./api";

const path = "/clients";

const formHeaders = {
headers: {
"Content-Type": "multipart/form-data",
},
};

const get = async queryParam => axios.get(`${path}${queryParam}`);

const create = async payload => axios.post(`${path}`, payload);
const create = async payload => axios.post(`${path}`, payload, formHeaders);

const show = async (id, queryParam) => axios.get(`${path}/${id}${queryParam}`);

const update = async (id, payload) => axios.patch(`${path}/${id}`, payload);
const update = async (id, payload) =>
axios.patch(`${path}/${id}`, payload, formHeaders);

const destroy = async id => axios.delete(`${path}/${id}`);

Expand Down
11 changes: 9 additions & 2 deletions app/javascript/src/apis/companies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ const authApi = axios.create({
},
});

const formHeaders = {
headers: {
"Content-Type": "multipart/form-data",
},
};

const index = async () => axios.get(`${path}`);

const create = payload => authApi.post(path, payload);
const create = payload => authApi.post(path, payload, formHeaders);

const update = (id, payload) => axios.put(`${path}/${id}`, payload);
const update = (id, payload) =>
axios.put(`${path}/${id}`, payload, formHeaders);

const destroy = id => axios.delete(`${path}/${id}`);

Expand Down
27 changes: 27 additions & 0 deletions app/javascript/src/apis/expenses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import axios from "./api";

const path = "/expenses";

const index = async () => await axios.get(path);

const create = async payload => await axios.post(path, payload);

const show = async id => await axios.get(`${path}/${id}`);

const update = async (id, payload) => axios.patch(`${path}/${id}`, payload);

const destroy = async id => axios.delete(`${path}/${id}`);

const createCategory = async payload =>
axios.post("/expense_categories", payload);

const expensesApi = {
index,
create,
show,
update,
destroy,
createCategory,
};

export default expensesApi;
9 changes: 8 additions & 1 deletion app/javascript/src/apis/reports/accountsAging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ const path = "/reports/accounts_aging";

const get = () => axios.get(path);

const accountsAgingApi = { get };
const download = (type, queryParams) =>
axios({
method: "GET",
url: `${path}/download.${type}${queryParams}`,
responseType: "blob",
});

const accountsAgingApi = { get, download };

export default accountsAgingApi;
138 changes: 138 additions & 0 deletions app/javascript/src/common/CustomCreatableSelect/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/* eslint-disable import/exports-last */
import React from "react";

import CreatableSelect from "react-select/creatable";

import {
customErrStyles,
customStyles,
CustomValueContainer,
} from "common/CustomReactSelectStyle";
import { useUserContext } from "context/UserContext";

type CustomCreatableSelectProps = {
id?: string;
styles?: any;
components?: any;
classNamePrefix?: string;
label?: string;
isErr?: any;
isSearchable?: boolean;
isDisabled?: boolean;
ignoreDisabledFontColor?: boolean;
hideDropdownIndicator?: boolean;
handleOnClick?: (e?: any) => void; // eslint-disable-line
handleOnChange?: (e?: any) => void; // eslint-disable-line
handleonFocus?: (e?: any) => void; // eslint-disable-line
onBlur?: (e?: any) => void; // eslint-disable-line
defaultValue?: object;
onMenuClose?: (e?: any) => void; // eslint-disable-line
onMenuOpen?: (e?: any) => void; // eslint-disable-line
className?: string;
autoFocus?: boolean;
value?: object;
getOptionLabel?: (e?: any) => any; // eslint-disable-line
wrapperClassName?: string;
options?: Array<any>;
name?: string;
};

export const CustomCreatableSelect = ({
id,
isSearchable,
classNamePrefix,
options,
label,
handleOnChange,
handleonFocus,
handleOnClick,
name,
value,
isErr,
isDisabled,
styles,
components,
onMenuClose,
onMenuOpen,
ignoreDisabledFontColor,
hideDropdownIndicator,
className,
autoFocus,
onBlur,
defaultValue,
getOptionLabel,
wrapperClassName,
}: CustomCreatableSelectProps) => {
const { isDesktop } = useUserContext();

const getStyle = () => {
if (isErr) {
return customErrStyles(isDesktop);
}

return customStyles(
isDesktop,
ignoreDisabledFontColor,
hideDropdownIndicator
);
};

return (
<div
className={`outline relative ${wrapperClassName}`}
onClick={handleOnClick}
>
<CreatableSelect
autoFocus={autoFocus}
className={className}
classNamePrefix={classNamePrefix}
defaultValue={defaultValue}
getOptionLabel={getOptionLabel}
id={id || name}
isDisabled={isDisabled}
isSearchable={isSearchable}
name={name}
options={options}
placeholder={label}
styles={styles || getStyle()}
value={value}
components={{
...components,
ValueContainer: CustomValueContainer,
IndicatorSeparator: () => null,
}}
onBlur={onBlur}
onChange={handleOnChange}
onFocus={handleonFocus}
onMenuClose={onMenuClose}
onMenuOpen={onMenuOpen}
/>
</div>
);
};

CustomCreatableSelect.defaultProps = {
id: "",
styles: null,
components: null,
classNamePrefix: "react-select-filter",
label: "Select",
isErr: false,
isSearchable: true,
isDisabled: false,
ignoreDisabledFontColor: false,
hideDropdownIndicator: false,
handleOnClick: () => {}, // eslint-disable-line @typescript-eslint/no-empty-function
handleOnChange: () => {}, // eslint-disable-line @typescript-eslint/no-empty-function
handleonFocus: () => {}, // eslint-disable-line @typescript-eslint/no-empty-function
onBlur: () => {}, // eslint-disable-line @typescript-eslint/no-empty-function
defaultValue: null,
onMenuClose: () => {}, // eslint-disable-line @typescript-eslint/no-empty-function
onMenuOpen: () => {}, // eslint-disable-line @typescript-eslint/no-empty-function
className: "",
autoFocus: false,
value: null,
wrapperClassName: "",
};

export default CustomCreatableSelect;
8 changes: 6 additions & 2 deletions app/javascript/src/common/FormikFields/InputErrors/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import React from "react";

const InputErrors = ({ fieldErrors, fieldTouched }) =>
const InputErrors = ({ fieldErrors, fieldTouched, addMargin = true }) =>
fieldErrors && fieldTouched ? (
<div className="mx-0 mb-6 block text-xs tracking-wider text-red-600">
<div
className={`mx-0 ${
addMargin && "mb-6"
} block text-xs tracking-wider text-red-600`}
>
<div>{fieldErrors}</div>
</div>
) : null;
Expand Down
Loading

0 comments on commit 74ac848

Please sign in to comment.