diff --git a/src/controller.py b/src/controller.py
index fe008c34b6ef945e32da602826e1a4864e098eef..4b397fa701d6df12669895dc4ec41d75e337a98e 100644
--- a/src/controller.py
+++ b/src/controller.py
@@ -20,7 +20,7 @@ class controller:
         self.dashboard.switch.connect(self.fromDashboard)
         self.listLatihan = listLatihan2()
         self.listLatihan.switch.connect(self.fromListLatihan)
-        self.customize = customizeWorkout()
+        self.customize = customizeWorkout(0)
         self.customize.switch.connect(self.fromCustomize)
         self.plan = plan()
         self.plan.switch.connect(self.fromPlan)
@@ -48,7 +48,7 @@ class controller:
         self.dashboard.switch.connect(self.fromDashboard)
         self.dashboard.show()
 
-    def fromDashboard(self, page):
+    def fromDashboard(self, page, program_id):
         self.registerWin.close()
         self.dashboard.close()
         if (page == "listLatihan"):
@@ -59,7 +59,7 @@ class controller:
             self.plan.show()
 
 
-    def fromListLatihan(self, page):
+    def fromListLatihan(self, page, program_id):
         self.listLatihan.close()
         if (page == "dashboard"):
             self.dashboard.show()
@@ -73,17 +73,25 @@ class controller:
         if (page == "dashboard"):
             self.dashboard.show()
         elif (page == "customize"):
+            self.customize = customizeWorkout(program_id)
+            self.customize.switch.connect(self.fromCustomize)
             self.customize.show()
         elif (page == "listLatihan"):
             self.listLatihan.show()
+        elif (page == "plan2"):
+            self.plan2 = plan2(program_id)
+            self.plan2.switch.connect(self.toEndOfExe)
+            self.plan2.show()
 
-    def fromCustomize(self, page):
+    def fromCustomize(self, page, program_id):
         self.customize.close()
         if (page == "dashboard"):
             self.dashboard.show()
         elif (page == "listLatihan"):
             self.listLatihan.show()
         elif (page == "plan"):
+            self.plan = plan()
+            self.plan.switch.connect(self.fromPlan)
             self.plan.show()
 
     def toPlan2(self, page, program_id):
@@ -102,6 +110,8 @@ class controller:
     def fromEndOfExe(self,page):
         self.endOfExe.close()
         if (page == "dashboard"):
+            self.dashboard = dashboard()
+            self.dashboard.switch.connect(self.fromDashboard)
             self.dashboard.show()
 
     def initDatabase(self):
@@ -133,13 +143,14 @@ class controller:
 
             cur.execute("""
                         CREATE TABLE IF NOT EXISTS riwayat_latihan (
-                        history_id integer PRIMARY KEY AUTOINCREMENT,
+                        history_id integer,
                         program_id integer,
                         name text,
                         title_program text,
                         calories integer,
                         date text,
-                        tot_duration integer
+                        tot_duration integer,
+                        FOREIGN KEY (program_id) REFERENCES program (program_id)
                         )
                         """)
             cur.execute("""
@@ -205,6 +216,7 @@ class controller:
                             (3, 205),
                             (3, 106)
                         """)
+            
             # cur.execute("""
             #         INSERT INTO riwayat_latihan
             #             (program_id, name, title_program, calories, date, tot_duration)
diff --git a/src/customize.py b/src/customize.py
index fe903ba871feebdc6234208b0f27d5f4868f592d..9443c641947263b1a1af916512aca7ef11a690b1 100644
--- a/src/customize.py
+++ b/src/customize.py
@@ -15,11 +15,12 @@ cardColor = '#D2DCC4'
 class customizeWorkout(QWidget):
     switch = pyqtSignal(str, int, dict)
 
-    def __init__(self):
+    def __init__(self, program_id):
         
         super().__init__()
         self.con = sqlite3.connect('fitu.db')
-        self.listEx = self.fetchListEx()          
+        self.listEx = self.fetchListEx()    
+        self.program_id = program_id  
         self.setupGUI()
         
     def fetchListEx(self):
@@ -306,9 +307,50 @@ class customizeWorkout(QWidget):
         scroll2.setWidget(scrollWidget2)
         
         area2 = []
