Skip to content

Commit

Permalink
Merge pull request #267 from wanderlust-group-project-1/finalize
Browse files Browse the repository at this point in the history
Finalize
  • Loading branch information
nsavinda committed May 1, 2024
2 parents a2edd06 + 7a54e45 commit 3134f7c
Show file tree
Hide file tree
Showing 585 changed files with 43,129 additions and 33,064 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Web test with Selenium

on:
push:
branches: [ dev, test-workflow ]
pull_request:
branches: [ dev, test-workflow ]

jobs:
build:
runs-on: ubuntu-latest

steps:
# setup site using docker-compose
- name: Checkout
uses: actions/checkout@v3
- run: cp example.env .env
- run: cp database/example.env database/.env
- name: Run docker compose
run: docker compose up -d


- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install selenium
- name: Run test
run: |
python test.py
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/vendor/
database/.env
.env
public/uploads/
.pytest_cache
public/uploads/rental_services/



server.env
setup.sql
public/assets/scss/wl/dashboard/index.css
public/assets/scss/wl/dashboard/index.css.map
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{
"liveServer.settings.port": 5501
"liveServer.settings.port": 5501,

"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "./public/assets/scss/index",
"savePathReplacementPairs": null
}
]
}
Binary file removed Archive.zip
Binary file not shown.
File renamed without changes
74 changes: 72 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,75 @@
# mvc
# Wanderlust

## Camping Equipment Rental and Guide Booking System



## Group Members

- [Nirmal Savinda](https://www.github.com/nsavinda)
- [Gayandee Rajapaksha](https://www.github.com/Gayandee)
- [Sarani Hettiarachchi](https://www.github.com/Zaras00)
- [Sandali Gunawardena](https://www.github.com/Sandali-Upekha)


## Features

### For Rental Service

- Inventory Management
- Rental Management
- Complaint Management
- Report Generation


### For Guide

- Package Management
- Booking Calendar
- Report Generation


### For Customer

- Booking & Rent Equipment
- Booking Guide
- Complaint Management


### For Admin

- User Management
- View Statistics
- Handle Complaints
- Report Generation


## Tech Stack

- HTML | JavaScript | jQuery | SCSS | CSS
- PHP
- MySQL
- Apache
- Docker


### APIs and Other Integrations

- Google Maps API
- Payhere Sandbox
- PHPMailer
- Dompdf
- ApexCharts


# Setup

Rename `example.env` to `.env`

Rename `database/example.env` to `database/.env`



```bash
docker-compose up -d --build
```
Expand All @@ -17,11 +81,17 @@ docker exec -it wl-mysql bash

# inside container
cd docker-entrypoint-initdb.d/
# On Windows

# On Windows (To remove CRLF)
sed -i -e 's/\r$//' .env
sed -i -e 's/\r$//' migrate.sh

#import
./migrate.sh import
```


## Compile SCSS

Use Live Sass Compiler Extension in VSCode to compile SCSS to CSS

94 changes: 94 additions & 0 deletions app/controllers/API/Cart.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

class Cart {
use Controller;

public function create(string $a = '', string $b = '', string $c = ''):void {

$request = new JSONRequest();
$response = new JSONResponse();

$cart = new CartModel;

$data = [
'customer_id' => UserMiddleware::getUser()['id'],
'start_date' => $request->get('start_date'),
'end_date' => $request->get('end_date'),
];

$result = $cart->createCart($data);

$response->data($result)->statusCode(200)->send();


}

public function addItem(string $a = '', string $b = '', string $c = ''):void {

$request = new JSONRequest();
$response = new JSONResponse();

$cart = new CartModel;

$data = [
'customer_id' => UserMiddleware::getUser()['id'],
'equipment_id' => $request->get('equipment_id'),
'count' => $request->get('count'),
];

$result = $cart->addItemToCart($data);

$response->data([
'message' => 'Item added to cart',
'status' => 'success',
'data' => $result

])
->statusCode(200)
->send();


}

public function count(string $a = '', string $b = '', string $c = ''):void {

$request = new JSONRequest();
$response = new JSONResponse();

$cart = new CartModel;

$data = [
'customer_id' => UserMiddleware::getUser()['id'],
];

$result = $cart->countItem($data);

$response->data($result)->statusCode(200)->send();


}

public function removeItem(string $a = '', string $b = '', string $c = ''):void {

$request = new JSONRequest();
$response = new JSONResponse();

$item = new CartItemModel;

$data = [
'customer_id' => UserMiddleware::getUser()['id'],
'id' => $request->get('id'),
];

$result = $item->removeCartItem($data);

$response->data([
'message' => 'Item removed from cart',
'status' => 'success'
])
->statusCode(200)
->send();


}
}
44 changes: 44 additions & 0 deletions app/controllers/API/Complaints.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

class Complaints
{
use Controller;

public function index()
{

$this->view('rental/complaints');
}

public function cancelComplaint(string $a = '', string $b = '', string $c = ''): void
{

$complaint = new RentReturnComplaintModel;
$complaint->cancelComplaint($a);

$response = new JSONResponse;
$response->statusCode(200)->data(['complaint_id' => $a])->send();
}

public function resolveComplaint(string $a = ''): void
{

$complaint = new RentComplaintModel;
$complaint->resolveComplaint($a);

$response = new JSONResponse;
$response->statusCode(200)->success(true)->data(['complaint_id' => $a])->send();
}

public function cancelCustomerComplaint(string $a = '', string $b = '', string $c = ''): void
{

$complaint = new RentComplaintModel;
$complaint->cancelComplaint($a);

$response = new JSONResponse;
$response->statusCode(200)->data(['complaint_id' => $a])->send();
}


}
30 changes: 30 additions & 0 deletions app/controllers/API/Customer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

class Customer {
use Controller;


public function uploadImage(string $a = '', string $b = '', string $c = ''):void {

$request = JSONRequest::createFromFormData();
$response = new JSONResponse();

$customer = new CustomerModel;

$data = [
'image' => $_FILES['image'],

];
$id = UserMiddleware::getUser()['id'];

$image = $customer->uploadImage($data, $id);


if($image){
$response->statusCode(200)->data(['image' => $image['image']])->send();
}else{
$response->statusCode(400)->data(['error' => 'Image upload failed'])->send();
}

}
}
Loading

0 comments on commit 3134f7c

Please sign in to comment.