Commit 715251a9 by Bojan Borovcanin

Almost there

parent ade2c6bf
.imagePreview{ .imagePreview{
width: 350px; width: 350px;
height: 200px; height: 200px;
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
public function workerSignup() public function workerSignup()
{ {
$this->form_validation->set_rules('firstname','Firstname','required|max_length[30]'); $this->form_validation->set_rules('firstname','Firstname','required|max_length[30]');
$this->form_validation->set_rules('lastname','Lasttname','required|max_length[30]'); $this->form_validation->set_rules('lastname','Lastname','required|max_length[30]');
$this->form_validation->set_rules('dateofbirth','Date of birth','required'); $this->form_validation->set_rules('dateofbirth','Date of birth','required');
$this->form_validation->set_rules('gender','Gender','required'); $this->form_validation->set_rules('gender','Gender','required');
$this->form_validation->set_rules('worker_name','Worker name','required|max_length[30]|callback_worker_name_is_unique'); $this->form_validation->set_rules('worker_name','Worker name','required|max_length[30]|callback_worker_name_is_unique');
...@@ -72,7 +72,6 @@ ...@@ -72,7 +72,6 @@
$this->form_validation->set_rules('city','City','required|max_length[30]'); $this->form_validation->set_rules('city','City','required|max_length[30]');
$this->form_validation->set_rules('profession','Profession','required|max_length[30]'); $this->form_validation->set_rules('profession','Profession','required|max_length[30]');
$this->form_validation->set_rules('phone_number','Phone number','required|max_length[30]'); $this->form_validation->set_rules('phone_number','Phone number','required|max_length[30]');
$this->form_validation->set_rules('inpImage','Image ','required');
if($this->form_validation->run()==FALSE){ if($this->form_validation->run()==FALSE){
$data['countries'] = $this->User_model->getAllCountries(); $data['countries'] = $this->User_model->getAllCountries();
...@@ -82,8 +81,6 @@ ...@@ -82,8 +81,6 @@
} }
else{ else{
$verification_key = md5(rand());
$data['firstname'] = $this->input->post('firstname'); $data['firstname'] = $this->input->post('firstname');
$data['lastname'] = $this->input->post('lastname'); $data['lastname'] = $this->input->post('lastname');
$data['worker_name'] = $this->input->post('worker_name'); $data['worker_name'] = $this->input->post('worker_name');
...@@ -96,9 +93,7 @@ ...@@ -96,9 +93,7 @@
$data['proffesion'] = $this->input->post('profession'); $data['proffesion'] = $this->input->post('profession');
$data['phone_number'] = $this->input->post('phone_number'); $data['phone_number'] = $this->input->post('phone_number');
$data['image'] = $this->input->post('inpImage'); $this->Worker_model->insertWorker($data);
$id = $this->Worker_model->insertWorker($data);
$array['apartments'] = $this->Apartment_model->getAllApartments(); $array['apartments'] = $this->Apartment_model->getAllApartments();
......
...@@ -34,7 +34,6 @@ class Worker_model extends CI_Model{ ...@@ -34,7 +34,6 @@ class Worker_model extends CI_Model{
public function insertWorker($data) public function insertWorker($data)
{ {
$this->db->insert('worker',$data); $this->db->insert('worker',$data);
return $this->db->insert_id();
} }
public function authenticatePassword($username,$passwordLogin) public function authenticatePassword($username,$passwordLogin)
......
...@@ -56,6 +56,20 @@ ...@@ -56,6 +56,20 @@
} }
} }
?> ?>
<?php
if(isset($_SESSION['logged_in']))
{
if ($_SESSION['logged_in']['acl'] == 1) {
?>
<li>
<a href="<?php echo base_url();?>worker/workerSignup">Add New Worker</a>
</li>
<?php
}
}
?>
<?php <?php
if(isset($_SESSION['logged_in'])) if(isset($_SESSION['logged_in']))
...@@ -178,6 +192,7 @@ ...@@ -178,6 +192,7 @@
?> ?>
<form method="post" action="<?php echo base_url();?>activity/deleteActivity"> <form method="post" action="<?php echo base_url();?>activity/deleteActivity">
<div class="container-fluid bg-grey"> <div class="container-fluid bg-grey">
<h6><?php foreach ($activities as $activity) { <h6><?php foreach ($activities as $activity) {
echo '<img src="data:image/jpeg;base64,'.base64_encode($activity['image']).'" width = "100px" alt = "image"> '; echo '<img src="data:image/jpeg;base64,'.base64_encode($activity['image']).'" width = "100px" alt = "image"> ';
...@@ -197,7 +212,7 @@ ...@@ -197,7 +212,7 @@
</div> </div>
</form> </form>
<h6><form action="<?php echo base_url();?>activity/addNewActivity?>" method="post"> <h6><form action="<?php echo base_url();?>activity/addNewActivity?>" method="post">
<input type="submit" name="addNewActivity" value="Add new activity"> <input type="submit" name="addNewActivity" value="Add new activity">
...@@ -206,6 +221,6 @@ ...@@ -206,6 +221,6 @@
} }
} }
?> ?>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
<input class="form-control" id="datetime" type="datetime-local" min="<?php echo date('Y-m-d'); ?>T00:00" name="datetime"> <input class="form-control" id="datetime" type="datetime-local" min="<?php echo date('Y-m-d'); ?>T00:00" name="datetime">
<div class="errors"><?php echo form_error('datetime'); ?></div> <div class="errors"><?php echo form_error('datetime'); ?></div>
<br> <br>
<center>
<div ><?php echo form_error('inpImage'); ?></div> <div ><?php echo form_error('inpImage'); ?></div>
<div > <div >
...@@ -128,6 +128,7 @@ ...@@ -128,6 +128,7 @@
<input class="chooseFile" type="file" name="inpImage" id="inpImage" > <input class="chooseFile" type="file" name="inpImage" id="inpImage" >
</div> </div>
</center>
<script> <script>
const inpImage = document.getElementById("inpImage"); const inpImage = document.getElementById("inpImage");
......
...@@ -141,6 +141,7 @@ ...@@ -141,6 +141,7 @@
<div class="errors"><?php echo form_error('email'); ?></div> <div class="errors"><?php echo form_error('email'); ?></div>
<br> <br>
<center>
<div ><?php echo form_error('inpImage'); ?></div> <div ><?php echo form_error('inpImage'); ?></div>
<div > <div >
...@@ -152,7 +153,7 @@ ...@@ -152,7 +153,7 @@
<input type="file" name="inpImage" id="inpImage"> <input type="file" name="inpImage" id="inpImage">
</div> </div>
</center>
<script> <script>
const inpImage = document.getElementById("inpImage"); const inpImage = document.getElementById("inpImage");
const previewContainer = document.getElementById("imagePreview"); const previewContainer = document.getElementById("imagePreview");
......
...@@ -182,11 +182,12 @@ ...@@ -182,11 +182,12 @@
if ($_SESSION['logged_in']['acl'] == 1) { if ($_SESSION['logged_in']['acl'] == 1) {
?> ?>
<div class="row text-center">
<div class="col-sm-4"> <div class="row text-center" style="margin-left: 25%">
<div class="col-sm-8">
<div class="thumbnail"> <div class="thumbnail">
<form action="<?php echo base_url();?>pages/deleteApartment" method="post"> <form action="<?php echo base_url();?>pages/deleteApartment" method="post">
<center>
<?php foreach ($apartments as $apartment) { <?php foreach ($apartments as $apartment) {
?> ?>
<?php echo '<img src="data:image/jpeg;base64,'.base64_encode($apartment['image']).'" alt = "image"> '; <?php echo '<img src="data:image/jpeg;base64,'.base64_encode($apartment['image']).'" alt = "image"> ';
...@@ -197,6 +198,7 @@ ...@@ -197,6 +198,7 @@
?> ?>
<?php <?php
} ?> } ?>
</center>
</form> </form>
...@@ -216,6 +218,7 @@ ...@@ -216,6 +218,7 @@
</div> </div>
</div> </div>
<!-- Rooms: user logged in --> <!-- Rooms: user logged in -->
<?php <?php
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<body> <body>
<br> <br>
<?php echo '<img src="data:image/jpeg;base64,'.base64_encode($activity['image']).'" width = "100px" alt = "image"> '; <?php echo '<img src="data:image/jpeg;base64,'.base64_encode($activity['image']).'" width = "300px" alt = "image"> ';
?> ?>
<br> <br>
......
...@@ -2,16 +2,22 @@ ...@@ -2,16 +2,22 @@
<html> <html>
<head> <head>
<title></title> <title></title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/home1.css">
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/bootstrap.min.css"> <style>
.fakeimg {
height: 200px;
background: #aaa;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
</head> </head>
<body> <body>
<nav> <nav>
...@@ -20,56 +26,72 @@ ...@@ -20,56 +26,72 @@
</a> </a>
</nav> </nav>
<br> <br>
<center>
<br> <br>
<br> <br>
<h1>Worker profile</h1>
<br>
<?php echo '<img src="data:image/jpeg;base64,'.base64_encode($profileInfo['image']).'" width = "100px" alt = "image"> ';
?>
<div class="container" style="margin-top:30px ; color: #21d5ed">
<h3>Worker profile</h3>
</div>
<div class="container" style="margin-top:30px">
<div class="row">
<div class="col-sm-4">
<h5>Profile photo:</h5>
<div class="fakeimg">Fake Image</div>
</div>
<div class="col-sm-8">
<br> <br>
<label>First name:</label> <label>First name:</label>
<br>
<input type="text" name="firstname" disabled="true" value="<?php <input type="text" name="firstname" disabled="true" value="<?php
echo $profileInfo['firstname']; echo $profileInfo['firstname'];
?>" > ?>" >
<br> <br>
<label>Last name:</label> <label>Last name:</label>
<br>
<input type="text" name="firstname" disabled="true" value="<?php <input type="text" name="firstname" disabled="true" value="<?php
echo $profileInfo['lastname']; echo $profileInfo['lastname'];
?>" > ?>" >
<br> <br>
<label>Worker name:</label> <label>Worker name:</label>
<br>
<input type="text" name="firstname" disabled="true" value="<?php <input type="text" name="firstname" disabled="true" value="<?php
echo $profileInfo['worker_name']; echo $profileInfo['worker_name'];
?>" > ?>" >
<br> <br>
<label>Email:</label> <label>Email:</label>
<br>
<input type="text" name="firstname" disabled="true" value="<?php <input type="text" name="firstname" disabled="true" value="<?php
echo $profileInfo['email']; echo $profileInfo['email'];
?>" > ?>" >
<br> <br>
<label>Date of birth:</label> <label>Date of birth:</label>
<br>
<input type="date" name="firstname" disabled="true" value="<?php <input type="date" name="firstname" disabled="true" value="<?php
echo $profileInfo['date_of_birth']; echo $profileInfo['date_of_birth'];
?>" > ?>" >
<br> <br>
<label>Proffesion:</label> <label>Proffesion:</label>
<br>
<input type="text" name="firstname" disabled="true" value="<?php <input type="text" name="firstname" disabled="true" value="<?php
echo $profileInfo['proffesion']; echo $profileInfo['proffesion'];
?>" > ?>" >
<br> <br>
<label>Phone number:</label> <label>Phone number:</label>
<br>
<input type="text" name="firstname" disabled="true" value="<?php <input type="text" name="firstname" disabled="true" value="<?php
echo $profileInfo['phone_number']; echo $profileInfo['phone_number'];
?>" > ?>" >
<br> <br>
</center> </div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -2,38 +2,39 @@ ...@@ -2,38 +2,39 @@
<html> <html>
<head> <head>
<title></title> <title></title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/workerRegistration.css"> <link rel="stylesheet" href="<?php echo base_url();?>assets/css/workerRegistration.css">
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/home1.css">
</head> </head>
<body> <body>
Complete the registration to register as a worker and wait for confirmation <center>
<h5>Complete the registration to register a new worker </h5>
<br> <br>
<div> <div>
<form method="post" action="<?php echo base_url();?>worker/workerSignup"> <form method="post" action="<?php echo base_url();?>worker/workerSignup">
<br> <br>
<label>First name:</label>
<label class="workerRegistration">First name:</label>
<br> <br>
<input type="text" name="firstname" placeholder="Firstname"> <input type="text" name="firstname" placeholder="Firstname">
<div class="errors"><?php echo form_error('firstname'); ?></div> <div class="errors"><?php echo form_error('firstname'); ?></div>
<br> <br>
<label>Last name:</label> <label>Last name:</label>
<br> <br>
<input type="text" name="lastname" placeholder="Lastname"> <input type="text" name="lastname" placeholder="Lastname">
<div class="errors"><?php echo form_error('lastname'); ?></div> <div class="errors"><?php echo form_error('lastname'); ?></div>
<br> <br>
<label>BIRTH DATE:</label> <label>BIRTH DATE:</label>
<br> <br>
<input type="Date" id="datefield" min="1899-01-01" max="<?php echo date('Y-m-d'); ?>" name="dateofbirth" placeholder="Birth date" > <input type="Date" id="datefield" min="1899-01-01" max="<?php echo date('Y-m-d'); ?>" name="dateofbirth" placeholder="Birth date" >
...@@ -74,7 +75,7 @@ ...@@ -74,7 +75,7 @@
<div class="errors"> <?php echo form_error('email'); ?></div> <div class="errors"> <?php echo form_error('email'); ?></div>
<br> <br>
<label>Select your country</label> <label>Select your country </label><br>
<select name="selectCountry"> <select name="selectCountry">
<option selected="">Country</option> <option selected="">Country</option>
<?php <?php
...@@ -106,53 +107,12 @@ ...@@ -106,53 +107,12 @@
<div class="errors"><?php echo form_error('phone_number'); ?></div> <div class="errors"><?php echo form_error('phone_number'); ?></div>
<br> <br>
<label>Choose your profile image</label>
<br>
<div class="errors"><?php echo form_error('inpImage'); ?></div>
<div class="box2">
<div class="imagePreview" id="imagePreview">
<img src="" alt="Image preview" class="image-preview__image">
<span class="image-preview__default-text">Image preview </span>
</div>
<br>
<input class="chooseFile" type="File" name="inpImage" id="inpImage" accept="image/*">
</div>
<script>
const inpImage = document.getElementById("inpImage");
const previewContainer = document.getElementById("imagePreview");
const previewImage = previewContainer.querySelector(".image-preview__image");
const previewDefaultText = previewContainer.querySelector(".image-preview__default-text");
inpImage.addEventListener("change",function(){
const file = this.files[0];
if(file)
{
const reader = new FileReader();
previewDefaultText.style.display = "none";
previewImage.style.display= "block";
reader.addEventListener("load",function(){
previewImage.setAttribute("src",this.result);
});
reader.readAsDataURL(file);
}else{
previewDefaultText.style.display = null;
previewImage.style.display= null;
previewImage.setAttribute("src","");
}
});
</script>
<br> <br>
<input id="btn_signup_worker" type="submit" name="signup-submit"> <input id="btn_signup_worker" type="submit" name="signup-submit">
</form> </form>
</div> </div>
</center>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment