Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "3F78EA44-1199-4BC7-ACD5-A0538F379950"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "FFC28917-3413-4858-91D7-7EB5585C4C47"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Stored/InventoryTableViewCell.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "17"
endingLineNumber = "17">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Stored.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
21 changes: 21 additions & 0 deletions Stored/Assets.xcassets/bonn_bread_image.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Stored/Assets.xcassets/coca_cola_image.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Stored/Assets.xcassets/doritos_image.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions Stored/New Group/QItem.swift
Original file line number Diff line number Diff line change
@@ -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
}
137 changes: 137 additions & 0 deletions Stored/QuickAddTableViewCell.swift
Original file line number Diff line number Diff line change
@@ -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
}
}
}


}
Loading