feat: add logo field to settings schema and update settings client to handle file uploads

feat: integrate dialog close context in vendor select field and CRUD dialog components

feat: enhance vendor general info to format status using utility function

feat: implement form dialog context for managing dialog close actions

feat: add async select field dialog close context for better form handling

fix: update form mutation hook to close dialog on successful submission

feat: extend document print types to include expense and credit note

feat: add settings update payload type to include logo and other fields

feat: create employee attendance and work history pages with resource management

feat: implement payment made and received detail pages with actions

feat: add quick shortcuts component for easy navigation in the dashboard

feat: create actions for payment made and received with print and delete options

feat: implement dialog close context for better dialog management

feat: add error parsing utility for improved error handling in API responses
This commit is contained in:
2026-05-19 17:56:39 +04:00
parent 2d6e3c5734
commit 4f0a2f790f
56 changed files with 1220 additions and 92 deletions
+3 -1
View File
@@ -11,9 +11,11 @@ export type DocumentPrintType =
| "job_card"
| "invoice"
| "payment_received"
| "expense"
| "purchase_order"
| "bill"
| string
| "payment_made"
| "credit_note"
export type DocumentPrintMode = "print" | "download"
+43 -3
View File
@@ -1,10 +1,34 @@
import { ApiClient, type ApiClientOptions } from "../infra/client"
import type { ApiPath, ApiRequestBody } from "../infra/types"
import type { ApiPath } from "../infra/types"
export const SETTINGS_ROUTES = {
INDEX: "/api/settings",
} as const satisfies Record<string, ApiPath>
export type SettingsUpdatePayload = {
name?: string
email?: string
phone?: string
alternative_phone?: string
website?: string
time_zone?: string
upi_id?: string
first_day_of_work?: string
latitude?: string | number
longitude?: string | number
bank_details?: string
first_address_line?: string
second_address_line?: string
country_id?: number | string
state_id?: number | string
city?: string
zip_code?: string
description?: string
security?: string
privacy_policy?: string
logo?: File | null
}
export class SettingsClient extends ApiClient {
constructor(baseUrl?: string, defaultOptions?: ApiClientOptions) {
super(baseUrl, defaultOptions)
@@ -14,7 +38,23 @@ export class SettingsClient extends ApiClient {
return this.get(SETTINGS_ROUTES.INDEX)
}
async update(payload: ApiRequestBody<typeof SETTINGS_ROUTES.INDEX, "put">) {
return this.put(SETTINGS_ROUTES.INDEX, payload)
async update(payload: SettingsUpdatePayload) {
const hasFile = payload && (payload as any).logo instanceof File
if (!hasFile) {
const { logo: _logo, ...rest } = (payload ?? {}) as Record<string, unknown>
return this.put(SETTINGS_ROUTES.INDEX, rest as any)
}
const fd = new FormData()
for (const [key, value] of Object.entries(payload as Record<string, unknown>)) {
if (value === undefined || value === null) continue
if (value instanceof File) {
fd.append(key, value)
} else {
fd.append(key, String(value))
}
}
fd.append("_method", "PUT")
return this.postFormData(SETTINGS_ROUTES.INDEX, fd)
}
}