diff --git a/Stored.xcodeproj/project.xcworkspace/xcuserdata/architmalik.xcuserdatad/UserInterfaceState.xcuserstate b/Stored.xcodeproj/project.xcworkspace/xcuserdata/architmalik.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..764bf38
Binary files /dev/null and b/Stored.xcodeproj/project.xcworkspace/xcuserdata/architmalik.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/Stored.xcodeproj/xcuserdata/architmalik.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Stored.xcodeproj/xcuserdata/architmalik.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
new file mode 100644
index 0000000..7d9edaa
--- /dev/null
+++ b/Stored.xcodeproj/xcuserdata/architmalik.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
diff --git a/Stored.xcodeproj/xcuserdata/architmalik.xcuserdatad/xcschemes/xcschememanagement.plist b/Stored.xcodeproj/xcuserdata/architmalik.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..d00bd57
--- /dev/null
+++ b/Stored.xcodeproj/xcuserdata/architmalik.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,14 @@
+
+
+
+
+ SchemeUserState
+
+ Stored.xcscheme_^#shared#^_
+
+ orderHint
+ 0
+
+
+
+
diff --git a/Stored/Assets.xcassets/bonn_bread_image.imageset/Contents.json b/Stored/Assets.xcassets/bonn_bread_image.imageset/Contents.json
new file mode 100644
index 0000000..73fdce7
--- /dev/null
+++ b/Stored/Assets.xcassets/bonn_bread_image.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "filename" : "tempImagesAWKnl 1.png",
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Stored/Assets.xcassets/bonn_bread_image.imageset/tempImagesAWKnl 1.png b/Stored/Assets.xcassets/bonn_bread_image.imageset/tempImagesAWKnl 1.png
new file mode 100644
index 0000000..08632c0
Binary files /dev/null and b/Stored/Assets.xcassets/bonn_bread_image.imageset/tempImagesAWKnl 1.png differ
diff --git a/Stored/Assets.xcassets/coca_cola_image.imageset/1l-coca-cola-cold-drink 1.png b/Stored/Assets.xcassets/coca_cola_image.imageset/1l-coca-cola-cold-drink 1.png
new file mode 100644
index 0000000..9c0658b
Binary files /dev/null and b/Stored/Assets.xcassets/coca_cola_image.imageset/1l-coca-cola-cold-drink 1.png differ
diff --git a/Stored/Assets.xcassets/coca_cola_image.imageset/Contents.json b/Stored/Assets.xcassets/coca_cola_image.imageset/Contents.json
new file mode 100644
index 0000000..4661bf7
--- /dev/null
+++ b/Stored/Assets.xcassets/coca_cola_image.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "filename" : "1l-coca-cola-cold-drink 1.png",
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Stored/Assets.xcassets/doritos_image.imageset/40201381_10-doritos-nacho-chips-nacho-cheese 1.png b/Stored/Assets.xcassets/doritos_image.imageset/40201381_10-doritos-nacho-chips-nacho-cheese 1.png
new file mode 100644
index 0000000..729f1aa
Binary files /dev/null and b/Stored/Assets.xcassets/doritos_image.imageset/40201381_10-doritos-nacho-chips-nacho-cheese 1.png differ
diff --git a/Stored/Assets.xcassets/doritos_image.imageset/Contents.json b/Stored/Assets.xcassets/doritos_image.imageset/Contents.json
new file mode 100644
index 0000000..830ad1d
--- /dev/null
+++ b/Stored/Assets.xcassets/doritos_image.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "filename" : "40201381_10-doritos-nacho-chips-nacho-cheese 1.png",
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Stored/Assets.xcassets/All.imageset/All.svg b/Stored/Assets.xcassets/img.imageset/All.svg
similarity index 100%
rename from Stored/Assets.xcassets/All.imageset/All.svg
rename to Stored/Assets.xcassets/img.imageset/All.svg
diff --git a/Stored/Assets.xcassets/All.imageset/Contents.json b/Stored/Assets.xcassets/img.imageset/Contents.json
similarity index 100%
rename from Stored/Assets.xcassets/All.imageset/Contents.json
rename to Stored/Assets.xcassets/img.imageset/Contents.json
diff --git a/Stored/Assets.xcassets/nutella_biscuits_image.imageset/Contents.json b/Stored/Assets.xcassets/nutella_biscuits_image.imageset/Contents.json
new file mode 100644
index 0000000..a3b5660
--- /dev/null
+++ b/Stored/Assets.xcassets/nutella_biscuits_image.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "filename" : "tempImageX15TNU 1.png",
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Stored/Assets.xcassets/nutella_biscuits_image.imageset/tempImageX15TNU 1.png b/Stored/Assets.xcassets/nutella_biscuits_image.imageset/tempImageX15TNU 1.png
new file mode 100644
index 0000000..3c6723a
Binary files /dev/null and b/Stored/Assets.xcassets/nutella_biscuits_image.imageset/tempImageX15TNU 1.png differ
diff --git a/Stored/Assets.xcassets/real_fruit_juice_image.imageset/Contents.json b/Stored/Assets.xcassets/real_fruit_juice_image.imageset/Contents.json
new file mode 100644
index 0000000..62b168e
--- /dev/null
+++ b/Stored/Assets.xcassets/real_fruit_juice_image.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "filename" : "tempImagelkcfCn 1.png",
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Stored/Assets.xcassets/real_fruit_juice_image.imageset/tempImagelkcfCn 1.png b/Stored/Assets.xcassets/real_fruit_juice_image.imageset/tempImagelkcfCn 1.png
new file mode 100644
index 0000000..de48e9c
Binary files /dev/null and b/Stored/Assets.xcassets/real_fruit_juice_image.imageset/tempImagelkcfCn 1.png differ
diff --git a/Stored/New Group/QItem.swift b/Stored/New Group/QItem.swift
new file mode 100644
index 0000000..4f2bcf3
--- /dev/null
+++ b/Stored/New Group/QItem.swift
@@ -0,0 +1,13 @@
+//
+// QuickAddItems.swift
+// Stored
+//
+// Created by Archit Malik on 25/04/24.
+//
+
+import UIKit
+
+struct QItem {
+ let name: String
+ let imageName: String
+}
diff --git a/Stored/QuickAddTableViewCell.swift b/Stored/QuickAddTableViewCell.swift
new file mode 100644
index 0000000..29b35db
--- /dev/null
+++ b/Stored/QuickAddTableViewCell.swift
@@ -0,0 +1,137 @@
+
+import UIKit
+
+class QuickAddTableViewCell: UITableViewCell {
+
+ @IBOutlet var itemImage: UIImageView!
+ @IBOutlet var itemNameLabel: UILabel!
+ @IBOutlet var itemAddButton: UIButton!
+
+ @IBOutlet var minusBtn:UIButton!
+
+ @IBOutlet var quantityLabel:UILabel!
+
+ @IBOutlet var quantAddBtn:UIButton!
+
+ @IBOutlet var extimateLabel:UILabel!
+
+ @IBOutlet weak var rulerView: UIView!
+
+ var isExpanded = false
+
+ var showQuantityButtons = false {
+ didSet {
+ minusBtn.isHidden = !showQuantityButtons
+ quantityLabel.isHidden = !showQuantityButtons
+ quantAddBtn.isHidden = !showQuantityButtons
+ extimateLabel.isHidden = !showQuantityButtons
+
+ // Adjust cell's height based on showQuantityButtons
+ if showQuantityButtons {
+
+ itemNameLabel.numberOfLines = 1 // Set to 1 line
+ } else {
+ itemNameLabel.numberOfLines = 0 // Allow multiple lines
+ }
+ }
+ }
+
+
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ self.layer.cornerRadius = 10
+ self.clipsToBounds = true
+ minusBtn.layer.cornerRadius = 10
+ quantAddBtn.layer.cornerRadius = 10
+ }
+
+
+ override func prepareForReuse() {
+ super.prepareForReuse()
+ isExpanded = false
+ rulerView.isHidden = false
+ updateUI()
+ }
+
+ @IBAction func addButtonTapped(_ sender: UIButton) {
+
+ guard sender == itemAddButton else { return }
+ isExpanded = true
+ updateUI()
+ }
+
+ // Action method for handling "-" button tap
+ @IBAction func minusButtonTapped(_ sender: UIButton) {
+ guard var quantity = Int(quantityLabel.text ?? "0") else { return }
+ quantity = max(0, quantity - 1)
+ quantityLabel.text = "\(quantity)"
+ }
+
+ // Action method for handling "+" button tap in quantity
+ @IBAction func addButtonQuantityTapped(_ sender: UIButton) {
+ guard var quantity = Int(quantityLabel.text ?? "0") else { return }
+ quantity += 1
+ quantityLabel.text = "\(quantity)"
+ }
+
+
+ override func setSelected(_ selected: Bool, animated: Bool) {
+ super.setSelected(selected, animated: animated)
+
+ // Configure the view for the selected state
+ if selected {
+ contentView.backgroundColor = .white // Set the background color to white
+ }
+ }
+
+ private func updateUI() {
+ let defaultBackgroundColor: UIColor = .white
+
+ // Set background color for the labels
+ let desiredColor = UIColor(red: 242/255, green: 242/255, blue: 247/255, alpha: 1.0) // F2F2F7
+
+ if isExpanded {
+ minusBtn.isHidden = false
+ quantityLabel.isHidden = false
+ quantAddBtn.isHidden = false
+ extimateLabel.isHidden = false
+ itemAddButton.setImage(UIImage(systemName: "checkmark.circle.fill"), for: .normal)
+ itemAddButton.tintColor = .green
+ minusBtn.backgroundColor = desiredColor
+ quantAddBtn.backgroundColor = desiredColor
+ quantityLabel.backgroundColor = desiredColor
+
+ let cornerRadius: CGFloat = 10
+ minusBtn.layer.cornerRadius = cornerRadius
+ quantAddBtn.layer.cornerRadius = cornerRadius
+
+ let minusMaskedCorners: CACornerMask = [.layerMinXMinYCorner, .layerMinXMaxYCorner]
+ let plusMaskedCorners: CACornerMask = [.layerMaxXMinYCorner, .layerMaxXMaxYCorner]
+
+ minusBtn.layer.maskedCorners = minusMaskedCorners
+ quantAddBtn.layer.maskedCorners = plusMaskedCorners
+ } else {
+ minusBtn.isHidden = true
+ quantityLabel.isHidden = true
+ quantAddBtn.isHidden = true
+ extimateLabel.isHidden = true
+ itemAddButton.setImage(UIImage(systemName: "plus.circle"), for: .normal)
+ itemAddButton.tintColor = .systemBlue
+ minusBtn.backgroundColor = defaultBackgroundColor
+ quantAddBtn.backgroundColor = defaultBackgroundColor
+ quantityLabel.backgroundColor = defaultBackgroundColor
+ }
+
+ for subview in subviews {
+ if let stackView = subview as? UIStackView {
+ stackView.backgroundColor = isExpanded ? desiredColor : defaultBackgroundColor
+ stackView.layer.cornerRadius = 0
+ }
+ if let label = subview as? UILabel, label == quantityLabel {
+ label.backgroundColor = isExpanded ? desiredColor : defaultBackgroundColor
+ }
+ }
+ }
+
+
+}
diff --git a/Stored/QuickAddViewController.swift b/Stored/QuickAddViewController.swift
new file mode 100644
index 0000000..2010fd3
--- /dev/null
+++ b/Stored/QuickAddViewController.swift
@@ -0,0 +1,145 @@
+import UIKit
+
+class QuickAddViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
+
+ let items: [QItem] = [
+ QItem(name: "Coca Cola", imageName: "coca_cola_image"),
+ QItem(name: "Bonn Bread", imageName: "bonn_bread_image"),
+ QItem(name: "Real Fruit Juice", imageName: "real_fruit_juice_image"),
+ QItem(name: "Doritos", imageName: "doritos_image"),
+ QItem(name: "Nutella Biscuits", imageName: "nutella_biscuits_image")
+ ]
+
+ @IBOutlet var quickAddTableView: UITableView!
+
+ @IBOutlet var popupView: UIView!
+
+ @IBOutlet weak var OkBtn: UIButton!
+
+ var isPopupVisible = false
+ var popupShown = false
+ var shouldPopUpShow = 0
+
+
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ let searchController = UISearchController(searchResultsController: nil)
+ self.navigationItem.searchController = searchController
+ quickAddTableView.dataSource = self
+ quickAddTableView.delegate = self
+ quickAddTableView.layer.cornerRadius = 10
+ quickAddTableView.clipsToBounds = true
+
+ popupView.isHidden = true
+ popupView.layer.cornerRadius = 10
+
+
+ // Add observer for cell height update
+ NotificationCenter.default.addObserver(self, selector: #selector(updateCellHeight), name: NSNotification.Name(rawValue: "UpdateCellHeight"), object: nil)
+
+
+ }
+
+ deinit {
+ // Remove observer
+ NotificationCenter.default.removeObserver(self)
+ }
+
+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ return items.count
+ }
+
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ let cell = tableView.dequeueReusableCell(withIdentifier: "QuickAddTableViewCell", for: indexPath) as! QuickAddTableViewCell
+ let item = items[indexPath.row]
+ cell.itemImage.image = UIImage(named: item.imageName)
+ cell.itemNameLabel.text = item.name
+
+ // Initially hide the "-" label and "+" button
+ cell.showQuantityButtons = false
+
+ // Set tags for buttons
+ cell.itemAddButton.tag = indexPath.row
+ cell.minusBtn.tag = indexPath.row
+ cell.quantAddBtn.tag = indexPath.row
+
+ return cell
+ }
+
+ @IBAction func rightEndTickButtonTapped(_ sender: UIButton) {
+ print(sender.currentImage!)
+ if let image = sender.currentImage {
+ if(image == UIImage(systemName: "plus.circle")) {
+ // isPopupVisible.toggle()
+ popupView.isHidden = !isPopupVisible
+
+ // If the pop-up view is visible, center it above the table
+ if isPopupVisible {
+ centerPopupView()
+ }
+
+ }
+ if(image == UIImage(systemName: "checkmark.circle.fill")) {
+ if(shouldPopUpShow == 0) { shouldPopUpShow = 1 }
+ else if shouldPopUpShow == 1 {
+ shouldPopUpShow = 0
+ isPopupVisible.toggle()
+
+ popupView.isHidden = !isPopupVisible
+
+ // If the pop-up view is visible, center it above the table
+ if isPopupVisible {
+ centerPopupView()
+ }
+ }
+ }
+ } else {
+ return
+ }
+
+
+ }
+
+ @IBAction func addButtonTapped(_ sender: UIButton) {
+ guard sender.currentImage == UIImage(systemName: "plus.circle") else {
+ return // If the button is not a plus circle, return without further action
+ }
+
+ // Call the method only when the button is a plus circle
+ rightEndTickButtonTapped(sender)
+ }
+
+
+ @IBAction func okTapped(_ sender: Any) {
+
+ popupView.isHidden = true
+
+
+ isPopupVisible = false
+ }
+
+ private func centerPopupView() {
+ guard let tableViewSuperview = quickAddTableView.superview else { return }
+
+ let tableCenterX = tableViewSuperview.bounds.midX
+ let tableCenterY = tableViewSuperview.bounds.midY
+ let popupWidth = popupView.bounds.width
+ let popupHeight = popupView.bounds.height
+ let popupX = tableCenterX - (popupWidth / 2)
+ let popupY = tableCenterY - (popupHeight / 2)
+
+ popupView.frame = CGRect(x: popupX, y: popupY, width: popupWidth, height: popupHeight)
+ }
+ // Action method for handling "+" button tap
+ @objc func updateCellHeight() {
+ DispatchQueue.main.async {
+ self.quickAddTableView.beginUpdates()
+ self.quickAddTableView.endUpdates()
+ }
+ }
+
+
+
+
+}
diff --git a/file.txt b/file.txt
new file mode 100644
index 0000000..e69de29