|
@@ -7,17 +7,31 @@ |
|
@@ -7,17 +7,31 @@ |
7
|
|
7
|
|
8
|
import UIKit
|
8
|
import UIKit
|
9
|
|
9
|
|
|
|
10
|
+protocol ViewDelegate: AnyObject {
|
|
|
11
|
+ func viewDidTapImage()
|
|
|
12
|
+}
|
|
|
13
|
+
|
10
|
class AddResidentsView: UIView {
|
14
|
class AddResidentsView: UIView {
|
|
|
15
|
+ var isShow: Bool = false
|
|
|
16
|
+
|
|
|
17
|
+ weak var delegate: ViewDelegate?
|
|
|
18
|
+
|
11
|
let blurEffect: UIVisualEffectView = {
|
19
|
let blurEffect: UIVisualEffectView = {
|
12
|
let blur = UIBlurEffect(style: UIBlurEffect.Style.systemMaterialDark)
|
20
|
let blur = UIBlurEffect(style: UIBlurEffect.Style.systemMaterialDark)
|
13
|
let obj = UIVisualEffectView(effect: blur)
|
21
|
let obj = UIVisualEffectView(effect: blur)
|
14
|
obj.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
22
|
obj.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
15
|
obj.alpha = 0.9
|
23
|
obj.alpha = 0.9
|
|
|
24
|
+ obj.isUserInteractionEnabled = true
|
16
|
return obj
|
25
|
return obj
|
17
|
}()
|
26
|
}()
|
18
|
|
27
|
|
19
|
- var transparentView: UIView = {
|
28
|
+ lazy var transparentView: UIView = {
|
20
|
var obj = UIView()
|
29
|
var obj = UIView()
|
|
|
30
|
+ obj.isUserInteractionEnabled = true
|
|
|
31
|
+ var tap = UIGestureRecognizer(target: self, action: #selector(imageTapped))
|
|
|
32
|
+ obj.addGestureRecognizer(tap)
|
|
|
33
|
+ obj.backgroundColor = .black
|
|
|
34
|
+ obj.alpha = 0.5
|
21
|
return obj
|
35
|
return obj
|
22
|
}()
|
36
|
}()
|
23
|
|
37
|
|
|
@@ -32,7 +46,7 @@ class AddResidentsView: UIView { |
|
@@ -32,7 +46,7 @@ class AddResidentsView: UIView { |
32
|
var addResidentLabeL: UILabel = {
|
46
|
var addResidentLabeL: UILabel = {
|
33
|
var obj = UILabel()
|
47
|
var obj = UILabel()
|
34
|
obj.text = "Add resident"
|
48
|
obj.text = "Add resident"
|
35
|
- obj.textColor = UIColor(red: 0.196, green: 0.216, blue: 0.333, alpha: 1)
|
49
|
+ obj.textColor = .TextColor.darkBlue
|
36
|
obj.font = .skModernist(type: .bold, ofSize: 24)
|
50
|
obj.font = .skModernist(type: .bold, ofSize: 24)
|
37
|
return obj
|
51
|
return obj
|
38
|
}()
|
52
|
}()
|
|
@@ -41,14 +55,14 @@ class AddResidentsView: UIView { |
|
@@ -41,14 +55,14 @@ class AddResidentsView: UIView { |
41
|
var obj = UIButton()
|
55
|
var obj = UIButton()
|
42
|
obj.layer.cornerRadius = 13
|
56
|
obj.layer.cornerRadius = 13
|
43
|
obj.layer.borderWidth = 1
|
57
|
obj.layer.borderWidth = 1
|
44
|
- obj.layer.borderColor = UIColor(red: 0.882, green: 0.91, blue: 0.91, alpha: 1).cgColor
|
58
|
+ obj.layer.borderColor = .ButtonBorderColor.lightGrey
|
45
|
obj.setImage(UIImage(named: "Close"), for: .normal)
|
59
|
obj.setImage(UIImage(named: "Close"), for: .normal)
|
46
|
return obj
|
60
|
return obj
|
47
|
}()
|
61
|
}()
|
48
|
|
62
|
|
49
|
var dividingLineView: UIView = {
|
63
|
var dividingLineView: UIView = {
|
50
|
var view = UIView()
|
64
|
var view = UIView()
|
51
|
- view.backgroundColor = UIColor(red: 246/255, green: 246/255, blue: 246/255, alpha: 1)
|
65
|
+ view.backgroundColor = MyColor.dividingLineBackgroundColor.value
|
52
|
return view
|
66
|
return view
|
53
|
}()
|
67
|
}()
|
54
|
|
68
|
|
|
@@ -56,15 +70,18 @@ class AddResidentsView: UIView { |
|
@@ -56,15 +70,18 @@ class AddResidentsView: UIView { |
56
|
var obj = UILabel()
|
70
|
var obj = UILabel()
|
57
|
obj.text = "Resident name"
|
71
|
obj.text = "Resident name"
|
58
|
obj.font = .skModernist(type: .bold, ofSize: 14)
|
72
|
obj.font = .skModernist(type: .bold, ofSize: 14)
|
59
|
- obj.textColor = UIColor(red: 0.196, green: 0.216, blue: 0.333, alpha: 1)
|
73
|
+ obj.textColor = .TextColor.darkBlue
|
60
|
return obj
|
74
|
return obj
|
61
|
}()
|
75
|
}()
|
62
|
|
76
|
|
63
|
- var nameTextField: UITextField = {
|
|
|
64
|
- var obj = UITextField()
|
|
|
65
|
- obj.backgroundColor = UIColor(red: 0.954, green: 0.954, blue: 0.954, alpha: 1)
|
77
|
+ var nameTextField: TextFieldWithPadding = {
|
|
|
78
|
+ var obj = TextFieldWithPadding()
|
|
|
79
|
+ obj.backgroundColor = .TextFieldColor.general
|
66
|
obj.textAlignment = .left
|
80
|
obj.textAlignment = .left
|
67
|
obj.layer.cornerRadius = 15
|
81
|
obj.layer.cornerRadius = 15
|
|
|
82
|
+ obj.placeholder = "Enter resident name"
|
|
|
83
|
+ obj.font = .skModernist(type: .regular, ofSize: 14)
|
|
|
84
|
+ obj.textPadding = UIEdgeInsets(top: 0, left: 22, bottom: 0, right: 22)
|
68
|
return obj
|
85
|
return obj
|
69
|
}()
|
86
|
}()
|
70
|
|
87
|
|
|
@@ -72,27 +89,36 @@ class AddResidentsView: UIView { |
|
@@ -72,27 +89,36 @@ class AddResidentsView: UIView { |
72
|
var obj = UILabel()
|
89
|
var obj = UILabel()
|
73
|
obj.text = "Mobile number"
|
90
|
obj.text = "Mobile number"
|
74
|
obj.font = .skModernist(type: .bold, ofSize: 14)
|
91
|
obj.font = .skModernist(type: .bold, ofSize: 14)
|
75
|
- obj.textColor = UIColor(red: 0.196, green: 0.216, blue: 0.333, alpha: 1)
|
92
|
+ obj.textColor = MyColor.darkBlueTextColor.value
|
76
|
return obj
|
93
|
return obj
|
77
|
}()
|
94
|
}()
|
78
|
|
95
|
|
79
|
- var mobileNumberTextField: UITextField = {
|
|
|
80
|
- var obj = UITextField()
|
|
|
81
|
- obj.backgroundColor = UIColor(red: 0.954, green: 0.954, blue: 0.954, alpha: 1)
|
96
|
+ var mobileNumberTextField: TextFieldWithPadding = {
|
|
|
97
|
+ var obj = TextFieldWithPadding()
|
|
|
98
|
+ obj.backgroundColor = MyColor.generalTextFieldBackgroundColor.value
|
82
|
obj.textAlignment = .left
|
99
|
obj.textAlignment = .left
|
83
|
obj.layer.cornerRadius = 15
|
100
|
obj.layer.cornerRadius = 15
|
|
|
101
|
+ obj.font = .skModernist(type: .regular, ofSize: 14)
|
|
|
102
|
+ obj.textPadding = UIEdgeInsets(top: 0, left: 22, bottom: 0, right: 45)
|
|
|
103
|
+ obj.placeholder = "Enter resident number"
|
84
|
return obj
|
104
|
return obj
|
85
|
}()
|
105
|
}()
|
86
|
-
|
|
|
87
|
- var managerButton: UIButton = {
|
|
|
88
|
- var obj = UIButton()
|
|
|
89
|
- obj.setImage(UIImage(named: ""), for: .normal)
|
|
|
90
|
- obj.setImage(UIImage(named: ""), for: .selected)
|
106
|
+
|
|
|
107
|
+ let contactListButton: UIButton = {
|
|
|
108
|
+ let obj = UIButton()
|
|
|
109
|
+ obj.setImage(UIImage(named:"3Users"), for: .normal)
|
91
|
return obj
|
110
|
return obj
|
92
|
}()
|
111
|
}()
|
93
|
|
112
|
|
94
|
- var hiddenButton: UIButton = {
|
|
|
95
|
- var obj = UIButton()
|
113
|
+ var managerButton: SquereCheckbox = {
|
|
|
114
|
+ var obj = SquereCheckbox()
|
|
|
115
|
+ obj.checkboxTitle = "Manager"
|
|
|
116
|
+ return obj
|
|
|
117
|
+ }()
|
|
|
118
|
+
|
|
|
119
|
+ var hiddenButton: SquereCheckbox = {
|
|
|
120
|
+ var obj = SquereCheckbox()
|
|
|
121
|
+ obj.checkboxTitle = "Hidden"
|
96
|
return obj
|
122
|
return obj
|
97
|
}()
|
123
|
}()
|
98
|
|
124
|
|
|
@@ -118,7 +144,6 @@ class AddResidentsView: UIView { |
|
@@ -118,7 +144,6 @@ class AddResidentsView: UIView { |
118
|
obj.setTitle("Add resident", for: .normal)
|
144
|
obj.setTitle("Add resident", for: .normal)
|
119
|
obj.setTitleColor(UIColor(red: 1, green: 1, blue: 1, alpha: 1), for: .normal)
|
145
|
obj.setTitleColor(UIColor(red: 1, green: 1, blue: 1, alpha: 1), for: .normal)
|
120
|
obj.titleLabel?.font = .skModernist(type: .bold, ofSize: 16)
|
146
|
obj.titleLabel?.font = .skModernist(type: .bold, ofSize: 16)
|
121
|
- obj.setTitleColor(.cyan, for: .normal)
|
|
|
122
|
obj.clipsToBounds = true
|
147
|
obj.clipsToBounds = true
|
123
|
obj.layer.masksToBounds = true
|
148
|
obj.layer.masksToBounds = true
|
124
|
return obj
|
149
|
return obj
|
|
@@ -135,6 +160,7 @@ class AddResidentsView: UIView { |
|
@@ -135,6 +160,7 @@ class AddResidentsView: UIView { |
135
|
}
|
160
|
}
|
136
|
|
161
|
|
137
|
func layout() {
|
162
|
func layout() {
|
|
|
163
|
+ isUserInteractionEnabled = true
|
138
|
addResidentButton.layer.insertSublayer(gradientBG, at: 0)
|
164
|
addResidentButton.layer.insertSublayer(gradientBG, at: 0)
|
139
|
|
165
|
|
140
|
addSubview(transparentView)
|
166
|
addSubview(transparentView)
|
|
@@ -148,6 +174,8 @@ class AddResidentsView: UIView { |
|
@@ -148,6 +174,8 @@ class AddResidentsView: UIView { |
148
|
containerView.addSubview(nameTextField)
|
174
|
containerView.addSubview(nameTextField)
|
149
|
containerView.addSubview(mobileNumberLabel)
|
175
|
containerView.addSubview(mobileNumberLabel)
|
150
|
containerView.addSubview(mobileNumberTextField)
|
176
|
containerView.addSubview(mobileNumberTextField)
|
|
|
177
|
+ mobileNumberTextField.addSubview(contactListButton)
|
|
|
178
|
+
|
151
|
containerView.addSubview(managerButton)
|
179
|
containerView.addSubview(managerButton)
|
152
|
containerView.addSubview(hiddenButton)
|
180
|
containerView.addSubview(hiddenButton)
|
153
|
containerView.addSubview(heartButton)
|
181
|
containerView.addSubview(heartButton)
|
|
@@ -159,9 +187,7 @@ class AddResidentsView: UIView { |
|
@@ -159,9 +187,7 @@ class AddResidentsView: UIView { |
159
|
|
187
|
|
160
|
containerView.snp.makeConstraints {
|
188
|
containerView.snp.makeConstraints {
|
161
|
$0.leading.trailing.equalToSuperview().inset(25)
|
189
|
$0.leading.trailing.equalToSuperview().inset(25)
|
162
|
-// $0.top.equalToSuperview().offset(174)
|
|
|
163
|
-// $0.bottom.equalToSuperview().offset(-201)
|
|
|
164
|
- $0.centerY.equalToSuperview()
|
190
|
+ $0.centerY.equalTo(transparentView.snp.centerY)
|
165
|
}
|
191
|
}
|
166
|
|
192
|
|
167
|
addResidentLabeL.snp.makeConstraints {
|
193
|
addResidentLabeL.snp.makeConstraints {
|
|
@@ -184,7 +210,6 @@ class AddResidentsView: UIView { |
|
@@ -184,7 +210,6 @@ class AddResidentsView: UIView { |
184
|
residentNameLabel.snp.makeConstraints {
|
210
|
residentNameLabel.snp.makeConstraints {
|
185
|
$0.top.equalTo(dividingLineView.snp.bottom).offset(24)
|
211
|
$0.top.equalTo(dividingLineView.snp.bottom).offset(24)
|
186
|
$0.leading.equalToSuperview().offset(44)
|
212
|
$0.leading.equalToSuperview().offset(44)
|
187
|
-
|
|
|
188
|
}
|
213
|
}
|
189
|
|
214
|
|
190
|
nameTextField.snp.makeConstraints {
|
215
|
nameTextField.snp.makeConstraints {
|
|
@@ -196,7 +221,6 @@ class AddResidentsView: UIView { |
|
@@ -196,7 +221,6 @@ class AddResidentsView: UIView { |
196
|
mobileNumberLabel.snp.makeConstraints {
|
221
|
mobileNumberLabel.snp.makeConstraints {
|
197
|
$0.leading.equalTo(residentNameLabel.snp.leading)
|
222
|
$0.leading.equalTo(residentNameLabel.snp.leading)
|
198
|
$0.top.equalTo(nameTextField.snp.bottom).offset(15)
|
223
|
$0.top.equalTo(nameTextField.snp.bottom).offset(15)
|
199
|
-
|
|
|
200
|
}
|
224
|
}
|
201
|
|
225
|
|
202
|
mobileNumberTextField.snp.makeConstraints {
|
226
|
mobileNumberTextField.snp.makeConstraints {
|
|
@@ -205,14 +229,22 @@ class AddResidentsView: UIView { |
|
@@ -205,14 +229,22 @@ class AddResidentsView: UIView { |
205
|
$0.height.equalTo(47)
|
229
|
$0.height.equalTo(47)
|
206
|
}
|
230
|
}
|
207
|
|
231
|
|
|
|
232
|
+ contactListButton.snp.makeConstraints {
|
|
|
233
|
+ $0.height.width.equalTo(24)
|
|
|
234
|
+ $0.centerY.equalToSuperview()
|
|
|
235
|
+ $0.trailing.equalToSuperview().offset(-19)
|
|
|
236
|
+ }
|
|
|
237
|
+
|
208
|
managerButton.snp.makeConstraints {
|
238
|
managerButton.snp.makeConstraints {
|
209
|
$0.leading.equalToSuperview().offset(29)
|
239
|
$0.leading.equalToSuperview().offset(29)
|
210
|
$0.top.equalTo(mobileNumberTextField.snp.bottom).offset(30)
|
240
|
$0.top.equalTo(mobileNumberTextField.snp.bottom).offset(30)
|
|
|
241
|
+ $0.height.equalTo(20)
|
211
|
}
|
242
|
}
|
212
|
|
243
|
|
213
|
hiddenButton.snp.makeConstraints {
|
244
|
hiddenButton.snp.makeConstraints {
|
214
|
$0.top.equalTo(managerButton)
|
245
|
$0.top.equalTo(managerButton)
|
215
|
$0.leading.equalTo(managerButton.snp.trailing).offset(24)
|
246
|
$0.leading.equalTo(managerButton.snp.trailing).offset(24)
|
|
|
247
|
+ $0.height.equalTo(20)
|
216
|
}
|
248
|
}
|
217
|
|
249
|
|
218
|
heartButton.snp.makeConstraints {
|
250
|
heartButton.snp.makeConstraints {
|
|
@@ -223,7 +255,7 @@ class AddResidentsView: UIView { |
|
@@ -223,7 +255,7 @@ class AddResidentsView: UIView { |
223
|
addResidentButton.snp.makeConstraints {
|
255
|
addResidentButton.snp.makeConstraints {
|
224
|
$0.top.equalTo(managerButton.snp.bottom).offset(43)
|
256
|
$0.top.equalTo(managerButton.snp.bottom).offset(43)
|
225
|
$0.leading.trailing.bottom.equalToSuperview()
|
257
|
$0.leading.trailing.bottom.equalToSuperview()
|
226
|
- $0.height.equalTo(45)
|
258
|
+ $0.height.equalTo(64)
|
227
|
}
|
259
|
}
|
228
|
}
|
260
|
}
|
229
|
|
261
|
|
|
@@ -232,4 +264,8 @@ class AddResidentsView: UIView { |
|
@@ -232,4 +264,8 @@ class AddResidentsView: UIView { |
232
|
gradientBG.frame = addResidentButton.bounds
|
264
|
gradientBG.frame = addResidentButton.bounds
|
233
|
blurEffect.frame = transparentView.bounds
|
265
|
blurEffect.frame = transparentView.bounds
|
234
|
}
|
266
|
}
|
|
|
267
|
+
|
|
|
268
|
+ @objc func imageTapped() {
|
|
|
269
|
+ delegate?.viewDidTapImage()
|
|
|
270
|
+ }
|
235
|
} |
271
|
} |