-        
+
+        if self.program_id != 0:
+            cur = self.con.cursor()
+            self.latihan = cur.execute(f"SELECT exercise_id FROM daftar_latihan NATURAL JOIN latihan_program WHERE program_id = {self.program_id}").fetchall()
+            print(self.latihan)
+            for i in range(len(self.latihan)):
+                area2.append(self.latihan[i][0])
+                exLabel = QLabel(self)
+                exLabel.setFixedSize(367, 99)
+                exLabel.setStyleSheet("background-color: #5A8D6C; border-radius: 20px;")
+                exLabel1 = QLabel(exLabel)
+                exLabel1.move(10, 10)
+                exLabel1.setFixedSize(79, 79)
+                exLabel1.setStyleSheet(styleSheet5)
+                
+                #add gif
+                gif = QMovie('img/exe-pushup.gif')
+                exLabel1.setMovie(gif)
+                gif.start()
+                gif.setScaledSize(QSize(79, 79))
+                gif.setSpeed(100)
+                title = QLabel(exLabel)
+                title.setText(f'<font style="font-size:24px;" color="#D2DCC4"; font-family="Sogoe UI";><b>{self.listEx[i][1]}<b>')
+                title.move(100, 15)
+                repDur = QLabel(exLabel)
+                if(i<8):
+                        repDur.setText(f'<font style="font-size:14px;" color="#D2DCC4"; font-family="Sogoe UI";><b>{self.listEx[i][4]} Seconds<b>')
+                        repDur.move(100, 60)
+                else:
+                    repDur.setText(f'<font style="font-size:14px;" color="#D2DCC4"; font-family="Sogoe UI";><b>{self.listEx[i][5]} Repetition<b>')
+                    repDur.move(100,60)
+                deleteButton = QPushButton(exLabel)
+                deleteButton.setIcon(QIcon('img/delete button.png'))
+                deleteButton.setIconSize(QPixmap('img/delete button.png').size())
+                deleteButton.setGeometry(320, 55, 36, 36)
+                deleteButton.move(320, 55)
+                deleteButton.setCursor(
+                    QCursor(Qt.CursorShape.PointingHandCursor))
+                deleteButton.clicked.connect(lambda checked, index=i: handleDeleteButtonClicked(index, exLabel, scrollLayout2))
+                scrollLayout2.addWidget(exLabel)
+
         def handleButtonClicked(i, buttonList):
-            area2.append(i)
+
+            area2.append(self.listEx[i][0])
             button = buttonList[i]
             button.setEnabled(False)
             button.setIcon(QIcon('img/check button.png'))
@@ -332,10 +374,10 @@ class customizeWorkout(QWidget):
             title.move(100, 15)
             repDur = QLabel(exLabel)
             if(i<8):
-                    repDur.setText(f'<font style="font-size:14px;" color="#D2DCC4"; font-family="Sogoe UI";><b>{self.listEx[i][4]} Detik<b>')
+                    repDur.setText(f'<font style="font-size:14px;" color="#D2DCC4"; font-family="Sogoe UI";><b>{self.listEx[i][4]} Seconds<b>')
                     repDur.move(100, 60)
             else:
-                repDur.setText(f'<font style="font-size:14px;" color="#D2DCC4"; font-family="Sogoe UI";><b>{self.listEx[i][5]} Repetisi<b>')
+                repDur.setText(f'<font style="font-size:14px;" color="#D2DCC4"; font-family="Sogoe UI";><b>{self.listEx[i][5]} Repetition<b>')
                 repDur.move(100,60)
             deleteButton = QPushButton(exLabel)
             deleteButton.setIcon(QIcon('img/delete button.png'))
@@ -360,7 +402,7 @@ class customizeWorkout(QWidget):
             if(progNameInput.text() == '' or scrollLayout2 == []):
                 QMessageBox.about(self, "Error", "Please input program name")
             else:
-                # QMessageBox.about(self, "Success", "Program saved")
+                QMessageBox.about(self, "Success", "Program saved")
                 # self.close()
                 cur = self.con.cursor()
                 data = cur.execute("SELECT program_id FROM program")
@@ -370,11 +412,11 @@ class customizeWorkout(QWidget):
                     )
                 for i in area2:
                     cur.execute(
-                        f"INSERT INTO latihan_program (program_id, exercise_id) VALUES ({lenProg+1} ,{self.listEx[i][0]})"
+                        f"INSERT INTO latihan_program (program_id, exercise_id) VALUES ({lenProg+1} ,{i})"
                         )
                 print(lenProg)
                 self.con.commit()
-                self.close()
+                
                 
                 
                 
@@ -441,13 +483,13 @@ class customizeWorkout(QWidget):
         saveButton.clicked.connect(saveButtonClicked)
 
     def planWindow(self):
-        self.switch.emit("plan", self.clickedRowData, {})
+        self.switch.emit("plan", 0, {})
     
     def listWindow(self):
-        self.switch.emit("listLatihan", {})
+        self.switch.emit("listLatihan", 0, {})
     
     def dashboardWindow(self):
