o
    Q_diG	                     @  sv   d dl mZ d dlmZ ddlmZ ddlmZmZ ddl	m
Z
 ddlmZmZ ddlmZ dd	lmZ dddZdS )    )annotations)sync_playwright   )launch_browser_context)create_run_dirshot)ensure_logged_in)timesheet_navtimesheet_create)timesheet_select_date)
NewRowSpecreturnintc                 C  s  | j  std| j  dt| d}t }t|| t| j d\}}| }zwzGt|| |ddd t	
|| | tj
|| |t| dd	d
 d }t| dd rVdd | jD }tj
|| ||d t||d |jt| j d W n ty}   t||d  w W z|  W n	 ty   Y nw z|  W n) ty   Y n!w z|  W n	 ty   Y nw z|  W w  ty   Y w w W d    n1 sw   Y  td td|  dS )NzstorageState not found: z. Run bootstrap first.ztimesheet-create)storage_state F)mfa_code	allow_mfatimesheet_datez
2026-01-08)target_datetimesheet_rowsc                 S  s@   g | ]}t |d  |d |dpd|dd|dddqS )	hoursoverheadnoteNworktypeNTtrackingADMIN)r   r   r   worktype_labeltracking_label)r   get).0r r"   _/var/www/html/flask_server/apps/aroflo_connector_app/ui_automation/commands/timesheet_create.py
<listcomp>)   s    

z(cmd_timesheet_create.<locals>.<listcomp>)rowsok)pathz99-errorz[UI] timesheet-create OKz[UI] Artifacts: r   )
state_fileexists
SystemExitr   r   r   strnew_pager   r	   runr   getattrr   r
   r   r   	Exceptioncloseprint)cfgrun_dirpbrowsercontextpager%   r"   r"   r#   cmd_timesheet_create   sj   


1r8   N)r   r   )
__future__r   playwright.sync_apir   core.browserr   core.artifactsr   r   auth.sessionr   flowsr	   r
   r   flows.timesheet_creater   r8   r"   r"   r"   r#   <module>   s   