Skip to content
Closed
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
8 changes: 6 additions & 2 deletions pos/src/lib/customer-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ export async function getCustomerTerritories() {

export async function addCustomer(customerData: CreateCustomerData): Promise<CreateCustomerResponse> {
try {
const response = await db.createDoc(DOCTYPES.CUSTOMER, customerData);
return { data: response as Customer };
const response = await call.post('ury.ury_pos.api.create_customer',customerData)
const customer: Customer = response.message.customer;
if(!customer) {
throw new Error("Failed to create Customer,API Response error")
}
return {data:customer}
} catch (error) {
console.error('Error creating customer:', error);
throw error;
Expand Down
3 changes: 3 additions & 0 deletions pos/src/lib/pos-profile-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface PosProfileFull {
role_allowed_for_billing: RolePermission[];
role_restricted_for_table_order?: RolePermission[];
paid_limit?: number;
custom_allow_without_print_on_payment?: boolean
}

// Combined POS Profile with both limited and full fields
Expand All @@ -84,6 +85,7 @@ export interface PosProfileCombined extends PosProfileFull {
edit_order_type?: number;
view_all_status?: number;
custom_daily_pos_close?: number;
custom_allow_without_print_on_payment?: boolean;
}

export interface Currency {
Expand Down Expand Up @@ -133,6 +135,7 @@ export async function getCombinedPosProfile(): Promise<PosProfileCombined> {
enable_discount: limitedProfile.enable_discount,
multiple_cashier: limitedProfile.multiple_cashier,
edit_order_type: limitedProfile.edit_order_type,
custom_allow_without_print_on_payment: Boolean(fullProfile.custom_allow_without_print_on_payment),
};

return combinedProfile;
Expand Down
31 changes: 17 additions & 14 deletions pos/src/pages/Orders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -464,20 +464,23 @@ export default function Orders() {
{isPrinting ? <Spinner className="w-5 h-5" hideMessage /> : <Printer className="w-5 h-5" />}
</Button>
{/* Payment Button - Only show for Draft, Unbilled, and Recently Paid orders */}
{(selectedOrder.status === 'Draft' || selectedOrder.status === 'Unbilled' || selectedOrder.status === 'Recently Paid') && (
<Button
className="flex-1"
onClick={() => {
if (String(selectedOrder.invoice_printed) === '0') {
showToast.error('Please print invoice before making payment');
return;
}
setShowPaymentDialog(true);
}}
>
Payment
</Button>
)}
{(selectedOrder.status === 'Draft' || selectedOrder.status === 'Unbilled' || selectedOrder.status === 'Recently Paid') && (
<Button
className="flex-1"
onClick={() => {
const allowWithoutPrint = Boolean(
posStore.posProfile?.custom_allow_without_print_on_payment
);
if (!allowWithoutPrint && selectedOrder.invoice_printed === 0) {
showToast.error('Please print invoice before making payment');
return;
}
setShowPaymentDialog(true);
}}
>
Payment
</Button>
)}
{/* Total */}
<span className="ml-auto text-xl font-bold text-gray-900 whitespace-nowrap">
{formatCurrency(selectedOrder.rounded_total)}
Expand Down
Loading
Loading