-        self.switch.emit("dashboard", {})
+        self.switch.emit("dashboard", 0, {})
                 
 if __name__ == '__main__':
     app = QApplication(sys.argv)
diff --git a/src/dashboard.py b/src/dashboard.py
index ae75dcf1334ecfa0fca32a1c13fda0d298d556a1..c5a9398bc669b6050c284a313e4748c24833b1b9 100644
--- a/src/dashboard.py
+++ b/src/dashboard.py
@@ -86,6 +86,7 @@ class dashboard(QWidget):
 
     def historyElement(self, historyIdx, idx):
         # self.cur = self.con.cursor()
+        print(idx)
         self.index_history = idx
         tanggal = self.cur.execute(f"""
             SELECT strftime(date) FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}'
@@ -97,7 +98,7 @@ class dashboard(QWidget):
         self.card.move(633, 172)
 
         daftar_latihan = self.cur.execute(f"""
-            SELECT name FROM riwayat_latihan WHERE date = '{tanggal}'
+            SELECT name FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}'
         """).fetchall()
 
         jumlahCard = len(daftar_latihan)
@@ -113,8 +114,9 @@ class dashboard(QWidget):
         self.date.setAlignment(Qt.AlignmentFlag.AlignLeft)
 
         keterangan = self.cur.execute(f"""
-                SELECT tot_duration, title_program FROM riwayat_latihan WHERE date = '{tanggal}'
+                SELECT tot_duration, title_program FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}'
         """).fetchone()
+        print(keterangan)
         self.duration = QLabel(self)
         self.duration.setText("Duration : " + str(keterangan[0]) + " minutes")
         self.duration.setStyleSheet(f'color: {button_color}; background-color: {card_color};')
@@ -127,7 +129,7 @@ class dashboard(QWidget):
         self.prog.setText("Program Name: " + keterangan[1])
         self.prog.setStyleSheet(f'color: {button_color}; background-color: {card_color};')
         self.prog.move(667, 317)
-        self.prog.setFixedWidth(300)
+        self.prog.setFixedWidth(497)
         self.prog.setFont(historyFont)
         self.prog.setAlignment(Qt.AlignmentFlag.AlignLeft)
 
@@ -365,13 +367,13 @@ class dashboard(QWidget):
         if(self.biodata == []):
             self.hello.setText(f"Hello, dummy!")
         else:
-            self.hello.setText(f"Hello, {self.biodata[0][0]}!")
+            self.hello.setText(f"Hello, {self.biodata[0][0].split(' ')[0]}!")
         self.hello.setStyleSheet(f'color: {text_color};')
         self.hello.setAlignment(Qt.AlignmentFlag.AlignLeft)
 
         # quote
         quote = QLabel(self)
-        quote.setText("Saran quote dong maz\nbingung mau naro quote apa nih")
+        quote.setText("“Strength does not come from\nphysical capacity. It comes from\nan indomitable will.”\n-Mahatma Gandhi")
         quote.setStyleSheet(f'color: {text_color};')
         quote.move(101, 320)
         quote.setFont(quoteFont)
@@ -403,6 +405,7 @@ class dashboard(QWidget):
                                 SELECT DISTINCT history_id FROM riwayat_latihan
                                 """).fetchall()
         
+        print(historyIdx)
         # menyiapkan history card
 
         if (len(historyIdx) <= 0):
@@ -428,14 +431,16 @@ class dashboard(QWidget):
             tanggal = self.cur.execute(f"""
             SELECT strftime(date) FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}'
         """).fetchone()[0]
+            print('tanggal',tanggal)
             self.date.setText(f"{tanggal}")
             daftar_latihan = self.cur.execute(f"""
-                SELECT name FROM riwayat_latihan WHERE date = '{tanggal}'
+                SELECT name FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}'
                 """).fetchall()
             jumlahCard = len(daftar_latihan)
             keterangan = self.cur.execute(f"""
-                SELECT tot_duration, title_program FROM riwayat_latihan WHERE date = '{tanggal}'
+                SELECT tot_duration, title_program FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}'
                 """).fetchone()
+            print('keterangan',keterangan)
             
             self.duration.setText("Duration : " + str(keterangan[0]) + " minutes")
             self.prog.setText("Program Name: " + keterangan[1])
@@ -535,11 +540,11 @@ class dashboard(QWidget):
         """).fetchone()[0]
             self.date.setText(f"{tanggal}")
             daftar_latihan = self.cur.execute(f"""
