File size: 3,681 Bytes
c9329ee
 
8f9431d
c9329ee
 
 
 
3487183
aa1cf8a
 
 
 
 
 
 
 
c9329ee
 
3487183
c9329ee
3487183
 
aa1cf8a
 
3487183
 
 
 
c9329ee
3487183
8f9431d
3487183
 
 
aa1cf8a
3487183
 
 
 
 
 
 
aa1cf8a
 
 
3487183
 
 
 
aa1cf8a
c9329ee
 
 
3487183
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from taipy import Gui
import taipy.gui.builder as tgb
from functi import post_generation,post_publishing,authen,add_scheduling,delete_account,delete_schedule,post_generation_

days_of_week = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
Social_network_menu = ["Linkedin"]


from taipy import Gui
import taipy.gui.builder as tgb
from functi import post_generation,post_publishing,authen,add_scheduling,delete_account,delete_schedule

days_of_week = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
Social_network_menu = ["Linkedin"]


with tgb.Page(class_name="bodyp") as Post_manag :
    with tgb.part(class_name="source_body") :
        tgb.text("Post Management", class_name="Title_Page")
        with tgb.part(class_name="layout_top") :
            tgb.text("Linking Account", class_name="header-burgundy")
            with tgb.layout(columns="1", class_name="table_t") :  # Single column for full width
                # Mobile responsive: 3 columns on desktop, 1 column on mobile
                with tgb.layout(columns="1 1 1", columns_mobile="1", gap="16px") :
                    tgb.input("{Linked_account_name}", label="Account name", change_delay=-1, action_on_blur=True, width="100%")
                    tgb.selector("{Linked_social_network}", lov=Social_network_menu, dropdown=True, label="Select platform", width="100%")
                    tgb.button(label="Add account", on_action=authen, class_name="btn-burgundy", width="100%")
                tgb.table("{data_account}", editable=True, on_add=False, on_edit=False, on_delete=delete_account, columns="social_network;account_name", width="100%")
        with tgb.part(class_name="table_s") :
            tgb.text("Demo", class_name="header-burgundy table_t")
            tgb.button(label="Generate a post", on_action=post_generation_, class_name="btn-burgundy", width="100%")
            tgb.input("{generated_post}", multiline=True, class_name="burgundy-border", width="100%")
            tgb.button(label="Publish", on_action=post_publishing, width="100%")
        with tgb.part(class_name="table_s") :
            tgb.text("Post Scheduling", class_name="header-burgundy")
            # Texte explicatif juste en dessous du titre, avec exemple
            tgb.text(
                "⏰ Pour garantir la bonne planification, l'heure choisie doit être au moins 10 minutes après l'heure actuelle. "
                "Par exemple, si il est 14h00, choisissez au minimum 14h10. "
                "Sinon, la tâche sera programmée pour la prochaine occurrence du créneau choisi.",
                class_name="info-message"
            )
            with tgb.layout(columns="1", class_name="table_t ") :
                # Mobile responsive: 4 columns on desktop, 1 column on mobile
                with tgb.layout(columns="1 1 1 1", columns_mobile="1", gap="16px") :
                    tgb.input("{time_value_hour}", label="Hour", change_delay=-1, action_on_blur=True, width="100%")
                    tgb.input("{time_value_minute}", label="Minute", change_delay=-1, action_on_blur=True, width="100%")
                    tgb.selector("{day_value}", lov=days_of_week, multiple=True, dropdown=True, show_select_all=True, width="100%")
                    tgb.button(label="Add", on_action=add_scheduling, width="100%")
                tgb.table("{data_schedule}", editable=True, on_add=False, on_edit=False, on_delete=delete_schedule, class_name="table_t", width="100%", columns="social_network;schedule_time")
            
            # Date complète
            # tgb.date("{day_value}", format="EEEE, MMM dd, yyyy", label="Full Date with Day")