Skip to content

Commit

Permalink
Merge branch 'release/1.6.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorv1316 committed May 22, 2024
2 parents 8a12f60 + d092d8a commit 04ca222
Show file tree
Hide file tree
Showing 36 changed files with 339 additions and 123 deletions.
10 changes: 6 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,11 @@ GEM
net-protocol
newrelic_rpm (9.8.0)
nio4r (2.5.9)
nokogiri (1.16.4-arm64-darwin)
nokogiri (1.16.5-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-darwin)
nokogiri (1.16.5-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-linux)
nokogiri (1.16.5-x86_64-linux)
racc (~> 1.4)
oauth2 (2.0.9)
faraday (>= 0.17.3, < 3.0)
Expand Down Expand Up @@ -496,7 +496,8 @@ GEM
actionpack (>= 5.2)
railties (>= 5.2)
retriable (3.1.2)
rexml (3.2.6)
rexml (3.2.8)
strscan (>= 3.0.9)
rolify (6.0.1)
rspec-buildkite (0.1.6)
rspec-core (~> 3.0)
Expand Down Expand Up @@ -624,6 +625,7 @@ GEM
stripe (8.2.0)
strong_migrations (1.4.2)
activerecord (>= 5.2)
strscan (3.1.0)
thor (1.3.1)
tilt (2.0.11)
timeout (0.4.1)
Expand Down
29 changes: 29 additions & 0 deletions app/controllers/internal_api/v1/custom_leaves_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

class InternalApi::V1::CustomLeavesController < InternalApi::V1::ApplicationController
before_action :set_leave, only: [:update]

def update
authorize current_user, policy_class: LeaveWithLeaveTypesPolicy
CustomLeavesService.new(leave, update_params).process
render json: { notice: "Leaves updated successfully" }, status: :ok
end

private

def set_leave
@_leave ||= current_company.leaves.find_or_create_by(year: params[:year])
end

def update_params
params.require(:custom_leaves).permit(
add_custom_leaves: [:name, :color, :icon, :allocation_value,
:allocation_period, user_ids: [],
],
update_custom_leaves: [:id, :name, :color, :icon, :allocation_value,
:allocation_period, user_ids: [],
],
remove_custom_leaves: []
)
end
end
7 changes: 1 addition & 6 deletions app/controllers/internal_api/v1/employments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class InternalApi::V1::EmploymentsController < InternalApi::V1::ApplicationContr

def index
authorize Employment
render :index, locals: { users: users_with_not_client_role }, status: :ok
render :index, locals: { users: current_company.employees_without_client_role }, status: :ok
end

def show
Expand All @@ -28,9 +28,4 @@ def set_employment
def employment_params
params.require(:employment).permit(:designation, :employment_type, :joined_at, :resigned_at, :employee_id)
end

def users_with_not_client_role
users_with_client_role_ids = current_company.users.joins(:roles).where(roles: { name: "client" }).pluck(:id)
current_company.users.kept.where.not(id: users_with_client_role_ids)
end
end
2 changes: 1 addition & 1 deletion app/controllers/internal_api/v1/leaves_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class InternalApi::V1::LeavesController < InternalApi::V1::ApplicationController

