o
    g#                     @   s<   d dl mZ d dlmZ dd Zdd Zdd Zd	d
 ZdS )    )ui)Vehiclec                     s  t  I d H } t d t A t d td td td td td td td	 td
 td td W d    n1 sXw   Y  t  | D ]v}t h t|j	 t|j
 t|j t|j t|j t|j t|j t|j t|j t  tjd|fddd tjd|fddd W d    n1 sw   Y  W d    n1 sw   Y  qdW d    n1 sw   Y  W d    d S W d    d S 1 sw   Y  d S )Nzw-fullz	font-boldIDNameMakeModelYearVINLicense PlateColorImageActionsEditc                 S      t | S N)edit_vehiclev r   */home/mproulx/AI/AIRepair/xFix/vehicles.py<lambda>"       z(display_editable_table.<locals>.<lambda>on_clickDeletec                 S   r   r   )delete_vehicler   r   r   r   r   #   r   )r   allr   tableclasses
table_head	table_row
table_cell
table_bodyidnamemakemodelyearvinlicense_platecolorimagebutton)vehiclesvehicler   r   r   display_editable_table   sP   












"r/   c              	      sF  t  }t  x t jd j fddd t jd j fddd t jd j fddd t jd	 j fd
dd t jd j fddd t jd j	 fddd t jd j
 fddd t jd j fddd t jd|jd W d    n1 sw   Y  W d    d S W d    d S 1 sw   Y  d S )Nr   c                       t  jd| jS )Nr$   update_vehicle_fieldr#   valueer.   r   r   r   '       zedit_vehicle.<locals>.<lambda>)r3   	on_changer   c                    r0   )Nr%   r1   r4   r6   r   r   r   (   r7   r   c                    r0   )Nr&   r1   r4   r6   r   r   r   )   r7   r   c                    r0   )Nr'   r1   r4   r6   r   r   r   *   r7   r	   c                    r0   )Nr(   r1   r4   r6   r   r   r   +   r7   r
   c                    r0   )Nr)   r1   r4   r6   r   r   r   ,   r7   r   c                    r0   )Nr*   r1   r4   r6   r   r   r   -   r7   r   c                    r0   )Nr+   r1   r4   r6   r   r   r   .   r7   Closer   )r   dialogcardinputr$   r%   r&   r'   r(   r)   r*   r+   r,   close)r.   r:   r   r6   r   r   %   s   Pr   c                    s<   t j| dI d H }t||| | I d H  td d S )N)r#   zVehicle updated successfully)r   getsetattrsaver   notify)
vehicle_idfieldr3   r.   r   r   r   r2   1   s
   r2   c                    s*   |   I d H  td t I d H  d S )NzVehicle deleted successfully)deleter   rA   r/   r6   r   r   r   r   7   s   
r   N)niceguir   r&   r   r/   r   r2   r   r   r   r   r   <module>   s     