Skip to content

Commit

Permalink
Merge pull request #94 from NUTFes/feature/imai/93-show-shift-detail
Browse files Browse the repository at this point in the history
[Feature]シフトの詳細をダイアログで表示(#93)
  • Loading branch information
mashita1023 authored Sep 7, 2022
2 parents 4d83429 + fa5d481 commit 241118f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 31 deletions.
19 changes: 5 additions & 14 deletions lib/utils/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class Api {

// 準備日雨シフト
Future getMyShiftPreparationDayRainy(id) async {
String url = constant.apiUrl + '/shifts/users/' + id + '/dates/1/weathers/2';
// String url = constant.apiUrl + '/shifts/users/' + id + '/dates/1/weathers/2';
String url = constant.apiUrl + '/shifts/users/' + id + '/dates/1/weathers/1';
try {
return await get(url);
} catch (err) {
Expand Down Expand Up @@ -206,20 +207,10 @@ class Api {

// Get Shift Detail
Future shiftDetail(workId, userId, date, weather, time) async {
logger.w(time);
var url = constant.apiUrl +
"/work/" +
workId.toString() +
"/" +
userId.toString() +
"/" +
date +
"/" +
weather +
"/" +
time;
logger.w(url);
// logger.w(time);
var url = constant.apiUrl + "/tasks/shifts/" + workId.toString();
try {
logger.i(url);
var res = await get(url);
logger.i(res);
return await get(url);
Expand Down
32 changes: 17 additions & 15 deletions lib/widgets/shift_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:seeft_mobile/configs/importer.dart';
import 'package:url_launcher/url_launcher.dart';

getShiftDetail(workId, userId, date, weather, time) async {
// 本当は引数はworkIdだけでいいが、今後ほかの要素を使うことも考えてそのままに
try {
logger.w(workId);
var res = await api.shiftDetail(workId, userId, date, weather, time);
Expand All @@ -22,11 +23,11 @@ openShiftDialog(
BuildContext context, workId, userId, date, weather, time) async {
var res = await getShiftDetail(workId, userId, date, weather, time);
logger.i(res);
var resName = res["Name"];
var resURL = res["URL"];
var resUsers = res["Users"];
var resPlace = res["Place"];
var resPresident = res["President"];
var resName = res["task"];
var resURL = res["url"];
var resUsers = res["users"];
var resPlace = res["place"];
var resPresident = res["superviser"];
var resPresidentTel = res["TEL"];
showDialog(
context: context,
Expand Down Expand Up @@ -58,16 +59,17 @@ openShiftDialog(
title: Text("集合場所"),
subtitle: Text(resPlace),
),
ListTile(
leading: Icon(Icons.supervisor_account_outlined),
title: Text("代表者"),
subtitle: Text(resPresident),
),
ListTile(
leading: Icon(Icons.phone),
title: Text("緊急時連絡先"),
subtitle: Text(resPresidentTel),
),
// 今回はいらないので一時的にコメントアウト
// ListTile(
// leading: Icon(Icons.supervisor_account_outlined),
// title: Text("代表者"),
// subtitle: Text(resPresident),
// ),
// ListTile(
// leading: Icon(Icons.phone),
// title: Text("緊急時連絡先"),
// subtitle: Text(resPresidentTel),
// ),
ListTile(
leading: Icon(Icons.group),
title: Text("メンバー"),
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class ShiftTable {
child: InkWell(
splashColor: Colors.orangeAccent,
onTap: () async {
if (shifts[index]["task"] != "") {
logger.i(shifts[index]["task"]);
if (shifts[index]["task"]["task"] != "") {
logger.i(shifts[index]["task"]["task"]);
await openShiftDialog(
context,
shifts[index]["task"]["id"],
Expand Down

0 comments on commit 241118f

Please sign in to comment.