@@ -6,6 +6,65 @@ angular.module("mrlapp.service.EmailGui", []).controller("EmailGuiCtrl", [
66 var _self = this
77 var msg = this . msg
88
9+ // Toggle edit mode for a specific property
10+ $scope . toggleEdit = function ( key ) {
11+ $scope . editMode [ key ] = ! $scope . editMode [ key ]
12+ }
13+
14+ // Remove a property from the service
15+ $scope . removeProp = function ( key ) {
16+ msg . send ( "removeProperty" , key )
17+ msg . send ( "broadcastState" )
18+ }
19+
20+ // New property template
21+ $scope . newProp = { name : "" , value : "" }
22+
23+ // Add a new property to the service
24+ $scope . addProp = function ( ) {
25+ if ( $scope . newProp . name && $scope . newProp . value ) {
26+ msg . send ( "addProperty" , $scope . newProp . name , $scope . newProp . value )
27+ msg . send ( "broadcastState" )
28+ $scope . newProp . name = ""
29+ $scope . newProp . value = ""
30+ }
31+ }
32+
33+ // Email data
34+ $scope . emailRecipient = ""
35+ $scope . emailMessage = ""
36+ $scope . attachment = null
37+
38+ // Handle file selection
39+ $scope . handleFileChange = function ( event ) {
40+ $scope . $apply ( ( ) => {
41+ $scope . attachment = event . target . files [ 0 ]
42+ } )
43+ }
44+
45+ // Send email function (placeholder)
46+ $scope . sendEmail = function ( ) {
47+ if ( ! $scope . emailRecipient . trim ( ) ) {
48+ alert ( "Please enter a recipient email." )
49+ return
50+ }
51+
52+ if ( ! $scope . emailMessage . trim ( ) ) {
53+ alert ( "Please enter an email message." )
54+ return
55+ }
56+
57+ console . log ( "Sending email..." )
58+ console . log ( "To:" , $scope . emailRecipient )
59+ console . log ( "Message:" , $scope . emailMessage )
60+ console . log ( "SMTP Config:" , $scope . service . props )
61+ if ( $scope . attachment ) {
62+ console . log ( "Attachment:" , $scope . attachment . name )
63+ }
64+
65+ alert ( "Email Sent Successfully! (This is a placeholder function)" )
66+ }
67+
968 // GOOD TEMPLATE TO FOLLOW
1069 this . updateState = function ( service ) {
1170 $scope . service = service
0 commit comments