Blame view

App/createNew/VCRootCreateNew.swift 1.68 KB
d774f0637   Trịnh Văn Quân   fisrt comit
1
2
  import UIKit
  import Foundation
defd9642e   Trịnh Văn Quân   version 1.2
3
4
  import GeneralUtils
  import Alamofire
d774f0637   Trịnh Văn Quân   fisrt comit
5
6
7
  
  class VCRootCreateNew: VCContainerFullScreen {
      var tenCty: String?, tenCtruong: String?
1341bf603   Trịnh Văn Quân   version 1.1
8
      var mucChups: [ShootItem]?
defd9642e   Trịnh Văn Quân   version 1.2
9
      var signboard: Int = 1
d774f0637   Trịnh Văn Quân   fisrt comit
10
11
12
13
14
15
16
17
18
19
  
      static func openController(_ viewController: UIViewController) {
          let vcOpen = VCRootCreateNew()
          viewController.present(vcOpen, animated: true, completion: nil)
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
          changeCurrentController(VCNhapTenCty.getInstance())
      }
1341bf603   Trịnh Văn Quân   version 1.1
20

defd9642e   Trịnh Văn Quân   version 1.2
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
      func createNewToServer() {
          var ShootingItem = [Any]()
          if let mucChups = mucChups {
              for item in mucChups {
                  if let name = item.name {
                      ShootingItem.append(["name": name, "willShoot": (item.willShoot == 1)])
                  }
              }
          }
          let parameters: Parameters = [
                  "idWorker": getIDWork(),
                  "signboard": signboard == 1,
                  "companyName": tenCty ?? "",
                  "constructionName": tenCtruong ?? "",
                  "ShootingItem": ShootingItem
          ]
          NetWorkUtils.excutePostTypeRawJSONEncoding(parameters: parameters, url: Constants.PathManager.ROOT_SERVER + "api/regulations/store",
                  isShowProgress: true, vc: self, responseStringParam: { response in
              if response.result.isSuccess {
                  CommonUtils.showToastLong(text: LocalizedString("successful"))
                  self.dismiss(animated: true)
              } else {
                  DialogUtils.builderDialog(showCloseButton: true, showTitle: false).showError("", subTitle: LocalizedString("Has_Error_occurred"))
              }
          })
      }
d774f0637   Trịnh Văn Quân   fisrt comit
47
  }