Changes between Initial Version and Version 1 of AddComponent


Ignore:
Timestamp:
12/29/25 04:56:59 (13 hours ago)
Author:
233194
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AddComponent

    v1 v1  
     1== Add component to build ==
     2
     3=== Actors ===
     4
     5Admin
     6
     7=== Scenario ===
     8
     91. In the admin dashboard, there is a button labeled 'Add Component' with which the admin can add any component needed. The labels and text fields are populated by back-end logic, so it's as seamless as possible.
     10
     11[[Image(component.png, width=800, height=420)]]
     12
     132. When the button is clicked, a popup appears which has some basic information, but one of the fields is a dropdown with all the component types. The admins can choose which component they want and the fields populate.
     14
     15[[Image(componentpopup.png, width=800, height=420)]]
     16[[Image(componentdropdown.png, width=800, height=420)]]
     17
     183. When the admin selects a cpu, for example, it automatically populates the needed fields and then he can enter the information.
     19
     20[[Image(populatedfields.png, width=800, height=420)]]
     21
     224. After the admin clicks create component, the popup disappears and if we check popup with all the cpus we can see that the new cpu is inserted successfully.
     23
     24[[Image(newComponent.png, width=800, height=420)]]
     25
     26{{{
     27BEGIN;
     28
     29SELECT *
     30FROM build
     31WHERE id = $buildId
     32  AND user_id = $userId
     33LIMIT 1;
     34
     35SELECT *
     36FROM build_component
     37WHERE build_id = $buildId
     38  AND component_id = $componentId
     39LIMIT 1;
     40
     41INSERT INTO build_component (build_id, component_id)
     42VALUES ($buildId, $componentId);
     43
     44SELECT c.price
     45FROM build_component bc
     46JOIN components c ON c.id = bc.component_id
     47WHERE bc.build_id = $buildId;
     48
     49UPDATE build
     50SET total_price = (
     51  SELECT COALESCE(ROUND(SUM(c.price), 2), 0)
     52  FROM build_component bc
     53  JOIN components c ON c.id = bc.component_id
     54  WHERE bc.build_id = $buildId
     55)
     56WHERE id = $buildId;
     57
     58COMMIT;
     59}}}
     60
     61[[Image(addedComponent.png, width=800, height=420)]]