-                SELECT name FROM riwayat_latihan WHERE date = '{tanggal}'
+                SELECT name FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}'
                 """).fetchall()
             jumlahCard = len(daftar_latihan)
             keterangan = self.cur.execute(f"""
-                SELECT tot_duration, title_program FROM riwayat_latihan WHERE date = '{tanggal}'
+                SELECT tot_duration, title_program FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}'
                 """).fetchone()
             
             self.duration.setText("Duration : " + str(keterangan[0]) + " minutes")
@@ -624,10 +629,10 @@ class dashboard(QWidget):
         self.switch.emit("plan", 0, {})
     
     def listWindow(self):
-        self.switch.emit("listLatihan", {})
+        self.switch.emit("listLatihan",0,  {})
     
     def customWindow(self):
-        self.switch.emit("customize", {})
+        self.switch.emit("customize", 0, {})
     
 if __name__ == '__main__':
     app = QApplication(sys.argv)
diff --git a/src/listlatihan2.py b/src/listlatihan2.py
index 5f54869e73213274638a0a72f2362ef2a8f3fbdc..62060e7badd9b3bda415ba9679661adbc817c41d 100644
--- a/src/listlatihan2.py
+++ b/src/listlatihan2.py
@@ -268,13 +268,13 @@ class listLatihan2(QWidget):
         
         scroll.setWidget(scrollWidget)
     def customWindow(self):
-        self.switch.emit("customize", {})
+        self.switch.emit("customize", 0, {})
         
     def planWindow(self):
-        self.switch.emit("plan", self.clickedRowData, {})
+        self.switch.emit("plan", 0, {})
         
     def dashboard(self):
-        self.switch.emit("dashboard", {})
+        self.switch.emit("dashboard",0, {})
         
 class MyPopup(QDialog):
     def __init__(self, count, listLat):
diff --git a/src/plan.py b/src/plan.py
index 13c406aa86642ed64dff57f387e7b7edb3dabe4f..25c67347fd8f3bf35cda9e296532fccace3c5eff 100644
--- a/src/plan.py
+++ b/src/plan.py
@@ -14,6 +14,7 @@ class plan(QWidget):
     switch = pyqtSignal(str, int, dict )
     def __init__(self):
         super().__init__()
+        self.clickedRowData = 0
         self.con = sqlite3.connect('fitu.db')
         self.programExercises = self.fetchProgramExercises()
         self.planWindow()
@@ -376,13 +377,15 @@ class plan(QWidget):
         custButton.clicked.connect(self.customWindow)
     
     def dashboardWindow(self):
-        self.switch.emit("dashboard", {})
+        self.switch.emit("dashboard",0, {})
     
     def listWindow(self):
-        self.switch.emit("listLatihan", {})
+        self.switch.emit("listLatihan", 0, {})
     
     def customWindow(self):
         self.switch.emit("customize", self.clickedRowData, {})
+        # else:
+        #     self.switch.emit("customize", 0, {})
     
     def plan2Window(self):
         self.switch.emit("plan2", self.clickedRowData, {})
diff --git a/src/plan2.py b/src/plan2.py
index 2610a2af313693f4624b9e01dfb3c29c8657542d..267a48b89f6e62af1ef9126df836eb0788fee87c 100644
--- a/src/plan2.py
+++ b/src/plan2.py
@@ -257,13 +257,14 @@ class plan2(QWidget):
             print(nameExe)
             date = time.strftime("%Y-%m-%d", time.localtime())
             print(date)
+            histId = self.c.execute("SELECT DISTINCT history_id FROM riwayat_latihan").fetchall()
             totDuration = time.time() - self.start
             print(totDuration)
             for i in range (len(self.latihan)):
                 print(nameExe[i][0], titleProgram[0], date, int(totDuration))
-                self.c.execute(f"""INSERT INTO riwayat_latihan (program_id, name, title_program, date, calories, tot_duration) 
+                self.c.execute(f"""INSERT INTO riwayat_latihan (history_id, program_id, name, title_program, date, calories, tot_duration) 
                 VALUES 
-                ({self.program_id}, '{nameExe[i][0]}', '{(titleProgram[0])}', '{date}', NULL, {int(totDuration)})""")
+                ({len(histId)+401}, {self.program_id}, '{nameExe[i][0]}', '{(titleProgram[0])}', '{date}', NULL, {int(totDuration)})""")
                 self.conn.commit()
             self.switch.emit("endOfExe", {})
 
@@ -285,7 +286,7 @@ class plan2(QWidget):
     #     # historyButton.clicked.connect(self.addHistory)
 
     def backToPlan(self):
-        self.switch.emit("plan", {})
+        self.switch.emit("plan", 0, {})
     
 if __name__ == "__main__":