diff --git a/assets/global/scripts/components-date-time-pickers.js b/assets/global/scripts/components-date-time-pickers.js
new file mode 100755
index 0000000..0a8f637
--- /dev/null
+++ b/assets/global/scripts/components-date-time-pickers.js
@@ -0,0 +1,249 @@
+var ComponentsDateTimePickers = function () {
+
+ var handleDatePickers = function () {
+
+ if (jQuery().datepicker) {
+ $('.date-picker').datepicker({
+ rtl: App.isRTL(),
+ orientation: "left",
+ autoclose: true
+ });
+ //$('body').removeClass("modal-open"); // fix bug when inline picker is used in modal
+ }
+
+ /* Workaround to restrict daterange past date select: http://stackoverflow.com/questions/11933173/how-to-restrict-the-selectable-date-ranges-in-bootstrap-datepicker */
+
+ // Workaround to fix datepicker position on window scroll
+ $( document ).scroll(function(){
+ $('#form_modal2 .date-picker').datepicker('place'); //#modal is the id of the modal
+ });
+ }
+
+ var handleTimePickers = function () {
+
+ if (jQuery().timepicker) {
+ $('.timepicker-default').timepicker({
+ autoclose: true,
+ showSeconds: true,
+ minuteStep: 1
+ });
+
+ $('.timepicker-no-seconds').timepicker({
+ autoclose: true,
+ minuteStep: 5,
+ defaultTime: false
+ });
+
+ $('.timepicker-24').timepicker({
+ autoclose: true,
+ minuteStep: 5,
+ showSeconds: false,
+ showMeridian: false
+ });
+
+ // handle input group button click
+ $('.timepicker').parent('.input-group').on('click', '.input-group-btn', function(e){
+ e.preventDefault();
+ $(this).parent('.input-group').find('.timepicker').timepicker('showWidget');
+ });
+
+ // Workaround to fix timepicker position on window scroll
+ $( document ).scroll(function(){
+ $('#form_modal4 .timepicker-default, #form_modal4 .timepicker-no-seconds, #form_modal4 .timepicker-24').timepicker('place'); //#modal is the id of the modal
+ });
+ }
+ }
+
+ var handleDateRangePickers = function () {
+ if (!jQuery().daterangepicker) {
+ return;
+ }
+
+ $('#defaultrange').daterangepicker({
+ opens: (App.isRTL() ? 'left' : 'right'),
+ format: 'MM/DD/YYYY',
+ separator: ' to ',
+ startDate: moment().subtract('days', 29),
+ endDate: moment(),
+ ranges: {
+ 'Today': [moment(), moment()],
+ 'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
+ 'Last 7 Days': [moment().subtract('days', 6), moment()],
+ 'Last 30 Days': [moment().subtract('days', 29), moment()],
+ 'This Month': [moment().startOf('month'), moment().endOf('month')],
+ 'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
+ },
+ minDate: '01/01/2012',
+ maxDate: '12/31/2018',
+ },
+ function (start, end) {
+ $('#defaultrange input').val(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
+ }
+ );
+
+ $('#defaultrange_modal').daterangepicker({
+ opens: (App.isRTL() ? 'left' : 'right'),
+ format: 'MM/DD/YYYY',
+ separator: ' to ',
+ startDate: moment().subtract('days', 29),
+ endDate: moment(),
+ minDate: '01/01/2012',
+ maxDate: '12/31/2018',
+ },
+ function (start, end) {
+ $('#defaultrange_modal input').val(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
+ }
+ );
+
+ // this is very important fix when daterangepicker is used in modal. in modal when daterange picker is opened and mouse clicked anywhere bootstrap modal removes the modal-open class from the body element.
+ // so the below code will fix this issue.
+ $('#defaultrange_modal').on('click', function(){
+ if ($('#daterangepicker_modal').is(":visible") && $('body').hasClass("modal-open") == false) {
+ $('body').addClass("modal-open");
+ }
+ });
+
+ $('#reportrange').daterangepicker({
+ opens: (App.isRTL() ? 'left' : 'right'),
+ startDate: moment().subtract('days', 29),
+ endDate: moment(),
+ //minDate: '01/01/2012',
+ //maxDate: '12/31/2014',
+ dateLimit: {
+ days: 60
+ },
+ showDropdowns: true,
+ showWeekNumbers: true,
+ timePicker: false,
+ timePickerIncrement: 1,
+ timePicker12Hour: true,
+ ranges: {
+ 'Today': [moment(), moment()],
+ 'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
+ 'Last 7 Days': [moment().subtract('days', 6), moment()],
+ 'Last 30 Days': [moment().subtract('days', 29), moment()],
+ 'This Month': [moment().startOf('month'), moment().endOf('month')],
+ 'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
+ },
+ buttonClasses: ['btn'],
+ applyClass: 'green',
+ cancelClass: 'default',
+ format: 'MM/DD/YYYY',
+ separator: ' to ',
+ locale: {
+ applyLabel: 'Apply',
+ fromLabel: 'From',
+ toLabel: 'To',
+ customRangeLabel: 'Custom Range',
+ daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
+ monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ firstDay: 1
+ }
+ },
+ function (start, end) {
+ $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
+ }
+ );
+ //Set the initial state of the picker label
+ $('#reportrange span').html(moment().subtract('days', 29).format('MMMM D, YYYY') + ' - ' + moment().format('MMMM D, YYYY'));
+ }
+
+ var handleDatetimePicker = function () {
+
+ if (!jQuery().datetimepicker) {
+ return;
+ }
+
+ $(".form_datetime").datetimepicker({
+ autoclose: true,
+ isRTL: App.isRTL(),
+ format: "yyyy-mm-dd hh:ii",
+ fontAwesome: true,
+ pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left")
+ });
+
+ $(".form_advance_datetime").datetimepicker({
+ isRTL: App.isRTL(),
+ format: "dd MM yyyy - hh:ii",
+ autoclose: true,
+ todayBtn: true,
+ fontAwesome: true,
+ startDate: "2013-02-14 10:00",
+ pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left"),
+ minuteStep: 10
+ });
+
+ $(".form_meridian_datetime").datetimepicker({
+ isRTL: App.isRTL(),
+ format: "dd MM yyyy - HH:ii P",
+ showMeridian: true,
+ autoclose: true,
+ fontAwesome: true,
+ pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left"),
+ todayBtn: true
+ });
+
+ $('body').removeClass("modal-open"); // fix bug when inline picker is used in modal
+
+ // Workaround to fix datetimepicker position on window scroll
+ $( document ).scroll(function(){
+ $('#form_modal1 .form_datetime, #form_modal1 .form_advance_datetime, #form_modal1 .form_meridian_datetime').datetimepicker('place'); //#modal is the id of the modal
+ });
+ }
+
+ var handleClockfaceTimePickers = function () {
+
+ if (!jQuery().clockface) {
+ return;
+ }
+
+ $('.clockface_1').clockface();
+
+ $('#clockface_2').clockface({
+ format: 'HH:mm',
+ trigger: 'manual'
+ });
+
+ $('#clockface_2_toggle').click(function (e) {
+ e.stopPropagation();
+ $('#clockface_2').clockface('toggle');
+ });
+
+ $('#clockface_2_modal').clockface({
+ format: 'HH:mm',
+ trigger: 'manual'
+ });
+
+ $('#clockface_2_modal_toggle').click(function (e) {
+ e.stopPropagation();
+ $('#clockface_2_modal').clockface('toggle');
+ });
+
+ $('.clockface_3').clockface({
+ format: 'H:mm'
+ }).clockface('show', '14:30');
+
+ // Workaround to fix clockface position on window scroll
+ $( document ).scroll(function(){
+ $('#form_modal5 .clockface_1, #form_modal5 #clockface_2_modal').clockface('place'); //#modal is the id of the modal
+ });
+ }
+
+ return {
+ //main function to initiate the module
+ init: function () {
+ handleDatePickers();
+ handleTimePickers();
+ handleDatetimePicker();
+ handleDateRangePickers();
+ handleClockfaceTimePickers();
+ }
+ };
+
+}();
+
+if (App.isAngularJsApp() === false) {
+ jQuery(document).ready(function() {
+ ComponentsDateTimePickers.init();
+ });
+}
\ No newline at end of file
diff --git a/assets/layouts/layout/img/logo-big-white.png b/assets/layouts/layout/img/font
similarity index 100%
rename from assets/layouts/layout/img/logo-big-white.png
rename to assets/layouts/layout/img/font
diff --git a/assets/modul-js/arrangements/warehouse-arrangement/create.js b/assets/modul-js/arrangements/warehouse-arrangement/create.js
index 277118e..bc625c5 100755
--- a/assets/modul-js/arrangements/warehouse-arrangement/create.js
+++ b/assets/modul-js/arrangements/warehouse-arrangement/create.js
@@ -1,4 +1,12 @@
$('#decision_request').find('.submit').show();
+function toggleCheckbox(element)
+{
+ if(element.checked == true){
+ $('#decision_request_title').text("Unmatched Quantity & Damaged");
+ }else{
+ $('#decision_request_title').text("Unmatched Quantity");
+ }
+}
var FormWizard = function () {
@@ -9,22 +17,7 @@ var FormWizard = function () {
return;
}
- function format(state) {
- if (!state.id) return state.text; // optgroup
- return "
" + state.text;
- }
-
- $("#country_list").select2({
- placeholder: "Select",
- allowClear: true,
- formatResult: format,
- width: 'auto',
- formatSelection: format,
- escapeMarkup: function (m) {
- return m;
- }
- });
-
+
var form = $('#submit_form');
var error = $('.alert-danger', form);
var success = $('.alert-success', form);
@@ -183,6 +176,7 @@ var FormWizard = function () {
});
$('#form_wizard_1').find('.button-previous').hide();
+
$('#form_wizard_1 .button-submit').click(function () {
var dataString = $('#submit_form').serialize() + '&submit_type=no_decision_request';
$.ajax({
diff --git a/assets/modul-js/common/dashboard/dashboard.so.js b/assets/modul-js/common/dashboard/dashboard.so.js
index 083f284..73ae66a 100755
--- a/assets/modul-js/common/dashboard/dashboard.so.js
+++ b/assets/modul-js/common/dashboard/dashboard.so.js
@@ -6,7 +6,7 @@
"type": "POST",
},
"columnDefs": [
- { className: "dt-body-center", "targets": [ 0,1,2,3,4,5,6,7,8,9,10,11 ] },
+ { className: "dt-body-center", "targets": [ 0,1,2,3,4,5,6,7,8,9,10 ] },
],
"language": {
diff --git a/assets/modul-js/common/dashboard/dashboard.so.min.js b/assets/modul-js/common/dashboard/dashboard.so.min.js
index 083f284..73ae66a 100755
--- a/assets/modul-js/common/dashboard/dashboard.so.min.js
+++ b/assets/modul-js/common/dashboard/dashboard.so.min.js
@@ -6,7 +6,7 @@
"type": "POST",
},
"columnDefs": [
- { className: "dt-body-center", "targets": [ 0,1,2,3,4,5,6,7,8,9,10,11 ] },
+ { className: "dt-body-center", "targets": [ 0,1,2,3,4,5,6,7,8,9,10 ] },
],
"language": {
diff --git a/assets/modul-js/common/messenger/order.min.js b/assets/modul-js/common/messenger/order.min.js
index ea5d907..bf3fac3 100755
--- a/assets/modul-js/common/messenger/order.min.js
+++ b/assets/modul-js/common/messenger/order.min.js
@@ -33,7 +33,7 @@ jQuery(document).ready(function() {
});
$(document).on("click", "#form-decision-request .decision-yes", function() {
- var message_id = $('.warehouse-arrangement').data('message_id');
+ var message_id = $(this).data('message_id');
var decision = "1";
var dataStringg = 'decision=' + decision + '&message_id=' + message_id;
$.ajax({
@@ -47,23 +47,9 @@ jQuery(document).ready(function() {
});
});
- $(document).on("click", "#form-delivery-request .decision-yes", function() {
- var message_id = $('.warehouse-arrangement').data('message_id');
- var decision = "1";
- var dataStringg = 'decision=' + decision + '&message_id=' + message_id;
- $.ajax({
- type: "POST",
- url: "/messenger/order/decision-request-update",
- cache: false,
- data: dataStringg,
- success: function(data) {
- location.reload();
- }
- });
-
- });
- $(document).on("click", ".decision-no", function() {
- var message_id = $('.warehouse-arrangement').data('message_id');
+
+ $(document).on("click", "form-decision-request .decision-no", function() {
+ var message_id = $(this).data('message_id');
var decision = "2";
var dataStringg = 'decision=' + decision + '&message_id=' + message_id;
$.ajax({
@@ -77,11 +63,52 @@ jQuery(document).ready(function() {
});
});
+
+ $(document).on("click", "#form-delivery-request .decision-yes", function() {
+ var message_id = $(this).data('message_id');
+ var decision = "1";
+ var id = $(this).data('id');
+ var dataStringg = 'decision=' + decision + '&message_id=' + message_id + '&id=' + id;
+ $.ajax({
+ type: "POST",
+ url: "/messenger/order/decision-request-update",
+ cache: false,
+ data: dataStringg,
+ success: function(data) {
+ location.reload();
+ }
+ });
+
+ });
+ $(document).on("click", "#form-delivery-request .decision-no", function() {
+ jQuery("#delivery-request-details").modal('hide');
+ jQuery("#form_decision_reject").modal('show');
+ });
+ $(document).on("click", "#decision_reject .submit", function() {
+ var message_id = $(this).data('message_id');
+ var id = $(this).data('id');
+ var decision = "2";
+ var reason = $('#decision_reject').data('id');
+ var dataStringg = $('#decision_reject').serialize() + '&decision=' + decision + '&message_id=' + message_id + '&id=' + id;
+ $.ajax({
+ type: "POST",
+ url: "/messenger/order/decision-request-update",
+ cache: false,
+ data: dataStringg,
+ success: function(data) {
+ location.reload();
+ }
+ });
+ });
$(document).on("click", ".decision-request-details", function() {
var group_id = $('#chats').data('group_id');
var decision = $(this).data('decision');
var id = $(this).data('id');
var message_id = $(this).data('message_id');
+ $('#form-decision-request .decision-no').attr('data-id', id);
+ $('#form-decision-request .decision-no').attr('data-message_id', message_id);
+ $('#form-decision-request .decision-yes').attr('data-id', id);
+ $('#form-decision-request .decision-yes').attr('data-message_id', message_id);
if(group_id == 1){
if(decision == 1){
$('#decision-request-action').html("Your importer have agree to accept this decision request");
@@ -113,8 +140,15 @@ jQuery(document).ready(function() {
var decision = $(this).data('decision');
var id = $(this).data('id');
var message_id = $(this).data('message_id');
+ $('#decision_reject .submit').attr('data-id', id);
+ $('#decision_reject .submit').attr('data-message_id', message_id);
+ $('#form-delivery-request .decision-no').attr('data-id', id);
+ $('#form-delivery-request .decision-no').attr('data-message_id', message_id);
+ $('#form-delivery-request .decision-yes').attr('data-id', id);
+ $('#form-delivery-request .decision-yes').attr('data-message_id', message_id);
if(group_id == 1){
if(decision == 1){
+
$('#delivery-request-action').html("Your importer have agree to accept this decision request");
}else if(decision == 2){
$('#delivery-request-action').html("Your importer have agree to decline this decision request");
diff --git a/assets/modul-js/orders/shipping-order/create.min.js b/assets/modul-js/orders/shipping-order/create.min.js
index 45e7eed..598f9dc 100755
--- a/assets/modul-js/orders/shipping-order/create.min.js
+++ b/assets/modul-js/orders/shipping-order/create.min.js
@@ -98,8 +98,7 @@ var TableDatatablesEditable = function() {
$('.button-previous2').trigger('click');
$('#finish2').remove();
- $('.button-next2').after(' Finish!'); //add input box
- $('#finish2').hide();
+ $('#form-actions').after(' Finish!'); //add input box
$('#rowNo').remove();
$('#form_add').modal('hide');
@@ -386,9 +385,8 @@ var TableDatatablesEditable = function() {
$('#form_wizard_2').append('
| ".getItemBalance($shipping_order_item['id'], $so_id)." | " ."" - ." | " + ." | " ." |
-
-
-
+
+
Select image
@@ -251,6 +245,14 @@ function the_warehouse_arrangement(){
$db->bind("room_id", $room_id);
$db->bind("message_id", $message_id);
$createMembers = $db->query("INSERT INTO notice_room_message(room_id,message_id) VALUES (:room_id, :message_id)");
+
+ $insideRoom = getUserInRoom($room_id);
+ foreach($insideRoom as $key => $value){
+ $db->bind("room_id", $room_id);
+ $db->bind("message_id", $message_id);
+ $db->bind("user_id", $value['user_id']);
+ $createMembers = $db->query("INSERT INTO notice_unread(room_id,message_id,user_id, status) VALUES (:room_id, :message_id,:user_id, 0)");
+ }
if($type == "decision_request"){
//create messages
$db->bind("message", "Decision Requested.");
@@ -288,12 +290,17 @@ function the_warehouse_arrangement(){
$unread_order = "";
}
if(getStatusCompanyFriend($_SESSION['company_id']) > 0 && $_SESSION['group_id'] == 1){
- $unread_contact = getStatusCompanyFriend($_SESSION['company_id']);
+ $unread_contact = getStatusCompanyFriend($_SESSION['company_id']) + getContactUnread();
}else{
- $unread_contact = "";
+ $unread_contact = getContactUnread();
+ }
+ if(getSOUnread() > 0){
+ $unread_so = getSOUnread();
+ }else{
+ $unread_so = "";
}
$output_array = array();
- $output_array[] = array('unread_order' => $unread_order, 'unread_contact' => $unread_contact);
+ $output_array[] = array('unread_order' => $unread_order, 'unread_contact' => $unread_contact, 'unread_so' => $unread_so);
return json_encode( $output_array );
});
diff --git a/modul/arrangements/warehouse/warehouse.tpl.php b/modul/arrangements/warehouse/warehouse.tpl.php
index 55e96d1..2b7a0f2 100755
--- a/modul/arrangements/warehouse/warehouse.tpl.php
+++ b/modul/arrangements/warehouse/warehouse.tpl.php
@@ -76,7 +76,7 @@ th.dt-body-center,
diff --git a/modul/common/dashboard/dashboard.func.php b/modul/common/dashboard/dashboard.func.php
index aa1db77..8fc90e1 100755
--- a/modul/common/dashboard/dashboard.func.php
+++ b/modul/common/dashboard/dashboard.func.php
@@ -36,6 +36,8 @@ function getGeneralStatus($so_id){
return "Delivery Request Completed";
}elseif($daStatus == 4){
return "Order Completed";
+ }elseif($daStatus == 5){
+ return "Delivery Request Rejected";
}
}else{
return "Order Created";
diff --git a/modul/common/dashboard/dashboard.so.list.php b/modul/common/dashboard/dashboard.so.list.php
index c066fe8..54dbbb0 100755
--- a/modul/common/dashboard/dashboard.so.list.php
+++ b/modul/common/dashboard/dashboard.so.list.php
@@ -10,8 +10,7 @@ $requestData= $_REQUEST;
1 => 'created_on',
3 => 'order_no',
4 => 'marking',
- 5 => 'supplier_company_name',
- 6 => 'forwarder_id',
+ 5 => 'supplier_company_name',
);
$count = $data[0]["jumlah"];
$totalData = $count;
@@ -37,7 +36,9 @@ $requestData= $_REQUEST;
$nestedData[] = $value['order_no'];
$nestedData[] = $value['marking'];
$nestedData[] = $value['supplier_company_name'];
- $nestedData[] = getCompanyData($value['forwarder_id'], "company_id", "name");
+ if($_SESSION['group_id'] <> 1){
+ $nestedData[] = getCompanyData($value['forwarder_id'], "company_id", "name");
+ }
$nestedData[] = (getSAData($value['so_id'], "shipment_no") <> "" ? getSAData($value['so_id'], "shipment_no") : "N/A");
$nestedData[] = (getSAData($value['so_id'], "container_no") <> "" ? getSAData($value['so_id'], "container_no") : "N/A");
$nestedData[] = (getWAData($value['so_id'], "warehouse_receive_note_no") <> "" ? getWAData($value['so_id'], "warehouse_receive_note_no") : "N/A");
diff --git a/modul/common/dashboard/dashboard.so.tpl.php b/modul/common/dashboard/dashboard.so.tpl.php
index cf6e86f..5ff171c 100755
--- a/modul/common/dashboard/dashboard.so.tpl.php
+++ b/modul/common/dashboard/dashboard.so.tpl.php
@@ -112,7 +112,9 @@ th.dt-body-center,
-
Unmatched Quantity +Unmatched Quantity
diff --git a/modul/common/contact/companies.tpl.php b/modul/common/contact/companies.tpl.php
index 80519e2..e2831e0 100755
--- a/modul/common/contact/companies.tpl.php
+++ b/modul/common/contact/companies.tpl.php
@@ -10,7 +10,7 @@
diff --git a/modul/common/contact/contact.list.php b/modul/common/contact/contact.list.php
index 8352c20..617f5f2 100755
--- a/modul/common/contact/contact.list.php
+++ b/modul/common/contact/contact.list.php
@@ -15,7 +15,7 @@ $count = $data[0]["jumlah"];
$totalData = $count;
$totalFiltered = $totalData;
-$sql = "SELECT DISTINCT user_detail.first_name as first_name,users.user_id as user_id, users.username as username, groups.name FROM `user_friend` join users on user_friend.friend_id = users.user_id join user_detail on user_friend.friend_id = user_detail.user_id join groups on users.group_id = groups.group_id WHERE user_friend.user_id = '". $_SESSION['user_id'] ."'";
+$sql = "SELECT DISTINCT user_friend.status as status, user_detail.first_name as first_name,users.user_id as user_id, users.username as username, groups.name FROM `user_friend` join users on user_friend.friend_id = users.user_id join user_detail on user_friend.friend_id = user_detail.user_id join groups on users.group_id = groups.group_id WHERE user_friend.user_id = '". $_SESSION['user_id'] ."'";
if( !empty($requestData['columns'][0]['search']['value']) ){ //name
$sql.=" AND user_detail.first_name LIKE '".$requestData['columns'][0]['search']['value']."%' ";
}
@@ -35,12 +35,17 @@ foreach ($data as $key => $value) {
$nestedData = array();
$nestedData[] = "Order No |
Marking |
Supplier |
- Name Forwarder |
+ 1){ ?>
+ Forwarder |
+
Shipment |
No Cont |
No Warehouse |
diff --git a/modul/common/messenger/init.php b/modul/common/messenger/init.php
index a5647a7..a692ec7 100755
--- a/modul/common/messenger/init.php
+++ b/modul/common/messenger/init.php
@@ -53,6 +53,7 @@ function order_css() {
+
@@ -68,12 +69,14 @@ function order_js() {
+
+
-
+
get('message_id');
$decision = $request->get('decision');
+ if( $request->get('reason') && $request->get('scheduled_date')){
+ $reason = $request->get('reason');
+ $scheduled_date = $request->get('scheduled_date');
+ }
+
+ if($request->get('id')){
+ $DAID = $request->get('id');
+
+ }
$db->bind("message_id", $message_id);
+
$data = $db->query("SELECT * FROM `notice_room_message` WHERE message_id = :message_id");
$room_id = $data[0]["room_id"];
@@ -434,38 +447,119 @@ function the_messenger(){
$db->bind("warehouse_arrangement_id", $warehouse_arrangement_id);
$data = $db->query("UPDATE `warehouse_arrangements` SET status = :status WHERE id = :warehouse_arrangement_id");
}
- }
-
- //create messages
- if($decision == 1){
- $text = (getProfileData($_SESSION['user_id'], "first_name") <> "" ? getProfileData($_SESSION['user_id'], "first_name") : get_data($_SESSION['user_id'], "username")) . " have agreed to accept this decision request.";
+
+ //create messages
+ if($decision == 1){
+ $text = (getProfileData($_SESSION['user_id'], "first_name") <> "" ? getProfileData($_SESSION['user_id'], "first_name") : get_data($_SESSION['user_id'], "username")) . " have agreed to accept this decision request.";
+ }else{
+ $text = (getProfileData($_SESSION['user_id'], "first_name") <> "" ? getProfileData($_SESSION['user_id'], "first_name") : get_data($_SESSION['user_id'], "username")) . " have agreed to declined this decision request.";
+ }
+ $db->bind("message", $text);
+ $db->bind("chat_type", "1");
+ $db->bind("from_id", $_SESSION['user_id']);
+ $createMessage = $db->query("INSERT INTO notice_messages(message,chat_type,from_id) VALUES (:message,:chat_type,:from_id)");
+
+ $message_id = $db->lastInsertId();
+
+
+
+ //connecting messages with room
+ $db->bind("room_id", $room_id);
+ $db->bind("message_id", $message_id);
+ $createMembers = $db->query("INSERT INTO notice_room_message(room_id,message_id) VALUES (:room_id, :message_id)");
+
+ //create unread status
+ $MembersInRoom = getUserInRoom($room_id);
+ foreach ($MembersInRoom as $key => $value){
+ if($value['user_id'] <> $_SESSION['user_id']){
+ $db->bind("room_id", $room_id);
+ $db->bind("message_id", $message_id);
+ $db->bind("user_id", $value['user_id']);
+ $createMembers = $db->query("INSERT INTO notice_unread(room_id,message_id,user_id, status) VALUES (:room_id, :message_id,:user_id, 0)");
+ }
+ }
}else{
- $text = (getProfileData($_SESSION['user_id'], "first_name") <> "" ? getProfileData($_SESSION['user_id'], "first_name") : get_data($_SESSION['user_id'], "username")) . " have agreed to declined this decision request.";
- }
- $db->bind("message", $text);
- $db->bind("chat_type", "1");
- $db->bind("from_id", $_SESSION['user_id']);
- $createMessage = $db->query("INSERT INTO notice_messages(message,chat_type,from_id) VALUES (:message,:chat_type,:from_id)");
-
- $message_id = $db->lastInsertId();
-
-
-
- //connecting messages with room
- $db->bind("room_id", $room_id);
- $db->bind("message_id", $message_id);
- $createMembers = $db->query("INSERT INTO notice_room_message(room_id,message_id) VALUES (:room_id, :message_id)");
-
- //create unread status
- $MembersInRoom = getUserInRoom($room_id);
- foreach ($MembersInRoom as $key => $value){
- if($value['user_id'] <> $_SESSION['user_id']){
+ $delivery_arrangement_id = getMessageData($message_id, "delivery_arrangement_id");
+ if($decision == 1){
+ $db->bind("status", "2");
+ $db->bind("delivery_arrangement_id", $delivery_arrangement_id);
+ $data = $db->query("UPDATE `delivery_arrangements` SET status = :status WHERE id = :delivery_arrangement_id");
+ //create messages
+
+ $text = (getProfileData($_SESSION['user_id'], "first_name") <> "" ? getProfileData($_SESSION['user_id'], "first_name") : get_data($_SESSION['user_id'], "username")) . " have agreed to accept this decision request.";
+
+ $db->bind("message", $text);
+ $db->bind("chat_type", "1");
+ $db->bind("from_id", $_SESSION['user_id']);
+ $createMessage = $db->query("INSERT INTO notice_messages(message,chat_type,from_id) VALUES (:message,:chat_type,:from_id)");
+
+ $message_id = $db->lastInsertId();
+
+ //connecting messages with room
$db->bind("room_id", $room_id);
$db->bind("message_id", $message_id);
- $db->bind("user_id", $value['user_id']);
- $createMembers = $db->query("INSERT INTO notice_unread(room_id,message_id,user_id, status) VALUES (:room_id, :message_id,:user_id, 0)");
+ $createMembers = $db->query("INSERT INTO notice_room_message(room_id,message_id) VALUES (:room_id, :message_id)");
+
+ //create unread status
+ $MembersInRoom = getUserInRoom($room_id);
+ foreach ($MembersInRoom as $key => $value){
+ if($value['user_id'] <> $_SESSION['user_id']){
+ $db->bind("room_id", $room_id);
+ $db->bind("message_id", $message_id);
+ $db->bind("user_id", $value['user_id']);
+ $createMembers = $db->query("INSERT INTO notice_unread(room_id,message_id,user_id, status) VALUES (:room_id, :message_id,:user_id, 0)");
+ }
+ }
+
+ //create messages
+ $db->bind("message", "Have you received your goods?");
+ $db->bind("chat_type", "13");
+ $db->bind("decision", 0);
+ $db->bind("decision_type", 1);
+ $db->bind("delivery_arrangement_id", $delivery_arrangement_id);
+ $db->bind("from_id", $_SESSION['user_id']);
+ $createMessage = $db->query("INSERT INTO notice_messages(message,chat_type,from_id, decision, decision_type, delivery_arrangement_id) VALUES (:message,:chat_type,:from_id, :decision, :decision_type, :delivery_arrangement_id)");
+ $message_id = $db->lastInsertId();
+
+ //connecting messages with room
+ $db->bind("room_id", $room_id);
+ $db->bind("message_id", $message_id);
+ $createMembers = $db->query("INSERT INTO notice_room_message(room_id,message_id) VALUES (:room_id, :message_id)");
+ }else{
+ $db->bind("status", "5");
+ $db->bind("delivery_arrangement_id", $delivery_arrangement_id);
+ $data = $db->query("UPDATE `delivery_arrangements` SET status = :status WHERE id = :delivery_arrangement_id");
+
+ //create messages
+ $text = (getProfileData($_SESSION['user_id'], "first_name") <> "" ? getProfileData($_SESSION['user_id'], "first_name") : get_data($_SESSION['user_id'], "username")) . " have agreed to accept this decision request.";
+
+ $db->bind("message", $text);
+ $db->bind("chat_type", "1");
+ $db->bind("from_id", $_SESSION['user_id']);
+ $createMessage = $db->query("INSERT INTO notice_messages(message,chat_type,from_id) VALUES (:message,:chat_type,:from_id)");
+
+ $message_id = $db->lastInsertId();
+
+ //connecting messages with room
+ $db->bind("room_id", $room_id);
+ $db->bind("message_id", $message_id);
+ $createMembers = $db->query("INSERT INTO notice_room_message(room_id,message_id) VALUES (:room_id, :message_id)");
+
+ //create unread status
+ $MembersInRoom = getUserInRoom($room_id);
+ foreach ($MembersInRoom as $key => $value){
+ if($value['user_id'] <> $_SESSION['user_id']){
+ $db->bind("room_id", $room_id);
+ $db->bind("message_id", $message_id);
+ $db->bind("user_id", $value['user_id']);
+ $createMembers = $db->query("INSERT INTO notice_unread(room_id,message_id,user_id, status) VALUES (:room_id, :message_id,:user_id, 0)");
+ }
+ }
}
+
}
+
+
return new Response("SUCCESS", 200);
});
@@ -518,6 +612,127 @@ function the_messenger(){
Recv Note Delivery Arrangement Details+
+
+
+
+
+
+
+
+ '. $delivery_type .' +';
+ if(getDADataFromDAID($delivery_arrangement_id, "delivery_type") == 1 || getDADataFromDAID($delivery_arrangement_id, "delivery_type") == 3 ){
+ $html .= '
+ ';
+ return($html);
+ });
$app->post('/messenger/get-staff', function(Request $request) {
global $db;
$room_id = $request->get('room_id');
@@ -563,7 +778,7 @@ function the_messenger(){
foreach($data as $key => $value){
if(get_data($value['friend_id'], "group_id") == get_data($value['user_id'], "group_id")){
$table .= "
+
+
+
+
+
+
+ '. getDADataFromDAID($delivery_arrangement_id, "delivery_date").' +
+
+
+
+
+ '. getDADataFromDAID($delivery_arrangement_id, "driver_contact_person").' +
+ ';
+ }elseif(getDADataFromDAID($delivery_arrangement_id, "delivery_type") == 2){
+ $html .= '
+
+
+
+
+
+ '. getDADataFromDAID($delivery_arrangement_id, "driver_contact_person_no").' +
+
+
+
+
+ '. getDADataFromDAID($delivery_arrangement_id, "vehicle_no").' +
+
+
+
+
+
+
+ '. getDADataFromDAID($delivery_arrangement_id, "courier_service_name").' +
+ ';
+ }elseif(getDADataFromDAID($delivery_arrangement_id, "delivery_type") == 4){
+ $html .= '
+
+
+
+
+
+ '. getDADataFromDAID($delivery_arrangement_id, "tracking_no").' +
+
+
+
+
+
+
+ '. get_warehouse(getDADataFromDAID($delivery_arrangement_id, "warehouse_id"), "warehouse_name").' +
+
+
+
+
+ '. getDADataFromDAID($delivery_arrangement_id, "warehouse_contact_person").' +
+
+
+
+
+ '. getDADataFromDAID($delivery_arrangement_id, "warehouse_contact_person_no").' +
+ ';
+ }
+ $html .= '
+
+
+
+
+ '. getDADataFromDAID($delivery_arrangement_id, "warehouse_address").' +
+
+
+
+
+ '. getDADataFromDAID($delivery_arrangement_id, "warehouse_zip").' '. getDADataFromDAID($delivery_arrangement_id, "warehouse_city").' +
+
+
+
+
+ '. getDADataFromDAID($delivery_arrangement_id, "warehouse_state").' + |
| ".getProfileData($value['friend_id'], "first_name") . " " . getProfileData($value['user_id'], "last_name")." | +".getProfileData($value['friend_id'], "first_name") . " " . getProfileData($value['friend_id'], "last_name")." | ".get_data($value['friend_id'], "username")." |