From 29d09a915e78a8413b70dee50c3291d93f3617d6 Mon Sep 17 00:00:00 2001 From: wmanintu Date: Mon, 22 Feb 2016 23:40:50 +0700 Subject: [PATCH 1/4] Added files via upload Hello, this is Wut Manintu. --- WutManintu_BookStore.zip | Bin 0 -> 4118 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 WutManintu_BookStore.zip diff --git a/WutManintu_BookStore.zip b/WutManintu_BookStore.zip new file mode 100644 index 0000000000000000000000000000000000000000..51634e14e108b0149ad0e1e1ede31b3755e20e46 GIT binary patch literal 4118 zcma)92|QG5AD*#fD@zDjr%|#rc9Rx{u``UyzGcZeX2_6zUq)rkQkF=>P#Ba*V`*}2 zgODuAn#z{t3PnE4?WVr#e&3njIcMhgoAaFa|NNi#eV+%ZO-V%$*gjU`4K;SY{B>am zFawM{u?TCl6B_GjrHsM2T*P9oUJ*AiJ_sN)wi*IwS`3$gYyjjI1RH>M>rtv4Widq*V?DUD zXwG=qN?Cl=f>si&vcZ`jbvUZK$Ygjcr@~E9Zr1CP5ytnXjY`Bw!)|Wx*S;xQ%Wg7& z0y%Gtd-BXPQnfOccuh}5E^EW)vm)}*sC%MAZ>wo(3G8}EZ5mo<0M4~+i#94wzz!R` zgzDA&$_CvQ8&*~bCAi*2;~f%HPPZCvpFc?a=f}25{QI$e8}d8WKQ~19e_}zb_U(=B zWp-PK%Qlzi5juwROoljQFhx8kr4TbWkig9xw#p7`0~mqof+x$YI%XXdIe{n`O)y8l`nTa2aB+_#% zRC}jJ)#=p_kMwzV=V+LphQ6S2PF*asJOwo`ww0ZK6!pb2JI>6EjoMet7x_IVP)lz&dFFp0xgK&tgBWXs#aCM&qocX-r!HY5w!Nk8v4N0Jwom!kP`G*J+jrf zba-}vq|^&70jqpSLD&zi61pqDQWiOoOECegN5`$9_6Bx7eYI3P3oI#85j*e?V(ycXytN5$R}F@8S%|JpEA~s)7y;^)s(Fc z366sIeku@SBvSNoaY^F>UKaJI&DKlsaLFxj<->ZAx3!fI%T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!KO@{Mc1u^0WLI5Wr(stkR`N>d}A&no0$E9S9IP9#1b*+HlEy<9YzGbn{3F~%Nk^^cjvn@7Yd;lVTdpWKz zRR0Q-3ENxu+^NttC`JpWeZ_2o@6%HljsZ5Knnn<7(wOJBtn@q4EFX_bU^G%F>LAlq zcKYQ6=%>7=U4&nXJacN?;j!Owi&@?(g=txBPbj_9ssf+OpiJhB?^WLbFA9FMSa_V+ zDUB2$_rX`v0C_NcpPe7{Mp{~yPC5(B;4;l;b9uy6JN`s&SE1L_;D;kLtvIT?;I)n%^;_~3r zj|;@4PDo%tkMjkX5J>w`tJ6DmKsVnnrbz{unSI> zTDs2mTF#c5_NMmE2>^Iaa1s&R+0!;bI-K2L6Of-nnwaTHw28M^pg4AC%~w<7*h?fqMDb`IFA()N8H z7f<_ltlEY9>EZVV3_ie5xZDuM$^--7((V z=KJ3u_6}`B3AYzw-;#d>m)}d?n;L|FDY@r=;{Fn1ey@I))$RDPcLnAD Date: Tue, 23 Feb 2016 12:46:43 +0700 Subject: [PATCH 2/4] Answer unzip Wut Manintu's answer unzip --- index.html | 218 +++++++++++++++++++++++++++++++++++++++++++++++++++++ style.css | 60 +++++++++++++++ 2 files changed, 278 insertions(+) create mode 100644 index.html create mode 100644 style.css diff --git a/index.html b/index.html new file mode 100644 index 00000000..cd470b6b --- /dev/null +++ b/index.html @@ -0,0 +1,218 @@ + + + + + บ้านนายดิน + + + + +