def index
authorize Leave
leaves = current_company.leaves.includes([:leave_types])
leaves = current_company.leaves.includes([:leave_types, :custom_leaves])
render :index, locals: {
leaves:
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ const contactSchema = Yup.object().shape({
.required("First Name cannot be blank"),
lastName: Yup.string()
.matches(/^[a-zA-Z]+$/, "Last Name must contain only letters")
.max(20, "Maximum 20 characters are allowed")
.required("Last Name cannot be blank"),
.max(20, "Maximum 20 characters are allowed"),
email: Yup.string()
.email("Invalid email ID")
.required("Email ID cannot be blank"),
Expand Down Expand Up @@ -82,9 +81,11 @@ const AddContacts = ({
<div>
<InputField
autoComplete="off"
hasError={errors.firstName && touched.firstName}
id="firstName"
inputBoxClassName="border focus:border-miru-han-purple-1000"
label="First Name"
marginBottom={errors.firstName && "mb-0"}
name="firstName"
setFieldError={setFieldError}
setFieldValue={setFieldValue}
Expand All @@ -96,9 +97,11 @@ const AddContacts = ({
/>
<InputField
autoComplete="off"
hasError={errors.lastName && touched.lastName}
id="lastName"
inputBoxClassName="border focus:border-miru-han-purple-1000"
label="Last Name"
marginBottom={errors.lastName && "mb-0"}
name="lastName"
setFieldError={setFieldError}
setFieldValue={setFieldValue}
Expand All @@ -110,8 +113,10 @@ const AddContacts = ({
/>
<InputField
autoComplete="off"
hasError={errors.email && touched.email}
id="email"
label="Email"
marginBottom={errors.email && "mb-0"}
name="email"
readOnly={false}
setFieldError={setFieldError}
Expand Down
27 changes: 14 additions & 13 deletions app/javascript/src/components/Clients/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Fragment } from "react";

import Logger from "js-logger";
import { PlusIcon } from "miruIcons";
import { Button } from "StyledComponents";

import clientApi from "apis/clients";
import AutoSearch from "common/AutoSearch";
Expand Down Expand Up @@ -34,19 +35,19 @@ const Header = ({ setnewClient, isAdminUser, setShowDialog }) => {
SearchDataRow={SearchDataRow}
searchAction={fetchClients}
/>
<div className="flex">
<button
className="header__button md:px-2 "
type="button"
onClick={() => {
setShowDialog(true);
setnewClient(true);
}}
>
<PlusIcon size={16} weight="fill" />
<span className="ml-2 hidden md:inline">NEW CLIENT</span>
</button>
</div>
<Button
className="ml-2 flex items-center px-2 py-2 lg:ml-0 lg:px-4"
style="secondary"
onClick={() => {
setShowDialog(true);
setnewClient(true);
}}
>
<PlusIcon size={16} weight="bold" />
<span className="ml-2 hidden text-base font-bold tracking-widest lg:inline-block">
New Client
</span>
</Button>
</Fragment>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/components/Expenses/List/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Fragment, useEffect, useState } from "react";

import expensesApi from "apis/expenses";
import Loader from "common/Loader";
import Loader from "common/Loader/index";
import withLayout from "common/Mobile/HOC/withLayout";
import { useUserContext } from "context/UserContext";

Expand Down
64 changes: 27 additions & 37 deletions app/javascript/src/components/Invoices/List/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React, { useEffect, useState, useRef } from "react";

import { useDebounce, useOutsideClick } from "helpers";
import { PlusIcon, FilterIcon, XIcon, SearchIcon } from "miruIcons";
import { Link } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import { Button } from "StyledComponents";

import invoicesApi from "apis/invoices";
import { ApiStatus as InvoiceStatus, LocalStorageKeys } from "constants/index";
Expand All @@ -29,6 +30,7 @@ const Header = ({
(appliedFilterCount = appliedFilterCount - 2);

const searchRef = useRef(null);
const navigate = useNavigate();

useEffect(() => {
if (searchQuery) {
Expand Down Expand Up @@ -118,7 +120,7 @@ const Header = ({
onChange={e => setSearchQuery(e.target.value)}
onKeyDown={e => onKeydownHandler(e)}
/>
<button className="absolute inset-y-0 right-3 flex cursor-pointer items-center">
<div className="absolute inset-y-0 right-3 flex items-center">
{searchQuery ? (
<XIcon size={12} weight="bold" onClick={onSearchClear} />
) : (
Expand All @@ -128,29 +130,25 @@ const Header = ({
weight="bold"
/>
)}
</button>
</div>
<SearchDropdown
display={params.query !== searchQuery}
list={searchResult}
status={status}
/>
</div>
<button
className="relative ml-auto ml-4 h-10 w-10 rounded p-3 hover:bg-miru-gray-1000"
<Button
className="relative ml-3"
style="ternary"
onClick={() => setIsFilterVisible(true)}
>
{appliedFilterCount > 0 && (
<span className="absolute bottom-5 left-5 flex h-4 w-4 items-center justify-center rounded-full bg-miru-han-purple-1000 text-xs font-semibold text-white">
{appliedFilterCount}
</span>
)}
<FilterIcon
className="hover:bg-miru-gray-1000"
color="#5B34EA"
size={16}
weight="bold"
/>
</button>
<FilterIcon color="#5B34EA" size={16} weight="bold" />
</Button>
</div>
) : (
<div className="flex w-10/12 md:w-11/12 lg:w-1/3">
Expand All @@ -171,7 +169,7 @@ const Header = ({
onFocus={() => setExpandSearchBox(true)}
onKeyDown={e => onKeydownHandler(e)}
/>
<button className="absolute inset-y-0 right-3 flex cursor-pointer items-center">
<div className="absolute inset-y-0 right-3 flex items-center">
{searchQuery || expandSearchBox ? (
<XIcon
color="#CDD6DF"
Expand All @@ -186,46 +184,38 @@ const Header = ({
weight="bold"
/>
)}
</button>
</div>
<SearchDropdown
display={params.query !== searchQuery}
list={searchResult}
searchRef={searchRef}
status={status}
/>
</div>
<button
className="relative ml-2 h-10 w-10 rounded p-3 hover:bg-miru-gray-1000"
<Button
className="relative ml-3"
style="ternary"
onClick={() => setIsFilterVisible(true)}
>
{appliedFilterCount > 0 && (
<span className="absolute bottom-5 left-5 flex h-4 w-4 items-center justify-center rounded-full bg-miru-han-purple-1000 text-xs font-semibold text-white">
{appliedFilterCount}
</span>
)}
<FilterIcon
className="hover:bg-miru-gray-1000"
color="#5B34EA"
size={16}
weight="bold"
/>
</button>
<FilterIcon color="#5B34EA" size={16} weight="bold" />
</Button>
</div>
)}
<div className="flex">
<Link
className="header__button border md:p-3"
to="/invoices/generate"
type="button"
>
<PlusIcon size={16} weight="bold" />
{isDesktop && (
<span className="ml-2 inline-block tracking-normal">
NEW INVOICE
</span>
)}
</Link>
</div>
<Button
className="ml-2 flex items-center px-2 py-2 lg:ml-0 lg:px-4"
style="secondary"
onClick={() => navigate("/invoices/generate")}
>
<PlusIcon size={16} weight="bold" />
<span className="ml-2 hidden text-base font-bold tracking-widest lg:inline-block">
New Invoice
</span>
</Button>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const LeaveBlock = ({ leaveType, selectedLeaveType, setSelectedLeaveType }) => {
category == "national" || category == "optional"
? label
: netDuration < 0
? `-${minToHHMM(-netDuration)} h (${label})`
? `-${minToHHMM(-netDuration)} h (-${label})`
: `${minToHHMM(netDuration)} h (${label})`;

const selectedDiv =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getYear } from "date-fns";
import { useNavigate } from "react-router-dom";

import leavesApi from "apis/leaves";
import Loader from "common/Loader";
import Loader from "common/Loader/index";
import { leaveIcons, leaveColors } from "constants/leaveType";
import { useUserContext } from "context/UserContext";
import { sendGAPageView } from "utils/googleAnalytics";
Expand Down
14 changes: 9 additions & 5 deletions app/javascript/src/components/Projects/List/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";

import Logger from "js-logger";
import { PlusIcon } from "miruIcons";
import { Button } from "StyledComponents";

import projectApi from "apis/projects";
import AutoSearch from "common/AutoSearch";
Expand Down Expand Up @@ -38,13 +39,16 @@ const Header = ({ projectDataPresent, setShowProjectModal, isAdminUser }) => {
searchAction={fetchProjects}
/>
)}
<button
className="header__button flex"
<Button
className="ml-2 flex items-center px-2 py-2 lg:ml-0 lg:px-4"
style="secondary"
onClick={() => setShowProjectModal(true)}
>
<PlusIcon size={16} weight="fill" />
<span className="ml-2 hidden lg:inline">NEW PROJECT</span>
</button>
<PlusIcon size={16} weight="bold" />
<span className="ml-2 hidden text-base font-bold tracking-widest lg:inline-block">
New Project
</span>
</Button>
</>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Header from "../Header";
const AccountsAgingReport = () => {
const [isFilterVisible, setIsFilterVisible] = useState<boolean>(false);
const [showNavFilters, setShowNavFilters] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(true);
const [selectedFilter, setSelectedFilter] = useState([]); //eslint-disable-line
const [filterCounter, setFilterCounter] = useState(0); //eslint-disable-line
const [clientList, setClientList] = useState<any>([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const OutstandingInvoiceReport = () => {
const [selectedFilter, setSelectedFilter] = useState(filterIntialValues);
const [isFilterVisible, setIsFilterVisible] = useState<boolean>(false);
const [showNavFilters, setShowNavFilters] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(true);
const [filterCounter, setFilterCounter] = useState(0); // eslint-disable-line
const [dateRange, setDateRange] = useState({ from: "", to: "" });
const [selectedInput, setSelectedInput] = useState("from-input");
Expand Down
Loading

0 comments on commit 04ca222

Please sign in to comment.