From cf77cd71f04fe3669882bd0a025668bfaac5ca28 Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Sat, 10 Aug 2024 04:50:09 +0000 Subject: [PATCH 01/20] Added to Author --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ae0c24c98f4..066a9b4eb41 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,9 @@ No known bugs at this time. Alexa Orrico - [Github](https://github.com/alexaorrico) / [Twitter](https://twitter.com/alexa_orrico) Jennifer Huang - [Github](https://github.com/jhuang10123) / [Twitter](https://twitter.com/earthtojhuang) Jhoan Zamora - [Github](https://github.com/jzamora5) / [Twitter](https://twitter.com/JhoanZamora10) -David Ovalle - [Github](https://github.com/Nukemenonai) / [Twitter](https://twitter.com/disartDave) +David Ovalle - [Github](https://github.com/Nukemenonai) / [Twitter](https://twitter.com/disartDave) +Emmanuel Sekyi - [Github] (https://github.com/Esekyi) + Second part of Airbnb: Joann Vuong ## License From 31064006be9bbbf152aa7ca08307776724081165 Mon Sep 17 00:00:00 2001 From: Emmanuel Sekyi <52067244+Esekyi@users.noreply.github.com> Date: Sat, 10 Aug 2024 04:53:03 +0000 Subject: [PATCH 02/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 066a9b4eb41..49825a0e031 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ Alexa Orrico - [Github](https://github.com/alexaorrico) / [Twitter](https://twit Jennifer Huang - [Github](https://github.com/jhuang10123) / [Twitter](https://twitter.com/earthtojhuang) Jhoan Zamora - [Github](https://github.com/jzamora5) / [Twitter](https://twitter.com/JhoanZamora10) David Ovalle - [Github](https://github.com/Nukemenonai) / [Twitter](https://twitter.com/disartDave) -Emmanuel Sekyi - [Github] (https://github.com/Esekyi) +Emmanuel Sekyi - [Github](https://github.com/Esekyi) Second part of Airbnb: Joann Vuong From 73b2d42f743a12fa7e2332ced5ab95361e10a9fa Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Sat, 10 Aug 2024 14:10:38 +0000 Subject: [PATCH 03/20] 1. Cash Only --- .gitignore | 2 + AUTHORS | 1 + web_dynamic/0-hbnb.py | 47 ++++++++ web_dynamic/__init__.py | 0 web_dynamic/static/images/icon.png | Bin 0 -> 2962 bytes web_dynamic/static/images/icon_bath.png | Bin 0 -> 704 bytes web_dynamic/static/images/icon_bed.png | Bin 0 -> 447 bytes web_dynamic/static/images/icon_group.png | Bin 0 -> 1051 bytes web_dynamic/static/images/logo.png | Bin 0 -> 9876 bytes web_dynamic/static/styles/3-footer.css | 16 +++ web_dynamic/static/styles/3-header.css | 11 ++ web_dynamic/static/styles/4-common.css | 11 ++ web_dynamic/static/styles/6-filters.css | 103 +++++++++++++++++ web_dynamic/static/styles/8-places.css | 101 +++++++++++++++++ web_dynamic/static/styles/w3c_validator.py | 123 +++++++++++++++++++++ web_dynamic/templates/0-hbnb.html | 78 +++++++++++++ 16 files changed, 493 insertions(+) create mode 100644 .gitignore create mode 100755 web_dynamic/0-hbnb.py create mode 100755 web_dynamic/__init__.py create mode 100644 web_dynamic/static/images/icon.png create mode 100644 web_dynamic/static/images/icon_bath.png create mode 100644 web_dynamic/static/images/icon_bed.png create mode 100644 web_dynamic/static/images/icon_group.png create mode 100644 web_dynamic/static/images/logo.png create mode 100644 web_dynamic/static/styles/3-footer.css create mode 100644 web_dynamic/static/styles/3-header.css create mode 100644 web_dynamic/static/styles/4-common.css create mode 100644 web_dynamic/static/styles/6-filters.css create mode 100644 web_dynamic/static/styles/8-places.css create mode 100755 web_dynamic/static/styles/w3c_validator.py create mode 100644 web_dynamic/templates/0-hbnb.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..808386fd8a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.venv/ +__pycache__/ \ No newline at end of file diff --git a/AUTHORS b/AUTHORS index 64b26acdc14..d6cd7982d89 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,3 +4,4 @@ Jennifer Huang <133@holbertonschool.com> Alexa Orrico <210@holbertonschool.com> Joann Vuong <130@holbertonschool.com> +Emmanuel Sekyi diff --git a/web_dynamic/0-hbnb.py b/web_dynamic/0-hbnb.py new file mode 100755 index 00000000000..acbdf35c63d --- /dev/null +++ b/web_dynamic/0-hbnb.py @@ -0,0 +1,47 @@ +#!/usr/bin/python3 +""" Starts a Flash Web Application """ +from models import storage +from models.state import State +from models.city import City +from models.amenity import Amenity +from models.place import Place +from os import environ +from flask import Flask, render_template +import uuid +app = Flask(__name__) +# app.jinja_env.trim_blocks = True +# app.jinja_env.lstrip_blocks = True + + +@app.teardown_appcontext +def close_db(error): + """ Remove the current SQLAlchemy Session """ + storage.close() + + +@app.route('/0-hbnb', strict_slashes=False) +def hbnb(): + """ HBNB is alive! """ + states = storage.all(State).values() + states = sorted(states, key=lambda k: k.name) + st_ct = [] + + for state in states: + st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) + + amenities = storage.all(Amenity).values() + amenities = sorted(amenities, key=lambda k: k.name) + + places = storage.all(Place).values() + places = sorted(places, key=lambda k: k.name) + + return render_template('0-hbnb.html', + cache_id=uuid.uuid4(), + states=st_ct, + amenities=amenities, + places=places) + + +if __name__ == "__main__": + """ Main Function """ + app.run(host='0.0.0.0', port=5000) diff --git a/web_dynamic/__init__.py b/web_dynamic/__init__.py new file mode 100755 index 00000000000..e69de29bb2d diff --git a/web_dynamic/static/images/icon.png b/web_dynamic/static/images/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..93492bb8df2ec8408a935db7d4352e70e297d48d GIT binary patch literal 2962 zcmaJ@dpy(YAOE^bDo5^=HRNtH%#4L>bIFih@PDUw@9?C7LK45=KA zNx776q!JD}P_xtmCKA-m=PllI=^A;OPQ zm+TwJ3dFf12{eise#6I%O`(g>0AOd&rsD}wBo-))6hWqBs89UCbkppaO25StQBWg^)q@E2aBXun~GfI(keSWzhO zKS>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>q?X*Gd~%aczPdT{(iR&6=T8 zV9ZoWhyMcw=P+X5ewIsXWIyNUK7O4XhSCb88|pRlu3dX@oy#48VN1Fv79u!0eFD&h zq@<)+Nl8gNU(g+_k(E=`(ls_UvvG9s4+snii-}K4PRS{+sH|>kZta*d zb^5Hi%T}!2uxZzxeMgUB_uttD3|2-1PZ!4!kK=EzMEf6d z5MX_<`NFNF>}b(ImcWUtRxDUiq0Myf64zg@7xpEqNdy0}VK@7U`tS21i8(3ekx#7LRz)t6QhuZvYoqq(ZPJWeo{wbL zESc!_=-iIXBXixXdh-l+?sMFJ(Npp3leugCmHBqA^*EAv+fU7J_sqjOf%_PaZ8|Of UVsdFeFj^QqUHx3vIVCg!0N#=_Pyhe` literal 0 HcmV?d00001 diff --git a/web_dynamic/static/images/icon_bed.png b/web_dynamic/static/images/icon_bed.png new file mode 100644 index 0000000000000000000000000000000000000000..2a63284877067dcb61b769fd59e8ee373587b0be GIT binary patch literal 447 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=3?wxlRx|^t$pJngu0XnMkb%!ndUAozGAIf1 z3ua(sX64}I;^CE*Q#3F%wXpN{i-=9nD6gz;XziFdWA5TjTelxSb?*G-JNG_+|M~mx zviF&$K)tIyT^vI^j=#O^&UeT_#Pwo+)q9mM_a;x+{r{?=!!(C77B>!oQ*-yt>6GnW zvb0u7U+vo+51u1=EDhnF`&QiX_{);$Z#jXF;fza^;C9#FjyJu$eswQfV=yaSXUXd8 zOV{`w(o3GyDaWjxm?#vV?{2*?Yr?E~e^`u+I&Q^G-!Q>}@0sHBZ48dCLMLt(OVPgg&ebxsLQ E03-gv2mk;8 literal 0 HcmV?d00001 diff --git a/web_dynamic/static/images/icon_group.png b/web_dynamic/static/images/icon_group.png new file mode 100644 index 0000000000000000000000000000000000000000..3e012ab4d5cdc2146782461b475b2a81ce0fea4d GIT binary patch literal 1051 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=3?wxlRx~p(FqQ=Pgt!8^Wut(;A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zG|r@A0>dJd+*?&BN+y z&L=xzr$JO&Eu=D>KzjsM*d>odr7MmB{z(S~;&KYKii2K#hw3@RoY2rvH&$5>fEj^i z8|2^H%FM!pMEseLaW(}DW1ou6HW%F4>>=PnhM z&)Lu5_-JT|QQ+v7Q`}m{h-ECldHsfAX6!g8(_t-X-IkkcAUu<*3S7QL}O9GcV6!K@ZgeQ_F8K?G?+3lhvc*W zH2m)ClKEJg^+_$HRGW0rCj_ej$=~az7jIvL?}N+RGt|T)%l6#x}?n7h^wgxWk}s$!loc7caoRiwp7TgH(-Q`Ob33ybmILXlbWxz)h#UqAm5( zq>pZI8Sk07m9?)0AltyNV|hY88!+{r6$k@4Jm@0?l|CcM)G$szjGk|%jCyEW-ue<7 zX*LrdALvldTi1s|{?;8;Ol-FMqm+h*hAgKal=o`o(t$#$nVFCHDTbVRPky*{aHz|G z%A4&hF5AiOT%l4DxsLrj9~yLG{u^9qWok?WRD4z{ZtgoZf@Cn{)%u_YP<{^@HUrT0 zUv4J9{`^D-QW$M>JLbk>#mNFpC2Z-_R|R0&jI>4EQV3ioF73au^zb!pJ zHCmR*2heE5FR`#Ygeiv{mkJ<4uO4(@8r+>1qT5usfH%(BvBMm(^zv7?87n3PHDU~O zbOWg7R>aS=`GK9-T^u{WH>yoK$_mS}O@H)W$%$a{X3BnhxCN_jX^{eI7eLl4;*aJe zxKe?GGl#S&b+^@g)`t&OjBrLPFh*2G9ZteiaZ@f(gCS1YgaCqU@0)qFtN_F5)_|xr z{WB}|J>c0ke0+OL&<@aHvn7U*_w4HJ$4fN;1^|a9@@e^3ZS3Fg#AGBDC8|Ce1^*w{ C(Z%)v literal 0 HcmV?d00001 diff --git a/web_dynamic/static/styles/3-footer.css b/web_dynamic/static/styles/3-footer.css new file mode 100644 index 00000000000..2cd4ff05d90 --- /dev/null +++ b/web_dynamic/static/styles/3-footer.css @@ -0,0 +1,16 @@ +footer { + position: fixed; + background: white; + height: 60px; + width: 100%; + bottom: 0; + border-top: 1px solid #CCCCCC; +} +footer p { + position: absolute; + text-align: center; + top: 10%; + bottom: 0; + right: 0; + left: 0; +} diff --git a/web_dynamic/static/styles/3-header.css b/web_dynamic/static/styles/3-header.css new file mode 100644 index 00000000000..245cac7c980 --- /dev/null +++ b/web_dynamic/static/styles/3-header.css @@ -0,0 +1,11 @@ +header { + background: white; + height: 70px; + width: 100%; + border-bottom: 1px solid #CCCCCC; +} +header .logo { + background: url("../images/logo.png") no-repeat; + left: 20px; + height: 100%; +} diff --git a/web_dynamic/static/styles/4-common.css b/web_dynamic/static/styles/4-common.css new file mode 100644 index 00000000000..46cfc19d1c1 --- /dev/null +++ b/web_dynamic/static/styles/4-common.css @@ -0,0 +1,11 @@ +body { + margin: 0; + padding: 0; + color: #484848; + font-size: 14px; + font-family: Circular,"Helvetica Neue",Helvetica,Arial,sans-serif; +} +body .container { + max-width: 1000px; + margin: 30px auto; +} diff --git a/web_dynamic/static/styles/6-filters.css b/web_dynamic/static/styles/6-filters.css new file mode 100644 index 00000000000..d47107732aa --- /dev/null +++ b/web_dynamic/static/styles/6-filters.css @@ -0,0 +1,103 @@ +.container .filters { + position: relative; + background: white; + height: 70px; + width: 100%; + border: 1px solid #DDDDDD; + border-radius: 4px; +} +button { + position: absolute; + font-size: 18px; + background: #FF5A5F; + color: #FFFFFF; + height: 48px; + width: 20%; + border-style: none; + border-radius: 4px; + top: 15%; + right: 30px; +} +button:hover { + opacity: 0.9; +} +.filters div { + display: inline-grid; +} +.filters h2 { + margin-left: 15%; + margin-top: 0; + margin-bottom: 0; + font-weight: 600; +} +.filters h3 { + margin-left: 15%; + margin-bottom: 0; + font-weight: 600; +} +.filters h4 { + margin-left: 15%; + margin-top: 0; + font-weight: 400; + font-size: 14px; +} +.locations { + height: 100%; + width: 25%; + border-right: 1px solid #DDDDDD; +} +.amenities { + height: 100%; + width: 25%; +} + +.popover { + visibility: hidden; + width: 100%; + border: 1px solid #DDDDDD; + border-radius: 4px; + background: #FAFAFA; + padding-bottom: 15px; + height: 300px; + overflow-y: scroll; + scrollbar-width: none; + max-height: 300px; +} + +.popover::-webkit-scrollbar{ + width: 0px; +} + +.amenities .popover { + padding: 10px 0; + margin-left: -5px; + margin-top: 0%; +} + +.amenities .popover ul{ + margin: 0px; +} + +.locations .popover { + margin-top: 0%; +} +.popover ul { + list-style-type: none; + padding-bottom: 10px; + padding-left: 10px; +} +.popover ul li{ + padding: 4px; + padding-left: 10px; +} + +.popover ul h2{ + margin-top: 1.5%; + margin-bottom: 5%; + margin-left: 0px; +} + +.amenities:hover .popover, +.locations:hover .popover { + visibility: visible; +} diff --git a/web_dynamic/static/styles/8-places.css b/web_dynamic/static/styles/8-places.css new file mode 100644 index 00000000000..9dac66c0d7f --- /dev/null +++ b/web_dynamic/static/styles/8-places.css @@ -0,0 +1,101 @@ +.places { + column-count: 2; + columns: 30em; + justify-content: center; + padding: 0 20px; + margin-top: 1%; + margin-bottom: 8%; +} +@media only screen and (max-width: 920px) +{ + .places { + display: flex; + flex-wrap: wrap; + } +} + +.placesh1 h1 { + width: 100%; + margin-right: 400px; + text-align: left; + font-size: 35px; +} + +.places article { + -webkit-column-break-inside: avoid; + page-break-inside: avoid; + display: inline-block; + width: 390px; + height: 100%; + padding: 20px; + margin: 20px; + border: 1px solid #FF5A5F; + border-radius: 4px; +} +.places h2 { + font-size: 30px; + text-align: center; + margin-top: 0; +} +.title_box { + display: flex; + justify-content: space-between; + margin-top: -2%; +} + +.title_box h2 { + text-align: left; + margin: 25px 3% 40px 2%; + max-width: 75%; + word-wrap: break-word; +} +.price_by_night { + display: flex; + height: 60px; + min-width: 60px; + font-size: 30px; + justify-content: center; + align-items: center; + color: #FF5A5F; + border: 4px solid #FF5A5F; + border-radius: 50%; + align-items: center; + padding: 2.3%; +} + +.information { + display: flex; + justify-content: center; + align-items: center; + height: 80px; + border-top: 1px solid #DDDDDD; + border-bottom: 1px solid #DDDDDD; + margin-bottom: 5%; +} + +.information div { + display: flex; + justify-content: flex-end; + align-items: center; + flex-direction: column; + height: 65px; +} + +.information .max_guest { + background: url("../images/icon_group.png") no-repeat top center; + width: 100px; +} + +.information .number_rooms { + background: url("../images/icon_bed.png") no-repeat top center; + width: 100px; +} + +.information .number_bathrooms { + background: url("../images/icon_bath.png") no-repeat top center; + width: 100px; +} + +.user { + margin-bottom: 1.5%; +} diff --git a/web_dynamic/static/styles/w3c_validator.py b/web_dynamic/static/styles/w3c_validator.py new file mode 100755 index 00000000000..ee9593fce40 --- /dev/null +++ b/web_dynamic/static/styles/w3c_validator.py @@ -0,0 +1,123 @@ +#!/usr/bin/python3 +""" +W3C validator for Holberton School + +For HTML and CSS files. + +Based on 2 APIs: + +- https://validator.w3.org/nu/ +- http://jigsaw.w3.org/css-validator/validator + + +Usage: + +Simple file: + +``` +./w3c_validator.py index.html +``` + +Multiple files: + +``` +./w3c_validator.py index.html header.html styles/common.css +``` + +All errors are printed in `STDERR` + +Return: +Exit status is the # of errors, 0 on Success + +References + +https://developer.mozilla.org/en-US/ + +""" +import sys +import requests + + +def __print_stdout(msg): + """Print message in STDOUT + """ + sys.stdout.write(msg) + + +def __print_stderr(msg): + """Print message in STDERR + """ + sys.stderr.write(msg) + + +def __analyse_html(file_path): + """Start analyse of HTML file + """ + h = {'Content-Type': "text/html; charset=utf-8"} + d = open(file_path, "rb").read() + u = "https://validator.w3.org/nu/?out=json" + r = requests.post(u, headers=h, data=d) + res = [] + messages = r.json().get('messages', []) + for m in messages: + res.append("[{}:{}] {}".format(file_path, m['lastLine'], m['message'])) + return res + + +def __analyse_css(file_path): + """Start analyse of CSS file + """ + d = {'output': "json"} + f = {'file': (file_path, open(file_path, 'rb'), 'text/css')} + u = "http://jigsaw.w3.org/css-validator/validator" + r = requests.post(u, data=d, files=f) + res = [] + errors = r.json().get('cssvalidation', {}).get('errors', []) + for e in errors: + res.append("[{}:{}] {}".format(file_path, e['line'], e['message'])) + return res + + +def __analyse(file_path): + """Start analyse of a file and print the result + """ + nb_errors = 0 + try: + result = None + if file_path.endswith('.css'): + result = __analyse_css(file_path) + else: + result = __analyse_html(file_path) + + if len(result) > 0: + for msg in result: + __print_stderr("{}\n".format(msg)) + nb_errors += 1 + else: + __print_stdout("{}: OK\n".format(file_path)) + + except Exception as e: + __print_stderr("[{}] {}\n".format(e.__class__.__name__, e)) + return nb_errors + + +def __files_loop(): + """Loop that analyses for each file from input arguments + """ + nb_errors = 0 + for file_path in sys.argv[1:]: + nb_errors += __analyse(file_path) + + return nb_errors + + +if __name__ == "__main__": + """Main + """ + if len(sys.argv) < 2: + __print_stderr("usage: w3c_validator.py file1 file2 ...\n") + exit(1) + + """execute tests, then exit. Exit status = # of errors (0 on success) + """ + sys.exit(__files_loop()) diff --git a/web_dynamic/templates/0-hbnb.html b/web_dynamic/templates/0-hbnb.html new file mode 100644 index 00000000000..90beca049f8 --- /dev/null +++ b/web_dynamic/templates/0-hbnb.html @@ -0,0 +1,78 @@ + + + + + + + + + + + HBnB + + +
+ +
+
+
+
+

States

+

 

+
+
    + {% for state in states %} +
  • +

    {{ state[0].name }}:

    +
      + {% for city in state[1] %} +
    • {{ city.name }}
    • + {% endfor %} +
    +
  • + {% endfor %} +
+
+
+
+

Amenities

+

 

+
+
    + {% for amenity in amenities %} +
  • {{ amenity.name }}
  • + {% endfor %} +
+
+
+ +
+

Places

+
+ + {% for place in places %} +
+
+

{{ place.name }}

+
${{ place.price_by_night }}
+
+
+
{{ place.max_guest }} Guest{% if place.max_guest != 1 %}s{% endif %}
+
{{ place.number_rooms }} Bedroom{% if place.number_rooms != 1 %}s{% endif %}
+
{{ place.number_bathrooms }} Bathroom{% if place.number_bathrooms != 1 %}s{% endif %}
+
+
+ Owner: {{ place.user.first_name }} {{ place.user.last_name }} +
+
+ {{ place.description | safe }} +
+
+ {% endfor %} +
+
+
+

Holberton School

+
+ + From e74dcfd775dc2bddc5a5c899dc87e36451a41a4c Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Sat, 10 Aug 2024 14:11:02 +0000 Subject: [PATCH 04/20] 1. Cash Only --- web_flask/100-hbnb.py | 45 --------- web_flask/__init__.py | 0 web_flask/static/images/icon.png | Bin 2962 -> 0 bytes web_flask/static/images/icon_bath.png | Bin 704 -> 0 bytes web_flask/static/images/icon_bed.png | Bin 447 -> 0 bytes web_flask/static/images/icon_group.png | Bin 1051 -> 0 bytes web_flask/static/images/logo.png | Bin 9876 -> 0 bytes web_flask/static/styles/3-footer.css | 16 --- web_flask/static/styles/3-header.css | 11 -- web_flask/static/styles/4-common.css | 11 -- web_flask/static/styles/6-filters.css | 103 ------------------- web_flask/static/styles/8-places.css | 101 ------------------- web_flask/static/styles/w3c_validator.py | 123 ----------------------- web_flask/templates/100-hbnb.html | 78 -------------- 14 files changed, 488 deletions(-) delete mode 100755 web_flask/100-hbnb.py delete mode 100755 web_flask/__init__.py delete mode 100644 web_flask/static/images/icon.png delete mode 100644 web_flask/static/images/icon_bath.png delete mode 100644 web_flask/static/images/icon_bed.png delete mode 100644 web_flask/static/images/icon_group.png delete mode 100644 web_flask/static/images/logo.png delete mode 100644 web_flask/static/styles/3-footer.css delete mode 100644 web_flask/static/styles/3-header.css delete mode 100644 web_flask/static/styles/4-common.css delete mode 100644 web_flask/static/styles/6-filters.css delete mode 100644 web_flask/static/styles/8-places.css delete mode 100755 web_flask/static/styles/w3c_validator.py delete mode 100644 web_flask/templates/100-hbnb.html diff --git a/web_flask/100-hbnb.py b/web_flask/100-hbnb.py deleted file mode 100755 index cc243d165dc..00000000000 --- a/web_flask/100-hbnb.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/python3 -""" Starts a Flash Web Application """ -from models import storage -from models.state import State -from models.city import City -from models.amenity import Amenity -from models.place import Place -from os import environ -from flask import Flask, render_template -app = Flask(__name__) -# app.jinja_env.trim_blocks = True -# app.jinja_env.lstrip_blocks = True - - -@app.teardown_appcontext -def close_db(error): - """ Remove the current SQLAlchemy Session """ - storage.close() - - -@app.route('/hbnb', strict_slashes=False) -def hbnb(): - """ HBNB is alive! """ - states = storage.all(State).values() - states = sorted(states, key=lambda k: k.name) - st_ct = [] - - for state in states: - st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) - - amenities = storage.all(Amenity).values() - amenities = sorted(amenities, key=lambda k: k.name) - - places = storage.all(Place).values() - places = sorted(places, key=lambda k: k.name) - - return render_template('100-hbnb.html', - states=st_ct, - amenities=amenities, - places=places) - - -if __name__ == "__main__": - """ Main Function """ - app.run(host='0.0.0.0', port=5000) diff --git a/web_flask/__init__.py b/web_flask/__init__.py deleted file mode 100755 index e69de29bb2d..00000000000 diff --git a/web_flask/static/images/icon.png b/web_flask/static/images/icon.png deleted file mode 100644 index 93492bb8df2ec8408a935db7d4352e70e297d48d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2962 zcmaJ@dpy(YAOE^bDo5^=HRNtH%#4L>bIFih@PDUw@9?C7LK45=KA zNx776q!JD}P_xtmCKA-m=PllI=^A;OPQ zm+TwJ3dFf12{eise#6I%O`(g>0AOd&rsD}wBo-))6hWqBs89UCbkppaO25StQBWg^)q@E2aBXun~GfI(keSWzhO zKS>4Ryg*Jg1_@+kW?@Qznwx{*a5HmDD>&TT1O$Vc!yr)6gqxaMBCX&^m^J9@0E?nA zh~Y?YH1=yO(Fp~PWU=T-2qZQ()-2Y-jK+w7nA_OcY;eF}rXmkhW*n7;XPZ))I^P)3 zBqo7DrnAU2DrkcdA4ZE|p}?X{|G5H%{+*V}{8}ba!60lr9b#?<-MG>>M;z||yHY6M zy_qa;(tq;(pTtbxI64X9O=8kw7z9z{!gV%6(UDFJ5}rk4_|j<6->T>pNn_ENku*BU z$p;QHz~KpG>W0Da3j&8jx>A`eJe5FlMWetX4l^>Dh{QrMa4Ty#7GrI_*W4TfN0?(^ zHjWmSa3~aRgRrvthDFl|F%%M&^$kn>jjY53vwYGLVhd{#UENnMC^8*nStT=yL zcJyVxo(_ofIzO@Fb5a7YNl-n_2#Eq3A69HFgsUlx#%FP*z<%zwsB=fkgy}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b0be..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 447 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=3?wxlRx|^t$pJngu0XnMkb%!ndUAozGAIf1 z3ua(sX64}I;^CE*Q#3F%wXpN{i-=9nD6gz;XziFdWA5TjTelxSb?*G-JNG_+|M~mx zviF&$K)tIyT^vI^j=#O^&UeT_#Pwo+)q9mM_a;x+{r{?=!!(C77B>!oQ*-yt>6GnW zvb0u7U+vo+51u1=EDhnF`&QiX_{);$Z#jXF;fza^;C9#FjyJu$eswQfV=yaSXUXd8 zOV{`w(o3GyDaWjxm?#vV?{2*?Yr?E~e^`u+I&Q^G-!Q>}@0sHBZ48dCLMLt(OVPgg&ebxsLQ E03-gv2mk;8 diff --git a/web_flask/static/images/icon_group.png b/web_flask/static/images/icon_group.png deleted file mode 100644 index 3e012ab4d5cdc2146782461b475b2a81ce0fea4d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1051 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=3?wxlRx~p(FqQ=Pgt!8^Wut(;A)xa1&vRh7 zSC<6&1v4-*F|)9;v2$>8ar5x<@e2qF35$q|iAze!$jZqpD66S!Xld)}=^Gdt8Jn70 zTG`s!J370#x_Nqe`}q0=hQ-7sr)1|86ql4%RM$6jboNi2I(^3MxeFF8TeW)arY+ld z?%K2Oz~Q6EPnA zgW||zoJzi$)5NBGZPtle#HKS|ONG3(HoLZl9GLX^x%AAL)@KUZ+vTc0{VsSi z|7-5$4L5oF7urh2ac+5eFFjb7YkJ+RdkcL#rzu5sa_K66=m>b_)UA@+{lO#H>wv(! zKGwt?PPf%;9!;rgkiMT8v73YEVpvoAipxQ+*R6D08{BU5?0I*&$T((Mh|u|rRhb!| z=lE8x*>H4C#d+ti#sLx)(RZV*`io0Cl{SazpONRXdQn&qR2=$s=a78nheKN1tRgd#}OF1pXGJj3wWR$qG zJasw0!xKYYO^YwQa#}23?syqCK4vvLo2~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AiOT%l4DxsLrj9~yLG{u^9qWok?WRD4z{ZtgoZf@Cn{)%u_YP<{^@HUrT0 zUv4J9{`^D-QW$M>JLbk>#mNFpC2Z-_R|R0&jI>4EQV3ioF73au^zb!pJ zHCmR*2heE5FR`#Ygeiv{mkJ<4uO4(@8r+>1qT5usfH%(BvBMm(^zv7?87n3PHDU~O zbOWg7R>aS=`GK9-T^u{WH>yoK$_mS}O@H)W$%$a{X3BnhxCN_jX^{eI7eLl4;*aJe zxKe?GGl#S&b+^@g)`t&OjBrLPFh*2G9ZteiaZ@f(gCS1YgaCqU@0)qFtN_F5)_|xr z{WB}|J>c0ke0+OL&<@aHvn7U*_w4HJ$4fN;1^|a9@@e^3ZS3Fg#AGBDC8|Ce1^*w{ C(Z%)v diff --git a/web_flask/static/styles/3-footer.css b/web_flask/static/styles/3-footer.css deleted file mode 100644 index 2cd4ff05d90..00000000000 --- a/web_flask/static/styles/3-footer.css +++ /dev/null @@ -1,16 +0,0 @@ -footer { - position: fixed; - background: white; - height: 60px; - width: 100%; - bottom: 0; - border-top: 1px solid #CCCCCC; -} -footer p { - position: absolute; - text-align: center; - top: 10%; - bottom: 0; - right: 0; - left: 0; -} diff --git a/web_flask/static/styles/3-header.css b/web_flask/static/styles/3-header.css deleted file mode 100644 index 245cac7c980..00000000000 --- a/web_flask/static/styles/3-header.css +++ /dev/null @@ -1,11 +0,0 @@ -header { - background: white; - height: 70px; - width: 100%; - border-bottom: 1px solid #CCCCCC; -} -header .logo { - background: url("../images/logo.png") no-repeat; - left: 20px; - height: 100%; -} diff --git a/web_flask/static/styles/4-common.css b/web_flask/static/styles/4-common.css deleted file mode 100644 index 46cfc19d1c1..00000000000 --- a/web_flask/static/styles/4-common.css +++ /dev/null @@ -1,11 +0,0 @@ -body { - margin: 0; - padding: 0; - color: #484848; - font-size: 14px; - font-family: Circular,"Helvetica Neue",Helvetica,Arial,sans-serif; -} -body .container { - max-width: 1000px; - margin: 30px auto; -} diff --git a/web_flask/static/styles/6-filters.css b/web_flask/static/styles/6-filters.css deleted file mode 100644 index d47107732aa..00000000000 --- a/web_flask/static/styles/6-filters.css +++ /dev/null @@ -1,103 +0,0 @@ -.container .filters { - position: relative; - background: white; - height: 70px; - width: 100%; - border: 1px solid #DDDDDD; - border-radius: 4px; -} -button { - position: absolute; - font-size: 18px; - background: #FF5A5F; - color: #FFFFFF; - height: 48px; - width: 20%; - border-style: none; - border-radius: 4px; - top: 15%; - right: 30px; -} -button:hover { - opacity: 0.9; -} -.filters div { - display: inline-grid; -} -.filters h2 { - margin-left: 15%; - margin-top: 0; - margin-bottom: 0; - font-weight: 600; -} -.filters h3 { - margin-left: 15%; - margin-bottom: 0; - font-weight: 600; -} -.filters h4 { - margin-left: 15%; - margin-top: 0; - font-weight: 400; - font-size: 14px; -} -.locations { - height: 100%; - width: 25%; - border-right: 1px solid #DDDDDD; -} -.amenities { - height: 100%; - width: 25%; -} - -.popover { - visibility: hidden; - width: 100%; - border: 1px solid #DDDDDD; - border-radius: 4px; - background: #FAFAFA; - padding-bottom: 15px; - height: 300px; - overflow-y: scroll; - scrollbar-width: none; - max-height: 300px; -} - -.popover::-webkit-scrollbar{ - width: 0px; -} - -.amenities .popover { - padding: 10px 0; - margin-left: -5px; - margin-top: 0%; -} - -.amenities .popover ul{ - margin: 0px; -} - -.locations .popover { - margin-top: 0%; -} -.popover ul { - list-style-type: none; - padding-bottom: 10px; - padding-left: 10px; -} -.popover ul li{ - padding: 4px; - padding-left: 10px; -} - -.popover ul h2{ - margin-top: 1.5%; - margin-bottom: 5%; - margin-left: 0px; -} - -.amenities:hover .popover, -.locations:hover .popover { - visibility: visible; -} diff --git a/web_flask/static/styles/8-places.css b/web_flask/static/styles/8-places.css deleted file mode 100644 index 9dac66c0d7f..00000000000 --- a/web_flask/static/styles/8-places.css +++ /dev/null @@ -1,101 +0,0 @@ -.places { - column-count: 2; - columns: 30em; - justify-content: center; - padding: 0 20px; - margin-top: 1%; - margin-bottom: 8%; -} -@media only screen and (max-width: 920px) -{ - .places { - display: flex; - flex-wrap: wrap; - } -} - -.placesh1 h1 { - width: 100%; - margin-right: 400px; - text-align: left; - font-size: 35px; -} - -.places article { - -webkit-column-break-inside: avoid; - page-break-inside: avoid; - display: inline-block; - width: 390px; - height: 100%; - padding: 20px; - margin: 20px; - border: 1px solid #FF5A5F; - border-radius: 4px; -} -.places h2 { - font-size: 30px; - text-align: center; - margin-top: 0; -} -.title_box { - display: flex; - justify-content: space-between; - margin-top: -2%; -} - -.title_box h2 { - text-align: left; - margin: 25px 3% 40px 2%; - max-width: 75%; - word-wrap: break-word; -} -.price_by_night { - display: flex; - height: 60px; - min-width: 60px; - font-size: 30px; - justify-content: center; - align-items: center; - color: #FF5A5F; - border: 4px solid #FF5A5F; - border-radius: 50%; - align-items: center; - padding: 2.3%; -} - -.information { - display: flex; - justify-content: center; - align-items: center; - height: 80px; - border-top: 1px solid #DDDDDD; - border-bottom: 1px solid #DDDDDD; - margin-bottom: 5%; -} - -.information div { - display: flex; - justify-content: flex-end; - align-items: center; - flex-direction: column; - height: 65px; -} - -.information .max_guest { - background: url("../images/icon_group.png") no-repeat top center; - width: 100px; -} - -.information .number_rooms { - background: url("../images/icon_bed.png") no-repeat top center; - width: 100px; -} - -.information .number_bathrooms { - background: url("../images/icon_bath.png") no-repeat top center; - width: 100px; -} - -.user { - margin-bottom: 1.5%; -} diff --git a/web_flask/static/styles/w3c_validator.py b/web_flask/static/styles/w3c_validator.py deleted file mode 100755 index ee9593fce40..00000000000 --- a/web_flask/static/styles/w3c_validator.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/python3 -""" -W3C validator for Holberton School - -For HTML and CSS files. - -Based on 2 APIs: - -- https://validator.w3.org/nu/ -- http://jigsaw.w3.org/css-validator/validator - - -Usage: - -Simple file: - -``` -./w3c_validator.py index.html -``` - -Multiple files: - -``` -./w3c_validator.py index.html header.html styles/common.css -``` - -All errors are printed in `STDERR` - -Return: -Exit status is the # of errors, 0 on Success - -References - -https://developer.mozilla.org/en-US/ - -""" -import sys -import requests - - -def __print_stdout(msg): - """Print message in STDOUT - """ - sys.stdout.write(msg) - - -def __print_stderr(msg): - """Print message in STDERR - """ - sys.stderr.write(msg) - - -def __analyse_html(file_path): - """Start analyse of HTML file - """ - h = {'Content-Type': "text/html; charset=utf-8"} - d = open(file_path, "rb").read() - u = "https://validator.w3.org/nu/?out=json" - r = requests.post(u, headers=h, data=d) - res = [] - messages = r.json().get('messages', []) - for m in messages: - res.append("[{}:{}] {}".format(file_path, m['lastLine'], m['message'])) - return res - - -def __analyse_css(file_path): - """Start analyse of CSS file - """ - d = {'output': "json"} - f = {'file': (file_path, open(file_path, 'rb'), 'text/css')} - u = "http://jigsaw.w3.org/css-validator/validator" - r = requests.post(u, data=d, files=f) - res = [] - errors = r.json().get('cssvalidation', {}).get('errors', []) - for e in errors: - res.append("[{}:{}] {}".format(file_path, e['line'], e['message'])) - return res - - -def __analyse(file_path): - """Start analyse of a file and print the result - """ - nb_errors = 0 - try: - result = None - if file_path.endswith('.css'): - result = __analyse_css(file_path) - else: - result = __analyse_html(file_path) - - if len(result) > 0: - for msg in result: - __print_stderr("{}\n".format(msg)) - nb_errors += 1 - else: - __print_stdout("{}: OK\n".format(file_path)) - - except Exception as e: - __print_stderr("[{}] {}\n".format(e.__class__.__name__, e)) - return nb_errors - - -def __files_loop(): - """Loop that analyses for each file from input arguments - """ - nb_errors = 0 - for file_path in sys.argv[1:]: - nb_errors += __analyse(file_path) - - return nb_errors - - -if __name__ == "__main__": - """Main - """ - if len(sys.argv) < 2: - __print_stderr("usage: w3c_validator.py file1 file2 ...\n") - exit(1) - - """execute tests, then exit. Exit status = # of errors (0 on success) - """ - sys.exit(__files_loop()) diff --git a/web_flask/templates/100-hbnb.html b/web_flask/templates/100-hbnb.html deleted file mode 100644 index 776bbb9c999..00000000000 --- a/web_flask/templates/100-hbnb.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - HBnB - - -
- -
-
-
-
-

States

-

 

-
-
    - {% for state in states %} -
  • -

    {{ state[0].name }}:

    -
      - {% for city in state[1] %} -
    • {{ city.name }}
    • - {% endfor %} -
    -
  • - {% endfor %} -
-
-
-
-

Amenities

-

 

-
-
    - {% for amenity in amenities %} -
  • {{ amenity.name }}
  • - {% endfor %} -
-
-
- -
-

Places

-
- - {% for place in places %} -
-
-

{{ place.name }}

-
${{ place.price_by_night }}
-
-
-
{{ place.max_guest }} Guest{% if place.max_guest != 1 %}s{% endif %}
-
{{ place.number_rooms }} Bedroom{% if place.number_rooms != 1 %}s{% endif %}
-
{{ place.number_bathrooms }} Bathroom{% if place.number_bathrooms != 1 %}s{% endif %}
-
-
- Owner: {{ place.user.first_name }} {{ place.user.last_name }} -
-
- {{ place.description | safe }} -
-
- {% endfor %} -
-
-
-

Holberton School

-
- - From 4f8325000de91177256afca82b52c6f67cce5c61 Mon Sep 17 00:00:00 2001 From: Nazavivian21 Date: Sat, 10 Aug 2024 20:11:14 +0100 Subject: [PATCH 05/20] Update the AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 64b26acdc14..e41cf809bab 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,6 +1,7 @@ # This file lists all individuals having contributed content to the repository. +Chinaza Ukwe Jennifer Huang <133@holbertonschool.com> Alexa Orrico <210@holbertonschool.com> Joann Vuong <130@holbertonschool.com> From 3ec3a1b66641026798b8603b8396f77b5f47f264 Mon Sep 17 00:00:00 2001 From: Nazavivian21 Date: Sun, 11 Aug 2024 04:46:07 +0100 Subject: [PATCH 06/20] Update the AUTHORS --- AUTHORS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 61fe682cfc5..11835386d66 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,7 +2,8 @@ Chinaza Ukwe +Emmanuel Sekyi Jennifer Huang <133@holbertonschool.com> Alexa Orrico <210@holbertonschool.com> Joann Vuong <130@holbertonschool.com> -Emmanuel Sekyi + From 85fd8b972e7d9034025724ece883094ec494c2d7 Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Sun, 11 Aug 2024 04:52:40 +0000 Subject: [PATCH 07/20] 2. Select some Amenities to be comfortable --- web_dynamic/1-hbnb.py | 47 ++++++++++++++ web_dynamic/static/scripts/1-hbnb.js | 14 +++++ web_dynamic/templates/1-hbnb.html | 92 ++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 web_dynamic/1-hbnb.py create mode 100644 web_dynamic/static/scripts/1-hbnb.js create mode 100644 web_dynamic/templates/1-hbnb.html diff --git a/web_dynamic/1-hbnb.py b/web_dynamic/1-hbnb.py new file mode 100644 index 00000000000..bb95a8613eb --- /dev/null +++ b/web_dynamic/1-hbnb.py @@ -0,0 +1,47 @@ +#!/usr/bin/python3 +""" Starts a Flash Web Application """ +from models import storage +from models.state import State +from models.city import City +from models.amenity import Amenity +from models.place import Place +from os import environ +from flask import Flask, render_template +import uuid +app = Flask(__name__) +# app.jinja_env.trim_blocks = True +# app.jinja_env.lstrip_blocks = True + + +@app.teardown_appcontext +def close_db(error): + """ Remove the current SQLAlchemy Session """ + storage.close() + + +@app.route('/1-hbnb', strict_slashes=False) +def hbnb(): + """ HBNB is alive! """ + states = storage.all(State).values() + states = sorted(states, key=lambda k: k.name) + st_ct = [] + + for state in states: + st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) + + amenities = storage.all(Amenity).values() + amenities = sorted(amenities, key=lambda k: k.name) + + places = storage.all(Place).values() + places = sorted(places, key=lambda k: k.name) + + return render_template('1-hbnb.html', + cache_id=uuid.uuid4(), + states=st_ct, + amenities=amenities, + places=places) + + +if __name__ == "__main__": + """ Main Function """ + app.run(host='0.0.0.0', port=5000) diff --git a/web_dynamic/static/scripts/1-hbnb.js b/web_dynamic/static/scripts/1-hbnb.js new file mode 100644 index 00000000000..6a4068c4c82 --- /dev/null +++ b/web_dynamic/static/scripts/1-hbnb.js @@ -0,0 +1,14 @@ +$(document).ready(function() { + const selectedAmenities = {}; + $('input[type="checkbox"]').change(function () { + const amenityId = $(this).attr('data-id'); + const amenityName = $(this).attr('data-name'); + if ($(this).is(':checked')) { + selectedAmenities[amenityId] = amenityName; + } else { + delete selectedAmenities[amenityId]; + } + const amenitiesList = Object.values(selectedAmenities).join(', '); + $('.selected-amenities').text(amenitiesList); + }); +}); diff --git a/web_dynamic/templates/1-hbnb.html b/web_dynamic/templates/1-hbnb.html new file mode 100644 index 00000000000..0473335e69b --- /dev/null +++ b/web_dynamic/templates/1-hbnb.html @@ -0,0 +1,92 @@ + + + + + + HBnB + + + + + + + + + + + + +
+ +
+
+
+
+

States

+

 

+
+
    + {% for state in states %} +
  • +

    {{ state[0].name }}:

    +
      + {% for city in state[1] %} +
    • {{ city.name }}
    • + {% endfor %} +
    +
  • + {% endfor %} +
+
+
+
+

Amenities

+

 

+
+
    + {% for amenity in amenities %} +
  • + + {{ amenity.name }} +
  • + {% endfor %} +
+
+
+ +
+
+

Places

+
+
+ + {% for place in places %} +
+
+

{{ place.name }}

+
${{ place.price_by_night }}
+
+
+
{{ place.max_guest }} Guest{% if place.max_guest != 1 %}s{% endif %}
+
{{ place.number_rooms }} Bedroom{% if place.number_rooms != 1 %}s{% endif + %}
+
{{ place.number_bathrooms }} Bathroom{% if place.number_bathrooms != 1 + %}s{% endif %}
+
+
+ Owner: {{ place.user.first_name }} {{ place.user.last_name }} +
+
+ {{ place.description | safe }} +
+
+ {% endfor %} +
+
+
+

Holberton School

+
+ + + \ No newline at end of file From 24bba59d2ab9ce8863f653688e921852c81dec6e Mon Sep 17 00:00:00 2001 From: Nazavivian21 Date: Sun, 11 Aug 2024 08:49:30 +0100 Subject: [PATCH 08/20] Update app.py --- api/v1/app.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/v1/app.py b/api/v1/app.py index 2a74f26a1e5..751ed9d6b6f 100755 --- a/api/v1/app.py +++ b/api/v1/app.py @@ -11,8 +11,7 @@ app = Flask(__name__) app.config['JSONIFY_PRETTYPRINT_REGULAR'] = True app.register_blueprint(app_views) -cors = CORS(app, resources={r"/*": {"origins": "0.0.0.0"}}) - +cors = CORS(app, resources={r"/api/v1/*": {"origins": "*"}}) @app.teardown_appcontext def close_db(error): From adcce2200e2ef2380af0ccd43565af7c75ab958d Mon Sep 17 00:00:00 2001 From: Nazavivian21 Date: Sun, 11 Aug 2024 08:52:05 +0100 Subject: [PATCH 09/20] Add 2-hbnb --- web_dynamic/2-hbnb.py | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 web_dynamic/2-hbnb.py diff --git a/web_dynamic/2-hbnb.py b/web_dynamic/2-hbnb.py new file mode 100644 index 00000000000..c5c091003af --- /dev/null +++ b/web_dynamic/2-hbnb.py @@ -0,0 +1,47 @@ +#!/usr/bin/python3 +""" Starts a Flash Web Application """ +from models import storage +from models.state import State +from models.city import City +from models.amenity import Amenity +from models.place import Place +from os import environ +from flask import Flask, render_template +import uuid +app = Flask(__name__) +# app.jinja_env.trim_blocks = True +# app.jinja_env.lstrip_blocks = True + + +@app.teardown_appcontext +def close_db(error): + """ Remove the current SQLAlchemy Session """ + storage.close() + + +@app.route('/2-hbnb', strict_slashes=False) +def hbnb(): + """ HBNB is alive! """ + states = storage.all(State).values() + states = sorted(states, key=lambda k: k.name) + st_ct = [] + + for state in states: + st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) + + amenities = storage.all(Amenity).values() + amenities = sorted(amenities, key=lambda k: k.name) + + places = storage.all(Place).values() + places = sorted(places, key=lambda k: k.name) + + return render_template('1-hbnb.html', + cache_id=uuid.uuid4(), + states=st_ct, + amenities=amenities, + places=places) + + +if __name__ == "__main__": + """ Main Function """ + app.run(host='0.0.0.0', port=5000) From b2ac4b2913e3e236216364021dac9d3c2cd7f2e6 Mon Sep 17 00:00:00 2001 From: Nazavivian21 Date: Sun, 11 Aug 2024 08:52:05 +0100 Subject: [PATCH 10/20] Add 2-hbnb.py --- web_dynamic/2-hbnb.py | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 web_dynamic/2-hbnb.py diff --git a/web_dynamic/2-hbnb.py b/web_dynamic/2-hbnb.py new file mode 100644 index 00000000000..c5c091003af --- /dev/null +++ b/web_dynamic/2-hbnb.py @@ -0,0 +1,47 @@ +#!/usr/bin/python3 +""" Starts a Flash Web Application """ +from models import storage +from models.state import State +from models.city import City +from models.amenity import Amenity +from models.place import Place +from os import environ +from flask import Flask, render_template +import uuid +app = Flask(__name__) +# app.jinja_env.trim_blocks = True +# app.jinja_env.lstrip_blocks = True + + +@app.teardown_appcontext +def close_db(error): + """ Remove the current SQLAlchemy Session """ + storage.close() + + +@app.route('/2-hbnb', strict_slashes=False) +def hbnb(): + """ HBNB is alive! """ + states = storage.all(State).values() + states = sorted(states, key=lambda k: k.name) + st_ct = [] + + for state in states: + st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) + + amenities = storage.all(Amenity).values() + amenities = sorted(amenities, key=lambda k: k.name) + + places = storage.all(Place).values() + places = sorted(places, key=lambda k: k.name) + + return render_template('1-hbnb.html', + cache_id=uuid.uuid4(), + states=st_ct, + amenities=amenities, + places=places) + + +if __name__ == "__main__": + """ Main Function """ + app.run(host='0.0.0.0', port=5000) From cc842bee1447a63209c28f8199729d7b5fa50ce2 Mon Sep 17 00:00:00 2001 From: Nazavivian21 Date: Sun, 11 Aug 2024 08:57:45 +0100 Subject: [PATCH 11/20] Add 2-hnbnb.html --- web_dynamic/templates/2-hbnb.html | 94 +++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 web_dynamic/templates/2-hbnb.html diff --git a/web_dynamic/templates/2-hbnb.html b/web_dynamic/templates/2-hbnb.html new file mode 100644 index 00000000000..8000273711d --- /dev/null +++ b/web_dynamic/templates/2-hbnb.html @@ -0,0 +1,94 @@ + + + + + + HBnB + + + + + + + + + + + + + +
+ +
+
+
+
+
+

States

+

 

+
+
    + {% for state in states %} +
  • +

    {{ state[0].name }}:

    +
      + {% for city in state[1] %} +
    • {{ city.name }}
    • + {% endfor %} +
    +
  • + {% endfor %} +
+
+
+
+

Amenities

+

 

+
+
    + {% for amenity in amenities %} +
  • + + {{ amenity.name }} +
  • + {% endfor %} +
+
+
+ +
+
+

Places

+
+
+ + {% for place in places %} +
+
+

{{ place.name }}

+
${{ place.price_by_night }}
+
+
+
{{ place.max_guest }} Guest{% if place.max_guest != 1 %}s{% endif %}
+
{{ place.number_rooms }} Bedroom{% if place.number_rooms != 1 %}s{% endif + %}
+
{{ place.number_bathrooms }} Bathroom{% if place.number_bathrooms != 1 + %}s{% endif %}
+
+
+ Owner: {{ place.user.first_name }} {{ place.user.last_name }} +
+
+ {{ place.description | safe }} +
+
+ {% endfor %} +
+
+
+

Holberton School

+
+ + + \ No newline at end of file From 1e08a04140b38aca83e5fd8f2a0150f7bab6323e Mon Sep 17 00:00:00 2001 From: Nazavivian21 Date: Sun, 11 Aug 2024 09:00:48 +0100 Subject: [PATCH 12/20] Update 3-header.css --- web_dynamic/static/styles/3-header.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web_dynamic/static/styles/3-header.css b/web_dynamic/static/styles/3-header.css index 245cac7c980..3f7385ae3de 100644 --- a/web_dynamic/static/styles/3-header.css +++ b/web_dynamic/static/styles/3-header.css @@ -9,3 +9,7 @@ header .logo { left: 20px; height: 100%; } + +.available { + background-color: #ff545f; +} \ No newline at end of file From 062ad0fae307ceb2813312d2a08ac73ceea76e2d Mon Sep 17 00:00:00 2001 From: Nazavivian21 Date: Sun, 11 Aug 2024 09:03:35 +0100 Subject: [PATCH 13/20] Add 2-hbnb.js --- web_dynamic/static/scripts/2-hbnb.js | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 web_dynamic/static/scripts/2-hbnb.js diff --git a/web_dynamic/static/scripts/2-hbnb.js b/web_dynamic/static/scripts/2-hbnb.js new file mode 100644 index 00000000000..1133288710b --- /dev/null +++ b/web_dynamic/static/scripts/2-hbnb.js @@ -0,0 +1,38 @@ +$(document).ready(function() { + // Object to keep track of selected amenities + const selectedAmenities = {}; + + /** + * Event listener for checkbox changes + * Adds or removes amenities from the selectedAmenities object + * Updates the text of the .selected-amenities element with the list of selected amenities + */ + $('input[type="checkbox"]').change(function () { + const amenityId = $(this).attr('data-id'); // Get the data-id attribute of the checkbox + const amenityName = $(this).attr('data-name'); // Get the data-name attribute of the checkbox + if ($(this).is(':checked')) { // If the checkbox is checked + selectedAmenities[amenityId] = amenityName; // Add the amenity to the selectedAmenities object + } else { // If the checkbox is unchecked + delete selectedAmenities[amenityId]; // Remove the amenity from the selectedAmenities object + } + // Update the text of the .selected-amenities element with the list of selected amenities + const amenitiesList = Object.values(selectedAmenities).join(', '); + $('.selected-amenities').text(amenitiesList); + }); + + /** + * Function to check the API status + * Sends a GET request to the API endpoint + * Adds the 'available' class to the #api_status element if the status is 'OK' + * Removes the 'available' class from the #api_status element if the status is not 'OK' or the request fails + */ + $.get('http://0.0.0.0:5001/api/v1/status/', function(data) { + if (data.status === 'OK') { // If the status is 'OK' + $('#api_status').addClass('available'); // Add the 'available' class to the #api_status element + } else { // If the status is not 'OK' + $('#api_status').removeClass('available'); // Remove the 'available' class from the #api_status element + } + }).fail(function() { + $('#api_status').removeClass('available'); // Remove the 'available' class from the #api_status element if the request fails + }); +}); From bb0c780c9a2e0b72fe6ac32d20a549db5afd3a39 Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Sun, 11 Aug 2024 08:20:41 +0000 Subject: [PATCH 14/20] changes and updates --- file.json | 216 ++++++++++++++++++++++++++++++ web_dynamic/1-hbnb.py | 8 +- web_dynamic/templates/1-hbnb.html | 6 +- 3 files changed, 226 insertions(+), 4 deletions(-) create mode 100644 file.json diff --git a/file.json b/file.json new file mode 100644 index 00000000000..b5e05146a0e --- /dev/null +++ b/file.json @@ -0,0 +1,216 @@ +{ + "BaseModel.dd52e210-0a0a-4f48-aba9-129c09d5b083": { + "id": "dd52e210-0a0a-4f48-aba9-129c09d5b083", + "created_at": "2024-08-06T04:50:24.300285", + "updated_at": "2024-08-06T04:50:24.300285", + "__class__": "BaseModel" + }, + "State.965c91e6-1c6b-4001-88de-fde415e4d2ca": { + "name": "Arizona", + "created_at": "2024-08-06T10:12:09.276009", + "updated_at": "2024-08-06T10:12:09.276047", + "id": "965c91e6-1c6b-4001-88de-fde415e4d2ca", + "__class__": "State" + }, + "State.92038c0a-7701-4499-8d9c-e3cf04511298": { + "name": "Ohio", + "created_at": "2024-08-06T10:16:13.211148", + "updated_at": "2024-08-06T10:16:13.211231", + "id": "92038c0a-7701-4499-8d9c-e3cf04511298", + "__class__": "State" + }, + "State.d8e94fa2-2710-40e0-9d3c-40ed5b00c681": { + "name": "Texas", + "created_at": "2024-08-06T10:16:52.657918", + "updated_at": "2024-08-06T10:16:52.658001", + "id": "d8e94fa2-2710-40e0-9d3c-40ed5b00c681", + "__class__": "State" + }, + "State.6e2d673d-ba64-434f-919b-8c5d70193e1b": { + "name": "Florida", + "created_at": "2024-08-06T10:17:02.766481", + "updated_at": "2024-08-06T10:17:02.766538", + "id": "6e2d673d-ba64-434f-919b-8c5d70193e1b", + "__class__": "State" + }, + "State.c76968c7-4d3a-4042-93c1-3c9a3d4c5d9b": { + "name": "California", + "created_at": "2024-08-06T10:17:10.514532", + "updated_at": "2024-08-06T10:17:10.514570", + "id": "c76968c7-4d3a-4042-93c1-3c9a3d4c5d9b", + "__class__": "State" + }, + "State.e45594a4-2824-4075-9a86-70ce3653a144": { + "name": "tr", + "created_at": "2024-08-06T10:53:45.495555", + "updated_at": "2024-08-06T10:53:45.495647", + "id": "e45594a4-2824-4075-9a86-70ce3653a144", + "__class__": "State" + }, + "City.147fbef5-061d-4e79-896b-e2e901bf99b3": { + "name": "Miami", + "created_at": "2024-08-07T04:32:32.007342", + "updated_at": "2024-08-07T04:32:32.007399", + "id": "147fbef5-061d-4e79-896b-e2e901bf99b3", + "state_id": "6e2d673d-ba64-434f-919b-8c5d70193e1b", + "__class__": "City" + }, + "City.d807b069-c052-4f8d-b2c7-a7bd63008892": { + "name": "Orlando", + "created_at": "2024-08-07T04:33:08.636635", + "updated_at": "2024-08-07T04:33:08.636683", + "id": "d807b069-c052-4f8d-b2c7-a7bd63008892", + "state_id": "6e2d673d-ba64-434f-919b-8c5d70193e1b", + "__class__": "City" + }, + "City.3b6f9ce1-ca57-4dc5-8cdc-d734d1c818b8": { + "name": "Tallahassee", + "created_at": "2024-08-07T04:38:45.238888", + "updated_at": "2024-08-07T04:38:45.238924", + "id": "3b6f9ce1-ca57-4dc5-8cdc-d734d1c818b8", + "state_id": "6e2d673d-ba64-434f-919b-8c5d70193e1b", + "__class__": "City" + }, + "City.5200d721-e515-4247-afa9-75e892066b87": { + "name": "Tucson", + "created_at": "2024-08-07T04:40:20.831317", + "updated_at": "2024-08-07T04:40:20.831363", + "id": "5200d721-e515-4247-afa9-75e892066b87", + "state_id": "965c91e6-1c6b-4001-88de-fde415e4d2ca", + "__class__": "City" + }, + "City.0a41acee-1caa-4661-9d45-93ba6e816b24": { + "name": "Yuma", + "created_at": "2024-08-07T04:41:00.856309", + "updated_at": "2024-08-07T04:41:00.856345", + "id": "0a41acee-1caa-4661-9d45-93ba6e816b24", + "state_id": "965c91e6-1c6b-4001-88de-fde415e4d2ca", + "__class__": "City" + }, + "Amenity.63b9e893-f4ad-4a52-af20-666b555fa52e": { + "name": "Cable Tv", + "created_at": "2024-08-11T05:36:27.934054", + "updated_at": "2024-08-11T05:36:27.934446", + "id": "63b9e893-f4ad-4a52-af20-666b555fa52e", + "__class__": "Amenity" + }, + "Amenity.608a70a2-0dd1-46a2-9d6d-2bf0b0878fe7": { + "name": "Air Conditioning", + "created_at": "2024-08-11T05:44:08.346441", + "updated_at": "2024-08-11T05:44:08.346588", + "id": "608a70a2-0dd1-46a2-9d6d-2bf0b0878fe7", + "__class__": "Amenity" + }, + "Amenity.b9fa984a-2db2-4642-a944-c978d1680a1f": { + "name": "Breackfast", + "created_at": "2024-08-11T05:44:31.028926", + "updated_at": "2024-08-11T05:44:31.028973", + "id": "b9fa984a-2db2-4642-a944-c978d1680a1f", + "__class__": "Amenity" + }, + "Amenity.aead74ea-84c2-487d-8a0f-5f4e233d0332": { + "name": "Dogs", + "created_at": "2024-08-11T05:52:54.136181", + "updated_at": "2024-08-11T05:52:54.136390", + "id": "aead74ea-84c2-487d-8a0f-5f4e233d0332", + "__class__": "Amenity" + }, + "Amenity.76f89e99-3a4c-444a-875d-4b331f89c8d4": { + "name": "Doorman", + "created_at": "2024-08-11T05:52:59.947820", + "updated_at": "2024-08-11T05:52:59.947864", + "id": "76f89e99-3a4c-444a-875d-4b331f89c8d4", + "__class__": "Amenity" + }, + "Amenity.f519229f-7571-4569-9130-5739efd2edac": { + "name": "Cat(s)", + "created_at": "2024-08-11T05:53:17.010840", + "updated_at": "2024-08-11T05:53:17.010882", + "id": "f519229f-7571-4569-9130-5739efd2edac", + "__class__": "Amenity" + }, + "User.1e4c7ec4-2711-44a9-96d4-8f04bb4e8b80": { + "email": "sskert10@gmail.com", + "password": "51e2831f7c824b48adb2fb194949003d", + "first_name": "Sekyi", + "last_name": "Skert", + "created_at": "2024-08-11T06:10:52.994434", + "updated_at": "2024-08-11T06:10:52.994912", + "id": "1e4c7ec4-2711-44a9-96d4-8f04bb4e8b80", + "__class__": "User" + }, + "User.08e66463-fd13-4c09-97b4-e7cb03cee6f9": { + "email": "sskert10@gmail.com", + "password": "bb37c85cff2917a43fa8ab7253b40ab6", + "first_name": "Sekyi", + "last_name": "Skert", + "created_at": "2024-08-11T06:11:27.925884", + "updated_at": "2024-08-11T06:11:27.925954", + "id": "08e66463-fd13-4c09-97b4-e7cb03cee6f9", + "__class__": "User" + }, + "Place.9b9a3ac4-61fa-4620-8533-028a76c310d6": { + "city_id": "3b6f9ce1-ca57-4dc5-8cdc-d734d1c818b8", + "user_id": "08e66463-fd13-4c09-97b4-e7cb03cee6f9", + "name": "Beautiful Studio Rooms", + "amenity_ids": "608a70a2-0dd1-46a2-9d6d-2bf0b0878fe7", + "description": "If you use a multi-element selector, like the class selector we used in the previous example, and we know that we're looking for elements of a specific type, it's good practice to specify the element type before the selector. Not only is it more precise, it's also faster for jQuery to process, resulting in more responsive sites. Here is a re-written version of the previous example, where we use this method:", + "max_guest": 2, + "numeber_rooms": 4, + "numeber_bathrooms": 8, + "created_at": "2024-08-11T06:28:11.585076", + "updated_at": "2024-08-11T06:28:11.585344", + "id": "9b9a3ac4-61fa-4620-8533-028a76c310d6", + "__class__": "Place" + }, + "City.a703dc2b-4eb8-4998-badd-82e6f1e8b857": { + "name": "Galveston", + "created_at": "2024-08-11T06:39:55.484038", + "updated_at": "2024-08-11T06:39:55.484190", + "id": "a703dc2b-4eb8-4998-badd-82e6f1e8b857", + "state_id": "d8e94fa2-2710-40e0-9d3c-40ed5b00c681", + "__class__": "City" + }, + "Place.4cabf5b6-552d-4bd1-8943-c0e85aae5981": { + "user_id": "08e66463-fd13-4c09-97b4-e7cb03cee6f9", + "name": "Baywatch Dolphin Tour", + "amenity_ids": [ + "608a70a2-0dd1-46a2-9d6d-2bf0b0878fe7", + "63b9e893-f4ad-4a52-af20-666b555fa52e", + "76f89e99-3a4c-444a-875d-4b331f89c8d4" + ], + "description": "This Galveston Baywatch Dolphin Tour is a great way to see dolphins on the water in just a few hours. Meet your group and captain at Pier 21 and join the boat you\u2019re assigned for this experience. Then, take off on the water to enjoy some time searching for dolphins in their natural habitat. Catch sight of dolphins in their natural habitat during this Galveston tour Perfect for nature lovers who are short on time No need to rush on board\u2014all seats offer great viewing opportunities A captain knows the best areas on the water to spot dolphins", + "max_guest": 6, + "numeber_rooms": 8, + "numeber_bathrooms": 3, + "price_by_night": 329, + "latitude": -94.792802857672, + "longitude": "29.309400464654054", + "city_id": "a703dc2b-4eb8-4998-badd-82e6f1e8b857", + "created_at": "2024-08-11T06:49:19.954826", + "updated_at": "2024-08-11T06:49:19.955034", + "id": "4cabf5b6-552d-4bd1-8943-c0e85aae5981", + "__class__": "Place" + }, + "Place.03f48f7e-7c47-4b20-98c5-729e093be6f7": { + "user_id": "08e66463-fd13-4c09-97b4-e7cb03cee6f9", + "name": "Baywatch Dolphin Tour", + "amenity_ids": [ + "608a70a2-0dd1-46a2-9d6d-2bf0b0878fe7", + "63b9e893-f4ad-4a52-af20-666b555fa52e", + "76f89e99-3a4c-444a-875d-4b331f89c8d4" + ], + "description": "This Galveston Baywatch Dolphin Tour is a great way to see dolphins on the water in just a few hours. Meet your group and captain at Pier 21 and join the boat you\u2019re assigned for this experience. Then, take off on the water to enjoy some time searching for dolphins in their natural habitat. Catch sight of dolphins in their natural habitat during this Galveston tour Perfect for nature lovers who are short on time No need to rush on board\u2014all seats offer great viewing opportunities A captain knows the best areas on the water to spot dolphins", + "max_guest": 6, + "numeber_rooms": 8, + "numeber_bathrooms": 3, + "price_by_night": 329, + "latitude": -94.792802857672, + "longitude": 29.309400464654054, + "city_id": "a703dc2b-4eb8-4998-badd-82e6f1e8b857", + "created_at": "2024-08-11T06:51:43.027322", + "updated_at": "2024-08-11T06:51:43.027374", + "id": "03f48f7e-7c47-4b20-98c5-729e093be6f7", + "__class__": "Place" + } +} \ No newline at end of file diff --git a/web_dynamic/1-hbnb.py b/web_dynamic/1-hbnb.py index bb95a8613eb..ee44915c317 100644 --- a/web_dynamic/1-hbnb.py +++ b/web_dynamic/1-hbnb.py @@ -5,6 +5,7 @@ from models.city import City from models.amenity import Amenity from models.place import Place +from models.user import User from os import environ from flask import Flask, render_template import uuid @@ -35,11 +36,16 @@ def hbnb(): places = storage.all(Place).values() places = sorted(places, key=lambda k: k.name) + places_with_users = [] + for place in places: + user = storage.get(User, place.user_id) + places_with_users.append((place, user)) + return render_template('1-hbnb.html', cache_id=uuid.uuid4(), states=st_ct, amenities=amenities, - places=places) + places=places_with_users) if __name__ == "__main__": diff --git a/web_dynamic/templates/1-hbnb.html b/web_dynamic/templates/1-hbnb.html index 0473335e69b..3179f663203 100644 --- a/web_dynamic/templates/1-hbnb.html +++ b/web_dynamic/templates/1-hbnb.html @@ -46,7 +46,7 @@

 

    {% for amenity in amenities %}
  • - {{ amenity.name }}
  • @@ -61,7 +61,7 @@

    Places

    - {% for place in places %} + {% for place, user in places %}

    {{ place.name }}

    @@ -75,7 +75,7 @@

    {{ place.name }}

    %}s{% endif %}
    - Owner: {{ place.user.first_name }} {{ place.user.last_name }} + Owner: {{ user.first_name }} {{ user.last_name }}
    {{ place.description | safe }} From d38d6c887b73e39f5259efe4dd2e201d25a54508 Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Sun, 11 Aug 2024 23:34:04 +0000 Subject: [PATCH 15/20] task 2 - fixes --- web_dynamic/2-hbnb.py | 10 ++++++++-- web_dynamic/templates/2-hbnb.html | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/web_dynamic/2-hbnb.py b/web_dynamic/2-hbnb.py index c5c091003af..054c9646ae4 100644 --- a/web_dynamic/2-hbnb.py +++ b/web_dynamic/2-hbnb.py @@ -5,6 +5,7 @@ from models.city import City from models.amenity import Amenity from models.place import Place +from models.user import User from os import environ from flask import Flask, render_template import uuid @@ -35,11 +36,16 @@ def hbnb(): places = storage.all(Place).values() places = sorted(places, key=lambda k: k.name) - return render_template('1-hbnb.html', + places_with_users = [] + for place in places: + user = storage.get(User, place.user_id) + places_with_users.append((place, user)) + + return render_template('2-hbnb.html', cache_id=uuid.uuid4(), states=st_ct, amenities=amenities, - places=places) + places=places_with_users) if __name__ == "__main__": diff --git a/web_dynamic/templates/2-hbnb.html b/web_dynamic/templates/2-hbnb.html index 8000273711d..e1cb93803e2 100644 --- a/web_dynamic/templates/2-hbnb.html +++ b/web_dynamic/templates/2-hbnb.html @@ -48,7 +48,7 @@

     

      {% for amenity in amenities %}
    • - {{ amenity.name }}
    • @@ -63,7 +63,7 @@

      Places

    - {% for place in places %} + {% for place, user in places %}

    {{ place.name }}

    @@ -77,7 +77,7 @@

    {{ place.name }}

    %}s{% endif %}
    - Owner: {{ place.user.first_name }} {{ place.user.last_name }} + Owner: {{ user.first_name }} {{ user.last_name }}
    {{ place.description | safe }} From 5f401b19412923bfedf568de93c6df5ec0e916c5 Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Mon, 12 Aug 2024 01:55:33 +0000 Subject: [PATCH 16/20] updates --- web_dynamic/templates/2-hbnb.html | 1 - 1 file changed, 1 deletion(-) diff --git a/web_dynamic/templates/2-hbnb.html b/web_dynamic/templates/2-hbnb.html index e1cb93803e2..3221301f49d 100644 --- a/web_dynamic/templates/2-hbnb.html +++ b/web_dynamic/templates/2-hbnb.html @@ -12,7 +12,6 @@ - From 12d47e5f8d975237ef43098ea16be409a527ca18 Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Mon, 12 Aug 2024 01:57:03 +0000 Subject: [PATCH 17/20] 4. Fetch places --- web_dynamic/3-hbnb.py | 53 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 web_dynamic/3-hbnb.py diff --git a/web_dynamic/3-hbnb.py b/web_dynamic/3-hbnb.py new file mode 100644 index 00000000000..8fc1ad4ba24 --- /dev/null +++ b/web_dynamic/3-hbnb.py @@ -0,0 +1,53 @@ +#!/usr/bin/python3 +""" Starts a Flash Web Application """ +from models import storage +from models.state import State +from models.city import City +from models.amenity import Amenity +from models.place import Place +from models.user import User +from os import environ +from flask import Flask, render_template +import uuid +app = Flask(__name__) +# app.jinja_env.trim_blocks = True +# app.jinja_env.lstrip_blocks = True + + +@app.teardown_appcontext +def close_db(error): + """ Remove the current SQLAlchemy Session """ + storage.close() + + +@app.route('/3-hbnb', strict_slashes=False) +def hbnb(): + """ HBNB is alive! """ + states = storage.all(State).values() + states = sorted(states, key=lambda k: k.name) + st_ct = [] + + for state in states: + st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) + + amenities = storage.all(Amenity).values() + amenities = sorted(amenities, key=lambda k: k.name) + + places = storage.all(Place).values() + places = sorted(places, key=lambda k: k.name) + + places_with_users = [] + for place in places: + user = storage.get(User, place.user_id) + places_with_users.append((place, user)) + + return render_template('3-hbnb.html', + cache_id=uuid.uuid4(), + states=st_ct, + amenities=amenities, + places=places_with_users) + + +if __name__ == "__main__": + """ Main Function """ + app.run(host='0.0.0.0', port=5000) From fbf7f32c8a319b04fb8399a32d9037acc01a372a Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Mon, 12 Aug 2024 01:58:12 +0000 Subject: [PATCH 18/20] 4. Fetch places --- web_dynamic/static/scripts/3-hbnb.js | 66 +++++++++++++++++++++++++ web_dynamic/templates/3-hbnb.html | 74 ++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 web_dynamic/static/scripts/3-hbnb.js create mode 100644 web_dynamic/templates/3-hbnb.html diff --git a/web_dynamic/static/scripts/3-hbnb.js b/web_dynamic/static/scripts/3-hbnb.js new file mode 100644 index 00000000000..5f709bce2db --- /dev/null +++ b/web_dynamic/static/scripts/3-hbnb.js @@ -0,0 +1,66 @@ +$(document).ready(function () +{ + const selectedAmenities = {}; + + $('input[type="checkbox"]').change(function () + { + const amenityId = $(this).attr('data-id'); + const amenityName = $(this).attr('data-name'); + if ($(this).is(':checked')) + { + selectedAmenities[amenityId] = amenityName; + } else + { + delete selectedAmenities[amenityId]; + } + const amenitiesList = Object.values(selectedAmenities).join(', '); + $('.selected-amenities').text(amenitiesList); + }); + + $.get('http://0.0.0.0:5001/api/v1/status/', function (data) + { + if (data.status === 'OK') + { // If the status is 'OK' + $('#api_status').addClass('available'); + } else + { + $('#api_status').removeClass('available'); + } + }).fail(function () + { + $('#api_status').removeClass('available'); + }); + + $.ajax({ + url: 'http://0.0.0.0:5001/api/v1/places_search/', + type: 'POST', + contentType: 'application/json', + data: JSON.stringify({}), + success: function (data) { + for (let place of data) { + const article = $('
    '); + const titleBox = $('
    '); + titleBox.append(`

    ${place.name || ''}

    `); + titleBox.append(`
    $${place.price_by_night || 0}
    `); + article.append(titleBox); + + const infoBox = $('
    '); + infoBox.append(`
    ${place.max_guest || 0} Guest${place.max_guest != 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_rooms || 0} Bedroom${place.number_rooms != 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_bathrooms || 0} Bathroom${place.number_bathrooms != 1 ? 's' : ''}
    `); + article.append(infoBox); + + const description = $('
    '); + description.html(place.description || ''); + article.append(description); + + $('.places').append(article); + } + }, + error: function (error) { + console.error('Error fetching places:', error); + } + + }); + +}); diff --git a/web_dynamic/templates/3-hbnb.html b/web_dynamic/templates/3-hbnb.html new file mode 100644 index 00000000000..a5d2cea4c2f --- /dev/null +++ b/web_dynamic/templates/3-hbnb.html @@ -0,0 +1,74 @@ + + + + + + HBnB + + + + + + + + + + + + +
    + +
    +
    +
    +
    +
    +
    +

    States

    +

     

    +
    +
      + {% for state in states %} +
    • +

      {{ state[0].name }}:

      +
        + {% for city in state[1] %} +
      • {{ city.name }}
      • + {% endfor %} +
      +
    • + {% endfor %} +
    +
    +
    +
    +

    Amenities

    +

     

    +
    +
      + {% for amenity in amenities %} +
    • + + {{ amenity.name }} +
    • + {% endfor %} +
    +
    +
    + +
    +
    +

    Places

    +
    +
    + +
    +
    +
    +

    Holberton School

    +
    + + + \ No newline at end of file From 3b851e93f33ec4dc62a21374162371f5c7831826 Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Mon, 12 Aug 2024 03:47:21 +0000 Subject: [PATCH 19/20] 5. Filter places by Amenity --- web_dynamic/4-hbnb.py | 53 ++++++++++++ web_dynamic/static/scripts/1-hbnb.js | 16 ++-- web_dynamic/static/scripts/2-hbnb.js | 6 +- web_dynamic/static/scripts/3-hbnb.js | 121 +++++++++++++-------------- web_dynamic/static/scripts/4-hbnb.js | 102 ++++++++++++++++++++++ web_dynamic/templates/4-hbnb.html | 74 ++++++++++++++++ 6 files changed, 296 insertions(+), 76 deletions(-) create mode 100644 web_dynamic/4-hbnb.py create mode 100644 web_dynamic/static/scripts/4-hbnb.js create mode 100644 web_dynamic/templates/4-hbnb.html diff --git a/web_dynamic/4-hbnb.py b/web_dynamic/4-hbnb.py new file mode 100644 index 00000000000..3841e345121 --- /dev/null +++ b/web_dynamic/4-hbnb.py @@ -0,0 +1,53 @@ +#!/usr/bin/python3 +""" Starts a Flash Web Application """ +from models import storage +from models.state import State +from models.city import City +from models.amenity import Amenity +from models.place import Place +from models.user import User +from os import environ +from flask import Flask, render_template +import uuid +app = Flask(__name__) +# app.jinja_env.trim_blocks = True +# app.jinja_env.lstrip_blocks = True + + +@app.teardown_appcontext +def close_db(error): + """ Remove the current SQLAlchemy Session """ + storage.close() + + +@app.route('/4-hbnb', strict_slashes=False) +def hbnb(): + """ HBNB is alive! """ + states = storage.all(State).values() + states = sorted(states, key=lambda k: k.name) + st_ct = [] + + for state in states: + st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) + + amenities = storage.all(Amenity).values() + amenities = sorted(amenities, key=lambda k: k.name) + + places = storage.all(Place).values() + places = sorted(places, key=lambda k: k.name) + + places_with_users = [] + for place in places: + user = storage.get(User, place.user_id) + places_with_users.append((place, user)) + + return render_template('4-hbnb.html', + cache_id=uuid.uuid4(), + states=st_ct, + amenities=amenities, + places=places_with_users) + + +if __name__ == "__main__": + """ Main Function """ + app.run(host='0.0.0.0', port=5000) diff --git a/web_dynamic/static/scripts/1-hbnb.js b/web_dynamic/static/scripts/1-hbnb.js index 6a4068c4c82..75b645c05dc 100644 --- a/web_dynamic/static/scripts/1-hbnb.js +++ b/web_dynamic/static/scripts/1-hbnb.js @@ -1,14 +1,14 @@ -$(document).ready(function() { +$(document).ready(function () { const selectedAmenities = {}; $('input[type="checkbox"]').change(function () { - const amenityId = $(this).attr('data-id'); - const amenityName = $(this).attr('data-name'); - if ($(this).is(':checked')) { + const amenityId = $(this).attr('data-id'); + const amenityName = $(this).attr('data-name'); + if ($(this).is(':checked')) { selectedAmenities[amenityId] = amenityName; - } else { + } else { delete selectedAmenities[amenityId]; - } - const amenitiesList = Object.values(selectedAmenities).join(', '); - $('.selected-amenities').text(amenitiesList); + } + const amenitiesList = Object.values(selectedAmenities).join(', '); + $('.selected-amenities').text(amenitiesList); }); }); diff --git a/web_dynamic/static/scripts/2-hbnb.js b/web_dynamic/static/scripts/2-hbnb.js index 1133288710b..4056243b698 100644 --- a/web_dynamic/static/scripts/2-hbnb.js +++ b/web_dynamic/static/scripts/2-hbnb.js @@ -1,4 +1,4 @@ -$(document).ready(function() { +$(document).ready(function () { // Object to keep track of selected amenities const selectedAmenities = {}; @@ -26,13 +26,13 @@ $(document).ready(function() { * Adds the 'available' class to the #api_status element if the status is 'OK' * Removes the 'available' class from the #api_status element if the status is not 'OK' or the request fails */ - $.get('http://0.0.0.0:5001/api/v1/status/', function(data) { + $.get('http://0.0.0.0:5001/api/v1/status/', function (data) { if (data.status === 'OK') { // If the status is 'OK' $('#api_status').addClass('available'); // Add the 'available' class to the #api_status element } else { // If the status is not 'OK' $('#api_status').removeClass('available'); // Remove the 'available' class from the #api_status element } - }).fail(function() { + }).fail(function () { $('#api_status').removeClass('available'); // Remove the 'available' class from the #api_status element if the request fails }); }); diff --git a/web_dynamic/static/scripts/3-hbnb.js b/web_dynamic/static/scripts/3-hbnb.js index 5f709bce2db..f6f4f380539 100644 --- a/web_dynamic/static/scripts/3-hbnb.js +++ b/web_dynamic/static/scripts/3-hbnb.js @@ -1,66 +1,57 @@ -$(document).ready(function () -{ - const selectedAmenities = {}; - - $('input[type="checkbox"]').change(function () - { - const amenityId = $(this).attr('data-id'); - const amenityName = $(this).attr('data-name'); - if ($(this).is(':checked')) - { - selectedAmenities[amenityId] = amenityName; - } else - { - delete selectedAmenities[amenityId]; - } - const amenitiesList = Object.values(selectedAmenities).join(', '); - $('.selected-amenities').text(amenitiesList); - }); - - $.get('http://0.0.0.0:5001/api/v1/status/', function (data) - { - if (data.status === 'OK') - { // If the status is 'OK' - $('#api_status').addClass('available'); - } else - { - $('#api_status').removeClass('available'); - } - }).fail(function () - { - $('#api_status').removeClass('available'); - }); - - $.ajax({ - url: 'http://0.0.0.0:5001/api/v1/places_search/', - type: 'POST', - contentType: 'application/json', - data: JSON.stringify({}), - success: function (data) { - for (let place of data) { - const article = $('
    '); - const titleBox = $('
    '); - titleBox.append(`

    ${place.name || ''}

    `); - titleBox.append(`
    $${place.price_by_night || 0}
    `); - article.append(titleBox); - - const infoBox = $('
    '); - infoBox.append(`
    ${place.max_guest || 0} Guest${place.max_guest != 1 ? 's' : ''}
    `); - infoBox.append(`
    ${place.number_rooms || 0} Bedroom${place.number_rooms != 1 ? 's' : ''}
    `); - infoBox.append(`
    ${place.number_bathrooms || 0} Bathroom${place.number_bathrooms != 1 ? 's' : ''}
    `); - article.append(infoBox); - - const description = $('
    '); - description.html(place.description || ''); - article.append(description); - - $('.places').append(article); - } - }, - error: function (error) { - console.error('Error fetching places:', error); - } - - }); - +$(document).ready(function () { + const selectedAmenities = {}; + + $('input[type="checkbox"]').change(function () { + const amenityId = $(this).attr('data-id'); + const amenityName = $(this).attr('data-name'); + if ($(this).is(':checked')) { + selectedAmenities[amenityId] = amenityName; + } else { + delete selectedAmenities[amenityId]; + } + const amenitiesList = Object.values(selectedAmenities).join(', '); + $('.selected-amenities').text(amenitiesList); + }); + + $.get('http://0.0.0.0:5001/api/v1/status/', function (data) { + if (data.status === 'OK') { // If the status is 'OK' + $('#api_status').addClass('available'); + } else { + $('#api_status').removeClass('available'); + } + }).fail(function () { + $('#api_status').removeClass('available'); + }); + + $.ajax({ + url: 'http://0.0.0.0:5001/api/v1/places_search/', + type: 'POST', + contentType: 'application/json', + data: JSON.stringify({}), + success: function (data) { + for (const place of data) { + const article = $('
    '); + const titleBox = $('
    '); + titleBox.append(`

    ${place.name || ''}

    `); + titleBox.append(`
    $${place.price_by_night || 0}
    `); + article.append(titleBox); + + const infoBox = $('
    '); + infoBox.append(`
    ${place.max_guest || 0} Guest${place.max_guest !== 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_rooms || 0} Bedroom${place.number_rooms !== 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_bathrooms || 0} Bathroom${place.number_bathrooms !== 1 ? 's' : ''}
    `); + article.append(infoBox); + + const description = $('
    '); + description.html(place.description || ''); + article.append(description); + + $('.places').append(article); + } + }, + error: function (error) { + console.error('Error fetching places:', error); + } + + }); }); diff --git a/web_dynamic/static/scripts/4-hbnb.js b/web_dynamic/static/scripts/4-hbnb.js new file mode 100644 index 00000000000..c58396af81d --- /dev/null +++ b/web_dynamic/static/scripts/4-hbnb.js @@ -0,0 +1,102 @@ +$(document).ready(function () { + console.log('DOM is Ready') + const selectedAmenities = {}; + + $('input[type="checkbox"]').change(function () { + const amenityId = $(this).attr('data-id'); + const amenityName = $(this).attr('data-name'); + if ($(this).is(':checked')) { + selectedAmenities[amenityId] = amenityName; + } else { + delete selectedAmenities[amenityId]; + } + const amenitiesList = Object.values(selectedAmenities).join(', '); + if (amenitiesList) { + $('.selected-amenities').text(amenitiesList); + } else { + $('.amenities h4').html(' '); + } + }); + + $.get('http://0.0.0.0:5001/api/v1/status/', function (data) { + if (data.status === 'OK') { // If the status is 'OK' + $('#api_status').addClass('available'); + } else { + $('#api_status').removeClass('available'); + } + }).fail(function () { + $('#api_status').removeClass('available'); + }); + + $.ajax({ + url: 'http://0.0.0.0:5001/api/v1/places_search/', + type: 'POST', + contentType: 'application/json', + data: JSON.stringify({}), + success: function (data) { + for (const place of data) { + const article = $('
    '); + const titleBox = $('
    '); + titleBox.append(`

    ${place.name || ''}

    `); + titleBox.append(`
    $${place.price_by_night || 0}
    `); + article.append(titleBox); + + const infoBox = $('
    '); + infoBox.append(`
    ${place.max_guest || 0} Guest${place.max_guest !== 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_rooms || 0} Bedroom${place.number_rooms !== 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_bathrooms || 0} Bathroom${place.number_bathrooms !== 1 ? 's' : ''}
    `); + article.append(infoBox); + + const description = $('
    '); + description.html(place.description || ''); + article.append(description); + + $('.places').append(article); + } + }, + error: function (error) { + console.error('Error fetching places:', error); + } + + }); + function fetchPlaces(data) { + console.log('Data being sent:', data); + $.ajax({ + url: 'http://0.0.0.0:5001/api/v1/places_search/', + type: 'POST', + contentType: 'application/json', + data: JSON.stringify(data), + success: function (places) { + $('.places').empty(); + for (const place of places) { + const article = $('
    '); + const titleBox = $('
    '); + titleBox.append(`

    ${place.name || ''}

    `); + titleBox.append(`
    $${place.price_by_night || 0}
    `); + article.append(titleBox); + + const infoBox = $('
    '); + infoBox.append(`
    ${place.max_guest || 0} Guest${place.max_guest !== 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_rooms || 0} Bedroom${place.number_rooms !== 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_bathrooms || 0} Bathroom${place.number_bathrooms !== 1 ? 's' : ''}
    `); + article.append(infoBox); + + const description = $('
    '); + description.html(place.description || ''); + article.append(description); + + $('.places').append(article); + } + }, + error: function (error) { + console.error('Error fetching places:', error); + } + }); + } + fetchPlaces({}); + $('button').click(function () { + console.log('Button is clicked') + const amenities = Object.keys(selectedAmenities); + fetchPlaces({ amenities: amenities }); + }); +}); diff --git a/web_dynamic/templates/4-hbnb.html b/web_dynamic/templates/4-hbnb.html new file mode 100644 index 00000000000..dbec52974a7 --- /dev/null +++ b/web_dynamic/templates/4-hbnb.html @@ -0,0 +1,74 @@ + + + + + + HBnB + + + + + + + + + + + + +
    + +
    +
    +
    +
    +
    +
    +

    States

    +

     

    +
    +
      + {% for state in states %} +
    • +

      {{ state[0].name }}:

      +
        + {% for city in state[1] %} +
      • {{ city.name }}
      • + {% endfor %} +
      +
    • + {% endfor %} +
    +
    +
    +
    +

    Amenities

    +

     

    +
    +
      + {% for amenity in amenities %} +
    • + + {{ amenity.name }} +
    • + {% endfor %} +
    +
    +
    + +
    +
    +

    Places

    +
    +
    + +
    +
    +
    +

    Holberton School

    +
    + + + \ No newline at end of file From 376200db9879141d8d67e43ff7f59eba561d539f Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Mon, 12 Aug 2024 04:46:33 +0000 Subject: [PATCH 20/20] 6. States and Cities --- web_dynamic/100-hbnb.py | 53 ++++++++++++++ web_dynamic/static/scripts/100-hbnb.js | 99 ++++++++++++++++++++++++++ web_dynamic/templates/100-hbnb.html | 74 +++++++++++++++++++ 3 files changed, 226 insertions(+) create mode 100644 web_dynamic/100-hbnb.py create mode 100644 web_dynamic/static/scripts/100-hbnb.js create mode 100644 web_dynamic/templates/100-hbnb.html diff --git a/web_dynamic/100-hbnb.py b/web_dynamic/100-hbnb.py new file mode 100644 index 00000000000..ce715cc1535 --- /dev/null +++ b/web_dynamic/100-hbnb.py @@ -0,0 +1,53 @@ +#!/usr/bin/python3 +""" Starts a Flash Web Application """ +from models import storage +from models.state import State +from models.city import City +from models.amenity import Amenity +from models.place import Place +from models.user import User +from os import environ +from flask import Flask, render_template +import uuid +app = Flask(__name__) +# app.jinja_env.trim_blocks = True +# app.jinja_env.lstrip_blocks = True + + +@app.teardown_appcontext +def close_db(error): + """ Remove the current SQLAlchemy Session """ + storage.close() + + +@app.route('/100-hbnb', strict_slashes=False) +def hbnb(): + """ HBNB is alive! """ + states = storage.all(State).values() + states = sorted(states, key=lambda k: k.name) + st_ct = [] + + for state in states: + st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) + + amenities = storage.all(Amenity).values() + amenities = sorted(amenities, key=lambda k: k.name) + + places = storage.all(Place).values() + places = sorted(places, key=lambda k: k.name) + + places_with_users = [] + for place in places: + user = storage.get(User, place.user_id) + places_with_users.append((place, user)) + + return render_template('100-hbnb.html', + cache_id=uuid.uuid4(), + states=st_ct, + amenities=amenities, + places=places_with_users) + + +if __name__ == "__main__": + """ Main Function """ + app.run(host='0.0.0.0', port=5000) diff --git a/web_dynamic/static/scripts/100-hbnb.js b/web_dynamic/static/scripts/100-hbnb.js new file mode 100644 index 00000000000..2649a591b24 --- /dev/null +++ b/web_dynamic/static/scripts/100-hbnb.js @@ -0,0 +1,99 @@ +$(document).ready(function () { + const selectedAmenities = {}; + + $('input[type="checkbox"]').change(function () { + const amenityId = $(this).attr('data-id'); + const amenityName = $(this).attr('data-name'); + if ($(this).is(':checked')) { + selectedAmenities[amenityId] = amenityName; + } else { + delete selectedAmenities[amenityId]; + } + const amenitiesList = Object.values(selectedAmenities).join(', '); + if (amenitiesList) { + $('.selected-amenities').text(amenitiesList); + } else { + $('.amenities h4').html(' '); + } + }); + + $.get('http://0.0.0.0:5001/api/v1/status/', function (data) { + if (data.status === 'OK') { // If the status is 'OK' + $('#api_status').addClass('available'); + } else { + $('#api_status').removeClass('available'); + } + }).fail(function () { + $('#api_status').removeClass('available'); + }); + + $.ajax({ + url: 'http://0.0.0.0:5001/api/v1/places_search/', + type: 'POST', + contentType: 'application/json', + data: JSON.stringify({}), + success: function (data) { + for (const place of data) { + const article = $('
    '); + const titleBox = $('
    '); + titleBox.append(`

    ${place.name || ''}

    `); + titleBox.append(`
    $${place.price_by_night || 0}
    `); + article.append(titleBox); + + const infoBox = $('
    '); + infoBox.append(`
    ${place.max_guest || 0} Guest${place.max_guest !== 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_rooms || 0} Bedroom${place.number_rooms !== 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_bathrooms || 0} Bathroom${place.number_bathrooms !== 1 ? 's' : ''}
    `); + article.append(infoBox); + + const description = $('
    '); + description.html(place.description || ''); + article.append(description); + + $('.places').append(article); + } + }, + error: function (error) { + console.error('Error fetching places:', error); + } + + }); + function fetchPlaces(data) { + $.ajax({ + url: 'http://0.0.0.0:5001/api/v1/places_search/', + type: 'POST', + contentType: 'application/json', + data: JSON.stringify(data), + success: function (places) { + $('.places').empty(); + for (const place of places) { + const article = $('
    '); + const titleBox = $('
    '); + titleBox.append(`

    ${place.name || ''}

    `); + titleBox.append(`
    $${place.price_by_night || 0}
    `); + article.append(titleBox); + + const infoBox = $('
    '); + infoBox.append(`
    ${place.max_guest || 0} Guest${place.max_guest !== 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_rooms || 0} Bedroom${place.number_rooms !== 1 ? 's' : ''}
    `); + infoBox.append(`
    ${place.number_bathrooms || 0} Bathroom${place.number_bathrooms !== 1 ? 's' : ''}
    `); + article.append(infoBox); + + const description = $('
    '); + description.html(place.description || ''); + article.append(description); + + $('.places').append(article); + } + }, + error: function (error) { + console.error('Error fetching places:', error); + } + }); + } + fetchPlaces({}); + $('button').click(function () { + const amenities = Object.keys(selectedAmenities); + fetchPlaces({ amenities: amenities }); + }); +}); diff --git a/web_dynamic/templates/100-hbnb.html b/web_dynamic/templates/100-hbnb.html new file mode 100644 index 00000000000..b9e52a5ad61 --- /dev/null +++ b/web_dynamic/templates/100-hbnb.html @@ -0,0 +1,74 @@ + + + + + + HBnB + + + + + + + + + + + + +
    + +
    +
    +
    +
    +
    +
    +

    States

    +

     

    +
    +
      + {% for state in states %} +
    • +

      {{ state[0].name }}:

      +
        + {% for city in state[1] %} +
      • {{ city.name }}
      • + {% endfor %} +
      +
    • + {% endfor %} +
    +
    +
    +
    +

    Amenities

    +

     

    +
    +
      + {% for amenity in amenities %} +
    • + + {{ amenity.name }} +
    • + {% endfor %} +
    +
    +
    + +
    +
    +

    Places

    +
    +
    + +
    +
    + + + + \ No newline at end of file