Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fixed the drawer behaviour and also added work type aand enviorment type to search

alidauda6d89889de6b6
diff --git a/apps/carbon/app/components/Form/Color.tsx b/apps/carbon/app/components/Form/Color.tsx
index 548f8f28a8..e7d36d10fd 100644
--- a/apps/carbon/app/components/Form/Color.tsx
+++ b/apps/carbon/app/components/Form/Color.tsx
@@ -35,7 +35,10 @@ const ColorPicker = ({ name, label }: ColorFieldProps) => {
<button
className="inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 h-8 w-8 border border-border"
style={{ background: value }}
- onClick={disclosure.onToggle}
+ onClick={(event) => {
+ event.preventDefault(); // Prevent default action
+ disclosure.onToggle();
+ }}
/>
<HexColorInput
color={value}
diff --git a/packages/database/supabase/migrations/20240223235518_add_search_functionality_to_equipment_and_work_cell_types.sql b/packages/database/supabase/migrations/20240223235518_add_search_functionality_to_equipment_and_work_cell_types.sql
new file mode 100644
index 0000000000..c33979f761
--- /dev/null
+++ b/packages/database/supabase/migrations/20240223235518_add_search_functionality_to_equipment_and_work_cell_types.sql
@@ -0,0 +1,85 @@
+
+
+-- Work Cell Type Start
+CREATE FUNCTION public.create_work_cell_type_search_result()
+RETURNS TRIGGER AS $$
+BEGIN
+ INSERT INTO public.search(name, description, entity, uuid, link)
+ VALUES (new.id, new.id || ' ' || new.name || ' ' || COALESCE(new.description, ''), 'Part', new.id, '/x/resources/work-cells/' || new.id);
+ RETURN new;
+END;
+$$ LANGUAGE plpgsql SECURITY DEFINER;
+
+CREATE TRIGGER create_work_cell_type_search_result
+ AFTER INSERT ON public."workCellType"
+ FOR EACH ROW EXECUTE PROCEDURE public.create_work_cell_type_search_result();
+
+CREATE FUNCTION public.update_work_cell_type_search_result()
+RETURNS TRIGGER AS $$
+BEGIN
+ IF (old.name <> new.name OR old.description <> new.description) THEN
+ UPDATE public.search SET name = new.name, description = new.id || ' ' || new.name || ' ' || COALESCE(new.description, '')
+ WHERE entity = 'Part' AND uuid = new.id;
+ END IF;
+ RETURN new;
+END;
+$$ LANGUAGE plpgsql SECURITY DEFINER;
+
+CREATE TRIGGER update_work_cell_type_search_result
+ AFTER UPDATE ON public."workCellType"
+ FOR EACH ROW EXECUTE PROCEDURE public.update_work_cell_type_search_result();
+
+CREATE FUNCTION public.delete_work_cell_type_search_result()
+RETURNS TRIGGER AS $$
+BEGIN
+ DELETE FROM public.search WHERE entity = 'Part' AND uuid = old.id;
+ RETURN old;
+END;
+$$ LANGUAGE plpgsql SECURITY DEFINER;
+
+CREATE TRIGGER delete_work_cell_type_search_result
+ AFTER DELETE ON public."workCellType"
+ FOR EACH ROW EXECUTE PROCEDURE public.delete_work_cell_type_search_result();
+-- Work Cell Type End
+
+-- Equipment Type Start
+CREATE FUNCTION public.create_equipment_type_search_result()
+RETURNS TRIGGER AS $$
+BEGIN
+ INSERT INTO public.search(name, description, entity, uuid, link)
+ VALUES (new.id, new.id || ' ' || new.name || ' ' || COALESCE(new.description, ''), 'Part', new.id, '/x/resources/equipment/' || new.id);
+ RETURN new;
+END;
+$$ LANGUAGE plpgsql SECURITY DEFINER;
+
+CREATE TRIGGER create_equipment_type_search_result
+ AFTER INSERT ON public."equipmentType"
+ FOR EACH ROW EXECUTE PROCEDURE public.create_equipment_type_search_result();
+
+CREATE FUNCTION public.update_equipment_type_search_result()
+RETURNS TRIGGER AS $$
+BEGIN
+ IF (old.name <> new.name OR old.description <> new.description) THEN
+ UPDATE public.search SET name = new.name, description = new.id || ' ' || new.name || ' ' || COALESCE(new.description, '')
+ WHERE entity = 'Part' AND uuid = new.id;
+ END IF;
+ RETURN new;
+END;
+$$ LANGUAGE plpgsql SECURITY DEFINER;
+
+CREATE TRIGGER update_equipment_type_search_result
+ AFTER UPDATE ON public."equipmentType"
+ FOR EACH ROW EXECUTE PROCEDURE public.update_equipment_type_search_result();
+
+CREATE FUNCTION public.delete_equipment_type_search_result()
+RETURNS TRIGGER AS $$
+BEGIN
+ DELETE FROM public.search WHERE entity = 'Part' AND uuid = old.id;
+ RETURN old;
+END;
+$$ LANGUAGE plpgsql SECURITY DEFINER;
+
+CREATE TRIGGER delete_equipment_type_search_result
+ AFTER DELETE ON public."equipmentType"
+ FOR EACH ROW EXECUTE PROCEDURE public.delete_equipment_type_search_result();
+-- Equipment Type End
\ No newline at end of file