บ้านนายดิน

+ +
+ + +
+
+ +
+

Catalog

+
+
    +
  • Harry Potter and the Philosopher's Stone (Book 1)

    Add to Cart
  • +
  • Harry Potter and the Chamber of Secrets (Book 2)

    Add to Cart
  • +
  • Harry Potter and the Prisoner of Azkaban (Book 3)

    Add to Cart
  • +
  • Harry Potter and the Goblet of Fire (Book 4)

    Add to Cart
  • +
  • Harry Potter and the Order of the Phoenix (Book 5)

    Add to Cart
  • +
  • Harry Potter and the Half-blood Prince: Children's Edition (Harry Potter 6)

    Add to Cart
  • +
  • Harry Potter and the Deathly Hallows (Book 7) [Children's Edition]

    Add to Cart
  • +
  • Barry Loser Hates Half Term

    Add to Cart
  • +
+
+
+

Shopping Cart

+
+
+ +
    +
+
ราคารวม: บาท
+
ส่วนลด: บาท
+
รวมสุทธ: บาท
+
+
+ +
+
+
+
+ + +
+ +
+ +
+ + +
+ + diff --git a/style.css b/style.css new file mode 100644 index 00000000..0341ec22 --- /dev/null +++ b/style.css @@ -0,0 +1,60 @@ +@import url('http://fonts.googleapis.com/css?family=Neuton'); +li { + list-style: none; /* Remove list bullets */ + padding: 0; + margin: 0; +} +h1 { + font-size: 95px; + text-align: center; + color: black; +} +body { + font-family: 'Work Sans', sans-serif; +} +#catalog, #cart { + display: table-cell +} +hr { + border: 1px dotted #000000; + border-style: none none dotted; + color: #fff; + background-color: #fff; + width: 98%; +} +div { + max-width: 500px; + padding: 1%; + width: 500px; +} +#catalog { + position: absolute; + right: 50%; +/* background: #ee3e64;*/ +} + +#cart { + position: absolute; + left: 50%; +/* background: #b7d84b;*/ +} +.book { + background-color: #4CAF50; /* Green */ + border: none; + color: white; + padding: 15px 32px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; +} +#clear-cart { + background-color: #4D90FE; /* Green */ + border: none; + color: white; + padding: 15px 32px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; +} From d590242835c56e8c3ca7496a4c6fa2d9f7a44f32 Mon Sep 17 00:00:00 2001 From: wmanintu Date: Tue, 23 Feb 2016 12:48:01 +0700 Subject: [PATCH 3/4] Delete WutManintu_BookStore.zip --- WutManintu_BookStore.zip | Bin 4118 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 WutManintu_BookStore.zip diff --git a/WutManintu_BookStore.zip b/WutManintu_BookStore.zip deleted file mode 100644 index 51634e14e108b0149ad0e1e1ede31b3755e20e46..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4118 zcma)92|QG5AD*#fD@zDjr%|#rc9Rx{u``UyzGcZeX2_6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Ds2mTF#c5_NMmE2>^Iaa1s&R+0!;bI-K2L6Of-nnwaTHw28M^pg4AC%~w<7*h?fqMDb`IFA()N8H z7f<_ltlEY9>EZVV3_ie5xZDuM$^--7((V z=KJ3u_6}`B3AYzw-;#d>m)}d?n;L|FDY@r=;{Fn1ey@I))$RDPcLnAD Date: Sat, 27 Feb 2016 08:22:32 +0700 Subject: [PATCH 4/4] Added files via upload Hello, This is Wut Manintu, and I integrated AngularJS with my website. --- app.js | 156 ++++++++++++++++++++++++++++++ index.html | 274 ++++++++++++++--------------------------------------- style.css | 71 +++++++------- 3 files changed, 259 insertions(+), 242 deletions(-) create mode 100644 app.js diff --git a/app.js b/app.js new file mode 100644 index 00000000..349acec9 --- /dev/null +++ b/app.js @@ -0,0 +1,156 @@ +(function(){ + var app = angular.module('store', []); + app.controller('StoreController', ['$scope',function($scope){ + $scope.products = books; + $scope.cart = []; + $scope.total = 0; + $scope.promoItemQuantity = 0; + $scope.promoItemTotalPrice = 0; + $scope.discountPercent = 0; + $scope.discountReduction = 0; + $scope.subtotal = 0; + $scope.groupPromoQuantity = 0; + $scope.tempTotal = 0; + $scope.lowest = 0; + $scope.tmp; + $scope.cartsize = 0; + $scope.addItemToCart = function(product){ + if ($scope.cart.length === 0){ + product.count = 1; + $scope.cart.push(product); + } else { + var repeat = false; + for(var i = 0; i< $scope.cart.length; i++){ + if($scope.cart[i].id === product.id){ + repeat = true; + $scope.cart[i].count +=1; + } + } + if (!repeat) { + product.count = 1; + $scope.cart.push(product); + } + } + $scope.lowest = $scope.findLowestPromoIndex(); + $scope.discountPercent = $scope.readDiscount(); + $scope.subtotal += parseFloat(product.price); + /* + console.log("$scope.discountPercent: "+$scope.discountPercent); + console.log("$scope.groupPromoQuantityTotalPrice: "+ $scope.groupPromoQuantityTotalPrice); + console.log("$scope.promoItemTotalPrice: "+$scope.promoItemTotalPrice); + console.log("$scope.promoItemQuantity: "+$scope.promoItemQuantity); + */ + $scope.calculateTotal(); + }; + /*this function capture the minimum count of eatch item in the cart. And + use this value to multiplay with promoItemQuantity*/ + $scope.findLowestPromoIndex = function(){ + this.min = Number.POSITIVE_INFINITY; + for(var i = 0; i< $scope.cart.length; i++) + { + if($scope.cart[i].id <= 7) + { + if($scope.cart.length >= 1) + { + if($scope.cart[i].count <= this.min) + { + this.min = $scope.cart[i].count; + } + } + } + } + if(this.min === Infinity){ //if the first item in the cart isn't a promotion + return 0; + } + else + return this.min; + }; + /*read the cart and return discount percent, and it also calculate the + group promotion quantity total price*/ + $scope.readDiscount = function(){ + this.discount = 0; + this.promoItemQuantity = 0; + $scope.promoItemTotalPrice = 0; + for(var i = 0; i < $scope.cart.length; i++){ + if($scope.cart[i].id === 001 || $scope.cart[i].id === 002 || + $scope.cart[i].id === 003 || $scope.cart[i].id === 004 || + $scope.cart[i].id === 005 || $scope.cart[i].id === 006 || + $scope.cart[i].id === 007){ + $scope.promoItemQuantity++; + $scope.promoItemTotalPrice += $scope.cart[i].price; + } + } + if(this.promoItemQuantity === 2){ + this.discount = .10; + } + if(this.promoItemQuantity === 3){ + this.discount = .20; + } + if(this.promoItemQuantity === 4){ + this.discount = .30; + } + if(this.promoItemQuantity === 5){ + this.discount = .40; + } + if(this.promoItemQuantity === 6){ + this.discount = .50; + } + if(this.promoItemQuantity === 7){ + this.discount = .60; + } + $scope.groupPromoQuantityTotalPrice = $scope.lowest * $scope.promoItemTotalPrice; + return this.discount; + }; + $scope.calculateTotal = function(){ + //if theres a discount + $scope.discountReduction = $scope.groupPromoQuantityTotalPrice * $scope.discountPercent + if($scope.discountPercent != 0){ + $scope.total = $scope.subtotal - $scope.discountReduction; + } + else{ + $scope.total = $scope.subtotal; + } + }; + }]); + var books = [{ + id: 1, + name: 'Harry Potter and the Philosopher Stone', + price: 100.00 + + },{ + id: 2, + name: 'Harry Potter and the Chamber of Secrets', + price: 100.00 + }, + { + id: 3, + name: 'Harry Potter and the Prisoner of Azkaban', + price: 100.00 + }, + { + id: 4, + name: 'Harry Potter and the Goblet of Fire', + price: 100.00 + }, + { + id: 5, + name: 'Harry Potter and the Order of the Phoenix', + price: 100.00 + }, + { + id: 6, + name: 'Harry Potter and the Half-Blood Prince', + price: 100.00 + }, + { + id: 7, + name: 'Harry Potter and the Deathly Hallows', + price: 100.00 + }, + { + id: 8, + name: 'Lord of the Flies', + price: 100.00 + }]; + + })(); diff --git a/index.html b/index.html index cd470b6b..80f70046 100644 --- a/index.html +++ b/index.html @@ -1,218 +1,82 @@ - - + + - + บ้านนายดิน - + + -

บ้านนายดิน

- -
- - -
-
- -
-

Catalog

-
-
    -
  • Harry Potter and the Philosopher's Stone (Book 1)

    Add to Cart
  • -
  • Harry Potter and the Chamber of Secrets (Book 2)

    Add to Cart
  • -
  • Harry Potter and the Prisoner of Azkaban (Book 3)

    Add to Cart
  • -
  • Harry Potter and the Goblet of Fire (Book 4)

    Add to Cart
  • -
  • Harry Potter and the Order of the Phoenix (Book 5)

    Add to Cart
  • -
  • Harry Potter and the Half-blood Prince: Children's Edition (Harry Potter 6)

    Add to Cart
  • -
  • Harry Potter and the Deathly Hallows (Book 7) [Children's Edition]

    Add to Cart
  • -
  • Barry Loser Hates Half Term

    Add to Cart
  • +
    +
    +

    บ้านนายดิน

    +
    +
      +
    • + + + + + + + + + +

      Catalog

      {{product.name}}{{product.price | currency:"฿ "}}
      +
    -
    -

    Shopping Cart

    -
    -
    - -
      -
    -
    ราคารวม: บาท
    -
    ส่วนลด: บาท
    -
    รวมสุทธ: บาท
    -
    -
    - -
    +
    +
      +
    • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

      Shopping Cart

      ProductQuantityPrice
      {{c.name}}{{c.count}}{{c.price*c.count | currency:"฿ "}}
      Subtotal{{subtotal | currency:"฿ "}}
      Discount{{discountReduction | currency:"฿ "}}
      Total{{total | currency:"฿ "}}
      +
    • +
    - - -
    - -
    - + + diff --git a/style.css b/style.css index 0341ec22..ec552030 100644 --- a/style.css +++ b/style.css @@ -1,60 +1,57 @@ @import url('http://fonts.googleapis.com/css?family=Neuton'); +html { + color: #555; + /*background-color: #E3B736;*/ +} +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; +} li { list-style: none; /* Remove list bullets */ - padding: 0; - margin: 0; + padding-left: 0; + background: white; } h1 { - font-size: 95px; + color: #111; + font-size: 75px; + font-weight: bold; + letter-spacing: -1px; + line-height: 1; text-align: center; - color: black; } -body { - font-family: 'Work Sans', sans-serif; -} -#catalog, #cart { +.catalog-1, .shopping-cart-1 { display: table-cell } + hr { border: 1px dotted #000000; border-style: none none dotted; color: #fff; background-color: #fff; - width: 98%; + width: 98.0%; } -div { - max-width: 500px; - padding: 1%; - width: 500px; -} -#catalog { +.catalog-1 { position: absolute; right: 50%; -/* background: #ee3e64;*/ + /*background: #ee3e64;*/ } -#cart { +.shopping-cart-1 { position: absolute; left: 50%; -/* background: #b7d84b;*/ + /*background: #b7d84b;*/ } -.book { - background-color: #4CAF50; /* Green */ - border: none; - color: white; - padding: 15px 32px; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 16px; -} -#clear-cart { - background-color: #4D90FE; /* Green */ - border: none; - color: white; - padding: 15px 32px; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 16px; +table { + border-collapse: collapse; +} +th, +td { + border: 0px solid #cecfd5; + padding: 10px 15px; +} +footer { + width: 100%; + background: #222; + padding: 60px 0px; }