diff --git a/custom_ui/api/db/onsite_meetings.py b/custom_ui/api/db/bid_meetings.py similarity index 92% rename from custom_ui/api/db/onsite_meetings.py rename to custom_ui/api/db/bid_meetings.py index 7ab4721..649e596 100644 --- a/custom_ui/api/db/onsite_meetings.py +++ b/custom_ui/api/db/bid_meetings.py @@ -3,7 +3,7 @@ import json from custom_ui.db_utils import build_error_response, build_success_response, process_filters, process_sorting @frappe.whitelist() -def get_week_onsite_meetings(week_start, week_end): +def get_week_bid_meetings(week_start, week_end): """Get On-Site Meetings scheduled within a specific week.""" try: meetings = frappe.db.get_all( @@ -24,13 +24,13 @@ def get_week_onsite_meetings(week_start, week_end): return build_error_response(str(e), 500) @frappe.whitelist() -def get_onsite_meetings(fields=["*"], filters={}): +def get_bid_meetings(fields=["*"], filters={}): """Get paginated On-Site Meetings with filtering and sorting support.""" try: - print("DEBUG: Raw onsite meeting options received:", filters) - + print("DEBUG: Raw bid meeting options received:", filters) + processed_filters = process_filters(filters) - + meetings = frappe.db.get_all( "On-Site Meeting", fields=fields, @@ -40,17 +40,17 @@ def get_onsite_meetings(fields=["*"], filters={}): for meeting in meetings: address_doc = frappe.get_doc("Address", meeting["address"]) meeting["address"] = address_doc.as_dict() - + return build_success_response( meetings ) except Exception as e: frappe.log_error(message=str(e), title="Get On-Site Meetings Failed") return build_error_response(str(e), 500) - + @frappe.whitelist() -def get_unscheduled_onsite_meetings(): +def get_unscheduled_bid_meetings(): """Get On-Site Meetings that are unscheduled.""" try: meetings = frappe.db.get_all( @@ -63,26 +63,26 @@ def get_unscheduled_onsite_meetings(): except Exception as e: frappe.log_error(message=str(e), title="Get Unscheduled On-Site Meetings Failed") return build_error_response(str(e), 500) - + @frappe.whitelist() -def create_onsite_meeting(address, notes=""): +def create_bid_meeting(address, notes=""): """Create a new On-Site Meeting with Unscheduled status.""" try: print(f"DEBUG: Creating meeting with address='{address}', notes='{notes}'") - + # Validate address parameter if not address or address == "None" or not address.strip(): return build_error_response("Address is required and cannot be empty.", 400) - + # Get the address document name from the full address string address_name = frappe.db.get_value("Address", filters={"full_address": address}, fieldname="name") - + print(f"DEBUG: Address lookup result: address_name='{address_name}'") - + if not address_name: return build_error_response(f"Address '{address}' not found in the system.", 404) - + # Create the meeting with Unscheduled status meeting = frappe.get_doc({ "doctype": "On-Site Meeting", @@ -93,19 +93,19 @@ def create_onsite_meeting(address, notes=""): meeting.flags.ignore_permissions = True meeting.insert(ignore_permissions=True) frappe.db.commit() - + # Clear any auto-generated messages from Frappe frappe.local.message_log = [] - + print(f"DEBUG: Meeting created successfully: {meeting.name}") - + return build_success_response(meeting.as_dict()) except Exception as e: frappe.log_error(message=str(e), title="Create On-Site Meeting Failed") return build_error_response(str(e), 500) - + @frappe.whitelist() -def update_onsite_meeting(name, data): +def update_bid_meeting(name, data): """Update an existing On-Site Meeting.""" defualts = { "address": None, @@ -141,4 +141,4 @@ def update_onsite_meeting(name, data): return build_error_response(f"On-Site Meeting '{name}' does not exist.", 404) except Exception as e: return build_error_response(str(e), 500) - \ No newline at end of file + diff --git a/frontend/src/api.js b/frontend/src/api.js index 7a4072b..aa2988c 100644 --- a/frontend/src/api.js +++ b/frontend/src/api.js @@ -20,8 +20,8 @@ const FRAPPE_UPSERT_INVOICE_METHOD = "custom_ui.api.db.invoices.upsert_invoice"; const FRAPPE_GET_WARRANTY_CLAIMS_METHOD = "custom_ui.api.db.warranties.get_warranty_claims"; // On-Site Meeting methods const FRAPPE_GET_WEEK_ONSITE_MEETINGS_METHOD = - "custom_ui.api.db.onsite_meetings.get_week_onsite_meetings"; -const FRAPPE_GET_ONSITE_MEETINGS_METHOD = "custom_ui.api.db.onsite_meetings.get_onsite_meetings"; + "custom_ui.api.db.bid_meetings.get_week_bid_meetings"; +const FRAPPE_GET_ONSITE_MEETINGS_METHOD = "custom_ui.api.db.bid_meetings.get_bid_meetings"; // Address methods const FRAPPE_GET_ADDRESSES_METHOD = "custom_ui.api.db.addresses.get_addresses"; // Client methods @@ -113,29 +113,29 @@ class Api { // ON-SITE MEETING METHODS // ============================================================================ - static async getUnscheduledOnSiteMeetings() { + static async getUnscheduledBidMeetings() { return await this.request( - "custom_ui.api.db.onsite_meetings.get_unscheduled_onsite_meetings", + "custom_ui.api.db.bid_meetings.get_unscheduled_bid_meetings", ); } - static async getScheduledOnSiteMeetings(fields = ["*"], filters = {}) { + static async getScheduledBidMeetings(fields = ["*"], filters = {}) { return await this.request(FRAPPE_GET_ONSITE_MEETINGS_METHOD, { fields, filters }); } - static async getWeekOnSiteMeetings(weekStart, weekEnd) { + static async getWeekBidMeetings(weekStart, weekEnd) { return await this.request(FRAPPE_GET_WEEK_ONSITE_MEETINGS_METHOD, { weekStart, weekEnd }); } - static async updateOnSiteMeeting(name, data) { - return await this.request("custom_ui.api.db.onsite_meetings.update_onsite_meeting", { + static async updateBidMeeting(name, data) { + return await this.request("custom_ui.api.db.bid_meetings.update_bid_meeting", { name, data, }); } - static async createOnSiteMeeting(address, notes = "") { - return await this.request("custom_ui.api.db.onsite_meetings.create_onsite_meeting", { + static async createBidMeeting(address, notes = "") { + return await this.request("custom_ui.api.db.bid_meetings.create_bid_meeting", { address, notes, }); diff --git a/frontend/src/components/SideBar.vue b/frontend/src/components/SideBar.vue index 4405507..f36df01 100644 --- a/frontend/src/components/SideBar.vue +++ b/frontend/src/components/SideBar.vue @@ -54,9 +54,9 @@ const createButtons = ref([ }, }, { - label: "On-Site Meeting", + label: "Bid", command: () => { - router.push("/schedule-onsite?new=true"); + router.push("/schedule-bid?new=true"); }, }, { @@ -102,10 +102,9 @@ const categories = ref([ { name: "Clients", icon: Community, - //url: "/clients" buttons: clientButtons, }, - { name: "Bids", icon: Neighbourhood, url: "/schedule-onsite" }, + { name: "Bids", icon: Neighbourhood, url: "/schedule-bid" }, { name: "Estimates", icon: Calculator, url: "/estimates" }, { name: "Jobs", icon: Hammer, url: "/jobs" }, { name: "Payments/Invoices", icon: ReceiveDollars, url: "/invoices" }, diff --git a/frontend/src/components/modals/OnSiteMeetingModal.vue b/frontend/src/components/modals/BidMeetingModal.vue similarity index 99% rename from frontend/src/components/modals/OnSiteMeetingModal.vue rename to frontend/src/components/modals/BidMeetingModal.vue index f3e50bc..26908d4 100644 --- a/frontend/src/components/modals/OnSiteMeetingModal.vue +++ b/frontend/src/components/modals/BidMeetingModal.vue @@ -6,7 +6,7 @@ @confirm="handleConfirm" @cancel="handleCancel" > - Schedule New On-Site Meeting + Schedule New Bid Meeting