diff --git a/autoload/controls/class.Campaigns.php b/autoload/controls/class.Campaigns.php index 8018458..e733863 100644 --- a/autoload/controls/class.Campaigns.php +++ b/autoload/controls/class.Campaigns.php @@ -41,6 +41,7 @@ class Campaigns '', $row['bidding_strategy'], \S::number_display( $row['budget'] ), + '', ]; } @@ -102,4 +103,36 @@ class Campaigns ] ); exit; } + + static public function delete_campaign() + { + $campaign_id = \S::get( 'campaign_id' ); + + if ( !$campaign_id ) + { + echo json_encode( [ 'success' => false, 'message' => 'Nie wybrano kampanii' ] ); + exit; + } + + $result = \factory\Campaigns::delete_campaign( $campaign_id ); + + echo json_encode( [ 'success' => $result ? true : false ] ); + exit; + } + + static public function delete_history_entry() + { + $history_id = \S::get( 'history_id' ); + + if ( !$history_id ) + { + echo json_encode( [ 'success' => false, 'message' => 'Nie podano wpisu do usunięcia' ] ); + exit; + } + + $result = \factory\Campaigns::delete_history_entry( $history_id ); + + echo json_encode( [ 'success' => $result ? true : false ] ); + exit; + } } diff --git a/autoload/factory/class.Campaigns.php b/autoload/factory/class.Campaigns.php index 5f8175b..42b2aeb 100644 --- a/autoload/factory/class.Campaigns.php +++ b/autoload/factory/class.Campaigns.php @@ -34,4 +34,17 @@ class Campaigns global $mdb; return $mdb -> get( 'clients', 'name', [ 'id' => $client_id ] ); } + + static public function delete_campaign( $campaign_id ) + { + global $mdb; + $mdb -> delete( 'campaigns_history', [ 'campaign_id' => $campaign_id ] ); + return $mdb -> delete( 'campaigns', [ 'id' => $campaign_id ] ); + } + + static public function delete_history_entry( $history_id ) + { + global $mdb; + return $mdb -> delete( 'campaigns_history', [ 'id' => $history_id ] ); + } } \ No newline at end of file diff --git a/templates/campaigns/main_view.php b/templates/campaigns/main_view.php index df10371..cafe3a7 100644 --- a/templates/campaigns/main_view.php +++ b/templates/campaigns/main_view.php @@ -14,12 +14,21 @@
- +
+
+ +
+
+ +
+
@@ -42,7 +51,7 @@ - + @@ -50,6 +59,7 @@ + @@ -61,6 +71,104 @@ \ No newline at end of file
DataData ROAS (30 dni) ROAS (all time) Wartość konwersji (30 dni)Komentarz Strategia ustalania stawek BudżetAkcje