Skip to content

Commit

Permalink
Raspored ima dane na dnu i dodatni stupac za vrijeme. CSS preimenovan…
Browse files Browse the repository at this point in the history
… kako bi se azurirao.
  • Loading branch information
Firtzberg committed Mar 30, 2018
1 parent 2664ba4 commit aa123cd
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 28 deletions.
45 changes: 21 additions & 24 deletions app/libraries/Raspored.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class Raspored {
* gets a raspored column with hours
* @return string
*/
public static function HoursColumn($widthPercent) {
$response = '<div style="width:'.$widthPercent.'%;">';
public static function HoursColumn($left) {
$response = '<div class = "raspored-time col-lg-1 col-md-1 col-sm-2 col-xs-3'.($left?'':' hidden-xs').'">';
$response .= '<div class = "raspored-heading">Vrijeme</div>';
for ($hour = \BaseController::START_HOUR; $hour < \BaseController::END_HOUR; $hour++) {
$response .= '<div class = "raspored-vrijeme" style="height:' .
Expand Down Expand Up @@ -154,24 +154,22 @@ private static function RezervacijeForUserInWeek($djelatnik, $week, $year) {
* @return string
*/
public static function RasporedForUserInWeek($user_id, $week, $year) {
$count = 8;
$count = 7;
$widthPercent = 100/$count;
$response = '<div class = "raspored">';
$response .= '<div class = "raspored-scroller">';
$response = '<div class = "raspored container-fluid"><div class = "row">';
$response .= self::HoursColumn(true);
$response .= '<div class = "raspored-scroller col-lg-10 col-md-10 col-sm-8 col-xs-9">';
$response .= '<div style="min-width:'.($count*self::MIN_COLUMN_WIGHT).'px;">';
$response .= self::HoursColumn($widthPercent/2);
foreach (self::RezervacijeForUserInWeek(\User::find($user_id), $week, $year) as $dayNumber => $blocks) {
$response .= '<div style="width:'.$widthPercent.'%;">';
$response .= self::DayHeading($dayNumber, $blocks['formatedDate']);
$response .= self::Blocks2HTML($blocks);
$response .= self::DayHeading($dayNumber, $blocks['formatedDate']);
$response .= '</div>';
if ($dayNumber == 5) {
$response .= self::HoursColumn($widthPercent / 2);
}
}
$response .= '</div></div>';
$response .= '</div>';
$response .= self::HoursColumn(false);
$response .= '</div></div>';
return $response;
}

Expand Down Expand Up @@ -231,24 +229,22 @@ private static function RezervacijeForUcionicaInWeek($ucionicaId, $week, $year)
* @return string
*/
public static function RasporedForUcionicaInWeek($ucionicaId, $week, $year) {
$count = 8;
$count = 7;
$widthPercent = 100/$count;
$response = '<div class = "raspored">';
$response .= '<div class = "raspored-scroller">';
$response = '<div class = "raspored container-fluid"><div class = "row">';
$response .= self::HoursColumn(true);
$response .= '<div class = "raspored-scroller col-lg-10 col-md-10 col-sm-8 col-xs-9">';
$response .= '<div style="min-width:'.($count*self::MIN_COLUMN_WIGHT).'px;">';
$response .= self::HoursColumn($widthPercent/2);
foreach (self::RezervacijeForUcionicaInWeek($ucionicaId, $week, $year) as $dayNumber => $blocks) {
$response .= '<div style="width:'.$widthPercent.'%;">';
$response .= self::DayHeading($dayNumber, $blocks['formatedDate']);
$response .= self::Blocks2HTML($blocks);
$response .= self::DayHeading($dayNumber, $blocks['formatedDate']);
$response .= '</div>';
if ($dayNumber == 5) {
$response .= self::HoursColumn($widthPercent / 2);
}
}
$response .= '</div></div>';
$response .= '</div>';
$response .= self::HoursColumn(false);
$response .= '</div></div>';
return $response;
}

Expand Down Expand Up @@ -308,15 +304,16 @@ private static function RezervacijeForDay($day, $week, $year) {
*/
public static function RasporedForDay($day, $week, $year) {
$rezervacije = self::RezervacijeForDay($day, $week, $year);
$count = count($rezervacije)+1;
$count = count($rezervacije);
$widthPercent = 100/$count;
$response = '<div class = "raspored">';
$response = '<div class = "raspored container-fluid">';
$dto = new \DateTime();
$dto->setISODate($year, $week, $day);
$response .= '<p>'.self::$dani[$day].', '.$dto->format('d.m.Y').'</p>';
$response .= '<div class = "raspored-scroller">';
$response .= '<div class = "row">';
$response .= self::HoursColumn(true);
$response .= '<div class = "raspored-scroller col-lg-10 col-md-10 col-sm-8 col-xs-9">';
$response .= '<div style="min-width:'.($count*self::MIN_COLUMN_WIGHT).'px;">';
$response .= self::HoursColumn($widthPercent/2);
foreach ($rezervacije as $blocks) {
$response .= '<div class = "raspored-column" style="width:'.$widthPercent.'%">';
if (isset($blocks['ucionica'])) {
Expand All @@ -334,9 +331,9 @@ public static function RasporedForDay($day, $week, $year) {
}
$response .= '</div>';
}
$response .= self::HoursColumn($widthPercent/2);
$response .= '</div></div>';
$response .= '</div>';
$response .= self::HoursColumn(false);
$response .= '</div></div>';
return $response;
}

Expand Down
Empty file modified app/storage/.gitignore
100644 → 100755
Empty file.
Empty file modified app/storage/cache/.gitignore
100644 → 100755
Empty file.
Empty file modified app/storage/logs/.gitignore
100644 → 100755
Empty file.
Empty file modified app/storage/meta/.gitignore
100644 → 100755
Empty file.
Empty file modified app/storage/sessions/.gitignore
100644 → 100755
Empty file.
Empty file modified app/storage/views/.gitignore
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion app/views/Djelatnik/show.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@extends('layouts.master')

@section('heading')
{{ HTML::style('css/raspored.css') }}
{{ HTML::style('css/raspored1.css') }}
@endsection

@section('title')
Expand Down
2 changes: 1 addition & 1 deletion app/views/Ucionica/show.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@extends('layouts.master')

@section('heading')
{{ HTML::style('css/raspored.css') }}
{{ HTML::style('css/raspored1.css') }}
@endsection

@section('title')
Expand Down
2 changes: 1 addition & 1 deletion app/views/home.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@extends('layouts.master')

@section('heading')
{{ HTML::style('css/raspored.css') }}
{{ HTML::style('css/raspored1.css') }}
@endsection

@section('title')
Expand Down
11 changes: 10 additions & 1 deletion css/raspored.css → css/raspored1.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,27 @@ div.raspored > p {
}

div.raspored-scroller {
width: 100%;
overflow-x: auto;
overflow-y: hidden;
}
div.raspored-scroller > div {
width: 100%;
margin: 0;
padding: 0;
overflow-x: visible;
}
div.raspored-scroller > div > div {
float: left;
margin: 0;
}

div.raspored-time {
overflow: hidden;
padding: 0;
margin: 0;
text-align: center;
}

div.raspored-blocks{
position: relative;
}
Expand Down

0 comments on commit aa123cd

Please sign in to comment.